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
e62ead51
Commit
e62ead51
authored
Oct 20, 2020
by
Mickael Laurent
Browse files
trying some new rules... (wip)
parent
aeda9f51
Changes
1
Hide whitespace changes
Inline
Side-by-side
new_system2.tex
View file @
e62ead51
...
...
@@ -85,15 +85,15 @@ x\in\dom\Gamma\\
{
\Gamma\vdash
\tcase
{
x
}
t
{
e
_
1
}{
e
_
2
}
: t'
}
{
}
\\
\Infer
[Abs]
{
\Gamma
,(x:s)
\vdash
e
\triangleright
_
x
\dt\\
\textstyle
{
\dt
'=
\dt\cup\left\{
s
\setminus\bigcup
_{
s'
\in\dt
}
s'
\right\}
}
\\
T=
\{
(s',t')
\,
|
\,
s'
\in\dt
'
\text
{
and
}
\Gamma
,(x:s')
\vdash
e:t'
\}
}
{
\Gamma\vdash\lambda
x:s.e:
\textstyle
\bigwedge
_{
(s',t')
\in
T
}
\arrow
{
s'
}
{
t'
}
}
{
}
\\
%
\Infer[Abs]
%
{\Gamma,(x:s)\vdash e\triangleright_x \dt\\
%
\textstyle {\dt'=\dt\cup\left\{s\setminus\bigcup_{s'\in\dt}s'\right\}}\\
%
T=\{(s',t')\,|\,s'\in\dt' \text{ and } \Gamma,(x:s')\vdash e:t'\}}
%
{
%
\Gamma\vdash\lambda x:s.e:\textstyle \bigwedge_{(s',t')\in T}\arrow {s'} {t'}
%
}
%
{ }
%
\\
\Infer
[Let]
{
\Gamma\bvdash
{
p
}{
u
}
(
\Gamma
_
u
^
i)
_{
i
\in
I
_
u
}
\\
...
...
@@ -125,6 +125,10 @@ 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
...
...
@@ -136,13 +140,13 @@ without making any approximation (and similarly for the application of a union o
\Infer
[Var]
{
}
{
\Gamma
\vdash
y
\triangleright
_
x
\
varnothing
}
{
\Gamma
\vdash
y
\triangleright
_
x
\
{\Gamma
(x)
\}
}
{}
\hfill
\Infer
[Const]
{
}
{
\Gamma
\vdash
c
\triangleright
_
x
\
varnothing
}
{
\Gamma
\vdash
c
\triangleright
_
x
\
{\Gamma
(x)
\}
}
{}
\hfill
\Infer
[Abs]
...
...
@@ -154,7 +158,7 @@ without making any approximation (and similarly for the application of a union o
\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
\
d
t
_
1
\
cup
\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
\}
}
{}
\hfill
\Infer
[Proj]
...
...
@@ -162,41 +166,68 @@ without making any approximation (and similarly for the application of a union o
{
\Gamma
\vdash
\pi
_
i a
\triangleright
_
x
\dt
}
{}
\vspace
{
-2.3mm
}
\\
\Infer
[Case]
{
\Gamma\subst
{
y
}{
\Gamma
(y)
\land
t
}
\vdash
e
_
1
\triangleright
_
x
\dt
_
1
\\
\Gamma\subst
{
y
}{
\Gamma
(y)
\land
\neg
t
}
\vdash
e
_
2
\triangleright
_
x
\dt
_
2
}
{
\Gamma\vdash
\tcase
{
y
}{
t
}{
e
_
1
}{
e
_
2
}
\triangleright
_
x
\dt
_
1
\cup\dt
_
2
\cup
\left\{
\begin{array}
{
l
}
\{\Gamma
(x)
\land
t,
\Gamma
(x)
\land\neg
t
\}
\text
{
if
}
y=x
\arcr
\varnothing\text
{
otherwise
}
\end{array}
\right
.
}
\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
[App]
\Infer
[CaseRec1]
{
\Gamma\vdash
e
_
1
\triangleright
_
x
\dt\\
\Gamma
(y)
\leq
t
}
{
\Gamma\vdash
\tcase
{
y
}{
t
}{
e
_
1
}{
e
_
2
}
\triangleright
_
x
\dt
}
{}
\qquad
\Infer
[CaseRec2]
{
\Gamma\vdash
e
_
2
\triangleright
_
x
\dt\\
\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}\\
% \Gamma \vdash a_1\triangleright_x\dt_1\\
% \forall i\in I.\ \Gamma\fvdash{a_2}{s_i}\{\Gamma_i^j\}_{j\in J_i}
% }
% { \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
a
_
1 :
\textstyle
{
\bigvee
\bigwedge
_{
i
\in
I
}
s
_
i
\to
t
_
i
}
\\
\Gamma
\vdash
a
_
1
\triangleright
_
x
\dt
_
1
\\
\forall
i
\in
I.
\ \Gamma\fvdash
{
a
_
2
}{
s
_
i
}
\{\Gamma
_
i
^
j
\}
_{
j
\in
J
_
i
}
\Gamma
\vdash
p: t
\\
\Gamma
, (y:t)
\vdash
e
\triangleright
_
x
\dt
}
{
\Gamma
\vdash\letexp
{
y
}{
p
}{
e
}
\triangleright
_
x
\dt
}
{
\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
}
\\
\vspace
{
-2.3mm
}
\\
\Infer
[Let]
{
\Gamma
\vdash
p: t
\\
\Gamma
, (y:t)
\vdash
e
\triangleright
_
x
\dt
_
x
\\
\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
\
dt
_
x
\cup\
textstyle
{
{
\Gamma
\vdash\letexp
{
y
}{
p
}{
e
}
\triangleright
_
x
\textstyle
{
\bigcup
_{
u
\in
\dt
_
y
}
\bigcup
_{
i
\in
I
_
u
}
\{\Gamma
_
u
^
i(x)
\}
}}
{}
\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: App rule must be updated (like the let rule)
TODO: example: application
$
x y
$
with
$
x
$
an union of arrow. Candidates
for
$
x
$
should be all the different union of arrows of its type?
...
...
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