mirror of
https://github.com/dhil/phd-dissertation
synced 2026-03-13 02:58:26 +00:00
Define a macro for definitional equality up to alpha-conversion.
This commit is contained in:
@@ -161,6 +161,7 @@
|
||||
%%
|
||||
\newcommand{\defas}[0]{\mathrel{\overset{\makebox[0pt]{\mbox{\normalfont\tiny\text{def}}}}{=}}}
|
||||
\newcommand{\defnas}[0]{\mathrel{:=}}
|
||||
\newcommand{\simdefas}[0]{\mathrel{\overset{\makebox[0pt]{\mbox{\normalfont\tiny\text{def}}}}{\simeq}}}
|
||||
|
||||
%%
|
||||
%% Partiality
|
||||
|
||||
128
thesis.tex
128
thesis.tex
@@ -619,7 +619,7 @@ structure as follows.
|
||||
\begin{eqs}
|
||||
(A \eff E)\sigma &\defas& A\sigma \eff E\sigma\\
|
||||
(A \to C)\sigma &\defas& A\sigma \to C\sigma\\
|
||||
(\forall \alpha^K.C)\sigma &\defas& \forall \alpha^K.C\sigma \quad \text{convert if } \alpha \in \dom(\sigma)\\
|
||||
(\forall \alpha^K.C)\sigma &\simdefas& \forall \alpha^K.C\sigma\\
|
||||
\alpha\sigma &\defas& \begin{cases}
|
||||
A & \text{if } (\alpha,A) \in \sigma\\
|
||||
\alpha & \text{otherwise}
|
||||
@@ -976,7 +976,7 @@ cannot be satisfied.
|
||||
|
||||
\paragraph{Typing computations}
|
||||
The \tylab{App} rule states that an application $V\,W$ has computation
|
||||
type $C$ if the abstractor term $V$ has type $A \to C$ and the
|
||||
type $C$ if the function-term $V$ has type $A \to C$ and the
|
||||
argument term $W$ has type $A$, that is both the argument type and the
|
||||
domain type of the abstractor agree.
|
||||
%
|
||||
@@ -1050,87 +1050,83 @@ that the binder $x : A$.
|
||||
\label{fig:base-language-small-step}
|
||||
\end{figure}
|
||||
%
|
||||
In this section we present the dynamic semantics of \BCalc{}. We
|
||||
choose to use a contextual small-step semantics, since in conjunction
|
||||
with fine-grain call-by-value, it yields a considerably simpler
|
||||
semantics than the traditional structural operational semantics
|
||||
(SOS)~\cite{Plotkin04a}, because only the rule for let bindings admits
|
||||
a continuation whereas in ordinary call-by-value SOS each congruence
|
||||
rule admits a continuation.
|
||||
In this section we present the dynamic semantics of \BCalc{}. We opt
|
||||
to use a \citet{Felleisen87}-style contextual small-step semantics,
|
||||
since in conjunction with fine-grain call-by-value (FGCBV), it yields
|
||||
a considerably simpler semantics than the traditional structural
|
||||
operational semantics (SOS)~\cite{Plotkin04a}, because only the rule
|
||||
for let bindings admits a continuation wheres in ordinary
|
||||
call-by-value SOS each congruence rule admits a continuation.
|
||||
%
|
||||
The simpler semantics comes at the expense of a more verbose syntax,
|
||||
which is not a concern as one can readily convert between fine-grain
|
||||
call-by-value and ordinary call-by-value.
|
||||
|
||||
The semantics are based on a substitution model of computation. Thus,
|
||||
before presenting the reduction rules, we define an adequate
|
||||
substitution function. As usual we work up to
|
||||
The reduction semantics are based on a substitution model of
|
||||
computation. Thus, before presenting the reduction rules, we define an
|
||||
adequate substitution function. As usual we work up to
|
||||
$\alpha$-conversion~\cite{Church32} of terms in $\BCalc{}$.
|
||||
%
|
||||
\paragraph{Term substitution}
|
||||
We write $M[V/x]$ for the substitution of some value $V$ for some
|
||||
variable $x$ in some computation term $M$. We use the same notation
|
||||
for substitution on values, i.e. $W[V/x]$ denotes the substitution of
|
||||
$V$ for $x$ in some value $W$. We define substitution as a ternary
|
||||
function, whose signature is given by
|
||||
We define a term substitution map,
|
||||
$\sigma : (\VarCat \times \ValCat)^\ast$ as list of pairs mapping a
|
||||
variable to its value replacement. We denote a single mapping as $V/x$
|
||||
meaning substitute $V$ for the variable $x$. We write multiple
|
||||
mappings using list notation, i.e. $[V_0/x_0,\dots,V_n/x_n]$. The
|
||||
domain of a substitution map is set generated by projecting the first
|
||||
component, i.e.
|
||||
%
|
||||
\[
|
||||
-[-/-] : \TermCat \times \ValCat \times \VarCat \to \CompCat,
|
||||
\bl
|
||||
\dom : (\VarCat \times \ValCat)^\ast \to \ValCat\\
|
||||
\dom(\sigma) \defas \{ x \mid (\_/x) \in \sigma \}
|
||||
\el
|
||||
\]
|
||||
%
|
||||
and we realise it by pattern matching on the first argument.
|
||||
The application of a type substitution map on a term $t \in \TermCat$,
|
||||
written $t\sigma$, is defined inductively on the term structure as
|
||||
follows.
|
||||
%
|
||||
\[
|
||||
\ba[t]{@{~}l@{~}c@{~}r}
|
||||
\begin{eqs}
|
||||
x[V/y] &\defas& \begin{cases}
|
||||
V & \text{if } x = y\\
|
||||
x\sigma &\defas& \begin{cases}
|
||||
V & \text{if } (x, V) \in \sigma\\
|
||||
x & \text{otherwise}
|
||||
\end{cases}\\
|
||||
(\lambda x^A.M)[V/y] &\defas& \lambda x^A.M[V/y] \quad \text{if } x \neq y \text{ and } x \notin \FV(V)\\
|
||||
(\Lambda \alpha^K. M)[V/y] &\defas& \Lambda \alpha^K. M[V/y]\\
|
||||
\Unit[V/y] &\defas& \Unit\\
|
||||
\Record{\ell = W; W'}[V/y] &\defas& \Record{\ell = W[V/y]; W'[V/y]}\\
|
||||
(\ell~W)^R[V/y] &\defas& (\ell~W[V/y])^R\\
|
||||
(W\,W')[V/y] &\defas& W[V/y]\,W'[V/y]\\
|
||||
(W\,T)[V/y] &\defas& W[V/y]~T\\
|
||||
(\ba[t]{@{}l}
|
||||
\Let\;\Record{\ell = x; y} = W\\
|
||||
\In\;N)[V/z]
|
||||
\ea &\defas&
|
||||
\ba[t]{@{~}l}
|
||||
\Let\;\Record{\ell = x; y} = W[V/z]\\
|
||||
\In\;N[V/z]
|
||||
\ea \quad
|
||||
\ba[t]{@{}l}
|
||||
\text{if } x \neq z, y \neq z,\\
|
||||
\text{and } x,y\notin \FV(V)
|
||||
\ea\\
|
||||
(\Case\;(\ell~W)^R\{
|
||||
\ba[t]{@{}l}
|
||||
\ell~x \mapsto M\\
|
||||
; y \mapsto N \})[V/z]
|
||||
\ea
|
||||
&\defas&
|
||||
\Case\;(\ell~W[V/z])^R\{
|
||||
\ba[t]{@{}l}
|
||||
\ell~x \mapsto M[V/z]\\
|
||||
; y \mapsto N[V/z] \}
|
||||
\ea\quad
|
||||
\ba[t]{@{}l}
|
||||
\text{if } x \neq z, y \neq z,\\
|
||||
\text{and } x, y \notin \FV(V)
|
||||
\ea\\
|
||||
(\Let\;x \revto M \;\In\;N)[V/y] &\defas& \Let\;x \revto M[V/y] \;\In\;N[V/y] \quad\text{if } x \neq y \text{ and } x \notin \FV(V)
|
||||
(\lambda x^A.M)\sigma &\simdefas& \lambda x^A.M\sigma\\
|
||||
(\Lambda \alpha^K.M)\sigma &\defas& \Lambda \alpha^K.M\sigma\\
|
||||
(V~T)\sigma &\defas& V\sigma~T
|
||||
\end{eqs}
|
||||
&~~&
|
||||
\begin{eqs}
|
||||
(V~W)\sigma &\defas& V\sigma~W\sigma\\
|
||||
\Unit\sigma &\defas& \Unit\\
|
||||
\Record{\ell = V; W}\sigma &\defas& \Record{\ell = V\sigma;W\sigma}\\
|
||||
(\ell~V)^R\sigma &\defas& (\ell~V\sigma)^R\\
|
||||
\end{eqs}\bigskip\\
|
||||
\multicolumn{3}{c}{
|
||||
\begin{eqs}
|
||||
(\Let\;\Record{\ell = x; y} = V\;\In\;N)\sigma &\simdefas& \Let\;\Record{\ell = x; y} = V\sigma\;\In\;N\sigma\\
|
||||
(\Case\;(\ell~V)^R\{
|
||||
\ell~x \mapsto M
|
||||
; y \mapsto N \})\sigma
|
||||
&\simdefas&
|
||||
\Case\;(\ell~V\sigma)^R\{
|
||||
\ell~x \mapsto M\sigma
|
||||
; y \mapsto N\sigma \}\\
|
||||
(\Let\;x \revto M \;\In\;N)\sigma &\simdefas& \Let\;x \revto M[V/y] \;\In\;N\sigma
|
||||
\end{eqs}}
|
||||
\ea
|
||||
\]
|
||||
%
|
||||
% \begin{cases}
|
||||
% \Let\;x \revto M[V/y]\;\In\;N & \text{if } x = y\\
|
||||
% \Let\;x \revto M[V/y]\;\In\;N[V/y] & \text{otherwise}
|
||||
% \end{cases}
|
||||
% \end{eqs}
|
||||
%
|
||||
We write $t[t_0/x_0,\dots,t_n/x_n]$ to mean the simultaneous
|
||||
substitution of $t_0$ for $x_0$ up to $t_n$ for $x_n$ in $t$.
|
||||
%
|
||||
|
||||
The attentive reader will notice that we are using the same notation
|
||||
for type and term substitutions. We justify this choice by the fact
|
||||
that we can lift type substitution pointwise on the term syntax
|
||||
constructors, enabling us to use one uniform notation for
|
||||
substitution. Thus we shall generally allow a mix of pairs of
|
||||
variables and values and pairs of type variables and types to occur in
|
||||
the same substitution map.
|
||||
|
||||
\paragraph{Reduction semantics}
|
||||
The reduction relation $\reducesto : \CompCat \pto \CompCat$ is defined
|
||||
|
||||
Reference in New Issue
Block a user