Pearl-jv/Paper.thy
changeset 1809 08e4d3cbcf8c
parent 1790 000e680b6b6e
child 2005 233bb805a4df
equal deleted inserted replaced
1808:d7a2c45b447a 1809:08e4d3cbcf8c
   212   with the large amounts of custom ML-code for generating multiple variants
   212   with the large amounts of custom ML-code for generating multiple variants
   213   for some basic definitions. The result is that we can implement a pleasingly
   213   for some basic definitions. The result is that we can implement a pleasingly
   214   simple formalisation of the nominal logic work.\smallskip
   214   simple formalisation of the nominal logic work.\smallskip
   215 
   215 
   216   \noindent
   216   \noindent
   217   {\bf Contributions of the paper:} Our use of a single atom type for representing
   217   {\bf Contributions of the paper:} Using a single atom type to represent
   218   atoms of different sorts and of functions for representing
   218   atoms of different sorts and representing permutations as functions are not
   219   permutations is not novel, but drastically reduces the number of type classes to just
   219   new ideas.  The main contribution of this paper is to show an example of how
   220   two (permutation types and finitely supported types) that we need in order
   220   to make better theorem proving tools by choosing the right level of
   221   reason abstractly about properties from the nominal logic work. The novel
   221   abstraction for the underlying theory---our design choices take advantage of
   222   technical contribution of this paper is a mechanism for dealing with
   222   Isabelle's type system, type classes, and reasoning infrastructure.
       
   223   The novel
       
   224   technical contribution is a mechanism for dealing with
   223   ``Church-style'' lambda-terms \cite{Church40} and HOL-based languages
   225   ``Church-style'' lambda-terms \cite{Church40} and HOL-based languages
   224   \cite{PittsHOL4} where variables and variable binding depend on type
   226   \cite{PittsHOL4} where variables and variable binding depend on type
   225   annotations.
   227   annotations.
       
   228 
   226 *}
   229 *}
   227 
   230 
   228 section {* Sorted Atoms and Sort-Respecting Permutations *}
   231 section {* Sorted Atoms and Sort-Respecting Permutations *}
   229 
   232 
   230 text {*
   233 text {*
   336 
   339 
   337   \noindent
   340   \noindent
   338   are \emph{equal}.  We do not have to use the equivalence relation shown
   341   are \emph{equal}.  We do not have to use the equivalence relation shown
   339   in~\eqref{permequ} to identify them, as we would if they had been represented
   342   in~\eqref{permequ} to identify them, as we would if they had been represented
   340   as lists of pairs.  Another advantage of the function representation is that
   343   as lists of pairs.  Another advantage of the function representation is that
   341   they form an (additive non-commutative) group provided we define
   344   they form a (non-commutative) group provided we define
   342 
   345 
   343   \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
   346   \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%%
   344   \begin{tabular}{@ {}l}
   347   \begin{tabular}{@ {}l}
   345   @{thm zero_perm_def[no_vars, THEN eq_reflection]} \hspace{4mm}
   348   @{thm zero_perm_def[no_vars, THEN eq_reflection]} \hspace{4mm}
   346   @{thm plus_perm_def[where p="\<pi>\<^isub>1" and q="\<pi>\<^isub>2", THEN eq_reflection]} \hspace{4mm}
   349   @{thm plus_perm_def[where p="\<pi>\<^isub>1" and q="\<pi>\<^isub>2", THEN eq_reflection]} \hspace{4mm}
   361   \end{tabular}
   364   \end{tabular}
   362   \end{isabelle}
   365   \end{isabelle}
   363 
   366 
   364   \noindent
   367   \noindent
   365   Again this is in contrast to the list-of-pairs representation which does not
   368   Again this is in contrast to the list-of-pairs representation which does not
   366   form a group. The technical importance of this fact is that for groups we
   369   form a group.  The technical importance of this fact is that we can rely on
   367   can rely on Isabelle/HOL's rich simplification infrastructure.  This will
   370   Isabelle/HOL's existing simplification infrastructure for groups, which will
   368   come in handy when we have to do calculations with permutations. 
   371   come in handy when we have to do calculations with permutations.
   369   Note that Isabelle/HOL defies standard conventions of mathematical notation
   372   Note that Isabelle/HOL defies standard conventions of mathematical notation
   370   by using additive syntax even for non-commutative groups.  Obviously,
   373   by using additive syntax even for non-commutative groups.  Obviously,
   371   composition of permutations is not commutative in general, because @{text
   374   composition of permutations is not commutative in general, because @{text
   372   "\<pi>\<^sub>1 + \<pi>\<^sub>2 \<noteq>  \<pi>\<^sub>2 + \<pi>\<^sub>1"}.  But since the point of this paper is to implement the
   375   "\<pi>\<^sub>1 + \<pi>\<^sub>2 \<noteq>  \<pi>\<^sub>2 + \<pi>\<^sub>1"}.  But since the point of this paper is to implement the
   373   nominal theory as smoothly as possible in Isabelle/HOL, we tolerate
   376   nominal theory as smoothly as possible in Isabelle/HOL, we tolerate
   498 
   501 
   499 section {* Equivariance *}
   502 section {* Equivariance *}
   500 
   503 
   501 text {*
   504 text {*
   502 
   505 
   503   One huge advantage of using bijective permutation functions (as opposed to
   506   An \emph{equivariant} function or predicate is one that is invariant under
   504   non-bijective renaming substitutions employed in traditional works syntax) is 
   507   the swapping of atoms.  Having a notion of equivariance with nice logical
   505   the property of \emph{equivariance}
   508   properties is a major advantage of bijective permutations over traditional
   506   and the fact that most HOL-functions (this includes constants) whose argument
   509   renaming substitutions \cite[\S2]{Pitts03}.  Equivariance can be defined
   507   and result types are permutation types satisfy this property:
   510   uniformly for all permutation types, and it is satisfied by most HOL
       
   511   functions and constants.
       
   512 
   508 
   513 
   509   \begin{definition}\label{equivariance}
   514   \begin{definition}\label{equivariance}
   510   A function @{text f} is \emph{equivariant} if @{term "\<forall>\<pi>. \<pi> \<bullet> f = f"}.
   515   A function @{text f} is \emph{equivariant} if @{term "\<forall>\<pi>. \<pi> \<bullet> f = f"}.
   511   \end{definition}
   516   \end{definition}
   512 
   517 
   739   \begin{lemma}\label{optimised} Let @{text x} be of permutation type.
   744   \begin{lemma}\label{optimised} Let @{text x} be of permutation type.
   740   We have that @{thm (concl) finite_supp_unique[no_vars]}
   745   We have that @{thm (concl) finite_supp_unique[no_vars]}
   741   provided @{thm (prem 1) finite_supp_unique[no_vars]},
   746   provided @{thm (prem 1) finite_supp_unique[no_vars]},
   742   @{thm (prem 2) finite_supp_unique[no_vars]}, and for
   747   @{thm (prem 2) finite_supp_unique[no_vars]}, and for
   743   all @{text "a \<in> S"} and all @{text "b \<notin> S"}, with @{text a}
   748   all @{text "a \<in> S"} and all @{text "b \<notin> S"}, with @{text a}
   744   and @{text b} having the same sort, then \mbox{@{term "(a \<rightleftharpoons> b) \<bullet> x \<noteq> x"}}
   749   and @{text b} having the same sort, \mbox{@{term "(a \<rightleftharpoons> b) \<bullet> x \<noteq> x"}}
   745   \end{lemma}
   750   \end{lemma}
   746 
   751 
   747   \begin{proof}
   752   \begin{proof}
   748   By Lemma \ref{supports}@{text ".iii)"} we have to show that for every finite
   753   By Lemma \ref{supports}@{text ".iii)"} we have to show that for every finite
   749   set @{text S'} that supports @{text x}, \mbox{@{text "S \<subseteq> S'"}} holds. We will
   754   set @{text S'} that supports @{text x}, \mbox{@{text "S \<subseteq> S'"}} holds. We will
  1152   involving ``Church-style'' terms and bindings as shown in \eqref{church}. We
  1157   involving ``Church-style'' terms and bindings as shown in \eqref{church}. We
  1153   expect that the creation of such atoms can be easily automated so that the
  1158   expect that the creation of such atoms can be easily automated so that the
  1154   user just needs to specify \isacommand{atom\_decl}~~@{text "var (ty)"}
  1159   user just needs to specify \isacommand{atom\_decl}~~@{text "var (ty)"}
  1155   where the argument, or arguments, are datatypes for which we can automatically
  1160   where the argument, or arguments, are datatypes for which we can automatically
  1156   define an injective function like @{text "sort_ty"} (see \eqref{sortty}).
  1161   define an injective function like @{text "sort_ty"} (see \eqref{sortty}).
  1157   Our hope is that with this approach Benzmueller and Paulson, the authors of 
  1162   Our hope is that with this approach Benzmueller and Paulson can make
  1158   \cite{PaulsonBenzmueller}, can make headway with formalising their results 
  1163   headway with formalising their results
  1159   about simple type theory.  
  1164   about simple type theory \cite{PaulsonBenzmueller}.
  1160   Because of its limitations, they did not attempt this with the old version 
  1165   Because of its limitations, they did not attempt this with the old version 
  1161   of Nominal Isabelle. We also hope we can make progress with formalisations of
  1166   of Nominal Isabelle. We also hope we can make progress with formalisations of
  1162   HOL-based languages.
  1167   HOL-based languages.
  1163 *}
  1168 *}
  1164 
  1169 
  1199   in order to make the approach based on a single type of sorted atoms to work.
  1204   in order to make the approach based on a single type of sorted atoms to work.
  1200   But of course it is analogous to the well-known trick of defining division by 
  1205   But of course it is analogous to the well-known trick of defining division by 
  1201   zero to return zero.
  1206   zero to return zero.
  1202 
  1207 
  1203   We noticed only one disadvantage of the permutations-as-functions: Over
  1208   We noticed only one disadvantage of the permutations-as-functions: Over
  1204   lists we can easily perform inductions. For permutation made up from
  1209   lists we can easily perform inductions. For permutations made up from
  1205   functions, we have to manually derive an appropriate induction principle. We
  1210   functions, we have to manually derive an appropriate induction principle. We
  1206   can establish such a principle, but we have no real experience yet whether ours
  1211   can establish such a principle, but we have no real experience yet whether ours
  1207   is the most useful principle: such an induction principle was not needed in
  1212   is the most useful principle: such an induction principle was not needed in
  1208   any of the reasoning we ported from the old Nominal Isabelle, except
  1213   any of the reasoning we ported from the old Nominal Isabelle, except
  1209   when showing that if @{term "\<forall>a \<in> supp x. a \<sharp> p"} implies @{term "p \<bullet> x = x"}.
  1214   when showing that if @{term "\<forall>a \<in> supp x. a \<sharp> p"} implies @{term "p \<bullet> x = x"}.