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
9d53d224
Commit
9d53d224
authored
Nov 23, 2020
by
Mickael Laurent
Browse files
simplify backtyping
parent
2394f896
Changes
1
Hide whitespace changes
Inline
Side-by-side
new_system3.tex
View file @
9d53d224
...
...
@@ -113,6 +113,13 @@ TODO: Theorems and proof: no need for rule Inter, etc.
\subsection
{
Algorithmic type system
}
\begin{eqnarray*}
\dom
{
t
}
&
=
&
\bigwedge
_{
i
\in
I
}
\bigvee
_{
p
\in
P
_
i
}
s
_
p
\\
[4mm]
\apply
t s
&
=
&
\bigvee
_{
i
\in
I
}
\left
(
\bigvee
_{
\{
Q
\subsetneq
P
_
i
\alt
s
\not\leq\bigvee
_{
q
\in
Q
}
s
_
q
\}
}
\left
(
\bigwedge
_{
p
\in
P
_
i
\setminus
Q
}
t
_
p
\right
)
\right
)
\hspace*
{
1cm
}
\makebox
[0cm][l]
{
(for
$
s
\leq\dom
{
t
}$
)
}
\\
[4mm]
%\worra t s & = & \dom t \wedge\bigvee_{i\in I}\left(\bigwedge_{\{P \subseteq P_i\alt s \leq \bigvee_{p \in P} \neg t_p\}} \left(\bigvee_{p \in P} \neg s_p \right)\right)\\[4mm]
\worra
t s
&
=
&
\left\{\left
(
\bigwedge
_{
p
\in
P
_
i
}
(s
_
p
\to
t
_
p)
\bigwedge
_{
n
\in
N
_
i
}
\neg
(s
_
n'
\to
t
_
n'),
\ \dom
t
\wedge\bigwedge
_{
\{
P
\subseteq
P
_
i
\alt
s
\leq
\bigvee
_{
p
\in
P
}
\neg
t
_
p
\}
}
\left
(
\bigvee
_{
p
\in
P
}
\neg
s
_
p
\right
)
\right
)
\
|
\
i
\in
I
\right\}
\end{eqnarray*}
The elements of
$
\Gamma\avdash\Gammap\ct
e:S
$
mean:
\begin{itemize}
\item
$
\Gamma
$
is the environment: it associates to some variables their associated type,
...
...
@@ -297,6 +304,16 @@ rules, because one branch is already unreachable and retyping only occurs with s
\subsection
{
Backward refinement rules
}
\begin{mathpar}
% \Infer[Inter]
% {\Gamma\vdash e:t' \\ \Gamma\bvdash e {t\wedge t'} \Gammas}
% {\Gamma\bvdash e t \Gammas}
% { }
% \qquad
\Infer
[Normalize]
{
\Gamma\bvdash
e t
\Gammas\cup\{\Gamma
'
\}\\\exists
x
\in\dom
{
\Gamma
'
}
.
\ \Gamma
'(x)=
\Empty
}
{
\Gamma\bvdash
e t
\Gammas
}
{
}
\\
\Infer
[Var]
{
}
{
\Gamma\bvdash
x t
\{\{
x:t
\}\}
}
...
...
@@ -306,16 +323,6 @@ rules, because one branch is already unreachable and retyping only occurs with s
{
}
{
\Gamma\bvdash
c t
\{\{\}\}
}
{
}
\\
% \Infer[Inter]
% {\Gamma\vdash e:t' \\ \Gamma\bvdash e {t\wedge t'} \Gammas}
% {\Gamma\bvdash e t \Gammas}
% { }
% \qquad
\Infer
[Normalize]
{
\Gamma\bvdash
e t
\Gammas\cup\{\Gamma
'
\}\\\exists
x
\in\dom
{
\Gamma
'
}
.
\ \Gamma
'(x)=
\Empty
}
{
\Gamma\bvdash
e t
\Gammas
}
{
}
\\
\Infer
[Pair]
{
...
...
@@ -336,8 +343,7 @@ rules, because one branch is already unreachable and retyping only occurs with s
{
}
\\
\Infer
[App]
{
\Gamma
(x
_
1)
\equiv\textstyle\bigvee
_{
i
\in
I
}
u
_
i
\\
\forall
i
\in
I.
\
u
_
i
\leq
\arrow
{
\neg
t
_
i
}{
s
_
i
}
\text
{
with
}
s
_
i
\land
t =
\varnothing
\\
{
\worra
{
\Gamma
(x
_
1)
}
t =
\{
(u
_
i, t
_
i)
\}
_{
i
\in
I
}
\\
\forall
i
\in
I.
\ \Gamma
_
1
^
i =
\subst
{
x
_
1
}{
u
_
i
}
\\
\forall
i
\in
I.
\ \Gamma
_
2
^
i =
\subst
{
x
_
2
}{
t
_
i
}
}
...
...
@@ -382,10 +388,21 @@ rules, because one branch is already unreachable and retyping only occurs with s
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
$
.
\begin{mathpar}
\Infer
[App]
{
\Gamma
(x
_
1)
\equiv\textstyle\bigvee
_{
i
\in
I
}
u
_
i
\\
\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
}
}
{
\Gamma\bvdash
{
(x
_
1
\
x
_
2)
}
{
t
}
\textstyle\bigcup
_{
i
\in
I
}
\{\Gamma
_{
1
}^
i
\land\Gamma
_{
2
}^
i
\}
}
{
}
\end{mathpar}
TODO: Algorithmic App, Inter and EFQ rule
TODO: Simplify Case and Let rule: as the expression has been typed before backtyping,
$
x
$
is supposed to be included into
$
t
_
x
$
or
$
\neg
t
_
x
$
.
\subsection
{
Algorithmic typing rules (alternative attempt)
}
...
...
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