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
c658912d
Commit
c658912d
authored
Nov 21, 2020
by
Mickael Laurent
Browse files
attempt in progress
parent
999343fa
Changes
2
Hide whitespace changes
Inline
Side-by-side
new_system3.tex
View file @
c658912d
...
...
@@ -126,129 +126,131 @@ The elements of $\Gamma\avdash\Gammap\ct e:t$ mean:
\end{itemize}
\begin{mathpar}
\Infer
[
EFQ
]
{
\exists
x
\in\dom\Gamma
.
\ \Gamma
(x)=
\Empty
}
{
\Gamma
\avdash\Gammap\ct
e :
\{
(
\Empty
,
\Gamma
)
\}
}
{
}
\qquad
\Infer
[NoDef]
{
x
\in\dom\Gammap\setminus\bv
(e)
\\
\Gamma\subst
{
x
}{
\Gamma
(x)
\land
\Gamma
p
(x)
}
\avdash
{
\Gammap\setminus\{
x
\}
}{
\ct
}
e : S
}
{
\Gamma
\avdash\Gammap
{
\ct
}
e :
S
}
{
}
\\
\Infer
[Const]
{
}
{
\Gamma\avdash\Gammap\ct
c:
\{
(
\basic
{
c
}
,
\Gamma
)
\}
}
{
}
\quad
\Infer
[Var]
{
}
{
\Gamma
\avdash\Gammap\ct
x:
\{
(
\Gamma
(x),
\Gamma
)
\}
}
{
x
\in\dom\Gamma
}
\\
\Infer
[Proj]
{
\Gamma
(x)
\equiv\pair
{
t
_
1
}{
t
_
2
}}
{
\Gamma
\avdash\Gammap\ct
\pi
_
i x:
\{
(t
_
i,
\Gamma
)
\}
}
{
}
\\
\Infer
[Proj*]
{
\Gamma
(x)
\equiv\textstyle\bigvee
_{
i
\in
I
}
\pair
{
t
_
i
}{
s
_
i
}
\\
\forall
i
\in
I.
\ \Gamma\avdash
{
\Gammap\subst
{
x
}{
\pair
{
t
_
i
}{
s
_
i
}}}{
[]
}
\ct
[\pi_i x]
:
\{
(u
_
j,
\Gamma
_
j)
\}
_{
j
\in
J
_
i
}
}
{
\Gamma
\avdash\Gammap\ct
\pi
_
i x:
\
{
(u
_
j,
\Gamma
_
j)
\,\alt\,
i
\in
I,
\
j
\in
J
_
i
\}
}
{
}
\\
\Infer
[ProjDom]
{
\Gamma
(x) = t
\\
t
\land
(
\pair
{
\Any
}{
\Any
}
)
\neq\Empty\\
t
\land\neg
(
\pair
{
\Any
}{
\Any
}
)
\neq\Empty\\
\Gamma\avdash
{
\Gammap\subst
{
x
}{
t
\land
(
\pair
{
\Any
}{
\Any
}
)
}}{
[]
}
\ct
[\pi_i x]
:
\{
(u
_
i,
\Gamma
_
i)
\}
_{
i
\in
I
}
\\
\Gamma\avdash
{
\Gammap\subst
{
x
}{
t
\land\neg
(
\pair
{
\Any
}{
\Any
}
)
}}{
[]
}
\ct
[\pi_i x]
:
\{
(u
_
j,
\Gamma
_
j)
\}
_{
j
\in
J
}
}
{
\Gamma
\avdash\Gammap\ct
\pi
_
i x:
\{
(u
_
i,
\Gamma
_
i)
\}
_{
i
\in
I
}
\cup\{
(u
_
j,
\Gamma
_
j)
\}
_{
j
\in
J
}
}
{
}
\\
\Infer
[Pair]
{
}
{
\Gamma
\avdash\Gammap\ct
(x
_
1,x
_
2):
\{
(
\pair
{
\Gamma
(x
_
1)
}
{
\Gamma
(x
_
2)
}
,
\Gamma
)
\}
}
{
}
\\
\Infer
[App]
{
\Gamma
(x
_
1)
\equiv
\textstyle\bigwedge
_{
i
\in
I
}
\arrow
{
s
_
i
}{
t
_
i
}
\\
\Gamma
(x
_
2)=s
\\
\exists
i
\in
I.
\
s
\leq
s
_
i
}
{
\Gamma
\avdash\Gammap\ct
{
x
_
1
}{
x
_
2
}
:
\{
((
\textstyle\bigwedge
_{
i
\in
I
}
\arrow
{
s
_
i
}{
t
_
i
}
)
\circ
s,
\Gamma
)
\}
}
{
}
\\
\Infer
[AppR*]
{
\Gamma
(x
_
1)
\equiv
\textstyle\bigwedge
_{
i
\in
I
}
\arrow
{
s
_
i
}{
t
_
i
}
\\
\Gamma
(x
_
2)=s
\\
s
\leq
\textstyle\bigvee
_{
i
\in
I
}
s
_
i
\\
\forall
i
\in
I.
\ \Gamma\avdash
{
\Gammap\subst
{
x
_
2
}{
s
\land
s
_
i
}}{
[]
}
\ct
[{x_1}{x_2}]
:
\{
(u
_
j,
\Gamma
_
j)
\}
_{
j
\in
J
_
i
}
}
{
\Gamma
\avdash\Gammap\ct
{
x
_
1
}{
x
_
2
}
:
\
{
(u
_
j,
\Gamma
_
j)
\,\alt\,
i
\in
I,
\
j
\in
J
_
i
\}
}
{
}
\\
\Infer
[AppRDom]
{
\Gamma
(x
_
1)
\equiv
\textstyle\bigwedge
_{
i
\in
I
}
\arrow
{
s
_
i
}{
t
_
i
}
\\
s
_
\circ
=
\textstyle\bigvee
_{
i
\in
I
}
s
_
i
\\
\Gamma
(x
_
2)=s
\\
s
\land
s
_
\circ\neq\Empty\\
s
\land
\neg
s
_
\circ\neq\Empty\\
\Gamma\avdash
{
\Gammap\subst
{
x
_
2
}{
s
\land
s
_
\circ
}}{
[]
}
\ct
[{x_1}{x_2}]
:
\{
(u
_
i,
\Gamma
_
i)
\}
_{
i
\in
I
}
\\
\Gamma\avdash
{
\Gammap\subst
{
x
_
2
}{
s
\land
\neg
s
_
\circ
}}{
[]
}
\ct
[{x_1}{x_2}]
:
\{
(u
_
j,
\Gamma
_
j)
\}
_{
j
\in
J
}
}
{
\Gamma
\avdash\Gammap\ct
{
x
_
1
}{
x
_
2
}
:
\{
(u
_
i,
\Gamma
_
i)
\}
_{
i
\in
I
}
\cup\{
(u
_
j,
\Gamma
_
j)
\}
_{
j
\in
J
}
}
{
}
\\
\Infer
[AppL*]
{
\Gamma
(x
_
1)
\equiv\textstyle\bigvee
_{
i
\in
I
}
t
_
i
\leq\arrow
{
\Empty
}{
\Any
}
\\
\forall
i
\in
I.
\ \Gamma\avdash
{
\Gammap\subst
{
x
_
1
}{
t
_
i
}}{
[]
}
\ct
[{x_1}{x_2}]
:
\{
(u
_
j,
\Gamma
_
j)
\}
_{
j
\in
J
_
i
}
}
{
\Gamma
\avdash\Gammap\ct
{
x
_
1
}{
x
_
2
}
:
\
{
(u
_
j,
\Gamma
_
j)
\,\alt\,
i
\in
I,
\
j
\in
J
_
i
\}
}
{
}
\\
\Infer
[AppLDom]
{
\Gamma
(x
_
1) = t
\\
t
\land
(
\arrow
{
\Empty
}{
\Any
}
)
\neq\Empty\\
t
\land
\neg
(
\arrow
{
\Empty
}{
\Any
}
)
\neq\Empty\\
\Gamma\avdash
{
\Gammap\subst
{
x
_
1
}{
t
\land
(
\arrow
{
\Empty
}{
\Any
}
)
}}{
[]
}
\ct
[{x_1}{x_2}]
:
\{
(u
_
i,
\Gamma
_
i)
\}
_{
i
\in
I
}
\\
\Gamma\avdash
{
\Gammap\subst
{
x
_
1
}{
t
\land\neg
(
\arrow
{
\Empty
}{
\Any
}
)
}}{
[]
}
\ct
[{x_1}{x_2}]
:
\{
(u
_
j,
\Gamma
_
j)
\}
_{
j
\in
J
}
}
{
\Gamma
\avdash\Gammap\ct
{
x
_
1
}{
x
_
2
}
:
\{
(u
_
i,
\Gamma
_
i)
\}
_{
i
\in
I
}
\cup\{
(u
_
j,
\Gamma
_
j)
\}
_{
j
\in
J
}
}
{
}
\end{mathpar}
\begin{mathpar}
\Infer
[CaseThen]
{
\Gamma
(x)=t
_
\circ\\
t
_
\circ\leq
t
\\
\Gamma
\avdash\Gammap\ct
e
_
1:
\{
(u
_
i,
\Gamma
_
i)
\}
_{
i
\in
I
}
}
{
\Gamma\avdash\Gammap\ct
\tcase
{
x
}
t
{
e
_
1
}{
e
_
2
}
:
\{
(u
_
i,
\Gamma
_
i)
\}
_{
i
\in
I
}
}
{
}
\\
\Infer
[CaseElse]
{
\Gamma
(x)=t
_
\circ\\
t
_
\circ\leq
\neg
t
\\
\Gamma
\avdash\Gammap\ct
e
_
2:
\{
(u
_
i,
\Gamma
_
i)
\}
_{
i
\in
I
}
}
{
\Gamma\avdash\Gammap\ct
\tcase
{
x
}
t
{
e
_
1
}{
e
_
2
}
:
\{
(u
_
i,
\Gamma
_
i)
\}
_{
i
\in
I
}
}
{
}
\\
\Infer
[Case*]
{
\Gamma
(x) = t
_
\circ\\
\Gamma\avdash
{
\Gammap\subst
{
x
}{
t
_
\circ\land
t
}}{
[]
}
\ct
[\tcase {x} t {e_1}{e_2}]
:
\{
(u
_
i,
\Gamma
_
i)
\}
_{
i
\in
I
}
\\
\Gamma\avdash
{
\Gammap\subst
{
x
}{
t
_
\circ\land\neg
t
}}{
[]
}
\ct
[\tcase {x} t {e_1}{e_2}]
:
\{
(u
_
j,
\Gamma
_
j)
\}
_{
j
\in
J
}
}
{
\Gamma\avdash\Gammap\ct
\tcase
{
x
}
t
{
e
_
1
}{
e
_
2
}
:
\{
(u
_
i,
\Gamma
_
i)
\}
_{
i
\in
I
}
\cup\{
(u
_
j,
\Gamma
_
j)
\}
_{
j
\in
J
}
}
{
}
\Infer
[
NoDef
]
{
x
\in\dom\Gamma
p\setminus\bv
(e)
\\
\Gamma\subst
{
x
}{
\Gamma
(x)
\land\Gammap
(x)
}
\avdash
{
\Gammap\
setminus\{
x
\}
}{
\
ct
}
e :
S
}
{
\Gamma
\avdash\Gammap
{
\ct
}
e : S
}
{
}
\qquad
\Infer
[EFQ]
{
\exists
x
\in\dom\Gamma
.
\
\Gamma
(x)
=
\Empty
}
{
\Gamma
\avdash\Gammap\ct
e :
\{
(
\Empty
,
\Gamma
)
\}
}
{
}
\\
\Infer
[Const]
{
}
{
\Gamma\avdash\Gammap\ct
c:
\{
(
\basic
{
c
}
,
\Gamma
)
\}
}
{
}
\quad
\Infer
[Var]
{
}
{
\Gamma
\avdash\Gammap\ct
x:
\{
(
\Gamma
(x),
\Gamma
)
\}
}
{
x
\in\dom\Gamma
}
\\
\Infer
[Proj]
{
\Gamma
(x)
\equiv\pair
{
t
_
1
}{
t
_
2
}}
{
\Gamma
\avdash\Gammap\ct
\pi
_
i x:
\{
(t
_
i,
\Gamma
)
\}
}
{
}
\\
\Infer
[Proj*]
{
\Gamma
(x)
\equiv\textstyle\bigvee
_{
i
\in
I
}
\pair
{
t
_
i
}{
s
_
i
}
\\
\forall
i
\in
I.
\ \Gamma\avdash
{
\Gammap\subst
{
x
}{
\pair
{
t
_
i
}{
s
_
i
}}}{
[]
}
\ct
[\pi_i x]
:
S
_
i
}
{
\Gamma
\avdash\Gammap\ct
\pi
_
i x:
\
textstyle\bigcup
_{
i
\in
I
}
S
_
i
}
{
}
\\
\Infer
[ProjDom]
{
\Gamma
(x) = t
\\
t
\land
(
\pair
{
\Any
}{
\Any
}
)
\neq\Empty\\
t
\land\neg
(
\pair
{
\Any
}{
\Any
}
)
\neq\Empty\\
\Gamma\avdash
{
\Gammap\subst
{
x
}{
t
\land
(
\pair
{
\Any
}{
\Any
}
)
}}{
[]
}
\ct
[\pi_i x]
:
S
_
1
\\
\Gamma\avdash
{
\Gammap\subst
{
x
}{
t
\land\neg
(
\pair
{
\Any
}{
\Any
}
)
}}{
[]
}
\ct
[\pi_i x]
:
S
_
2
}
{
\Gamma
\avdash\Gammap\ct
\pi
_
i x:
S
_
1
\cup
S
_
2
}
{
}
\\
\Infer
[Pair]
{
}
{
\Gamma
\avdash\Gammap\ct
(x
_
1,x
_
2):
\{
(
\pair
{
\Gamma
(x
_
1)
}
{
\Gamma
(x
_
2)
}
,
\Gamma
)
\}
}
{
}
\\
\Infer
[App]
{
\Gamma
(x
_
1)
\equiv
\textstyle\bigwedge
_{
i
\in
I
}
\arrow
{
s
_
i
}{
t
_
i
}
\\
\Gamma
(x
_
2)=s
\\
\exists
i
\in
I.
\
s
\leq
s
_
i
}
{
\Gamma
\avdash\Gammap\ct
{
x
_
1
}{
x
_
2
}
:
\{
((
\textstyle\bigwedge
_{
i
\in
I
}
\arrow
{
s
_
i
}{
t
_
i
}
)
\circ
s,
\Gamma
)
\}
}
{
}
\\
\Infer
[AppR*]
{
\Gamma
(x
_
1)
\equiv
\textstyle\bigwedge
_{
i
\in
I
}
\arrow
{
s
_
i
}{
t
_
i
}
\\
\Gamma
(x
_
2)=s
\\
s
\leq
\textstyle\bigvee
_{
i
\in
I
}
s
_
i
\\
\forall
i
\in
I.
\ \Gamma\avdash
{
\Gammap\subst
{
x
_
2
}{
s
\land
s
_
i
}}{
[]
}
\ct
[{x_1}{x_2}]
:
S
_
i
}
{
\Gamma
\avdash\Gammap\ct
{
x
_
1
}{
x
_
2
}
:
\
textstyle\bigcup
_{
i
\in
I
}
S
_
i
}
{
}
\\
\Infer
[AppRDom]
{
\Gamma
(x
_
1)
\equiv
\textstyle\bigwedge
_{
i
\in
I
}
\arrow
{
s
_
i
}{
t
_
i
}
\\
s
_
\circ
=
\textstyle\bigvee
_{
i
\in
I
}
s
_
i
\\
\Gamma
(x
_
2)=s
\\
s
\land
s
_
\circ\neq\Empty\\
s
\land
\neg
s
_
\circ\neq\Empty\\
\Gamma\avdash
{
\Gammap\subst
{
x
_
2
}{
s
\land
s
_
\circ
}}{
[]
}
\ct
[{x_1}{x_2}]
:
S
_
1
\\
\Gamma\avdash
{
\Gammap\subst
{
x
_
2
}{
s
\land
\neg
s
_
\circ
}}{
[]
}
\ct
[{x_1}{x_2}]
:
S
_
2
}
{
\Gamma
\avdash\Gammap\ct
{
x
_
1
}{
x
_
2
}
:
S
_
1
\cup
S
_
2
}
{
}
\\
\Infer
[AppL*]
{
\Gamma
(x
_
1)
\equiv\textstyle\bigvee
_{
i
\in
I
}
t
_
i
\leq\arrow
{
\Empty
}{
\Any
}
\\
\forall
i
\in
I.
\ \Gamma\avdash
{
\Gammap\subst
{
x
_
1
}{
t
_
i
}}{
[]
}
\ct
[{x_1}{x_2}]
:
S
_
i
}
{
\Gamma
\avdash\Gammap\ct
{
x
_
1
}{
x
_
2
}
:
\
textstyle\bigcup
_{
i
\in
I
}
S
_
i
}
{
}
\\
\Infer
[AppLDom]
{
\Gamma
(x
_
1) = t
\\
t
\land
(
\arrow
{
\Empty
}{
\Any
}
)
\neq\Empty\\
t
\land
\neg
(
\arrow
{
\Empty
}{
\Any
}
)
\neq\Empty\\
\Gamma\avdash
{
\Gammap\subst
{
x
_
1
}{
t
\land
(
\arrow
{
\Empty
}{
\Any
}
)
}}{
[]
}
\ct
[{x_1}{x_2}]
:
S
_
1
\\
\Gamma\avdash
{
\Gammap\subst
{
x
_
1
}{
t
\land\neg
(
\arrow
{
\Empty
}{
\Any
}
)
}}{
[]
}
\ct
[{x_1}{x_2}]
:
S
_
2
}
{
\Gamma
\avdash\Gammap\ct
{
x
_
1
}{
x
_
2
}
:
S
_
1
\cup
S
_
2
}
{
}
\end{mathpar}
\begin{mathpar}
\Infer
[CaseThen]
{
\Gamma
(x)=t
_
\circ\\
t
_
\circ\leq
t
\\
\Gamma
\avdash\Gammap\ct
e
_
1:
S
}
{
\Gamma\avdash\Gammap\ct
\tcase
{
x
}
t
{
e
_
1
}{
e
_
2
}
:
S
}
{
}
\\
\Infer
[CaseElse]
{
\Gamma
(x)=t
_
\circ\\
t
_
\circ\leq
\neg
t
\\
\Gamma
\avdash\Gammap\ct
e
_
2:
S
}
{
\Gamma\avdash\Gammap\ct
\tcase
{
x
}
t
{
e
_
1
}{
e
_
2
}
:
S
}
{
}
\\
\Infer
[Case*]
{
\Gamma
(x) = t
_
\circ\\
\Gamma\avdash
{
\Gammap\subst
{
x
}{
t
_
\circ\land
t
}}{
[]
}
\ct
[\tcase {x} t {e_1}{e_2}]
:
S
_
1
\\
\Gamma\avdash
{
\Gammap\subst
{
x
}{
t
_
\circ\land\neg
t
}}{
[]
}
\ct
[\tcase {x} t {e_1}{e_2}]
:
S
_
2
}
{
\Gamma
,
\avdash\Gammap\ct
\tcase
{
x
}
t
{
e
_
1
}{
e
_
2
}
:
S
_
1
\cup
S
_
2
}
{
}
\end{mathpar}
NOTE: No need to add the case statement to the context in the premises of the
\Rule
{
CaseThen
}
and
\Rule
{
CaseElse
}
rules, because one branch is already unreachable and retyping only occurs with stronger environments.
TODO: Update rules below
\begin{mathpar}
\Infer
[LetFirst]
\Infer
[LetFirst]
{
\Gamma\avdash\Gammap\ct
a:
\{
(t
_
i,
\Gamma
_
i)
\}
_{
i
\in
I
}
\\
\forall
i
\in
I.
\ \Gamma
_
i,(x:t
_
i)
\avdash\Gammap
{
\ct
[\letexp x a {[]
}
]
}
e : S
_
i
...
...
@@ -288,7 +290,6 @@ rules, because one branch is already unreachable and retyping only occurs with s
\Gamma
'
_
i
\setminus\{
x
\}
)
\,\alt\,
i
\in
I'
\}
}
{
}
\end{mathpar}
TODO: Check abs rule
TODO: The current environments returned by the typing rules are
...
...
setup.sty
View file @
c658912d
...
...
@@ -299,6 +299,7 @@
\newcommand
{
\Gammap
}
[0]
{{
\Gamma
'
}}
\newcommand
{
\avdash
}
[2]
{
\vdash
_{
#1,
\
#2
}}
\newcommand
{
\bt
}
[0]
{
\texttt
{
Backtrack
}}
\newcommand
{
\Gammas
}
[0]
{
\bbGamma
}
\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