42 $T ::= x \mid T \rightarrow T$ \hspace{5mm} $S ::= \forall \{x_1,\ldots, x_n\}. T$ |
42 $T ::= x \mid T \rightarrow T$ \hspace{5mm} $S ::= \forall \{x_1,\ldots, x_n\}. T$ |
43 \end{tabular} |
43 \end{tabular} |
44 \end{center} |
44 \end{center} |
45 |
45 |
46 \noindent |
46 \noindent |
47 and the quantification binds a finite (possibly empty) set of type-variables. |
47 and the quantification binds at once a finite (possibly empty) set of type-variables. |
48 While it is possible to formalise such abstractions by iterating single bindings, |
48 While it is possible to implement this kind of more general binders by iterating single binders, |
49 this leads to a rather clumsy formalisation of W. This need of iterating single binders |
49 this leads to a rather clumsy formalisation of W. The need of iterating single binders |
50 in order to representing multiple binders is also one reason why Nominal Isabelle and other |
50 is also one reason why Nominal Isabelle and similar |
51 theorem provers have not fared extremely well with the more advanced tasks |
51 theorem provers have not fared extremely well with the more advanced tasks |
52 in the POPLmark challenge \cite{challenge05}, because also there one would like |
52 in the POPLmark challenge \cite{challenge05}, because also there one would like |
53 to bind multiple variables at once. |
53 to bind multiple variables at once. |
54 |
54 |
55 Binding multiple variables in a single abstraction has interesting properties that are not |
55 Binding multiple variables has interesting properties that are not |
56 captured by iterating single binders. First, |
56 captured by iterating single binders. First, |
57 in the case of type-schemes, we do not like to make a distinction |
57 in the case of type-schemes, we do not like to make a distinction |
58 about the order of the bound variables. Therefore we would like to regard the following two |
58 about the order of the bound variables. Therefore we would like to regard the following two |
59 type-schemes as alpha-equivalent |
59 type-schemes as alpha-equivalent |
60 |
60 |
147 \begin{center} |
145 \begin{center} |
148 $\LET [x_1,\ldots,x_n].s\;\; [t_1,\ldots,t_n]$ |
146 $\LET [x_1,\ldots,x_n].s\;\; [t_1,\ldots,t_n]$ |
149 \end{center} |
147 \end{center} |
150 |
148 |
151 \noindent |
149 \noindent |
152 where the notation $[\_\!\_].\_\!\_$ indicates that a set of variables becomes |
150 where the notation $[\_\!\_].\_\!\_$ indicates that the $x_i$ become |
153 bound in $s$. In this representation we need additional predicates about terms |
151 bound in $s$. In this representation we need additional predicates about terms |
154 to ensure that the two lists are of equal length. This can result into very |
152 to ensure that the two lists are of equal length. This can result into very |
155 unintelligible reasoning (see for example~\cite{BengtsonParow09}). |
153 unintelligible reasoning (see for example~\cite{BengtsonParow09}). |
156 To avoid this, we will allow for example specifications of $\mathtt{let}$s |
154 To avoid this, we will allow to specify $\mathtt{let}$s |
157 as follows |
155 as follows |
158 |
156 |
159 \begin{center} |
157 \begin{center} |
160 \begin{tabular}{r@ {\hspace{2mm}}r@ {\hspace{2mm}}l} |
158 \begin{tabular}{r@ {\hspace{2mm}}r@ {\hspace{2mm}}l} |
161 $trm$ & $::=$ & \ldots\\ |
159 $trm$ & $::=$ & \ldots\\ |
162 & $\mid$ & $\mathtt{let}\;a\!::\!assn\;\;t\!::\!trm\quad\mathtt{bind}\;bn\,(a) \IN t$\\[1mm] |
160 & $\mid$ & $\mathtt{let}\;a\!::\!assn\;\;s\!::\!trm\quad\mathtt{bind}\;bn\,(a) \IN s$\\[1mm] |
163 $assn$ & $::=$ & $\mathtt{anil}$\\ |
161 $assn$ & $::=$ & $\mathtt{anil}$\\ |
164 & $\mid$ & $\mathtt{acons}\;\;name\;\;trm\;\;assn$ |
162 & $\mid$ & $\mathtt{acons}\;\;name\;\;trm\;\;assn$ |
165 \end{tabular} |
163 \end{tabular} |
166 \end{center} |
164 \end{center} |
167 |
165 |
168 \noindent |
166 \noindent |
169 where $assn$ is an auxiliary type representing a list of assignments |
167 where $assn$ is an auxiliary type representing a list of assignments |
170 and $bn$ an auxilary function identifying the variables to be bound by |
168 and $bn$ an auxiliary function identifying the variables to be bound by |
171 the $\mathtt{let}$. This function can be defined as |
169 the $\mathtt{let}$. This function can be defined as |
172 |
170 |
173 \begin{center} |
171 \begin{center} |
174 $bn\,(\mathtt{anil}) = \varnothing \qquad bn\,(\mathtt{acons}\;x\;t\;as) = \{x\} \cup bn\,(as)$ |
172 $bn\,(\mathtt{anil}) = \varnothing \qquad bn\,(\mathtt{acons}\;x\;t\;as) = \{x\} \cup bn\,(as)$ |
175 \end{center} |
173 \end{center} |
176 |
174 |
177 \noindent |
175 \noindent |
|
176 The scope of the binding is indicated by labels given to the types, for example |
|
177 $s\!::\!trm$, and a binding clause $\mathtt{bind}\;bn\,(a) \IN s$. |
178 This style of specifying terms and bindings is heavily |
178 This style of specifying terms and bindings is heavily |
179 inspired by the syntax of the Ott-tool \cite{ott-jfp}. |
179 inspired by the syntax of the Ott-tool \cite{ott-jfp}. |
180 |
180 |
181 However, we will not be able to deal with all specifications that are allowed by |
181 However, we will not be able to deal with all specifications that are |
182 Ott. One reason is that we establish the reasoning infrastructure for |
182 allowed by Ott. One reason is that we establish the reasoning infrastructure |
183 alpha-\emph{equated} terms. In contrast, Ott produces for a subset of its |
183 for alpha-\emph{equated} terms. In contrast, Ott produces for a subset of |
184 specifiactions a reasoning infrastructure for terms that have names for |
184 its specifications a reasoning infrastructure in Isabelle for |
185 bound variables, but these terms are concrete, \emph{non}-alpha-equated terms. To see |
185 \emph{non}-alpha-equated, or ``raw'', terms. While our alpha-equated terms |
186 the difference, note that working |
186 and the concrete terms produced by Ott use names for the bound variables, |
187 with alpha-equated terms means that the two type-schemes with $x$, $y$ and |
187 there is a key difference: working with alpha-equated terms means that the |
188 $z$ being distinct |
188 two type-schemes with $x$, $y$ and $z$ being distinct |
189 |
189 |
190 \begin{center} |
190 \begin{center} |
191 $\forall \{x\}. x \rightarrow y \;=\; \forall \{x, z\}. x \rightarrow y$ |
191 $\forall \{x\}. x \rightarrow y \;=\; \forall \{x, z\}. x \rightarrow y$ |
192 \end{center} |
192 \end{center} |
193 |
193 |
194 \noindent |
194 \noindent |
195 are not just alpha-equal, but actually equal. Our insistence on reasoning |
195 are not just alpha-equal, but actually equal (note the ``=''-sign). Our insistence |
196 with alpha-equated terms comes from the wealth of experience we gained with |
196 on reasoning with alpha-equated terms comes from the wealth of experience we gained with |
197 the older version of Nominal Isabelle: for non-trivial properties, reasoning |
197 the older version of Nominal Isabelle: for non-trivial properties, reasoning |
198 about alpha-equated terms is much easier than reasoning with concrete |
198 about alpha-equated terms is much easier than reasoning with concrete |
199 terms. The fundamental reason for this is that the HOL-logic underlying |
199 terms. The fundamental reason is that the HOL-logic underlying |
200 Nominal Isabelle allows us to replace ``equals-by-equals''. In contrast, |
200 Nominal Isabelle allows us to replace ``equals-by-equals''. In contrast replacing |
201 replacing ``alpha-equals-by-alpha-equals'' requires a lot of extra work. |
201 ``alpha-equals-by-alpha-equals'' in a term calculus requires a lot of extra reasoning work. |
202 |
202 |
203 |
203 |
204 Although in informal settings a reasoning infrastructure for alpha-equated |
204 Although in informal settings a reasoning infrastructure for alpha-equated |
205 terms that have names is nearly always taken for granted, establishing |
205 terms (that have names for bound variables) is nearly always taken for granted, establishing |
206 it automatically in a theorem prover is a rather non-trivial task. |
206 it automatically in a theorem prover is a rather non-trivial task. |
207 For every specification we will need to construct a type containing as |
207 For every specification we will need to construct a type containing as |
208 elements exactly those sets containing alpha-equal terms. To do so we use |
208 elements the alpha-equated terms. To do so we use |
209 the standard HOL-technique of defining a new type by |
209 the standard HOL-technique of defining a new type by |
210 identifying a non-empty subset of an existing type. In our |
210 identifying a non-empty subset of an existing type. In our |
211 we take as the starting point the type of sets of concrete |
211 case we take as the starting point the type of sets of concrete |
212 terms (the latter being defined as datatypes). Then quotient these |
212 terms (the latter being defined as a datatype). Then identify the |
213 sets according to our alpha-equivalence relation and then identifying |
213 alpha-equivalence classes according to our alpha-equivalence relation and |
214 the new type as these alpha-equivalence classes. The construction we |
214 then identify the new type as these alpha-equivalence classes. The construction we |
215 can perform in HOL is illustrated by the following picture: |
215 can perform in HOL is illustrated by the following picture: |
216 |
216 |
217 |
|
218 |
|
219 Contributions: We provide definitions for when terms |
|
220 involving general bindings are alpha-equivelent. |
|
221 |
|
222 \begin{center} |
217 \begin{center} |
223 figure |
218 figure |
224 %\begin{pspicture}(0.5,0.0)(8,2.5) |
219 %\begin{pspicture}(0.5,0.0)(8,2.5) |
225 %%\showgrid |
220 %%\showgrid |
226 %\psframe[linewidth=0.4mm,framearc=0.2](5,0.0)(7.7,2.5) |
221 %\psframe[linewidth=0.4mm,framearc=0.2](5,0.0)(7.7,2.5) |