Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Giuseppe Castagna
occurrence-typing
Commits
afb78ba0
Commit
afb78ba0
authored
Nov 16, 2020
by
Mickael Laurent
Browse files
add backward typing rules
parent
8b106db5
Changes
1
Hide whitespace changes
Inline
Side-by-side
new_system3.tex
View file @
afb78ba0
...
...
@@ -269,13 +269,105 @@ rules, because one branch is already unreachable and retyping only occurs with s
\Infer
[LetRefine]
{
\Gamma\land\Gammap\bvdash
{
a
}{
\Gamma
(x)
\land\Gammap
(x)
}
\{
(t
_
i,
\Gamma
_
i)
\}
_{
i
\in
I
}
\\
\forall
i
\in
I.
\ \Gamma\subst
{
x
}{
t
_
i
}
\avdash
{
\Gamma
_
i
\setminus\{
x
\}
}{
[]
}
\ct
[\letexp x a e]
: S
_
i
}
\forall
i
\in
I.
\ \Gamma\subst
{
x
}{
t
_
i
}
\avdash
{
(
\Gammap\land
\Gamma
_
i
)
\setminus\{
x
\}
}{
[]
}
\ct
[\letexp x a e]
: S
_
i
}
{
\Gamma\avdash\Gammap\ct\letexp
x a e :
\textstyle\bigcup
_{
i
\in
I
}
S
_
i
}
{
x
\in\dom\Gamma
\text
{
and
}
x
\in\dom\Gammap
\text
{
and
}
\Gamma
(x)
\not\leq
\Gammap
(x)
}
\end{mathpar}
TODO: Check let rule
and optimize
$
\Gammap
$
(it should be minimal but it isn't as output of
$
\bvdash
{
t
}{
a
}$
)
TODO: Check let rule
TODO: Abs rules
\subsection
{
Backward typing rules
}
\begin{mathpar}
\Infer
[Var]
{
}
{
\Gamma\bvdash
x t
\{
(t,
\subst
{
x
}{
t
}
)
\}
}
{
}
\qquad
\Infer
[Const]
{
}
{
\Gamma\bvdash
c t
\{
(t,
\{\}
)
\}
}
{
}
\\
\Infer
[Inter]
{
\Gamma\vdash
e:t'
\\
\Gamma\bvdash
e
{
t
\wedge
t'
}
\{
(t
_
i,
\Gamma
_
i)
\}
_{
i
\in
I
}}
{
\Gamma\bvdash
e t
\{
(t
_
i,
\Gamma
_
i)
\}
_{
i
\in
I
}}
{
}
\qquad
\Infer
[EFQ]
{
\Gamma\bvdash
e t
\{
(t
_
i,
\Gamma
_
i)
\}
_{
i
\in
I
}
\cup\{
(
\Empty
,
\Gamma
')
\}
}
{
\Gamma\bvdash
e t
\{
(t
_
i,
\Gamma
_
i)
\}
_{
i
\in
I
}}
{
}
\\
\Infer
[Pair]
{
\forall
i
\in
I.
\ \Gamma
_
1
^
i =
\subst
{
x
_
1
}{
t
_
i
}
\\
\forall
i
\in
I.
\ \Gamma
_
2
^
i =
\subst
{
x
_
2
}{
s
_
i
}
}
{
\Gamma\bvdash
{
(x
_
1,x
_
2)
}
{
\bigcup
_{
i
\in
I
}
(t
_
i,s
_
i)
}
\bigcup
_{
i
\in
I
}
\{
(
\pair
{
t
_
i
}{
s
_
i
}
,
\Gamma
_
1
^
i
\land\Gamma
_
2
^
i)
\}
}
{
}
\\
\Infer
[Proj]
{
i = 1
\Rightarrow
t' =
\pair
{
t
}{
\Any
}
\\
i = 2
\Rightarrow
t' =
\pair
{
\Any
}{
t
}
}
{
\Gamma\bvdash
{
\pi
_
i x
}{
t
}
\{
(t,
\subst
{
x
}{
\Gamma
(x)
\land
t'
}
)
\}
}
{
}
\\
\Infer
[App]
{
\Gamma
(x
_
1)
\equiv\bigvee
_{
i
\in
I
}
u
_
i
\\
\Gamma
(x
_
2)=t'
\\
\forall
i
\in
I.
\
u
_
i
\leq
\arrow
{
\neg
t
_
i
}{
s
_
i
}
\text
{
with
}
s
_
i
\land
t =
\varnothing
\\
\forall
i
\in
I.
\ \Gamma
_
1
^
i =
\subst
{
x
_
1
}{
u
_
i
}
\\
\forall
i
\in
I.
\ \Gamma
_
2
^
i =
\subst
{
x
_
2
}{
t
_
i
\land
t'
}
\\
\forall
i
\in
I.
\
u
_
i
\leq\arrow
{
(t
_
i
\land
t')
}{
s
_
i
}}
{
\Gamma\bvdash
{
(x
_
1
\
x
_
2)
}
{
t
}
\bigcup
_{
i
\in
I
}
\{
(s
_
i,
\Gamma
_{
1
}^
i
\land\Gamma
_{
2
}^
i)
\}
}
{
}
\\
\Infer
[Case]
{
\Gamma\subst
{
x
}{
t
_
x
\land\Gamma
(x)
}
\bvdash
{
e
_
1
}
{
t
}
\{
(t
_
i,
\Gamma
_
1
^
i)
\}
_{
i
\in
I
}
\\
\Gamma\subst
{
x
}{
\neg
t
_
x
\land\Gamma
(x)
}
\bvdash
{
e
_
2
}
{
t
}
\{
(s
_
j,
\Gamma
_
2
^
j)
\}
_{
j
\in
J
}}
{
\Gamma\bvdash
{
\tcase
{
x
}
{
t
_
x
}
{
e
_
1
}{
e
_
2
}}{
t
}
\{
(t
_
i,
\Gamma
_
1
^
i
\subst
{
x
}{
t
_
x
\land\Gamma
_
1
^
i(x)
}
)
\}
_{
i
\in
I
}
\cup
\{
(s
_
j,
\Gamma
_
2
^
j
\subst
{
x
}{
\neg
t
_
x
\land\Gamma
_
2
^
j(x)
}
)
\}
_{
j
\in
J
}}
{
}
\\
\Infer
[Abs]
{
}
{
\Gamma\bvdash
{
\lambda
x:s.
\
e
}{
t
}
\{
(t,
\{\}
)
\}
}
{
}
\qquad
\Infer
[Abs-]
{
t
\leq
\arrow
{
t
_
1
}{
t
_
2
}
\\
t
_
1
\not\leq
s
}
{
\Gamma\bvdash
{
\lambda
x:s.
\
e
}{
t
}
\{\}
}
{
}
\\
\Infer
[Let]
{
\Gamma\bvdash
{
e
}{
t
}
\{
(t
_
i,
\Gamma
_
i)
\}
_{
i
\in
I
}
\\
\forall
i
\in
I.
\ \Gamma\land\Gamma
_
i
\bvdash
{
a
}{
\Gamma\land\Gamma
_
i)(x)
}
\{
(t
_
i
^
j,
\Gamma
_
i
^
j)
\}
_{
j
\in
J
_
i
}
}
{
\Gamma\bvdash
{
\letexp
{
x
}{
a
}{
e
}}{
t
}
\{
(t
_
i,
\Gamma
_
i
\land\Gamma
_
i
^
j)
\ \alt\
i
\in
I,
\
j
\in
J
_
i
\}
}
{
}
\end{mathpar}
NOTE: For the Let rule: as the expression
$
a
$
has been typed before backtyping,
the environment is supposed to already contain a type for
$
x
$
.
TODO: Simplify Case rule: as the expression has been typed before backtyping,
$
x
$
is supposed to be included into
$
t
_
x
$
or
$
\neg
t
_
x
$
.
TODO: Improve Abs rule
TODO: Algorithmic App, Inter and EFQ rule
TODO: Is the Comp rule needed in this new setting where every application is alone in a let,
and where union-arrow app are backtyped by splitting possibilities?
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment