Pearl-jv/Paper.thy
changeset 2744 56b8d977d1c0
parent 2742 f1192e3474e0
child 2746 6aa98a113e6c
equal deleted inserted replaced
2743:7085ab735de7 2744:56b8d977d1c0
    88   renaming substitutions of atoms. One reason is that permutations are
    88   renaming substitutions of atoms. One reason is that permutations are
    89   bijective renamings of atoms and thus they can be easily `undone'---namely
    89   bijective renamings of atoms and thus they can be easily `undone'---namely
    90   by applying the inverse permutation. A corresponding inverse substitution 
    90   by applying the inverse permutation. A corresponding inverse substitution 
    91   might not always exist, since renaming substitutions are in general only injective.  
    91   might not always exist, since renaming substitutions are in general only injective.  
    92   Another reason is that permutations preserve many constructions when reasoning about syntax. 
    92   Another reason is that permutations preserve many constructions when reasoning about syntax. 
    93   For example the validity of a typing context is preserved under any permutation. 
    93   For example, suppose a typing context @{text "\<Gamma>"} of the form
    94   Suppose a typing context @{text "\<Gamma>"} of the form
       
    95 
    94 
    96   \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
    95   \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
    97   @{text "x\<^isub>1:\<tau>\<^isub>1, \<dots>, x\<^isub>n:\<tau>\<^isub>n"}
    96   @{text "x\<^isub>1:\<tau>\<^isub>1, \<dots>, x\<^isub>n:\<tau>\<^isub>n"}
    98   \end{isabelle}
    97   \end{isabelle}
    99 
    98 
   100   \noindent
    99   \noindent
   101   is said to be \emph{valid} provided none of its variables, or atoms, @{text "x\<^isub>i"}
   100   is said to be \emph{valid} provided none of its variables, or atoms, @{text "x\<^isub>i"}
   102   occur twice. Then validity is preserved under
   101   occur twice. Then validity of typing contexts is preserved under
   103   permutations in the sense that if @{text \<Gamma>} is valid then so is @{text "\<pi> \<bullet> \<Gamma>"} for
   102   permutations in the sense that if @{text \<Gamma>} is valid then so is \mbox{@{text "\<pi> \<bullet> \<Gamma>"}} for
   104   all permutations @{text "\<pi>"}. This is again \emph{not} the case for arbitrary
   103   all permutations @{text "\<pi>"}. Again, this is \emph{not} the case for arbitrary
   105   renaming substitutions, as they might identify some of the @{text "x\<^isub>i"} in @{text \<Gamma>}. 
   104   renaming substitutions, as they might identify some of the @{text "x\<^isub>i"} in @{text \<Gamma>}. 
   106 
   105 
   107   Permutations also behave uniformly with respect to HOL's logic connectives. 
   106   Permutations also behave uniformly with respect to HOL's logic connectives. 
   108   Applying a permutation to a formula gives, for example 
   107   Applying a permutation to a formula gives, for example 
   109   
   108   
   116 
   115 
   117   \noindent
   116   \noindent
   118   This uniform behaviour can also be extended to quantifiers and functions. 
   117   This uniform behaviour can also be extended to quantifiers and functions. 
   119   Because of these good properties of permutations, we are able to automate 
   118   Because of these good properties of permutations, we are able to automate 
   120   reasoning to do with \emph{equivariance}. By equivariance we mean the property 
   119   reasoning to do with \emph{equivariance}. By equivariance we mean the property 
   121   that every permutation leaves an object unchanged, that is @{term "\<pi> \<bullet> x = x"}
   120   that every permutation leaves a function unchanged, that is @{term "\<pi> \<bullet> f = f"}
   122   for all @{text "\<pi>"}. This will often simplify arguments involving support 
   121   for all @{text "\<pi>"}. This will often simplify arguments involving support 
   123   and functions, since equivariant objects have empty support---or
   122   of functions, since if they are equivariant then they have empty support---or
   124   `no free atoms'.
   123   `no free atoms'.
   125 
   124 
   126   There are a number of subtle differences between the nominal logic work by
   125   There are a number of subtle differences between the nominal logic work by
   127   Pitts and the formalisation we will present in this paper. One difference 
   126   Pitts and the formalisation we will present in this paper. One difference 
   128   is that our
   127   is that our
   156 
   155 
   157 section {* Sorted Atoms and Sort-Respecting Permutations *}
   156 section {* Sorted Atoms and Sort-Respecting Permutations *}
   158 
   157 
   159 text {*
   158 text {*
   160   The two most basic notions in the nominal logic work are a countably
   159   The two most basic notions in the nominal logic work are a countably
   161   infinite collection of sorted atoms and sort-respecting permutations. 
   160   infinite collection of sorted atoms and sort-respecting permutations of atoms. 
   162   The existing nominal logic work usually leaves implicit
   161   The existing nominal logic work usually leaves implicit
   163   the sorting information for atoms and as far as we know leaves out a
   162   the sorting information for atoms and as far as we know leaves out a
   164   description of how sorts are represented.  In our formalisation, we
   163   description of how sorts are represented.  In our formalisation, we
   165   therefore have to make a design decision about how to implement sorted atoms
   164   therefore have to make a design decision about how to implement sorted atoms
   166   and sort-respecting permutations. One possibility, which we described in
   165   and sort-respecting permutations. One possibility, which we described in
   180   whereby the string argument specifies the sort of the atom.\footnote{A
   179   whereby the string argument specifies the sort of the atom.\footnote{A
   181   similar design choice was made by Gunter et al \cite{GunterOsbornPopescu09}
   180   similar design choice was made by Gunter et al \cite{GunterOsbornPopescu09}
   182   for their variables.}  The use of type \emph{string} for sorts is merely for
   181   for their variables.}  The use of type \emph{string} for sorts is merely for
   183   convenience; any countably infinite type would work as well. 
   182   convenience; any countably infinite type would work as well. 
   184   The set of all atoms we shall write as @{term "UNIV::atom set"}.
   183   The set of all atoms we shall write as @{term "UNIV::atom set"}.
   185   We have two
   184   We have two auxiliary functions for atoms, namely @{text sort} 
   186   auxiliary functions @{text sort} and @{const nat_of} that are defined as 
   185   and @{const nat_of} which are defined as 
   187 
   186 
   188   \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
   187   \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
   189   \begin{tabular}{@ {}r@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
   188   \begin{tabular}{@ {}r@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
   190   @{thm (lhs) sort_of.simps[no_vars]} & @{text "\<equiv>"} & @{thm (rhs) sort_of.simps[no_vars]}\\
   189   @{thm (lhs) sort_of.simps[no_vars]} & @{text "\<equiv>"} & @{thm (rhs) sort_of.simps[no_vars]}\\
   191   @{thm (lhs) nat_of.simps[no_vars]} & @{text "\<equiv>"}  & @{thm (rhs) nat_of.simps[no_vars]}
   190   @{thm (lhs) nat_of.simps[no_vars]} & @{text "\<equiv>"}  & @{thm (rhs) nat_of.simps[no_vars]}
   234   \noindent
   233   \noindent
   235   but since permutations are required to respect sorts, we must carefully
   234   but since permutations are required to respect sorts, we must carefully
   236   consider what happens if a user states a swapping of atoms with different
   235   consider what happens if a user states a swapping of atoms with different
   237   sorts.  The following definition\footnote{To increase legibility, we omit
   236   sorts.  The following definition\footnote{To increase legibility, we omit
   238   here and in what follows the @{term Rep_perm} and @{term "Abs_perm"}
   237   here and in what follows the @{term Rep_perm} and @{term "Abs_perm"}
   239   wrappers that are needed in our implementation since we defined permutation
   238   wrappers that are needed in our implementation in Isabelle/HOL since we defined permutation
   240   not to be the full function space, but only those functions of type @{typ
   239   not to be the full function space, but only those functions of type @{typ
   241   perm} satisfying properties @{text i}-@{text "iii"} in \eqref{permtype}.}
   240   perm} satisfying properties @{text i}-@{text "iii"} in \eqref{permtype}.}
   242 
   241 
   243 
   242 
   244   @{text [display,indent=10] "(a b) \<equiv> \<lambda>c. if a = c then b else (if b = c then a else c)"}
   243   @{text [display,indent=10] "(a b) \<equiv> \<lambda>c. if a = c then b else (if b = c then a else c)"}
   315   composition of permutations is not commutative in general, because @{text
   314   composition of permutations is not commutative in general, because @{text
   316   "\<pi>\<^sub>1 + \<pi>\<^sub>2 \<noteq>  \<pi>\<^sub>2 + \<pi>\<^sub>1"}.  But since the point of this paper is to implement the
   315   "\<pi>\<^sub>1 + \<pi>\<^sub>2 \<noteq>  \<pi>\<^sub>2 + \<pi>\<^sub>1"}.  But since the point of this paper is to implement the
   317   nominal theory as smoothly as possible in Isabelle/HOL, we tolerate
   316   nominal theory as smoothly as possible in Isabelle/HOL, we tolerate
   318   the non-standard notation in order to reuse the existing libraries.
   317   the non-standard notation in order to reuse the existing libraries.
   319 
   318 
   320   In order to reason abstractly about permutations, we use Isabelle/HOL's
   319   
   321   type classes~\cite{Wenzel04} and state the following two 
   320   A permutation operation, written @{text "\<pi> \<bullet> x"}, applies a permutation 
       
   321   @{text "\<pi>"} to an object @{text "x"}. This operation has the generic type
       
   322 
       
   323   \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
       
   324   @{text "_ \<bullet> _ :: perm \<Rightarrow> \<beta> \<Rightarrow> \<beta>"}
       
   325   \end{isabelle} 
       
   326 
       
   327   \noindent
       
   328   and Isabelle/HOL will allow us to give a definition of this operation for
       
   329   `base' types, such as booleans and atoms, and for type-constructors, such as 
       
   330   products and lists. In order to reason abstractly about this operation, 
       
   331   we use Isabelle/HOL's type classes~\cite{Wenzel04} and state the following two 
   322   \emph{permutation properties}: 
   332   \emph{permutation properties}: 
   323   
   333   
   324   \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
   334   \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
   325   \begin{tabular}{@ {}r@ {\hspace{4mm}}p{10cm}}
   335   \begin{tabular}{@ {}r@ {\hspace{4mm}}p{10cm}}
   326   i) & @{thm permute_zero[no_vars]}\\
   336   i) & @{thm permute_zero[no_vars]}\\
   329   \end{isabelle} 
   339   \end{isabelle} 
   330 
   340 
   331   \noindent
   341   \noindent
   332   The use of type classes allows us to delegate much of the routine resoning involved in 
   342   The use of type classes allows us to delegate much of the routine resoning involved in 
   333   determining whether these properties are satisfied to Isabelle/HOL's type system:
   343   determining whether these properties are satisfied to Isabelle/HOL's type system:
   334   we only have to establish that `base' types, such as @{text booleans} and 
   344   we only have to establish that base types satisfy them and that type-constructors
   335   @{text atoms}, satisfy them and that type-constructors, such as products and lists, 
   345   preserve them. Isabelle/HOL will use this information and determine whether
   336   preserve them.  For this we define
   346   an object @{text x} with a compound type satisfies the permutation properties.
       
   347   For this we define the notion of a \emph{permutation type}:
   337 
   348 
   338   \begin{definition}[Permutation type]
   349   \begin{definition}[Permutation type]
   339   A type @{text "\<beta>"} is a \emph{permutation type} if the permutation
   350   A type @{text "\<beta>"} is a \emph{permutation type} if the permutation
   340   properties in \eqref{newpermprops} are satisfied for every @{text "x"} of type
   351   properties in \eqref{newpermprops} are satisfied for every @{text "x"} of type
   341   @{text "\<beta>"}.  
   352   @{text "\<beta>"}.  
   366   @{thm (rhs) permute_eq_iff[where p="\<pi>", no_vars]}.
   377   @{thm (rhs) permute_eq_iff[where p="\<pi>", no_vars]}.
   367   \end{tabular}\hfill\numbered{permuteequ}
   378   \end{tabular}\hfill\numbered{permuteequ}
   368   \end{isabelle} 
   379   \end{isabelle} 
   369 
   380 
   370   \noindent
   381   \noindent
   371   In order to lift the permutation operation to other types, we can define for:
   382   We can also show that the following property holds for any permutation type.
       
   383 
       
   384   \begin{lemma}\label{permutecompose} 
       
   385   Given @{term x} is of permutation type, then 
       
   386   @{text "\<pi>\<^isub>1 \<bullet> (\<pi>\<^isub>2 \<bullet> x) = (\<pi>\<^isub>1 \<bullet> \<pi>\<^isub>2) \<bullet> (\<pi>\<^isub>1 \<bullet> x)"}.
       
   387   \end{lemma}
       
   388 
       
   389   \begin{proof} The proof is as follows:
       
   390   \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
       
   391   \begin{tabular}[b]{@ {}c@ {\hspace{2mm}}l@ {\hspace{8mm}}l}
       
   392   & @{text "\<pi>\<^isub>1 \<bullet> \<pi>\<^isub>2 \<bullet> x"}\\
       
   393   @{text "="} & @{text "\<pi>\<^isub>1 \<bullet> \<pi>\<^isub>2 \<bullet> (-\<pi>\<^isub>1) \<bullet> \<pi>\<^isub>1 \<bullet> x"} & by \eqref{cancel}\\
       
   394   @{text "="} & @{text "(\<pi>\<^isub>1 + \<pi>\<^isub>2 - \<pi>\<^isub>1) \<bullet> (\<pi>\<^isub>1 \<bullet> x)"}  & by {\rm(\ref{newpermprops}.@{text "ii"})}\\
       
   395   @{text "\<equiv>"} & @{text "(\<pi>\<^isub>1 \<bullet> \<pi>\<^isub>2) \<bullet> (\<pi>\<^isub>1 \<bullet> x)"}\\
       
   396   \end{tabular}\hfill\qed
       
   397   \end{isabelle}
       
   398   \end{proof}
       
   399 
       
   400   \noindent
       
   401   Next we define the permutation operation for some types:
   372 
   402 
   373   \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
   403   \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
   374   \begin{tabular}{@ {}l@ {\hspace{4mm}}l@ {}}
   404   \begin{tabular}{@ {}l@ {\hspace{4mm}}l@ {}}
   375   atoms: & @{thm permute_atom_def[where p="\<pi>",no_vars, THEN eq_reflection]}\\
   405   atoms: & @{thm permute_atom_def[where p="\<pi>",no_vars, THEN eq_reflection]}\\
   376   functions: &  @{text "\<pi> \<bullet> f \<equiv> \<lambda>x. \<pi> \<bullet> (f ((-\<pi>) \<bullet> x))"}\\
   406   functions: &  @{text "\<pi> \<bullet> f \<equiv> \<lambda>x. \<pi> \<bullet> (f ((-\<pi>) \<bullet> x))"}\\
   383   nats: & @{thm permute_nat_def[where p="\<pi>", no_vars, THEN eq_reflection]}\\
   413   nats: & @{thm permute_nat_def[where p="\<pi>", no_vars, THEN eq_reflection]}\\
   384   \end{tabular}\hfill\numbered{permdefs}
   414   \end{tabular}\hfill\numbered{permdefs}
   385   \end{isabelle}
   415   \end{isabelle}
   386 
   416 
   387   \noindent
   417   \noindent
   388   and then establish:
   418   and establish:
   389 
   419 
   390   \begin{theorem}
   420   \begin{theorem}
   391   If @{text \<beta>}, @{text "\<beta>\<^isub>1"} and @{text "\<beta>\<^isub>2"} are permutation types, 
   421   If @{text \<beta>}, @{text "\<beta>\<^isub>1"} and @{text "\<beta>\<^isub>2"} are permutation types, 
   392   then so are @{text "atom"}, @{text "\<beta>\<^isub>1 \<Rightarrow> \<beta>\<^isub>2"}, 
   422   then so are @{text "atom"}, @{text "\<beta>\<^isub>1 \<Rightarrow> \<beta>\<^isub>2"}, 
   393   @{text perm}, @{term "\<beta> set"}, @{term "\<beta> list"}, @{term "\<beta>\<^isub>1 \<times> \<beta>\<^isub>2"},
   423   @{text perm}, @{term "\<beta> set"}, @{term "\<beta> list"}, @{term "\<beta>\<^isub>1 \<times> \<beta>\<^isub>2"},
   418   \hfill\numbered{permutefunapp}
   448   \hfill\numbered{permutefunapp}
   419   \end{isabelle}
   449   \end{isabelle}
   420 
   450 
   421   \noindent
   451   \noindent
   422   which is a simple consequence of the definition and the cancellation property in \eqref{cancel}.
   452   which is a simple consequence of the definition and the cancellation property in \eqref{cancel}.
   423   We can also show that the following property holds for any permutation type.
       
   424 
       
   425   \begin{lemma}\label{permutecompose} 
       
   426   Given @{term x} is of permutation type, then 
       
   427   @{text "\<pi>\<^isub>1 \<bullet> (\<pi>\<^isub>2 \<bullet> x) = (\<pi>\<^isub>1 \<bullet> \<pi>\<^isub>2) \<bullet> (\<pi>\<^isub>1 \<bullet> x)"}.
       
   428   \end{lemma}
       
   429 
       
   430   \begin{proof} The proof is as follows:
       
   431   \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
       
   432   \begin{tabular}[b]{@ {}c@ {\hspace{2mm}}l@ {\hspace{8mm}}l}
       
   433   & @{text "\<pi>\<^isub>1 \<bullet> \<pi>\<^isub>2 \<bullet> x"}\\
       
   434   @{text "="} & @{text "\<pi>\<^isub>1 \<bullet> \<pi>\<^isub>2 \<bullet> (-\<pi>\<^isub>1) \<bullet> (\<pi>\<^isub>1 \<bullet> x)"} & by \eqref{cancel}\\
       
   435   @{text "="} & @{text "(\<pi>\<^isub>1 + \<pi>\<^isub>2 - \<pi>\<^isub>1) \<bullet> (\<pi>\<^isub>1 \<bullet> x)"}  & by {\rm(\ref{newpermprops}.@{text "ii"})}\\
       
   436   @{text "\<equiv>"} & @{text "(\<pi>\<^isub>1 \<bullet> \<pi>\<^isub>2) \<bullet> (\<pi>\<^isub>1 \<bullet> x)"}\\
       
   437   \end{tabular}\hfill\qed
       
   438   \end{isabelle}
       
   439   \end{proof}
       
   440 
       
   441 *}
   453 *}
   442 
   454 
   443 section {* Equivariance *}
   455 section {* Equivariance *}
   444 
   456 
   445 text {*
   457 text {*
   446   An important notion in the nominal logic work is \emph{equivariance}.
   458   An important notion in the nominal logic work is \emph{equivariance}.
   447   An equivariant function is one that is invariant under
   459   An equivariant function is one that is invariant under the
   448   permutations of atoms. This notion can be defined
   460   permutation operation. This notion can be defined
   449   uniformly as follows:
   461   uniformly for all constants in HOL as follows:
   450 
   462 
   451 
   463 
   452   \begin{definition}[Equivariance]\label{equivariance}
   464   \begin{definition}[Equivariance]\label{equivariance}
   453   A function @{text f} is \emph{equivariant} if @{term "\<forall>\<pi>. \<pi> \<bullet> f = f"}.
   465   A constant @{text c} is \emph{equivariant} if @{term "\<forall>\<pi>. \<pi> \<bullet> c = c"}.
   454   \end{definition}
   466   \end{definition}
   455 
   467 
   456   \noindent
   468   \noindent
   457   There are a number of equivalent formulations for the equivariance property. 
   469   There are a number of equivalent formulations for the equivariance property. 
   458   For example, assuming @{text f} is of type @{text "\<alpha> \<Rightarrow> \<beta>"}, then equivariance 
   470   For example, assuming @{text c} is of type @{text "\<alpha> \<Rightarrow> \<beta>"}, then equivariance 
   459   can also be stated as 
   471   can also be stated as 
   460 
   472 
   461   \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
   473   \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
   462   \begin{tabular}{@ {}l}
   474   \begin{tabular}{@ {}l}
   463   @{text "\<forall>\<pi> x.  \<pi> \<bullet> (f x) = f (\<pi> \<bullet> x)"}
   475   @{text "\<forall>\<pi> x.  \<pi> \<bullet> (c x) = c (\<pi> \<bullet> x)"}
   464   \end{tabular}\hfill\numbered{altequivariance}
   476   \end{tabular}\hfill\numbered{altequivariance}
   465   \end{isabelle} 
   477   \end{isabelle} 
   466 
   478 
   467   \noindent
   479   \noindent
   468   To see that this formulation implies the definition, we just unfold the
   480   To see that this formulation implies the definition, we just unfold the
   482   \end{isabelle} 
   494   \end{isabelle} 
   483 
   495 
   484   \noindent
   496   \noindent
   485   using the permutation operation on booleans and property \eqref{permuteequ}. 
   497   using the permutation operation on booleans and property \eqref{permuteequ}. 
   486   Lemma~\ref{permutecompose} establishes that the permutation operation is 
   498   Lemma~\ref{permutecompose} establishes that the permutation operation is 
   487   equivariant. It is also easy to see that the boolean operators, like 
   499   equivariant. The permutation operation for lists and products, shown in \eqref{permdefs},
   488   @{text "\<and>"}, @{text "\<or>"}, @{text "\<not>"} and @{text "\<longrightarrow>"} are all equivariant. Furthermore 
   500   state that the constructors for products, @{text "Nil"} and @{text Cons} are equivariant. Also
       
   501   the booleans @{const True} and @{const False} are equivariant by the permutation
       
   502   operation. Furthermore 
   489   a simple calculation will show that our swapping functions are equivariant, that is
   503   a simple calculation will show that our swapping functions are equivariant, that is
   490   
   504   
   491   \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
   505   \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
   492   \begin{tabular}{@ {}l}
   506   \begin{tabular}{@ {}l}
   493   @{thm swap_eqvt[where p="\<pi>", no_vars]}
   507   @{thm swap_eqvt[where p="\<pi>", no_vars]}
   494   \end{tabular}\hfill\numbered{swapeqvt}
   508   \end{tabular}\hfill\numbered{swapeqvt}
   495   \end{isabelle} 
   509   \end{isabelle} 
   496 
   510 
   497   \noindent
   511   \noindent
   498   for all @{text a}, @{text b} and @{text \<pi>}.  
   512   for all @{text a}, @{text b} and @{text \<pi>}. 
   499 
   513   It is also easy to see that the boolean operators, like 
   500   In contrast, Definition~\ref{equivariance} together with the permutation 
   514   @{text "\<and>"}, @{text "\<or>"}, @{text "\<not>"} and @{text "\<longrightarrow>"} are all equivariant. 
   501   operation for functions and \eqref{permutefunapp} lead to a simple
   515 
   502   rewrite system that pushes permutations inside a term until they reach
   516   In contrast, the equation in Definition~\ref{equivariance} together with the permutation 
       
   517   operation for functions and the properties in \eqref{permutefunapp} and \eqref{cancel}
       
   518   leads to a simple rewrite system that pushes permutations inside a term until they reach
   503   either function constants or variables. The permutations in front of
   519   either function constants or variables. The permutations in front of
   504   equivariant functions disappear. Such a rewrite system is often very helpful
   520   equivariant constants disappear. This helps us to establish equivariance
       
   521   for any notion in HOL that is defined in terms of more primitive notions. To
       
   522   see this let us define \emph{HOL-terms}. They are given by the grammar
       
   523 
       
   524   \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
       
   525   @{text "t ::= c | x | t\<^isub>1 t\<^isub>2 | \<lambda>x. t"}
       
   526   \hfill\numbered{holterms}
       
   527   \end{isabelle} 
       
   528 
       
   529   \noindent
       
   530   whereby @{text c} stands for constants. We assume HOL-terms are fully typed, but 
       
   531   for the sake of greater legibility we leave the typing information implicit. 
       
   532   We also assume the usual notions for free and bound variables of a HOL-term.
       
   533   With these definitions in place we can define the notion of an \emph{equivariant}
       
   534   HOL-term
       
   535 
       
   536   \begin{definition}[Equivariant HOL-term]
       
   537   A HOL-term is \emph{equivariant}, provided it is closed and composed of applications, 
       
   538   abstractions and equivariant constants only.
       
   539   \end{definition}
       
   540   
       
   541   \noindent
       
   542   For equivariant terms we have
       
   543 
       
   544   \begin{lemma}
       
   545   For an equivariant HOL-term @{text "t"},  @{term "\<pi> \<bullet> t = t"} for all permutations @{term "\<pi>"}.
       
   546   \end{lemma}
       
   547 
       
   548   \begin{proof}
       
   549   By induction on the grammar of HOL-terms. The case for variables cannot arise since
       
   550   equivariant HOL-terms are closed. The case for constants is clear by Definition 
       
   551   \ref{equivariance}. The case for applications is also straightforward since by
       
   552   \eqref{permutefunapp} we have @{term "\<pi> \<bullet> (t\<^isub>1 t\<^isub>2) = (\<pi> \<bullet> t\<^isub>1) (\<pi> \<bullet> t\<^isub>2)"}.
       
   553   For the case of abstractions we can reason as follows
       
   554   
       
   555   \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
       
   556   \begin{tabular}[b]{@ {}c@ {\hspace{2mm}}l@ {\hspace{8mm}}l}
       
   557   & @{text "\<pi> \<bullet> (\<lambda>x. t)"}\\
       
   558   @{text "\<equiv>"} & @{text "\<lambda>y. \<pi> \<bullet> ((\<lambda>x. t) ((-\<pi>) \<bullet> y))"} & by \eqref{permdefs}\\
       
   559 
       
   560   \end{tabular}\hfill\qed
       
   561   \end{isabelle}
       
   562   \end{proof}
       
   563 
       
   564   database of equivariant functions
       
   565 
       
   566   Such a rewrite system is often very helpful
   505   in determining whether @{text "\<pi> \<bullet> t = t"} holds for a compound term @{text t}. ???
   567   in determining whether @{text "\<pi> \<bullet> t = t"} holds for a compound term @{text t}. ???
   506  
   568  
   507 *}
   569 *}
   508 
   570 
   509 
   571