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
c2af93d5
Commit
c2af93d5
authored
Oct 22, 2020
by
Mickael Laurent
Browse files
trying some new rules... (wip)
parent
d14fcc6e
Changes
1
Hide whitespace changes
Inline
Side-by-side
new_system2.tex
View file @
c2af93d5
...
...
@@ -9,16 +9,13 @@
\begin{equation}
\label
{
expressions2
}
\begin{array}
{
lrclr
}
\textbf
{
Atomic Expr
}
&
a
&
::=
&
c
\alt
x
\alt\lambda
x:t.e
\alt
(a,a)
\\
[.3mm]
\textbf
{
U-Expr
}
&
u
&
::=
&
a a
\alt
\tcase
{
x
}{
t
}{
e
}{
e
}
\alt
\pi
_
i
a
\\
[.3mm]
\textbf
{
U-Expr
}
&
u
&
::=
&
x x
\alt
\tcase
{
x
}{
t
}{
e
}{
e
}
\alt
\pi
_
i
x
\\
[.3mm]
\textbf
{
P-Expr
}
&
p
&
::=
&
u
\alt
a
\\
[.3mm]
\textbf
{
Expressions
}
&
e
&
::=
&
\letexp
{
x
}{
p
}{
e
}
\alt
p
\\
[.3mm]
\textbf
{
Values
}
&
v
&
::=
&
c
\alt\lambda
x:t.e
\alt
(v,v)
\\
\end{array}
\end{equation}
TODO: Only allow variables and both sides of a application / projection? It would simplify
rules...
TODO: the then and else expressions of typecases have no associated variable,
altough the env refinement rules could refine their types...
Is this an issue? Should we require an atomic in the then and else branchs
...
...
@@ -55,8 +52,8 @@ TODO: Which restrictions on types? (cannot test a precise arrow type, etc)
{
}
\qquad
\Infer
[Proj]
{
\Gamma
\vdash
a
:
\pair
{
t
_
1
}{
t
_
2
}}
{
\Gamma
\vdash
\pi
_
i
a
:t
_
i
}
{
\Gamma
\vdash
x
:
\pair
{
t
_
1
}{
t
_
2
}}
{
\Gamma
\vdash
\pi
_
i
x
:t
_
i
}
{
}
\qquad
\Infer
[Pair]
...
...
@@ -66,19 +63,18 @@ TODO: Which restrictions on types? (cannot test a precise arrow type, etc)
\\
\Infer
[App]
{
\Gamma
\vdash
a
_
1:
\arrow
{
t
_
1
}{
t
_
2
}
\quad
\Gamma
\vdash
a
_
2: t
_
1
\Gamma
\vdash
x
_
1:
\arrow
{
t
_
1
}{
t
_
2
}
\quad
\Gamma
\vdash
x
_
2: t
_
1
}
{
\Gamma
\vdash
{
a
_
1
}{
a
_
2
}
: t
_
2
}
{
\Gamma
\vdash
{
x
_
1
}{
x
_
2
}
: t
_
2
}
{
}
\\
\Infer
[Case]
{
x
\in\dom\Gamma\\
\Gamma\subst
{
x
}{
\Gamma
(x)
\land
t
}
\vdash
e
_
1:t'
\\
\Gamma\subst
{
x
}{
\Gamma
(x)
\land
\neg
t
}
\vdash
e
_
2:t'
}
{
\Gamma\vdash
\tcase
{
x
}
t
{
e
_
1
}{
e
_
2
}
: t'
}
{
}
{
x
\in\dom\Gamma
}
\\
\Infer
[AbsBase]
{
...
...
@@ -135,21 +131,21 @@ x\in\dom\Gamma\\
\end{mathpar}
\begin{mathpar}
\Infer
[Proj]
\Infer
[Proj
C
]
{
\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]
\Infer
[App
C
]
{
\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
\vdash
y
: t
}
{
\Gamma
\cvdash
{
x
}{
a
}
:
\{
(s
_
i,
\Gamma\subst
{
x
}{
t
_
i
}
)
\ \alt\
i
\in
I
\}
}
{
\Gamma
\cvdash
{
x
}{
y
}
:
\{
(s
_
i,
\Gamma\subst
{
x
}{
t
_
i
}
)
\ \alt\
i
\in
I
\}
}
{
}
\\
\Infer
[Case]
\Infer
[Case
C
]
{
\Gamma
_
1 =
\Gamma\subst
{
x
}{
\Gamma
(x)
\land
t
}
\\
\Gamma
_
2 =
\Gamma\subst
{
x
}{
\Gamma
(x)
\land
\neg
t
}
\\
...
...
@@ -158,9 +154,9 @@ x\in\dom\Gamma\\
{
\Gamma\cvdash
\tcase
{
x
}
t
{
e
_
1
}{
e
_
2
}
:
\{
(t
_
1,
\Gamma
_
1), (t
_
2,
\Gamma
_
2)
\}
}
{
}
\\
\Infer
[
NoCho
ic
e
]
{
\Gamma
\vdash
p
:t
}
{
\Gamma
\cvdash
p
:
\{
(t,
\Gamma
)
\}
}
\Infer
[
Atom
ic
C
]
{
\Gamma
\vdash
a
:t
}
{
\Gamma
\cvdash
a
:
\{
(t,
\Gamma
)
\}
}
{
}
\end{mathpar}
...
...
@@ -168,6 +164,9 @@ TODO: Inter rule needed?
TODO: Algorithmic rules
TODO: AppC rule: what about the argument? We could loose precision there...
In the end, these rules look quite similar to the candidate generation rules.
\subsection
{
Candidates generation rules
}
\begin{mathpar}
...
...
@@ -213,15 +212,15 @@ TODO: Algorithmic rules
{
\Gamma
\vdash
(a
_
1,a
_
2)
\triangleright
_
x
\dt
}
{}
\hfill
\Infer
[Proj
Var
]
\Infer
[Proj
X
]
{
\Gamma
\vdash
x:
\textstyle
{
\bigvee
_{
i
\in
I
}
t
_
i
}}
{
\Gamma
\vdash
\pi
_
i x
\triangleright
_
x
\textstyle
{
\bigcup
_{
i
\in
I
}
\{
t
_
i
\}
}}
{}
\hfill
\Infer
[Proj]
{
\Gamma
\vdash
a
\triangleright
_
x
\dt
}
{
\Gamma
\vdash
\pi
_
i
a
\triangleright
_
x
\
dt
}
{}
{
}
{
\Gamma
\vdash
\pi
_
i
y
\triangleright
_
x
\
{\}
}
{
y
\neq
x
}
\\
\Infer
[CaseTest]
{
}
...
...
@@ -245,20 +244,19 @@ TODO: Algorithmic rules
{
\Gamma
\vdash
x :
\textstyle
{
\bigvee
_{
i
\in
I
}
t
_
i
}
}
{
\Gamma
\vdash
x
a
\triangleright
_
x
\textstyle
{
\bigcup
_{
i
\in
I
}
\{
t
_
i
\}
}}
{
\Gamma
\vdash
x
y
\triangleright
_
x
\textstyle
{
\bigcup
_{
i
\in
I
}
\{
t
_
i
\}
}}
{}
\qquad
\Infer
[AppVar2]
{
\Gamma
\vdash
a
:
\textstyle
{
\bigwedge
_{
i
\in
I
}
s
_
i
\to
t
_
i
}
\Gamma
\vdash
y
:
\textstyle
{
\bigwedge
_{
i
\in
I
}
s
_
i
\to
t
_
i
}
}
{
\Gamma
\vdash
a
x
\triangleright
_
x
\textstyle
{
\bigcup
_{
i
\in
I
}
\{
s
_
i
\}
}}
{
\Gamma
\vdash
y
x
\triangleright
_
x
\textstyle
{
\bigcup
_{
i
\in
I
}
\{
s
_
i
\}
}}
{}
\qquad
\Infer
[App]
{
i
\in\{
1,2
\}\\
\Gamma
\vdash
a
_
i
\triangleright
_
x
\dt
}
{
\Gamma
\vdash
a
_
1 a
_
2
\triangleright
_
x
\dt
}
{
}
{
\Gamma
\vdash
y z
\triangleright
_
x
\{\}
}
{}
\\
\Infer
[LetBase]
...
...
@@ -294,6 +292,9 @@ TODO: Algorithmic rules
TODO: Candidates for a variable should be a special "all splits".
Otherwise,
$
\letexp
{
x
}{
\cdots
}{
x
}$
will never be splitted.
TODO: Proj: Actually, all the possible types of the first component should be candidates
(similar to the Var case)
\subsection
{
Forward refinement rules
}
\subsection
{
Backward refinement rules
}
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