LMCS-Paper/Paper.thy
changeset 3018 65452cf6f5ae
parent 3017 014f0ea2381c
child 3019 10fa937255da
equal deleted inserted replaced
3017:014f0ea2381c 3018:65452cf6f5ae
    72   fa_trm2_al ("'(fa\<AL>\<^bsub>assn\<^esub>, fa\<AL>\<^bsub>trm\<^esub>')") and
    72   fa_trm2_al ("'(fa\<AL>\<^bsub>assn\<^esub>, fa\<AL>\<^bsub>trm\<^esub>')") and
    73   ast ("'(as, t')") and
    73   ast ("'(as, t')") and
    74   ast' ("'(as', t\<PRIME> ')") and
    74   ast' ("'(as', t\<PRIME> ')") and
    75   equ2 ("'(=, =')") and
    75   equ2 ("'(=, =')") and
    76   supp2 ("'(supp, supp')") and
    76   supp2 ("'(supp, supp')") and
    77   bn_al ("bn\<^sup>\<alpha> _")
    77   bn_al ("bn\<^sup>\<alpha> _" [100] 100)
    78 (*>*)
    78 (*>*)
    79 
    79 
    80 
    80 
    81 section {* Introduction *}
    81 section {* Introduction *}
    82 
    82 
  1036   corresponding alpha-equivalence will differ). We will show this later with
  1036   corresponding alpha-equivalence will differ). We will show this later with
  1037   an example.
  1037   an example.
  1038 
  1038 
  1039   
  1039   
  1040   There are also some restrictions we need to impose on our binding clauses in
  1040   There are also some restrictions we need to impose on our binding clauses in
  1041   comparison to the ones of Ott. The main idea behind these restrictions is
  1041   comparison to Ott. The main idea behind these restrictions is
  1042   that we obtain a notion of alpha-equivalence where it is ensured
  1042   that we obtain a notion of alpha-equivalence where it is ensured
  1043   that within a given scope an atom occurrence cannot be both bound and free
  1043   that within a given scope an atom occurrence cannot be both bound and free
  1044   at the same time.  The first restriction is that a body can only occur in
  1044   at the same time.  The first restriction is that a body can only occur in
  1045   \emph{one} binding clause of a term constructor. So for example
  1045   \emph{one} binding clause of a term constructor. So for example
  1046 
  1046 
  1084   \end{tabular}}
  1084   \end{tabular}}
  1085   \]\smallskip
  1085   \]\smallskip
  1086 
  1086 
  1087 
  1087 
  1088   \noindent
  1088   \noindent
  1089   In these specifications @{text "name"} refers to an atom type, and @{text
  1089   In these specifications @{text "name"} refers to a (concrete) atom type, and @{text
  1090   "fset"} to the type of finite sets.  Note that for @{text Lam} it does not
  1090   "fset"} to the type of finite sets.  Note that for @{text Lam} it does not
  1091   matter which binding mode we use. The reason is that we bind only a single
  1091   matter which binding mode we use. The reason is that we bind only a single
  1092   @{text name}, in which case all three binding modes coincide. However, having 
  1092   @{text name}, in which case all three binding modes coincide. However, having 
  1093   \isacommand{binds (set)} or just \isacommand{binds}
  1093   \isacommand{binds (set)} or just \isacommand{binds}
  1094   in the second case makes a difference to the semantics of the specification
  1094   in the second case makes a difference to the semantics of the specification
  1111   \isacommand{nominal\_datatype} @{text trm} $=$\\
  1111   \isacommand{nominal\_datatype} @{text trm} $=$\\
  1112   \hspace{5mm}\phantom{$\mid$}~@{term "Var name"}\\
  1112   \hspace{5mm}\phantom{$\mid$}~@{term "Var name"}\\
  1113   \hspace{5mm}$\mid$~@{term "App trm trm"}\\
  1113   \hspace{5mm}$\mid$~@{term "App trm trm"}\\
  1114   \hspace{5mm}$\mid$~@{text "Lam x::name t::trm"} 
  1114   \hspace{5mm}$\mid$~@{text "Lam x::name t::trm"} 
  1115      \;\;\isacommand{binds} @{text x} \isacommand{in} @{text t}\\
  1115      \;\;\isacommand{binds} @{text x} \isacommand{in} @{text t}\\
  1116   \hspace{5mm}$\mid$~@{text "Let p::pat trm t::trm"} 
  1116   \hspace{5mm}$\mid$~@{text "Let_pat p::pat trm t::trm"} 
  1117      \;\;\isacommand{binds} @{text "bn(p)"} \isacommand{in} @{text t}\\
  1117      \;\;\isacommand{binds} @{text "bn(p)"} \isacommand{in} @{text t}\\
  1118   \isacommand{and} @{text pat} $=$\\
  1118   \isacommand{and} @{text pat} $=$\\
  1119   \hspace{5mm}\phantom{$\mid$}~@{text PNil}\\
  1119   \hspace{5mm}\phantom{$\mid$}~@{text PNil}\\
  1120   \hspace{5mm}$\mid$~@{text "PVar name"}\\
  1120   \hspace{5mm}$\mid$~@{text "PVar name"}\\
  1121   \hspace{5mm}$\mid$~@{text "PTup pat pat"}\\ 
  1121   \hspace{5mm}$\mid$~@{text "PTup pat pat"}\\ 
  1955   \eqref{cases} and \eqref{induct} boil down to the following three inference
  1955   \eqref{cases} and \eqref{induct} boil down to the following three inference
  1956   rules (the cases lemmas are on the left-hand side; the induction principle
  1956   rules (the cases lemmas are on the left-hand side; the induction principle
  1957   on the right):
  1957   on the right):
  1958 
  1958 
  1959   \begin{equation}\label{inductex}\mbox{
  1959   \begin{equation}\label{inductex}\mbox{
  1960   \begin{tabular}{@ {}c@ {\hspace{3mm}}c@ {}}
  1960   \begin{tabular}{c}
  1961   \begin{tabular}{@ {}c@ {}}
  1961   \multicolumn{1}{@ {\hspace{-5mm}}l}{cases lemmas:}\smallskip\\
  1962   \infer{@{text "P\<^bsub>trm\<^esub>"}}
  1962   \infer{@{text "P\<^bsub>trm\<^esub>"}}
  1963   {\begin{array}{@ {}l@ {}}
  1963   {\begin{array}{@ {}l@ {}}
  1964    @{text "\<forall>x. y = Var\<^sup>\<alpha> x \<Rightarrow> P\<^bsub>trm\<^esub>"}\\
  1964    @{text "\<forall>x. y = Var\<^sup>\<alpha> x \<Rightarrow> P\<^bsub>trm\<^esub>"}\\
  1965    @{text "\<forall>x\<^isub>1 x\<^isub>2. y = App\<^sup>\<alpha> x\<^isub>1 x\<^isub>2 \<Rightarrow> P\<^bsub>trm\<^esub>"}\\
  1965    @{text "\<forall>x\<^isub>1 x\<^isub>2. y = App\<^sup>\<alpha> x\<^isub>1 x\<^isub>2 \<Rightarrow> P\<^bsub>trm\<^esub>"}\\
  1966    @{text "\<forall>x\<^isub>1 x\<^isub>2. y = Lam\<^sup>\<alpha> x\<^isub>1 x\<^isub>2 \<Rightarrow> P\<^bsub>trm\<^esub>"}\\
  1966    @{text "\<forall>x\<^isub>1 x\<^isub>2. y = Lam\<^sup>\<alpha> x\<^isub>1 x\<^isub>2 \<Rightarrow> P\<^bsub>trm\<^esub>"}\\
  1967    @{text "\<forall>x\<^isub>1 x\<^isub>2 x\<^isub>3. y = Let\<^sup>\<alpha> x\<^isub>1 x\<^isub>2 x\<^isub>3 \<Rightarrow> P\<^bsub>trm\<^esub>"}
  1967    @{text "\<forall>x\<^isub>1 x\<^isub>2 x\<^isub>3. y = Let_pat\<^sup>\<alpha> x\<^isub>1 x\<^isub>2 x\<^isub>3 \<Rightarrow> P\<^bsub>trm\<^esub>"}
  1968    \end{array}}\medskip\\
  1968    \end{array}}\hspace{10mm}
  1969 
  1969 
  1970   \infer{@{text "P\<^bsub>pat\<^esub>"}}
  1970   \infer{@{text "P\<^bsub>pat\<^esub>"}}
  1971   {\begin{array}{@ {}l@ {}}
  1971   {\begin{array}{@ {}l@ {}}
  1972    @{text "y = PNil\<^sup>\<alpha>  \<Rightarrow> P\<^bsub>pat\<^esub>"}\\
  1972    @{text "y = PNil\<^sup>\<alpha>  \<Rightarrow> P\<^bsub>pat\<^esub>"}\\
  1973    @{text "\<forall>x. y = PVar\<^sup>\<alpha> x \<Rightarrow> P\<^bsub>pat\<^esub>"}\\
  1973    @{text "\<forall>x. y = PVar\<^sup>\<alpha> x \<Rightarrow> P\<^bsub>pat\<^esub>"}\\
  1974    @{text "\<forall>x\<^isub>1 x\<^isub>2. y = PTup\<^sup>\<alpha> x\<^isub>1 x\<^isub>2 \<Rightarrow> P\<^bsub>pat\<^esub>"}
  1974    @{text "\<forall>x\<^isub>1 x\<^isub>2. y = PTup\<^sup>\<alpha> x\<^isub>1 x\<^isub>2 \<Rightarrow> P\<^bsub>pat\<^esub>"}
  1975   \end{array}}
  1975   \end{array}}\medskip\\
  1976   \end{tabular} 
  1976 
  1977   &
  1977   \multicolumn{1}{@ {\hspace{-5mm}}l}{induction principle:}\smallskip\\
  1978   
  1978   
  1979   \begin{tabular}{@ {}c@ {}}
       
  1980   \infer{@{text "P\<^bsub>trm\<^esub> y\<^isub>1 \<and> P\<^bsub>pat\<^esub> y\<^isub>2"}}
  1979   \infer{@{text "P\<^bsub>trm\<^esub> y\<^isub>1 \<and> P\<^bsub>pat\<^esub> y\<^isub>2"}}
  1981   {\begin{array}{@ {}l@ {}}
  1980   {\begin{array}{@ {}l@ {}}
  1982    @{text "\<forall>x. P\<^bsub>trm\<^esub> (Var\<^sup>\<alpha> x)"}\\
  1981    @{text "\<forall>x. P\<^bsub>trm\<^esub> (Var\<^sup>\<alpha> x)"}\\
  1983    @{text "\<forall>x\<^isub>1 x\<^isub>2. P\<^bsub>trm\<^esub> x\<^isub>1 \<and> P\<^bsub>trm\<^esub> x\<^isub>2 \<Rightarrow> P\<^bsub>trm\<^esub> (App\<^sup>\<alpha> x\<^isub>1 x\<^isub>2)"}\\
  1982    @{text "\<forall>x\<^isub>1 x\<^isub>2. P\<^bsub>trm\<^esub> x\<^isub>1 \<and> P\<^bsub>trm\<^esub> x\<^isub>2 \<Rightarrow> P\<^bsub>trm\<^esub> (App\<^sup>\<alpha> x\<^isub>1 x\<^isub>2)"}\\
  1984    @{text "\<forall>x\<^isub>1 x\<^isub>2. P\<^bsub>trm\<^esub> x\<^isub>2 \<Rightarrow> P\<^bsub>trm\<^esub> (Lam\<^sup>\<alpha> x\<^isub>1 x\<^isub>2)"}\\
  1983    @{text "\<forall>x\<^isub>1 x\<^isub>2. P\<^bsub>trm\<^esub> x\<^isub>2 \<Rightarrow> P\<^bsub>trm\<^esub> (Lam\<^sup>\<alpha> x\<^isub>1 x\<^isub>2)"}\\
  1985    @{text "\<forall>x\<^isub>1 x\<^isub>2 x\<^isub>3. P\<^bsub>pat\<^esub> x\<^isub>1 \<and> P\<^bsub>trm\<^esub> x\<^isub>2 \<and> P\<^bsub>trm\<^esub> x\<^isub>3 \<Rightarrow> P\<^bsub>trm\<^esub> (Let\<^sup>\<alpha> x\<^isub>1 x\<^isub>2 x\<^isub>3)"}\\
  1984    @{text "\<forall>x\<^isub>1 x\<^isub>2 x\<^isub>3. P\<^bsub>pat\<^esub> x\<^isub>1 \<and> P\<^bsub>trm\<^esub> x\<^isub>2 \<and> P\<^bsub>trm\<^esub> x\<^isub>3 \<Rightarrow> P\<^bsub>trm\<^esub> (Let_pat\<^sup>\<alpha> x\<^isub>1 x\<^isub>2 x\<^isub>3)"}\\
  1986    @{text "P\<^bsub>pat\<^esub> (PNil\<^sup>\<alpha>)"}\\
  1985    @{text "P\<^bsub>pat\<^esub> (PNil\<^sup>\<alpha>)"}\\
  1987    @{text "\<forall>x. P\<^bsub>pat\<^esub> (PVar\<^sup>\<alpha> x)"}\\
  1986    @{text "\<forall>x. P\<^bsub>pat\<^esub> (PVar\<^sup>\<alpha> x)"}\\
  1988    @{text "\<forall>x\<^isub>1 x\<^isub>2. P\<^bsub>pat\<^esub> x\<^isub>1 \<and> P\<^bsub>pat\<^esub> x\<^isub>2 \<Rightarrow> P\<^bsub>pat\<^esub> (PTup\<^sup>\<alpha> x\<^isub>1 x\<^isub>2)"}
  1987    @{text "\<forall>x\<^isub>1 x\<^isub>2. P\<^bsub>pat\<^esub> x\<^isub>1 \<and> P\<^bsub>pat\<^esub> x\<^isub>2 \<Rightarrow> P\<^bsub>pat\<^esub> (PTup\<^sup>\<alpha> x\<^isub>1 x\<^isub>2)"}
  1989   \end{array}}
  1988   \end{array}}
  1990   \end{tabular}
       
  1991   \end{tabular}}
  1989   \end{tabular}}
  1992   \end{equation}\smallskip
  1990   \end{equation}\smallskip
  1993 
  1991 
  1994   By working now completely on the alpha-equated level, we
  1992   By working now completely on the alpha-equated level, we
  1995   can first show using \eqref{calphaeqvt} that the support of each term
  1993   can first show using \eqref{calphaeqvt} that the support of each term
  2114   problem is to rename them. Unfortunately, this leads to very clunky proofs
  2112   problem is to rename them. Unfortunately, this leads to very clunky proofs
  2115   and makes formalisations grievous experiences (especially in the case for
  2113   and makes formalisations grievous experiences (especially in the case for
  2116   multiple bound atoms).
  2114   multiple bound atoms).
  2117 
  2115 
  2118 
  2116 
  2119   For the older versions of Nominal Isabelle we introduced in
  2117   For the older versions of Nominal Isabelle we described in
  2120   \cite{UrbanTasson05} a method for automatically strengthening weak induction
  2118   \cite{Urban08} a method for automatically strengthening weak induction
  2121   principles. These stronger induction principles allow the user to make
  2119   principles. These stronger induction principles allow the user to make
  2122   additional assumptions about bound atoms. The advantage of these assumptions
  2120   additional assumptions about bound atoms. The advantage of these assumptions
  2123   is that they make in most cases any renaming of bound atoms unnecessary.  To
  2121   is that they make in most cases any renaming of bound atoms unnecessary.  To
  2124   explain how the strengthening works in the presence of multiple binders, we
  2122   explain how the strengthening works in the presence of multiple binders, we
  2125   use as running example the lambda-calculus with @{text "Let"}-patterns shown
  2123   use as running example the lambda-calculus with @{text "Let"}-patterns shown
  2133   {\begin{array}{l}
  2131   {\begin{array}{l}
  2134    @{text "\<forall>x c. P\<^bsub>trm\<^esub> c (Var\<^sup>\<alpha> x)"}\\
  2132    @{text "\<forall>x c. P\<^bsub>trm\<^esub> c (Var\<^sup>\<alpha> x)"}\\
  2135    @{text "\<forall>x\<^isub>1 x\<^isub>2 c. (\<forall>d. P\<^bsub>trm\<^esub> d x\<^isub>1) \<and> (\<forall>d. P\<^bsub>trm\<^esub> d x\<^isub>2) \<Rightarrow> P\<^bsub>trm\<^esub> c (App\<^sup>\<alpha> x\<^isub>1 x\<^isub>2)"}\\
  2133    @{text "\<forall>x\<^isub>1 x\<^isub>2 c. (\<forall>d. P\<^bsub>trm\<^esub> d x\<^isub>1) \<and> (\<forall>d. P\<^bsub>trm\<^esub> d x\<^isub>2) \<Rightarrow> P\<^bsub>trm\<^esub> c (App\<^sup>\<alpha> x\<^isub>1 x\<^isub>2)"}\\
  2136    @{text "\<forall>x\<^isub>1 x\<^isub>2 c. atom x\<^isub>1 # c \<and> (\<forall>d. P\<^bsub>trm\<^esub> d x\<^isub>2) \<Rightarrow> P\<^bsub>trm\<^esub> c (Lam\<^sup>\<alpha> x\<^isub>1 x\<^isub>2)"}\\
  2134    @{text "\<forall>x\<^isub>1 x\<^isub>2 c. atom x\<^isub>1 # c \<and> (\<forall>d. P\<^bsub>trm\<^esub> d x\<^isub>2) \<Rightarrow> P\<^bsub>trm\<^esub> c (Lam\<^sup>\<alpha> x\<^isub>1 x\<^isub>2)"}\\
  2137    @{text "\<forall>x\<^isub>1 x\<^isub>2 x\<^isub>3 c. (set (bn\<^sup>\<alpha> x\<^isub>1)) #\<^sup>* c \<and>"}\\ 
  2135    @{text "\<forall>x\<^isub>1 x\<^isub>2 x\<^isub>3 c. (set (bn\<^sup>\<alpha> x\<^isub>1)) #\<^sup>* c \<and>"}\\ 
  2138    \hspace{10mm}@{text "(\<forall>d. P\<^bsub>pat\<^esub> d x\<^isub>1) \<and> (\<forall>d. P\<^bsub>trm\<^esub> d x\<^isub>2) \<and> (\<forall>d. P\<^bsub>trm\<^esub> d x\<^isub>3) \<Rightarrow> P\<^bsub>trm\<^esub> c (Let\<^sup>\<alpha> x\<^isub>1 x\<^isub>2 x\<^isub>3)"}\\
  2136    \hspace{10mm}@{text "(\<forall>d. P\<^bsub>pat\<^esub> d x\<^isub>1) \<and> (\<forall>d. P\<^bsub>trm\<^esub> d x\<^isub>2) \<and> (\<forall>d. P\<^bsub>trm\<^esub> d x\<^isub>3) \<Rightarrow> P\<^bsub>trm\<^esub> c (Let_pat\<^sup>\<alpha> x\<^isub>1 x\<^isub>2 x\<^isub>3)"}\\
  2139    @{text "\<forall>c. P\<^bsub>pat\<^esub> c (PNil\<^sup>\<alpha>)"}\\
  2137    @{text "\<forall>c. P\<^bsub>pat\<^esub> c (PNil\<^sup>\<alpha>)"}\\
  2140    @{text "\<forall>x c. P\<^bsub>pat\<^esub> c (PVar\<^sup>\<alpha> x)"}\\
  2138    @{text "\<forall>x c. P\<^bsub>pat\<^esub> c (PVar\<^sup>\<alpha> x)"}\\
  2141    @{text "\<forall>x\<^isub>1 x\<^isub>2 c. (\<forall>d. P\<^bsub>pat\<^esub> d x\<^isub>1) \<and> (\<forall>d. P\<^bsub>pat\<^esub> d x\<^isub>2) \<Rightarrow> P\<^bsub>pat\<^esub> c (PTup\<^sup>\<alpha> x\<^isub>1 x\<^isub>2)"}
  2139    @{text "\<forall>x\<^isub>1 x\<^isub>2 c. (\<forall>d. P\<^bsub>pat\<^esub> d x\<^isub>1) \<and> (\<forall>d. P\<^bsub>pat\<^esub> d x\<^isub>2) \<Rightarrow> P\<^bsub>pat\<^esub> c (PTup\<^sup>\<alpha> x\<^isub>1 x\<^isub>2)"}
  2142   \end{array}}
  2140   \end{array}}
  2143   \end{tabular}}
  2141   \end{tabular}}
  2150   stronger induction principle establishes the properties @{text "
  2148   stronger induction principle establishes the properties @{text "
  2151   P\<^bsub>trm\<^esub> c y\<^isub>1 \<and> P\<^bsub>pat\<^esub> c y\<^isub>2"} in
  2149   P\<^bsub>trm\<^esub> c y\<^isub>1 \<and> P\<^bsub>pat\<^esub> c y\<^isub>2"} in
  2152   which the additional parameter @{text c} is assumed to be of finite
  2150   which the additional parameter @{text c} is assumed to be of finite
  2153   support. The purpose of @{text "c"} is to ``control'' which freshness
  2151   support. The purpose of @{text "c"} is to ``control'' which freshness
  2154   assumptions the binders should satisfy in the @{text "Lam\<^sup>\<alpha>"} and
  2152   assumptions the binders should satisfy in the @{text "Lam\<^sup>\<alpha>"} and
  2155   @{text "Let\<^sup>\<alpha>"} cases: for @{text "Lam\<^sup>\<alpha>"} we can assume the
  2153   @{text "Let_pat\<^sup>\<alpha>"} cases: for @{text "Lam\<^sup>\<alpha>"} we can assume the
  2156   bound atom @{text "x\<^isub>1"} is fresh for @{text "c"}; for @{text
  2154   bound atom @{text "x\<^isub>1"} is fresh for @{text "c"}; for @{text
  2157   "Let\<^sup>\<alpha>"} we can assume all bound atoms from an assignment are fresh
  2155   "Let_pat\<^sup>\<alpha>"} we can assume all bound atoms from an assignment are fresh
  2158   for @{text "c"}. If @{text "c"} is instantiated appropriately, the user can
  2156   for @{text "c"}. If @{text "c"} is instantiated appropriately, the user can
  2159   mimic the ``pencil-and-paper'' reasoning employing the usual variable
  2157   mimic the ``pencil-and-paper'' reasoning employing the usual variable
  2160   convention.
  2158   convention \cite{Urban08}.
  2161 
  2159 
  2162   In what follows we will show that the induction principle in
  2160   In what follows we will show that the induction principle in
  2163   \eqref{inductex} implies \eqref{stronginduct}. This fact was established for
  2161   \eqref{inductex} implies \eqref{stronginduct}. This fact was established for
  2164   single binders in \cite{UrbanTasson05} by some quite involved, nevertheless
  2162   single binders in \cite{Urban08} by some quite involved, nevertheless
  2165   automated, induction proof. In this paper we simplify the proof by
  2163   automated, induction proof. In this paper we simplify the proof by
  2166   leveraging the automated proof methods from the function package of
  2164   leveraging the automated proof methods from the function package of
  2167   Isabelle/HOL \cite{Krauss09}. The reasoning principle behind these methods
  2165   Isabelle/HOL \cite{Krauss09}. The reasoning principle behind these methods
  2168   is well-founded induction. To use them in our setting, we have to discharge
  2166   is well-founded induction. To use them in our setting, we have to discharge
  2169   two proof obligations: one is that we have well-founded measures (one for
  2167   two proof obligations: one is that we have well-founded measures (one for
  2170   each type @{text "ty"}$^\alpha_{1..n}$) that decrease in every induction
  2168   each type @{text "ty"}$^\alpha_{1..n}$) that decrease in every induction
  2171   step and the other is that we have covered all cases. Once these two
  2169   step and the other is that we have covered all cases in the induction
  2172   proof obligations are discharged, the reasoning infrastructure in 
  2170   principle. Once these two proof obligations are discharged, the reasoning
  2173   the function package will automatically derive the stronger induction
  2171   infrastructure in the function package will automatically derive the
  2174   principle. This considerably simplifies the work we have to do.
  2172   stronger induction principle. This considerably simplifies the work we have
       
  2173   to do here.
       
  2174 
  2175 
  2175 
  2176   As measures we can use the size functions @{text "size_ty"}$^\alpha_{1..n}$,
  2176   As measures we can use the size functions @{text "size_ty"}$^\alpha_{1..n}$,
  2177   which we lifted in the previous section and which are all well-founded. It
  2177   which we lifted in the previous section and which are all well-founded. It
  2178   is straightforward to establish that the sizes decrease in every
  2178   is straightforward to establish that the sizes decrease in every
  2179   induction step. What is left to show is that we covered all cases. 
  2179   induction step. What is left to show is that we covered all cases. 
  2180   To do so, we have to derive stronger cases lemmas, which look in our
  2180   To do so, we have to derive stronger cases lemmas, which look in our
  2181   running example as follows:
  2181   running example are as follows:
  2182 
  2182 
  2183   \[\mbox{
  2183   \[\mbox{
  2184   \begin{tabular}{@ {}c@ {\hspace{6mm}}c@ {}}
  2184   \begin{tabular}{@ {}c@ {\hspace{4mm}}c@ {}}
  2185   \infer{@{text "P\<^bsub>trm\<^esub>"}}
  2185   \infer{@{text "P\<^bsub>trm\<^esub>"}}
  2186   {\begin{array}{@ {}l@ {}}
  2186   {\begin{array}{@ {}l@ {}}
  2187    @{text "\<forall>x. y = Var\<^sup>\<alpha> x \<Rightarrow> P\<^bsub>trm\<^esub>"}\\
  2187    @{text "\<forall>x. y = Var\<^sup>\<alpha> x \<Rightarrow> P\<^bsub>trm\<^esub>"}\\
  2188    @{text "\<forall>x\<^isub>1 x\<^isub>2. y = App\<^sup>\<alpha> x\<^isub>1 x\<^isub>2 \<Rightarrow> P\<^bsub>trm\<^esub>"}\\
  2188    @{text "\<forall>x\<^isub>1 x\<^isub>2. y = App\<^sup>\<alpha> x\<^isub>1 x\<^isub>2 \<Rightarrow> P\<^bsub>trm\<^esub>"}\\
  2189    @{text "\<forall>x\<^isub>1 x\<^isub>2. atom x\<^isub>1 # c \<and> y = Lam\<^sup>\<alpha> x\<^isub>1 x\<^isub>2 \<Rightarrow> P\<^bsub>trm\<^esub>"}\\
  2189    @{text "\<forall>x\<^isub>1 x\<^isub>2. atom x\<^isub>1 # c \<and> y = Lam\<^sup>\<alpha> x\<^isub>1 x\<^isub>2 \<Rightarrow> P\<^bsub>trm\<^esub>"}\\
  2190    @{text "\<forall>x\<^isub>1 x\<^isub>2 x\<^isub>3. set (bn\<^sup>\<alpha> x\<^isub>1) #\<^sup>* c \<and> y = Let\<^sup>\<alpha> x\<^isub>1 x\<^isub>2 x\<^isub>3 \<Rightarrow> P\<^bsub>trm\<^esub>"}
  2190    @{text "\<forall>x\<^isub>1 x\<^isub>2 x\<^isub>3. set (bn\<^sup>\<alpha> x\<^isub>1) #\<^sup>* c \<and> y = Let_pat\<^sup>\<alpha> x\<^isub>1 x\<^isub>2 x\<^isub>3 \<Rightarrow> P\<^bsub>trm\<^esub>"}
  2191    \end{array}} &
  2191    \end{array}} &
  2192 
  2192 
  2193   \infer{@{text "P\<^bsub>pat\<^esub>"}}
  2193   \infer{@{text "P\<^bsub>pat\<^esub>"}}
  2194   {\begin{array}{@ {}l@ {}}
  2194   {\begin{array}{@ {}l@ {}}
  2195    @{text "y = PNil\<^sup>\<alpha>  \<Rightarrow> P\<^bsub>pat\<^esub>"}\\
  2195    @{text "y = PNil\<^sup>\<alpha>  \<Rightarrow> P\<^bsub>pat\<^esub>"}\\
  2198   \end{array}}
  2198   \end{array}}
  2199   \end{tabular}}
  2199   \end{tabular}}
  2200   \]\smallskip 
  2200   \]\smallskip 
  2201 
  2201 
  2202   \noindent
  2202   \noindent
  2203   These stronger cases lemmas need to be derived from the `weak' cases lemmas given
  2203   They are stronger in the sense that they allow us to assume that the bound
  2204   in \eqref{inductex}. This is trivial in case of patterns (the one on the right-hand side)
  2204   atoms avoid a context @{text "c"} (which is assumed to be finitely
  2205   since weak and strong cases lemma coincide (there is no binding in patterns).
  2205   supported). This is similar with the stronger induction principles. 
  2206   Interesting are only the cases for @{text "Lam\<^sup>\<alpha>"} and @{text "Let\<^sup>\<alpha>"}. There the
  2206   
  2207   stronger cases lemma allow us to assume that the bound atoms avoid the context @{text "c"}
  2207   These stronger cases lemmas need to be derived from the `weak' cases lemmas
  2208   (which is assumed to be finitely supported).
  2208   given in \eqref{inductex}. This is trivial in case of patterns (the one on
  2209  
  2209   the right-hand side) since the weak and strong cases lemma coincide (there
  2210   Let us show first establish the simpler case for @{text "Lam\<^sup>\<alpha>"}. By the weak cases lemma 
  2210   is no binding in patterns).  Interesting are only the cases for @{text
  2211   \eqref{inductex} we can assume that
  2211   "Lam\<^sup>\<alpha>"} and @{text "Let_pat\<^sup>\<alpha>"}, where we have some binders and
       
  2212   therefore have an addition assumption.  Let us show first establish the case
       
  2213   for @{text "Lam\<^sup>\<alpha>"}. By the weak cases lemma \eqref{inductex} we can
       
  2214   assume that
  2212 
  2215 
  2213   \begin{equation}\label{assm}
  2216   \begin{equation}\label{assm}
  2214   @{text "y = Lam\<^sup>\<alpha> x\<^isub>1 x\<^isub>2"}
  2217   @{text "y = Lam\<^sup>\<alpha> x\<^isub>1 x\<^isub>2"}
  2215   \end{equation}\smallskip
  2218   \end{equation}\smallskip
  2216 
  2219 
  2217   \noindent
  2220   \noindent
  2218   holds and need to establish @{text "P\<^bsub>trm\<^esub>"}. The stronger cases lemma has the implication 
  2221   holds and need to establish @{text "P\<^bsub>trm\<^esub>"}. The stronger cases lemma has the 
       
  2222   corresponding implication 
  2219 
  2223 
  2220   \begin{equation}\label{imp}
  2224   \begin{equation}\label{imp}
  2221   @{text "\<forall>x\<^isub>1 x\<^isub>2. atom x\<^isub>1 # c \<and> y = Lam\<^sup>\<alpha> x\<^isub>1 x\<^isub>2 \<Rightarrow> P\<^bsub>trm\<^esub>"}
  2225   @{text "\<forall>x\<^isub>1 x\<^isub>2. atom x\<^isub>1 # c \<and> y = Lam\<^sup>\<alpha> x\<^isub>1 x\<^isub>2 \<Rightarrow> P\<^bsub>trm\<^esub>"}
  2222   \end{equation}\smallskip
  2226   \end{equation}\smallskip
  2223 
  2227 
  2224   \noindent
  2228   \noindent
  2225   which we can use to infer @{text "P\<^bsub>trm\<^esub>"}. Clearly, we cannot
  2229   which we can use to infer @{text "P\<^bsub>trm\<^esub>"}. Clearly, we cannot
  2226   use this implication directly, because we have no information whether @{text
  2230   use this implication directly, because we have no information whether @{text
  2227   "x\<^isub>1"} is fresh for @{text "c"}.  However, we can use Properties
  2231   "x\<^isub>1"} is fresh for @{text "c"}.  However, we can use Properties
  2228   \ref{supppermeq} and \ref{avoiding} to rename @{text "x\<^isub>1"}. We know
  2232   \ref{supppermeq} and \ref{avoiding} to rename @{text "x\<^isub>1"}: We know
  2229   by Theorem~\ref{suppfa} that @{text "{atom x\<^isub>1} #\<^sup>* Lam\<^sup>\<alpha>
  2233   by Theorem~\ref{suppfa} that @{text "{atom x\<^isub>1} #\<^sup>* Lam\<^sup>\<alpha>
  2230   x\<^isub>1 x\<^isub>2"} (since its support is @{text "supp x\<^isub>2 -
  2234   x\<^isub>1 x\<^isub>2"} (since its support is @{text "supp x\<^isub>2 -
  2231   {atom x\<^isub>1}"}). Property \ref{avoiding} provides us therefore with a
  2235   {atom x\<^isub>1}"}). Property \ref{avoiding} provides us therefore with a
  2232   permutation @{text "\<pi>"}, such that @{text "{atom (\<pi> \<bullet> x\<^isub>1)} #\<^sup>*
  2236   permutation @{text "\<pi>"}, such that @{text "{atom (\<pi> \<bullet> x\<^isub>1)} #\<^sup>*
  2233   c"} and \mbox{@{text "supp (Lam\<^sup>\<alpha> x\<^isub>1 x\<^isub>2) #\<^sup>* \<pi>"}} hold.
  2237   c"} and \mbox{@{text "supp (Lam\<^sup>\<alpha> x\<^isub>1 x\<^isub>2) #\<^sup>* \<pi>"}} hold.
  2234   By using Property \ref{supppermeq}, we can infer from the latter that @{text
  2238   By using Property \ref{supppermeq}, we can infer from the latter that @{text
  2235   "Lam\<^sup>\<alpha> (\<pi> \<bullet> x\<^isub>1) (\<pi> \<bullet> x\<^isub>2) = Lam\<^sup>\<alpha> x\<^isub>1 x\<^isub>2"}. We can use this in the assumption
  2239   "Lam\<^sup>\<alpha> (\<pi> \<bullet> x\<^isub>1) (\<pi> \<bullet> x\<^isub>2) = Lam\<^sup>\<alpha> x\<^isub>1 x\<^isub>2"} holds. We can use this equation in 
  2236   \eqref{assm} and then use \eqref{imp} to conclude this case.
  2240   the assumption \eqref{assm} and then use \eqref{imp} with the renamed @{text "\<pi> \<bullet> x\<^isub>1"} 
  2237 
  2241   and @{text "\<pi> \<bullet> x\<^isub>2"} in order to conclude this case.
  2238   The @{text "Let\<^sup>\<alpha>"}-case involving a (non-recursive) deep binder is more complicated.
  2242 
       
  2243   The @{text "Let_pat\<^sup>\<alpha>"}-case involving a deep binder is slightly more complicated.
  2239   We have the assumption
  2244   We have the assumption
  2240 
  2245 
  2241   \begin{equation}\label{assm}
  2246   \begin{equation}\label{assmtwo}
  2242   @{text "y = Let\<^sup>\<alpha> x\<^isub>1 x\<^isub>2 x\<^isub>3"}
  2247   @{text "y = Let_pat\<^sup>\<alpha> x\<^isub>1 x\<^isub>2 x\<^isub>3"}
  2243   \end{equation}\smallskip
  2248   \end{equation}\smallskip
  2244 
  2249 
  2245   \noindent
  2250   \noindent
  2246   and as implication
  2251   and the implication
  2247 
  2252 
  2248   \[
  2253   \[
  2249 
  2254   @{text "\<forall>x\<^isub>1 x\<^isub>2 x\<^isub>3. set (bn\<^sup>\<alpha> x\<^isub>1) #\<^sup>* c \<and> y = Let_pat\<^sup>\<alpha> x\<^isub>1 x\<^isub>2 x\<^isub>3 \<Rightarrow> P\<^bsub>trm\<^esub>"}
  2250   \]\smallskip
  2255   \]\smallskip
  2251 
  2256 
  2252 
  2257   \noindent
  2253   The reason is that the we cannot apply Property \ref{avoiding} to the whole term @{text "Let p t"},
  2258   The reason that this case is more complicated is that we cannot apply directly Property 
       
  2259   \ref{avoiding} for obtaining a renaming permutation. Property \ref{avoiding} requires
       
  2260   that the binders are fresh for the term in which we want to perform the renaming. But
       
  2261   this is not true in cases like (using informal notation)
       
  2262 
       
  2263   \[
       
  2264   @{text "Let (x, y) := (x, y) in (x, y)"}
       
  2265   \]\smallskip
       
  2266 
       
  2267   \noindent
       
  2268   Although @{text x} and @{text y} are bound in this term, they are also free
       
  2269   in the assignment. We can, however, obtain obtain such a renaming
       
  2270   permutation, say @{text "\<pi>"}, for the abstraction @{term "Abs_lst (bn_al
       
  2271   x\<^isub>1) x\<^isub>3"}. So we have \mbox{@{term "set (bn_al (\<pi> \<bullet>
       
  2272   x\<^isub>1)) \<sharp>* c"}} and @{term "Abs_lst (bn_al (\<pi> \<bullet> x\<^isub>1)) (\<pi> \<bullet>
       
  2273   x\<^isub>3) = Abs_lst (bn_al x\<^isub>1) x\<^isub>3"} (remember @{text "set"} and @{text "bn\<^sup>\<alpha>"} are equivariant).  
       
  2274   Now the quasi-injective property for @{text "Let_pat\<^sup>\<alpha>"} states
       
  2275 
       
  2276   \[
       
  2277   \infer{@{text "Let_pat\<^sup>\<alpha> p t\<^isub>1 t\<^isub>2 = Let_pat\<^sup>\<alpha> p\<PRIME> t\<PRIME>\<^isub>1 t\<PRIME>\<^isub>2"}}
       
  2278   {@{text "[bn\<^sup>\<alpha> p]\<^bsub>list\<^esub>. t\<^isub>2 = [bn\<^sup>\<alpha> p']\<^bsub>list\<^esub>. t\<PRIME>\<^isub>2"}\;\; & 
       
  2279   @{text "p \<approx>\<AL>\<^bsub>bn\<^esub> p\<PRIME>"}\;\; & @{text "t\<^isub>1 = t\<PRIME>\<^isub>1"}}
       
  2280   \]\smallskip
       
  2281 
       
  2282   \noindent
       
  2283   Since all atoms in a pattern are bound by @{text "Let_pat\<^sup>\<alpha>"} 
       
  2284   (hence @{text "(\<pi> \<bullet> x\<^isub>1) \<approx>\<AL>\<^bsub>bn\<^esub> x\<^isub>1"} holds for every @{text "\<pi>"}), we can infer the 
       
  2285   equation
       
  2286 
       
  2287   \[
       
  2288   @{text "Let_pat\<^sup>\<alpha> (\<pi> \<bullet> x\<^isub>1) x\<^isub>2 (\<pi> \<bullet> x\<^isub>3) = Let_pat\<^sup>\<alpha> x\<^isub>1 x\<^isub>2 x\<^isub>3"}  
       
  2289   \]\smallskip
       
  2290   
       
  2291   \noindent
       
  2292   Taking the left-hand side as our assumption in \eqref{assmtwo}, we can use
       
  2293   the implication from the stronger cases lemma to infer @{text "P\<^bsub>trm\<^esub>"}, as needed.
       
  2294 
       
  2295   The remaining difficulty is when a deep binder contains atoms that are bound, but
       
  2296   also that are free.
       
  2297 
       
  2298 
       
  2299   to the whole term @{text "Let_pat x\<^isub>1 x\<^isub>2 x\<^isub>3"},
  2254   because @{text p} might contain names bound by @{text bn}, but also some that are 
  2300   because @{text p} might contain names bound by @{text bn}, but also some that are 
  2255   free. To solve this problem we have to introduce a permutation function that only
  2301   free. To solve this problem we have to introduce a permutation function that only
  2256   permutes names bound by @{text bn} and leaves the other names unchanged. We do this again
  2302   permutes names bound by @{text bn} and leaves the other names unchanged. We do this again
  2257   by lifting. For a
  2303   by lifting. For a
  2258   clause @{text "bn (C x\<^isub>1 \<dots> x\<^isub>r) = rhs"}, we define 
  2304   clause @{text "bn (C x\<^isub>1 \<dots> x\<^isub>r) = rhs"}, we define