Paper/Paper.thy
changeset 2175 f11dd09fa3a7
parent 2163 5dc48e1af733
child 2176 5054f170024e
equal deleted inserted replaced
2174:157e8a4a6556 2175:f11dd09fa3a7
   554   @{text "p \<bullet> (f x) = f (p \<bullet> x)"}
   554   @{text "p \<bullet> (f x) = f (p \<bullet> x)"}
   555   \end{equation}
   555   \end{equation}
   556  
   556  
   557   \noindent
   557   \noindent
   558   From property \eqref{equivariancedef} and the definition of @{text supp}, we 
   558   From property \eqref{equivariancedef} and the definition of @{text supp}, we 
   559   can be easily deduce that equivariant functions have empty support. There is
   559   can easily deduce that equivariant functions have empty support. There is
   560   also a similar notion for equivariant relations, say @{text R}, namely the property
   560   also a similar notion for equivariant relations, say @{text R}, namely the property
   561   that
   561   that
   562   %
   562   %
   563   \begin{center}
   563   \begin{center}
   564   @{text "x R y"} \;\;implies\;\; @{text "(p \<bullet> x) R (p \<bullet> y)"}
   564   @{text "x R y"} \;\;implies\;\; @{text "(p \<bullet> x) R (p \<bullet> y)"}
   591   fact and Property~\ref{supppermeq} allow us to ``rename'' just the binders 
   591   fact and Property~\ref{supppermeq} allow us to ``rename'' just the binders 
   592   @{text as} in @{text x}, because @{term "p \<bullet> x = x"}.
   592   @{text as} in @{text x}, because @{term "p \<bullet> x = x"}.
   593 
   593 
   594   Most properties given in this section are described in detail in \cite{HuffmanUrban10}
   594   Most properties given in this section are described in detail in \cite{HuffmanUrban10}
   595   and of course all are formalised in Isabelle/HOL. In the next sections we will make 
   595   and of course all are formalised in Isabelle/HOL. In the next sections we will make 
   596   extensively use of these properties in order to define alpha-equivalence in 
   596   extensive use of these properties in order to define alpha-equivalence in 
   597   the presence of multiple binders.
   597   the presence of multiple binders.
   598 *}
   598 *}
   599 
   599 
   600 
   600 
   601 section {* General Binders\label{sec:binders} *}
   601 section {* General Binders\label{sec:binders} *}
   621   given a free-variable function @{text "fv"} of type \mbox{@{text "\<beta> \<Rightarrow> atom
   621   given a free-variable function @{text "fv"} of type \mbox{@{text "\<beta> \<Rightarrow> atom
   622   set"}}, then @{text x} and @{text y} need to have the same set of free
   622   set"}}, then @{text x} and @{text y} need to have the same set of free
   623   variables; moreover there must be a permutation @{text p} such that {\it
   623   variables; moreover there must be a permutation @{text p} such that {\it
   624   ii)} @{text p} leaves the free variables of @{text x} and @{text y} unchanged, but
   624   ii)} @{text p} leaves the free variables of @{text x} and @{text y} unchanged, but
   625   {\it iii)} ``moves'' their bound names so that we obtain modulo a relation,
   625   {\it iii)} ``moves'' their bound names so that we obtain modulo a relation,
   626   say \mbox{@{text "_ R _"}}, two equivalent terms. We also require {\it iv)} that
   626   say \mbox{@{text "_ R _"}}, two equivalent terms. We also require that {\it iv)}
   627   @{text p} makes the sets of abstracted atoms @{text as} and @{text bs} equal. The
   627   @{text p} makes the sets of abstracted atoms @{text as} and @{text bs} equal. The
   628   requirements {\it i)} to {\it iv)} can be stated formally as follows:
   628   requirements {\it i)} to {\it iv)} can be stated formally as follows:
   629   %
   629   %
   630   \begin{equation}\label{alphaset}
   630   \begin{equation}\label{alphaset}
   631   \begin{array}{@ {\hspace{10mm}}r@ {\hspace{2mm}}l}
   631   \begin{array}{@ {\hspace{10mm}}r@ {\hspace{2mm}}l}
   636   @{text "\<and>"} & @{term "(p \<bullet> as) = bs"}\\ 
   636   @{text "\<and>"} & @{term "(p \<bullet> as) = bs"}\\ 
   637   \end{array}
   637   \end{array}
   638   \end{equation}
   638   \end{equation}
   639 
   639 
   640   \noindent
   640   \noindent
   641   Note that this relation is dependent on the permutation @{text
   641   Note that this relation depends on the permutation @{text
   642   "p"}. Alpha-equivalence between two pairs is then the relation where we
   642   "p"}. Alpha-equivalence between two pairs is then the relation where we
   643   existentially quantify over this @{text "p"}. Also note that the relation is
   643   existentially quantify over this @{text "p"}. Also note that the relation is
   644   dependent on a free-variable function @{text "fv"} and a relation @{text
   644   dependent on a free-variable function @{text "fv"} and a relation @{text
   645   "R"}. The reason for this extra generality is that we will use
   645   "R"}. The reason for this extra generality is that we will use
   646   $\approx_{\textit{set}}$ for both ``raw'' terms and alpha-equated terms. In
   646   $\approx_{\textit{set}}$ for both ``raw'' terms and alpha-equated terms. In
   690   \end{center}
   690   \end{center}
   691 
   691 
   692   \noindent
   692   \noindent
   693   Now recall the examples shown in \eqref{ex1}, \eqref{ex2} and
   693   Now recall the examples shown in \eqref{ex1}, \eqref{ex2} and
   694   \eqref{ex3}. It can be easily checked that @{text "({x, y}, x \<rightarrow> y)"} and
   694   \eqref{ex3}. It can be easily checked that @{text "({x, y}, x \<rightarrow> y)"} and
   695   @{text "({y, x}, y \<rightarrow> x)"} are alpha-equivalent according to $\approx_{\textit{set}}$ and
   695   @{text "({y, x}, y \<rightarrow> x)"} are alpha-equivalent according to
   696   $\approx_{\textit{res}}$ by taking @{text p} to be the swapping @{term "(x \<rightleftharpoons>
   696   $\approx_{\textit{set}}$ and $\approx_{\textit{res}}$ by taking @{text p} to
   697   y)"}. In case of @{text "x \<noteq> y"}, then @{text "([x, y], x \<rightarrow> y)"}
   697   be the swapping @{term "(x \<rightleftharpoons> y)"}. In case of @{text "x \<noteq> y"}, then @{text
   698   $\not\approx_{\textit{list}}$ @{text "([y, x], x \<rightarrow> y)"} since there is no permutation
   698   "([x, y], x \<rightarrow> y)"} $\not\approx_{\textit{list}}$ @{text "([y, x], x \<rightarrow> y)"}
   699   that makes the lists @{text "[x, y]"} and @{text "[y, x]"} equal, and also
   699   since there is no permutation that makes the lists @{text "[x, y]"} and
   700   leaves the type \mbox{@{text "x \<rightarrow> y"}} unchanged. Another example is
   700   @{text "[y, x]"} equal, and also leaves the type \mbox{@{text "x \<rightarrow> y"}}
   701   @{text "({x}, x)"} $\approx_{\textit{res}}$ @{text "({x, y}, x)"} which holds by 
   701   unchanged. Another example is @{text "({x}, x)"} $\approx_{\textit{res}}$
   702   taking @{text p} to be the
   702   @{text "({x, y}, x)"} which holds by taking @{text p} to be the identity
   703   identity permutation.  However, if @{text "x \<noteq> y"}, then @{text "({x}, x)"}
   703   permutation.  However, if @{text "x \<noteq> y"}, then @{text "({x}, x)"}
   704   $\not\approx_{\textit{set}}$ @{text "({x, y}, x)"} since there is no permutation 
   704   $\not\approx_{\textit{set}}$ @{text "({x, y}, x)"} since there is no
   705   that makes the
   705   permutation that makes the sets @{text "{x}"} and @{text "{x, y}"} equal
   706   sets @{text "{x}"} and @{text "{x, y}"} equal (similarly for $\approx_{\textit{list}}$).
   706   (similarly for $\approx_{\textit{list}}$).  It can also relatively easily be
   707   It can also relatively easily be shown that all tree notions of alpha-equivalence
   707   shown that all tree notions of alpha-equivalence coincide, if we only
   708   coincide, if we only abstract a single atom. 
   708   abstract a single atom.
   709 
   709 
   710   In the rest of this section we are going to introduce three abstraction 
   710   In the rest of this section we are going to introduce three abstraction 
   711   types. For this we define 
   711   types. For this we define 
   712   %
   712   %
   713   \begin{equation}
   713   \begin{equation}
   939   Similarly for the other binding modes. Interestingly, in case of \isacommand{bind\_set}
   939   Similarly for the other binding modes. Interestingly, in case of \isacommand{bind\_set}
   940   and \isacommand{bind\_res} the binding clauses will make a difference to the semantics
   940   and \isacommand{bind\_res} the binding clauses will make a difference to the semantics
   941   of the specification (the corresponding alpha-equivalence will differ). We will 
   941   of the specification (the corresponding alpha-equivalence will differ). We will 
   942   show this later with an example.
   942   show this later with an example.
   943   
   943   
   944   There are some restrictions we need to impose: First, a body can only occur
   944   There are some restrictions we need to impose on binding clasues: First, a
   945   in \emph{one} binding clause of a term constructor. For binders we
   945   body can only occur in \emph{one} binding clause of a term constructor. For
   946   distinguish between \emph{shallow} and \emph{deep} binders.  Shallow binders
   946   binders we distinguish between \emph{shallow} and \emph{deep} binders.
   947   are just labels. The restriction we need to impose on them is that in case
   947   Shallow binders are just labels. The restriction we need to impose on them
   948   of \isacommand{bind\_set} and \isacommand{bind\_res} the labels must either
   948   is that in case of \isacommand{bind\_set} and \isacommand{bind\_res} the
   949   refer to atom types or to sets of atom types; in case of \isacommand{bind}
   949   labels must either refer to atom types or to sets of atom types; in case of
   950   the labels must refer to atom types or lists of atom types. Two examples for
   950   \isacommand{bind} the labels must refer to atom types or lists of atom
   951   the use of shallow binders are the specification of lambda-terms, where a
   951   types. Two examples for the use of shallow binders are the specification of
   952   single name is bound, and type-schemes, where a finite set of names is
   952   lambda-terms, where a single name is bound, and type-schemes, where a finite
   953   bound:
   953   set of names is bound:
   954 
   954 
   955   \begin{center}
   955   \begin{center}
   956   \begin{tabular}{@ {}cc@ {}}
   956   \begin{tabular}{@ {}cc@ {}}
   957   \begin{tabular}{@ {}l@ {\hspace{-1mm}}}
   957   \begin{tabular}{@ {}l@ {\hspace{-1mm}}}
   958   \isacommand{nominal\_datatype} @{text lam} =\\
   958   \isacommand{nominal\_datatype} @{text lam} =\\
   972   \end{center}
   972   \end{center}
   973 
   973 
   974   \noindent
   974   \noindent
   975   Note that for @{text lam} it does not matter which binding mode we use. The
   975   Note that for @{text lam} it does not matter which binding mode we use. The
   976   reason is that we bind only a single @{text name}. However, having
   976   reason is that we bind only a single @{text name}. However, having
   977   \isacommand{bind\_set} or \isacommand{bind} in the second case makes again a
   977   \isacommand{bind\_set} or \isacommand{bind} in the second case makes a
   978   difference to the semantics of the specification. Note also that in
   978   difference to the semantics of the specification. Note also that in
   979   these specifications @{text "name"} refers to an atom type, and @{text
   979   these specifications @{text "name"} refers to an atom type, and @{text
   980   "fset"} to the type of finite sets.
   980   "fset"} to the type of finite sets.
   981 
   981 
   982 
   982