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
3c6c2c26
Commit
3c6c2c26
authored
Nov 24, 2020
by
Giuseppe Castagna
Browse files
Added declarative rules
parent
af650565
Changes
2
Hide whitespace changes
Inline
Side-by-side
main.tex
View file @
3c6c2c26
...
...
@@ -356,7 +356,10 @@ The authors thank Paul-André Melliès for his help on type ranking.
%\input{new_system2}
\newpage
\section
{
New Formalization (Beppe)
}
\input
{
new
_
system
_
beppe
}
\newpage
\section
{
New system with normal form
}
\input
{
new
_
system3
}
...
...
new_system_beppe.tex
0 → 100644
View file @
3c6c2c26
\subsection
{
Declarative system
}
\subsubsection
{
Types
}
\[
\begin
{
array
}{
lrcl
}
\textbf
{
Types
}
&
t
&
::
=
&
b
\alt
t
\to
t
\alt
t
\times
t
\alt
t
\vee
t
\alt
\neg
t
\alt
\Empty
\end
{
array
}
\]
\subsubsection
{
Terms
}
\begin{equation}
\begin{array}
{
lrclr
}
\textbf
{
Expressions
}
&
a
&
::=
&
c
\alt
x
\alt\lambda
x.e
\alt
e e
\alt
(e,e)
\alt
\pi
_
i e
\alt
\letexp
{
x
}{
e
}{
e
}
\alt
\tcase
{
e
}{
t
}{
e
}{
e
}
\\
[.3mm]
\end{array}
\end{equation}
\subsubsection
{
Typing rules
}
Rules of Definition 3.5 of Barbanera Dezani + pairs + negation
\begin{mathpar}
\Infer
[Const]
{
}
{
\Gamma\vdash
c:
\basic
{
c
}}
{
}
\quad
\Infer
[Ax]
{
}
{
\Gamma
\vdash
x:
\Gamma
(x)
}
{
x
\in\dom\Gamma
}
% \qquad
% \Infer[Inter]
% { \Gamma \vdash e:t_1\\\Gamma \vdash e:t_2 }
% { \Gamma \vdash e: t_1 \wedge t_2 }
% { }
\\
\Infer
[$\to$I]
{
\Gamma
,x:t
_
1
\vdash
e:t
_
2
}
{
\Gamma\vdash\lambda
x.e:
\arrow
{
t
_
1
}{
t
_
2
}}
{
}
\qquad
\Infer
[$\to$E]
{
\Gamma
\vdash
e
_
1:
\arrow
{
t
_
1
}{
t
_
2
}
\quad
\Gamma
\vdash
e
_
2: t
_
1
}
{
\Gamma
\vdash
{
e
_
1
}{
e
_
2
}
: t
_
2
}
{
}
\\
\Infer
[$\times$I]
{
\Gamma
\vdash
e
_
1:t
_
1
\and
\Gamma
\vdash
e
_
2:t
_
2
}
{
\Gamma
\vdash
(e
_
1,e
_
2):
\pair
{
t
_
1
}
{
t
_
2
}}
{
}
\qquad
\Infer
[$\times$E$_1$]
{
\Gamma
\vdash
e:
\pair
{
t
_
1
}{
t
_
2
}}
{
\Gamma
\vdash
\pi
_
1 e:t
_
1
}
{
}
\quad
\Infer
[$\times$E$_2$]
{
\Gamma
\vdash
e:
\pair
{
t
_
1
}{
t
_
2
}}
{
\Gamma
\vdash
\pi
_
2 e:t
_
2
}
{
}
\\
\Infer
[$\wedge$]
{
\Gamma
\vdash
e:t
_
1
\and
\Gamma
\vdash
e:t
_
2
}
{
\Gamma
\vdash
e:
{
t
_
1
}
\wedge
{
t
_
2
}}
{
}
\qquad
\Infer
[$\vee$]
{
\Gamma
, x:t
_
1
\vdash
e:t
\and
\Gamma
, x:t
_
2
\vdash
e:t
\and
\Gamma
\vdash
e':t
_
1
\vee
t
_
2
}
{
\Gamma\vdash\letexp
x
{
e'
}
e : t
}
{
}
\\
\Infer
[$\neg_1$]
{
\Gamma
\vdash
e:t
\and
\Gamma\vdash
e
_
1: t
_
1
}
{
\Gamma\vdash
\tcase
{
e
}
t
{
e
_
1
}{
e
_
2
}
: t
_
1
}
{
}
\qquad
\Infer
[$\neg_2$]
{
\Gamma
\vdash
e:
\neg
t
\and
\Gamma\vdash
e
_
2: t
_
2
}
{
\Gamma\vdash
\tcase
{
e
}
t
{
e
_
1
}{
e
_
2
}
: t
_
2
}
{
}
\\
\Infer
[Subsumption]
{
\Gamma
\vdash
e:t
\\
t
\leq
t'
}
{
\Gamma
\vdash
e: t'
}
{
}
\end{mathpar}
\subsection
{
Algorithmic type system
}
The idea is to translate terms above in to explicitly annotated
notrmal form and prove that a term above is well typed if and only if
its translation is well typed for a suitable annotation.
In particular the typing rule for cases will be obtained by combining
the union rule with the case rule and using two subsumption rules. Intuitively
\begin{mathpar}
\inferrule*
{
\inferrule*
{
\inferrule*
{
\Gamma
, x: t
{
\wedge
}
t
_
\circ\vdash
x: t
{
\wedge
}
t
_
\circ\quad
t
\wedge
t
_
\circ\leq
t
}{
\Gamma
, x: t
\wedge
t
_
\circ\vdash
x: t
}
\Gamma
, x: t
{
\wedge
}
t
_
\circ\vdash
e
_
1: t'
}
{
\Gamma
, x: t
\wedge
t
_
\circ\vdash
\tcase
{
x
}
t
{
e
_
1
}{
e
_
2
}
:t'
}
\inferrule
{
\inferrule*
{
...
}{
\Gamma
, x:
\neg
t
\wedge
t
_
\circ\vdash
x:
\neg
t
}
\Gamma
, x:
\neg
t
{
\wedge
}
t
_
\circ\vdash
e
_
2: t
}
{
\Gamma
, x:
\neg
t
\wedge
t
_
\circ\vdash
\tcase
{
x
}
t
{
e
_
1
}{
e
_
2
}
:t'
}
\Gamma\vdash
e:t
_
\circ
}
{
\Gamma\vdash
\letexp
x
{
e
}{
\tcase
{
x
}
t
{
e
_
1
}{
e
_
2
}
:t'
}}
\end{mathpar}
Note:
$
t
_
\circ
=(
t
\wedge
t
_
\circ
)
\vee
(
\neg
t
\wedge
t
_
\circ
$
)
\subsubsection
{
Normal form terms with explicit annotations
}
\begin{equation}
\label
{
expressions2
}
\begin{array}
{
lrclr
}
\textbf
{
Atomic expr
}
&
a
&
::=
&
c
\alt
x
\alt\lambda
x
{
:
}
\{
t,...,t
\}
.e
\alt
x x
\alt
\pi
_
i x
\alt
(x,x)
\alt
\tcase
{
x
}{
t
}{
e
}{
e
}
\\
[.3mm]
\textbf
{
Expressions
}
&
e
&
::=
&
\letexp
{
x
{
:
}
\{
t,...,t
\}
}{
a
}{
e
}
\alt
a
\\
[.3mm]
\textbf
{
Values
}
&
v
&
::=
&
c
\alt\lambda
x
{
:
}
\{
t,...,t
\}
.e
\alt
(v,v)
\\
\end{array}
\end{equation}
\subsubsection
{
Algorithmic typing rules
}
\begin{mathpar}
\Infer
[Const]
{
}
{
\Gamma\vdash
c:
\basic
{
c
}}
{
}
\quad
\Infer
[Ax]
{
}
{
\Gamma
\vdash
x:
\Gamma
(x)
}
{
x
\in\dom\Gamma
}
\\
\Infer
[$\to$I]
{
i=1..n
\\\Gamma
,x:t
_
i
\vdash
e:s
_
i
}
{
\Gamma\vdash\lambda
x
{
:
}
\{
t
_
1,...,t
_
n
\}
.e:
\textstyle\bigwedge
_{
i=1..n
}
\arrow
{
t
_
i
}{
s
_
i
}}
{
}
\qquad
\Infer
[$\to$E]
{
\Gamma
\vdash
e
_
1:
\arrow
{
t
_
1
}
\quad
\Gamma
\vdash
e
_
2: t
_
2
}
{
\Gamma
\vdash
{
e
_
1
}{
e
_
2
}
: t
_
1
\circ
t
_
2
}
{
t
_
1
\leq\Empty\to\Any
,t
_
2
\leq\dom
{
t
_
1
}
}
\\
\Infer
[$\times$I]
{
\Gamma
\vdash
x
_
1:t
_
1
\and
\Gamma
\vdash
x
_
2:t
_
2
}
{
\Gamma
\vdash
(x
_
1,x
_
2):
\pair
{
t
_
1
}
{
t
_
2
}}
{
}
\qquad
\Infer
[$\times$E$_1$]
{
\Gamma
\vdash
x:t
\leq
(
\Any\times\Any
)
}
{
\Gamma
\vdash
\pi
_
1 x:
\pi
_
1(t
_
1)
}
{
}
\quad
\Infer
[$\times$E$_2$]
{
\Gamma
\vdash
x:t
\leq
(
\Any\times\Any
)
}
{
\Gamma
\vdash
\pi
_
2 x:
\pi
_
2(t)
}
{
}
\\
\Infer
[$\neg_1$]
{
\Gamma
, x: t
_
0
{
\wedge
}
t
\vdash
e
_
1: t'
}
{
\Gamma
,x:t
_
0
\vdash
\tcase
{
x
}
t
{
e
_
1
}{
e
_
2
}
: t'
}
{
t
_
0
\wedge\neg
t =
\Empty
}
\quad
\Infer
[$\neg_2$]
{
\Gamma
, x: t
_
0
{
\wedge
}
\neg
t
\vdash
e
_
2: t'
}
{
\Gamma
,x:t
_
0
\vdash
\tcase
{
x
}
t
{
e
_
1
}{
e
_
2
}
: t'
}
{
t
_
0
\wedge
t =
\Empty
}
\and
\Infer
[$\neg$]
{
\Gamma
, x: t
_
0
{
\wedge
}
t
\vdash
e
_
1: t'
\\
\Gamma
, x: t
_
0
{
\wedge
}
\neg
t
\vdash
e
_
2: t'
}
{
\Gamma
,x:t
_
0
\vdash
\tcase
{
x
}
t
{
e
_
1
}{
e
_
2
}
: t'
}
{
\text
{
(otherwise)
}}
\\
\Infer
[$\vee$]
{
\Gamma\vdash
e':
\textstyle\bigvee
_{
i=1..n
}
t
_
i
\\
i=1..n
\\
\Gamma
, x:t
_
i
\vdash
e:t
}
{
\Gamma\vdash\letexp
{
x
{
:
}
\{
t
_
1,...,t
_
n
\}
}
{
e'
}
e : t
}
{
}
\end{mathpar}
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