46 Nominal Isabelle is a definitional extension of the Isabelle/HOL theorem |
46 Nominal Isabelle is a definitional extension of the Isabelle/HOL theorem |
47 prover providing a proving infrastructure for convenient reasoning about |
47 prover providing a proving infrastructure for convenient reasoning about |
48 programming languages. It has been used to formalise an equivalence checking |
48 programming languages. It has been used to formalise an equivalence checking |
49 algorithm for LF \cite{UrbanCheneyBerghofer08}, |
49 algorithm for LF \cite{UrbanCheneyBerghofer08}, |
50 Typed Scheme~\cite{TobinHochstadtFelleisen08}, several calculi for concurrency |
50 Typed Scheme~\cite{TobinHochstadtFelleisen08}, several calculi for concurrency |
51 \cite{BengtsonParrow07,BengtsonParow09} and a strong normalisation result for |
51 \cite{BengtsonParrow07} and a strong normalisation result for |
52 cut-elimination in classical logic \cite{UrbanZhu08}. It has also been used |
52 cut-elimination in classical logic \cite{UrbanZhu08}. It has also been used |
53 by Pollack for formalisations in the locally-nameless approach to binding |
53 by Pollack for formalisations in the locally-nameless approach to binding |
54 \cite{SatoPollack10}. |
54 \cite{SatoPollack10}. |
55 |
55 |
56 At its core Nominal Isabelle is based on the nominal logic work of Pitts et |
56 At its core Nominal Isabelle is based on the nominal logic work of Pitts et |
216 simple formalisation of the nominal logic work.\smallskip |
216 simple formalisation of the nominal logic work.\smallskip |
217 |
217 |
218 \noindent |
218 \noindent |
219 {\bf Contributions of the paper:} Our use of a single atom type for representing |
219 {\bf Contributions of the paper:} Our use of a single atom type for representing |
220 atoms of different sorts and of functions for representing |
220 atoms of different sorts and of functions for representing |
221 permutations drastically reduces the number of type classes to just |
221 permutations is not novel, but drastically reduces the number of type classes to just |
222 two (permutation types and finitely supported types) that we need in order |
222 two (permutation types and finitely supported types) that we need in order |
223 reason abstractly about properties from the nominal logic work. The novel |
223 reason abstractly about properties from the nominal logic work. The novel |
224 technical contribution of this paper is a mechanism for dealing with |
224 technical contribution of this paper is a mechanism for dealing with |
225 ``Church-style'' lambda-terms \cite{Church40} and HOL-based languages |
225 ``Church-style'' lambda-terms \cite{Church40} and HOL-based languages |
226 \cite{PittsHOL4} where variables and variable binding depend on type |
226 \cite{PittsHOL4} where variables and variable binding depend on type |
240 |
240 |
241 datatype atom\<iota> = Atom\<iota> string nat |
241 datatype atom\<iota> = Atom\<iota> string nat |
242 |
242 |
243 text {* |
243 text {* |
244 \noindent |
244 \noindent |
245 whereby the string argument specifies the sort of the atom. (We use type |
245 whereby the string argument specifies the sort of the atom.\footnote{A similar |
246 \emph{string} merely for convenience; any countably infinite type would work |
246 design choice was made by Gunter et al \cite{GunterOsbornPopescu09} |
247 as well.) A similar design choice was made by Gunter et al \cite{GunterOsbornPopescu09} |
247 for their variables.} (The use type |
248 for their variables. |
248 \emph{string} is merely for convenience; any countably infinite type would work |
|
249 as well.) |
249 We have an auxiliary function @{text sort} that is defined as @{thm |
250 We have an auxiliary function @{text sort} that is defined as @{thm |
250 sort_of.simps[no_vars]}, and we clearly have for every finite set @{text X} of |
251 sort_of.simps[no_vars]}, and we clearly have for every finite set @{text X} of |
251 atoms and every sort @{text s} the property: |
252 atoms and every sort @{text s} the property: |
252 |
253 |
253 \begin{proposition}\label{choosefresh} |
254 \begin{proposition}\label{choosefresh} |
365 form a group. The technical importance of this fact is that for groups we |
366 form a group. The technical importance of this fact is that for groups we |
366 can rely on Isabelle/HOL's rich simplification infrastructure. This will |
367 can rely on Isabelle/HOL's rich simplification infrastructure. This will |
367 come in handy when we have to do calculations with permutations. However, |
368 come in handy when we have to do calculations with permutations. However, |
368 note that in this case Isabelle/HOL neglects well-entrenched mathematical |
369 note that in this case Isabelle/HOL neglects well-entrenched mathematical |
369 terminology that associates with an additive group a commutative |
370 terminology that associates with an additive group a commutative |
370 operation. Obviously, permutations are not commutative in general---@{text |
371 operation. Obviously, permutations are not commutative in general, because @{text |
371 "p + q \<noteq> q + p"}. However, it is quite difficult to work around this |
372 "p + q \<noteq> q + p"}. However, it is quite difficult to work around this |
372 idiosyncrasy of Isabelle/HOL, unless we develop our own algebraic hierarchy |
373 idiosyncrasy of Isabelle/HOL, unless we develop our own algebraic hierarchy |
373 and infrastructure. But since the point of this paper is to implement the |
374 and infrastructure. But since the point of this paper is to implement the |
374 nominal theory as smoothly as possible in Isabelle/HOL, we will follow its |
375 nominal theory as smoothly as possible in Isabelle/HOL, we will follow its |
375 characterisation of additive groups. |
376 characterisation of additive groups. |
811 The main point about support is that whenever an object @{text x} has finite |
812 The main point about support is that whenever an object @{text x} has finite |
812 support, then Proposition~\ref{choosefresh} allows us to choose for @{text x} a |
813 support, then Proposition~\ref{choosefresh} allows us to choose for @{text x} a |
813 fresh atom with arbitrary sort. This is an important operation in Nominal |
814 fresh atom with arbitrary sort. This is an important operation in Nominal |
814 Isabelle in situations where, for example, a bound variable needs to be |
815 Isabelle in situations where, for example, a bound variable needs to be |
815 renamed. To allow such a choice, we only have to assume \emph{one} premise |
816 renamed. To allow such a choice, we only have to assume \emph{one} premise |
816 of the form |
817 of the form @{text "finite (supp x)"} |
817 |
|
818 @{text [display,indent=10] "finite (supp x)"} |
|
819 |
|
820 \noindent |
|
821 for each @{text x}. Compare that with the sequence of premises in our earlier |
818 for each @{text x}. Compare that with the sequence of premises in our earlier |
822 version of Nominal Isabelle (see~\eqref{fssequence}). For more convenience we |
819 version of Nominal Isabelle (see~\eqref{fssequence}). For more convenience we |
823 can define a type class for types where every element has finite support, and |
820 can define a type class for types where every element has finite support, and |
824 prove that the types @{term "atom"}, @{term "perm"}, lists, products and |
821 prove that the types @{term "atom"}, @{term "perm"}, lists, products and |
825 booleans are instances of this type class. Then \emph{no} premise is needed, |
822 booleans are instances of this type class. Then \emph{no} premise is needed, |
924 types. The definition of the concrete atom type class is as follows: First, |
921 types. The definition of the concrete atom type class is as follows: First, |
925 every concrete atom type must be a permutation type. In addition, the class |
922 every concrete atom type must be a permutation type. In addition, the class |
926 defines an overloaded function that maps from the concrete type into the |
923 defines an overloaded function that maps from the concrete type into the |
927 generic atom type, which we will write @{text "|_|"}. For each class |
924 generic atom type, which we will write @{text "|_|"}. For each class |
928 instance, this function must be injective and equivariant, and its outputs |
925 instance, this function must be injective and equivariant, and its outputs |
929 must all have the same sort. |
926 must all have the same sort, that is |
930 |
927 |
931 \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
928 \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
932 i) \hspace{1mm}if @{thm (lhs) atom_eq_iff [no_vars]} then @{thm (rhs) atom_eq_iff [no_vars]}\hspace{4mm} |
929 i) \hspace{1mm}if @{thm (lhs) atom_eq_iff [no_vars]} then @{thm (rhs) atom_eq_iff [no_vars]}\hspace{4mm} |
933 ii) \hspace{1mm}@{thm atom_eqvt[where p="\<pi>", no_vars]}\hspace{4mm} |
930 ii) \hspace{1mm}@{thm atom_eqvt[where p="\<pi>", no_vars]}\hspace{4mm} |
934 iii) \hspace{1mm}@{thm sort_of_atom_eq [no_vars]} |
931 iii) \hspace{1mm}@{thm sort_of_atom_eq [no_vars]} |
1151 involving ``Church-style'' terms and bindings as shown in \eqref{church}. We |
1148 involving ``Church-style'' terms and bindings as shown in \eqref{church}. We |
1152 expect that the creation of such atoms can be easily automated so that the |
1149 expect that the creation of such atoms can be easily automated so that the |
1153 user just needs to specify \isacommand{atom\_decl}~~@{text "var (ty)"} |
1150 user just needs to specify \isacommand{atom\_decl}~~@{text "var (ty)"} |
1154 where the argument, or arguments, are datatypes for which we can automatically |
1151 where the argument, or arguments, are datatypes for which we can automatically |
1155 define an injective function like @{text "sort_ty"} (see \eqref{sortty}). |
1152 define an injective function like @{text "sort_ty"} (see \eqref{sortty}). |
1156 Our hope is that with this approach Benzmueller and Paulson the authors of |
1153 Our hope is that with this approach Benzmueller and Paulson, the authors of |
1157 \cite{PaulsonBenzmueller} can make headway with formalising their results |
1154 \cite{PaulsonBenzmueller}, can make headway with formalising their results |
1158 about simple type theory. |
1155 about simple type theory. |
1159 Because of its limitations, they did not attempt this with the old version |
1156 Because of its limitations, they did not attempt this with the old version |
1160 of Nominal Isabelle. We also hope we can make progress with formalisations of |
1157 of Nominal Isabelle. We also hope we can make progress with formalisations of |
1161 HOL-based languages. |
1158 HOL-based languages. |
1162 *} |
1159 *} |