LMCS-Paper/Paper.thy
changeset 3006 4baa2fccfb61
parent 3005 4df720c9b660
child 3007 c5de60da0bcf
equal deleted inserted replaced
3005:4df720c9b660 3006:4baa2fccfb61
    13   Abs_print :: "'a \<Rightarrow> 'b \<Rightarrow> 'c" 
    13   Abs_print :: "'a \<Rightarrow> 'b \<Rightarrow> 'c" 
    14 
    14 
    15 definition
    15 definition
    16  "equal \<equiv> (op =)" 
    16  "equal \<equiv> (op =)" 
    17 
    17 
       
    18 fun alpha_set_ex where
       
    19   "alpha_set_ex (bs, x) R f (cs, y) = (\<exists>pi. alpha_set (bs, x) R f pi (cs, y))"
       
    20  
       
    21 fun alpha_res_ex where
       
    22   "alpha_res_ex (bs, x) R f pi (cs, y) = (\<exists>pi. alpha_res (bs, x) R f pi (cs, y))"
       
    23 
       
    24 fun alpha_lst_ex where
       
    25   "alpha_lst_ex (bs, x) R f pi (cs, y) = (\<exists>pi. alpha_lst (bs, x) R f pi (cs, y))"
       
    26 
       
    27 
       
    28 
    18 notation (latex output)
    29 notation (latex output)
    19   swap ("'(_ _')" [1000, 1000] 1000) and
    30   swap ("'(_ _')" [1000, 1000] 1000) and
    20   fresh ("_ # _" [51, 51] 50) and
    31   fresh ("_ # _" [51, 51] 50) and
    21   fresh_star ("_ #\<^sup>* _" [51, 51] 50) and
    32   fresh_star ("_ #\<^sup>* _" [51, 51] 50) and
    22   supp ("supp _" [78] 73) and
    33   supp ("supp _" [78] 73) and
    23   uminus ("-_" [78] 73) and
    34   uminus ("-_" [78] 73) and
    24   If  ("if _ then _ else _" 10) and
    35   If  ("if _ then _ else _" 10) and
    25   alpha_set ("_ \<approx>\<^raw:\,\raisebox{-1pt}{\makebox[0mm][l]{$_{\textit{set}}$}}>\<^bsup>_, _, _\<^esup> _") and
    36   alpha_set_ex ("_ \<approx>\<^raw:\,\raisebox{-1pt}{\makebox[0mm][l]{$_{\textit{set}}$}}>\<^bsup>_, _\<^esup> _") and
    26   alpha_lst ("_ \<approx>\<^raw:\,\raisebox{-1pt}{\makebox[0mm][l]{$_{\textit{list}}$}}>\<^bsup>_, _, _\<^esup> _") and
    37   alpha_lst_ex ("_ \<approx>\<^raw:\,\raisebox{-1pt}{\makebox[0mm][l]{$_{\textit{list}}$}}>\<^bsup>_, _\<^esup> _") and
    27   alpha_res ("_ \<approx>\<^raw:\,\raisebox{-1pt}{\makebox[0mm][l]{$_{\textit{set+}}$}}>\<^bsup>_, _, _\<^esup> _") and
    38   alpha_res_ex ("_ \<approx>\<^raw:\,\raisebox{-1pt}{\makebox[0mm][l]{$_{\textit{set+}}$}}>\<^bsup>_, _\<^esup> _") and
    28   abs_set ("_ \<approx>\<^raw:{$\,_{\textit{abs\_set}}$}> _") and
    39   abs_set ("_ \<approx>\<^raw:{$\,_{\textit{abs\_set}}$}> _") and
    29   abs_set2 ("_ \<approx>\<^raw:\raisebox{-1pt}{\makebox[0mm][l]{$\,_{\textit{list}}$}}>\<^bsup>_\<^esup>  _") and
    40   abs_set2 ("_ \<approx>\<^raw:\raisebox{-1pt}{\makebox[0mm][l]{$\,_{\textit{list}}$}}>\<^bsup>_\<^esup>  _") and
    30   fv ("fa'(_')" [100] 100) and
    41   fv ("fa'(_')" [100] 100) and
    31   equal ("=") and
    42   equal ("=") and
    32   alpha_abs_set ("_ \<approx>\<^raw:{$\,_{\textit{abs\_set}}$}> _") and 
    43   alpha_abs_set ("_ \<approx>\<^raw:{$\,_{\textit{abs\_set}}$}> _") and 
   655   @{text \<pi>} makes the sets of abstracted atoms @{text as} and @{text bs} equal. The
   666   @{text \<pi>} makes the sets of abstracted atoms @{text as} and @{text bs} equal. The
   656   requirements {\it (i)} to {\it (iv)} can be stated formally as the conjunction of:
   667   requirements {\it (i)} to {\it (iv)} can be stated formally as the conjunction of:
   657 
   668 
   658   \begin{defi}[Alpha-Equivalence for Set-Bindings]\label{alphaset}\mbox{}\\
   669   \begin{defi}[Alpha-Equivalence for Set-Bindings]\label{alphaset}\mbox{}\\
   659   \begin{tabular}{@ {\hspace{10mm}}l@ {\hspace{5mm}}rl}  
   670   \begin{tabular}{@ {\hspace{10mm}}l@ {\hspace{5mm}}rl}  
   660   @{term "(as, x) \<approx>set R fa \<pi> (bs, y)"}\hspace{2mm}@{text "\<equiv>"} 
   671   @{term "alpha_set_ex (as, x) R fa (bs, y)"}\hspace{2mm}@{text "\<equiv>"} & 
       
   672     \multicolumn{2}{@ {}l}{if there exists a @{text "\<pi>"} such that:}\\ 
   661        & \mbox{\it (i)}   & @{term "fa(x) - as = fa(y) - bs"}\\
   673        & \mbox{\it (i)}   & @{term "fa(x) - as = fa(y) - bs"}\\
   662        & \mbox{\it (ii)}  & @{term "(fa(x) - as) \<sharp>* \<pi>"}\\
   674        & \mbox{\it (ii)}  & @{term "(fa(x) - as) \<sharp>* \<pi>"}\\
   663        & \mbox{\it (iii)} &  @{text "(\<pi> \<bullet> x) R y"} \\
   675        & \mbox{\it (iii)} &  @{text "(\<pi> \<bullet> x) R y"} \\
   664        & \mbox{\it (iv)}  & @{term "(\<pi> \<bullet> as) = bs"} \\ 
   676        & \mbox{\it (iv)}  & @{term "(\<pi> \<bullet> as) = bs"} \\ 
   665   \end{tabular}
   677   \end{tabular}
   666   \end{defi}
   678   \end{defi}
   667  
   679  
   668   \noindent
   680   \noindent
   669   Note that this relation depends on the permutation @{text
   681   Note that the relation is
   670   "\<pi>"}; alpha-equivalence between two pairs is then the relation where we
       
   671   existentially quantify over this @{text "\<pi>"}. Also note that the relation is
       
   672   dependent on a free-atom function @{text "fa"} and a relation @{text
   682   dependent on a free-atom function @{text "fa"} and a relation @{text
   673   "R"}. The reason for this extra generality is that we will use
   683   "R"}. The reason for this extra generality is that we will use
   674   $\approx_{\,\textit{set}}$ for both ``raw'' terms and alpha-equated terms. In
   684   $\approx_{\,\textit{set}}$ for both ``raw'' terms and alpha-equated terms. In
   675   the latter case, @{text R} will be replaced by equality @{text "="} and we
   685   the latter case, @{text R} will be replaced by equality @{text "="} and we
   676   will prove that @{text "fa"} is equal to @{text "supp"}.
   686   will prove that @{text "fa"} is equal to @{text "supp"}.
   680   for pairs of the form \mbox{@{text "(as, x)"}} with type @{text "(atom list) \<times> \<beta>"} 
   690   for pairs of the form \mbox{@{text "(as, x)"}} with type @{text "(atom list) \<times> \<beta>"} 
   681   as follows
   691   as follows
   682   
   692   
   683   \begin{defi}[Alpha-Equivalence for List-Bindings]\label{alphalist}\mbox{}\\
   693   \begin{defi}[Alpha-Equivalence for List-Bindings]\label{alphalist}\mbox{}\\
   684   \begin{tabular}{@ {\hspace{10mm}}l@ {\hspace{5mm}}rl}  
   694   \begin{tabular}{@ {\hspace{10mm}}l@ {\hspace{5mm}}rl}  
   685   @{term "(as, x) \<approx>lst R fa \<pi> (bs, y)"}\hspace{2mm}@{text "\<equiv>"}
   695   @{term "alpha_lst_ex (as, x) R fa (bs, y)"}\hspace{2mm}@{text "\<equiv>"} &
       
   696   \multicolumn{2}{@ {}l}{if there exists a @{text "\<pi>"} such that:}\\ 
   686          & \mbox{\it (i)}   & @{term "fa(x) - (set as) = fa(y) - (set bs)"}\\ 
   697          & \mbox{\it (i)}   & @{term "fa(x) - (set as) = fa(y) - (set bs)"}\\ 
   687          & \mbox{\it (ii)}  & @{term "(fa(x) - set as) \<sharp>* \<pi>"}\\
   698          & \mbox{\it (ii)}  & @{term "(fa(x) - set as) \<sharp>* \<pi>"}\\
   688          & \mbox{\it (iii)} & @{text "(\<pi> \<bullet> x) R y"}\\
   699          & \mbox{\it (iii)} & @{text "(\<pi> \<bullet> x) R y"}\\
   689          & \mbox{\it (iv)}  & @{term "(\<pi> \<bullet> as) = bs"}\\
   700          & \mbox{\it (iv)}  & @{term "(\<pi> \<bullet> as) = bs"}\\
   690   \end{tabular}
   701   \end{tabular}
   699   also allow vacuous binders, that means \emph{restrict} names, then we keep sets of binders, but drop 
   710   also allow vacuous binders, that means \emph{restrict} names, then we keep sets of binders, but drop 
   700   condition {\it (iv)} in Definition~\ref{alphaset}:
   711   condition {\it (iv)} in Definition~\ref{alphaset}:
   701 
   712 
   702   \begin{defi}[Alpha-Equivalence for Set+-Bindings]\label{alphares}\mbox{}\\
   713   \begin{defi}[Alpha-Equivalence for Set+-Bindings]\label{alphares}\mbox{}\\
   703   \begin{tabular}{@ {\hspace{10mm}}l@ {\hspace{5mm}}rl}  
   714   \begin{tabular}{@ {\hspace{10mm}}l@ {\hspace{5mm}}rl}  
   704   @{term "(as, x) \<approx>res R fa \<pi> (bs, y)"}\hspace{2mm}@{text "\<equiv>"}
   715   @{term "alpha_res_ex (as, x) R fa (bs, y)"}\hspace{2mm}@{text "\<equiv>"} &
       
   716   \multicolumn{2}{@ {}l}{if there exists a @{text "\<pi>"} such that:}\\ 
   705              & \mbox{\it (i)}   & @{term "fa(x) - as = fa(y) - bs"}\\
   717              & \mbox{\it (i)}   & @{term "fa(x) - as = fa(y) - bs"}\\
   706              & \mbox{\it (ii)}  & @{term "(fa(x) - as) \<sharp>* \<pi>"}\\
   718              & \mbox{\it (ii)}  & @{term "(fa(x) - as) \<sharp>* \<pi>"}\\
   707              & \mbox{\it (iii)} & @{text "(\<pi> \<bullet> x) R y"}\\
   719              & \mbox{\it (iii)} & @{text "(\<pi> \<bullet> x) R y"}\\
   708   \end{tabular}
   720   \end{tabular}
   709   \end{defi}
   721   \end{defi}
   735   permutation that makes the sets @{text "{x}"} and @{text "{x, y}"} equal
   747   permutation that makes the sets @{text "{x}"} and @{text "{x, y}"} equal
   736   (similarly for $\approx_{\,\textit{list}}$).  It can also relatively easily be
   748   (similarly for $\approx_{\,\textit{list}}$).  It can also relatively easily be
   737   shown that all three notions of alpha-equivalence coincide, if we only
   749   shown that all three notions of alpha-equivalence coincide, if we only
   738   abstract a single atom.
   750   abstract a single atom.
   739 
   751 
   740   In the rest of this section we are going to introduce three abstraction 
   752   In the rest of this section we are going to show that the alpha-equivalences really 
   741   types. For this we define the relations
   753   lead to abstractions where some atoms are bound.  For this we are going to introduce 
       
   754   three abstraction types that are quotients with respect to the relations
   742 
   755 
   743   \begin{equation}
   756   \begin{equation}
   744   \begin{array}{r}
   757   \begin{array}{r}
   745   @{term "alpha_abs_set (as, x) (bs, y) \<equiv> \<exists>\<pi>. alpha_set (as, x) equal supp \<pi> (bs, y)"}\\
   758   @{term "alpha_abs_set (as, x) (bs, y)"}~~@{text "\<equiv>"}~~@{term "alpha_set_ex (as, x) equal supp (bs, y)"}\\
   746   @{term "alpha_abs_res (as, x) (bs, y) \<equiv> \<exists>\<pi>. alpha_res (as, x) equal supp \<pi> (bs, y)"}\\
   759   @{term "alpha_abs_res (as, x) (bs, y)"}~~@{text "\<equiv>"}~~@{term "alpha_res_ex (as, x) equal supp (bs, y)"}\\
   747   @{term "alpha_abs_lst (as, x) (bs, y) \<equiv> \<exists>\<pi>. alpha_lst (as, x) equal supp \<pi> (bs, y)"}\\
   760   @{term "alpha_abs_lst (as, x) (bs, y)"}~~@{text "\<equiv>"}~~@{term "alpha_lst_ex (as, x) equal supp (bs, y)"}\\
   748   \end{array}
   761   \end{array}
   749   \end{equation}\smallskip
   762   \end{equation}\smallskip
   750   
   763   
   751   \noindent
   764   \noindent
   752   We can show that these relations are equivalence 
   765   In these relation we replaced the free-atom function @{text "fa"} with @{term "supp"} and the 
   753   relations and equivariant.
   766   relation @{text R} with equality. We can show the following properties:
   754 
   767 
   755   \begin{lem}\label{alphaeq} 
   768   \begin{lem}\label{alphaeq} 
   756   The relations $\approx_{\,\textit{abs\_set}}$, $\approx_{\,\textit{abs\_list}}$
   769   The relations $\approx_{\,\textit{abs\_set}}$, $\approx_{\,\textit{abs\_set+}}$
   757   and $\approx_{\,\textit{abs\_set+}}$ are equivalence relations and equivariant. 
   770   and $\approx_{\,\textit{abs\_list}}$ are equivalence relations and equivariant. 
   758   \end{lem}
   771   \end{lem}
   759 
   772 
   760   \begin{proof}
   773   \begin{proof}
   761   Reflexivity is by taking @{text "\<pi>"} to be @{text "0"}. For symmetry we have
   774   Reflexivity is by taking @{text "\<pi>"} to be @{text "0"}. For symmetry we have
   762   a permutation @{text "\<pi>"} and for the proof obligation take @{term "- \<pi>"}. In case 
   775   a permutation @{text "\<pi>"} and for the proof obligation take @{term "- \<pi>"}. In case 
   763   of transitivity, we have two permutations @{text "\<pi>\<^isub>1"} and @{text "\<pi>\<^isub>2"}, and for the
   776   of transitivity, we have two permutations @{text "\<pi>\<^isub>1"} and @{text "\<pi>\<^isub>2"}, and for the
   764   proof obligation use @{text "\<pi>\<^isub>1 + \<pi>\<^isub>2"}. Equivariance means
   777   proof obligation use @{text "\<pi>\<^isub>1 + \<pi>\<^isub>2"}. Equivariance means
   765   @{term "abs_set (\<pi> \<bullet> as, \<pi> \<bullet> x) (\<pi> \<bullet> bs, \<pi> \<bullet> y)"} holds provided 
   778   @{term "abs_set (\<pi> \<bullet> as, \<pi> \<bullet> x) (\<pi> \<bullet> bs, \<pi> \<bullet> y)"} holds provided 
   766   @{term "abs_set (as, x) (bs, y)"}. To show this, we need to unfold the
   779   \mbox{@{term "abs_set (as, x) (bs, y)"}} holds. To show this, we need to unfold the
   767   definitions and `pull out' the permutations, which is possible since all
   780   definitions and `pull out' the permutations, which is possible since all
   768   operators, such as @{text "#\<^sup>*, -, set"} and @{text "supp"}, are equivariant
   781   operators, such as @{text "#\<^sup>*, -, set"} and @{text "supp"}, are equivariant
   769   (see \cite{HuffmanUrban10}).
   782   (see \cite{HuffmanUrban10}). Finally we apply the permutation operation on booleans.
   770   \end{proof}
   783   \end{proof}
   771 
   784 
   772   \noindent
   785   \noindent
   773   This lemma allows us to use our quotient package for introducing 
   786   This lemma allows us to use our quotient package for introducing 
   774   new types @{text "\<beta> abs\<^bsub>set\<^esub>"}, @{text "\<beta> abs\<^bsub>set+\<^esub>"} and @{text "\<beta> abs\<^bsub>list\<^esub>"}
   787   new types @{text "\<beta> abs\<^bsub>set\<^esub>"}, @{text "\<beta> abs\<^bsub>set+\<^esub>"} and @{text "\<beta> abs\<^bsub>list\<^esub>"}
   801   \end{array}
   814   \end{array}
   802   \]\smallskip
   815   \]\smallskip
   803   \end{thm}
   816   \end{thm}
   804 
   817 
   805   \noindent
   818   \noindent
   806   In effect, this theorem states that the bound names do not appear in the support
   819   In effect, this theorem states that the atoms @{text "as"} are bound in the
   807   of abstractions. This can be seen as test that our Definitions \ref{alphaset}, \ref{alphalist}
   820   abstraction. As stated earlier, this can be seen as test that our
   808   and \ref{alphares} capture the idea of alpha-equivalence relations. 
   821   Definitions \ref{alphaset}, \ref{alphalist} and \ref{alphares} capture the
   809   Below we will show the first equation of Theorem \ref{suppabs}. The others follow by similar
   822   idea of alpha-equivalence relations. Below we will give the proof for the
   810   arguments. By definition of the abstraction type @{text "abs\<^bsub>set\<^esub>"} we have
   823   first equation of Theorem \ref{suppabs}. The others follow by similar
       
   824   arguments. By definition of the abstraction type @{text
       
   825   "abs\<^bsub>set\<^esub>"} we have
   811 
   826 
   812   \begin{equation}\label{abseqiff}
   827   \begin{equation}\label{abseqiff}
   813   @{thm (lhs) Abs_eq_iff(1)[where bs="as" and cs="bs", no_vars]} \;\;\;\text{if and only if}\;\;\; 
   828   @{thm (lhs) Abs_eq_iff(1)[where bs="as" and cs="bs", no_vars]} \;\;\;\text{if and only if}\;\;\; 
   814   @{term "\<exists>\<pi>. alpha_set (as, x) equal supp \<pi> (bs, y)"}
   829   @{term "alpha_set_ex (as, x) equal supp (bs, y)"}
   815   \end{equation}\smallskip
   830   \end{equation}\smallskip
   816   
   831   
   817   \noindent
   832   \noindent
   818   and also
   833   and also
   819   
   834   
   834   \end{lem}
   849   \end{lem}
   835   
   850   
   836   \begin{proof}
   851   \begin{proof}
   837   This lemma is straightforward using \eqref{abseqiff} and observing that
   852   This lemma is straightforward using \eqref{abseqiff} and observing that
   838   the assumptions give us @{term "(a \<rightleftharpoons> b) \<bullet> (supp x - as) = (supp x - as)"}.
   853   the assumptions give us @{term "(a \<rightleftharpoons> b) \<bullet> (supp x - as) = (supp x - as)"}.
       
   854   We therefore can use as permutation the swapping @{term "(a \<rightleftharpoons> b)"}.
   839   \end{proof}
   855   \end{proof}
   840   
   856   
   841   \noindent
   857   \noindent
   842   Assuming that @{text "x"} has finite support, this lemma together 
   858   Assuming that @{text "x"} has finite support, this lemma together 
   843   with \eqref{absperm} allows us to show
   859   with \eqref{absperm} allows us to show
   865   \[
   881   \[
   866   @{term "supp (supp_set (Abs_set as x)) \<subseteq> supp (Abs_set as x)"}
   882   @{term "supp (supp_set (Abs_set as x)) \<subseteq> supp (Abs_set as x)"}
   867   \]\smallskip
   883   \]\smallskip
   868   
   884   
   869   \noindent
   885   \noindent
   870   using fact about function applications in \eqref{supps}. Assuming 
   886   using the fact about the support of function applications in \eqref{supps}. Assuming 
   871   @{term "supp x - as"} is a finite set, we further obtain
   887   @{term "supp x - as"} is a finite set, we further obtain
   872   
   888   
   873   \begin{equation}\label{halftwo}
   889   \begin{equation}\label{halftwo}
   874   @{thm (concl) Abs_supp_subset1(1)[no_vars]}
   890   @{thm (concl) Abs_supp_subset1(1)[no_vars]}
   875   \end{equation}\smallskip
   891   \end{equation}\smallskip
   876   
   892   
   877   \noindent
   893   \noindent
   878   since for every finite sets of atoms, say @{text "bs"}, we have 
   894   This is because for every finite sets of atoms, say @{text "bs"}, we have 
   879   @{thm (concl) supp_finite_atom_set[where S="bs", no_vars]}.
   895   @{thm (concl) supp_finite_atom_set[where S="bs", no_vars]}.
   880   Finally, taking \eqref{halfone} and \eqref{halftwo} together establishes 
   896   Finally, taking \eqref{halfone} and \eqref{halftwo} together establishes 
   881   Theorem~\ref{suppabs}. 
   897   Theorem~\ref{suppabs}. 
   882 
   898 
   883   The method of first considering abstractions of the form @{term "Abs_set as
   899   The method of first considering abstractions of the form @{term "Abs_set as
   896   and by the syntax of the
   912   and by the syntax of the
   897   Ott-tool \cite{ott-jfp}. For us a specification of a term-calculus is a
   913   Ott-tool \cite{ott-jfp}. For us a specification of a term-calculus is a
   898   collection of (possibly mutual recursive) type declarations, say @{text
   914   collection of (possibly mutual recursive) type declarations, say @{text
   899   "ty\<AL>\<^isub>1, \<dots>, ty\<AL>\<^isub>n"}, and an associated collection of
   915   "ty\<AL>\<^isub>1, \<dots>, ty\<AL>\<^isub>n"}, and an associated collection of
   900   binding functions, say @{text "bn\<AL>\<^isub>1, \<dots>, bn\<AL>\<^isub>m"}. The
   916   binding functions, say @{text "bn\<AL>\<^isub>1, \<dots>, bn\<AL>\<^isub>m"}. The
   901   syntax in Nominal Isabelle for such specifications is roughly as follows:
   917   syntax in Nominal Isabelle for such specifications is schematically as follows:
   902   
   918   
   903   \begin{equation}\label{scheme}
   919   \begin{equation}\label{scheme}
   904   \mbox{\begin{tabular}{@ {}p{2.5cm}l}
   920   \mbox{\begin{tabular}{@ {}p{2.5cm}l}
   905   type \mbox{declaration part} &
   921   type \mbox{declaration part} &
   906   $\begin{cases}
   922   $\begin{cases}
   908   \isacommand{nominal\_datatype} @{text "ty\<AL>\<^isub>1 = \<dots>"}\\
   924   \isacommand{nominal\_datatype} @{text "ty\<AL>\<^isub>1 = \<dots>"}\\
   909   \isacommand{and} @{text "ty\<AL>\<^isub>2 = \<dots>"}\\
   925   \isacommand{and} @{text "ty\<AL>\<^isub>2 = \<dots>"}\\
   910   \raisebox{2mm}{$\ldots$}\\[-2mm] 
   926   \raisebox{2mm}{$\ldots$}\\[-2mm] 
   911   \isacommand{and} @{text "ty\<AL>\<^isub>n = \<dots>"}\\ 
   927   \isacommand{and} @{text "ty\<AL>\<^isub>n = \<dots>"}\\ 
   912   \end{tabular}}
   928   \end{tabular}}
   913   \end{cases}$\\
   929   \end{cases}$\\[2mm]
   914   binding \mbox{function part} &
   930   binding \mbox{function part} &
   915   $\begin{cases}
   931   $\begin{cases}
   916   \mbox{\begin{tabular}{l}
   932   \mbox{\begin{tabular}{l}
   917   \isacommand{binder} @{text "bn\<AL>\<^isub>1"} \isacommand{and} \ldots \isacommand{and} @{text "bn\<AL>\<^isub>m"}\\
   933   \isacommand{binder} @{text "bn\<AL>\<^isub>1"} \isacommand{and} \ldots \isacommand{and} @{text "bn\<AL>\<^isub>m"}\\
   918   \isacommand{where}\\
   934   \isacommand{where}\\
   984   There are also some restrictions we need to impose on our binding clauses in
  1000   There are also some restrictions we need to impose on our binding clauses in
   985   comparison to the ones of Ott. The main idea behind these restrictions is
  1001   comparison to the ones of Ott. The main idea behind these restrictions is
   986   that we obtain a sensible notion of alpha-equivalence where it is ensured
  1002   that we obtain a sensible notion of alpha-equivalence where it is ensured
   987   that within a given scope an atom occurrence cannot be both bound and free
  1003   that within a given scope an atom occurrence cannot be both bound and free
   988   at the same time.  The first restriction is that a body can only occur in
  1004   at the same time.  The first restriction is that a body can only occur in
   989   \emph{one} binding clause of a term constructor (this ensures that the bound
  1005   \emph{one} binding clause of a term constructor. So for example
   990   atoms of a body cannot be free at the same time by specifying an alternative
  1006 
   991   binder for the same body).
  1007   \[\mbox{
       
  1008   @{text "Foo x::name y::name t::trm"}\hspace{3mm}  
       
  1009   \isacommand{binds} @{text "x"} \isacommand{in} @{text "t"},
       
  1010   \isacommand{binds} @{text "y"} \isacommand{in} @{text "t"}}
       
  1011   \]\smallskip
       
  1012 
       
  1013   \noindent
       
  1014   is not allowed. This ensures that the bound atoms of a body cannot be free
       
  1015   at the same time by specifying an alternative binder for the same body.
   992 
  1016 
   993   For binders we distinguish between \emph{shallow} and \emph{deep} binders.
  1017   For binders we distinguish between \emph{shallow} and \emph{deep} binders.
   994   Shallow binders are just labels. The restriction we need to impose on them
  1018   Shallow binders are just labels. The restriction we need to impose on them
   995   is that in case of \isacommand{binds (set)} and \isacommand{binds (set+)} the
  1019   is that in case of \isacommand{binds (set)} and \isacommand{binds (set+)} the
   996   labels must either refer to atom types or to sets of atom types; in case of
  1020   labels must either refer to atom types or to sets of atom types; in case of
  1019   \]\smallskip
  1043   \]\smallskip
  1020 
  1044 
  1021 
  1045 
  1022   \noindent
  1046   \noindent
  1023   In these specifications @{text "name"} refers to an atom type, and @{text
  1047   In these specifications @{text "name"} refers to an atom type, and @{text
  1024   "fset"} to the type of finite sets.  Note that for @{text lam} it does not
  1048   "fset"} to the type of finite sets.  Note that for @{text Lam} it does not
  1025   matter which binding mode we use. The reason is that we bind only a single
  1049   matter which binding mode we use. The reason is that we bind only a single
  1026   @{text name}. However, having \isacommand{binds (set)} or \isacommand{binds}
  1050   @{text name}. However, having \isacommand{binds (set)} or just \isacommand{binds}
  1027   in the second case makes a difference to the semantics of the specification
  1051   in the second case makes a difference to the semantics of the specification
  1028   (which we will define in the next section).
  1052   (which we will define in the next section).
  1029 
  1053 
  1030   A \emph{deep} binder uses an auxiliary binding function that ``picks'' out
  1054   A \emph{deep} binder uses an auxiliary binding function that ``picks'' out
  1031   the atoms in one argument of the term-constructor, which can be bound in
  1055   the atoms in one argument of the term-constructor, which can be bound in
  1106   notions of free-atoms and alpha-equivalence.
  1130   notions of free-atoms and alpha-equivalence.
  1107   
  1131   
  1108   To make sure that atoms bound by deep binders cannot be free at the
  1132   To make sure that atoms bound by deep binders cannot be free at the
  1109   same time, we cannot have more than one binding function for a deep binder. 
  1133   same time, we cannot have more than one binding function for a deep binder. 
  1110   Consequently we exclude specifications such as
  1134   Consequently we exclude specifications such as
  1111   %
  1135 
  1112   \begin{center}
  1136   \[\mbox{
  1113   \begin{tabular}{@ {}l@ {\hspace{2mm}}l@ {}}
  1137   \begin{tabular}{@ {}l@ {\hspace{2mm}}l@ {}}
  1114   @{text "Baz\<^isub>1 p::pat t::trm"} & 
  1138   @{text "Baz\<^isub>1 p::pat t::trm"} & 
  1115      \isacommand{binds} @{text "bn\<^isub>1(p) bn\<^isub>2(p)"} \isacommand{in} @{text t}\\
  1139      \isacommand{binds} @{text "bn\<^isub>1(p) bn\<^isub>2(p)"} \isacommand{in} @{text t}\\
  1116   @{text "Baz\<^isub>2 p::pat t\<^isub>1::trm t\<^isub>2::trm"} & 
  1140   @{text "Baz\<^isub>2 p::pat t\<^isub>1::trm t\<^isub>2::trm"} & 
  1117      \isacommand{binds} @{text "bn\<^isub>1(p)"} \isacommand{in} @{text "t\<^isub>1"},
  1141      \isacommand{binds} @{text "bn\<^isub>1(p)"} \isacommand{in} @{text "t\<^isub>1"},
  1118      \isacommand{binds} @{text "bn\<^isub>2(p)"} \isacommand{in} @{text "t\<^isub>2"}\\
  1142      \isacommand{binds} @{text "bn\<^isub>2(p)"} \isacommand{in} @{text "t\<^isub>2"}\\
  1119   \end{tabular}
  1143   \end{tabular}}
  1120   \end{center}
  1144   \]\smallskip
  1121 
  1145 
  1122   \noindent
  1146   \noindent
  1123   Otherwise it is possible that @{text "bn\<^isub>1"} and @{text "bn\<^isub>2"}  pick 
  1147   Otherwise it is possible that @{text "bn\<^isub>1"} and @{text "bn\<^isub>2"}  pick 
  1124   out different atoms to become bound, respectively be free, in @{text "p"}.
  1148   out different atoms to become bound, respectively be free, in @{text "p"}.
  1125   (Since the Ott-tool does not derive a reasoning infrastructure for 
  1149   (Since the Ott-tool does not derive a reasoning infrastructure for 
  1126   alpha-equated terms with deep binders, it can permit such specifications.)
  1150   alpha-equated terms with deep binders, it can permit such specifications.)
  1127   
  1151   
  1128   We also need to restrict the form of the binding functions in order 
  1152   We also need to restrict the form of the binding functions in order to
  1129   to ensure the @{text "bn"}-functions can be defined for alpha-equated 
  1153   ensure the @{text "bn"}-functions can be defined for alpha-equated
  1130   terms. The main restriction is that we cannot return an atom in a binding function that is also
  1154   terms. The main restriction is that we cannot return an atom in a binding
  1131   bound in the corresponding term-constructor. That means in \eqref{letpat} 
  1155   function that is also bound in the corresponding term-constructor.
  1132   that the term-constructors @{text PVar} and @{text PTup} may
  1156   Consider again the specification for @{text "trm"} and a contrived
  1133   not have a binding clause (all arguments are used to define @{text "bn"}).
  1157   version for assignments, @{text "assn"}:
  1134   In contrast, in case of \eqref{letrecs} the term-constructor @{text ACons}
  1158 
  1135   may have a binding clause involving the argument @{text trm} (the only one that
  1159   \begin{equation}\label{bnexp}
  1136   is \emph{not} used in the definition of the binding function). This restriction
  1160   \mbox{%
  1137   is sufficient for lifting the binding function to alpha-equated terms.
  1161   \begin{tabular}{@ {}l@ {}}
  1138 
  1162   \isacommand{nominal\_datatype}~@{text "trm ="}~\ldots\\
  1139   In the version of
  1163   \isacommand{and} @{text "assn"} $=$\\
  1140   Nominal Isabelle described here, we also adopted the restriction from the
  1164   \hspace{5mm}\phantom{$\mid$}~@{text "ANil"}\\
  1141   Ott-tool that binding functions can only return: the empty set or empty list
  1165   \hspace{5mm}$\mid$~@{text "ACons x::name y::name t::trm assn"}
  1142   (as in case @{text PNil}), a singleton set or singleton list containing an
  1166      \;\;\isacommand{binds} @{text "y"} \isacommand{in} @{text t}\\
  1143   atom (case @{text PVar}), or unions of atom sets or appended atom lists
  1167   \isacommand{binder} @{text "bn::assn \<Rightarrow> atom list"}\\
  1144   (case @{text PTup}). This restriction will simplify some automatic definitions and proofs
  1168   \isacommand{where}~@{text "bn(ANil) = []"}\\
  1145   later on.
  1169   \hspace{5mm}$\mid$~@{text "bn(ACons x y t as) = [atom x] @ bn(as)"}\\
       
  1170   \end{tabular}}
       
  1171   \end{equation}\smallskip
       
  1172 
       
  1173   \noindent
       
  1174   In this example the term constructor @{text "ACons"} contains a binding 
       
  1175   clause, and also is used in the definition of the binding function. The
       
  1176   restriction we have to impose is that the binding function can only return
       
  1177   free atoms, that is the ones that are not mentioned in a binding clause.
       
  1178   Therefore @{text "y"} cannot be used in the binding function, @{text "bn"}
       
  1179   (since it is bound in @{text "ACons"} by the binding clause), but @{text x}
       
  1180   can (since it is a free atom). This restriction is sufficient for lifting 
       
  1181   the binding function to alpha-equated terms. If we would allow that @{text "bn"}
       
  1182   can return also @{text "y"}, then it would not be respectful and therefore
       
  1183   cannot be lifted.
       
  1184 
       
  1185   In the version of Nominal Isabelle described here, we also adopted the
       
  1186   restriction from the Ott-tool that binding functions can only return: the
       
  1187   empty set or empty list (as in case @{text ANil}), a singleton set or
       
  1188   singleton list containing an atom (case @{text PVar} in \eqref{letpat}), or
       
  1189   unions of atom sets or appended atom lists (case @{text ACons}). This
       
  1190   restriction will simplify some automatic definitions and proofs later on.
  1146   
  1191   
  1147   In order to simplify our definitions of free atoms and alpha-equivalence, 
  1192   In order to simplify our definitions of free atoms and alpha-equivalence, 
  1148   we shall assume specifications 
  1193   we shall assume specifications 
  1149   of term-calculi are implicitly \emph{completed}. By this we mean that  
  1194   of term-calculi are implicitly \emph{completed}. By this we mean that  
  1150   for every argument of a term-constructor that is \emph{not} 
  1195   for every argument of a term-constructor that is \emph{not} 
  1151   already part of a binding clause given by the user, we add implicitly a special \emph{empty} binding
  1196   already part of a binding clause given by the user, we add implicitly a special \emph{empty} binding
  1152   clause, written \isacommand{binds}~@{term "{}"}~\isacommand{in}~@{text "labels"}. In case
  1197   clause, written \isacommand{binds}~@{term "{}"}~\isacommand{in}~@{text "labels"}. In case
  1153   of the lambda-terms, the completion produces
  1198   of the lambda-terms, the completion produces
  1154 
  1199 
  1155   \begin{center}
  1200   \[\mbox{
  1156   \begin{tabular}{@ {}l@ {\hspace{-1mm}}}
  1201   \begin{tabular}{@ {}l@ {\hspace{-1mm}}}
  1157   \isacommand{nominal\_datatype} @{text lam} =\\
  1202   \isacommand{nominal\_datatype} @{text lam} =\\
  1158   \hspace{5mm}\phantom{$\mid$}~@{text "Var x::name"}
  1203   \hspace{5mm}\phantom{$\mid$}~@{text "Var x::name"}
  1159     \;\;\isacommand{binds}~@{term "{}"}~\isacommand{in}~@{text "x"}\\
  1204     \;\;\isacommand{binds}~@{term "{}"}~\isacommand{in}~@{text "x"}\\
  1160   \hspace{5mm}$\mid$~@{text "App t\<^isub>1::lam t\<^isub>2::lam"}
  1205   \hspace{5mm}$\mid$~@{text "App t\<^isub>1::lam t\<^isub>2::lam"}
  1161     \;\;\isacommand{binds}~@{term "{}"}~\isacommand{in}~@{text "t\<^isub>1 t\<^isub>2"}\\
  1206     \;\;\isacommand{binds}~@{term "{}"}~\isacommand{in}~@{text "t\<^isub>1 t\<^isub>2"}\\
  1162   \hspace{5mm}$\mid$~@{text "Lam x::name t::lam"}
  1207   \hspace{5mm}$\mid$~@{text "Lam x::name t::lam"}
  1163     \;\;\isacommand{binds}~@{text x} \isacommand{in} @{text t}\\
  1208     \;\;\isacommand{binds}~@{text x} \isacommand{in} @{text t}\\
  1164   \end{tabular}
  1209   \end{tabular}}
  1165   \end{center}
  1210   \]\smallskip
  1166 
  1211 
  1167   \noindent 
  1212   \noindent 
  1168   The point of completion is that we can make definitions over the binding
  1213   The point of completion is that we can make definitions over the binding
  1169   clauses and be sure to have captured all arguments of a term constructor. 
  1214   clauses and be sure to have captured all arguments of a term constructor. 
  1170 *}
  1215 *}
  1172 section {* Alpha-Equivalence and Free Atoms\label{sec:alpha} *}
  1217 section {* Alpha-Equivalence and Free Atoms\label{sec:alpha} *}
  1173 
  1218 
  1174 text {*
  1219 text {*
  1175   Having dealt with all syntax matters, the problem now is how we can turn
  1220   Having dealt with all syntax matters, the problem now is how we can turn
  1176   specifications into actual type definitions in Isabelle/HOL and then
  1221   specifications into actual type definitions in Isabelle/HOL and then
  1177   establish a reasoning infrastructure for them. As
  1222   establish a reasoning infrastructure for them. As Pottier and Cheney pointed
  1178   Pottier and Cheney pointed out \cite{Pottier06,Cheney05}, just 
  1223   out \cite{Cheney05,Pottier06}, just re-arranging the arguments of
  1179   re-arranging the arguments of
  1224   term-constructors so that binders and their bodies are next to each other
  1180   term-constructors so that binders and their bodies are next to each other will 
  1225   will result in inadequate representations in cases like \mbox{@{text "Let
  1181   result in inadequate representations in cases like @{text "Let x\<^isub>1 = t\<^isub>1\<dots>x\<^isub>n = t\<^isub>n in s"}. 
  1226   x\<^isub>1 = t\<^isub>1\<dots>x\<^isub>n = t\<^isub>n in s"}}. Therefore we will
  1182   Therefore we will first
  1227   first extract ``raw'' datatype definitions from the specification and then
  1183   extract ``raw'' datatype definitions from the specification and then define 
  1228   define explicitly an alpha-equivalence relation over them. We subsequently
  1184   explicitly an alpha-equivalence relation over them. We subsequently
       
  1185   construct the quotient of the datatypes according to our alpha-equivalence.
  1229   construct the quotient of the datatypes according to our alpha-equivalence.
       
  1230 
  1186 
  1231 
  1187   The ``raw'' datatype definition can be obtained by stripping off the 
  1232   The ``raw'' datatype definition can be obtained by stripping off the 
  1188   binding clauses and the labels from the types. We also have to invent
  1233   binding clauses and the labels from the types. We also have to invent
  1189   new names for the types @{text "ty\<^sup>\<alpha>"} and term-constructors @{text "C\<^sup>\<alpha>"}
  1234   new names for the types @{text "ty\<^sup>\<alpha>"} and term-constructors @{text "C\<^sup>\<alpha>"}
  1190   given by the user. In our implementation we just use the affix ``@{text "_raw"}''.
  1235   given by the user. In our implementation we just use the affix ``@{text "_raw"}''.
  1201   in Isabelle/HOL). 
  1246   in Isabelle/HOL). 
  1202   We subsequently define each of the user-specified binding 
  1247   We subsequently define each of the user-specified binding 
  1203   functions @{term "bn"}$_{1..m}$ by recursion over the corresponding 
  1248   functions @{term "bn"}$_{1..m}$ by recursion over the corresponding 
  1204   raw datatype. We can also easily define permutation operations by 
  1249   raw datatype. We can also easily define permutation operations by 
  1205   recursion so that for each term constructor @{text "C"} we have that
  1250   recursion so that for each term constructor @{text "C"} we have that
  1206   %
  1251   
  1207   \begin{equation}\label{ceqvt}
  1252   \begin{equation}\label{ceqvt}
  1208   @{text "p \<bullet> (C z\<^isub>1 \<dots> z\<^isub>n) = C (p \<bullet> z\<^isub>1) \<dots> (p \<bullet> z\<^isub>n)"}
  1253   @{text "\<pi> \<bullet> (C z\<^isub>1 \<dots> z\<^isub>n) = C (\<pi> \<bullet> z\<^isub>1) \<dots> (\<pi> \<bullet> z\<^isub>n)"}
  1209   \end{equation}
  1254   \end{equation}\smallskip
  1210 
  1255 
  1211   The first non-trivial step we have to perform is the generation of
  1256   The first non-trivial step we have to perform is the generation of
  1212   free-atom functions from the specification. For the 
  1257   \emph{free-atom functions} from the specification.\footnote{Admittedly, the
       
  1258   details of our definitions are somewhat involved. However they are still
       
  1259   conceptually simple in comparison with the ``positional'' approach taken in
       
  1260   Ott \cite[Pages 88--95]{ott-jfp}, which uses \emph{occurences} and
       
  1261   \emph{partial equivalence relations} over sets of occurences.} For the
  1213   \emph{raw} types @{text "ty"}$_{1..n}$ we define the free-atom functions
  1262   \emph{raw} types @{text "ty"}$_{1..n}$ we define the free-atom functions
  1214   
  1263 
  1215   \begin{equation}\label{fvars}
  1264   \begin{equation}\label{fvars}
  1216   \mbox{@{text "fa_ty"}$_{1..n}$}
  1265   \mbox{@{text "fa_ty"}$_{1..n}$}
  1217   \end{equation}
  1266   \end{equation}\smallskip
  1218   
  1267   
  1219   \noindent
  1268   \noindent
  1220   by recursion.
  1269   by recursion.
  1221   We define these functions together with auxiliary free-atom functions for
  1270   We define these functions together with auxiliary free-atom functions for
  1222   the binding functions. Given raw binding functions @{text "bn"}$_{1..m}$ 
  1271   the binding functions. Given raw binding functions @{text "bn"}$_{1..m}$ 
  1223   we define
  1272   we define
  1224   
  1273   
  1225   \begin{center}
  1274   \[
  1226   @{text "fa_bn"}$_{1..m}$.
  1275   @{text "fa_bn"}\mbox{$_{1..m}$}.
  1227   \end{center}
  1276   \]\smallskip
  1228   
  1277   
  1229   \noindent
  1278   \noindent
  1230   The reason for this setup is that in a deep binder not all atoms have to be
  1279   The reason for this setup is that in a deep binder not all atoms have to be
  1231   bound, as we saw in the example with ``plain'' @{text Let}s. We need therefore a function
  1280   bound, as we saw in the example with ``plain'' @{text Let}s. We need therefore a function
  1232   that calculates those free atoms in a deep binder.
  1281   that calculates those free atoms in a deep binder.
  1239   "fa_ty (C z\<^isub>1 \<dots> z\<^isub>n)"} will be the union @{text
  1288   "fa_ty (C z\<^isub>1 \<dots> z\<^isub>n)"} will be the union @{text
  1240   "fa(bc\<^isub>1) \<union> \<dots> \<union> fa(bc\<^isub>k)"} where we will define below what @{text "fa"} for a binding
  1289   "fa(bc\<^isub>1) \<union> \<dots> \<union> fa(bc\<^isub>k)"} where we will define below what @{text "fa"} for a binding
  1241   clause means. We only show the details for the mode \isacommand{binds (set)} (the other modes are similar). 
  1290   clause means. We only show the details for the mode \isacommand{binds (set)} (the other modes are similar). 
  1242   Suppose the binding clause @{text bc\<^isub>i} is of the form 
  1291   Suppose the binding clause @{text bc\<^isub>i} is of the form 
  1243   
  1292   
  1244   \begin{center}
  1293   \[
  1245   \mbox{\isacommand{binds (set)} @{text "b\<^isub>1\<dots>b\<^isub>p"} \isacommand{in} @{text "d\<^isub>1\<dots>d\<^isub>q"}}
  1294   \mbox{\isacommand{binds (set)} @{text "b\<^isub>1\<dots>b\<^isub>p"} \isacommand{in} @{text "d\<^isub>1\<dots>d\<^isub>q"}}
  1246   \end{center}
  1295   \]\smallskip
  1247   
  1296   
  1248   \noindent
  1297   \noindent
  1249   in which the body-labels @{text "d"}$_{1..q}$ refer to types @{text ty}$_{1..q}$,
  1298   in which the body-labels @{text "d"}$_{1..q}$ refer to types @{text
  1250   and the binders @{text b}$_{1..p}$
  1299   ty}$_{1..q}$, and the binders @{text b}$_{1..p}$ either refer to labels of
  1251   either refer to labels of atom types (in case of shallow binders) or to binding 
  1300   atom types (in case of shallow binders) or to binding functions taking a
  1252   functions taking a single label as argument (in case of deep binders). Assuming 
  1301   single label as argument (in case of deep binders). Assuming @{text "D"}
  1253   @{text "D"} stands for the set of free atoms of the bodies, @{text B} for the 
  1302   stands for the set of free atoms of the bodies, @{text B} for the set of
  1254   set of binding atoms in the binders and @{text "B'"} for the set of free atoms in 
  1303   binding atoms in the binders and @{text "B'"} for the set of free atoms in
  1255   non-recursive deep binders,
  1304   non-recursive deep binders, then the free atoms of the binding clause @{text
  1256   then the free atoms of the binding clause @{text bc\<^isub>i} are\\[-2mm]
  1305   bc\<^isub>i} are
  1257   %
  1306 
  1258   \begin{equation}\label{fadef}
  1307   \begin{equation}\label{fadef}
  1259   \mbox{@{text "fa(bc\<^isub>i) \<equiv> (D - B) \<union> B'"}}.
  1308   \mbox{@{text "fa(bc\<^isub>i) \<equiv> (D - B) \<union> B'"}}.
  1260   \end{equation}
  1309   \end{equation}\smallskip
  1261   %
  1310   
  1262   \noindent
  1311   \noindent
  1263   The set @{text D} is formally defined as
  1312   The set @{text D} is formally defined as
  1264   
  1313   
  1265   \begin{center}
  1314   \[
  1266   @{text "D \<equiv> fa_ty\<^isub>1 d\<^isub>1 \<union> ... \<union> fa_ty\<^isub>q d\<^isub>q"}
  1315   @{text "D \<equiv> fa_ty\<^isub>1 d\<^isub>1 \<union> ... \<union> fa_ty\<^isub>q d\<^isub>q"}
  1267   \end{center} 
  1316   \]\smallskip
  1268   
  1317   
  1269   \noindent
  1318   \noindent
  1270   where in case @{text "d\<^isub>i"} refers to one of the raw types @{text "ty"}$_{1..n}$ from the 
  1319   where in case @{text "d\<^isub>i"} refers to one of the raw types @{text "ty"}$_{1..n}$ from the 
  1271   specification, the function @{text "fa_ty\<^isub>i"} is the corresponding free-atom function 
  1320   specification, the function @{text "fa_ty\<^isub>i"} is the corresponding free-atom function 
  1272   we are defining by recursion; 
  1321   we are defining by recursion; otherwise we set \mbox{@{text "fa_ty\<^isub>i d\<^isub>i = supp d\<^isub>i"}}. The reason
  1273   (see \eqref{fvars}); 
  1322   for the latter choice is that @{text "ty"}$_i$ is not a type that is part of the specification, and
  1274   otherwise we set @{text "fa_ty\<^isub>i d\<^isub>i = supp d\<^isub>i"}.
  1323   we assume @{text supp} is the generic notion that characterises the free variables of 
       
  1324   a type (in fact in the next section we will show that the free-variable functions we
       
  1325   define here, are equal to the support once lifted to alpha-equivalence classes).
  1275   
  1326   
  1276   In order to formally define the set @{text B} we use the following auxiliary @{text "bn"}-functions
  1327   In order to formally define the set @{text B} we use the following auxiliary @{text "bn"}-functions
  1277   for atom types to which shallow binders may refer\\[-4mm]
  1328   for atom types to which shallow binders may refer\\[-4mm]
  1278   
  1329   
  1279   \begin{center}
  1330   \[\mbox{
  1280   \begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
  1331   \begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
  1281   @{text "bn_atom a"} & @{text "\<equiv>"} & @{text "{atom a}"}\\
  1332   @{text "bn\<^bsub>atom\<^esup> a"} & @{text "\<equiv>"} & @{text "{atom a}"}\\
  1282   @{text "bn_atom_set as"} & @{text "\<equiv>"} & @{text "atoms as"}\\
  1333   @{text "bn\<^bsub>atom_set\<^esup> as"} & @{text "\<equiv>"} & @{text "atoms as"}\\
  1283   @{text "bn_atom_list as"} & @{text "\<equiv>"} & @{text "atoms (set as)"}
  1334   @{text "bn\<^bsub>atom_list\<^esub> as"} & @{text "\<equiv>"} & @{text "atoms (set as)"}
  1284   \end{tabular}
  1335   \end{tabular}}
  1285   \end{center}
  1336   \]\smallskip
  1286   
  1337   
  1287   \begin{center}
       
  1288   @{text "bn\<^bsub>atom\<^esub> a \<equiv> {atom a}"}\hfill
       
  1289   @{text "bn\<^bsub>atom_set\<^esub> as \<equiv> atoms as"}\hfill
       
  1290   @{text "bn\<^bsub>atom_list\<^esub> as \<equiv> atoms (set as)"}
       
  1291   \end{center}
       
  1292   %
       
  1293   \noindent 
  1338   \noindent 
  1294   Like the function @{text atom}, the function @{text "atoms"} coerces 
  1339   Like the function @{text atom}, the function @{text "atoms"} coerces 
  1295   a set of atoms to a set of the generic atom type. 
  1340   a set of atoms to a set of the generic atom type. 
  1296   It is defined as  @{text "atoms as \<equiv> {atom a | a \<in> as}"}. 
  1341   It is defined as  @{text "atoms as \<equiv> {atom a | a \<in> as}"}. 
  1297   The set @{text B} is then formally defined as\\[-4mm]
  1342   The set @{text B} is then formally defined as
  1298   %
  1343   
  1299   \begin{center}
  1344   \begin{equation}\label{bdef}
  1300   @{text "B \<equiv> bn_ty\<^isub>1 b\<^isub>1 \<union> ... \<union> bn_ty\<^isub>p b\<^isub>p"}
  1345   @{text "B \<equiv> bn_ty\<^isub>1 b\<^isub>1 \<union> ... \<union> bn_ty\<^isub>p b\<^isub>p"}
  1301   \end{center} 
  1346   \end{equation}\smallskip
  1302   %
  1347 
  1303   \noindent 
  1348   \noindent 
  1304   where we use the auxiliary binding functions for shallow binders. 
  1349   where we use the auxiliary binding functions for shallow binders (that means
  1305   The set @{text "B'"} collects all free atoms in non-recursive deep
  1350   when @{text "ty"}$_i$ is of type @{text "atom"}, @{text "atom set"} or
  1306   binders. Let us assume these binders in @{text "bc\<^isub>i"} are
  1351   @{text "atom list"}). The set @{text "B'"} collects all free atoms in
  1307   
  1352   non-recursive deep binders. Let us assume these binders in the binding 
  1308   \begin{center}
  1353   clause @{text "bc\<^isub>i"} are
       
  1354 
       
  1355   \[
  1309   \mbox{@{text "bn\<^isub>1 l\<^isub>1, \<dots>, bn\<^isub>r l\<^isub>r"}}
  1356   \mbox{@{text "bn\<^isub>1 l\<^isub>1, \<dots>, bn\<^isub>r l\<^isub>r"}}
  1310   \end{center}
  1357   \]\smallskip
  1311   
  1358   
  1312   \noindent
  1359   \noindent
  1313   with @{text "l"}$_{1..r}$ $\subseteq$ @{text "b"}$_{1..p}$ and none of the 
  1360   with @{text "l"}$_{1..r}$ $\subseteq$ @{text "b"}$_{1..p}$ (see
  1314   @{text "l"}$_{1..r}$ being among the bodies @{text
  1361   \eqref{bdef}) and none of the @{text "l"}$_{1..r}$ being among the bodies
  1315   "d"}$_{1..q}$. The set @{text "B'"} is defined as\\[-5mm]
  1362   @{text "d"}$_{1..q}$. The set @{text "B'"} is defined as
  1316   %
  1363   
  1317   \begin{center}
  1364   \begin{equation}\label{bprimedef}
  1318   @{text "B' \<equiv> fa_bn\<^isub>1 l\<^isub>1 \<union> ... \<union> fa_bn\<^isub>r l\<^isub>r"}\\[-9mm]
  1365   @{text "B' \<equiv> fa_bn\<^isub>1 l\<^isub>1 \<union> ... \<union> fa_bn\<^isub>r l\<^isub>r"}
  1319   \end{center}
  1366   \end{equation}\smallskip
  1320   %
  1367   
  1321   \noindent
  1368   \noindent
  1322   This completes the definition of the free-atom functions @{text "fa_ty"}$_{1..n}$.
  1369   This completes the definition of the free-atom functions @{text "fa_ty"}$_{1..n}$.
  1323 
  1370 
  1324   Note that for non-recursive deep binders, we have to add in \eqref{fadef}
  1371   Note that for non-recursive deep binders, we have to add in \eqref{fadef}
  1325   the set of atoms that are left unbound by the binding functions @{text
  1372   the set of atoms that are left unbound by the binding functions @{text
  1326   "bn"}$_{1..m}$. We used for the definition of
  1373   "bn"}$_{1..m}$, see also the definition in \eqref{bprimedef}. We used for
  1327   this set the functions @{text "fa_bn"}$_{1..m}$, which are also defined by mutual
  1374   the definition of this set the functions @{text "fa_bn"}$_{1..m}$. The
  1328   recursion. Assume the user specified a @{text bn}-clause of the form
  1375   definition for those functions needs to be extracted from the clauses the
  1329   
  1376   user provided for @{text "bn"}$_{1..m}$ Assume the user specified a @{text
  1330   \begin{center}
  1377   bn}-clause of the form
       
  1378   
       
  1379   \[
  1331   @{text "bn (C z\<^isub>1 \<dots> z\<^isub>s) = rhs"}
  1380   @{text "bn (C z\<^isub>1 \<dots> z\<^isub>s) = rhs"}
  1332   \end{center}
  1381   \]\smallskip
  1333   
  1382   
  1334   \noindent
  1383   \noindent
  1335   where the @{text "z"}$_{1..s}$ are of types @{text "ty"}$_{1..s}$. For each of
  1384   where the @{text "z"}$_{1..s}$ are of types @{text "ty"}$_{1..s}$. For 
  1336   the arguments we calculate the free atoms as follows:
  1385   each of the arguments we calculate the free atoms as follows:
  1337   
  1386   
  1338   \begin{center}
  1387   \[\mbox{
  1339   \begin{tabular}{c@ {\hspace{2mm}}p{0.9\textwidth}}
  1388   \begin{tabular}{c@ {\hspace{2mm}}p{0.9\textwidth}}
  1340   $\bullet$ & @{term "fa_ty\<^isub>i z\<^isub>i"} provided @{text "z\<^isub>i"} does not occur in @{text "rhs"} 
  1389   $\bullet$ & @{term "fa_ty\<^isub>i z\<^isub>i"} provided @{text "z\<^isub>i"} does not occur in @{text "rhs"}\\ 
  1341   (that means nothing is bound in @{text "z\<^isub>i"} by the binding function),\\
  1390   & (that means nothing is bound in @{text "z\<^isub>i"} by the binding function),\smallskip\\
  1342   $\bullet$ & @{term "fa_bn\<^isub>i z\<^isub>i"} provided @{text "z\<^isub>i"} occurs in  @{text "rhs"}
  1391   $\bullet$ & @{term "fa_bn\<^isub>i z\<^isub>i"} provided @{text "z\<^isub>i"} occurs in  @{text "rhs"}
  1343   with the recursive call @{text "bn\<^isub>i z\<^isub>i"}, and\\
  1392   with the recursive call @{text "bn\<^isub>i z\<^isub>i"}, and\smallskip\\
  1344   $\bullet$ & @{term "{}"} provided @{text "z\<^isub>i"} occurs in  @{text "rhs"},
  1393   $\bullet$ & @{term "{}"} provided @{text "z\<^isub>i"} occurs in  @{text "rhs"},
  1345   but without a recursive call.
  1394   but without a recursive call\\
  1346   \end{tabular}
  1395   & (that means @{text "z\<^isub>i"} is supposed to become bound by the binding function)\\
  1347   \end{center}
  1396   \end{tabular}}
       
  1397   \]\smallskip
  1348   
  1398   
  1349   \noindent
  1399   \noindent
  1350   For defining @{text "fa_bn (C z\<^isub>1 \<dots> z\<^isub>n)"} we just union up all these sets.
  1400   For defining @{text "fa_bn (C z\<^isub>1 \<dots> z\<^isub>n)"} we just union up all these sets.
  1351  
  1401  
  1352   To see how these definitions work in practice, let us reconsider the
  1402   To see how these definitions work in practice, let us reconsider the
  1354   \eqref{letrecs} together with the term-constructors for assignments @{text
  1404   \eqref{letrecs} together with the term-constructors for assignments @{text
  1355   "ANil"} and @{text "ACons"}. Since there is a binding function defined for
  1405   "ANil"} and @{text "ACons"}. Since there is a binding function defined for
  1356   assignments, we have three free-atom functions, namely @{text
  1406   assignments, we have three free-atom functions, namely @{text
  1357   "fa\<^bsub>trm\<^esub>"}, @{text "fa\<^bsub>assn\<^esub>"} and @{text
  1407   "fa\<^bsub>trm\<^esub>"}, @{text "fa\<^bsub>assn\<^esub>"} and @{text
  1358   "fa\<^bsub>bn\<^esub>"} as follows:
  1408   "fa\<^bsub>bn\<^esub>"} as follows:
  1359   %
  1409   
  1360   \begin{center}
  1410   \[\mbox{
  1361   \begin{tabular}{@ {}l@ {\hspace{1mm}}c@ {\hspace{1mm}}l@ {}}
  1411   \begin{tabular}{@ {}l@ {\hspace{1mm}}c@ {\hspace{1mm}}l@ {}}
  1362   @{text "fa\<^bsub>trm\<^esub> (Let as t)"} & @{text "="} & @{text "(fa\<^bsub>trm\<^esub> t - set (bn as)) \<union> fa\<^bsub>bn\<^esub> as"}\\
  1412   @{text "fa\<^bsub>trm\<^esub> (Let as t)"} & @{text "="} & @{text "(fa\<^bsub>trm\<^esub> t - set (bn as)) \<union> fa\<^bsub>bn\<^esub> as"}\\
  1363   @{text "fa\<^bsub>trm\<^esub> (Let_rec as t)"} & @{text "="} & @{text "(fa\<^bsub>assn\<^esub> as \<union> fa\<^bsub>trm\<^esub> t) - set (bn as)"}\\[1mm]
  1413   @{text "fa\<^bsub>trm\<^esub> (Let_rec as t)"} & @{text "="} & @{text "(fa\<^bsub>assn\<^esub> as \<union> fa\<^bsub>trm\<^esub> t) - set (bn as)"}\smallskip\\
  1364 
  1414 
  1365   @{text "fa\<^bsub>assn\<^esub> (ANil)"} & @{text "="} & @{term "{}"}\\
  1415   @{text "fa\<^bsub>assn\<^esub> (ANil)"} & @{text "="} & @{term "{}"}\\
  1366   @{text "fa\<^bsub>assn\<^esub> (ACons a t as)"} & @{text "="} & @{text "(supp a) \<union> (fa\<^bsub>trm\<^esub> t) \<union> (fa\<^bsub>assn\<^esub> as)"}\\[1mm]
  1416   @{text "fa\<^bsub>assn\<^esub> (ACons a t as)"} & @{text "="} & @{text "(supp a) \<union> (fa\<^bsub>trm\<^esub> t) \<union> (fa\<^bsub>assn\<^esub> as)"}\smallskip\\
  1367 
  1417 
  1368   @{text "fa\<^bsub>bn\<^esub> (ANil)"} & @{text "="} & @{term "{}"}\\
  1418   @{text "fa\<^bsub>bn\<^esub> (ANil)"} & @{text "="} & @{term "{}"}\\
  1369   @{text "fa\<^bsub>bn\<^esub> (ACons a t as)"} & @{text "="} & @{text "(fa\<^bsub>trm\<^esub> t) \<union> (fa\<^bsub>bn\<^esub> as)"}
  1419   @{text "fa\<^bsub>bn\<^esub> (ACons a t as)"} & @{text "="} & @{text "(fa\<^bsub>trm\<^esub> t) \<union> (fa\<^bsub>bn\<^esub> as)"}
  1370   \end{tabular}
  1420   \end{tabular}}
  1371   \end{center}
  1421   \]\smallskip
  1372 
  1422 
  1373   \noindent
  1423 
  1374   Recall that @{text ANil} and @{text "ACons"} have no
  1424   \noindent
  1375   binding clause in the specification. The corresponding free-atom
  1425   Recall that @{text ANil} and @{text "ACons"} have no binding clause in the
  1376   function @{text "fa\<^bsub>assn\<^esub>"} therefore returns all free atoms
  1426   specification. The corresponding free-atom function @{text
  1377   of an assignment (in case of @{text "ACons"}, they are given in
  1427   "fa\<^bsub>assn\<^esub>"} therefore returns all free atoms of an assignment
  1378   terms of @{text supp}, @{text "fa\<^bsub>trm\<^esub>"} and @{text "fa\<^bsub>assn\<^esub>"}). 
  1428   (in case of @{text "ACons"}, they are given in terms of @{text supp}, @{text
  1379   The binding only takes place in @{text Let} and
  1429   "fa\<^bsub>trm\<^esub>"} and @{text "fa\<^bsub>assn\<^esub>"}). The binding
  1380   @{text "Let_rec"}. In case of @{text "Let"}, the binding clause specifies
  1430   only takes place in @{text Let} and @{text "Let_rec"}. In case of @{text
  1381   that all atoms given by @{text "set (bn as)"} have to be bound in @{text
  1431   "Let"}, the binding clause specifies that all atoms given by @{text "set (bn
  1382   t}. Therefore we have to subtract @{text "set (bn as)"} from @{text
  1432   as)"} have to be bound in @{text t}. Therefore we have to subtract @{text
  1383   "fa\<^bsub>trm\<^esub> t"}. However, we also need to add all atoms that are
  1433   "set (bn as)"} from @{text "fa\<^bsub>trm\<^esub> t"}. However, we also need
  1384   free in @{text "as"}. This is
  1434   to add all atoms that are free in @{text "as"}. This is in contrast with
  1385   in contrast with @{text "Let_rec"} where we have a recursive
  1435   @{text "Let_rec"} where we have a recursive binder to bind all occurrences
  1386   binder to bind all occurrences of the atoms in @{text
  1436   of the atoms in @{text "set (bn as)"} also inside @{text "as"}. Therefore we
  1387   "set (bn as)"} also inside @{text "as"}. Therefore we have to subtract
  1437   have to subtract @{text "set (bn as)"} from both @{text
  1388   @{text "set (bn as)"} from both @{text "fa\<^bsub>trm\<^esub> t"} and @{text "fa\<^bsub>assn\<^esub> as"}. 
  1438   "fa\<^bsub>trm\<^esub> t"} and @{text "fa\<^bsub>assn\<^esub> as"}. Like the
  1389   Like the function @{text "bn"}, the function @{text "fa\<^bsub>bn\<^esub>"} traverses the 
  1439   function @{text "bn"}, the function @{text "fa\<^bsub>bn\<^esub>"} traverses
  1390   list of assignments, but instead returns the free atoms, which means in this 
  1440   the list of assignments, but instead returns the free atoms, which means in
  1391   example the free atoms in the argument @{text "t"}.  
  1441   this example the free atoms in the argument @{text "t"}.
  1392 
  1442 
  1393   An interesting point in this
  1443 
  1394   example is that a ``naked'' assignment (@{text "ANil"} or @{text "ACons"}) does not bind any
  1444   An interesting point in this example is that a ``naked'' assignment (@{text
  1395   atoms, even if the binding function is specified over assignments. 
  1445   "ANil"} or @{text "ACons"}) does not bind any atoms, even if the binding
  1396   Only in the context of a @{text Let} or @{text "Let_rec"}, where the binding clauses are given, will
  1446   function is specified over assignments. Only in the context of a @{text Let}
  1397   some atoms actually become bound.  This is a phenomenon that has also been pointed
  1447   or @{text "Let_rec"}, where the binding clauses are given, will some atoms
  1398   out in \cite{ott-jfp}. For us this observation is crucial, because we would 
  1448   actually become bound.  This is a phenomenon that has also been pointed out
  1399   not be able to lift the @{text "bn"}-functions to alpha-equated terms if they act on 
  1449   in \cite{ott-jfp}. For us this observation is crucial, because we would not
  1400   atoms that are bound. In that case, these functions would \emph{not} respect
  1450   be able to lift the @{text "bn"}-functions to alpha-equated terms if they
  1401   alpha-equivalence.
  1451   act on atoms that are bound. In that case, these functions would \emph{not}
  1402 
  1452   respect alpha-equivalence.
  1403   Next we define the alpha-equivalence relations for the raw types @{text
  1453 
  1404   "ty"}$_{1..n}$ from the specification. We write them as
  1454   Having the free atom functions at our disposal, we can next define the 
  1405   
  1455   alpha-equivalence relations for the raw types @{text
  1406   \begin{center}
  1456   "ty"}$_{1..n}$. We write them as
  1407   @{text "\<approx>ty"}$_{1..n}$.
  1457   
  1408   \end{center}
  1458   \[
       
  1459   \mbox{@{text "\<approx>ty"}$_{1..n}$}.
       
  1460   \]\smallskip
  1409   
  1461   
  1410   \noindent
  1462   \noindent
  1411   Like with the free-atom functions, we also need to
  1463   Like with the free-atom functions, we also need to
  1412   define auxiliary alpha-equivalence relations 
  1464   define auxiliary alpha-equivalence relations 
  1413   
  1465   
  1414   \begin{center}
  1466   \[
  1415   @{text "\<approx>bn\<^isub>"}$_{1..m}$
  1467   \mbox{@{text "\<approx>bn\<^isub>"}$_{1..m}$}
  1416   \end{center}
  1468   \]\smallskip
  1417   
  1469   
  1418   \noindent
  1470   \noindent
  1419   for the binding functions @{text "bn"}$_{1..m}$, 
  1471   for the binding functions @{text "bn"}$_{1..m}$, 
  1420   To simplify our definitions we will use the following abbreviations for
  1472   To simplify our definitions we will use the following abbreviations for
  1421   \emph{compound equivalence relations} and \emph{compound free-atom functions} acting on tuples.
  1473   \emph{compound equivalence relations} and \emph{compound free-atom functions} acting on tuples.
  1422   
  1474   
  1423   \begin{center}
  1475   \[\mbox{
  1424   \begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
  1476   \begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
  1425   @{text "(x\<^isub>1,\<dots>, x\<^isub>n) (R\<^isub>1,\<dots>, R\<^isub>n) (x\<PRIME>\<^isub>1,\<dots>, x\<PRIME>\<^isub>n)"} & @{text "\<equiv>"} &
  1477   @{text "(x\<^isub>1,\<dots>, x\<^isub>n) (R\<^isub>1,\<dots>, R\<^isub>n) (y\<^isub>1,\<dots>, y\<^isub>n)"} & @{text "\<equiv>"} &
  1426   @{text "x\<^isub>1 R\<^isub>1 x\<PRIME>\<^isub>1 \<and> \<dots> \<and> x\<^isub>n R\<^isub>n x\<PRIME>\<^isub>n"}\\
  1478   @{text "x\<^isub>1 R\<^isub>1 y\<^isub>1 \<and> \<dots> \<and> x\<^isub>n R\<^isub>n y\<^isub>n"}\\
  1427   @{text "(fa\<^isub>1,\<dots>, fa\<^isub>n) (x\<^isub>1,\<dots>, x\<^isub>n)"} & @{text "\<equiv>"} & @{text "fa\<^isub>1 x\<^isub>1 \<union> \<dots> \<union> fa\<^isub>n x\<^isub>n"}\\
  1479   @{text "(fa\<^isub>1,\<dots>, fa\<^isub>n) (x\<^isub>1,\<dots>, x\<^isub>n)"} & @{text "\<equiv>"} & @{text "fa\<^isub>1 x\<^isub>1 \<union> \<dots> \<union> fa\<^isub>n x\<^isub>n"}\\
  1428   \end{tabular}
  1480   \end{tabular}}
  1429   \end{center}
  1481   \]\smallskip
  1430 
  1482 
  1431 
  1483 
  1432   The alpha-equivalence relations are defined as inductive predicates
  1484   The alpha-equivalence relations are defined as inductive predicates
  1433   having a single clause for each term-constructor. Assuming a
  1485   having a single clause for each term-constructor. Assuming a
  1434   term-constructor @{text C} is of type @{text ty} and has the binding clauses
  1486   term-constructor @{text C} is of type @{text ty} and has the binding clauses
  1435   @{term "bc"}$_{1..k}$, then the alpha-equivalence clause has the form
  1487   @{term "bc"}$_{1..k}$, then the alpha-equivalence clause has the form
  1436   
  1488   
  1437   \begin{center}
  1489   \[
  1438   \mbox{\infer{@{text "C z\<^isub>1 \<dots> z\<^isub>n  \<approx>ty  C z\<PRIME>\<^isub>1 \<dots> z\<PRIME>\<^isub>n"}}
  1490   \mbox{\infer{@{text "C z\<^isub>1 \<dots> z\<^isub>n  \<approx>ty  C z\<PRIME>\<^isub>1 \<dots> z\<PRIME>\<^isub>n"}}
  1439   {@{text "prems(bc\<^isub>1) \<dots> prems(bc\<^isub>k)"}}} 
  1491   {@{text "prems(bc\<^isub>1) \<dots> prems(bc\<^isub>k)"}}} 
  1440   \end{center}
  1492   \]\smallskip
  1441 
  1493 
  1442   \noindent
  1494   \noindent
  1443   The task below is to specify what the premises of a binding clause are. As a
  1495   The task below is to specify what the premises corresponding to a binding
  1444   special instance, we first treat the case where @{text "bc\<^isub>i"} is the
  1496   clause are. To understand better whet the general pattern is, let us first 
  1445   empty binding clause of the form
  1497   treat the special instance where @{text "bc\<^isub>i"} is the empty binding clause 
  1446   
  1498   of the form
  1447   \begin{center}
  1499 
       
  1500   \[
  1448   \mbox{\isacommand{binds (set)} @{term "{}"} \isacommand{in} @{text "d\<^isub>1\<dots>d\<^isub>q"}.}
  1501   \mbox{\isacommand{binds (set)} @{term "{}"} \isacommand{in} @{text "d\<^isub>1\<dots>d\<^isub>q"}.}
  1449   \end{center}
  1502   \]\smallskip
  1450 
  1503 
  1451   \noindent
  1504   \noindent
  1452   In this binding clause no atom is bound and we only have to alpha-relate the bodies. For this
  1505   In this binding clause no atom is bound and we only have to `alpha-relate' the bodies. For this
  1453   we build first the tuples @{text "D \<equiv> (d\<^isub>1,\<dots>, d\<^isub>q)"} and @{text "D' \<equiv> (d\<PRIME>\<^isub>1,\<dots>, d\<PRIME>\<^isub>q)"}  
  1506   we build first the tuples @{text "D \<equiv> (d\<^isub>1,\<dots>, d\<^isub>q)"} and @{text "D' \<equiv> (d\<PRIME>\<^isub>1,\<dots>, d\<PRIME>\<^isub>q)"}  
  1454   whereby the labels @{text "d"}$_{1..q}$ refer to arguments @{text "z"}$_{1..n}$ and
  1507   whereby the labels @{text "d"}$_{1..q}$ refer to arguments @{text "z"}$_{1..n}$ and
  1455   respectively @{text "d\<PRIME>"}$_{1..q}$ to @{text "z\<PRIME>"}$_{1..n}$. In order to relate
  1508   respectively @{text "d\<PRIME>"}$_{1..q}$ to @{text "z\<PRIME>"}$_{1..n}$. In order to relate
  1456   two such tuples we define the compound alpha-equivalence relation @{text "R"} as follows
  1509   two such tuples we define the compound alpha-equivalence relation @{text "R"} as follows
  1457   
  1510   
  1507   \noindent
  1560   \noindent
  1508   Similarly for @{text "B'"} using the labels @{text "b\<PRIME>"}$_{1..p}$. This 
  1561   Similarly for @{text "B'"} using the labels @{text "b\<PRIME>"}$_{1..p}$. This 
  1509   lets us formally define the premise @{text P} for a non-empty binding clause as:
  1562   lets us formally define the premise @{text P} for a non-empty binding clause as:
  1510   
  1563   
  1511   \begin{center}
  1564   \begin{center}
  1512   \mbox{@{term "P \<equiv> \<exists>p. (B, D) \<approx>set R fa p (B', D')"}}\;.
  1565   \mbox{@{term "P \<equiv> alpha_set_ex (B, D) R fa (B', D')"}}\;.
  1513   \end{center}
  1566   \end{center}
  1514 
  1567 
  1515   \noindent
  1568   \noindent
  1516   This premise accounts for alpha-equivalence of the bodies of the binding
  1569   This premise accounts for alpha-equivalence of the bodies of the binding
  1517   clause. 
  1570   clause. 
  1580   $\approx_{\textit{bn}}$ with the following clauses:
  1633   $\approx_{\textit{bn}}$ with the following clauses:
  1581 
  1634 
  1582   \begin{center}
  1635   \begin{center}
  1583   \begin{tabular}{@ {}c @ {}}
  1636   \begin{tabular}{@ {}c @ {}}
  1584   \infer{@{text "Let as t \<approx>\<^bsub>trm\<^esub> Let as' t'"}}
  1637   \infer{@{text "Let as t \<approx>\<^bsub>trm\<^esub> Let as' t'"}}
  1585   {@{term "\<exists>p. (bn as, t) \<approx>lst alpha_trm fa_trm p (bn as', t')"} & @{text "as \<approx>\<^bsub>bn\<^esub> as'"}}\smallskip\\
  1638   {@{term "alpha_lst_ex (bn as, t) alpha_trm fa_trm (bn as', t')"} & @{text "as \<approx>\<^bsub>bn\<^esub> as'"}}\smallskip\\
  1586   \makebox[0mm]{\infer{@{text "Let_rec as t \<approx>\<^bsub>trm\<^esub> Let_rec as' t'"}}
  1639   \makebox[0mm]{\infer{@{text "Let_rec as t \<approx>\<^bsub>trm\<^esub> Let_rec as' t'"}}
  1587   {@{term "\<exists>p. (bn as, ast) \<approx>lst alpha_trm2 fa_trm2 p (bn as', ast')"}}}
  1640   {@{term "alpha_lst_ex (bn as, ast) alpha_trm2 fa_trm2 (bn as', ast')"}}}
  1588   \end{tabular}
  1641   \end{tabular}
  1589   \end{center}
  1642   \end{center}
  1590 
  1643 
  1591   \begin{center}
  1644   \begin{center}
  1592   \begin{tabular}{@ {}c @ {}}
  1645   \begin{tabular}{@ {}c @ {}}