14 |
14 |
15 section {* Introduction *} |
15 section {* Introduction *} |
16 |
16 |
17 text {* |
17 text {* |
18 So far, Nominal Isabelle provides a mechanism for constructing |
18 So far, Nominal Isabelle provides a mechanism for constructing |
19 alpha-equated terms such as |
19 alpha-equated terms, for example |
20 |
20 |
21 \begin{center} |
21 \begin{center} |
22 $t ::= x \mid t\;t \mid \lambda x. t$ |
22 $t ::= x \mid t\;t \mid \lambda x. t$ |
23 \end{center} |
23 \end{center} |
24 |
24 |
25 \noindent |
25 \noindent |
26 where free and bound variables have names. For such terms Nominal Isabelle |
26 where free and bound variables have names. For such terms Nominal Isabelle |
27 derives automatically a reasoning infrastructure, which has been used |
27 derives automatically a reasoning infrastructure that has been used |
28 successfully in formalisations of an equivalence checking algorithm for LF |
28 successfully in formalisations of an equivalence checking algorithm for LF |
29 \cite{UrbanCheneyBerghofer08}, Typed |
29 \cite{UrbanCheneyBerghofer08}, Typed |
30 Scheme~\cite{TobinHochstadtFelleisen08}, several calculi for concurrency |
30 Scheme~\cite{TobinHochstadtFelleisen08}, several calculi for concurrency |
31 \cite{BengtsonParrow07,BengtsonParow09} and a strong normalisation result |
31 \cite{BengtsonParrow07,BengtsonParow09} and a strong normalisation result |
32 for cut-elimination in classical logic \cite{UrbanZhu08}. It has also been |
32 for cut-elimination in classical logic \cite{UrbanZhu08}. It has also been |
81 \noindent |
81 \noindent |
82 where $z$ does not occur freely in the type. |
82 where $z$ does not occur freely in the type. |
83 In this paper we will give a general binding mechanism and associated |
83 In this paper we will give a general binding mechanism and associated |
84 notion of alpha-equivalence that can be used to faithfully represent |
84 notion of alpha-equivalence that can be used to faithfully represent |
85 this kind of binding in Nominal Isabelle. The difficulty of finding the right notion |
85 this kind of binding in Nominal Isabelle. The difficulty of finding the right notion |
86 for alpha-equivalence in this case can be appreciated by considering that the |
86 for alpha-equivalence can be appreciated in this case by considering that the |
87 definition given by Leroy in \cite{Leroy92} is incorrect (it omits a side-condition). |
87 definition given by Leroy in \cite{Leroy92} is incorrect (it omits a side-condition). |
88 |
88 |
89 However, the notion of alpha-equivalence that is preserved by vacuous binders is not |
89 However, the notion of alpha-equivalence that is preserved by vacuous binders is not |
90 always wanted. For example in terms like |
90 always wanted. For example in terms like |
91 % |
91 % |
176 |
176 |
177 \noindent |
177 \noindent |
178 The scope of the binding is indicated by labels given to the types, for |
178 The scope of the binding is indicated by labels given to the types, for |
179 example \mbox{$s\!::\!trm$}, and a binding clause, in this case |
179 example \mbox{$s\!::\!trm$}, and a binding clause, in this case |
180 $\mathtt{bind}\;bn\,(a) \IN s$, that states to bind in $s$ all the names the |
180 $\mathtt{bind}\;bn\,(a) \IN s$, that states to bind in $s$ all the names the |
181 function $bn\,(a)$ returns. This style of specifying terms and bindings is |
181 function call $bn\,(a)$ returns. This style of specifying terms and bindings is |
182 heavily inspired by the syntax of the Ott-tool \cite{ott-jfp}. |
182 heavily inspired by the syntax of the Ott-tool \cite{ott-jfp}. |
183 |
183 |
184 However, we will not be able to deal with all specifications that are |
184 However, we will not be able to deal with all specifications that are |
185 allowed by Ott. One reason is that Ott allows ``empty'' specifications |
185 allowed by Ott. One reason is that Ott allows ``empty'' specifications |
186 like |
186 like |
189 $t ::= t\;t \mid \lambda x. t$ |
189 $t ::= t\;t \mid \lambda x. t$ |
190 \end{center} |
190 \end{center} |
191 |
191 |
192 \noindent |
192 \noindent |
193 where no clause for variables is given. Such specifications make some sense in |
193 where no clause for variables is given. Such specifications make some sense in |
194 the context of Coq's type theory (which Ott supports), but not at al in a HOL-based |
194 the context of Coq's type theory (which Ott supports), but not at all in a HOL-based |
195 theorem prover where every datatype must have a non-empty set-theoretic model. |
195 environment where every datatype must have a non-empty set-theoretic model. |
196 |
196 |
197 Another reason is that we establish the reasoning infrastructure |
197 Another reason is that we establish the reasoning infrastructure |
198 for alpha-\emph{equated} terms. In contrast, Ott produces a reasoning |
198 for alpha-\emph{equated} terms. In contrast, Ott produces a reasoning |
199 infrastructure in Isabelle/HOL for |
199 infrastructure in Isabelle/HOL for |
200 \emph{non}-alpha-equated, or ``raw'', terms. While our alpha-equated terms |
200 \emph{non}-alpha-equated, or ``raw'', terms. While our alpha-equated terms |
219 HOL-logic underlying Nominal Isabelle allows us to replace |
219 HOL-logic underlying Nominal Isabelle allows us to replace |
220 ``equals-by-equals''. In contrast replacing ``alpha-equals-by-alpha-equals'' |
220 ``equals-by-equals''. In contrast replacing ``alpha-equals-by-alpha-equals'' |
221 in a representation based on raw terms requires a lot of extra reasoning work. |
221 in a representation based on raw terms requires a lot of extra reasoning work. |
222 |
222 |
223 Although in informal settings a reasoning infrastructure for alpha-equated |
223 Although in informal settings a reasoning infrastructure for alpha-equated |
224 terms (that have names for bound variables) is nearly always taken for granted, establishing |
224 terms is nearly always taken for granted, establishing |
225 it automatically in the Isabelle/HOL theorem prover is a rather non-trivial task. |
225 it automatically in the Isabelle/HOL theorem prover is a rather non-trivial task. |
226 For every specification we will need to construct a type containing as |
226 For every specification we will need to construct a type containing as |
227 elements the alpha-equated terms. To do so, we use |
227 elements the alpha-equated terms. To do so, we use |
228 the standard HOL-technique of defining a new type by |
228 the standard HOL-technique of defining a new type by |
229 identifying a non-empty subset of an existing type. The construction we |
229 identifying a non-empty subset of an existing type. The construction we |
230 perform in HOL is illustrated by the following picture: |
230 perform in HOL can be illustrated by the following picture: |
231 |
231 |
232 \begin{center} |
232 \begin{center} |
233 \begin{tikzpicture} |
233 \begin{tikzpicture} |
234 %\draw[step=2mm] (-4,-1) grid (4,1); |
234 %\draw[step=2mm] (-4,-1) grid (4,1); |
235 |
235 |
254 \end{center} |
254 \end{center} |
255 |
255 |
256 \noindent |
256 \noindent |
257 We take as the starting point a definition of raw terms (defined as a |
257 We take as the starting point a definition of raw terms (defined as a |
258 datatype in Isabelle/HOL); identify then the |
258 datatype in Isabelle/HOL); identify then the |
259 alpha-equivalence classes in the type of sets of raw terms, according to our |
259 alpha-equivalence classes in the type of sets of raw terms according to our |
260 alpha-equivalence relation and finally define the new type as these |
260 alpha-equivalence relation and finally define the new type as these |
261 alpha-equivalence classes (non-emptiness is satisfied whenever the raw terms are |
261 alpha-equivalence classes (non-emptiness is satisfied whenever the raw terms are |
262 definable as datatype in Isabelle/HOL and the fact that our relation for alpha is an |
262 definable as datatype in Isabelle/HOL and the fact that our relation for |
263 equivalence relation). |
263 alpha-equivalence is indeed an equivalence relation). |
264 |
264 |
265 The fact that we obtain an isomorphism between between the new type and the non-empty |
265 The fact that we obtain an isomorphism between the new type and the non-empty |
266 subset shows that the new type is a faithful representation of alpha-equated terms. |
266 subset shows that the new type is a faithful representation of alpha-equated terms. |
267 That is not the case for example in the representation of terms using the locally |
267 That is not the case for example in the representation of terms using the locally |
268 nameless representation of binders \cite{McKinnaPollack99}: there are ``junk'' terms that need to |
268 nameless representation of binders \cite{McKinnaPollack99}: in this representation |
|
269 there are ``junk'' terms that need to |
269 be excluded by reasoning about a well-formedness predicate. |
270 be excluded by reasoning about a well-formedness predicate. |
270 |
271 |
271 The problem with introducing a new type in Isabelle/HOL is that in order to be useful, |
272 The problem with introducing a new type in Isabelle/HOL is that in order to be useful, |
272 a reasoning infrastructure needs to be ``lifted'' from the underlying subset to |
273 a reasoning infrastructure needs to be ``lifted'' from the underlying subset to |
273 the new type. This is usually a tricky and arduous task. To ease it |
274 the new type. This is usually a tricky and arduous task. To ease it, |
274 we re-implemented in Isabelle/HOL the quotient package described by Homeier |
275 we re-implemented in Isabelle/HOL the quotient package described by Homeier |
275 \cite{Homeier05}. This package |
276 \cite{Homeier05}. This package |
276 allows us to lift definitions and theorems involving raw terms |
277 allows us to lift definitions and theorems involving raw terms |
277 to definitions and theorems involving alpha-equated terms. For example |
278 to definitions and theorems involving alpha-equated, terms. For example |
278 if we define the free-variable function over lambda terms |
279 if we define the free-variable function over lambda terms |
279 |
280 |
280 \begin{center} |
281 \begin{center} |
281 $\fv(x) = \{x\}$\hspace{10mm} |
282 $\fv(x) = \{x\}$\hspace{10mm} |
282 $\fv(t_1\;t_2) = \fv(t_1) \cup \fv(t_2)$\\[1mm] |
283 $\fv(t_1\;t_2) = \fv(t_1) \cup \fv(t_2)$\\[1mm] |
294 \end{center} |
295 \end{center} |
295 |
296 |
296 \noindent |
297 \noindent |
297 (Note that this means also the term-constructors for variables, applications |
298 (Note that this means also the term-constructors for variables, applications |
298 and lambda are lifted to the quotient level.) This construction, of course, |
299 and lambda are lifted to the quotient level.) This construction, of course, |
299 only works if alpha is an equivalence relation, and the definitions and theorems |
300 only works if alpha-equivalence is an equivalence relation, and the |
300 are respectful w.r.t.~alpha-equivalence. Hence we will not be able to lift this |
301 definitions and theorems are respectful w.r.t.~alpha-equivalence. Hence we |
301 a bound-variable function to alpha-equated terms (since it does not respect |
302 will not be able to lift a bound-variable function to alpha-equated terms |
302 alpha-equivalence). To sum up, every lifting needs proofs of some respectfulness |
303 (since it does not respect alpha-equivalence). To sum up, every lifting of |
303 properties. These proofs we are able automate and therefore establish a |
304 theorems to the quotient level needs proofs of some respectfulness |
304 useful reasoning infrastructure for alpha-equated lambda terms.\medskip |
305 properties. In the paper we show that we are able to automate these |
|
306 proofs and therefore can establish a reasoning infrastructure for |
|
307 alpha-equated terms.\medskip |
305 |
308 |
306 |
309 |
307 \noindent |
310 \noindent |
308 {\bf Contributions:} We provide new definitions for when terms |
311 {\bf Contributions:} We provide new definitions for when terms |
309 involving multiple binders are alpha-equivalent. These definitions are |
312 involving multiple binders are alpha-equivalent. These definitions are |
310 inspired by earlier work of Pitts \cite{}. By means of automatic |
313 inspired by earlier work of Pitts \cite{Pitts04}. By means of automatic |
311 proofs, we establish a reasoning infrastructure for alpha-equated |
314 proofs, we establish a reasoning infrastructure for alpha-equated |
312 terms, including properties about support, freshness and equality |
315 terms, including properties about support, freshness and equality |
313 conditions for alpha-equated terms. We re also able to derive, at the moment |
316 conditions for alpha-equated terms. We are also able to derive, at the moment |
314 only manually, for these terms a strong induction principle that |
317 only manually, strong induction principles that |
315 has the variable convention already built in. |
318 have the variable convention already built in. |
316 *} |
319 *} |
317 |
320 |
318 section {* A Short Review of the Nominal Logic Work *} |
321 section {* A Short Review of the Nominal Logic Work *} |
319 |
322 |
320 text {* |
323 text {* |