author | Christian Urban <urbanc@in.tum.de> |
Mon, 22 Mar 2010 16:22:28 +0100 | |
changeset 1578 | 1dbc4f33549c |
parent 1577 | 8466fe2216da |
child 1579 | 5b0bdd64956e |
permissions | -rw-r--r-- |
754
b85875d65b10
added a paper for possible notes
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1 |
(*<*) |
b85875d65b10
added a paper for possible notes
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
2 |
theory Paper |
1506
7c607df46a0a
slightly more in the paper
Christian Urban <urbanc@in.tum.de>
parents:
1493
diff
changeset
|
3 |
imports "../Nominal/Test" "LaTeXsugar" |
754
b85875d65b10
added a paper for possible notes
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
4 |
begin |
1493
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
5 |
|
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
6 |
notation (latex output) |
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
7 |
swap ("'(_ _')" [1000, 1000] 1000) and |
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
8 |
fresh ("_ # _" [51, 51] 50) and |
1506
7c607df46a0a
slightly more in the paper
Christian Urban <urbanc@in.tum.de>
parents:
1493
diff
changeset
|
9 |
fresh_star ("_ #* _" [51, 51] 50) and |
1493
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
10 |
supp ("supp _" [78] 73) and |
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
11 |
uminus ("-_" [78] 73) and |
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
12 |
If ("if _ then _ else _" 10) |
754
b85875d65b10
added a paper for possible notes
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
13 |
(*>*) |
b85875d65b10
added a paper for possible notes
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
14 |
|
b85875d65b10
added a paper for possible notes
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
15 |
section {* Introduction *} |
b85875d65b10
added a paper for possible notes
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
16 |
|
b85875d65b10
added a paper for possible notes
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
17 |
text {* |
1524 | 18 |
So far, Nominal Isabelle provides a mechanism for constructing |
1535
a37c65fe10de
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1528
diff
changeset
|
19 |
alpha-equated terms such as |
1485
c004e7448dca
temporarily disabled tests in Nominal/ROOT
Christian Urban <urbanc@in.tum.de>
parents:
1484
diff
changeset
|
20 |
|
1520
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
21 |
\begin{center} |
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
22 |
$t ::= x \mid t\;t \mid \lambda x. t$ |
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
23 |
\end{center} |
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
24 |
|
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
25 |
\noindent |
1550 | 26 |
where free and bound variables have names. For such terms Nominal Isabelle |
27 |
derives automatically a reasoning infrastructure, which has been used |
|
28 |
successfully in formalisations of an equivalence checking algorithm for LF |
|
29 |
\cite{UrbanCheneyBerghofer08}, Typed |
|
1520
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
30 |
Scheme~\cite{TobinHochstadtFelleisen08}, several calculi for concurrency |
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
31 |
\cite{BengtsonParrow07,BengtsonParow09} and a strong normalisation result |
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
32 |
for cut-elimination in classical logic \cite{UrbanZhu08}. It has also been |
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
33 |
used by Pollack for formalisations in the locally-nameless approach to |
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
34 |
binding \cite{SatoPollack10}. |
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
35 |
|
1535
a37c65fe10de
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1528
diff
changeset
|
36 |
However, Nominal Isabelle has fared less well in a formalisation of |
1524 | 37 |
the algorithm W \cite{UrbanNipkow09}, where types and type-schemes |
38 |
are of the form |
|
1570 | 39 |
% |
40 |
\begin{equation}\label{tysch} |
|
41 |
\begin{array}{l} |
|
42 |
T ::= x \mid T \rightarrow T \hspace{5mm} S ::= \forall \{x_1,\ldots, x_n\}. T |
|
43 |
\end{array} |
|
44 |
\end{equation} |
|
1520
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
45 |
|
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
46 |
\noindent |
1566 | 47 |
and the quantification $\forall$ binds a finite (possibly empty) set of |
1550 | 48 |
type-variables. While it is possible to implement this kind of more general |
49 |
binders by iterating single binders, this leads to a rather clumsy |
|
50 |
formalisation of W. The need of iterating single binders is also one reason |
|
51 |
why Nominal Isabelle and similar theorem provers that only provide |
|
52 |
mechanisms for binding single variables have not fared extremely well with the |
|
53 |
more advanced tasks in the POPLmark challenge \cite{challenge05}, because |
|
54 |
also there one would like to bind multiple variables at once. |
|
1520
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
55 |
|
1577 | 56 |
Binding multiple variables has interesting properties that cannot be captured |
57 |
easily by iterating single binders. For example in the case of type-schemes we do not |
|
1550 | 58 |
like to make a distinction about the order of the bound variables. Therefore |
59 |
we would like to regard the following two type-schemes as alpha-equivalent |
|
1572 | 60 |
% |
61 |
\begin{equation}\label{ex1} |
|
62 |
\forall \{x, y\}. x \rightarrow y \;\approx_\alpha\; \forall \{y, x\}. y \rightarrow x |
|
63 |
\end{equation} |
|
1520
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
64 |
|
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
65 |
\noindent |
1524 | 66 |
but the following two should \emph{not} be alpha-equivalent |
1572 | 67 |
% |
68 |
\begin{equation}\label{ex2} |
|
69 |
\forall \{x, y\}. x \rightarrow y \;\not\approx_\alpha\; \forall \{z\}. z \rightarrow z |
|
70 |
\end{equation} |
|
1520
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
71 |
|
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
72 |
\noindent |
1524 | 73 |
assuming that $x$, $y$ and $z$ are distinct. Moreover, we like to regard type-schemes as |
74 |
alpha-equivalent, if they differ only on \emph{vacuous} binders, such as |
|
1572 | 75 |
% |
76 |
\begin{equation}\label{ex3} |
|
77 |
\forall \{x\}. x \rightarrow y \;\approx_\alpha\; \forall \{x, z\}. x \rightarrow y |
|
78 |
\end{equation} |
|
1485
c004e7448dca
temporarily disabled tests in Nominal/ROOT
Christian Urban <urbanc@in.tum.de>
parents:
1484
diff
changeset
|
79 |
|
1520
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
80 |
\noindent |
1535
a37c65fe10de
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1528
diff
changeset
|
81 |
where $z$ does not occur freely in the type. |
1545 | 82 |
In this paper we will give a general binding mechanism and associated |
1524 | 83 |
notion of alpha-equivalence that can be used to faithfully represent |
1545 | 84 |
this kind of binding in Nominal Isabelle. The difficulty of finding the right notion |
1524 | 85 |
for alpha-equivalence in this case can be appreciated by considering that the |
86 |
definition given by Leroy in \cite{Leroy92} is incorrect (it omits a side-condition). |
|
87 |
||
1520
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
88 |
However, the notion of alpha-equivalence that is preserved by vacuous binders is not |
1566 | 89 |
always wanted. For example in terms like |
1520
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
90 |
|
1535
a37c65fe10de
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1528
diff
changeset
|
91 |
\begin{equation}\label{one} |
1550 | 92 |
\LET x = 3 \AND y = 2 \IN x\,-\,y \END |
1535
a37c65fe10de
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1528
diff
changeset
|
93 |
\end{equation} |
1520
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
94 |
|
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
95 |
\noindent |
1524 | 96 |
we might not care in which order the assignments $x = 3$ and $y = 2$ are |
1535
a37c65fe10de
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1528
diff
changeset
|
97 |
given, but it would be unusual to regard \eqref{one} as alpha-equivalent |
1524 | 98 |
with |
1520
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
99 |
|
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
100 |
\begin{center} |
1550 | 101 |
$\LET x = 3 \AND y = 2 \AND z = loop \IN x\,-\,y \END$ |
1520
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
102 |
\end{center} |
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
103 |
|
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
104 |
\noindent |
1550 | 105 |
Therefore we will also provide a separate binding mechanism for cases in |
106 |
which the order of binders does not matter, but the ``cardinality'' of the |
|
1535
a37c65fe10de
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1528
diff
changeset
|
107 |
binders has to agree. |
1520
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
108 |
|
1550 | 109 |
However, we found that this is still not sufficient for dealing with |
110 |
language constructs frequently occurring in programming language |
|
111 |
research. For example in $\mathtt{let}$s containing patterns |
|
1485
c004e7448dca
temporarily disabled tests in Nominal/ROOT
Christian Urban <urbanc@in.tum.de>
parents:
1484
diff
changeset
|
112 |
|
1535
a37c65fe10de
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1528
diff
changeset
|
113 |
\begin{equation}\label{two} |
1550 | 114 |
\LET (x, y) = (3, 2) \IN x\,-\,y \END |
1535
a37c65fe10de
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1528
diff
changeset
|
115 |
\end{equation} |
1520
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
116 |
|
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
117 |
\noindent |
1535
a37c65fe10de
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1528
diff
changeset
|
118 |
we want to bind all variables from the pattern inside the body of the |
a37c65fe10de
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1528
diff
changeset
|
119 |
$\mathtt{let}$, but we also care about the order of these variables, since |
1566 | 120 |
we do not want to regard \eqref{two} as alpha-equivalent with |
1520
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
121 |
|
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
122 |
\begin{center} |
1550 | 123 |
$\LET (y, x) = (3, 2) \IN x\,- y\,\END$ |
1520
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
124 |
\end{center} |
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
125 |
|
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
126 |
\noindent |
1545 | 127 |
As a result, we provide three general binding mechanisms each of which binds multiple |
1566 | 128 |
variables at once, and let the user chose which one is intended when formalising a |
1524 | 129 |
programming language calculus. |
1485
c004e7448dca
temporarily disabled tests in Nominal/ROOT
Christian Urban <urbanc@in.tum.de>
parents:
1484
diff
changeset
|
130 |
|
1545 | 131 |
By providing these general binding mechanisms, however, we have to work around |
1524 | 132 |
a problem that has been pointed out by Pottier in \cite{Pottier06}: in |
133 |
$\mathtt{let}$-constructs of the form |
|
1520
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
134 |
|
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
135 |
\begin{center} |
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
136 |
$\LET x_1 = t_1 \AND \ldots \AND x_n = t_n \IN s \END$ |
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
137 |
\end{center} |
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
138 |
|
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
139 |
\noindent |
1524 | 140 |
which bind all the $x_i$ in $s$, we might not care about the order in |
1520
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
141 |
which the $x_i = t_i$ are given, but we do care about the information that there are |
1524 | 142 |
as many $x_i$ as there are $t_i$. We lose this information if we represent the |
1550 | 143 |
$\mathtt{let}$-constructor by something like |
1523
eb95360d6ac6
another little bit for the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1520
diff
changeset
|
144 |
|
eb95360d6ac6
another little bit for the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1520
diff
changeset
|
145 |
\begin{center} |
1524 | 146 |
$\LET [x_1,\ldots,x_n].s\;\; [t_1,\ldots,t_n]$ |
1523
eb95360d6ac6
another little bit for the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1520
diff
changeset
|
147 |
\end{center} |
1520
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
148 |
|
1523
eb95360d6ac6
another little bit for the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1520
diff
changeset
|
149 |
\noindent |
1566 | 150 |
where the notation $[\_\!\_].\_\!\_$ indicates that the $x_i$ become bound |
151 |
in $s$. In this representation the term \mbox{$\LET [x].s\;\;[t_1,t_2]$} |
|
152 |
would be a perfectly legal instance. To exclude such terms an additional |
|
153 |
predicate about well-formed terms is needed in order to ensure that the two |
|
154 |
lists are of equal length. This can result into very messy reasoning (see |
|
1577 | 155 |
for example~\cite{BengtsonParow09}). To avoid this, we will allow type specifications |
1566 | 156 |
for $\mathtt{let}$s as follows |
1528
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
157 |
|
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
158 |
\begin{center} |
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
159 |
\begin{tabular}{r@ {\hspace{2mm}}r@ {\hspace{2mm}}l} |
1570 | 160 |
$trm$ & $::=$ & \ldots\\ |
1545 | 161 |
& $\mid$ & $\mathtt{let}\;a\!::\!assn\;\;s\!::\!trm\quad\mathtt{bind}\;bn\,(a) \IN s$\\[1mm] |
1570 | 162 |
$assn$ & $::=$ & $\mathtt{anil}$\\ |
1528
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
163 |
& $\mid$ & $\mathtt{acons}\;\;name\;\;trm\;\;assn$ |
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
164 |
\end{tabular} |
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
165 |
\end{center} |
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
166 |
|
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
167 |
\noindent |
1577 | 168 |
where $assn$ is an auxiliary type representing a list of assignments |
1545 | 169 |
and $bn$ an auxiliary function identifying the variables to be bound by |
1566 | 170 |
the $\mathtt{let}$. This function is defined by recursion over $assn$ as follows |
1528
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
171 |
|
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
172 |
\begin{center} |
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
173 |
$bn\,(\mathtt{anil}) = \varnothing \qquad bn\,(\mathtt{acons}\;x\;t\;as) = \{x\} \cup bn\,(as)$ |
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
174 |
\end{center} |
1523
eb95360d6ac6
another little bit for the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1520
diff
changeset
|
175 |
|
1528
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
176 |
\noindent |
1550 | 177 |
The scope of the binding is indicated by labels given to the types, for |
178 |
example \mbox{$s\!::\!trm$}, and a binding clause, in this case |
|
1577 | 179 |
$\mathtt{bind}\;bn\,(a) \IN s$, that states to bind in $s$ all the names the |
180 |
function $bn\,(a)$ returns. This style of specifying terms and bindings is |
|
181 |
heavily inspired by the syntax of the Ott-tool \cite{ott-jfp}. |
|
1528
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
182 |
|
1545 | 183 |
However, we will not be able to deal with all specifications that are |
1570 | 184 |
allowed by Ott. One reason is that Ott allows ``empty'' specifications |
185 |
like |
|
186 |
||
187 |
\begin{center} |
|
188 |
$t ::= t\;t \mid \lambda x. t$ |
|
189 |
\end{center} |
|
190 |
||
191 |
\noindent |
|
1577 | 192 |
where no clause for variables is given. Such specifications make some sense in |
193 |
the context of Coq's type theory (which Ott supports), but not at al in a HOL-based |
|
1570 | 194 |
theorem prover where every datatype must have a non-empty set-theoretic model. |
195 |
||
196 |
Another reason is that we establish the reasoning infrastructure |
|
197 |
for alpha-\emph{equated} terms. In contrast, Ott produces a reasoning |
|
198 |
infrastructure in Isabelle/HOL for |
|
1545 | 199 |
\emph{non}-alpha-equated, or ``raw'', terms. While our alpha-equated terms |
1556 | 200 |
and the raw terms produced by Ott use names for bound variables, |
1545 | 201 |
there is a key difference: working with alpha-equated terms means that the |
202 |
two type-schemes with $x$, $y$ and $z$ being distinct |
|
1528
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
203 |
|
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
204 |
\begin{center} |
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
205 |
$\forall \{x\}. x \rightarrow y \;=\; \forall \{x, z\}. x \rightarrow y$ |
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
206 |
\end{center} |
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
207 |
|
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
208 |
\noindent |
1550 | 209 |
are not just alpha-equal, but actually equal. As a |
210 |
result, we can only support specifications that make sense on the level of |
|
211 |
alpha-equated terms (offending specifications, which for example bind a variable |
|
1556 | 212 |
according to a variable bound somewhere else, are not excluded by Ott, but we |
213 |
have to). Our |
|
1550 | 214 |
insistence on reasoning with alpha-equated terms comes from the wealth of |
215 |
experience we gained with the older version of Nominal Isabelle: for |
|
216 |
non-trivial properties, reasoning about alpha-equated terms is much easier |
|
1556 | 217 |
than reasoning with raw terms. The fundamental reason for this is that the |
1550 | 218 |
HOL-logic underlying Nominal Isabelle allows us to replace |
219 |
``equals-by-equals''. In contrast replacing ``alpha-equals-by-alpha-equals'' |
|
220 |
in a representation based on raw terms requires a lot of extra reasoning work. |
|
1535
a37c65fe10de
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1528
diff
changeset
|
221 |
|
a37c65fe10de
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1528
diff
changeset
|
222 |
Although in informal settings a reasoning infrastructure for alpha-equated |
1545 | 223 |
terms (that have names for bound variables) is nearly always taken for granted, establishing |
1550 | 224 |
it automatically in the Isabelle/HOL theorem prover is a rather non-trivial task. |
1535
a37c65fe10de
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1528
diff
changeset
|
225 |
For every specification we will need to construct a type containing as |
1556 | 226 |
elements the alpha-equated terms. To do so, we use |
1535
a37c65fe10de
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1528
diff
changeset
|
227 |
the standard HOL-technique of defining a new type by |
1556 | 228 |
identifying a non-empty subset of an existing type. The construction we |
229 |
perform in HOL is illustrated by the following picture: |
|
1545 | 230 |
|
1528
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
231 |
\begin{center} |
1552 | 232 |
\begin{tikzpicture} |
233 |
%\draw[step=2mm] (-4,-1) grid (4,1); |
|
234 |
||
235 |
\draw[very thick] (0.7,0.4) circle (4.25mm); |
|
236 |
\draw[rounded corners=1mm, very thick] ( 0.0,-0.8) rectangle ( 1.8, 0.9); |
|
237 |
\draw[rounded corners=1mm, very thick] (-1.95,0.85) rectangle (-2.85,-0.05); |
|
238 |
||
239 |
\draw (-2.0, 0.845) -- (0.7,0.845); |
|
240 |
\draw (-2.0,-0.045) -- (0.7,-0.045); |
|
241 |
||
242 |
\draw ( 0.7, 0.4) node {\begin{tabular}{@ {}c@ {}}$\alpha$-\\[-1mm]clas.\end{tabular}}; |
|
243 |
\draw (-2.4, 0.4) node {\begin{tabular}{@ {}c@ {}}$\alpha$-eq.\\[-1mm]terms\end{tabular}}; |
|
244 |
\draw (1.8, 0.48) node[right=-0.1mm] |
|
245 |
{\begin{tabular}{@ {}l@ {}}existing\\[-1mm] type\\ (sets of raw terms)\end{tabular}}; |
|
246 |
\draw (0.9, -0.35) node {\begin{tabular}{@ {}l@ {}}non-empty\\[-1mm]subset\end{tabular}}; |
|
247 |
\draw (-3.25, 0.55) node {\begin{tabular}{@ {}l@ {}}new\\[-1mm]type\end{tabular}}; |
|
248 |
||
249 |
\draw[<->, very thick] (-1.8, 0.3) -- (-0.1,0.3); |
|
250 |
\draw (-0.95, 0.3) node[above=0mm] {isomorphism}; |
|
251 |
||
252 |
\end{tikzpicture} |
|
1528
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
253 |
\end{center} |
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
254 |
|
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
255 |
\noindent |
1577 | 256 |
We take as the starting point a definition of raw terms (defined as a |
1556 | 257 |
datatype in Isabelle/HOL); identify then the |
258 |
alpha-equivalence classes in the type of sets of raw terms, according to our |
|
259 |
alpha-equivalence relation and finally define the new type as these |
|
260 |
alpha-equivalence classes (non-emptiness is satisfied whenever the raw terms are |
|
261 |
definable as datatype in Isabelle/HOL and the fact that our relation for alpha is an |
|
1570 | 262 |
equivalence relation). |
1556 | 263 |
|
264 |
The fact that we obtain an isomorphism between between the new type and the non-empty |
|
265 |
subset shows that the new type is a faithful representation of alpha-equated terms. |
|
1577 | 266 |
That is not the case for example in the representation of terms using the locally |
267 |
nameless representation of binders \cite{McKinnaPollack99}: there are ``junk'' terms that need to |
|
1556 | 268 |
be excluded by reasoning about a well-formedness predicate. |
269 |
||
1577 | 270 |
The problem with introducing a new type in Isabelle/HOL is that in order to be useful, |
1572 | 271 |
a reasoning infrastructure needs to be ``lifted'' from the underlying subset to |
1570 | 272 |
the new type. This is usually a tricky and arduous task. To ease it |
1577 | 273 |
we re-implemented in Isabelle/HOL the quotient package described by Homeier |
274 |
\cite{Homeier05}. This package |
|
275 |
allows us to lift definitions and theorems involving raw terms |
|
276 |
to definitions and theorems involving alpha-equated terms. For example |
|
277 |
if we define the free-variable function over lambda terms |
|
278 |
||
279 |
\begin{center} |
|
280 |
$\fv(x) = \{x\}$\hspace{10mm} |
|
281 |
$\fv(t_1\;t_2) = \fv(t_1) \cup \fv(t_2)$\\[1mm] |
|
282 |
$\fv(\lambda x.t) = \fv(t) - \{x\}$ |
|
283 |
\end{center} |
|
284 |
||
285 |
\noindent |
|
286 |
then with not too great effort we obtain a function $\fv_\alpha$ |
|
287 |
operating on quotients, or alpha-equivalence classes of terms, as follows |
|
288 |
||
289 |
\begin{center} |
|
290 |
$\fv_\alpha(x) = \{x\}$\hspace{10mm} |
|
291 |
$\fv_\alpha(t_1\;t_2) = \fv_\alpha(t_1) \cup \fv_\alpha(t_2)$\\[1mm] |
|
292 |
$\fv_\alpha(\lambda x.t) = \fv_\alpha(t) - \{x\}$ |
|
293 |
\end{center} |
|
294 |
||
295 |
\noindent |
|
296 |
(Note that this means also the term-constructors for variables, applications |
|
297 |
and lambda are lifted to the quotient level.) This construction, of course, |
|
298 |
only works if alpha is an equivalence relation, and the definitions and theorems |
|
299 |
are respectful w.r.t.~alpha-equivalence. Hence we will not be able to lift this |
|
300 |
a bound-variable function to alpha-equated terms (since it does not respect |
|
301 |
alpha-equivalence). To sum up, every lifting needs proofs of some respectfulness |
|
302 |
properties. These proofs we are able automate and therefore establish a |
|
303 |
useful reasoning infrastructure for alpha-equated lambda terms.\medskip |
|
304 |
||
1506
7c607df46a0a
slightly more in the paper
Christian Urban <urbanc@in.tum.de>
parents:
1493
diff
changeset
|
305 |
|
1528
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
306 |
\noindent |
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
307 |
{\bf Contributions:} We provide new definitions for when terms |
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
308 |
involving multiple binders are alpha-equivalent. These definitions are |
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
309 |
inspired by earlier work of Pitts \cite{}. By means of automatic |
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
310 |
proofs, we establish a reasoning infrastructure for alpha-equated |
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
311 |
terms, including properties about support, freshness and equality |
1552 | 312 |
conditions for alpha-equated terms. We re also able to derive, at the moment |
313 |
only manually, for these terms a strong induction principle that |
|
314 |
has the variable convention already built in. |
|
1485
c004e7448dca
temporarily disabled tests in Nominal/ROOT
Christian Urban <urbanc@in.tum.de>
parents:
1484
diff
changeset
|
315 |
*} |
c004e7448dca
temporarily disabled tests in Nominal/ROOT
Christian Urban <urbanc@in.tum.de>
parents:
1484
diff
changeset
|
316 |
|
1493
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
317 |
section {* A Short Review of the Nominal Logic Work *} |
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
318 |
|
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
319 |
text {* |
1556 | 320 |
At its core, Nominal Isabelle is an adaption of the nominal logic work by |
321 |
Pitts \cite{Pitts03}. This adaptation for Isabelle/HOL is described in |
|
1517
62d6f7acc110
corrected the strong induction principle in the lambda-calculus case; gave a second (oartial) version that is more elegant
Christian Urban <urbanc@in.tum.de>
parents:
1506
diff
changeset
|
322 |
\cite{HuffmanUrban10}, which we review here briefly to aid the description |
1556 | 323 |
of what follows. Two central notions in the nominal logic work are sorted |
1570 | 324 |
atoms and sort-respecting permutations of atoms. The sorts can be used to |
325 |
represent different kinds of variables, such as term- and type-variables in |
|
326 |
Core-Haskell, and it is assumed that there is an infinite supply of atoms |
|
327 |
for each sort. However, in order to simplify the description, we shall |
|
328 |
assume in what follows that there is only a single sort of atoms. |
|
1556 | 329 |
|
1493
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
330 |
|
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
331 |
Permutations are bijective functions from atoms to atoms that are |
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
332 |
the identity everywhere except on a finite number of atoms. There is a |
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
333 |
two-place permutation operation written |
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
334 |
|
1506
7c607df46a0a
slightly more in the paper
Christian Urban <urbanc@in.tum.de>
parents:
1493
diff
changeset
|
335 |
@{text[display,indent=5] "_ \<bullet> _ :: (\<alpha> \<times> \<alpha>) list \<Rightarrow> \<beta> \<Rightarrow> \<beta>"} |
1493
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
336 |
|
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
337 |
\noindent |
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
338 |
with a generic type in which @{text "\<alpha>"} stands for the type of atoms |
1570 | 339 |
and @{text "\<beta>"} for the type of the object on which the permutation |
1493
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
340 |
acts. In Nominal Isabelle the identity permutation is written as @{term "0::perm"}, |
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
341 |
the composition of two permutations @{term p} and @{term q} as \mbox{@{term "p + q"}} |
1570 | 342 |
and the inverse permutation of @{term p} as @{text "- p"}. The permutation |
1493
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
343 |
operation is defined for products, lists, sets, functions, booleans etc |
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
344 |
(see \cite{HuffmanUrban10}). |
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
345 |
|
1570 | 346 |
The most original aspect of the nominal logic work of Pitts is a general |
347 |
definition for the notion of ``the set of free variables of an object @{text |
|
348 |
"x"}''. This notion, written @{term "supp x"}, is general in the sense that |
|
349 |
it applies not only to lambda-terms alpha-equated or not, but also to lists, |
|
350 |
products, sets and even functions. The definition depends only on the |
|
351 |
permutation operation and on the notion of equality defined for the type of |
|
352 |
@{text x}, namely: |
|
1493
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
353 |
|
1506
7c607df46a0a
slightly more in the paper
Christian Urban <urbanc@in.tum.de>
parents:
1493
diff
changeset
|
354 |
@{thm[display,indent=5] supp_def[no_vars, THEN eq_reflection]} |
1493
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
355 |
|
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
356 |
\noindent |
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
357 |
There is also the derived notion for when an atom @{text a} is \emph{fresh} |
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
358 |
for an @{text x}, defined as |
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
359 |
|
1506
7c607df46a0a
slightly more in the paper
Christian Urban <urbanc@in.tum.de>
parents:
1493
diff
changeset
|
360 |
@{thm[display,indent=5] fresh_def[no_vars]} |
1493
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
361 |
|
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
362 |
\noindent |
1517
62d6f7acc110
corrected the strong induction principle in the lambda-calculus case; gave a second (oartial) version that is more elegant
Christian Urban <urbanc@in.tum.de>
parents:
1506
diff
changeset
|
363 |
We also use for sets of atoms the abbreviation |
62d6f7acc110
corrected the strong induction principle in the lambda-calculus case; gave a second (oartial) version that is more elegant
Christian Urban <urbanc@in.tum.de>
parents:
1506
diff
changeset
|
364 |
@{thm (lhs) fresh_star_def[no_vars]} defined as |
62d6f7acc110
corrected the strong induction principle in the lambda-calculus case; gave a second (oartial) version that is more elegant
Christian Urban <urbanc@in.tum.de>
parents:
1506
diff
changeset
|
365 |
@{thm (rhs) fresh_star_def[no_vars]}. |
1493
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
366 |
A striking consequence of these definitions is that we can prove |
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
367 |
without knowing anything about the structure of @{term x} that |
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
368 |
swapping two fresh atoms, say @{text a} and @{text b}, leave |
1506
7c607df46a0a
slightly more in the paper
Christian Urban <urbanc@in.tum.de>
parents:
1493
diff
changeset
|
369 |
@{text x} unchanged. |
7c607df46a0a
slightly more in the paper
Christian Urban <urbanc@in.tum.de>
parents:
1493
diff
changeset
|
370 |
|
1517
62d6f7acc110
corrected the strong induction principle in the lambda-calculus case; gave a second (oartial) version that is more elegant
Christian Urban <urbanc@in.tum.de>
parents:
1506
diff
changeset
|
371 |
\begin{property} |
1506
7c607df46a0a
slightly more in the paper
Christian Urban <urbanc@in.tum.de>
parents:
1493
diff
changeset
|
372 |
@{thm[mode=IfThen] swap_fresh_fresh[no_vars]} |
1517
62d6f7acc110
corrected the strong induction principle in the lambda-calculus case; gave a second (oartial) version that is more elegant
Christian Urban <urbanc@in.tum.de>
parents:
1506
diff
changeset
|
373 |
\end{property} |
1506
7c607df46a0a
slightly more in the paper
Christian Urban <urbanc@in.tum.de>
parents:
1493
diff
changeset
|
374 |
|
1517
62d6f7acc110
corrected the strong induction principle in the lambda-calculus case; gave a second (oartial) version that is more elegant
Christian Urban <urbanc@in.tum.de>
parents:
1506
diff
changeset
|
375 |
\noindent |
62d6f7acc110
corrected the strong induction principle in the lambda-calculus case; gave a second (oartial) version that is more elegant
Christian Urban <urbanc@in.tum.de>
parents:
1506
diff
changeset
|
376 |
For a proof see \cite{HuffmanUrban10}. |
62d6f7acc110
corrected the strong induction principle in the lambda-calculus case; gave a second (oartial) version that is more elegant
Christian Urban <urbanc@in.tum.de>
parents:
1506
diff
changeset
|
377 |
|
62d6f7acc110
corrected the strong induction principle in the lambda-calculus case; gave a second (oartial) version that is more elegant
Christian Urban <urbanc@in.tum.de>
parents:
1506
diff
changeset
|
378 |
\begin{property} |
1506
7c607df46a0a
slightly more in the paper
Christian Urban <urbanc@in.tum.de>
parents:
1493
diff
changeset
|
379 |
@{thm[mode=IfThen] at_set_avoiding[no_vars]} |
1517
62d6f7acc110
corrected the strong induction principle in the lambda-calculus case; gave a second (oartial) version that is more elegant
Christian Urban <urbanc@in.tum.de>
parents:
1506
diff
changeset
|
380 |
\end{property} |
1493
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
381 |
|
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
382 |
*} |
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
383 |
|
1485
c004e7448dca
temporarily disabled tests in Nominal/ROOT
Christian Urban <urbanc@in.tum.de>
parents:
1484
diff
changeset
|
384 |
|
1556 | 385 |
section {* General Binders *} |
1485
c004e7448dca
temporarily disabled tests in Nominal/ROOT
Christian Urban <urbanc@in.tum.de>
parents:
1484
diff
changeset
|
386 |
|
1517
62d6f7acc110
corrected the strong induction principle in the lambda-calculus case; gave a second (oartial) version that is more elegant
Christian Urban <urbanc@in.tum.de>
parents:
1506
diff
changeset
|
387 |
text {* |
1572 | 388 |
In order to keep our work manageable we give need to give definitions |
389 |
and perform proofs inside Isabelle wherever possible, as opposed to write |
|
1570 | 390 |
custom ML-code that generates them for each |
391 |
instance of a term-calculus. To this end we will first consider pairs |
|
1556 | 392 |
|
393 |
\begin{equation}\label{three} |
|
1570 | 394 |
\mbox{@{text "(as, x) :: (atom set) \<times> \<beta>"}} |
1556 | 395 |
\end{equation} |
396 |
||
397 |
\noindent |
|
1570 | 398 |
consisting of a set of atoms and an object of generic type. These pairs |
399 |
are intended to represent the abstraction or binding of the set $as$ |
|
400 |
in the body $x$ (similarly to type-schemes given in \eqref{tysch}). |
|
401 |
||
402 |
The first question we have to answer is when we should consider pairs such as |
|
1572 | 403 |
$(as, x)$ and $(bs, y)$ as alpha-equivalent? (At the moment we are interested in |
1570 | 404 |
the notion of alpha-equivalence that is \emph{not} preserved by adding |
1572 | 405 |
vacuous binders.) To answer this we identify four conditions: {\it i)} given |
406 |
a free-variable function of type \mbox{@{text "fv :: \<beta> \<Rightarrow> atom set"}}, then $x$ and $y$ |
|
407 |
need to have the same set of free variables; moreover there must be a permutation, |
|
408 |
$p$ that {\it ii)} leaves the free variables $x$ and $y$ unchanged, |
|
409 |
but {\it iii)} ``moves'' their bound names so that we obtain modulo a relation, |
|
410 |
say \mbox{@{text "_ R _"}}, two equal terms. We also require {\it iv)} that $p$ makes |
|
411 |
the abstracted sets $as$ and $bs$ equal (since at the moment we do not want |
|
412 |
that the sets $as$ and $bs$ differ on vacuous binders). These requirements can |
|
413 |
be stated formally as follows |
|
1556 | 414 |
% |
1572 | 415 |
\begin{equation}\label{alphaset} |
416 |
\begin{array}{@ {\hspace{10mm}}r@ {\hspace{2mm}}l} |
|
417 |
\multicolumn{2}{l}{(as, x) \approx_{set}^{\fv, R, p} (bs, y) \;\dn\hspace{30mm}\;}\\[1mm] |
|
418 |
& @{text "fv(x) - as = fv(y) - bs"}\\ |
|
419 |
\wedge & @{text "fv(x) - as #* p"}\\ |
|
420 |
\wedge & @{text "(p \<bullet> x) R y"}\\ |
|
421 |
\wedge & @{text "(p \<bullet> as) = bs"}\\ |
|
422 |
\end{array} |
|
1556 | 423 |
\end{equation} |
424 |
||
425 |
\noindent |
|
1572 | 426 |
Alpha equivalence between such pairs is then the relation with the additional |
427 |
existential quantification over $p$. Note that this relation is additionally |
|
428 |
dependent on the free-variable function $\fv$ and the relation $R$. The reason |
|
429 |
for this generality is that we want to use $\approx_{set}$ for both ``raw'' terms |
|
430 |
and alpha-equated terms. In the latter case, $R$ can be replaced by equality $(op =)$ and |
|
431 |
we are going to prove that $\fv$ will be equal to the support of $x$ and $y$. |
|
432 |
||
433 |
The definition in \eqref{alphaset} does not make any distinction between the |
|
434 |
order of abstracted variables. If we do want this then we can define alpha-equivalence |
|
435 |
for pairs of the form \mbox{@{text "(as, x) :: (atom list) \<times> \<beta>"}} by |
|
436 |
% |
|
437 |
\begin{equation}\label{alphalist} |
|
438 |
\begin{array}{@ {\hspace{10mm}}r@ {\hspace{2mm}}l} |
|
439 |
\multicolumn{2}{l}{(as, x) \approx_{list}^{\fv, R, p} (bs, y) \;\dn\hspace{30mm}\;}\\[1mm] |
|
440 |
& @{text "fv(x) - (set as) = fv(y) - (set bs)"}\\ |
|
441 |
\wedge & @{text "fv(x) - (set as) #* p"}\\ |
|
442 |
\wedge & @{text "(p \<bullet> x) R y"}\\ |
|
443 |
\wedge & @{text "(p \<bullet> as) = bs"}\\ |
|
444 |
\end{array} |
|
445 |
\end{equation} |
|
446 |
||
447 |
\noindent |
|
448 |
where $set$ is just the function that coerces a list of atoms into a set of atoms. |
|
1556 | 449 |
|
1572 | 450 |
If we do not want to make any difference between the order of binders and |
451 |
allow vacuous binders, then we just need to drop the fourth condition in \eqref{alphaset} |
|
452 |
and define |
|
453 |
% |
|
454 |
\begin{equation}\label{alphaset} |
|
455 |
\begin{array}{@ {\hspace{10mm}}r@ {\hspace{2mm}}l} |
|
456 |
\multicolumn{2}{l}{(as, x) \approx_{res}^{\fv, R, p} (bs, y) \;\dn\hspace{30mm}\;}\\[1mm] |
|
457 |
& @{text "fv(x) - as = fv(y) - bs"}\\ |
|
458 |
\wedge & @{text "fv(x) - as #* p"}\\ |
|
459 |
\wedge & @{text "(p \<bullet> x) R y"}\\ |
|
460 |
\end{array} |
|
461 |
\end{equation} |
|
1556 | 462 |
|
1572 | 463 |
To get a feeling how these definitions pan out in practise consider the case of |
464 |
abstracting names over types (like in type-schemes). For this we set $R$ to be |
|
465 |
the equality and for $\fv(T)$ we define |
|
466 |
||
467 |
\begin{center} |
|
468 |
$\fv(x) = \{x\} \qquad \fv(T_1 \rightarrow T_2) = \fv(T_1) \cup \fv(T_2)$ |
|
469 |
\end{center} |
|
470 |
||
471 |
\noindent |
|
472 |
Now reacall the examples in \eqref{ex1}, \eqref{ex2} and \eqref{ex3}: it can be easily |
|
473 |
checked that @{text "({x,y}, x \<rightarrow> y)"} and |
|
474 |
@{text "({y,x}, y \<rightarrow> x)"} are equal according to $\approx_{set}$ and $\approx_{ref}$ by taking $p$ to |
|
475 |
be the swapping @{text "(x \<rightleftharpoons> y)"}; but assuming @{text "x \<noteq> y"} then for instance |
|
476 |
$([x,y], x \rightarrow y) \not\approx_{list} ([y,x], x \rightarrow y)$ since there is no permutation that |
|
477 |
makes the lists @{text "[x,y]"} and @{text "[y,x]"} equal, but leaves the type \mbox{@{text "x \<rightarrow> y"}} |
|
478 |
unchanged. |
|
1517
62d6f7acc110
corrected the strong induction principle in the lambda-calculus case; gave a second (oartial) version that is more elegant
Christian Urban <urbanc@in.tum.de>
parents:
1506
diff
changeset
|
479 |
*} |
62d6f7acc110
corrected the strong induction principle in the lambda-calculus case; gave a second (oartial) version that is more elegant
Christian Urban <urbanc@in.tum.de>
parents:
1506
diff
changeset
|
480 |
|
1491
f970ca9b5bec
paper uses now a heap file - does not compile so long anymore
Christian Urban <urbanc@in.tum.de>
parents:
1485
diff
changeset
|
481 |
section {* Alpha-Equivalence and Free Variables *} |
f970ca9b5bec
paper uses now a heap file - does not compile so long anymore
Christian Urban <urbanc@in.tum.de>
parents:
1485
diff
changeset
|
482 |
|
1520
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
483 |
text {* |
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
484 |
Restrictions |
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
485 |
|
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
486 |
\begin{itemize} |
1572 | 487 |
\item non-emptiness |
1520
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
488 |
\item positive datatype definitions |
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
489 |
\item finitely supported abstractions |
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
490 |
\item respectfulness of the bn-functions\bigskip |
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
491 |
\item binders can only have a ``single scope'' |
1577 | 492 |
\item all bindings must have the same mode |
1520
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
493 |
\end{itemize} |
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
494 |
*} |
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
495 |
|
1493
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
496 |
section {* Examples *} |
1485
c004e7448dca
temporarily disabled tests in Nominal/ROOT
Christian Urban <urbanc@in.tum.de>
parents:
1484
diff
changeset
|
497 |
|
1517
62d6f7acc110
corrected the strong induction principle in the lambda-calculus case; gave a second (oartial) version that is more elegant
Christian Urban <urbanc@in.tum.de>
parents:
1506
diff
changeset
|
498 |
section {* Adequacy *} |
62d6f7acc110
corrected the strong induction principle in the lambda-calculus case; gave a second (oartial) version that is more elegant
Christian Urban <urbanc@in.tum.de>
parents:
1506
diff
changeset
|
499 |
|
62d6f7acc110
corrected the strong induction principle in the lambda-calculus case; gave a second (oartial) version that is more elegant
Christian Urban <urbanc@in.tum.de>
parents:
1506
diff
changeset
|
500 |
section {* Related Work *} |
62d6f7acc110
corrected the strong induction principle in the lambda-calculus case; gave a second (oartial) version that is more elegant
Christian Urban <urbanc@in.tum.de>
parents:
1506
diff
changeset
|
501 |
|
1570 | 502 |
text {* |
503 |
Ott is better with list dot specifications; subgrammars |
|
504 |
||
505 |
untyped; |
|
506 |
||
507 |
*} |
|
508 |
||
509 |
||
1493
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
510 |
section {* Conclusion *} |
1485
c004e7448dca
temporarily disabled tests in Nominal/ROOT
Christian Urban <urbanc@in.tum.de>
parents:
1484
diff
changeset
|
511 |
|
c004e7448dca
temporarily disabled tests in Nominal/ROOT
Christian Urban <urbanc@in.tum.de>
parents:
1484
diff
changeset
|
512 |
text {* |
1520
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
513 |
Complication when the single scopedness restriction is lifted (two |
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
514 |
overlapping permutations) |
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
515 |
*} |
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
516 |
|
6ac75fd979d4
more of the introduction
Christian Urban <urbanc@in.tum.de>
parents:
1517
diff
changeset
|
517 |
text {* |
1493
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
518 |
|
1517
62d6f7acc110
corrected the strong induction principle in the lambda-calculus case; gave a second (oartial) version that is more elegant
Christian Urban <urbanc@in.tum.de>
parents:
1506
diff
changeset
|
519 |
TODO: function definitions: |
62d6f7acc110
corrected the strong induction principle in the lambda-calculus case; gave a second (oartial) version that is more elegant
Christian Urban <urbanc@in.tum.de>
parents:
1506
diff
changeset
|
520 |
\medskip |
62d6f7acc110
corrected the strong induction principle in the lambda-calculus case; gave a second (oartial) version that is more elegant
Christian Urban <urbanc@in.tum.de>
parents:
1506
diff
changeset
|
521 |
|
1493
52f68b524fd2
slightly more of the paper
Christian Urban <urbanc@in.tum.de>
parents:
1491
diff
changeset
|
522 |
\noindent |
1528
d6ee4a1b34ce
more tuning on the paper
Christian Urban <urbanc@in.tum.de>
parents:
1524
diff
changeset
|
523 |
{\bf Acknowledgements:} We are very grateful to Andrew Pitts for |
1506
7c607df46a0a
slightly more in the paper
Christian Urban <urbanc@in.tum.de>
parents:
1493
diff
changeset
|
524 |
many discussions about Nominal Isabelle. We thank Peter Sewell for |
7c607df46a0a
slightly more in the paper
Christian Urban <urbanc@in.tum.de>
parents:
1493
diff
changeset
|
525 |
making the informal notes \cite{SewellBestiary} available to us and |
1556 | 526 |
also for patiently explaining some of the finer points about the abstract |
1545 | 527 |
definitions and about the implementation of the Ott-tool. |
1485
c004e7448dca
temporarily disabled tests in Nominal/ROOT
Christian Urban <urbanc@in.tum.de>
parents:
1484
diff
changeset
|
528 |
|
1577 | 529 |
Lookup: Merlin paper by James Cheney; Mark Shinwell PhD |
754
b85875d65b10
added a paper for possible notes
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
530 |
|
1577 | 531 |
Future work: distinct list abstraction |
532 |
||
533 |
||
754
b85875d65b10
added a paper for possible notes
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
534 |
*} |
b85875d65b10
added a paper for possible notes
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
535 |
|
1484 | 536 |
|
537 |
||
754
b85875d65b10
added a paper for possible notes
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
538 |
(*<*) |
b85875d65b10
added a paper for possible notes
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
539 |
end |
b85875d65b10
added a paper for possible notes
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
540 |
(*>*) |