The dynamic semantics is defined as a classic left-to-right cbv reduction for a $\lambda$-calculus with pairs enriched with a specific rule for type-cases. We have the following notions of reduction:

\[

...

...

@@ -437,17 +437,20 @@ illustrated in the introduction and it is sound. Now the problem is to

decide whether an expression is well typed or not, that is, to find an

algorithm that given a type environment $\Gamma$ and an expression $e$

decides whether there exists a type $t$ such that $\Gamma\vdash e:t$

is probable. For that we need to solve essentially three problems: $(i)$ how to handle the fact that it is possible to deduce several types for the same well-typed expression $(2)$ how to compute the auxiliary deduction system for paths.

The origin of multiple types are of two distinct origins that will

require two distinct technical solutions. The first origin is the rule

\Rule{Abs-} by which it is possible to deduce for every well-typed

lambda abstractions infinitely many types, that is the annotation of

the function intersected with as many negations of arrow types as it

is possible without making the type empty. To handle this multiplicity

we use the technique of \emph{type schemes} defined

is probable. For that we need to solve essentially three problems:

$(i)$ how to handle the fact that it is possible to deduce several

types for the same well-typed expression $(ii)$ how to compute the

auxiliary deduction system for paths.

Multiple types have two distinct origins each requiring a distinct

technical solution. The first origin is the rule \Rule{Abs-} by which

it is possible to deduce for every well-typed lambda abstractions

infinitely many types, that is the annotation of the function

intersected with as many negations of arrow types as it is possible

without making the type empty. To handle this multiplicity we use and

extend the technique of \emph{type schemes} defined

by~\citet{Frisch2004}. Type schemes are canonical representations of

the infinite set of types of $\lambda$-abstraction and they are

the infinite set of types of $\lambda$-abstractions and they are

presented in Section~\ref{sec:type-schemes}. The second origin is due

to the presence of structural rules\footnote{In logic, logical rules

refer to a particular connective (here, a type constructor, that is,

...

...

@@ -467,22 +470,83 @@ judgments, we present in Section~\ref{sec:typenv} an algorithm that we

prove sound \beppe{and complete?}. All these notions are used in the

algorithmic typing system given in Section~\ref{sec:algorules}.

\begin{enumerate}

\item type of functions -> type schemes

\item elimination rules (app, proj,if) ->operations on types and how to compute them

\item not syntax directed: rules Subs, Intersect, Env.

\item Compute the environments for occurrence typing. Algorithm to compute $\Gamma\vdash\Gamma$

\beppe{\begin{enumerate}

\item type of functions -> type schemes

\item elimination rules (app, proj,if) ->operations on types and how to compute them

\item not syntax directed: rules Subs, Intersect, Env.

\item Compute the environments for occurrence typing. Algorithm to compute $\Gamma\vdash\Gamma$

{v_1}{}\tstimes\tyof{v_1}{}$. Then we have $v\in t\iffdef\tyof

v{}\leq t$.

\beppe{Do we need the next definition and lemma here or they can go in the appendix?

\begin{definition}[Representative]

We define a function $\tsrep{\_}$ that maps every non-empty type scheme into a type, \textit{representative} of the set of types denoted by the scheme.