Browse Source

Progress and preservation

master
Daniel Hillerström 6 years ago
parent
commit
0065489933
  1. 1
      macros.tex
  2. 58
      thesis.tex

1
macros.tex

@ -118,6 +118,7 @@
\newcommand{\LabelCat}{\CatName{Label}} \newcommand{\LabelCat}{\CatName{Label}}
\newcommand{\TyEnvCat}{\CatName{TyEnv}} \newcommand{\TyEnvCat}{\CatName{TyEnv}}
\newcommand{\KindEnvCat}{\CatName{KindEnv}} \newcommand{\KindEnvCat}{\CatName{KindEnv}}
\newcommand{\EvalCat}{\CatName{Cont}}
%% %%
%% Lindley's array stuff. %% Lindley's array stuff.

58
thesis.tex

@ -866,7 +866,7 @@ that the binder $x : A$.
\EC[M] &\reducesto& \EC[N], \hfill\quad \text{if } M \reducesto N \\ \EC[M] &\reducesto& \EC[N], \hfill\quad \text{if } M \reducesto N \\
\end{reductions} \end{reductions}
\begin{syntax} \begin{syntax}
\slab{Evaluation contexts} & \mathcal{E} &::=& [\,] \mid \Let \; x \revto \mathcal{E} \; \In \; N
\slab{Evaluation contexts} & \mathcal{E} \in \EvalCat &::=& [\,] \mid \Let \; x \revto \mathcal{E} \; \In \; N
\end{syntax} \end{syntax}
%%\[ %%\[
% Evaluation context lift % Evaluation context lift
@ -1024,10 +1024,10 @@ about the language.
We begin by showing that substitutions preserve typability. We begin by showing that substitutions preserve typability.
% %
\begin{lemma}[Preservation of typing under substitution]
Let $\sigma$ be any type substitution and $V$ be a value and $M$ a
computation such that $\typ{\Delta;\Gamma}{V : A}$ and
$\typ{\Delta;\Gamma}{M : C}$, then
\begin{lemma}[Preservation of typing under substitution]\label{lem:base-language-subst}
Let $\sigma$ be any type substitution and $V \in \ValCat$ be any
value and $M \in \CompCat$ a computation such that
$\typ{\Delta;\Gamma}{V : A}$ and $\typ{\Delta;\Gamma}{M : C}$, then
$\typ{\Delta;\sigma~\Gamma}{\sigma~V : \sigma~A}$ and $\typ{\Delta;\sigma~\Gamma}{\sigma~V : \sigma~A}$ and
$\typ{\Delta;\sigma~\Gamma}{\sigma~M : \sigma~C}$. $\typ{\Delta;\sigma~\Gamma}{\sigma~M : \sigma~C}$.
\end{lemma} \end{lemma}
@ -1039,10 +1039,15 @@ We begin by showing that substitutions preserve typability.
\dhil{It is clear to me at this point, that I want to coalesce the \dhil{It is clear to me at this point, that I want to coalesce the
substitution functions. Possibly define them as maps rather than ordinary functions.} substitution functions. Possibly define them as maps rather than ordinary functions.}
\begin{lemma}[Unique decomposition]
The reduction semantics satisfy a \emph{unique decomposition}
property, which guarantees the existence and uniqueness of complete
decomposition for arbitrary computation terms into evaluation
contexts.
%
\begin{lemma}[Unique decomposition]\label{lem:base-language-uniq-decomp}
For any computation $M \in \CompCat$ it holds that $M$ is either For any computation $M \in \CompCat$ it holds that $M$ is either
stuck or there exists a unique evaluation context $\EC$ and a redex
$N \in \CompCat$ such that $M = \EC[N]$.
stuck or there exists a unique evaluation context $\EC \in \EvalCat$
and a redex $N \in \CompCat$ such that $M = \EC[N]$.
\end{lemma} \end{lemma}
% %
\begin{proof} \begin{proof}
@ -1072,7 +1077,42 @@ We begin by showing that substitutions preserve typability.
\end{description} \end{description}
\end{proof} \end{proof}
%
The calculus enjoys a rather strong \emph{progress} property, which
states that \emph{every} closed computation term reduces to a trivial
computation term $\Return\;V$ for some value $V$. In other words, any
realisable function in \BCalc{} is effect-free and total.
%
\begin{definition}[Computation normal form]\label{def:base-language-comp-normal}
A computation $M \in \CompCat$ is said to be \emph{normal} if it is
of the form $\Return\; V$ for some value $V \in \ValCat$.
\end{definition}
%
\begin{theorem}[Progress]\label{thm:base-language-progress}
Suppose $\typ{}{M : A}$, then there exists $\typ{}{N : A}$, such
that $M \reducesto^\ast N$ and $N$ is normal.
\end{theorem}
%
\begin{proof}
Proof by induction on typing derivations.
\end{proof}
%
\begin{corollary}
\BCalc{} is total.
\end{corollary}
%
The calculus also satisfies the \emph{preservation} property,
which states that if some computation $M$ is well-typed and reduces to
some other computation $M'$, then $M'$ is also well-typed.
%
\begin{theorem}[Preservation]\label{thm:base-language-preservation}
Suppose $\typ{\Gamma}{M : A}$ and $M \reducesto M'$, then
$\typ{\Gamma}{M' : A}$.
\end{theorem}
%
\begin{proof}
Proof by induction on typing derivations.
\end{proof}
\section{Primitive effect: general recursion} \section{Primitive effect: general recursion}
\label{sec:base-language-recursion} \label{sec:base-language-recursion}

Loading…
Cancel
Save