LMCS-Paper/Paper.thy
changeset 3039 3941fa3f179a
parent 3038 af6eda1fb91f
child 3041 119b9f7e34c0
equal deleted inserted replaced
3038:af6eda1fb91f 3039:3941fa3f179a
  2175   each type @{text "ty"}$^\alpha_{1..n}$) that decrease in every induction
  2175   each type @{text "ty"}$^\alpha_{1..n}$) that decrease in every induction
  2176   step and the other is that we have covered all cases in the induction
  2176   step and the other is that we have covered all cases in the induction
  2177   principle. Once these two proof obligations are discharged, the reasoning
  2177   principle. Once these two proof obligations are discharged, the reasoning
  2178   infrastructure of the function package will automatically derive the
  2178   infrastructure of the function package will automatically derive the
  2179   stronger induction principle. This way of establishing the stronger induction
  2179   stronger induction principle. This way of establishing the stronger induction
  2180   principle is considerably simpler than the earlier work presented \cite{Urban08}.
  2180   principle is considerably simpler than the earlier work presented in \cite{Urban08}.
  2181 
  2181 
  2182   As measures we can use the size functions @{text "size_ty"}$^\alpha_{1..n}$,
  2182   As measures we can use the size functions @{text "size_ty"}$^\alpha_{1..n}$,
  2183   which we lifted in the previous section and which are all well-founded. It
  2183   which we lifted in the previous section and which are all well-founded. It
  2184   is straightforward to establish that the sizes decrease in every
  2184   is straightforward to establish that the sizes decrease in every
  2185   induction step. What is left to show is that we covered all cases. 
  2185   induction step. What is left to show is that we covered all cases. 
  2205   \]\smallskip 
  2205   \]\smallskip 
  2206 
  2206 
  2207   \noindent
  2207   \noindent
  2208   They are stronger in the sense that they allow us to assume in the @{text
  2208   They are stronger in the sense that they allow us to assume in the @{text
  2209   "Lam\<^sup>\<alpha>"} and @{text "Let_pat\<^sup>\<alpha>"} cases that the bound atoms
  2209   "Lam\<^sup>\<alpha>"} and @{text "Let_pat\<^sup>\<alpha>"} cases that the bound atoms
  2210   avoid a context @{text "c"} (which is assumed to be finitely supported).
  2210   avoid, or being fresh for, a context @{text "c"} (which is assumed to be finitely supported).
  2211   
  2211   
  2212   These stronger cases lemmas can be derived from the `weak' cases lemmas
  2212   These stronger cases lemmas can be derived from the `weak' cases lemmas
  2213   given in \eqref{inductex}. This is trivial in case of patterns (the one on
  2213   given in \eqref{inductex}. This is trivial in case of patterns (the one on
  2214   the right-hand side) since the weak and strong cases lemma coincide (there
  2214   the right-hand side) since the weak and strong cases lemma coincide (there
  2215   is no binding in patterns).  Interesting are only the cases for @{text
  2215   is no binding in patterns).  Interesting are only the cases for @{text
  2232 
  2232 
  2233   \noindent
  2233   \noindent
  2234   which we must use in order to infer @{text "P\<^bsub>trm\<^esub>"}. Clearly, we cannot
  2234   which we must use in order to infer @{text "P\<^bsub>trm\<^esub>"}. Clearly, we cannot
  2235   use this implication directly, because we have no information whether or not @{text
  2235   use this implication directly, because we have no information whether or not @{text
  2236   "x\<^isub>1"} is fresh for @{text "c"}.  However, we can use Properties
  2236   "x\<^isub>1"} is fresh for @{text "c"}.  However, we can use Properties
  2237   \ref{supppermeq} and \ref{avoiding} to rename @{text "x\<^isub>1"}: we know
  2237   \ref{supppermeq} and \ref{avoiding} to rename @{text "x\<^isub>1"}. We know
  2238   by Theorem~\ref{suppfa} that @{text "{atom x\<^isub>1} #\<^sup>* Lam\<^sup>\<alpha>
  2238   by Theorem~\ref{suppfa} that @{text "{atom x\<^isub>1} #\<^sup>* Lam\<^sup>\<alpha>
  2239   x\<^isub>1 x\<^isub>2"} (since its support is @{text "supp x\<^isub>2 -
  2239   x\<^isub>1 x\<^isub>2"} (since its support is @{text "supp x\<^isub>2 -
  2240   {atom x\<^isub>1}"}). Property \ref{avoiding} provides us then with a
  2240   {atom x\<^isub>1}"}). Property \ref{avoiding} provides us then with a
  2241   permutation @{text "\<pi>"}, such that @{text "{atom (\<pi> \<bullet> x\<^isub>1)} #\<^sup>*
  2241   permutation @{text "\<pi>"}, such that @{text "{atom (\<pi> \<bullet> x\<^isub>1)} #\<^sup>*
  2242   c"} and \mbox{@{text "supp (Lam\<^sup>\<alpha> x\<^isub>1 x\<^isub>2) #\<^sup>* \<pi>"}} hold.
  2242   c"} and \mbox{@{text "supp (Lam\<^sup>\<alpha> x\<^isub>1 x\<^isub>2) #\<^sup>* \<pi>"}} hold.
  2308   \eqref{letrecs}.  In such cases @{text "(\<pi> \<bullet> x\<^isub>1)
  2308   \eqref{letrecs}.  In such cases @{text "(\<pi> \<bullet> x\<^isub>1)
  2309   \<approx>\<AL>\<^bsub>bn\<^esub> x\<^isub>1"} does not hold in general. The idea however is
  2309   \<approx>\<AL>\<^bsub>bn\<^esub> x\<^isub>1"} does not hold in general. The idea however is
  2310   that @{text "\<pi>"} only renames atoms that become bound. In this way @{text "\<pi>"}
  2310   that @{text "\<pi>"} only renames atoms that become bound. In this way @{text "\<pi>"}
  2311   does not affect @{text "\<approx>\<AL>\<^bsub>bn\<^esub>"} (which only tracks alpha-equivalence of terms that are not
  2311   does not affect @{text "\<approx>\<AL>\<^bsub>bn\<^esub>"} (which only tracks alpha-equivalence of terms that are not
  2312   under the binder). However, the problem is that the
  2312   under the binder). However, the problem is that the
  2313   permutation operation @{text "\<pi> \<bullet> x\<^isub>1"} applies to all attoms in @{text "x\<^isub>1"}. To avoid this
  2313   permutation operation @{text "\<pi> \<bullet> x\<^isub>1"} applies to all atoms in @{text "x\<^isub>1"}. To avoid this
  2314   we introduce an auxiliary permutation operations, written @{text "_
  2314   we introduce an auxiliary permutation operations, written @{text "_
  2315   \<bullet>\<^bsub>bn\<^esub> _"}, for deep binders that only permutes bound atoms (or
  2315   \<bullet>\<^bsub>bn\<^esub> _"}, for deep binders that only permutes bound atoms (or
  2316   more precisely the atoms specified by the @{text "bn"}-functions) and leaves
  2316   more precisely the atoms specified by the @{text "bn"}-functions) and leaves
  2317   the other atoms unchanged. Like the functions @{text "fa_bn"}$_{1..m}$, we
  2317   the other atoms unchanged. Like the functions @{text "fa_bn"}$_{1..m}$, we
  2318   can define these permutation operations over raw terms analysing how the functions @{text
  2318   can define these permutation operations over raw terms analysing how the functions @{text
  2334   \]\smallskip
  2334   \]\smallskip
  2335 
  2335 
  2336   \noindent
  2336   \noindent
  2337   Using again the quotient package  we can lift the auxiliary permutation operations
  2337   Using again the quotient package  we can lift the auxiliary permutation operations
  2338   @{text "_ \<bullet>\<^bsub>bn\<^esub> _"}
  2338   @{text "_ \<bullet>\<^bsub>bn\<^esub> _"}
  2339   alpha-equated terms. Moreover we can prove the following two properties
  2339   to alpha-equated terms. Moreover we can prove the following two properties
  2340 
  2340 
  2341   \begin{lem}\label{permutebn} 
  2341   \begin{lem}\label{permutebn} 
  2342   Given a binding function @{text "bn\<^sup>\<alpha>"} and auxiliary equivalence @{text "\<approx>\<AL>\<^bsub>bn\<^esub>"} 
  2342   Given a binding function @{text "bn\<^sup>\<alpha>"} and auxiliary equivalence @{text "\<approx>\<AL>\<^bsub>bn\<^esub>"} 
  2343   then for all @{text "\<pi>"}\smallskip\\
  2343   then for all @{text "\<pi>"}\smallskip\\
  2344   {\it (i)} @{text "\<pi> \<bullet> (bn\<^sup>\<alpha> x) = bn\<^sup>\<alpha> (\<pi> \<bullet>\<AL>\<^bsub>bn\<^esub> x)"} and\\ 
  2344   {\it (i)} @{text "\<pi> \<bullet> (bn\<^sup>\<alpha> x) = bn\<^sup>\<alpha> (\<pi> \<bullet>\<AL>\<^bsub>bn\<^esub> x)"} and\\ 
  2353   \noindent
  2353   \noindent
  2354   The first property states that a permutation applied to a binding function
  2354   The first property states that a permutation applied to a binding function
  2355   is equivalent to first permuting the binders and then calculating the bound
  2355   is equivalent to first permuting the binders and then calculating the bound
  2356   atoms. The second states that @{text "_ \<bullet>\<AL>\<^bsub>bn\<^esub> _"} preserves
  2356   atoms. The second states that @{text "_ \<bullet>\<AL>\<^bsub>bn\<^esub> _"} preserves
  2357   @{text "\<approx>\<AL>\<^bsub>bn\<^esub>"}.  The main point of the auxiliary
  2357   @{text "\<approx>\<AL>\<^bsub>bn\<^esub>"}.  The main point of the auxiliary
  2358   permutation functions is that they allow us to rename just the binders in a
  2358   permutation functions is that they allow us to rename just the bound atoms in a
  2359   term, without changing anything else.
  2359   term, without changing anything else.
  2360   
  2360   
  2361   Having the auxiliary permutation function in place, we can now solve all remaining cases. 
  2361   Having the auxiliary permutation function in place, we can now solve all remaining cases. 
  2362   For the @{text "Let\<^sup>\<alpha>"} term-constructor, for example, we can by Property \ref{avoiding} 
  2362   For the @{text "Let\<^sup>\<alpha>"} term-constructor, for example, we can by Property \ref{avoiding} 
  2363   obtain a @{text "\<pi>"} such that 
  2363   obtain a @{text "\<pi>"} such that 
  2652   
  2652   
  2653   We have also not yet played with other binding modes. For example we can
  2653   We have also not yet played with other binding modes. For example we can
  2654   imagine that there is need for a binding mode where instead of usual lists,
  2654   imagine that there is need for a binding mode where instead of usual lists,
  2655   we abstract lists of distinct elements (the corresponding type @{text
  2655   we abstract lists of distinct elements (the corresponding type @{text
  2656   "dlist"} already exists in the library of Isabelle/HOL). We expect the
  2656   "dlist"} already exists in the library of Isabelle/HOL). We expect the
  2657   presented work can be easily extended to accommodate such binding modes.\medskip
  2657   presented work can be extended to accommodate such binding modes.\medskip
  2658   
  2658   
  2659   \noindent
  2659   \noindent
  2660   {\bf Acknowledgements:} We are very grateful to Andrew Pitts for many
  2660   {\bf Acknowledgements:} We are very grateful to Andrew Pitts for many
  2661   discussions about Nominal Isabelle. We thank Peter Sewell for making the
  2661   discussions about Nominal Isabelle. We thank Peter Sewell for making the
  2662   informal notes \cite{SewellBestiary} available to us and also for patiently
  2662   informal notes \cite{SewellBestiary} available to us and also for patiently