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
aca5b30f
Commit
aca5b30f
authored
Oct 20, 2020
by
Mickael Laurent
Browse files
trying some new rules... (wip)
parent
e62ead51
Changes
2
Hide whitespace changes
Inline
Side-by-side
new_system2.tex
View file @
aca5b30f
...
...
@@ -68,14 +68,6 @@ TODO: Which restrictions on types? (cannot test a precise arrow type, etc)
}
{
\Gamma
\vdash
{
a
_
1
}{
a
_
2
}
: t
_
2
}
{
}
\qquad
\Infer
[Split]
{
\Gamma
,(x:t
_
1)
\vdash
e: t
\quad
\Gamma
,(x:t
_
2)
\vdash
e: t
}
{
\Gamma
,(x:t
_
1
\lor
t
_
2)
\vdash
e: t
}
{
}
\\
\Infer
[Case]
{
...
...
@@ -94,10 +86,9 @@ x\in\dom\Gamma\\
% }
% { }
% \\
\Infer
[Let]
\Infer
[Let
Base
]
{
\Gamma\bvdash
{
p
}{
u
}
(
\Gamma
_
u
^
i)
_{
i
\in
I
_
u
}
\\
\forall
i
\in
I
_
u.
\ \Gamma
_
u
^
i,(x:u)
\vdash
e:t
}
\Gamma
,(x:u)
\vdash
e:t
}
{
\Gamma\vdash
_{
u
}
\letexp
x p e : t
}
...
...
@@ -106,34 +97,58 @@ x\in\dom\Gamma\\
\Infer
[LetSplit]
{
\Gamma
,(x:t')
\vdash
e
\triangleright
_
x
\dt\\
\forall
u
\in
\dt
.
\ \Gamma\vdash
_{
u
}
\letexp
x p e : t
}
\forall
u
\in
\dt
.
\ \Gamma\bvdash
{
p
}{
u
}
(
\Gamma
_
u
^
i)
_{
i
\in
I
_
u
}
\\
\forall
u
\in
\dt
.
\ \forall
i
\in
I
_
u.
\ \Gamma
_
u
^
i
\vdash
_{
u
}
\letexp
x p e : t
}
{
\Gamma\vdash
_{
t'
}
\letexp
x p e : t
}
{
}
\\
\Infer
[Let]
{
\Gamma\vdash
p:
t'
\\
\Gamma\vdash
_{
t
'
}
\letexp
x p e : t
}
{
\Gamma\
c
vdash
p:
\{
(t
_
i,
\Gamma
_
i)
\}
_{
i
\in
I
}
\\
\forall
i
\in
I.
\
\Gamma
_
i
\vdash
_{
t
_
i
}
\letexp
x p e : t
}
{
\Gamma\vdash\letexp
x p e : t
}
{
}
\end{mathpar}
\begin{mathpar}
\Infer
[Proj]
{
\Gamma
\vdash
x:
\textstyle\bigcup
_{
j
\in
J
}
\pair
{
t
_
1
^
j
}{
t
_
2
^
j
}}
{
\Gamma
\cvdash
\pi
_
i x:
\{
(t
_
i
^
j,
\Gamma\subst
{
x
}{
\pair
{
t
_
1
^
j
}{
t
_
2
^
j
}}
)
\ \alt\
j
\in
J
\}
}
{
}
\\
\Infer
[App]
{
\Gamma
\vdash
x:
\textstyle\bigcup
_{
i
\in
I
}
t
_
i
\quad
\forall
i
\in
I.
\
t
_
i
\leq
\arrow
{
t
}{
s
_
i
}
\quad
\Gamma
\vdash
a: t
}
{
\Gamma
\cvdash
{
x
}{
a
}
:
\{
(s
_
i,
\Gamma\subst
{
x
}{
t
_
i
}
)
\ \alt\
i
\in
I
\}
}
{
}
\\
\Infer
[Case]
{
\Gamma
_
1 =
\Gamma\subst
{
x
}{
\Gamma
(x)
\land
t
}
\\
\Gamma
_
2 =
\Gamma\subst
{
x
}{
\Gamma
(x)
\land
\neg
t
}
\\
\Gamma
_
1
\vdash
e
_
1:t
_
1
\\
\Gamma
_
2
\vdash
e
_
2:t
_
2
}
{
\Gamma\cvdash
\tcase
{
x
}
t
{
e
_
1
}{
e
_
2
}
:
\{
(t
_
1,
\Gamma
_
1), (t
_
2,
\Gamma
_
2)
\}
}
{
}
\\
\Infer
[NoChoice]
{
\Gamma
\vdash
p:t
}
{
\Gamma
\cvdash
p:
\{
(t,
\Gamma
)
\}
}
{
}
\end{mathpar}
TODO: Inter rule needed?
TODO: Algorithmic rules
TODO: Abs rule must be updated (like the let rule)
TODO: Case rule can suppose that x is a subtype of
$
t
$
or
$
\neg
t
$
?
NOTE: In the algorithmic system, the Split rule can be guaranteed by stronger
typing rules for the application and the typecase: it should return a list of
pair (typ, env). It allows us to consider the two possibilities of a typecase
without making any approximation (and similarly for the application of a union of arrows).
\subsection
{
Candidates generation rules
}
\begin{mathpar}
...
...
@@ -155,7 +170,7 @@ without making any approximation (and similarly for the application of a union o
\Gamma\vdash\lambda
y:s.
\
e
\triangleright
_
x
\dt
}
{
x
\neq
y
}
\vspace
{
-2.3mm
}
\\
\\
\Infer
[Pair]
{
\Gamma
\vdash
a
_
1
\triangleright
_
x
\dt
_
1
\and
\Gamma
\vdash
a
_
2
\triangleright
_
x
\dt
_
2
}
{
\Gamma
\vdash
(a
_
1,a
_
2)
\triangleright
_
x
\{
t
_
1
\land
t
_
2
\
|
\
t
_
1
\in\dt
_
1, t
_
2
\in\dt
_
2
\}
}
...
...
@@ -165,13 +180,13 @@ without making any approximation (and similarly for the application of a union o
{
\Gamma
\vdash
a
\triangleright
_
x
\dt
}
{
\Gamma
\vdash
\pi
_
i a
\triangleright
_
x
\dt
}
{}
\vspace
{
-2.3mm
}
\\
\\
\Infer
[CaseTest]
{
}
{
\Gamma\vdash
\tcase
{
x
}{
t
}{
e
_
1
}{
e
_
2
}
\triangleright
_
x
\{\Gamma
(x)
\land
t,
\Gamma
(x)
\land\neg
t
\}
}
{}
\vspace
{
-2.3mm
}
\\
\\
\Infer
[CaseRec1]
{
\Gamma\vdash
e
_
1
\triangleright
_
x
\dt\\
\Gamma
(y)
\leq
t
}
...
...
@@ -183,15 +198,7 @@ without making any approximation (and similarly for the application of a union o
\Gamma
(y)
\leq
\neg
t
}
{
\Gamma\vdash
\tcase
{
y
}{
t
}{
e
_
1
}{
e
_
2
}
\triangleright
_
x
\dt
}
{}
\vspace
{
-2.3mm
}
\\
\Infer
[Split]
{
\Gamma
,(y:t
_
1)
\vdash
e
\triangleright
_
x
\dt
_
1
\quad
\Gamma
,(y:t
_
2)
\vdash
e
\triangleright
_
x
\dt
_
2
}
{
\Gamma
,(y:t
_
1
\lor
t
_
2)
\vdash
e
\triangleright
_
x
\{
t
_
1
\land
t
_
2
\
|
\
t
_
1
\in\dt
_
1, t
_
2
\in\dt
_
2
\}
}
{
y
\neq
x
}
\vspace
{
-2.3mm
}
\\
\\
% \Infer[App]
% {
% \Gamma \vdash a_1 : \textstyle{\bigvee \bigwedge_{i \in I}s_i\to t_i}\\
...
...
@@ -201,30 +208,58 @@ without making any approximation (and similarly for the application of a union o
% { \Gamma \vdash a_1 a_2\triangleright_x\dt_1\cup\textstyle{\bigcup_{i\in I}
% \bigcup_{j\in J_i}\{\Gamma_i^j(x)\}} }
% {}
% \vspace{-2.3mm}\\
\Infer
[Let]
{
\Gamma
\vdash
p: t
\\
\Gamma
, (y:t)
\vdash
e
\triangleright
_
x
\dt
}
{
\Gamma
\vdash\letexp
{
y
}{
p
}{
e
}
\triangleright
_
x
\dt
}
{}
\vspace
{
-2.3mm
}
\\
\Infer
[Let]
{
\Gamma
\vdash
p: t
\\
\Gamma
, (y:t)
\vdash
e
\triangleright
_
y
\dt
_
y
\\
\forall
u
\in
\dt
_
y.
\ \Gamma\fvdash
{
p
}{
u
}
\{\Gamma
_
u
^
i
\}
_{
i
\in
I
_
u
}
}
{
\Gamma
\vdash\letexp
{
y
}{
p
}{
e
}
\triangleright
_
x
\textstyle
{
\bigcup
_{
u
\in
\dt
_
y
}
\bigcup
_{
i
\in
I
_
u
}
\{\Gamma
_
u
^
i(x)
\}
}}
{}
% \\
% \Infer[Let]
% {
% \Gamma \cvdash p: \{(t_i,\Gamma_i)\}_{i\in I}\\
% \Gamma, (y:t) \vdash e\triangleright_x\dt
% }
% { \Gamma \vdash\letexp{y}{p}{e}\triangleright_x\dt
% }
% {}
% \\
% \Infer[Let]
% {
% \Gamma \vdash p: t\\
% \Gamma, (y:t) \vdash e\triangleright_y\dt_y\\
% \forall u\in \dt_y.\ \Gamma\fvdash{p}{u}\{\Gamma_u^i\}_{i\in I_u}
% }
% { \Gamma \vdash\letexp{y}{p}{e}\triangleright_x\textstyle{
% \bigcup_{u\in \dt_y}\bigcup_{i\in I_u}\{\Gamma_u^i(x)\}
% }}
% {}
% \\
\Infer
[LetBase]
{
\Gamma
, (y:u)
\vdash
e
\triangleright
_
y
\dt\\
\forall
v
\in
\dt
.
\ \Gamma\fvdash
{
p
}{
v
}
\{\Gamma
_
v
^
i
\}
_{
i
\in
I
_
v
}
}{
\Gamma\vdash
_{
u
}
\letexp
y p e
\triangleright
_
x
\textstyle
{
\bigcup
_{
v
\in
\dt
}
\bigcup
_{
i
\in
I
_
v
}
\{\Gamma
_
v
^
i(x)
\}
}}
{
}
\\
\Infer
[LetSplit]
{
\Gamma
,(y:t')
\vdash
e
\triangleright
_
y
\dt\\
\forall
u
\in
\dt
.
\ \Gamma\bvdash
{
p
}{
u
}
(
\Gamma
_
u
^
i)
_{
i
\in
I
_
u
}
\\
\forall
u
\in
\dt
.
\ \forall
i
\in
I
_
u.
\ \Gamma
_
u
^
i
\vdash
_{
u
}
\letexp
x p e
\triangleright
_
x
\dt
_
u
^
i
}
{
\Gamma\vdash
_{
t'
}
\letexp
y p e
\triangleright
_
x
\textstyle\bigcup
_{
u
\in
\dt
}
\bigcup
_{
i
\in
I
_
u
}
\dt
_
u
^
i
}
{
}
\\
\Infer
[Let]
{
\Gamma\cvdash
p:
\{
(t
_
i,
\Gamma
_
i)
\}
_{
i
\in
I
}
\\
\forall
i
\in
I.
\ \Gamma
_
i
\vdash
_{
t
_
i
}
\letexp
x p e
\triangleright
_
x
\dt
_
i
}
{
\Gamma\vdash\letexp
y p e
\triangleright
_
x
\textstyle\bigcup
_{
i
\in
I
}
\dt
_
i
}
{
}
\end{mathpar}
TODO: Fix the second Let rule (it does not allow to split the type of
$
y
$
when necessary
+ does the result cover all the initial domain of
$
x
$
??)
TODO: Fix the second Let rule (does the result cover all the initial domain of
$
x
$
??)
TODO: App rule must be updated (like the let rule)
...
...
setup.sty
View file @
aca5b30f
...
...
@@ -287,6 +287,7 @@
\newcommand
{
\dt
}
[0]
{
\mathbb
{
T
}}
\newcommand
{
\fvdash
}
[2]
{
\vdash
^{
\texttt
{
Env
}
\rightarrow
}_{
#1,#2
}}
\newcommand
{
\bvdash
}
[2]
{
\vdash
^{
\texttt
{
Env
}
\leftarrow
}_{
#1,#2
}}
\newcommand
{
\cvdash
}
[0]
{
\vdash
^{
\texttt
{
Choices
}}}
\makeatletter
% allow us to mention @-commands
\def\arcr
{
\@
arraycr
}
...
...
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