We have $\bigwedge_{i\in I}\arrow{t_i}{s_i}\leq t$.
We have $\bigwedge_{i\in I}\arrow{t_i}{s_i}\leq t$.
Using the definition of type schemes, let $t'=\bigwedge_{i\in I}\arrow{t_i}{s_i}\land\bigwedge_{j\in J}\neg\arrow{t'_j}{s'_j}$ such that $\Empty\neq t' \leq t$.
Using the definition of type schemes, let $t'=\bigwedge_{i\in I}\arrow{t_i}{s_i}\land\bigwedge_{j\in J}\neg\arrow{t'_j}{s'_j}$ such that $\Empty\neq t' \leq t$.
The induction hypothesis gives, for all $i\in I$, $\Gamma,x:s_i\vdash e':t_i$.
The induction hypothesis gives, for all $i\in I$, $\Gamma,x:s_i\vdash e':t_i$.
Thus, we can derive $\Gamma\vdash e:\bigwedge_{i\in I}\arrow{t_i}{s_i}$ using the rule \Rule{Abs+}, and with \Rule{Inter} and
Thus, we can derive $\Gamma\vdash e:\bigwedge_{i\in I}\arrow{t_i}{s_i}$ using the rule \Rule{Abs+}, and with \Rule{Inter} and
\Rule{Abs-} we can derive $\Gamma\vdash e:t'$. We can conclude by applying \Rule{Subs}.
\Rule{Abs-} we can derive $\Gamma\vdash e:t'$. We can conclude by applying \Rule{Subs}.
\item[$e=e_1 e_2$] The last rule is \Rule{App\Aa}.
\item[$e=e_1 e_2$] The last rule is \Rule{App\Aats}.
We have $\apply{\ts_1}{\ts_2}\leq t$. Thus, let $t_1$ and $t_2$ such that $\ts_1\leq t_1$, $\ts_2\leq t_2$ and $\apply{t_1}{t_2}\leq t$.
We have $\apply{\ts_1}{\ts_2}\leq t$. Thus, let $t_1$ and $t_2$ such that $\ts_1\leq t_1$, $\ts_2\leq t_2$ and $\apply{t_1}{t_2}\leq t$.
We know, according to the descriptive definition of $\apply{}{}$, that there exists $s\leq t$ such that $t_1\leq\arrow{t_2} s$.
We know, according to the descriptive definition of $\apply{}{}$, that there exists $s\leq t$ such that $t_1\leq\arrow{t_2} s$.
...
@@ -1124,15 +1124,15 @@ theorem for the algorithmic type system presented in \ref{sec:algorules}.
...
@@ -1124,15 +1124,15 @@ theorem for the algorithmic type system presented in \ref{sec:algorules}.
$\Gamma\vdash e_1:\arrow{t_2} s$ using \Rule{Subs}, and together with $\Gamma\vdash e_2:t_2$ it gives
$\Gamma\vdash e_1:\arrow{t_2} s$ using \Rule{Subs}, and together with $\Gamma\vdash e_2:t_2$ it gives
$\Gamma\vdash e_1\ e_2:s$ with \Rule{App}. We conclude with \Rule{Subs}.
$\Gamma\vdash e_1\ e_2:s$ with \Rule{App}. We conclude with \Rule{Subs}.
\item[$e=\pi_i e'$] The last rule is \Rule{Proj\Aa}. We have $\bpi_i \ts\leq t$. Thus, let $t'$ such that $\ts\leq t'$ and $\bpi_i t' \leq t$.
\item[$e=\pi_i e'$] The last rule is \Rule{Proj\Aats}. We have $\bpi_i \ts\leq t$. Thus, let $t'$ such that $\ts\leq t'$ and $\bpi_i t' \leq t$.
We know, according to the descriptive definition of $\bpi_i$, that there exists $t_i\leq t$ such that $t' \leq\pair\Any{t_i}$ (for $i=2$) or $t' \leq\pair{t_i}\Any$ (for $i=1$).
We know, according to the descriptive definition of $\bpi_i$, that there exists $t_i\leq t$ such that $t' \leq\pair\Any{t_i}$ (for $i=2$) or $t' \leq\pair{t_i}\Any$ (for $i=1$).
By using the induction hypothesis, we have $\Gamma\vdash e':t'$, and thus we easily conclude using \Rule{Subs} and \Rule{Proj}
By using the induction hypothesis, we have $\Gamma\vdash e':t'$, and thus we easily conclude using \Rule{Subs} and \Rule{Proj}
(for instance for the case $i=1$, we can derive $\Gamma\vdash e':\pair{t_i}\Any$ with \Rule{Subs} and then use \Rule{Proj}).
(for instance for the case $i=1$, we can derive $\Gamma\vdash e':\pair{t_i}\Any$ with \Rule{Subs} and then use \Rule{Proj}).
\item[$e=(e_1,e_2)$] The last rule is \Rule{Pair\Aa}. We conclude easily with the induction hypothesis and the rules \Rule{Subs} and \Rule{Pair}.
\item[$e=(e_1,e_2)$] The last rule is \Rule{Pair\Aats}. We conclude easily with the induction hypothesis and the rules \Rule{Subs} and \Rule{Pair}.
\item[$e=\ite {e_0} t {e_1} {e_2}$] The last rule is \Rule{Case\Aa}. We conclude easily with the induction hypothesis and the rules
\item[$e=\ite {e_0} t {e_1} {e_2}$] The last rule is \Rule{Case\Aats}. We conclude easily with the induction hypothesis and the rules
\Rule{Subs} and \Rule{Case} (for the application of \Rule{Case}, $t'$ must be taken equal to $t_1\vee t_2$ with $t_1$ and $t_2$ such that $\ts_1\leq t_1$, $\ts_2\leq t_2$ and $t_1\vee t_2\leq t$).
\Rule{Subs} and \Rule{Case} (for the application of \Rule{Case}, $t'$ must be taken equal to $t_1\vee t_2$ with $t_1$ and $t_2$ such that $\ts_1\leq t_1$, $\ts_2\leq t_2$ and $t_1\vee t_2\leq t$).
\end{description}\ \\
\end{description}\ \\
...
@@ -1278,23 +1278,23 @@ theorem for the algorithmic type system presented in \ref{sec:algorules}.
...
@@ -1278,23 +1278,23 @@ theorem for the algorithmic type system presented in \ref{sec:algorules}.
The property $\tsrep{\tyof e {\Gamma'}}\leq\tsrep{\tyof e {\Gamma}}$
The property $\tsrep{\tyof e {\Gamma'}}\leq\tsrep{\tyof e {\Gamma}}$
can be proved in a very similar way, by using the fact that operators on type schemes like $\tsand$ or $\apply{}{}$ are also monotone.
can be proved in a very similar way, by using the fact that operators on type schemes like $\tsand$ or $\apply{}{}$ are also monotone.
(Note that the only rule that introduces the type scheme constructor $\tsfun{\_}$ is \Rule{Abs\Aa}.)
(Note that the only rule that introduces the type scheme constructor $\tsfun{\_}$ is \Rule{Abs\Aats}.)
If $\Gamma' =\bot$ we can conclude directly with the rule \Rule{Efq}.
If $\Gamma' =\bot$ we can conclude directly with the rule \Rule{Efq\Aats}.
So let's assume $\Gamma' \neq\bot$ and $\Gamma\neq\bot$
So let's assume $\Gamma' \neq\bot$ and $\Gamma\neq\bot$
(as $\Gamma=\bot\Rightarrow\Gamma' =\bot$ by definition of $\leqA^e$).
(as $\Gamma=\bot\Rightarrow\Gamma' =\bot$ by definition of $\leqA^e$).
If $e=x$ is a variable, then the last rule used in $\tyof e \Gamma$ and $\tyof e {\Gamma'}$ is \Rule{Var\Aa}.
If $e=x$ is a variable, then the last rule used in $\tyof e \Gamma$ and $\tyof e {\Gamma'}$ is \Rule{Var\Aats}.
As $\Gamma' \leqA^e \Gamma$, we have $\Gamma'(e)\leq\Gamma(e)$ and thus
As $\Gamma' \leqA^e \Gamma$, we have $\Gamma'(e)\leq\Gamma(e)$ and thus
we can conclude with the rule \Rule{Var\Aa}.
we can conclude with the rule \Rule{Var\Aats}.
So let's assume that $e$ is not a variable.
So let's assume that $e$ is not a variable.
If $e\in\dom\Gamma$, then the last rule used in $\tyof e \Gamma$ is \Rule{Env\Aa}.
If $e\in\dom\Gamma$, then the last rule used in $\tyof e \Gamma$ is \Rule{Env\Aats}.
As $\Gamma' \leqA^e \Gamma$, we have $\tyof e {\Gamma'}\leq\Gamma(e)$.
As $\Gamma' \leqA^e \Gamma$, we have $\tyof e {\Gamma'}\leq\Gamma(e)$.
Moreover, by applying the induction hypothesis, we get $\tyof e {\Gamma'\setminus\{e\}}\leq\tyof e {\Gamma\setminus\{e\}}$
Moreover, by applying the induction hypothesis, we get $\tyof e {\Gamma'\setminus\{e\}}\leq\tyof e {\Gamma\setminus\{e\}}$
(we can easily verify that $\Gamma'\setminus\{e\}\leqA^e \Gamma\setminus\{e\}$).
(we can easily verify that $\Gamma'\setminus\{e\}\leqA^e \Gamma\setminus\{e\}$).
\begin{itemize}
\begin{itemize}
\item If we have $e\in\dom{\Gamma'}$, we have according to the rule \Rule{Env\Aa}
\item If we have $e\in\dom{\Gamma'}$, we have according to the rule \Rule{Env\Aats}
$\tyof e {\Gamma'}\leq\tyof e {\Gamma'\setminus\{e\}}\leq\tyof e {\Gamma\setminus\{e\}}$.
$\tyof e {\Gamma'}\leq\tyof e {\Gamma'\setminus\{e\}}\leq\tyof e {\Gamma\setminus\{e\}}$.
Together with $\tyof e {\Gamma'}\leq\Gamma(e)$,
Together with $\tyof e {\Gamma'}\leq\Gamma(e)$,
...
@@ -1303,7 +1303,7 @@ theorem for the algorithmic type system presented in \ref{sec:algorules}.
...
@@ -1303,7 +1303,7 @@ theorem for the algorithmic type system presented in \ref{sec:algorules}.
$\tyof e {\Gamma'}=\tyof e {\Gamma'\setminus\{e\}}\leq\Gamma(e)\tsand\tyof e {\Gamma\setminus\{e\}}=\tyof e {\Gamma}$.
$\tyof e {\Gamma'}=\tyof e {\Gamma'\setminus\{e\}}\leq\Gamma(e)\tsand\tyof e {\Gamma\setminus\{e\}}=\tyof e {\Gamma}$.
\end{itemize}
\end{itemize}
If $e\not\in\dom\Gamma$ and $e\in\dom{\Gamma'}$, the last rule is \Rule{Env\Aa} for $\tyof e {\Gamma'}$.
If $e\not\in\dom\Gamma$ and $e\in\dom{\Gamma'}$, the last rule is \Rule{Env\Aats} for $\tyof e {\Gamma'}$.
As $\Gamma'\setminus\{e\}\leqA^e \Gamma\setminus\{e\}=\Gamma$,
As $\Gamma'\setminus\{e\}\leqA^e \Gamma\setminus\{e\}=\Gamma$,
we have $\tyof e {\Gamma'}\leq\tyof e {\Gamma'\setminus\{e\}}\leq\tyof e {\Gamma}$ by induction hypothesis.
we have $\tyof e {\Gamma'}\leq\tyof e {\Gamma'\setminus\{e\}}\leq\tyof e {\Gamma}$ by induction hypothesis.
...
@@ -1311,23 +1311,23 @@ theorem for the algorithmic type system presented in \ref{sec:algorules}.
...
@@ -1311,23 +1311,23 @@ theorem for the algorithmic type system presented in \ref{sec:algorules}.
From now we know that the last rule in the derivation of $\tyof e {\Gamma}$ and $\tyof e {\Gamma'}$ (if any) is the same.
From now we know that the last rule in the derivation of $\tyof e {\Gamma}$ and $\tyof e {\Gamma'}$ (if any) is the same.
\begin{description}
\begin{description}
\item[$e=c$] The last rule is \Rule{Const\Aa}. It does not depend on $\Gamma$ so this case is trivial.
\item[$e=c$] The last rule is \Rule{Const\Aats}. It does not depend on $\Gamma$ so this case is trivial.