39 abbreviation |
38 abbreviation |
40 "sort_ty \<equiv> sort_of_ty" |
39 "sort_ty \<equiv> sort_of_ty" |
41 |
40 |
42 (*>*) |
41 (*>*) |
43 |
42 |
44 (* |
|
45 TODO: write about supp of finite sets, abstraction over finite sets |
|
46 *) |
|
47 |
|
48 section {* Introduction *} |
43 section {* Introduction *} |
49 |
44 |
50 text {* |
45 text {* |
51 Nominal Isabelle provides a proving infratructure for convenient reasoning |
46 Nominal Isabelle provides a proving infratructure for convenient reasoning |
52 about programming language calculi involving binders such as lambda abstractions or |
47 about programming language calculi involving binders, such as lambda abstractions or |
53 quantifications in type schemes: |
48 quantifications in type schemes: |
54 |
49 |
55 \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
50 \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
56 @{text "\<lambda>x. t \<forall>{x\<^isub>1,\<dots>,x\<^isub>n}. \<tau>"} |
51 @{text "\<lambda>x. t \<forall>{x\<^isub>1,\<dots>,x\<^isub>n}. \<tau>"} |
57 \hfill\numbered{atomperm} |
52 \hfill\numbered{atomperm} |
58 \end{isabelle} |
53 \end{isabelle} |
59 |
54 |
60 \noindent |
55 \noindent |
61 At its core Nominal Isabelle is based on the nominal logic work by Pitts at |
56 At its core Nominal Isabelle is based on the nominal logic work by Pitts at |
62 al \cite{GabbayPitts02,Pitts03}. The most basic notion in this work is a |
57 al \cite{GabbayPitts02,Pitts03}, whose most basic notion is a |
63 sort-respecting permutation operation defined over a countably infinite |
58 sort-respecting permutation operation defined over a countably infinite |
64 collection of sorted atoms. The atoms are used for representing variable names |
59 collection of sorted atoms. The nominal logic work has been starting |
65 that might be bound or free. Multiple sorts are necessary for being able to |
60 point for a number of formalisations, most notable Norrish \cite{norrish04} |
66 represent different kinds of variables. For example, in the language Mini-ML |
61 in HOL4, Aydemir et al \cite{AydemirBohannonWeirich07} in Coq and our own |
67 there are bound term variables in lambda abstractions and bound type variables in |
62 work in Isabelle/HOL. |
68 type schemes. In order to be able to separate them, each kind of variables needs to be |
63 |
69 represented by a different sort of atoms. |
64 |
70 |
|
71 The existing nominal logic work usually leaves implicit the sorting |
|
72 information for atoms and as far as we know leaves out a description of how |
|
73 sorts are represented. In our formalisation, we therefore have to make a |
|
74 design decision about how to implement sorted atoms and sort-respecting |
|
75 permutations. One possibility, which we described in \cite{Urban08}, is to |
|
76 have separate types for the different |
|
77 kinds of atoms, say types @{text "\<alpha>\<^isub>1,\<dots>,\<alpha>\<^isub>n"}. With this |
|
78 design one can represent permutations as lists of pairs of atoms and the |
|
79 operation of applying a permutation to an object as the function |
|
80 |
|
81 |
|
82 @{text [display,indent=10] "_ \<bullet> _ :: (\<alpha> \<times> \<alpha>) list \<Rightarrow> \<beta> \<Rightarrow> \<beta>"} |
|
83 |
|
84 \noindent |
|
85 where @{text "\<alpha>"} stands for a type of atoms and @{text "\<beta>"} for the type |
|
86 of the objects on which the permutation acts. For atoms |
|
87 the permutation operation is defined over the length of lists as follows |
|
88 |
|
89 \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
90 \begin{tabular}{@ {}r@ {\hspace{2mm}}c@ {\hspace{2mm}}l} |
|
91 @{text "[] \<bullet> c"} & @{text "="} & @{text c}\\ |
|
92 @{text "(a b)::\<pi> \<bullet> c"} & @{text "="} & |
|
93 $\begin{cases} @{text a} & \textrm{if}~@{text "\<pi> \<bullet> c = b"}\\ |
|
94 @{text b} & \textrm{if}~@{text "\<pi> \<bullet> c = a"}\\ |
|
95 @{text "\<pi> \<bullet> c"} & \textrm{otherwise}\end{cases}$ |
|
96 \end{tabular}\hfill\numbered{atomperm} |
|
97 \end{isabelle} |
|
98 |
|
99 \noindent |
|
100 where we write @{text "(a b)"} for a swapping of atoms @{text "a"} and |
|
101 @{text "b"}. For atoms with different type than the permutation, we |
|
102 define @{text "\<pi> \<bullet> c \<equiv> c"}. |
|
103 |
|
104 With the separate atom types and the list representation of permutations it |
|
105 is impossible in systems like Isabelle/HOL to state an ``ill-sorted'' |
|
106 permutation, since the type system excludes lists containing atoms of |
|
107 different type. However, a disadvantage is that whenever we need to |
|
108 generalise induction hypotheses by quantifying over permutations, we have to |
|
109 build quantifications like |
|
110 |
|
111 @{text [display,indent=10] "\<forall>\<pi>\<^isub>1 \<dots> \<forall>\<pi>\<^isub>n. \<dots>"} |
|
112 |
|
113 \noindent |
|
114 where the @{text "\<pi>\<^isub>i"} are of type @{text "(\<alpha>\<^isub>i \<times> \<alpha>\<^isub>i) list"}. |
|
115 The reason is that the permutation operation behaves differently for |
|
116 every @{text "\<alpha>\<^isub>i"} and the type system does not allow use to have a |
|
117 single quantification to stand for all permutations. Similarly, the |
|
118 notion of support |
|
119 |
|
120 @{text [display,indent=10] "supp _ :: \<beta> \<Rightarrow> \<alpha> set"} |
|
121 |
|
122 \noindent |
|
123 which we will define later, cannot be |
|
124 used to express the support of an object over \emph{all} atoms. The reason |
|
125 is that support can behave differently for each @{text |
|
126 "\<alpha>\<^isub>i"}. This problem is annoying, because if we need to know in |
|
127 a statement that an object, say @{text "x"}, is finitely supported we end up |
|
128 with having to state premises of the form |
|
129 |
|
130 \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
131 \begin{tabular}{@ {}l} |
|
132 @{text "finite ((supp x) :: \<alpha>\<^isub>1 set) , \<dots>, finite ((supp x) :: \<alpha>\<^isub>n set)"} |
|
133 \end{tabular}\hfill\numbered{fssequence} |
|
134 \end{isabelle} |
|
135 |
|
136 \noindent |
|
137 Because of these disadvantages, we will use in this paper a single unified atom type to |
|
138 represent atoms of different sorts. Consequently, we have to deal with the |
|
139 case that a swapping of two atoms is ill-sorted: we cannot rely anymore on |
|
140 the type systems to exclude them. |
|
141 |
|
142 We also will not represent permutations as lists of pairs of atoms (as done in |
|
143 \cite{Urban08}). Although an |
|
144 advantage of this representation is that the basic operations on |
|
145 permutations are already defined in Isabelle's list library: composition of |
|
146 two permutations (written @{text "_ @ _"}) is just list append, and |
|
147 inversion of a permutation (written @{text "_\<^sup>-\<^sup>1"}) is just |
|
148 list reversal, and another advantage is that there is a well-understood |
|
149 induction principle for lists, a disadvantage is that permutations |
|
150 do not have unique representations as lists. We have to explicitly identify |
|
151 them according to the relation |
|
152 |
|
153 |
|
154 \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
155 \begin{tabular}{@ {}l} |
|
156 @{text "\<pi>\<^isub>1 \<sim> \<pi>\<^isub>2 \<equiv> \<forall>a. \<pi>\<^isub>1 \<bullet> a = \<pi>\<^isub>2 \<bullet> a"} |
|
157 \end{tabular}\hfill\numbered{permequ} |
|
158 \end{isabelle} |
|
159 |
|
160 \noindent |
|
161 This is a problem when lifting the permutation operation to other types, for |
|
162 example sets, functions and so on. For this we need to ensure that every definition |
|
163 is well-behaved in the sense that it satisfies some |
|
164 \emph{permutation properties}. In the list representation we need |
|
165 to state these properties as follows: |
|
166 |
|
167 |
|
168 \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
169 \begin{tabular}{@ {}r@ {\hspace{4mm}}p{10cm}} |
|
170 i) & @{text "[] \<bullet> x = x"}\\ |
|
171 ii) & @{text "(\<pi>\<^isub>1 @ \<pi>\<^isub>2) \<bullet> x = \<pi>\<^isub>1 \<bullet> (\<pi>\<^isub>2 \<bullet> x)"}\\ |
|
172 iii) & if @{text "\<pi>\<^isub>1 \<sim> \<pi>\<^isub>2"} then @{text "\<pi>\<^isub>1 \<bullet> x = \<pi>\<^isub>2 \<bullet> x"} |
|
173 \end{tabular}\hfill\numbered{permprops} |
|
174 \end{isabelle} |
|
175 |
|
176 \noindent |
|
177 where the last clause explicitly states that the permutation operation has |
|
178 to produce the same result for related permutations. Moreover, |
|
179 ``permutations-as-lists'' do not satisfy the group properties. This means by |
|
180 using this representation we will not be able to reuse the extensive |
|
181 reasoning infrastructure in Isabelle about groups. Because of this, we will represent |
|
182 in this paper permutations as functions from atoms to atoms. This representation |
|
183 is unique and satisfies the laws of non-commutative groups. |
|
184 |
|
185 Using a single atom type to represent atoms of different sorts and |
65 Using a single atom type to represent atoms of different sorts and |
186 representing permutations as functions are not new ideas; see |
66 representing permutations as functions are not new ideas; see |
187 \cite{GunterOsbornPopescu09} \footnote{function rep.} The main contribution |
67 \cite{GunterOsbornPopescu09} \footnote{function rep.} The main contribution |
188 of this paper is to show an example of how to make better theorem proving |
68 of this paper is to show an example of how to make better theorem proving |
189 tools by choosing the right level of abstraction for the underlying |
69 tools by choosing the right level of abstraction for the underlying |
1200 together---it is no longer required to collect all atom declarations in one |
1098 together---it is no longer required to collect all atom declarations in one |
1201 place. |
1099 place. |
1202 *} |
1100 *} |
1203 |
1101 |
1204 |
1102 |
1205 section {* Multi-Sorted Concrete Atoms *} |
|
1206 |
|
1207 (*<*) |
|
1208 datatype ty = TVar string | Fun ty ty ("_ \<rightarrow> _") |
|
1209 (*>*) |
|
1210 |
|
1211 text {* |
|
1212 The formalisation presented so far allows us to streamline proofs and reduce |
|
1213 the amount of custom ML-code in the existing implementation of Nominal |
|
1214 Isabelle. In this section we describe a mechanism that extends the |
|
1215 capabilities of Nominal Isabelle. This mechanism is about variables with |
|
1216 additional information, for example typing constraints. |
|
1217 While we leave a detailed treatment of binders and binding of variables for a |
|
1218 later paper, we will have a look here at how such variables can be |
|
1219 represented by concrete atoms. |
|
1220 |
|
1221 In the previous section we considered concrete atoms that can be used in |
|
1222 simple binders like \emph{@{text "\<lambda>x. x"}}. Such concrete atoms do |
|
1223 not carry any information beyond their identities---comparing for equality |
|
1224 is really the only way to analyse ordinary concrete atoms. |
|
1225 However, in ``Church-style'' lambda-terms \cite{Church40} and in the terms |
|
1226 underlying HOL-systems \cite{PittsHOL4} binders and bound variables have a |
|
1227 more complicated structure. For example in the ``Church-style'' lambda-term |
|
1228 |
|
1229 \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
1230 \begin{tabular}{@ {}l} |
|
1231 @{text "\<lambda>x\<^isub>\<alpha>. x\<^isub>\<alpha> x\<^isub>\<beta>"} |
|
1232 \end{tabular}\hfill\numbered{church} |
|
1233 \end{isabelle} |
|
1234 |
|
1235 \noindent |
|
1236 both variables and binders include typing information indicated by @{text \<alpha>} |
|
1237 and @{text \<beta>}. In this setting, we treat @{text "x\<^isub>\<alpha>"} and @{text |
|
1238 "x\<^isub>\<beta>"} as distinct variables (assuming @{term "\<alpha>\<noteq>\<beta>"}) so that the |
|
1239 variable @{text "x\<^isub>\<alpha>"} is bound by the lambda-abstraction, but not |
|
1240 @{text "x\<^isub>\<beta>"}. |
|
1241 |
|
1242 To illustrate how we can deal with this phenomenon, let us represent object |
|
1243 types like @{text \<alpha>} and @{text \<beta>} by the datatype |
|
1244 |
|
1245 \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
1246 \begin{tabular}{@ {}l} |
|
1247 \isacommand{datatype}~~@{text "ty = TVar string | ty \<rightarrow> ty"} |
|
1248 \end{tabular} |
|
1249 \end{isabelle} |
|
1250 |
|
1251 \noindent |
|
1252 If we attempt to encode a variable naively as a pair of a @{text name} and a @{text ty}, we have the |
|
1253 problem that a swapping, say @{term "(x \<leftrightarrow> y)"}, applied to the pair @{text "((x, \<alpha>), (x, \<beta>))"} |
|
1254 will always permute \emph{both} occurrences of @{text x}, even if the types |
|
1255 @{text "\<alpha>"} and @{text "\<beta>"} are different. This is unwanted, because it will |
|
1256 eventually mean that both occurrences of @{text x} will become bound by a |
|
1257 corresponding binder. |
|
1258 |
|
1259 Another attempt might be to define variables as an instance of the concrete |
|
1260 atom type class, where a @{text ty} is somehow encoded within each variable. |
|
1261 Remember we defined atoms as the datatype: |
|
1262 *} |
|
1263 |
|
1264 datatype atom\<iota>\<iota> = Atom\<iota>\<iota> string nat |
|
1265 |
|
1266 text {* |
|
1267 \noindent |
|
1268 Considering our method of defining concrete atom types, the usage of a string |
|
1269 for the sort of atoms seems a natural choice. However, none of the results so |
|
1270 far depend on this choice and we are free to change it. |
|
1271 One possibility is to encode types or any other information by making the sort |
|
1272 argument parametric as follows: |
|
1273 *} |
|
1274 |
|
1275 datatype 'a \<iota>atom\<iota>\<iota>\<iota> = \<iota>Atom\<iota>\<iota> 'a nat |
|
1276 |
|
1277 text {* |
|
1278 \noindent |
|
1279 The problem with this possibility is that we are then back in the old |
|
1280 situation where our permutation operation is parametric in two types and |
|
1281 this would require to work around Isabelle/HOL's restriction on type |
|
1282 classes. Fortunately, encoding the types in a separate parameter is not |
|
1283 necessary for what we want to achieve, as we only have to know when two |
|
1284 types are equal or not. The solution is to use a different sort for each |
|
1285 object type. Then we can use the fact that permutations respect \emph{sorts} to |
|
1286 ensure that permutations also respect \emph{object types}. In order to do |
|
1287 this, we must define an injective function @{text "sort_ty"} mapping from |
|
1288 object types to sorts. For defining functions like @{text "sort_ty"}, it is |
|
1289 more convenient to use a tree datatype for sorts. Therefore we define |
|
1290 *} |
|
1291 |
|
1292 datatype sort = Sort string "(sort list)" |
|
1293 datatype atom\<iota>\<iota>\<iota>\<iota> = Atom\<iota>\<iota>\<iota>\<iota> sort nat |
|
1294 |
|
1295 text {* |
|
1296 \noindent |
|
1297 With this definition, |
|
1298 the sorts we considered so far can be encoded just as \mbox{@{text "Sort s []"}}. |
|
1299 The point, however, is that we can now define the function @{text sort_ty} simply as |
|
1300 |
|
1301 \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
1302 \begin{tabular}{@ {}l} |
|
1303 @{text "sort_ty (TVar s) = Sort ''TVar'' [Sort s []]"}\\ |
|
1304 @{text "sort_ty (\<tau>\<^isub>1 \<rightarrow> \<tau>\<^isub>2) = Sort ''Fun'' [sort_ty \<tau>\<^isub>1, sort_ty \<tau>\<^isub>2]"} |
|
1305 \end{tabular}\hfill\numbered{sortty} |
|
1306 \end{isabelle} |
|
1307 |
|
1308 \noindent |
|
1309 which can easily be shown to be injective. |
|
1310 |
|
1311 Having settled on what the sorts should be for ``Church-like'' atoms, we have to |
|
1312 give a subtype definition for concrete atoms. Previously we identified a subtype consisting |
|
1313 of atoms of only one specified sort. This must be generalised to all sorts the |
|
1314 function @{text "sort_ty"} might produce, i.e.~the |
|
1315 range of @{text "sort_ty"}. Therefore we define |
|
1316 |
|
1317 \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
1318 \isacommand{typedef}\ \ @{text var} = @{term "{a. sort a : range sort_ty}"} |
|
1319 \end{isabelle} |
|
1320 |
|
1321 \noindent |
|
1322 This command gives us again injective representation and abstraction |
|
1323 functions. We will write them also as \mbox{@{text "\<lfloor>_\<rfloor> :: var \<Rightarrow> atom"}} and |
|
1324 @{text "\<lceil>_\<rceil> :: atom \<Rightarrow> var"}, respectively. |
|
1325 |
|
1326 We can define the permutation operation for @{text var} as @{thm |
|
1327 permute_var_def[where p="\<pi>", THEN eq_reflection, no_vars]} and the |
|
1328 injective function to type @{typ atom} as @{thm atom_var_def[THEN |
|
1329 eq_reflection, no_vars]}. Finally, we can define a constructor function that |
|
1330 makes a @{text var} from a variable name and an object type: |
|
1331 |
|
1332 @{thm [display,indent=10] Var_def[where t="\<alpha>", THEN eq_reflection, no_vars]} |
|
1333 |
|
1334 \noindent |
|
1335 With these definitions we can verify all the properties for concrete atom |
|
1336 types except Property \ref{atomprops}@{text ".iii)"}, which requires every |
|
1337 atom to have the same sort. This last property is clearly not true for type |
|
1338 @{text "var"}. |
|
1339 This fact is slightly unfortunate since this |
|
1340 property allowed us to use the type-checker in order to shield the user from |
|
1341 all sort-constraints. But this failure is expected here, because we cannot |
|
1342 burden the type-system of Isabelle/HOL with the task of deciding when two |
|
1343 object types are equal. This means we sometimes need to explicitly state sort |
|
1344 constraints or explicitly discharge them, but as we will see in the lemma |
|
1345 below this seems a natural price to pay in these circumstances. |
|
1346 |
|
1347 To sum up this section, the encoding of type-information into atoms allows us |
|
1348 to form the swapping @{term "(Var x \<alpha> \<leftrightarrow> Var y \<alpha>)"} and to prove the following |
|
1349 lemma |
|
1350 *} |
|
1351 |
|
1352 lemma |
|
1353 assumes asm: "\<alpha> \<noteq> \<beta>" |
|
1354 shows "(Var x \<alpha> \<leftrightarrow> Var y \<alpha>) \<bullet> (Var x \<alpha>, Var x \<beta>) = (Var y \<alpha>, Var x \<beta>)" |
|
1355 using asm by simp |
|
1356 |
|
1357 text {* |
|
1358 \noindent |
|
1359 As we expect, the atom @{term "Var x \<beta>"} is left unchanged by the |
|
1360 swapping. With this we can faithfully represent bindings in languages |
|
1361 involving ``Church-style'' terms and bindings as shown in \eqref{church}. We |
|
1362 expect that the creation of such atoms can be easily automated so that the |
|
1363 user just needs to specify \isacommand{atom\_decl}~~@{text "var (ty)"} |
|
1364 where the argument, or arguments, are datatypes for which we can automatically |
|
1365 define an injective function like @{text "sort_ty"} (see \eqref{sortty}). |
|
1366 Our hope is that with this approach Benzmueller and Paulson can make |
|
1367 headway with formalising their results |
|
1368 about simple type theory \cite{PaulsonBenzmueller}. |
|
1369 Because of its limitations, they did not attempt this with the old version |
|
1370 of Nominal Isabelle. We also hope we can make progress with formalisations of |
|
1371 HOL-based languages. |
|
1372 *} |
|
1373 |
1103 |
1374 section {* Related Work *} |
1104 section {* Related Work *} |
1375 |
1105 |
1376 text {* |
1106 text {* |
1377 Add here comparison with old work. |
1107 Add here comparison with old work. |
1378 |
|
1379 |
1108 |
1380 The main point is that the above reasoning blends smoothly with the reasoning |
1109 The main point is that the above reasoning blends smoothly with the reasoning |
1381 infrastructure of Isabelle/HOL; no custom ML-code is necessary and a single |
1110 infrastructure of Isabelle/HOL; no custom ML-code is necessary and a single |
1382 type class suffices. |
1111 type class suffices. |
|
1112 |
|
1113 With this |
|
1114 design one can represent permutations as lists of pairs of atoms and the |
|
1115 operation of applying a permutation to an object as the function |
|
1116 |
|
1117 |
|
1118 @{text [display,indent=10] "_ \<bullet> _ :: (\<alpha> \<times> \<alpha>) list \<Rightarrow> \<beta> \<Rightarrow> \<beta>"} |
|
1119 |
|
1120 \noindent |
|
1121 where @{text "\<alpha>"} stands for a type of atoms and @{text "\<beta>"} for the type |
|
1122 of the objects on which the permutation acts. For atoms |
|
1123 the permutation operation is defined over the length of lists as follows |
|
1124 |
|
1125 \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
1126 \begin{tabular}{@ {}r@ {\hspace{2mm}}c@ {\hspace{2mm}}l} |
|
1127 @{text "[] \<bullet> c"} & @{text "="} & @{text c}\\ |
|
1128 @{text "(a b)::\<pi> \<bullet> c"} & @{text "="} & |
|
1129 $\begin{cases} @{text a} & \textrm{if}~@{text "\<pi> \<bullet> c = b"}\\ |
|
1130 @{text b} & \textrm{if}~@{text "\<pi> \<bullet> c = a"}\\ |
|
1131 @{text "\<pi> \<bullet> c"} & \textrm{otherwise}\end{cases}$ |
|
1132 \end{tabular}\hfill\numbered{atomperm} |
|
1133 \end{isabelle} |
|
1134 |
|
1135 \noindent |
|
1136 where we write @{text "(a b)"} for a swapping of atoms @{text "a"} and |
|
1137 @{text "b"}. For atoms with different type than the permutation, we |
|
1138 define @{text "\<pi> \<bullet> c \<equiv> c"}. |
|
1139 |
|
1140 With the separate atom types and the list representation of permutations it |
|
1141 is impossible in systems like Isabelle/HOL to state an ``ill-sorted'' |
|
1142 permutation, since the type system excludes lists containing atoms of |
|
1143 different type. However, a disadvantage is that whenever we need to |
|
1144 generalise induction hypotheses by quantifying over permutations, we have to |
|
1145 build quantifications like |
|
1146 |
|
1147 @{text [display,indent=10] "\<forall>\<pi>\<^isub>1 \<dots> \<forall>\<pi>\<^isub>n. \<dots>"} |
|
1148 |
|
1149 \noindent |
|
1150 where the @{text "\<pi>\<^isub>i"} are of type @{text "(\<alpha>\<^isub>i \<times> \<alpha>\<^isub>i) list"}. |
|
1151 The reason is that the permutation operation behaves differently for |
|
1152 every @{text "\<alpha>\<^isub>i"} and the type system does not allow use to have a |
|
1153 single quantification to stand for all permutations. Similarly, the |
|
1154 notion of support |
|
1155 |
|
1156 @{text [display,indent=10] "supp _ :: \<beta> \<Rightarrow> \<alpha> set"} |
|
1157 |
|
1158 \noindent |
|
1159 which we will define later, cannot be |
|
1160 used to express the support of an object over \emph{all} atoms. The reason |
|
1161 is that support can behave differently for each @{text |
|
1162 "\<alpha>\<^isub>i"}. This problem is annoying, because if we need to know in |
|
1163 a statement that an object, say @{text "x"}, is finitely supported we end up |
|
1164 with having to state premises of the form |
|
1165 |
|
1166 \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
1167 \begin{tabular}{@ {}l} |
|
1168 @{text "finite ((supp x) :: \<alpha>\<^isub>1 set) , \<dots>, finite ((supp x) :: \<alpha>\<^isub>n set)"} |
|
1169 \end{tabular}\hfill\numbered{fssequence} |
|
1170 \end{isabelle} |
|
1171 |
|
1172 \noindent |
|
1173 Because of these disadvantages, we will use in this paper a single unified atom type to |
|
1174 represent atoms of different sorts. Consequently, we have to deal with the |
|
1175 case that a swapping of two atoms is ill-sorted: we cannot rely anymore on |
|
1176 the type systems to exclude them. |
|
1177 |
|
1178 We also will not represent permutations as lists of pairs of atoms (as done in |
|
1179 \cite{Urban08}). Although an |
|
1180 advantage of this representation is that the basic operations on |
|
1181 permutations are already defined in Isabelle's list library: composition of |
|
1182 two permutations (written @{text "_ @ _"}) is just list append, and |
|
1183 inversion of a permutation (written @{text "_\<^sup>-\<^sup>1"}) is just |
|
1184 list reversal, and another advantage is that there is a well-understood |
|
1185 induction principle for lists, a disadvantage is that permutations |
|
1186 do not have unique representations as lists. We have to explicitly identify |
|
1187 them according to the relation |
|
1188 |
|
1189 |
|
1190 \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
1191 \begin{tabular}{@ {}l} |
|
1192 @{text "\<pi>\<^isub>1 \<sim> \<pi>\<^isub>2 \<equiv> \<forall>a. \<pi>\<^isub>1 \<bullet> a = \<pi>\<^isub>2 \<bullet> a"} |
|
1193 \end{tabular}\hfill\numbered{permequ} |
|
1194 \end{isabelle} |
|
1195 |
|
1196 \noindent |
|
1197 This is a problem when lifting the permutation operation to other types, for |
|
1198 example sets, functions and so on. For this we need to ensure that every definition |
|
1199 is well-behaved in the sense that it satisfies some |
|
1200 \emph{permutation properties}. In the list representation we need |
|
1201 to state these properties as follows: |
|
1202 |
|
1203 |
|
1204 \begin{isabelle}\ \ \ \ \ \ \ \ \ \ %%% |
|
1205 \begin{tabular}{@ {}r@ {\hspace{4mm}}p{10cm}} |
|
1206 i) & @{text "[] \<bullet> x = x"}\\ |
|
1207 ii) & @{text "(\<pi>\<^isub>1 @ \<pi>\<^isub>2) \<bullet> x = \<pi>\<^isub>1 \<bullet> (\<pi>\<^isub>2 \<bullet> x)"}\\ |
|
1208 iii) & if @{text "\<pi>\<^isub>1 \<sim> \<pi>\<^isub>2"} then @{text "\<pi>\<^isub>1 \<bullet> x = \<pi>\<^isub>2 \<bullet> x"} |
|
1209 \end{tabular}\hfill\numbered{permprops} |
|
1210 \end{isabelle} |
|
1211 |
|
1212 \noindent |
|
1213 where the last clause explicitly states that the permutation operation has |
|
1214 to produce the same result for related permutations. Moreover, |
|
1215 ``permutations-as-lists'' do not satisfy the group properties. This means by |
|
1216 using this representation we will not be able to reuse the extensive |
|
1217 reasoning infrastructure in Isabelle about groups. Because of this, we will represent |
|
1218 in this paper permutations as functions from atoms to atoms. This representation |
|
1219 is unique and satisfies the laws of non-commutative groups. |
1383 *} |
1220 *} |
1384 |
1221 |
1385 |
1222 |
1386 section {* Conclusion *} |
1223 section {* Conclusion *} |
1387 |
1224 |