author | Cezary Kaliszyk <cezarykaliszyk@gmail.com> |
Thu, 09 Feb 2012 14:47:24 +0100 | |
changeset 3118 | c9633254a4ec |
parent 2949 | adf22ee09738 |
permissions | -rw-r--r-- |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1 |
(*<*) |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
2 |
theory Paper |
2568
8193bbaa07fe
merged Nominal-General directory into Nominal; renamed Abs.thy to Nominal2_Abs.thy
Christian Urban <urbanc@in.tum.de>
parents:
2523
diff
changeset
|
3 |
imports "../Nominal/Nominal2_Base" |
8193bbaa07fe
merged Nominal-General directory into Nominal; renamed Abs.thy to Nominal2_Abs.thy
Christian Urban <urbanc@in.tum.de>
parents:
2523
diff
changeset
|
4 |
"../Nominal/Atoms" |
2734
eee5deb35aa8
included old test cases for perm_simp into ROOT.ML file
Christian Urban <urbanc@in.tum.de>
parents:
2568
diff
changeset
|
5 |
"../Nominal/Nominal2_Abs" |
2747
a5da7b6aff8f
precise path to LaTeXsugar
Christian Urban <urbanc@in.tum.de>
parents:
2746
diff
changeset
|
6 |
"~~/src/HOL/Library/LaTeXsugar" |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
7 |
begin |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
8 |
|
2742 | 9 |
abbreviation |
10 |
UNIV_atom ("\<allatoms>") |
|
11 |
where |
|
12 |
"UNIV_atom \<equiv> UNIV::atom set" |
|
13 |
||
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
14 |
notation (latex output) |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
15 |
sort_of ("sort _" [1000] 100) and |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
16 |
Abs_perm ("_") and |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
17 |
Rep_perm ("_") and |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
18 |
swap ("'(_ _')" [1000, 1000] 1000) and |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
19 |
fresh ("_ # _" [51, 51] 50) and |
2523
e903c32ec24f
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2522
diff
changeset
|
20 |
fresh_star ("_ #\<^sup>* _" [51, 51] 50) and |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
21 |
Cons ("_::_" [78,77] 73) and |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
22 |
supp ("supp _" [78] 73) and |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
23 |
uminus ("-_" [78] 73) and |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
24 |
atom ("|_|") and |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
25 |
If ("if _ then _ else _" 10) and |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
26 |
Rep_name ("\<lfloor>_\<rfloor>") and |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
27 |
Abs_name ("\<lceil>_\<rceil>") and |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
28 |
Rep_var ("\<lfloor>_\<rfloor>") and |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
29 |
Abs_var ("\<lceil>_\<rceil>") and |
2742 | 30 |
sort_of_ty ("sort'_ty _") |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
31 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
32 |
(* BH: uncomment if you really prefer the dot notation |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
33 |
syntax (latex output) |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
34 |
"_Collect" :: "pttrn => bool => 'a set" ("(1{_ . _})") |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
35 |
*) |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
36 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
37 |
(* sort is used in Lists for sorting *) |
2005
233bb805a4df
replaced hide by the new hide_const
Christian Urban <urbanc@in.tum.de>
parents:
1809
diff
changeset
|
38 |
hide_const sort |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
39 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
40 |
abbreviation |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
41 |
"sort \<equiv> sort_of" |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
42 |
|
2742 | 43 |
lemma infinite_collect: |
44 |
assumes "\<forall>x \<in> S. P x" "infinite S" |
|
45 |
shows "infinite {x \<in> S. P x}" |
|
46 |
using assms |
|
47 |
apply(subgoal_tac "infinite {x. x \<in> S}") |
|
48 |
apply(simp only: Inf_many_def[symmetric]) |
|
49 |
apply(erule INFM_mono) |
|
50 |
apply(auto) |
|
51 |
done |
|
52 |
||
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
53 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
54 |
(*>*) |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
55 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
56 |
section {* Introduction *} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
57 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
58 |
text {* |
2521
e7cc033f72c7
tiny work on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2470
diff
changeset
|
59 |
Nominal Isabelle provides a proving infratructure for convenient reasoning |
2771
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
60 |
about syntax involving binders, such as lambda terms or type schemes in Mini-ML: |
2466
47c840599a6b
cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents:
2382
diff
changeset
|
61 |
|
2521
e7cc033f72c7
tiny work on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2470
diff
changeset
|
62 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
2742 | 63 |
@{text "\<lambda>x. t \<forall>{x\<^isub>1,\<dots>, x\<^isub>n}. \<tau>"} |
2521
e7cc033f72c7
tiny work on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2470
diff
changeset
|
64 |
\end{isabelle} |
e7cc033f72c7
tiny work on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2470
diff
changeset
|
65 |
|
e7cc033f72c7
tiny work on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2470
diff
changeset
|
66 |
\noindent |
2754 | 67 |
At its core Nominal Isabelle is based on the nominal logic work by |
68 |
Pitts at al \cite{GabbayPitts02,Pitts03}, whose most basic notion is |
|
69 |
a sort-respecting permutation operation defined over a countably |
|
2758 | 70 |
infinite collection of sorted atoms. |
71 |
||
72 |
||
73 |
||
74 |
The aim of this paper is to |
|
2755 | 75 |
describe how we adapted this work so that it can be implemented in a |
2754 | 76 |
theorem prover based on Higher-Order Logic (HOL). For this we |
77 |
present the definition we made in the implementation and also review |
|
78 |
many proofs. There are a two main design choices to be made. One is |
|
79 |
how to represent sorted atoms. We opt here for a single unified atom |
|
80 |
type to represent atoms of different sorts. The other is how to |
|
81 |
present sort-respecting permutations. For them we use the standard |
|
82 |
technique of HOL-formalisations of introducing an appropriate |
|
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
83 |
subtype of functions from atoms to atoms. |
2740
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
84 |
|
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
85 |
The nominal logic work has been the starting point for a number of proving |
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
86 |
infrastructures, most notable by Norrish \cite{norrish04} in HOL4, by |
2742 | 87 |
Aydemir et al \cite{AydemirBohannonWeirich07} in Coq and the work by Urban |
2740
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
88 |
and Berghofer in Isabelle/HOL \cite{Urban08}. Its key attraction is a very |
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
89 |
general notion, called \emph{support}, for the `set of free variables, or |
2742 | 90 |
atoms, of an object' that applies not just to lambda terms and type schemes, |
91 |
but also to sets, products, lists, booleans and even functions. The notion of support |
|
92 |
is derived from the permutation operation defined over the |
|
93 |
hierarchy of types. This |
|
94 |
permutation operation, written @{text "_ \<bullet> _"}, has proved to be much more |
|
2740
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
95 |
convenient for reasoning about syntax, in comparison to, say, arbitrary |
2742 | 96 |
renaming substitutions of atoms. One reason is that permutations are |
2740
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
97 |
bijective renamings of atoms and thus they can be easily `undone'---namely |
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
98 |
by applying the inverse permutation. A corresponding inverse substitution |
2742 | 99 |
might not always exist, since renaming substitutions are in general only injective. |
100 |
Another reason is that permutations preserve many constructions when reasoning about syntax. |
|
2744
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
101 |
For example, suppose a typing context @{text "\<Gamma>"} of the form |
2521
e7cc033f72c7
tiny work on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2470
diff
changeset
|
102 |
|
2740
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
103 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
104 |
@{text "x\<^isub>1:\<tau>\<^isub>1, \<dots>, x\<^isub>n:\<tau>\<^isub>n"} |
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
105 |
\end{isabelle} |
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
106 |
|
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
107 |
\noindent |
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
108 |
is said to be \emph{valid} provided none of its variables, or atoms, @{text "x\<^isub>i"} |
2744
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
109 |
occur twice. Then validity of typing contexts is preserved under |
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
110 |
permutations in the sense that if @{text \<Gamma>} is valid then so is \mbox{@{text "\<pi> \<bullet> \<Gamma>"}} for |
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
111 |
all permutations @{text "\<pi>"}. Again, this is \emph{not} the case for arbitrary |
2742 | 112 |
renaming substitutions, as they might identify some of the @{text "x\<^isub>i"} in @{text \<Gamma>}. |
113 |
||
114 |
Permutations also behave uniformly with respect to HOL's logic connectives. |
|
115 |
Applying a permutation to a formula gives, for example |
|
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
116 |
|
2742 | 117 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
118 |
\begin{tabular}{@ {}lcl} |
|
119 |
@{term "\<pi> \<bullet> (A \<and> B)"} & if and only if & @{text "(\<pi> \<bullet> A) \<and> (\<pi> \<bullet> B)"}\\ |
|
120 |
@{term "\<pi> \<bullet> (A \<longrightarrow> B)"} & if and only if & @{text "(\<pi> \<bullet> A) \<longrightarrow> (\<pi> \<bullet> B)"}\\ |
|
121 |
\end{tabular} |
|
122 |
\end{isabelle} |
|
2740
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
123 |
|
2742 | 124 |
\noindent |
125 |
This uniform behaviour can also be extended to quantifiers and functions. |
|
126 |
Because of these good properties of permutations, we are able to automate |
|
127 |
reasoning to do with \emph{equivariance}. By equivariance we mean the property |
|
2744
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
128 |
that every permutation leaves a function unchanged, that is @{term "\<pi> \<bullet> f = f"} |
2742 | 129 |
for all @{text "\<pi>"}. This will often simplify arguments involving support |
2744
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
130 |
of functions, since if they are equivariant then they have empty support---or |
2742 | 131 |
`no free atoms'. |
132 |
||
133 |
There are a number of subtle differences between the nominal logic work by |
|
134 |
Pitts and the formalisation we will present in this paper. One difference |
|
135 |
is that our |
|
136 |
formalisation is compatible with HOL, in the sense that we only extend |
|
137 |
HOL by some definitions, withouth the introduction of any new axioms. |
|
138 |
The reason why the original nominal logic work is |
|
139 |
incompatible with HOL has to do with the way how the finite support property |
|
140 |
is enforced: FM-set theory is defined in \cite{Pitts01b} so that every set |
|
141 |
in the FM-set-universe has finite support. In nominal logic \cite{Pitts03}, |
|
142 |
the axioms (E3) and (E4) imply that every function symbol and proposition |
|
143 |
has finite support. However, there are notions in HOL that do \emph{not} |
|
144 |
have finite support (we will give some examples). In our formalisation, we |
|
145 |
will avoid the incompatibility of the original nominal logic work by not a |
|
146 |
priory restricting our discourse to only finitely supported entities, rather |
|
147 |
we will explicitly assume this property whenever it is needed in proofs. One |
|
148 |
consequence is that we state our basic definitions not in terms of nominal |
|
149 |
sets (as done for example in \cite{Pitts06}), but in terms of the weaker |
|
150 |
notion of permutation types---essentially sets equipped with a ``sensible'' |
|
151 |
notion of permutation operation. |
|
2740
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
152 |
|
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
153 |
|
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
154 |
|
2742 | 155 |
In the nominal logic woworkrk, the `new quantifier' plays a prominent role. |
156 |
$\new$ |
|
2740
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
157 |
|
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
158 |
|
2776 | 159 |
Obstacles for Coq; no type-classes, difficulties with quotient types, |
160 |
need for classical reasoning |
|
2740
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
161 |
|
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
162 |
Two binders |
2746
6aa98a113e6c
a lit bit more on the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents:
2744
diff
changeset
|
163 |
|
6aa98a113e6c
a lit bit more on the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents:
2744
diff
changeset
|
164 |
A preliminary version |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
165 |
*} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
166 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
167 |
section {* Sorted Atoms and Sort-Respecting Permutations *} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
168 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
169 |
text {* |
2742 | 170 |
The two most basic notions in the nominal logic work are a countably |
2754 | 171 |
infinite collection of sorted atoms and sort-respecting permutations |
172 |
of atoms. The atoms are used for representing variable names that |
|
173 |
might be bound or free. Multiple sorts are necessary for being able |
|
174 |
to represent different kinds of variables. For example, in the |
|
175 |
language Mini-ML there are bound term variables in lambda |
|
176 |
abstractions and bound type variables in type schemes. In order to |
|
177 |
be able to separate them, each kind of variables needs to be |
|
178 |
represented by a different sort of atoms. |
|
179 |
||
2746
6aa98a113e6c
a lit bit more on the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents:
2744
diff
changeset
|
180 |
|
2754 | 181 |
The existing nominal logic work usually leaves implicit the sorting |
182 |
information for atoms and leaves out a description of how sorts are |
|
183 |
represented. In our formalisation, we therefore have to make a |
|
184 |
design decision about how to implement sorted atoms and |
|
185 |
sort-respecting permutations. One possibility, which we described in |
|
186 |
\cite{Urban08}, is to have separate types for different sorts of |
|
187 |
atoms. However, we found that this does not blend well with |
|
188 |
type-classes in Isabelle/HOL (see Section~\ref{related} about |
|
189 |
related work). Therefore we use here a single unified atom type to |
|
190 |
represent atoms of different sorts. A basic requirement is that |
|
191 |
there must be a countably infinite number of atoms of each sort. |
|
2776 | 192 |
This can be implemented in Isabelle/HOL as the datatype |
2736 | 193 |
|
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
194 |
*} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
195 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
196 |
datatype atom\<iota> = Atom\<iota> string nat |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
197 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
198 |
text {* |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
199 |
\noindent |
2771
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
200 |
whereby the string argument specifies the sort of the |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
201 |
atom.\footnote{A similar design choice was made by Gunter et al |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
202 |
\cite{GunterOsbornPopescu09} for their variables.} The use of type |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
203 |
\emph{string} for sorts is merely for convenience; any countably |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
204 |
infinite type would work as well. In what follows we shall write |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
205 |
@{term "UNIV::atom set"} for the set of all atoms. We also have two |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
206 |
auxiliary functions for atoms, namely @{text sort} and @{const |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
207 |
nat_of} which are defined as |
2740
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
208 |
|
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
209 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
2742 | 210 |
\begin{tabular}{@ {}r@ {\hspace{2mm}}c@ {\hspace{2mm}}l} |
211 |
@{thm (lhs) sort_of.simps[no_vars]} & @{text "\<equiv>"} & @{thm (rhs) sort_of.simps[no_vars]}\\ |
|
212 |
@{thm (lhs) nat_of.simps[no_vars]} & @{text "\<equiv>"} & @{thm (rhs) nat_of.simps[no_vars]} |
|
213 |
\end{tabular}\hfill\numbered{sortnatof} |
|
2740
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
214 |
\end{isabelle} |
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
215 |
|
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
216 |
\noindent |
2742 | 217 |
We clearly have for every finite set @{text S} |
2522
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
218 |
of atoms and every sort @{text s} the property: |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
219 |
|
2740
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
220 |
\begin{proposition}\label{choosefresh}\mbox{}\\ |
2522
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
221 |
@{text "For a finite set of atoms S, there exists an atom a such that |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
222 |
sort a = s and a \<notin> S"}. |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
223 |
\end{proposition} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
224 |
|
2776 | 225 |
\noindent |
2783 | 226 |
This property will be used later whenever we have to chose a `fresh' atom. |
2776 | 227 |
|
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
228 |
For implementing sort-respecting permutations, we use functions of type @{typ |
2771
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
229 |
"atom => atom"} that are bijective; are the |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
230 |
identity on all atoms, except a finite number of them; and map |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
231 |
each atom to one of the same sort. These properties can be conveniently stated |
2742 | 232 |
in Isabelle/HOL for a function @{text \<pi>} as follows: |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
233 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
234 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
235 |
\begin{tabular}{r@ {\hspace{4mm}}l} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
236 |
i) & @{term "bij \<pi>"}\\ |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
237 |
ii) & @{term "finite {a. \<pi> a \<noteq> a}"}\\ |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
238 |
iii) & @{term "\<forall>a. sort (\<pi> a) = sort a"} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
239 |
\end{tabular}\hfill\numbered{permtype} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
240 |
\end{isabelle} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
241 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
242 |
\noindent |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
243 |
Like all HOL-based theorem provers, Isabelle/HOL allows us to |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
244 |
introduce a new type @{typ perm} that includes just those functions |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
245 |
satisfying all three properties. For example the identity function, |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
246 |
written @{term id}, is included in @{typ perm}. Also function composition, |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
247 |
written \mbox{@{text "_ \<circ> _"}}, and function inversion, given by Isabelle/HOL's |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
248 |
inverse operator and written \mbox{@{text "inv _"}}, preserve the properties |
2771
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
249 |
(\ref{permtype}.@{text "i"}-@{text "iii"}). |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
250 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
251 |
However, a moment of thought is needed about how to construct non-trivial |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
252 |
permutations. In the nominal logic work it turned out to be most convenient |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
253 |
to work with swappings, written @{text "(a b)"}. In our setting the |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
254 |
type of swappings must be |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
255 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
256 |
@{text [display,indent=10] "(_ _) :: atom \<Rightarrow> atom \<Rightarrow> perm"} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
257 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
258 |
\noindent |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
259 |
but since permutations are required to respect sorts, we must carefully |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
260 |
consider what happens if a user states a swapping of atoms with different |
2742 | 261 |
sorts. The following definition\footnote{To increase legibility, we omit |
262 |
here and in what follows the @{term Rep_perm} and @{term "Abs_perm"} |
|
2744
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
263 |
wrappers that are needed in our implementation in Isabelle/HOL since we defined permutation |
2742 | 264 |
not to be the full function space, but only those functions of type @{typ |
265 |
perm} satisfying properties @{text i}-@{text "iii"} in \eqref{permtype}.} |
|
266 |
||
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
267 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
268 |
@{text [display,indent=10] "(a b) \<equiv> \<lambda>c. if a = c then b else (if b = c then a else c)"} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
269 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
270 |
\noindent |
2742 | 271 |
does not work in general, because @{text a} and @{text b} may have different |
272 |
sorts---in which case the function would violate property @{text iii} in \eqref{permtype}. We |
|
273 |
could make the definition of swappings partial by adding the precondition |
|
274 |
@{term "sort a = sort b"}, which would mean that in case @{text a} and |
|
275 |
@{text b} have different sorts, the value of @{text "(a b)"} is unspecified. |
|
276 |
However, this looked like a cumbersome solution, since sort-related side |
|
277 |
conditions would be required everywhere, even to unfold the definition. It |
|
278 |
turned out to be more convenient to actually allow the user to state |
|
279 |
`ill-sorted' swappings but limit their `damage' by defaulting to the |
|
280 |
identity permutation in the ill-sorted case: |
|
281 |
||
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
282 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
283 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
284 |
\begin{tabular}{@ {}rl} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
285 |
@{text "(a b) \<equiv>"} & @{text "if (sort a = sort b)"}\\ |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
286 |
& \hspace{3mm}@{text "then \<lambda>c. if a = c then b else (if b = c then a else c)"}\\ |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
287 |
& \hspace{3mm}@{text "else id"} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
288 |
\end{tabular}\hfill\numbered{swapdef} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
289 |
\end{isabelle} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
290 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
291 |
\noindent |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
292 |
This function is bijective, the identity on all atoms except |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
293 |
@{text a} and @{text b}, and sort respecting. Therefore it is |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
294 |
a function in @{typ perm}. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
295 |
|
2740
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
296 |
One advantage of using functions as a representation for |
2775 | 297 |
permutations is that it is a unique representation. For example the swappings |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
298 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
299 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
300 |
\begin{tabular}{@ {}l} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
301 |
@{thm swap_commute[no_vars]}\hspace{10mm} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
302 |
@{text "(a a) = id"} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
303 |
\end{tabular}\hfill\numbered{swapeqs} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
304 |
\end{isabelle} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
305 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
306 |
\noindent |
2771
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
307 |
are \emph{equal} and can be used interchangeably. Another advantage of the function |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
308 |
representation is that they form a (non-com\-mu\-ta\-tive) group provided we define |
2740
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
309 |
|
2742 | 310 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
311 |
\begin{tabular}{@ {}r@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {\hspace{10mm}}r@ {\hspace{2mm}}c@ {\hspace{2mm}}l} |
|
312 |
@{thm (lhs) zero_perm_def[no_vars]} & @{text "\<equiv>"} & @{thm (rhs) zero_perm_def[no_vars]} & |
|
313 |
@{thm (lhs) plus_perm_def[where p="\<pi>\<^isub>1" and q="\<pi>\<^isub>2"]} & @{text "\<equiv>"} & |
|
314 |
@{thm (rhs) plus_perm_def[where p="\<pi>\<^isub>1" and q="\<pi>\<^isub>2"]}\\ |
|
315 |
@{thm (lhs) uminus_perm_def[where p="\<pi>"]} & @{text "\<equiv>"} & @{thm (rhs) uminus_perm_def[where p="\<pi>"]} & |
|
316 |
@{thm (lhs) minus_perm_def[where ?p1.0="\<pi>\<^isub>1" and ?p2.0="\<pi>\<^isub>2"]} & @{text "\<equiv>"} & |
|
317 |
@{thm (rhs) minus_perm_def[where ?p1.0="\<pi>\<^isub>1" and ?p2.0="\<pi>\<^isub>2"]} |
|
318 |
\end{tabular}\hfill\numbered{groupprops} |
|
319 |
\end{isabelle} |
|
320 |
||
321 |
\noindent |
|
322 |
and verify the four simple properties |
|
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
323 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
324 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
325 |
\begin{tabular}{@ {}l} |
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
326 |
i)~~@{thm add_assoc[where a="\<pi>\<^isub>1" and b="\<pi>\<^isub>2" and c="\<pi>\<^isub>3"]}\smallskip\\ |
2758 | 327 |
ii)~~@{thm monoid_add_class.add_0_left[where a="\<pi>::perm"]} \hspace{9mm} |
328 |
iii)~~@{thm monoid_add_class.add_0_right[where a="\<pi>::perm"]} \hspace{9mm} |
|
329 |
iv)~~@{thm group_add_class.left_minus[where a="\<pi>::perm"]} |
|
330 |
\end{tabular}\hfill\numbered{grouplaws} |
|
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
331 |
\end{isabelle} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
332 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
333 |
\noindent |
2740
a9e63abf3feb
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2736
diff
changeset
|
334 |
The technical importance of this fact is that we can rely on |
1809
08e4d3cbcf8c
folded changes from the conference version
Christian Urban <urbanc@in.tum.de>
parents:
1790
diff
changeset
|
335 |
Isabelle/HOL's existing simplification infrastructure for groups, which will |
08e4d3cbcf8c
folded changes from the conference version
Christian Urban <urbanc@in.tum.de>
parents:
1790
diff
changeset
|
336 |
come in handy when we have to do calculations with permutations. |
1790 | 337 |
Note that Isabelle/HOL defies standard conventions of mathematical notation |
338 |
by using additive syntax even for non-commutative groups. Obviously, |
|
2758 | 339 |
composition of permutations is not commutative in general; for example |
340 |
||
341 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
2771
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
342 |
@{text "(a b) + (b c) \<noteq> (b c) + (a b)"}\;. |
2758 | 343 |
\end{isabelle} |
344 |
||
345 |
\noindent |
|
346 |
But since the point of this paper is to implement the |
|
1790 | 347 |
nominal theory as smoothly as possible in Isabelle/HOL, we tolerate |
348 |
the non-standard notation in order to reuse the existing libraries. |
|
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
349 |
|
2758 | 350 |
A \emph{permutation operation}, written infix as @{text "\<pi> \<bullet> x"}, |
2771
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
351 |
applies a permutation @{text "\<pi>"} to an object @{text "x"}. This |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
352 |
operation has the type |
2744
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
353 |
|
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
354 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
355 |
@{text "_ \<bullet> _ :: perm \<Rightarrow> \<beta> \<Rightarrow> \<beta>"} |
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
356 |
\end{isabelle} |
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
357 |
|
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
358 |
\noindent |
2776 | 359 |
whereby @{text "\<beta>"} is a generic type for the object @{text |
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
360 |
x}.\footnote{We will write @{text "((op \<bullet>) \<pi>) |
2776 | 361 |
x"} for this operation in the few cases where we need to indicate |
362 |
that it is a function applied with two arguments.} The definition |
|
363 |
of this operation will be given by in terms of `induction' over this |
|
364 |
generic type. The type-class mechanism of Isabelle/HOL |
|
365 |
\cite{Wenzel04} allows us to give a definition for `base' types, |
|
366 |
such as atoms, permutations, booleans and natural numbers: |
|
2754 | 367 |
|
368 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
369 |
\begin{tabular}{@ {}l@ {\hspace{4mm}}l@ {}} |
|
370 |
atoms: & @{thm permute_atom_def[where p="\<pi>",no_vars, THEN eq_reflection]}\\ |
|
371 |
permutations: & @{thm permute_perm_def[where p="\<pi>" and q="\<pi>'", THEN eq_reflection]}\\ |
|
372 |
booleans: & @{thm permute_bool_def[where p="\<pi>", no_vars, THEN eq_reflection]}\\ |
|
373 |
nats: & @{thm permute_nat_def[where p="\<pi>", no_vars, THEN eq_reflection]}\\ |
|
2758 | 374 |
\end{tabular}\hfill\numbered{permdefsbase} |
375 |
\end{isabelle} |
|
376 |
||
377 |
\noindent |
|
378 |
and for type-constructors, such as functions, sets, lists and products: |
|
379 |
||
380 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
381 |
\begin{tabular}{@ {}l@ {\hspace{4mm}}l@ {}} |
|
2754 | 382 |
functions: & @{text "\<pi> \<bullet> f \<equiv> \<lambda>x. \<pi> \<bullet> (f ((-\<pi>) \<bullet> x))"}\\ |
383 |
sets: & @{thm permute_set_eq[where p="\<pi>", no_vars, THEN eq_reflection]}\\ |
|
384 |
lists: & @{thm permute_list.simps(1)[where p="\<pi>", no_vars, THEN eq_reflection]}\\ |
|
385 |
& @{thm permute_list.simps(2)[where p="\<pi>", no_vars, THEN eq_reflection]}\\ |
|
386 |
products: & @{thm permute_prod.simps[where p="\<pi>", no_vars, THEN eq_reflection]}\\ |
|
2758 | 387 |
\end{tabular}\hfill\numbered{permdefsconstrs} |
2754 | 388 |
\end{isabelle} |
389 |
||
2771
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
390 |
\noindent |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
391 |
The type classes also allow us to reason abstractly about the permutation operation. |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
392 |
For this we state the following two |
2742 | 393 |
\emph{permutation properties}: |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
394 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
395 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
396 |
\begin{tabular}{@ {}r@ {\hspace{4mm}}p{10cm}} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
397 |
i) & @{thm permute_zero[no_vars]}\\ |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
398 |
ii) & @{thm permute_plus[where p="\<pi>\<^isub>1" and q="\<pi>\<^isub>2",no_vars]} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
399 |
\end{tabular}\hfill\numbered{newpermprops} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
400 |
\end{isabelle} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
401 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
402 |
\noindent |
2761 | 403 |
From these properties and law (\ref{grouplaws}.{\it iv}) about groups |
404 |
follows that a permutation and its inverse cancel each other. That is |
|
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
405 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
406 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
407 |
\begin{tabular}{@ {}l} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
408 |
@{thm permute_minus_cancel(1)[where p="\<pi>", no_vars]}\hspace{10mm} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
409 |
@{thm permute_minus_cancel(2)[where p="\<pi>", no_vars]} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
410 |
\end{tabular}\hfill\numbered{cancel} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
411 |
\end{isabelle} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
412 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
413 |
\noindent |
2754 | 414 |
Consequently, the permutation operation @{text "\<pi> \<bullet> _"}~~is bijective, |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
415 |
which in turn implies the property |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
416 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
417 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
418 |
\begin{tabular}{@ {}l} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
419 |
@{thm (lhs) permute_eq_iff[where p="\<pi>", no_vars]} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
420 |
$\;$if and only if$\;$ |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
421 |
@{thm (rhs) permute_eq_iff[where p="\<pi>", no_vars]}. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
422 |
\end{tabular}\hfill\numbered{permuteequ} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
423 |
\end{isabelle} |
2523
e903c32ec24f
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2522
diff
changeset
|
424 |
|
e903c32ec24f
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2522
diff
changeset
|
425 |
\noindent |
2754 | 426 |
We can also show that the following property holds for the permutation |
427 |
operation. |
|
2744
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
428 |
|
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
429 |
\begin{lemma}\label{permutecompose} |
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
430 |
@{text "\<pi>\<^isub>1 \<bullet> (\<pi>\<^isub>2 \<bullet> x) = (\<pi>\<^isub>1 \<bullet> \<pi>\<^isub>2) \<bullet> (\<pi>\<^isub>1 \<bullet> x)"}. |
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
431 |
\end{lemma} |
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
432 |
|
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
433 |
\begin{proof} The proof is as follows: |
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
434 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
435 |
\begin{tabular}[b]{@ {}c@ {\hspace{2mm}}l@ {\hspace{8mm}}l} |
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
436 |
& @{text "\<pi>\<^isub>1 \<bullet> \<pi>\<^isub>2 \<bullet> x"}\\ |
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
437 |
@{text "="} & @{text "\<pi>\<^isub>1 \<bullet> \<pi>\<^isub>2 \<bullet> (-\<pi>\<^isub>1) \<bullet> \<pi>\<^isub>1 \<bullet> x"} & by \eqref{cancel}\\ |
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
438 |
@{text "="} & @{text "(\<pi>\<^isub>1 + \<pi>\<^isub>2 - \<pi>\<^isub>1) \<bullet> (\<pi>\<^isub>1 \<bullet> x)"} & by {\rm(\ref{newpermprops}.@{text "ii"})}\\ |
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
439 |
@{text "\<equiv>"} & @{text "(\<pi>\<^isub>1 \<bullet> \<pi>\<^isub>2) \<bullet> (\<pi>\<^isub>1 \<bullet> x)"}\\ |
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
440 |
\end{tabular}\hfill\qed |
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
441 |
\end{isabelle} |
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
442 |
\end{proof} |
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
443 |
|
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
444 |
\noindent |
2754 | 445 |
Note that the permutation operation for functions is defined so that |
2775 | 446 |
we have for applications the equation |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
447 |
|
2742 | 448 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
2754 | 449 |
@{text "\<pi> \<bullet> (f x) ="} |
450 |
@{thm (rhs) permute_fun_app_eq[where p="\<pi>", no_vars]} |
|
451 |
\hfill\numbered{permutefunapp} |
|
2742 | 452 |
\end{isabelle} |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
453 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
454 |
\noindent |
2776 | 455 |
provided the permutation properties hold for @{text x}. This equation can |
2754 | 456 |
be easily shown by unfolding the permutation operation for functions on |
2776 | 457 |
the right-hand side of the equation, simplifying the resulting beta-redex |
458 |
and eliminating the permutations in front of @{text x} using \eqref{cancel}. |
|
2754 | 459 |
|
2771
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
460 |
The main benefit of the use of type classes is that it allows us to delegate |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
461 |
much of the routine resoning involved in determining whether the permutation properties |
2754 | 462 |
are satisfied to Isabelle/HOL's type system: we only have to |
463 |
establish that base types satisfy them and that type-constructors |
|
2776 | 464 |
preserve them. Then Isabelle/HOL will use this information and determine |
2775 | 465 |
whether an object @{text x} with a compound type, like @{typ "atom \<Rightarrow> (atom set * nat)"}, satisfies the |
2754 | 466 |
permutation properties. For this we define the notion of a |
467 |
\emph{permutation type}: |
|
468 |
||
2776 | 469 |
\begin{definition}[Permutation Type] |
2754 | 470 |
A type @{text "\<beta>"} is a \emph{permutation type} if the permutation |
471 |
properties in \eqref{newpermprops} are satisfied for every @{text |
|
472 |
"x"} of type @{text "\<beta>"}. |
|
473 |
\end{definition} |
|
474 |
||
475 |
\noindent |
|
2744
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
476 |
and establish: |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
477 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
478 |
\begin{theorem} |
2758 | 479 |
The types @{type atom}, @{type perm}, @{type bool} and @{type nat} |
480 |
are permutation types, and if @{text \<beta>}, @{text "\<beta>\<^isub>1"} and @{text |
|
481 |
"\<beta>\<^isub>2"} are permutation types, then so are \mbox{@{text "\<beta>\<^isub>1 \<Rightarrow> \<beta>\<^isub>2"}}, |
|
482 |
@{text "\<beta> set"}, @{text "\<beta> list"} and @{text "\<beta>\<^isub>1 \<times> \<beta>\<^isub>2"}. |
|
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
483 |
\end{theorem} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
484 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
485 |
\begin{proof} |
2754 | 486 |
All statements are by unfolding the definitions of the permutation |
487 |
operations and simple calculations involving addition and |
|
2758 | 488 |
minus. In case of permutations for example we have |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
489 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
490 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
491 |
\begin{tabular}[b]{@ {}rcl} |
2761 | 492 |
@{text "0 \<bullet> \<pi>'"} & @{text "\<equiv>"} & @{text "0 + \<pi>' - 0 = \<pi>'"}\smallskip\\ |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
493 |
@{text "(\<pi>\<^isub>1 + \<pi>\<^isub>2) \<bullet> \<pi>'"} & @{text "\<equiv>"} & @{text "(\<pi>\<^isub>1 + \<pi>\<^isub>2) + \<pi>' - (\<pi>\<^isub>1 + \<pi>\<^isub>2)"}\\ |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
494 |
& @{text "="} & @{text "(\<pi>\<^isub>1 + \<pi>\<^isub>2) + \<pi>' - \<pi>\<^isub>2 - \<pi>\<^isub>1"}\\ |
2761 | 495 |
& @{text "="} & @{text "\<pi>\<^isub>1 + (\<pi>\<^isub>2 + \<pi>' - \<pi>\<^isub>2) - \<pi>\<^isub>1"}\\ |
496 |
& @{text "\<equiv>"} & @{text "\<pi>\<^isub>1 \<bullet> \<pi>\<^isub>2 \<bullet> \<pi>'"} |
|
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
497 |
\end{tabular}\hfill\qed |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
498 |
\end{isabelle} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
499 |
\end{proof} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
500 |
*} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
501 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
502 |
section {* Equivariance *} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
503 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
504 |
text {* |
2949
adf22ee09738
side commment for future use
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
505 |
(mention alpha-structural paper by Andy) |
adf22ee09738
side commment for future use
Christian Urban <urbanc@in.tum.de>
parents:
2821
diff
changeset
|
506 |
|
2776 | 507 |
Two important notions in the nominal logic work are what Pitts calls |
508 |
\emph{equivariance} and the \emph{equivariance principle}. These |
|
509 |
notions allows us to characterise how permutations act upon compound |
|
510 |
statements in HOL by analysing how these statements are constructed. |
|
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
511 |
The notion of equivariance means that an object is invariant under |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
512 |
any permutations. This can be defined as follows: |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
513 |
|
2742 | 514 |
\begin{definition}[Equivariance]\label{equivariance} |
2776 | 515 |
An object @{text "x"} of permutation type is \emph{equivariant} provided |
516 |
for all permutations @{text "\<pi>"}, \mbox{@{term "\<pi> \<bullet> x = x"}} holds. |
|
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
517 |
\end{definition} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
518 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
519 |
\noindent |
2776 | 520 |
In what follows we will primarily be interested in the cases where |
521 |
@{text x} is a constant, but of course there is no way in |
|
522 |
Isabelle/HOL to restrict this definition to just these cases. |
|
2758 | 523 |
|
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
524 |
There are a number of equivalent formulations for equivariance. |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
525 |
For example, assuming @{text f} is a function of permutation |
2783 | 526 |
type @{text "\<alpha> \<Rightarrow> \<beta>"}, then equivariance of @{text f} can also be stated as |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
527 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
528 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
529 |
\begin{tabular}{@ {}l} |
2776 | 530 |
@{text "\<forall>\<pi> x. \<pi> \<bullet> (f x) = f (\<pi> \<bullet> x)"} |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
531 |
\end{tabular}\hfill\numbered{altequivariance} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
532 |
\end{isabelle} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
533 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
534 |
\noindent |
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
535 |
We will say this formulation of equivariance is in \emph{fully applied form}. |
2754 | 536 |
To see that this formulation implies the definition, we just unfold |
537 |
the definition of the permutation operation for functions and |
|
538 |
simplify with the equation and the cancellation property shown in |
|
539 |
\eqref{cancel}. To see the other direction, we use |
|
2776 | 540 |
\eqref{permutefunapp}. Similarly for functions that take more than |
2761 | 541 |
one argument. The point to note is that equivariance and equivariance in fully |
2775 | 542 |
applied form are always interderivable (for permutation types). |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
543 |
|
2754 | 544 |
Both formulations of equivariance have their advantages and |
2761 | 545 |
disadvantages: \eqref{altequivariance} is usually more convenient to |
2775 | 546 |
establish, since statements in HOL are commonly given in a |
2754 | 547 |
form where functions are fully applied. For example we can easily |
548 |
show that equality is equivariant |
|
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
549 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
550 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
551 |
\begin{tabular}{@ {}l} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
552 |
@{thm eq_eqvt[where p="\<pi>", no_vars]} |
2771
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
553 |
\end{tabular}\hfill\numbered{eqeqvt} |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
554 |
\end{isabelle} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
555 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
556 |
\noindent |
2754 | 557 |
using the permutation operation on booleans and property |
2771
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
558 |
\eqref{permuteequ}. |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
559 |
Lemma~\ref{permutecompose} establishes that the |
2754 | 560 |
permutation operation is equivariant. The permutation operation for |
2758 | 561 |
lists and products, shown in \eqref{permdefsconstrs}, state that the |
2754 | 562 |
constructors for products, @{text "Nil"} and @{text Cons} are |
2758 | 563 |
equivariant. Furthermore a simple calculation will show that our |
2754 | 564 |
swapping functions are equivariant, that is |
565 |
||
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
566 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
567 |
\begin{tabular}{@ {}l} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
568 |
@{thm swap_eqvt[where p="\<pi>", no_vars]} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
569 |
\end{tabular}\hfill\numbered{swapeqvt} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
570 |
\end{isabelle} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
571 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
572 |
\noindent |
2754 | 573 |
for all @{text a}, @{text b} and @{text \<pi>}. Also the booleans |
574 |
@{const True} and @{const False} are equivariant by the definition |
|
2775 | 575 |
of the permutation operation for booleans. Given this definition, it |
576 |
is also easy to see that the boolean operators, like @{text "\<and>"}, |
|
2776 | 577 |
@{text "\<or>"}, @{text "\<longrightarrow>"} and @{text "\<not>"} are equivariant: |
2758 | 578 |
|
579 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
2771
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
580 |
\begin{tabular}{@ {}lcl} |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
581 |
@{text "\<pi> \<bullet> (A \<and> B) = (\<pi> \<bullet> A) \<and> (\<pi> \<bullet> B)"}\\ |
2775 | 582 |
@{text "\<pi> \<bullet> (A \<or> B) = (\<pi> \<bullet> A) \<or> (\<pi> \<bullet> B)"}\\ |
2771
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
583 |
@{text "\<pi> \<bullet> (A \<longrightarrow> B) = (\<pi> \<bullet> A) \<longrightarrow> (\<pi> \<bullet> B)"}\\ |
2775 | 584 |
@{text "\<pi> \<bullet> (\<not>A) = \<not>(\<pi> \<bullet> A)"}\\ |
2771
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
585 |
\end{tabular} |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
586 |
\end{isabelle} |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
587 |
|
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
588 |
In contrast, the advantage of Definition \ref{equivariance} is that |
2776 | 589 |
it allows us to state a general principle how permutations act on |
590 |
statements in HOL. For this we will define a rewrite system that |
|
591 |
`pushes' a permutation towards the leaves of statements (i.e.~constants |
|
592 |
and variables). Then the permutations disappear in cases where the |
|
593 |
constants are equivariant. To do so, let us first define |
|
594 |
\emph{HOL-terms}, which are the building blocks of statements in HOL. |
|
595 |
They are given by the grammar |
|
596 |
||
597 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
598 |
@{text "t ::= c | x | t\<^isub>1 t\<^isub>2 | \<lambda>x. t"} |
|
599 |
\hfill\numbered{holterms} |
|
600 |
\end{isabelle} |
|
601 |
||
602 |
\noindent |
|
603 |
where @{text c} stands for constants and @{text x} for variables. |
|
604 |
We assume HOL-terms are fully typed, but for the sake of better |
|
605 |
legibility we leave the typing information implicit. We also assume |
|
606 |
the usual notions for free and bound variables of a HOL-term. |
|
607 |
Furthermore, HOL-terms are regarded as equal modulo alpha-, beta- |
|
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
608 |
and eta-equivalence. The equivariance principle can now |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
609 |
be stated formally as follows: |
2775 | 610 |
|
611 |
\begin{theorem}[Equivariance Principle]\label{eqvtprin} |
|
612 |
Suppose a HOL-term @{text t} whose constants are all equivariant. For any |
|
2776 | 613 |
permutation @{text \<pi>}, let @{text t'} be @{text t} except every |
2775 | 614 |
free variable @{text x} in @{term t} is replaced by @{text "\<pi> \<bullet> x"}, then |
615 |
@{text "\<pi> \<bullet> t = t'"}. |
|
616 |
\end{theorem} |
|
617 |
||
618 |
\noindent |
|
619 |
The significance of this principle is that we can automatically establish |
|
620 |
the equivariance of a constant for which equivariance is not yet |
|
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
621 |
known. For this we only have to establish that the definiens of this |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
622 |
constant is a HOL-term whose constants are all equivariant. |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
623 |
This meshes well with how HOL is designed: except for a few axioms, every constant |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
624 |
is defined in terms of existing constants. For example an alternative way |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
625 |
to deduce that @{term True} is equivariant is to look at its |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
626 |
definition |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
627 |
|
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
628 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
629 |
@{thm True_def} |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
630 |
\end{isabelle} |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
631 |
|
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
632 |
\noindent |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
633 |
and observing that the only constant in the definiens, namely @{text "="}, is |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
634 |
equivariant. Similarly, the universal quantifier @{text "\<forall>"} is definied in HOL as |
2775 | 635 |
|
636 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
2776 | 637 |
@{text "\<forall>x. P x \<equiv> "}~@{thm (rhs) All_def[no_vars]} |
2775 | 638 |
\end{isabelle} |
639 |
||
640 |
\noindent |
|
2776 | 641 |
The constants in the definiens @{thm (rhs) All_def[no_vars]}, namely @{text "="} |
642 |
and @{text "True"}, are equivariant (we shown this above). Therefore |
|
643 |
the equivariance principle gives us |
|
2775 | 644 |
|
645 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
646 |
\begin{tabular}{r@ {\hspace{1mm}}c@ {\hspace{1mm}}l} |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
647 |
@{text "\<pi> \<bullet> (\<forall>x. P x)"} & @{text "\<equiv>"} & @{text "\<pi> \<bullet> (P = (\<lambda>x. True))"}\\ |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
648 |
& @{text "="} & @{text "(\<pi> \<bullet> P) = (\<lambda>x. True)"}\\ |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
649 |
& @{text "\<equiv>"} & @{text "\<forall>x. (\<pi> \<bullet> P) x"} |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
650 |
\end{tabular} |
2776 | 651 |
\end{isabelle} |
652 |
||
653 |
\noindent |
|
2783 | 654 |
which means the constant @{text "\<forall>"} must be equivariant. From this |
2776 | 655 |
we can deduce that the existential quantifier @{text "\<exists>"} is equivariant. |
656 |
Its definition in HOL is |
|
657 |
||
658 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
659 |
@{text "\<exists>x. P x \<equiv> "}~@{thm (rhs) Ex_def[no_vars]} |
|
2775 | 660 |
\end{isabelle} |
2771
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
661 |
|
2775 | 662 |
\noindent |
2776 | 663 |
where again the HOL-term on the right-hand side only contains equivariant constants |
664 |
(namely @{text "\<forall>"} and @{text "\<longrightarrow>"}). Taking both facts together, we can deduce that |
|
665 |
the unique existential quantifier @{text "\<exists>!"} is equivariant. Its definition |
|
666 |
is |
|
2775 | 667 |
|
668 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
2776 | 669 |
@{text "\<exists>!x. P x \<equiv> "}~@{thm (rhs) Ex1_def[no_vars]} |
2775 | 670 |
\end{isabelle} |
671 |
||
672 |
\noindent |
|
2776 | 673 |
with all constants on the right-hand side being equivariant. With this kind |
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
674 |
of reasoning we can build up a database of equivariant constants, which will |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
675 |
be handy for more complex calculations later on. |
2775 | 676 |
|
2776 | 677 |
Before we proceed, let us give a justification for the equivariance principle. |
2783 | 678 |
This justification cannot be given directly inside Isabelle/HOL since we cannot |
679 |
prove any statement about HOL-terms. Instead, we will use a rewrite |
|
680 |
system consisting of a series of equalities |
|
2775 | 681 |
|
682 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
2776 | 683 |
@{text "\<pi> \<cdot> t = ... = t'"} |
2775 | 684 |
\end{isabelle} |
685 |
||
2776 | 686 |
\noindent |
687 |
that establish the equality between @{term "\<pi> \<bullet> t"} and |
|
688 |
@{text "t'"}. The idea of the rewrite system is to push the |
|
689 |
permutation inside the term @{text t}. We have implemented this as a |
|
690 |
conversion tactic on the ML-level of Isabelle/HOL. In what follows, |
|
691 |
we will show that this tactic produces only finitely many equations |
|
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
692 |
and also show that it is correct (in the sense of pushing a permutation |
2776 | 693 |
@{text "\<pi>"} inside a term and the only remaining instances of @{text |
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
694 |
"\<pi>"} are in front of the term's free variables). |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
695 |
|
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
696 |
The tactic applies four `oriented' equations. |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
697 |
We will first give a naive version of |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
698 |
our tactic, which however in some corner cases produces incorrect |
2776 | 699 |
results or does not terminate. We then give a modification in order |
700 |
to obtain the desired properties. |
|
2783 | 701 |
Consider the following for oriented equations |
2776 | 702 |
|
2771
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
703 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
704 |
\begin{tabular}{@ {}lr@ {\hspace{3mm}}c@ {\hspace{3mm}}l} |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
705 |
i) & @{text "\<pi> \<bullet> (t\<^isub>1 t\<^isub>2)"} & \rrh & @{term "(\<pi> \<bullet> t\<^isub>1) (\<pi> \<bullet> t\<^isub>2)"}\\ |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
706 |
ii) & @{text "\<pi> \<bullet> (\<lambda>x. t)"} & \rrh & @{text "\<lambda>x. \<pi> \<bullet> (t[x := (-\<pi>) \<bullet> x])"}\\ |
2776 | 707 |
iii) & @{term "\<pi> \<bullet> (- \<pi>) \<bullet> x"} & \rrh & @{term "x"}\\ |
708 |
iv) & @{term "\<pi> \<bullet> c"} & \rrh & |
|
709 |
{\rm @{term "c"}\hspace{6mm}provided @{text c} is equivariant}\\ |
|
2758 | 710 |
\end{tabular}\hfill\numbered{rewriteapplam} |
711 |
\end{isabelle} |
|
712 |
||
713 |
\noindent |
|
2783 | 714 |
These equation are oriented in the sense of being applied in the left-to-right |
715 |
direction. The first equation we established in \eqref{permutefunapp}; |
|
2758 | 716 |
the second follows from the definition of permutations acting on functions |
2761 | 717 |
and the fact that HOL-terms are equal modulo beta-equivalence. |
2783 | 718 |
The third is a consequence of \eqref{cancel} and the fourth from |
719 |
Definition~\ref{equivariance}. Unfortunately, we have to be careful with |
|
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
720 |
the rules {\it i)} and {\it iv}) since they can lead to loops whenever |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
721 |
\mbox{@{text "t\<^isub>1 t\<^isub>2"}} is of the form @{text "((op \<bullet>) \<pi>') t"}. |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
722 |
Recall that we established in Lemma \ref{permutecompose} that the |
2776 | 723 |
constant @{text "(op \<bullet>)"} is equivariant and consider the infinite |
2771
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
724 |
reduction sequence |
2744
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
725 |
|
2754 | 726 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
2761 | 727 |
\begin{tabular}{@ {}l} |
2771
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
728 |
@{text "\<pi> \<bullet> (\<pi>' \<bullet> t)"} |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
729 |
$\;\;\stackrel{\text{\it i)}}{\rrh}\stackrel{\text{\it i)}}{\rrh}\stackrel{\text{\it iv)}}{\rrh}\;\;$ |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
730 |
@{text "(\<pi> \<bullet> \<pi>') \<bullet> (\<pi> \<bullet> t)"} |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
731 |
$\;\;\stackrel{\text{\it i)}}{\rrh}\stackrel{\text{\it i)}}{\rrh}\stackrel{\text{\it iv)}}{\rrh}\;\;$ |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
732 |
@{text "((\<pi> \<bullet> \<pi>') \<bullet> \<pi>) \<bullet> ((\<pi> \<bullet> \<pi>') \<bullet> t)"}~~\ldots% |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
733 |
|
2761 | 734 |
\end{tabular} |
2754 | 735 |
\end{isabelle} |
736 |
||
2758 | 737 |
\noindent |
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
738 |
where the last term is again an instance of rewrite rule {\it i}), but larger. |
2783 | 739 |
To avoid this loop we will apply the rewrite rule |
2771
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
740 |
using an `outside to inside' strategy. This strategy is sufficient |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
741 |
since we are only interested of rewriting terms of the form @{term |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
742 |
"\<pi> \<bullet> t"}, where an outermost permutation needs to pushed inside a term. |
2761 | 743 |
|
2776 | 744 |
Another problem we have to avoid is that the rules {\it i)} and {\it |
745 |
iii)} can `overlap'. For this note that the term @{term "\<pi> |
|
746 |
\<bullet>(\<lambda>x. x)"} reduces by {\it ii)} to @{term "\<lambda>x. \<pi> \<bullet> (- \<pi>) \<bullet> x"}, to |
|
747 |
which we can apply rule {\it iii)} in order to obtain @{term |
|
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
748 |
"\<lambda>x. x"}, as is desired: since there is no free variable in the original |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
749 |
term, the permutation should completely vanish. However, the |
2776 | 750 |
subterm @{text "(- \<pi>) \<bullet> x"} is also an application. Consequently, |
2783 | 751 |
the term @{term "\<lambda>x. \<pi> \<bullet> (- \<pi>) \<bullet>x"} can also reduce to @{text "\<lambda>x. (- (\<pi> |
752 |
\<bullet> \<pi>)) \<bullet> (\<pi> \<bullet> x)"} using {\it i)}. Given our strategy, we cannot |
|
753 |
apply rule {\it iii)} anymore in order to eliminate the permutation. |
|
754 |
In contrast, if we start |
|
2776 | 755 |
with the term @{text "\<pi> \<bullet> ((- \<pi>) \<bullet> x)"} where @{text \<pi>} and @{text |
756 |
x} are free variables, then we \emph{do} want to apply rule {\it i)} |
|
2783 | 757 |
in order to obtain @{text "(\<pi> \<bullet> (- \<pi>)) \<bullet> (\<pi> \<bullet> x)"} |
2776 | 758 |
and not rule {\it iii)}. The latter would eliminate @{text \<pi>} |
2783 | 759 |
completely and thus violating our correctness property. The problem is that |
760 |
rule {\it iii)} should only apply to |
|
761 |
instances where the corresponding variable is to bound; for free variables we want |
|
2776 | 762 |
to use {\it ii)}. In order to distinguish these cases we have to |
763 |
maintain the information which variable is bound when inductively |
|
764 |
taking a term `apart'. This, unfortunately, does not mesh well with |
|
765 |
the way how conversion tactics are implemented in Isabelle/HOL. |
|
2771
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
766 |
|
2776 | 767 |
Our remedy is to use a standard trick in HOL: we introduce a |
768 |
separate definition for terms of the form @{text "(- \<pi>) \<bullet> x"}, |
|
769 |
namely as |
|
2758 | 770 |
|
771 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
772 |
@{term "unpermute \<pi> x \<equiv> (- \<pi>) \<bullet> x"} |
|
773 |
\end{isabelle} |
|
774 |
||
775 |
\noindent |
|
2783 | 776 |
The point is that now we can re-formulate the rewrite rules as follows |
2758 | 777 |
|
778 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
779 |
\begin{tabular}{@ {}lrcl} |
|
2771
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
780 |
i') & @{text "\<pi> \<bullet> (t\<^isub>1 t\<^isub>2)"} & \rrh & |
2761 | 781 |
@{term "(\<pi> \<bullet> t\<^isub>1) (\<pi> \<bullet> t\<^isub>2)"}\hspace{45mm}\mbox{}\\ |
2771
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
782 |
\multicolumn{4}{r}{\rm provided @{text "t\<^isub>1 t\<^isub>2"} is not of the form @{text "unpermute \<pi> x"}}\smallskip\\ |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
783 |
ii') & @{text "\<pi> \<bullet> (\<lambda>x. t)"} & \rrh & @{text "\<lambda>x. \<pi> \<bullet> (t[x := unpermute \<pi> x])"}\\ |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
784 |
iii') & @{text "\<pi> \<bullet> (unpermute \<pi> x)"} & \rrh & @{term x}\\ |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
785 |
iv') & @{term "\<pi> \<bullet> c"} & \rrh & @{term "c"} |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
786 |
\hspace{6mm}{\rm provided @{text c} is equivariant}\\ |
2758 | 787 |
\end{tabular} |
788 |
\end{isabelle} |
|
789 |
||
790 |
\noindent |
|
2783 | 791 |
where @{text unpermutes} are only generated in case of bound variables. |
2771
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
792 |
Clearly none of these rules overlap. Moreover, given our |
2783 | 793 |
outside-to-inside strategy, applying them repeatedly must terminate. |
794 |
To see this, notice that |
|
2771
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
795 |
the permutation on the right-hand side of the rewrite rules is |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
796 |
always applied to a smaller term, provided we take the measure consisting |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
797 |
of lexicographically ordered pairs whose first component is the size |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
798 |
of a term (counting terms of the form @{text "unpermute \<pi> x"} as |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
799 |
leaves) and the second is the number of occurences of @{text |
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
800 |
"unpermute \<pi> x"} and @{text "\<pi> \<bullet> c"}. |
2758 | 801 |
|
2783 | 802 |
With the rewrite rules of the conversions tactic in place, we can |
2776 | 803 |
establish its correctness. The property we are after is that |
804 |
for a HOL-term @{text t} whose constants are all equivariant the |
|
805 |
term \mbox{@{text "\<pi> \<bullet> t"}} is equal to @{text "t'"} with @{text "t'"} |
|
2771
66ef2a2c64fb
more to the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2761
diff
changeset
|
806 |
being equal to @{text t} except that every free variable @{text x} |
2776 | 807 |
in @{text t} is replaced by \mbox{@{text "\<pi> \<bullet> x"}}. Let us call |
808 |
a variable @{text x} \emph{really free}, if it is free and not occuring |
|
2783 | 809 |
in an @{term unpermute}, such as @{text "unpermute _ x"} and @{text "unpermute x _"}. |
810 |
We need the following technical notion characterising \emph{@{text "\<pi>"}-proper} HOL-terms |
|
2744
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
811 |
|
2776 | 812 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
813 |
\begin{tabular}{@ {}ll} |
|
814 |
$\bullet$ & variables and constants are @{text \<pi>}-proper,\\ |
|
815 |
$\bullet$ & @{term "unpermute \<pi> x"} is @{text \<pi>}-proper,\\ |
|
816 |
$\bullet$ & @{term "\<lambda>x. t"} is @{text \<pi>}-proper, if @{text t} is @{text \<pi>}-proper and @{text x} is |
|
817 |
really free in @{text t}, and\\ |
|
818 |
$\bullet$ & @{term "t\<^isub>1 t\<^isub>2"} is @{text \<pi>}-proper, if @{text "t\<^isub>1"} and @{text "t\<^isub>2"} are |
|
819 |
@{text \<pi>}-proper. |
|
820 |
\end{tabular} |
|
821 |
\end{isabelle} |
|
2742 | 822 |
|
2776 | 823 |
\begin{proof}[Theorem~\ref{eqvtprin}] We establish the property if @{text t} |
824 |
is @{text \<pi>}-proper and only contains equivaraint constants, then |
|
825 |
@{text "\<pi> \<bullet> t = t'"} where @{text "t'"} is equal to @{text "t"} except all really |
|
826 |
free variables @{text x} are replaced by @{text "\<pi> \<bullet> x"}, and all semi-free variables |
|
827 |
@{text "unpermute \<pi> x"} by @{text "x"}. We establish this property by induction |
|
828 |
on the size of HOL-terms, counting terms like @{text "unpermuting \<pi> x"} as leafes, |
|
829 |
like variables and constants. The cases for variables, constants and @{text unpermutes} |
|
830 |
are routine. In the case of abstractions we have by induction hypothesis that |
|
831 |
@{text "\<pi> \<bullet> (t[x := unpermute \<pi> x]) = t'"} with @{text "t'"} satisfying our |
|
832 |
correctness property. This implies that @{text "\<lambda>x. \<pi> \<bullet> (t[x := unpermute \<pi> x]) = \<lambda>x. t'"} |
|
833 |
and hence @{text "\<pi> \<bullet> (\<lambda>x. t) = \<lambda>x. t'"} as needed.\hfill\qed |
|
834 |
\end{proof} |
|
835 |
||
836 |
Pitts calls this property \emph{equivariance principle} (book ref ???). |
|
2744
56b8d977d1c0
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2742
diff
changeset
|
837 |
|
2776 | 838 |
Problems with @{text undefined} |
839 |
||
840 |
Lines of code |
|
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
841 |
*} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
842 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
843 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
844 |
section {* Support and Freshness *} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
845 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
846 |
text {* |
2742 | 847 |
The most original aspect of the nominal logic work of Pitts is a general |
848 |
definition for `the set of free variables, or free atoms, of an object @{text "x"}'. This |
|
849 |
definition is general in the sense that it applies not only to lambda terms, |
|
850 |
but to any type for which a permutation operation is defined |
|
851 |
(like lists, sets, functions and so on). |
|
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
852 |
|
2776 | 853 |
\begin{definition}[Support] \label{support} |
854 |
Given @{text x} is of permutation type, then |
|
2742 | 855 |
|
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
856 |
@{thm [display,indent=10] supp_def[no_vars, THEN eq_reflection]} |
2742 | 857 |
\end{definition} |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
858 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
859 |
\noindent |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
860 |
(Note that due to the definition of swapping in \eqref{swapdef}, we do not |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
861 |
need to explicitly restrict @{text a} and @{text b} to have the same sort.) |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
862 |
There is also the derived notion for when an atom @{text a} is \emph{fresh} |
2742 | 863 |
for an @{text x} of permutation type, defined as |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
864 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
865 |
@{thm [display,indent=10] fresh_def[no_vars]} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
866 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
867 |
\noindent |
2523
e903c32ec24f
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2522
diff
changeset
|
868 |
We also use the notation @{thm (lhs) fresh_star_def[no_vars]} for sets ot atoms |
e903c32ec24f
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2522
diff
changeset
|
869 |
defined as follows |
e903c32ec24f
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2522
diff
changeset
|
870 |
|
e903c32ec24f
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2522
diff
changeset
|
871 |
@{thm [display,indent=10] fresh_star_def[no_vars]} |
e903c32ec24f
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2522
diff
changeset
|
872 |
|
2776 | 873 |
\noindent |
874 |
Using the equivariance principle, it can be easily checked that all three notions |
|
875 |
are equivariant. A simple consequence of the definition of support and equivariance |
|
876 |
is that if @{text x} is equivariant then we have |
|
877 |
||
878 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
879 |
\begin{tabular}{@ {}l} |
|
880 |
@{thm (concl) supp_fun_eqvt[where f="x", no_vars]} |
|
881 |
\end{tabular}\hfill\numbered{suppeqvtfun} |
|
882 |
\end{isabelle} |
|
2742 | 883 |
|
2523
e903c32ec24f
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2522
diff
changeset
|
884 |
\noindent |
2776 | 885 |
For function applications we can establish the following two properties. |
886 |
||
887 |
\begin{lemma}\label{suppfunapp} Let @{text f} and @{text x} be of permutation type, then |
|
888 |
\begin{isabelle} |
|
889 |
\begin{tabular}{r@ {\hspace{4mm}}p{10cm}} |
|
890 |
{\it i)} & @{thm[mode=IfThen] fresh_fun_app[no_vars]}\\ |
|
891 |
{\it ii)} & @{thm supp_fun_app[no_vars]}\\ |
|
892 |
\end{tabular} |
|
893 |
\end{isabelle} |
|
894 |
\end{lemma} |
|
895 |
||
896 |
\begin{proof} |
|
897 |
For the first property, we know from the assumption that @{term |
|
898 |
"finite {b. (a \<rightleftharpoons> b) \<bullet> f \<noteq> f}"} and @{term "finite {b . (a \<rightleftharpoons> b) \<bullet> x \<noteq> |
|
899 |
x}"} hold. That means for all, but finitely many @{text b} we have |
|
900 |
@{term "(a \<rightleftharpoons> b) \<bullet> f = f"} and @{term "(a \<rightleftharpoons> b) \<bullet> x = x"}. Similarly, |
|
901 |
we have to show that for but, but finitely @{text b} the equation |
|
902 |
@{term "(a \<rightleftharpoons> b) \<bullet> f x = f x"} holds. The left-hand side of this |
|
903 |
equation is equal to @{term "((a \<rightleftharpoons> b) \<bullet> f) ((a \<rightleftharpoons> b) \<bullet> x)"} by |
|
904 |
\eqref{permutefunapp}, which we know by the previous two facts for |
|
905 |
@{text f} and @{text x} is equal to the right-hand side for all, |
|
906 |
but finitely many @{text b}. This establishes the first |
|
907 |
property. The second is a simple corollary of {\it i)} by |
|
908 |
unfolding the definition of freshness.\qed |
|
909 |
\end{proof} |
|
910 |
||
911 |
A striking consequence of the definitions for support and freshness |
|
912 |
is that we can prove without knowing anything about the structure of |
|
913 |
@{term x} that swapping two fresh atoms, say @{text a} and @{text |
|
914 |
b}, leave @{text x} unchanged. For the proof we use the following |
|
915 |
lemma about swappings applied to an @{text x}: |
|
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
916 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
917 |
\begin{lemma}\label{swaptriple} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
918 |
Assuming @{text x} is of permutation type, and @{text a}, @{text b} and @{text c} |
2742 | 919 |
have the same sort, then \mbox{@{thm (prem 3) swap_rel_trans[no_vars]}} and |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
920 |
@{thm (prem 4) swap_rel_trans[no_vars]} imply @{thm (concl) swap_rel_trans[no_vars]}. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
921 |
\end{lemma} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
922 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
923 |
\begin{proof} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
924 |
The cases where @{text "a = c"} and @{text "b = c"} are immediate. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
925 |
For the remaining case it is, given our assumptions, easy to calculate |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
926 |
that the permutations |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
927 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
928 |
@{thm [display,indent=10] (concl) swap_triple[no_vars]} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
929 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
930 |
\noindent |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
931 |
are equal. The lemma is then by application of the second permutation |
2776 | 932 |
property shown in~\eqref{newpermprops}.\qed |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
933 |
\end{proof} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
934 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
935 |
\begin{theorem}\label{swapfreshfresh} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
936 |
Let @{text x} be of permutation type. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
937 |
@{thm [mode=IfThen] swap_fresh_fresh[no_vars]} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
938 |
\end{theorem} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
939 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
940 |
\begin{proof} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
941 |
If @{text a} and @{text b} have different sort, then the swapping is the identity. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
942 |
If they have the same sort, we know by definition of support that both |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
943 |
@{term "finite {c. (a \<rightleftharpoons> c) \<bullet> x \<noteq> x}"} and @{term "finite {c. (b \<rightleftharpoons> c) \<bullet> x \<noteq> x}"} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
944 |
hold. So the union of these sets is finite too, and we know by Proposition~\ref{choosefresh} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
945 |
that there is an atom @{term c}, with the same sort as @{term a} and @{term b}, |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
946 |
that satisfies \mbox{@{term "(a \<rightleftharpoons> c) \<bullet> x = x"}} and @{term "(b \<rightleftharpoons> c) \<bullet> x = x"}. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
947 |
Now the theorem follows from Lemma~\ref{swaptriple}.\hfill\qed |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
948 |
\end{proof} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
949 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
950 |
While the abstract properties of support and freshness, particularly |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
951 |
Theorem~\ref{swapfreshfresh}, are useful for developing Nominal Isabelle, |
2776 | 952 |
one often has to calculate the support of concrete objects. |
953 |
For booleans, nats, products and lists it is easy to check that |
|
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
954 |
|
2742 | 955 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
956 |
\begin{tabular}{@ {}l@ {\hspace{4mm}}l@ {}} |
|
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
957 |
@{text "booleans"}: & @{term "supp b = {}"}\\ |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
958 |
@{text "nats"}: & @{term "supp n = {}"}\\ |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
959 |
@{text "products"}: & @{thm supp_Pair[no_vars]}\\ |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
960 |
@{text "lists:"} & @{thm supp_Nil[no_vars]}\\ |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
961 |
& @{thm supp_Cons[no_vars]}\\ |
2742 | 962 |
\end{tabular} |
963 |
\end{isabelle} |
|
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
964 |
|
2776 | 965 |
\noindent |
966 |
hold. Establishing the support of atoms and permutations is a bit |
|
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
967 |
trickier. To do so we will use the following notion about a \emph{supporting set}. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
968 |
|
2742 | 969 |
\begin{definition}[Supporting Set] |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
970 |
A set @{text S} \emph{supports} @{text x} if for all atoms @{text a} and @{text b} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
971 |
not in @{text S} we have @{term "(a \<rightleftharpoons> b) \<bullet> x = x"}. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
972 |
\end{definition} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
973 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
974 |
\noindent |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
975 |
The main motivation for this notion is that we can characterise @{text "supp x"} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
976 |
as the smallest finite set that supports @{text "x"}. For this we prove: |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
977 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
978 |
\begin{lemma}\label{supports} Let @{text x} be of permutation type. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
979 |
\begin{isabelle} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
980 |
\begin{tabular}{r@ {\hspace{4mm}}p{10cm}} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
981 |
i) & @{thm[mode=IfThen] supp_is_subset[no_vars]}\\ |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
982 |
ii) & @{thm[mode=IfThen] supp_supports[no_vars]}\\ |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
983 |
iii) & @{thm (concl) supp_is_least_supports[no_vars]} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
984 |
provided @{thm (prem 1) supp_is_least_supports[no_vars]}, |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
985 |
@{thm (prem 2) supp_is_least_supports[no_vars]} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
986 |
and @{text "S"} is the least such set, that means formally, |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
987 |
for all @{text "S'"}, if @{term "finite S'"} and |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
988 |
@{term "S' supports x"} then @{text "S \<subseteq> S'"}. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
989 |
\end{tabular} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
990 |
\end{isabelle} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
991 |
\end{lemma} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
992 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
993 |
\begin{proof} |
2776 | 994 |
For {\it i)} we derive a contradiction by assuming there is an atom @{text a} |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
995 |
with @{term "a \<in> supp x"} and @{text "a \<notin> S"}. Using the second fact, the |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
996 |
assumption that @{term "S supports x"} gives us that @{text S} is a superset of |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
997 |
@{term "{b. (a \<rightleftharpoons> b) \<bullet> x \<noteq> x}"}, which is finite by the assumption of @{text S} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
998 |
being finite. But this means @{term "a \<notin> supp x"}, contradicting our assumption. |
2776 | 999 |
Property {\it ii)} is by a direct application of |
1000 |
Theorem~\ref{swapfreshfresh}. For the last property, part {\it i)} proves |
|
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1001 |
one ``half'' of the claimed equation. The other ``half'' is by property |
2776 | 1002 |
{\it ii)} and the fact that @{term "supp x"} is finite by {\it i)}.\hfill\qed |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1003 |
\end{proof} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1004 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1005 |
\noindent |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1006 |
These are all relatively straightforward proofs adapted from the existing |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1007 |
nominal logic work. However for establishing the support of atoms and |
2776 | 1008 |
permutations we found the following `optimised' variant of {\it iii)} |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1009 |
more useful: |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1010 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1011 |
\begin{lemma}\label{optimised} Let @{text x} be of permutation type. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1012 |
We have that @{thm (concl) finite_supp_unique[no_vars]} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1013 |
provided @{thm (prem 1) finite_supp_unique[no_vars]}, |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1014 |
@{thm (prem 2) finite_supp_unique[no_vars]}, and for |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1015 |
all @{text "a \<in> S"} and all @{text "b \<notin> S"}, with @{text a} |
1809
08e4d3cbcf8c
folded changes from the conference version
Christian Urban <urbanc@in.tum.de>
parents:
1790
diff
changeset
|
1016 |
and @{text b} having the same sort, \mbox{@{term "(a \<rightleftharpoons> b) \<bullet> x \<noteq> x"}} |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1017 |
\end{lemma} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1018 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1019 |
\begin{proof} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1020 |
By Lemma \ref{supports}@{text ".iii)"} we have to show that for every finite |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1021 |
set @{text S'} that supports @{text x}, \mbox{@{text "S \<subseteq> S'"}} holds. We will |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1022 |
assume that there is an atom @{text "a"} that is element of @{text S}, but |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1023 |
not @{text "S'"} and derive a contradiction. Since both @{text S} and |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1024 |
@{text S'} are finite, we can by Proposition \ref{choosefresh} obtain an atom |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1025 |
@{text b}, which has the same sort as @{text "a"} and for which we know |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1026 |
@{text "b \<notin> S"} and @{text "b \<notin> S'"}. Since we assumed @{text "a \<notin> S'"} and |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1027 |
we have that @{text "S' supports x"}, we have on one hand @{term "(a \<rightleftharpoons> b) \<bullet> x |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1028 |
= x"}. On the other hand, the fact @{text "a \<in> S"} and @{text "b \<notin> S"} imply |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1029 |
@{term "(a \<rightleftharpoons> b) \<bullet> x \<noteq> x"} using the assumed implication. This gives us the |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1030 |
contradiction.\hfill\qed |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1031 |
\end{proof} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1032 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1033 |
\noindent |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1034 |
Using this lemma we only have to show the following three proof-obligations |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1035 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1036 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1037 |
\begin{tabular}{@ {}r@ {\hspace{4mm}}l} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1038 |
i) & @{term "{c} supports c"}\\ |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1039 |
ii) & @{term "finite {c}"}\\ |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1040 |
iii) & @{text "\<forall>a \<in> {c} b \<notin> {c}. sort a = sort b \<longrightarrow> (a b) \<bullet> c \<noteq> c"} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1041 |
\end{tabular} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1042 |
\end{isabelle} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1043 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1044 |
\noindent |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1045 |
in order to establish that @{thm supp_atom[where a="c", no_vars]} holds. In |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1046 |
Isabelle/HOL these proof-obligations can be discharged by easy |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1047 |
simplifications. Similar proof-obligations arise for the support of |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1048 |
permutations, which is |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1049 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1050 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1051 |
\begin{tabular}{@ {}l} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1052 |
@{thm supp_perm[where p="\<pi>", no_vars]} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1053 |
\end{tabular} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1054 |
\end{isabelle} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1055 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1056 |
\noindent |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1057 |
The only proof-obligation that is |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1058 |
interesting is the one where we have to show that |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1059 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1060 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1061 |
\begin{tabular}{@ {}l} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1062 |
@{text "If \<pi> \<bullet> a \<noteq> a, \<pi> \<bullet> b = b and sort a = sort b, then (a b) \<bullet> \<pi> \<noteq> \<pi>"}. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1063 |
\end{tabular} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1064 |
\end{isabelle} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1065 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1066 |
\noindent |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1067 |
For this we observe that |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1068 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1069 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1070 |
\begin{tabular}{@ {}rcl} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1071 |
@{thm (lhs) perm_swap_eq[where p="\<pi>", no_vars]} & |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1072 |
if and only if & |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1073 |
@{thm (rhs) perm_swap_eq[where p="\<pi>", no_vars]} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1074 |
\end{tabular} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1075 |
\end{isabelle} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1076 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1077 |
\noindent |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1078 |
holds by a simple calculation using the group properties of permutations. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1079 |
The proof-obligation can then be discharged by analysing the inequality |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1080 |
between the permutations @{term "(\<pi> \<bullet> a \<rightleftharpoons> b)"} and @{term "(a \<rightleftharpoons> b)"}. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1081 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1082 |
The main point about support is that whenever an object @{text x} has finite |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1083 |
support, then Proposition~\ref{choosefresh} allows us to choose for @{text x} a |
2776 | 1084 |
fresh atom with arbitrary sort. This is a crucial operation in Nominal |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1085 |
Isabelle in situations where, for example, a bound variable needs to be |
2523
e903c32ec24f
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2522
diff
changeset
|
1086 |
renamed. To allow such a choice, we only have to assume that |
e903c32ec24f
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2522
diff
changeset
|
1087 |
@{text "finite (supp x)"} holds. For more convenience we |
2776 | 1088 |
can define a type class in Isabelle/HOL corresponding to the |
1089 |
property: |
|
1090 |
||
1091 |
\begin{definition}[Finitely Supported Type] |
|
1092 |
A type @{text "\<beta>"} is \emph{finitely supported} if @{term "finite (supp x)"} |
|
1093 |
holds for all @{text x} of type @{text "\<beta>"}. |
|
1094 |
\end{definition} |
|
1095 |
||
1096 |
\noindent |
|
1097 |
By the calculations above we can easily establish |
|
1098 |
||
1099 |
\begin{theorem}\label{finsuptype} |
|
1100 |
The types @{type atom}, @{type perm}, @{type bool} and @{type nat} |
|
1101 |
are fintitely supported, and assuming @{text \<beta>}, @{text "\<beta>\<^isub>1"} and |
|
1102 |
@{text "\<beta>\<^isub>2"} are finitely supported types, then @{text "\<beta> list"} and |
|
1103 |
@{text "\<beta>\<^isub>1 \<times> \<beta>\<^isub>2"} are finitely supported. |
|
1104 |
\end{theorem} |
|
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1105 |
|
2776 | 1106 |
\noindent |
1107 |
The main benefit of using the finite support property for choosing a |
|
1108 |
fresh atom is that the reasoning is `compositional'. To see this, |
|
1109 |
assume we have a list of atoms and a method of choosing a fresh atom |
|
1110 |
that is not a member in this list---for example the maximum plus |
|
1111 |
one. Then if we enlarge this list \emph{after} the choice, then |
|
1112 |
obviously the fresh atom might not be fresh anymore. In contrast, by |
|
1113 |
the classical reasoning of Proposition~\ref{choosefresh} we know a |
|
1114 |
fresh atom exists for every list of atoms and no matter how we |
|
1115 |
extend this list of atoms, we always preserve the property of being |
|
1116 |
finitely supported. Consequently the existence of a fresh atom is |
|
1117 |
still guarantied by Proposition~\ref{choosefresh}. Using the method |
|
1118 |
of `maximum plus one' we might have to adapt the choice of a fresh |
|
1119 |
atom. |
|
1120 |
||
1121 |
Unfortunately, Theorem~\ref{finsuptype} does not work in general for the |
|
1122 |
types of sets and functions. There are functions definable in HOL |
|
1123 |
for which the finite support property does not hold. A simple |
|
1124 |
example of a function with infinite support is @{const nat_of} shown |
|
1125 |
in \eqref{sortnatof}. This function's support is the set of |
|
1126 |
\emph{all} atoms @{term "UNIV::atom set"}. To establish this we |
|
1127 |
show @{term "\<not> a \<sharp> nat_of"}. This is equivalent to assuming the set |
|
1128 |
@{term "{b. (a \<rightleftharpoons> b) \<bullet> nat_of \<noteq> nat_of}"} is finite and deriving a |
|
1129 |
contradiction. From the assumption we also know that @{term "{a} \<union> |
|
1130 |
{b. (a \<rightleftharpoons> b) \<bullet> nat_of \<noteq> nat_of}"} is finite. Then we can use |
|
1131 |
Proposition~\ref{choosefresh} to choose an atom @{text c} such that |
|
1132 |
@{term "c \<noteq> a"}, @{term "sort_of c = sort_of a"} and @{term "(a \<rightleftharpoons> c) |
|
1133 |
\<bullet> nat_of = nat_of"}. Now we can reason as follows: |
|
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1134 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1135 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1136 |
\begin{tabular}[b]{@ {}rcl@ {\hspace{5mm}}l} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1137 |
@{text "nat_of a"} & @{text "="} & @{text "(a \<rightleftharpoons> c) \<bullet> (nat_of a)"} & by def.~of permutations on nats\\ |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1138 |
& @{text "="} & @{term "((a \<rightleftharpoons> c) \<bullet> nat_of) ((a \<rightleftharpoons> c) \<bullet> a)"} & by \eqref{permutefunapp}\\ |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1139 |
& @{text "="} & @{term "nat_of c"} & by assumptions on @{text c}\\ |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1140 |
\end{tabular} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1141 |
\end{isabelle} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1142 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1143 |
\noindent |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1144 |
But this means we have that @{term "nat_of a = nat_of c"} and @{term "sort_of a = sort_of c"}. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1145 |
This implies that atoms @{term a} and @{term c} must be equal, which clashes with our |
2742 | 1146 |
assumption @{term "c \<noteq> a"} about how we chose @{text c}.\footnote{Cheney \cite{Cheney06} |
1147 |
gives similar examples for constructions that have infinite support.} |
|
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1148 |
*} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1149 |
|
2033
74bd7bfb484b
some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents:
2005
diff
changeset
|
1150 |
section {* Support of Finite Sets *} |
74bd7bfb484b
some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents:
2005
diff
changeset
|
1151 |
|
74bd7bfb484b
some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents:
2005
diff
changeset
|
1152 |
text {* |
2776 | 1153 |
Also the set type is an instance whose elements are not generally finitely |
2742 | 1154 |
supported (we will give an example in Section~\ref{concrete}). |
1155 |
However, we can easily show that finite sets and co-finite sets of atoms are finitely |
|
2776 | 1156 |
supported. Their support can be characterised as: |
2033
74bd7bfb484b
some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents:
2005
diff
changeset
|
1157 |
|
2776 | 1158 |
\begin{lemma}\label{finatomsets} |
1159 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
1160 |
\begin{tabular}[b]{@ {}rl} |
|
1161 |
{\it i)} & If @{text S} is a finite set of atoms, then @{thm (concl) supp_finite_atom_set[no_vars]}.\\ |
|
1162 |
{\it ii)} & If @{term "UNIV - (S::atom set)"} is a finite set of atoms, then |
|
2742 | 1163 |
@{thm (concl) supp_cofinite_atom_set[no_vars]}. |
2776 | 1164 |
\end{tabular} |
1165 |
\end{isabelle} |
|
2033
74bd7bfb484b
some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents:
2005
diff
changeset
|
1166 |
\end{lemma} |
74bd7bfb484b
some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents:
2005
diff
changeset
|
1167 |
|
74bd7bfb484b
some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents:
2005
diff
changeset
|
1168 |
\begin{proof} |
2742 | 1169 |
Both parts can be easily shown by Lemma~\ref{optimised}. We only have to observe |
1170 |
that a swapping @{text "(a b)"} leaves a set @{text S} unchanged provided both |
|
1171 |
@{text a} and @{text b} are elements in @{text S} or both are not in @{text S}. |
|
1172 |
However if the sorts of a @{text a} and @{text b} agree, then the swapping will |
|
1173 |
change @{text S} if either of them is an element in @{text S} and the other is |
|
1174 |
not.\hfill\qed |
|
2033
74bd7bfb484b
some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents:
2005
diff
changeset
|
1175 |
\end{proof} |
74bd7bfb484b
some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents:
2005
diff
changeset
|
1176 |
|
2523
e903c32ec24f
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2522
diff
changeset
|
1177 |
\noindent |
2742 | 1178 |
Note that a consequence of the second part of this lemma is that |
1179 |
@{term "supp (UNIV::atom set) = {}"}. |
|
2523
e903c32ec24f
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2522
diff
changeset
|
1180 |
More difficult, however, is it to establish that finite sets of finitely |
2742 | 1181 |
supported objects are finitely supported. For this we first show that |
2776 | 1182 |
the union of the supports of finitely many and finitely supported objects |
2742 | 1183 |
is finite, namely |
1184 |
||
1185 |
\begin{lemma}\label{unionsupp} |
|
2776 | 1186 |
If @{text S} is a finite set whose elements are all finitely supported, then |
1187 |
% |
|
1188 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
1189 |
\begin{tabular}[b]{@ {}rl} |
|
1190 |
{\it i)} & @{thm (concl) Union_of_finite_supp_sets[no_vars]} and\\ |
|
1191 |
{\it ii)} & @{thm (concl) Union_included_in_supp[no_vars]}. |
|
1192 |
\end{tabular} |
|
1193 |
\end{isabelle} |
|
2742 | 1194 |
\end{lemma} |
1195 |
||
1196 |
\begin{proof} |
|
2776 | 1197 |
The first part is by a straightforward induction on the finiteness |
1198 |
of @{text S}. For the second part, we know that @{term "\<Union>x\<in>S. supp |
|
1199 |
x"} is a set of atoms, which by the first part is finite. Therefore |
|
1200 |
we know by Lemma~\ref{finatomsets}.{\it i)} that @{term "(\<Union>x\<in>S. supp |
|
1201 |
x) = supp (\<Union>x\<in>S. supp x)"}. Taking @{text "f"} to be the function |
|
1202 |
\mbox{@{text "\<lambda>S. \<Union> (supp ` S)"}}, we can write the right-hand side |
|
1203 |
as @{text "supp (f S)"}. Since @{text "f"} is an equivariant |
|
1204 |
function (can be easily checked by the equivariance principle), we |
|
1205 |
have that @{text "supp (f S) \<subseteq> supp S"} by |
|
1206 |
Lemma~\ref{suppfunapp}.{\it ii)}. This completes the second |
|
1207 |
part.\hfill\qed |
|
2742 | 1208 |
\end{proof} |
1209 |
||
1210 |
\noindent |
|
1211 |
With this lemma in place we can establish that |
|
1212 |
||
1213 |
\begin{lemma} |
|
1214 |
@{thm[mode=IfThen] supp_of_finite_sets[no_vars]} |
|
1215 |
\end{lemma} |
|
1216 |
||
1217 |
\begin{proof} |
|
2776 | 1218 |
The right-to-left inclusion is proved in Lemma~\ref{unionsupp}.{\it ii)}. To show the inclusion |
1219 |
in the other direction we can use Lemma~\ref{supports}.{\it i)}. This means |
|
1220 |
for all @{text a} and @{text b} that are not in @{text S} we have to show that |
|
1221 |
@{term "(a \<rightleftharpoons> b) \<bullet> (\<Union>x \<in> S. supp x) = (\<Union>x \<in> S. supp x)"} holds. By the equivariance |
|
1222 |
principle, the left-hand side is equal to @{term "\<Union>x \<in> ((a \<rightleftharpoons> b) \<bullet> S). supp x"}. Now |
|
1223 |
the swapping in front of @{text S} disappears, since @{term "a \<sharp> S"} and @{term "b \<sharp> S"} |
|
1224 |
whenever @{text "a, b \<notin> S"}. Thus we are done.\hfill\qed |
|
2742 | 1225 |
\end{proof} |
2776 | 1226 |
|
1227 |
\noindent |
|
1228 |
To sum up, every finite set of finitely supported elements has |
|
1229 |
finite support. Unfortunately, we cannot use |
|
1230 |
Theorem~\ref{finsuptype} to let Isabelle/HOL find this out |
|
1231 |
automatically. This would require to introduce a separate type of |
|
1232 |
finite sets, which however is not so convenient to reason about as |
|
1233 |
Isabelle's standard set type. |
|
2033
74bd7bfb484b
some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents:
2005
diff
changeset
|
1234 |
*} |
74bd7bfb484b
some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents:
2005
diff
changeset
|
1235 |
|
74bd7bfb484b
some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents:
2005
diff
changeset
|
1236 |
|
2776 | 1237 |
section {* Induction Principles for Permutations *} |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1238 |
|
2033
74bd7bfb484b
some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents:
2005
diff
changeset
|
1239 |
text {* |
74bd7bfb484b
some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents:
2005
diff
changeset
|
1240 |
While the use of functions as permutation provides us with a unique |
2776 | 1241 |
representation for permutations (for example @{term "(a \<rightleftharpoons> b)"} and |
1242 |
@{term "(b \<rightleftharpoons> a)"} are equal permutations), this representation does |
|
1243 |
not come automatically with an induction principle. Such an |
|
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
1244 |
induction principle is however useful for generalising |
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
1245 |
Lemma~\ref{swapfreshfresh} from swappings to permutations, namely |
2033
74bd7bfb484b
some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents:
2005
diff
changeset
|
1246 |
|
2776 | 1247 |
\begin{lemma} |
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
1248 |
@{thm [mode=IfThen] perm_supp_eq[where p="\<pi>", no_vars]} |
2776 | 1249 |
\end{lemma} |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1250 |
|
2033
74bd7bfb484b
some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents:
2005
diff
changeset
|
1251 |
\noindent |
2776 | 1252 |
In this section we will establish an induction principle for permutations |
1253 |
with which this lemma can be easily proved. It is not too difficult to derive |
|
1254 |
an induction principle for permutations, given the fact that we allow only |
|
1255 |
permutations having a finite support. |
|
1256 |
||
1257 |
Using a the property from \cite{???} |
|
1258 |
||
1259 |
\begin{lemma}\label{smallersupp} |
|
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
parents:
2783
diff
changeset
|
1260 |
@{thm [mode=IfThen] smaller_supp[where p="\<pi>", no_vars]} |
2776 | 1261 |
\end{lemma} |
2033
74bd7bfb484b
some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents:
2005
diff
changeset
|
1262 |
*} |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1263 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1264 |
|
2522
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1265 |
section {* An Abstraction Type *} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1266 |
|
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1267 |
text {* |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1268 |
To that end, we will consider |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1269 |
first pairs @{text "(as, x)"} of type @{text "(atom set) \<times> \<beta>"}. These pairs |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1270 |
are intended to represent the abstraction, or binding, of the set of atoms @{text |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1271 |
"as"} in the body @{text "x"}. |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1272 |
|
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1273 |
The first question we have to answer is when two pairs @{text "(as, x)"} and |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1274 |
@{text "(bs, y)"} are $\alpha$-equivalent? (For the moment we are interested in |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1275 |
the notion of $\alpha$-equivalence that is \emph{not} preserved by adding |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1276 |
vacuous binders.) To answer this question, we identify four conditions: {\it (i)} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1277 |
given a free-atom function @{text "fa"} of type \mbox{@{text "\<beta> \<Rightarrow> atom |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1278 |
set"}}, then @{text x} and @{text y} need to have the same set of free |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1279 |
atoms; moreover there must be a permutation @{text p} such that {\it |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1280 |
(ii)} @{text p} leaves the free atoms of @{text x} and @{text y} unchanged, but |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1281 |
{\it (iii)} ``moves'' their bound names so that we obtain modulo a relation, |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1282 |
say \mbox{@{text "_ R _"}}, two equivalent terms. We also require that {\it (iv)} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1283 |
@{text p} makes the sets of abstracted atoms @{text as} and @{text bs} equal. The |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1284 |
requirements {\it (i)} to {\it (iv)} can be stated formally as follows: |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1285 |
% |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1286 |
\begin{equation}\label{alphaset} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1287 |
\begin{array}{@ {\hspace{10mm}}r@ {\hspace{2mm}}l@ {\hspace{4mm}}r} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1288 |
\multicolumn{3}{l}{@{text "(as, x) \<approx>set R fa p (bs, y)"}\hspace{2mm}@{text "\<equiv>"}}\\[1mm] |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1289 |
& @{term "fa(x) - as = fa(y) - bs"} & \mbox{\it (i)}\\ |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1290 |
@{text "\<and>"} & @{term "(fa(x) - as) \<sharp>* p"} & \mbox{\it (ii)}\\ |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1291 |
@{text "\<and>"} & @{text "(p \<bullet> x) R y"} & \mbox{\it (iii)}\\ |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1292 |
@{text "\<and>"} & @{term "(p \<bullet> as) = bs"} & \mbox{\it (iv)}\\ |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1293 |
\end{array} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1294 |
\end{equation} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1295 |
|
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1296 |
\noindent |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1297 |
Note that this relation depends on the permutation @{text |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1298 |
"p"}; $\alpha$-equivalence between two pairs is then the relation where we |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1299 |
existentially quantify over this @{text "p"}. Also note that the relation is |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1300 |
dependent on a free-atom function @{text "fa"} and a relation @{text |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1301 |
"R"}. The reason for this extra generality is that we will use |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1302 |
$\approx_{\,\textit{set}}$ for both ``raw'' terms and $\alpha$-equated terms. In |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1303 |
the latter case, @{text R} will be replaced by equality @{text "="} and we |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1304 |
will prove that @{text "fa"} is equal to @{text "supp"}. |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1305 |
|
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1306 |
It might be useful to consider first some examples about how these definitions |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1307 |
of $\alpha$-equivalence pan out in practice. For this consider the case of |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1308 |
abstracting a set of atoms over types (as in type-schemes). We set |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1309 |
@{text R} to be the usual equality @{text "="} and for @{text "fa(T)"} we |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1310 |
define |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1311 |
|
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1312 |
\begin{center} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1313 |
@{text "fa(x) = {x}"} \hspace{5mm} @{text "fa(T\<^isub>1 \<rightarrow> T\<^isub>2) = fa(T\<^isub>1) \<union> fa(T\<^isub>2)"} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1314 |
\end{center} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1315 |
|
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1316 |
\noindent |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1317 |
Now recall the examples shown in \eqref{ex1}, \eqref{ex2} and |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1318 |
\eqref{ex3}. It can be easily checked that @{text "({x, y}, x \<rightarrow> y)"} and |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1319 |
@{text "({y, x}, y \<rightarrow> x)"} are $\alpha$-equivalent according to |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1320 |
$\approx_{\,\textit{set}}$ and $\approx_{\,\textit{res}}$ by taking @{text p} to |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1321 |
be the swapping @{term "(x \<rightleftharpoons> y)"}. In case of @{text "x \<noteq> y"}, then @{text |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1322 |
"([x, y], x \<rightarrow> y)"} $\not\approx_{\,\textit{list}}$ @{text "([y, x], x \<rightarrow> y)"} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1323 |
since there is no permutation that makes the lists @{text "[x, y]"} and |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1324 |
@{text "[y, x]"} equal, and also leaves the type \mbox{@{text "x \<rightarrow> y"}} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1325 |
unchanged. Another example is @{text "({x}, x)"} $\approx_{\,\textit{res}}$ |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1326 |
@{text "({x, y}, x)"} which holds by taking @{text p} to be the identity |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1327 |
permutation. However, if @{text "x \<noteq> y"}, then @{text "({x}, x)"} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1328 |
$\not\approx_{\,\textit{set}}$ @{text "({x, y}, x)"} since there is no |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1329 |
permutation that makes the sets @{text "{x}"} and @{text "{x, y}"} equal |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1330 |
(similarly for $\approx_{\,\textit{list}}$). It can also relatively easily be |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1331 |
shown that all three notions of $\alpha$-equivalence coincide, if we only |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1332 |
abstract a single atom. |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1333 |
|
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1334 |
In the rest of this section we are going to introduce three abstraction |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1335 |
types. For this we define |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1336 |
% |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1337 |
\begin{equation} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1338 |
@{term "abs_set (as, x) (bs, x) \<equiv> \<exists>p. alpha_set (as, x) equal supp p (bs, x)"} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1339 |
\end{equation} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1340 |
|
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1341 |
\noindent |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1342 |
(similarly for $\approx_{\,\textit{abs\_res}}$ |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1343 |
and $\approx_{\,\textit{abs\_list}}$). We can show that these relations are equivalence |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1344 |
relations and equivariant. |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1345 |
|
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1346 |
\begin{lemma}\label{alphaeq} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1347 |
The relations $\approx_{\,\textit{abs\_set}}$, $\approx_{\,\textit{abs\_list}}$ |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1348 |
and $\approx_{\,\textit{abs\_res}}$ are equivalence relations, and if @{term |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1349 |
"abs_set (as, x) (bs, y)"} then also @{term "abs_set (p \<bullet> as, p \<bullet> x) (p \<bullet> |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1350 |
bs, p \<bullet> y)"} (similarly for the other two relations). |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1351 |
\end{lemma} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1352 |
|
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1353 |
\begin{proof} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1354 |
Reflexivity is by taking @{text "p"} to be @{text "0"}. For symmetry we have |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1355 |
a permutation @{text p} and for the proof obligation take @{term "-p"}. In case |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1356 |
of transitivity, we have two permutations @{text p} and @{text q}, and for the |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1357 |
proof obligation use @{text "q + p"}. All conditions are then by simple |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1358 |
calculations. |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1359 |
\end{proof} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1360 |
|
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1361 |
\noindent |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1362 |
This lemma allows us to use our quotient package for introducing |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1363 |
new types @{text "\<beta> abs_set"}, @{text "\<beta> abs_res"} and @{text "\<beta> abs_list"} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1364 |
representing $\alpha$-equivalence classes of pairs of type |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1365 |
@{text "(atom set) \<times> \<beta>"} (in the first two cases) and of type @{text "(atom list) \<times> \<beta>"} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1366 |
(in the third case). |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1367 |
The elements in these types will be, respectively, written as: |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1368 |
|
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1369 |
\begin{center} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1370 |
@{term "Abs_set as x"} \hspace{5mm} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1371 |
@{term "Abs_res as x"} \hspace{5mm} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1372 |
@{term "Abs_lst as x"} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1373 |
\end{center} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1374 |
|
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1375 |
\noindent |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1376 |
indicating that a set (or list) of atoms @{text as} is abstracted in @{text x}. We will |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1377 |
call the types \emph{abstraction types} and their elements |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1378 |
\emph{abstractions}. The important property we need to derive is the support of |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1379 |
abstractions, namely: |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1380 |
|
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1381 |
\begin{theorem}[Support of Abstractions]\label{suppabs} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1382 |
Assuming @{text x} has finite support, then\\[-6mm] |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1383 |
\begin{center} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1384 |
\begin{tabular}{l@ {\hspace{2mm}}c@ {\hspace{2mm}}l} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1385 |
%@ {thm (lhs) supp_abs(1)[no_vars]} & $=$ & @ {thm (rhs) supp_abs(1)[no_vars]}\\ |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1386 |
%@ {thm (lhs) supp_abs(2)[no_vars]} & $=$ & @ {thm (rhs) supp_abs(2)[no_vars]}\\ |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1387 |
%@ {thm (lhs) supp_abs(3)[where bs="as", no_vars]} & $=$ & @ {thm (rhs) supp_abs(3)[where bs="as", no_vars]} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1388 |
\end{tabular} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1389 |
\end{center} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1390 |
\end{theorem} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1391 |
|
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1392 |
\noindent |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1393 |
Below we will show the first equation. The others |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1394 |
follow by similar arguments. By definition of the abstraction type @{text "abs_set"} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1395 |
we have |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1396 |
% |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1397 |
\begin{equation}\label{abseqiff} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1398 |
%@ {thm (lhs) abs_eq_iff(1)[where bs="as" and cs="bs", no_vars]} \;\;\text{if and only if}\;\; |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1399 |
%@ {thm (rhs) abs_eq_iff(1)[where bs="as" and cs="bs", no_vars]} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1400 |
\end{equation} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1401 |
|
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1402 |
\noindent |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1403 |
and also |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1404 |
% |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1405 |
\begin{equation}\label{absperm} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1406 |
@{thm permute_Abs[no_vars]} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1407 |
\end{equation} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1408 |
|
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1409 |
\noindent |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1410 |
The second fact derives from the definition of permutations acting on pairs |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1411 |
\eqref{permute} and $\alpha$-equivalence being equivariant |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1412 |
(see Lemma~\ref{alphaeq}). With these two facts at our disposal, we can show |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1413 |
the following lemma about swapping two atoms in an abstraction. |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1414 |
|
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1415 |
\begin{lemma} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1416 |
%@ {thm[mode=IfThen] abs_swap1(1)[where bs="as", no_vars]} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1417 |
\end{lemma} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1418 |
|
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1419 |
\begin{proof} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1420 |
This lemma is straightforward using \eqref{abseqiff} and observing that |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1421 |
the assumptions give us @{term "(a \<rightleftharpoons> b) \<bullet> (supp x - as) = (supp x - as)"}. |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1422 |
Moreover @{text supp} and set difference are equivariant (see \cite{HuffmanUrban10}). |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1423 |
\end{proof} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1424 |
|
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1425 |
\noindent |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1426 |
Assuming that @{text "x"} has finite support, this lemma together |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1427 |
with \eqref{absperm} allows us to show |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1428 |
% |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1429 |
\begin{equation}\label{halfone} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1430 |
%@ {thm abs_supports(1)[no_vars]} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1431 |
\end{equation} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1432 |
|
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1433 |
\noindent |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1434 |
which by Property~\ref{supportsprop} gives us ``one half'' of |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1435 |
Theorem~\ref{suppabs}. The ``other half'' is a bit more involved. To establish |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1436 |
it, we use a trick from \cite{Pitts04} and first define an auxiliary |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1437 |
function @{text aux}, taking an abstraction as argument: |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1438 |
% |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1439 |
\begin{center} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1440 |
@{thm supp_set.simps[THEN eq_reflection, no_vars]} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1441 |
\end{center} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1442 |
|
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1443 |
\noindent |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1444 |
Using the second equation in \eqref{equivariance}, we can show that |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1445 |
@{text "aux"} is equivariant (since @{term "p \<bullet> (supp x - as) = |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1446 |
(supp (p \<bullet> x)) - (p \<bullet> as)"}) and therefore has empty support. |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1447 |
This in turn means |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1448 |
% |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1449 |
\begin{center} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1450 |
@{term "supp (supp_gen (Abs_set as x)) \<subseteq> supp (Abs_set as x)"} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1451 |
\end{center} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1452 |
|
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1453 |
\noindent |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1454 |
using \eqref{suppfun}. Assuming @{term "supp x - as"} is a finite set, |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1455 |
we further obtain |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1456 |
% |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1457 |
\begin{equation}\label{halftwo} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1458 |
%@ {thm (concl) supp_abs_subset1(1)[no_vars]} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1459 |
\end{equation} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1460 |
|
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1461 |
\noindent |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1462 |
since for finite sets of atoms, @{text "bs"}, we have |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1463 |
@{thm (concl) supp_finite_atom_set[where S="bs", no_vars]}. |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1464 |
Finally, taking \eqref{halfone} and \eqref{halftwo} together establishes |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1465 |
Theorem~\ref{suppabs}. |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1466 |
|
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1467 |
The method of first considering abstractions of the |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1468 |
form @{term "Abs_set as x"} etc is motivated by the fact that |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1469 |
we can conveniently establish at the Isabelle/HOL level |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1470 |
properties about them. It would be |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1471 |
laborious to write custom ML-code that derives automatically such properties |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1472 |
for every term-constructor that binds some atoms. Also the generality of |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1473 |
the definitions for $\alpha$-equivalence will help us in the next section. |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1474 |
*} |
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1475 |
|
0cb0c88b2cad
added a section about abstractions
Christian Urban <urbanc@in.tum.de>
parents:
2521
diff
changeset
|
1476 |
|
2742 | 1477 |
section {* Concrete Atom Types\label{concrete} *} |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1478 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1479 |
text {* |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1480 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1481 |
So far, we have presented a system that uses only a single multi-sorted atom |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1482 |
type. This design gives us the flexibility to define operations and prove |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1483 |
theorems that are generic with respect to atom sorts. For example, as |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1484 |
illustrated above the @{term supp} function returns a set that includes the |
2776 | 1485 |
free atoms of \emph{all} sorts together. |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1486 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1487 |
However, the single multi-sorted atom type does not make an ideal interface |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1488 |
for end-users of Nominal Isabelle. If sorts are not distinguished by |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1489 |
Isabelle's type system, users must reason about atom sorts manually. That |
2776 | 1490 |
means for example that subgoals involving sorts must be discharged explicitly within proof |
1491 |
scripts, instead of being inferred automatically. In other |
|
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1492 |
cases, lemmas might require additional side conditions about sorts to be true. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1493 |
For example, swapping @{text a} and @{text b} in the pair \mbox{@{term "(a, |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1494 |
b)"}} will only produce the expected result if we state the lemma in |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1495 |
Isabelle/HOL as: |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1496 |
*} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1497 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1498 |
lemma |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1499 |
fixes a b :: "atom" |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1500 |
assumes asm: "sort a = sort b" |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1501 |
shows "(a \<rightleftharpoons> b) \<bullet> (a, b) = (b, a)" |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1502 |
using asm by simp |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1503 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1504 |
text {* |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1505 |
\noindent |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1506 |
Fortunately, it is possible to regain most of the type-checking automation |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1507 |
that is lost by moving to a single atom type. We accomplish this by defining |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1508 |
\emph{subtypes} of the generic atom type that only include atoms of a single |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1509 |
specific sort. We call such subtypes \emph{concrete atom types}. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1510 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1511 |
The following Isabelle/HOL command defines a concrete atom type called |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1512 |
\emph{name}, which consists of atoms whose sort equals the string @{term |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1513 |
"''name''"}. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1514 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1515 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1516 |
\isacommand{typedef}\ \ @{typ name} = @{term "{a. sort\<iota> a = ''name''}"} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1517 |
\end{isabelle} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1518 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1519 |
\noindent |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1520 |
This command automatically generates injective functions that map from the |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1521 |
concrete atom type into the generic atom type and back, called |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1522 |
representation and abstraction functions, respectively. We will write these |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1523 |
functions as follows: |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1524 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1525 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1526 |
\begin{tabular}{@ {}l@ {\hspace{10mm}}l} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1527 |
@{text "\<lfloor>_\<rfloor> :: name \<Rightarrow> atom"} & |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1528 |
@{text "\<lceil>_\<rceil> :: atom \<Rightarrow> name"} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1529 |
\end{tabular} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1530 |
\end{isabelle} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1531 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1532 |
\noindent |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1533 |
With the definition @{thm permute_name_def [where p="\<pi>", THEN |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1534 |
eq_reflection, no_vars]}, it is straightforward to verify that the type |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1535 |
@{typ name} is a permutation type. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1536 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1537 |
In order to reason uniformly about arbitrary concrete atom types, we define a |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1538 |
type class that characterises type @{typ name} and other similarly-defined |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1539 |
types. The definition of the concrete atom type class is as follows: First, |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1540 |
every concrete atom type must be a permutation type. In addition, the class |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1541 |
defines an overloaded function that maps from the concrete type into the |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1542 |
generic atom type, which we will write @{text "|_|"}. For each class |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1543 |
instance, this function must be injective and equivariant, and its outputs |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1544 |
must all have the same sort, that is |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1545 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1546 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
2776 | 1547 |
\begin{tabular}{@ {}r@ {\hspace{3mm}}l} |
1548 |
i) & if @{thm (lhs) atom_eq_iff [no_vars]} then @{thm (rhs) atom_eq_iff [no_vars]}\\ |
|
1549 |
ii) & @{thm atom_eqvt[where p="\<pi>", no_vars]}\\ |
|
1550 |
iii) & @{thm sort_of_atom_eq [no_vars]} |
|
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1551 |
\end{tabular}\hfill\numbered{atomprops} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1552 |
\end{isabelle} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1553 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1554 |
\noindent |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1555 |
With the definition @{thm atom_name_def [THEN eq_reflection, no_vars]} we can |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1556 |
show that @{typ name} satisfies all the above requirements of a concrete atom |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1557 |
type. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1558 |
|
2776 | 1559 |
The whole point of defining the concrete atom type class is to let users |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1560 |
avoid explicit reasoning about sorts. This benefit is realised by defining a |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1561 |
special swapping operation of type @{text "\<alpha> \<Rightarrow> \<alpha> |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1562 |
\<Rightarrow> perm"}, where @{text "\<alpha>"} is a concrete atom type: |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1563 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1564 |
@{thm [display,indent=10] flip_def [THEN eq_reflection, no_vars]} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1565 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1566 |
\noindent |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1567 |
As a consequence of its type, the @{text "\<leftrightarrow>"}-swapping |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1568 |
operation works just like the generic swapping operation, but it does not |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1569 |
require any sort-checking side conditions---the sort-correctness is ensured by |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1570 |
the types! For @{text "\<leftrightarrow>"} we can establish the following |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1571 |
simplification rule: |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1572 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1573 |
@{thm [display,indent=10] permute_flip_at[no_vars]} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1574 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1575 |
\noindent |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1576 |
If we now want to swap the \emph{concrete} atoms @{text a} and @{text b} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1577 |
in the pair @{term "(a, b)"} we can establish the lemma as follows: |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1578 |
*} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1579 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1580 |
lemma |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1581 |
fixes a b :: "name" |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1582 |
shows "(a \<leftrightarrow> b) \<bullet> (a, b) = (b, a)" |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1583 |
by simp |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1584 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1585 |
text {* |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1586 |
\noindent |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1587 |
There is no need to state an explicit premise involving sorts. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1588 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1589 |
We can automate the process of creating concrete atom types, so that users |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1590 |
can define a new one simply by issuing the command |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1591 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1592 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1593 |
\begin{tabular}{@ {}l} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1594 |
\isacommand{atom\_decl}~~@{text "name"} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1595 |
\end{tabular} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1596 |
\end{isabelle} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1597 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1598 |
\noindent |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1599 |
This command can be implemented using less than 100 lines of custom ML-code. |
2776 | 1600 |
|
1601 |
*} |
|
1602 |
||
1603 |
||
1604 |
||
1605 |
section {* Related Work\label{related} *} |
|
1606 |
||
1607 |
text {* |
|
1608 |
Coq-tries, but failed |
|
1609 |
||
1610 |
Add here comparison with old work. |
|
1611 |
||
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1612 |
In comparison, the old version of Nominal Isabelle included more than 1000 |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1613 |
lines of ML-code for creating concrete atom types, and for defining various |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1614 |
type classes and instantiating generic lemmas for them. In addition to |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1615 |
simplifying the ML-code, the setup here also offers user-visible improvements: |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1616 |
Now concrete atoms can be declared at any point of a formalisation, and |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1617 |
theories that separately declare different atom types can be merged |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1618 |
together---it is no longer required to collect all atom declarations in one |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1619 |
place. |
2523
e903c32ec24f
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2522
diff
changeset
|
1620 |
|
2742 | 1621 |
Using a single atom type to represent atoms of different sorts and |
1622 |
representing permutations as functions are not new ideas; see |
|
1623 |
\cite{GunterOsbornPopescu09} \footnote{function rep.} The main contribution |
|
1624 |
of this paper is to show an example of how to make better theorem proving |
|
1625 |
tools by choosing the right level of abstraction for the underlying |
|
1626 |
theory---our design choices take advantage of Isabelle's type system, type |
|
1627 |
classes and reasoning infrastructure. The novel technical contribution is a |
|
1628 |
mechanism for dealing with ``Church-style'' lambda-terms \cite{Church40} and |
|
1629 |
HOL-based languages \cite{PittsHOL4} where variables and variable binding |
|
1630 |
depend on type annotations. |
|
1631 |
||
1632 |
The paper is organised as follows\ldots |
|
1633 |
||
1634 |
||
2523
e903c32ec24f
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2522
diff
changeset
|
1635 |
The main point is that the above reasoning blends smoothly with the reasoning |
e903c32ec24f
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2522
diff
changeset
|
1636 |
infrastructure of Isabelle/HOL; no custom ML-code is necessary and a single |
e903c32ec24f
more on the pearl paper
Christian Urban <urbanc@in.tum.de>
parents:
2522
diff
changeset
|
1637 |
type class suffices. |
2736 | 1638 |
|
1639 |
With this |
|
1640 |
design one can represent permutations as lists of pairs of atoms and the |
|
1641 |
operation of applying a permutation to an object as the function |
|
1642 |
||
1643 |
||
1644 |
@{text [display,indent=10] "_ \<bullet> _ :: (\<alpha> \<times> \<alpha>) list \<Rightarrow> \<beta> \<Rightarrow> \<beta>"} |
|
1645 |
||
1646 |
\noindent |
|
1647 |
where @{text "\<alpha>"} stands for a type of atoms and @{text "\<beta>"} for the type |
|
1648 |
of the objects on which the permutation acts. For atoms |
|
1649 |
the permutation operation is defined over the length of lists as follows |
|
1650 |
||
1651 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
1652 |
\begin{tabular}{@ {}r@ {\hspace{2mm}}c@ {\hspace{2mm}}l} |
|
1653 |
@{text "[] \<bullet> c"} & @{text "="} & @{text c}\\ |
|
1654 |
@{text "(a b)::\<pi> \<bullet> c"} & @{text "="} & |
|
1655 |
$\begin{cases} @{text a} & \textrm{if}~@{text "\<pi> \<bullet> c = b"}\\ |
|
1656 |
@{text b} & \textrm{if}~@{text "\<pi> \<bullet> c = a"}\\ |
|
1657 |
@{text "\<pi> \<bullet> c"} & \textrm{otherwise}\end{cases}$ |
|
1658 |
\end{tabular}\hfill\numbered{atomperm} |
|
1659 |
\end{isabelle} |
|
1660 |
||
1661 |
\noindent |
|
1662 |
where we write @{text "(a b)"} for a swapping of atoms @{text "a"} and |
|
1663 |
@{text "b"}. For atoms with different type than the permutation, we |
|
1664 |
define @{text "\<pi> \<bullet> c \<equiv> c"}. |
|
1665 |
||
1666 |
With the separate atom types and the list representation of permutations it |
|
1667 |
is impossible in systems like Isabelle/HOL to state an ``ill-sorted'' |
|
1668 |
permutation, since the type system excludes lists containing atoms of |
|
1669 |
different type. However, a disadvantage is that whenever we need to |
|
1670 |
generalise induction hypotheses by quantifying over permutations, we have to |
|
1671 |
build quantifications like |
|
1672 |
||
1673 |
@{text [display,indent=10] "\<forall>\<pi>\<^isub>1 \<dots> \<forall>\<pi>\<^isub>n. \<dots>"} |
|
1674 |
||
1675 |
\noindent |
|
1676 |
where the @{text "\<pi>\<^isub>i"} are of type @{text "(\<alpha>\<^isub>i \<times> \<alpha>\<^isub>i) list"}. |
|
1677 |
The reason is that the permutation operation behaves differently for |
|
1678 |
every @{text "\<alpha>\<^isub>i"} and the type system does not allow use to have a |
|
1679 |
single quantification to stand for all permutations. Similarly, the |
|
1680 |
notion of support |
|
1681 |
||
1682 |
@{text [display,indent=10] "supp _ :: \<beta> \<Rightarrow> \<alpha> set"} |
|
1683 |
||
1684 |
\noindent |
|
1685 |
which we will define later, cannot be |
|
1686 |
used to express the support of an object over \emph{all} atoms. The reason |
|
1687 |
is that support can behave differently for each @{text |
|
1688 |
"\<alpha>\<^isub>i"}. This problem is annoying, because if we need to know in |
|
1689 |
a statement that an object, say @{text "x"}, is finitely supported we end up |
|
1690 |
with having to state premises of the form |
|
1691 |
||
1692 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
1693 |
\begin{tabular}{@ {}l} |
|
1694 |
@{text "finite ((supp x) :: \<alpha>\<^isub>1 set) , \<dots>, finite ((supp x) :: \<alpha>\<^isub>n set)"} |
|
1695 |
\end{tabular}\hfill\numbered{fssequence} |
|
1696 |
\end{isabelle} |
|
1697 |
||
1698 |
\noindent |
|
1699 |
Because of these disadvantages, we will use in this paper a single unified atom type to |
|
1700 |
represent atoms of different sorts. Consequently, we have to deal with the |
|
1701 |
case that a swapping of two atoms is ill-sorted: we cannot rely anymore on |
|
1702 |
the type systems to exclude them. |
|
1703 |
||
1704 |
We also will not represent permutations as lists of pairs of atoms (as done in |
|
1705 |
\cite{Urban08}). Although an |
|
1706 |
advantage of this representation is that the basic operations on |
|
1707 |
permutations are already defined in Isabelle's list library: composition of |
|
1708 |
two permutations (written @{text "_ @ _"}) is just list append, and |
|
1709 |
inversion of a permutation (written @{text "_\<^sup>-\<^sup>1"}) is just |
|
1710 |
list reversal, and another advantage is that there is a well-understood |
|
1711 |
induction principle for lists, a disadvantage is that permutations |
|
1712 |
do not have unique representations as lists. We have to explicitly identify |
|
1713 |
them according to the relation |
|
1714 |
||
1715 |
||
1716 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
1717 |
\begin{tabular}{@ {}l} |
|
1718 |
@{text "\<pi>\<^isub>1 \<sim> \<pi>\<^isub>2 \<equiv> \<forall>a. \<pi>\<^isub>1 \<bullet> a = \<pi>\<^isub>2 \<bullet> a"} |
|
1719 |
\end{tabular}\hfill\numbered{permequ} |
|
1720 |
\end{isabelle} |
|
1721 |
||
1722 |
\noindent |
|
1723 |
This is a problem when lifting the permutation operation to other types, for |
|
1724 |
example sets, functions and so on. For this we need to ensure that every definition |
|
1725 |
is well-behaved in the sense that it satisfies some |
|
1726 |
\emph{permutation properties}. In the list representation we need |
|
1727 |
to state these properties as follows: |
|
1728 |
||
1729 |
||
1730 |
\begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
1731 |
\begin{tabular}{@ {}r@ {\hspace{4mm}}p{10cm}} |
|
1732 |
i) & @{text "[] \<bullet> x = x"}\\ |
|
1733 |
ii) & @{text "(\<pi>\<^isub>1 @ \<pi>\<^isub>2) \<bullet> x = \<pi>\<^isub>1 \<bullet> (\<pi>\<^isub>2 \<bullet> x)"}\\ |
|
1734 |
iii) & if @{text "\<pi>\<^isub>1 \<sim> \<pi>\<^isub>2"} then @{text "\<pi>\<^isub>1 \<bullet> x = \<pi>\<^isub>2 \<bullet> x"} |
|
1735 |
\end{tabular}\hfill\numbered{permprops} |
|
1736 |
\end{isabelle} |
|
1737 |
||
1738 |
\noindent |
|
1739 |
where the last clause explicitly states that the permutation operation has |
|
1740 |
to produce the same result for related permutations. Moreover, |
|
1741 |
``permutations-as-lists'' do not satisfy the group properties. This means by |
|
1742 |
using this representation we will not be able to reuse the extensive |
|
1743 |
reasoning infrastructure in Isabelle about groups. Because of this, we will represent |
|
1744 |
in this paper permutations as functions from atoms to atoms. This representation |
|
1745 |
is unique and satisfies the laws of non-commutative groups. |
|
2033
74bd7bfb484b
some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents:
2005
diff
changeset
|
1746 |
*} |
74bd7bfb484b
some preliminary changes to the pearl-jv paper
Christian Urban <urbanc@in.tum.de>
parents:
2005
diff
changeset
|
1747 |
|
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1748 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1749 |
section {* Conclusion *} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1750 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1751 |
text {* |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1752 |
This proof pearl describes a new formalisation of the nominal logic work by |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1753 |
Pitts et al. With the definitions we presented here, the formal reasoning blends |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1754 |
smoothly with the infrastructure of the Isabelle/HOL theorem prover. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1755 |
Therefore the formalisation will be the underlying theory for a |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1756 |
new version of Nominal Isabelle. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1757 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1758 |
The main difference of this paper with respect to existing work on Nominal |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1759 |
Isabelle is the representation of atoms and permutations. First, we used a |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1760 |
single type for sorted atoms. This design choice means for a term @{term t}, |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1761 |
say, that its support is completely characterised by @{term "supp t"}, even |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1762 |
if the term contains different kinds of atoms. Also, whenever we have to |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1763 |
generalise an induction so that a property @{text P} is not just established |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1764 |
for all @{text t}, but for all @{text t} \emph{and} under all permutations |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1765 |
@{text \<pi>}, then we only have to state @{term "\<forall>\<pi>. P (\<pi> \<bullet> t)"}. The reason is |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1766 |
that permutations can now consist of multiple swapping each of which can |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1767 |
swap different kinds of atoms. This simplifies considerably the reasoning |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1768 |
involved in building Nominal Isabelle. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1769 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1770 |
Second, we represented permutations as functions so that the associated |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1771 |
permutation operation has only a single type parameter. This is very convenient |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1772 |
because the abstract reasoning about permutations fits cleanly |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1773 |
with Isabelle/HOL's type classes. No custom ML-code is required to work |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1774 |
around rough edges. Moreover, by establishing that our permutations-as-functions |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1775 |
representation satisfy the group properties, we were able to use extensively |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1776 |
Isabelle/HOL's reasoning infrastructure for groups. This often reduced proofs |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1777 |
to simple calculations over @{text "+"}, @{text "-"} and @{text "0"}. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1778 |
An interesting point is that we defined the swapping operation so that a |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1779 |
swapping of two atoms with different sorts is \emph{not} excluded, like |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1780 |
in our older work on Nominal Isabelle, but there is no ``effect'' of such |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1781 |
a swapping (it is defined as the identity). This is a crucial insight |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1782 |
in order to make the approach based on a single type of sorted atoms to work. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1783 |
But of course it is analogous to the well-known trick of defining division by |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1784 |
zero to return zero. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1785 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1786 |
We noticed only one disadvantage of the permutations-as-functions: Over |
1809
08e4d3cbcf8c
folded changes from the conference version
Christian Urban <urbanc@in.tum.de>
parents:
1790
diff
changeset
|
1787 |
lists we can easily perform inductions. For permutations made up from |
1785
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1788 |
functions, we have to manually derive an appropriate induction principle. We |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1789 |
can establish such a principle, but we have no real experience yet whether ours |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1790 |
is the most useful principle: such an induction principle was not needed in |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1791 |
any of the reasoning we ported from the old Nominal Isabelle, except |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1792 |
when showing that if @{term "\<forall>a \<in> supp x. a \<sharp> p"} implies @{term "p \<bullet> x = x"}. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1793 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1794 |
Finally, our implementation of sorted atoms turned out powerful enough to |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1795 |
use it for representing variables that carry on additional information, for |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1796 |
example typing annotations. This information is encoded into the sorts. With |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1797 |
this we can represent conveniently binding in ``Church-style'' lambda-terms |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1798 |
and HOL-based languages. While dealing with such additional information in |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1799 |
dependent type-theories, such as LF or Coq, is straightforward, we are not |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1800 |
aware of any other approach in a non-dependent HOL-setting that can deal |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1801 |
conveniently with such binders. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1802 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1803 |
The formalisation presented here will eventually become part of the Isabelle |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1804 |
distribution, but for the moment it can be downloaded from the |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1805 |
Mercurial repository linked at |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1806 |
\href{http://isabelle.in.tum.de/nominal/download} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1807 |
{http://isabelle.in.tum.de/nominal/download}.\smallskip |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1808 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1809 |
\noindent |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1810 |
{\bf Acknowledgements:} We are very grateful to Jesper Bengtson, Stefan |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1811 |
Berghofer and Cezary Kaliszyk for their comments on earlier versions |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1812 |
of this paper. We are also grateful to the anonymous referee who helped us to |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1813 |
put the work into the right context. |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1814 |
*} |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1815 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1816 |
|
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1817 |
(*<*) |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1818 |
end |
95df71c3df2f
added new paper directory for further work
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1819 |
(*>*) |