@@ -56,11 +56,24 @@ and to $ \lor $, $ \land $, $ \lnot $, and $ \setminus $

as \emph{type connectives}.

The subtyping relation for these types, noted $\leq$, is the one defined

by~\citet{Frisch2008} to which the reader may refer for the formal

definition (we recall it in Appendix~\ref{sec:subtyping} for the

reader's convenience). A detailed description of the algorithm to

by~\citet{Frisch2008}

%

\iflongversion

and detailed description of the algorithm to

decide this relation can be found in~\cite{Cas15}. For the reader's

convenince we succintly recall the definition of the subtyping relations in the next subsection.

This subsection can be skipped at first reading and the reader can

jump directly to Subsection~\ref{sec:syntax}, since to understand

what will follow

\else

to which the reader may refer for the formal

definition (we recall it in \Appendix\ref{sec:subtyping} for the

reader's convenience).

A detailed description of the algorithm to

decide this relation can be found in~\cite{Cas15}.

For this presentation it suffices to consider that

For this presentation

\fi

it suffices to consider that

types are interpreted as sets of \emph{values} ({i.e., either

constants, $\lambda$-abstractions, or pairs of values: see

Section~\ref{sec:syntax} right below) that have that type, and that subtyping is set

...

...

@@ -78,6 +91,14 @@ corresponding set-theoretic operators (e.g.,~$s\vee t$ is the

union of the values of the two types). We use $\simeq$ to denote the

symmetric closure of $\leq$: thus $s\simeq t$ (read, $s$ is equivalent to $t$) means that $s$ and $t$ denote the same set of values and, as such, they are semantically the same type.

\iflongversion

The above is formalized as follows.

\subsection{Subtyping}

\label{sec:subtyping}

\input{subtyping}

\fi

\subsection{Syntax}\label{sec:syntax}

The expressions $e$ and values $v$ of our language are inductively generated by the following grammars:\svvspace{-1mm}

\begin{equation}\label{expressions}

...

...

@@ -104,7 +125,7 @@ typed if $\lambda^{\wedge_{i\in I}s_i\to t_i} x.e$ has type $s_i\to

t_i$ for all $i\in I$. Every value is associated to a most specific type (mst): the mst of $c$ is $\basic c$; the mst of

$\lambda^{\wedge_{i\in I}s_i\to t_i} x.e$ is $\wedge_{i\in I}s_i\to t_i$; and, inductively,

the mst of a pair of values is the product of the mst's of the

values. We write $v\in t$ if the most specific type of $v$ is a subtype of $t$ (see Appendix~\ref{app:typeschemes} for the formal definition of $v\in t$ which deals with some corner cases for negated arrow types).

values. We write $v\in t$ if the most specific type of $v$ is a subtype of $t$ (see \Appendix\ref{app:typeschemes} for the formal definition of $v\in t$ which deals with some corner cases for negated arrow types).

...

...

@@ -451,9 +472,9 @@ e$) is of type $t'$, then the type of $e$ must be of the form

$\pair{t'}\Any$ (respectively, $\pair\Any{t'}$).

This concludes the presentation of all the rules of our type system

(they are summarized for the reader's convenience in Appendix~\ref{sec:declarative}), which satisfies

(they are summarized for the reader's convenience in \Appendix\ref{sec:declarative}), which satisfies

the property of safety, deduced, as customary, from the properties

of progress and subject reduction (\emph{cf.} Appendix~\ref{app:soundness}).\svvspace{-.5mm}

of progress and subject reduction (\emph{cf.}\Appendix\ref{app:soundness}).\svvspace{-.5mm}

\begin{theorem}[type safety]

For every expression $e$ such that $\varnothing\vdash e:t$ either $e$