|
1 theory Abs |
|
2 imports "Nominal2_Atoms" "Nominal2_Eqvt" "Nominal2_Supp" "../Quotient" "../Quotient_Product" |
|
3 begin |
|
4 |
|
5 (* the next three lemmas that should be in Nominal \<dots>\<dots>must be cleaned *) |
|
6 |
|
7 |
|
8 fun |
|
9 alpha_gen |
|
10 where |
|
11 alpha_gen[simp del]: |
|
12 "alpha_gen (bs, x) R f pi (cs, y) \<longleftrightarrow> |
|
13 f x - bs = f y - cs \<and> (f x - bs) \<sharp>* pi \<and> R (pi \<bullet> x) y \<and> pi \<bullet> bs = cs" |
|
14 |
|
15 notation |
|
16 alpha_gen ("_ \<approx>gen _ _ _ _" [100, 100, 100, 100, 100] 100) |
|
17 |
|
18 lemma [mono]: "R1 \<le> R2 \<Longrightarrow> alpha_gen x R1 \<le> alpha_gen x R2" |
|
19 by (cases x) (auto simp add: le_fun_def le_bool_def alpha_gen.simps) |
|
20 |
|
21 lemma alpha_gen_refl: |
|
22 assumes a: "R x x" |
|
23 shows "(bs, x) \<approx>gen R f 0 (bs, x)" |
|
24 using a by (simp add: alpha_gen fresh_star_def fresh_zero_perm) |
|
25 |
|
26 lemma alpha_gen_sym: |
|
27 assumes a: "(bs, x) \<approx>gen R f p (cs, y)" |
|
28 and b: "R (p \<bullet> x) y \<Longrightarrow> R (- p \<bullet> y) x" |
|
29 shows "(cs, y) \<approx>gen R f (- p) (bs, x)" |
|
30 using a b |
|
31 by (auto simp add: alpha_gen fresh_star_def fresh_def supp_minus_perm) |
|
32 |
|
33 lemma alpha_gen_trans: |
|
34 assumes a: "(bs, x) \<approx>gen R f p1 (cs, y)" |
|
35 and b: "(cs, y) \<approx>gen R f p2 (ds, z)" |
|
36 and c: "\<lbrakk>R (p1 \<bullet> x) y; R (p2 \<bullet> y) z\<rbrakk> \<Longrightarrow> R ((p2 + p1) \<bullet> x) z" |
|
37 shows "(bs, x) \<approx>gen R f (p2 + p1) (ds, z)" |
|
38 using a b c |
|
39 using supp_plus_perm |
|
40 apply(simp add: alpha_gen fresh_star_def fresh_def) |
|
41 apply(blast) |
|
42 done |
|
43 |
|
44 lemma alpha_gen_eqvt: |
|
45 assumes a: "(bs, x) \<approx>gen R f q (cs, y)" |
|
46 and b: "R (q \<bullet> x) y \<Longrightarrow> R (p \<bullet> (q \<bullet> x)) (p \<bullet> y)" |
|
47 and c: "p \<bullet> (f x) = f (p \<bullet> x)" |
|
48 and d: "p \<bullet> (f y) = f (p \<bullet> y)" |
|
49 shows "(p \<bullet> bs, p \<bullet> x) \<approx>gen R f (p \<bullet> q) (p \<bullet> cs, p \<bullet> y)" |
|
50 using a b |
|
51 apply(simp add: alpha_gen c[symmetric] d[symmetric] Diff_eqvt[symmetric]) |
|
52 apply(simp add: permute_eqvt[symmetric]) |
|
53 apply(simp add: fresh_star_permute_iff) |
|
54 apply(clarsimp) |
|
55 done |
|
56 |
|
57 lemma alpha_gen_compose_sym: |
|
58 fixes pi |
|
59 assumes b: "(aa, t) \<approx>gen (\<lambda>x1 x2. R x1 x2 \<and> R x2 x1) f pi (ab, s)" |
|
60 and a: "\<And>pi t s. (R t s \<Longrightarrow> R (pi \<bullet> t) (pi \<bullet> s))" |
|
61 shows "(ab, s) \<approx>gen R f (- pi) (aa, t)" |
|
62 using b apply - |
|
63 apply(simp add: alpha_gen.simps) |
|
64 apply(erule conjE)+ |
|
65 apply(rule conjI) |
|
66 apply(simp add: fresh_star_def fresh_minus_perm) |
|
67 apply(subgoal_tac "R (- pi \<bullet> s) ((- pi) \<bullet> (pi \<bullet> t))") |
|
68 apply simp |
|
69 apply(clarify) |
|
70 apply(simp) |
|
71 apply(rule a) |
|
72 apply assumption |
|
73 done |
|
74 |
|
75 lemma alpha_gen_compose_trans: |
|
76 fixes pi pia |
|
77 assumes b: "(aa, t) \<approx>gen (\<lambda>x1 x2. R x1 x2 \<and> (\<forall>x. R x2 x \<longrightarrow> R x1 x)) f pi (ab, ta)" |
|
78 and c: "(ab, ta) \<approx>gen R f pia (ac, sa)" |
|
79 and a: "\<And>pi t s. (R t s \<Longrightarrow> R (pi \<bullet> t) (pi \<bullet> s))" |
|
80 shows "(aa, t) \<approx>gen R f (pia + pi) (ac, sa)" |
|
81 using b c apply - |
|
82 apply(simp add: alpha_gen.simps) |
|
83 apply(erule conjE)+ |
|
84 apply(simp add: fresh_star_plus) |
|
85 apply(drule_tac x="- pia \<bullet> sa" in spec) |
|
86 apply(drule mp) |
|
87 apply(rotate_tac 5) |
|
88 apply(drule_tac pi="- pia" in a) |
|
89 apply(simp) |
|
90 apply(rotate_tac 7) |
|
91 apply(drule_tac pi="pia" in a) |
|
92 apply(simp) |
|
93 done |
|
94 |
|
95 lemma alpha_gen_compose_eqvt: |
|
96 fixes pia |
|
97 assumes b: "(g d, t) \<approx>gen (\<lambda>x1 x2. R x1 x2 \<and> R (pi \<bullet> x1) (pi \<bullet> x2)) f pia (g e, s)" |
|
98 and c: "\<And>y. pi \<bullet> (g y) = g (pi \<bullet> y)" |
|
99 and a: "\<And>x. pi \<bullet> (f x) = f (pi \<bullet> x)" |
|
100 shows "(g (pi \<bullet> d), pi \<bullet> t) \<approx>gen R f (pi \<bullet> pia) (g (pi \<bullet> e), pi \<bullet> s)" |
|
101 using b |
|
102 apply - |
|
103 apply(simp add: alpha_gen.simps) |
|
104 apply(erule conjE)+ |
|
105 apply(rule conjI) |
|
106 apply(rule_tac ?p1="- pi" in permute_eq_iff[THEN iffD1]) |
|
107 apply(simp add: a[symmetric] atom_eqvt Diff_eqvt insert_eqvt set_eqvt empty_eqvt c[symmetric]) |
|
108 apply(rule conjI) |
|
109 apply(rule_tac ?p1="- pi" in fresh_star_permute_iff[THEN iffD1]) |
|
110 apply(simp add: a[symmetric] atom_eqvt Diff_eqvt insert_eqvt set_eqvt empty_eqvt c[symmetric]) |
|
111 apply(subst permute_eqvt[symmetric]) |
|
112 apply(simp) |
|
113 oops |
|
114 |
|
115 fun |
|
116 alpha_abs |
|
117 where |
|
118 "alpha_abs (bs, x) (cs, y) = (\<exists>p. (bs, x) \<approx>gen (op=) supp p (cs, y))" |
|
119 |
|
120 notation |
|
121 alpha_abs ("_ \<approx>abs _") |
|
122 |
|
123 lemma alpha_abs_swap: |
|
124 assumes a1: "a \<notin> (supp x) - bs" |
|
125 and a2: "b \<notin> (supp x) - bs" |
|
126 shows "(bs, x) \<approx>abs ((a \<rightleftharpoons> b) \<bullet> bs, (a \<rightleftharpoons> b) \<bullet> x)" |
|
127 apply(simp) |
|
128 apply(rule_tac x="(a \<rightleftharpoons> b)" in exI) |
|
129 unfolding alpha_gen |
|
130 apply(simp) |
|
131 apply(simp add: supp_eqvt[symmetric] Diff_eqvt[symmetric]) |
|
132 apply(simp add: swap_set_not_in[OF a1 a2]) |
|
133 apply(subgoal_tac "supp (a \<rightleftharpoons> b) \<subseteq> {a, b}") |
|
134 using a1 a2 |
|
135 apply(simp add: fresh_star_def fresh_def) |
|
136 apply(blast) |
|
137 apply(simp add: supp_swap) |
|
138 done |
|
139 |
|
140 lemma alpha_gen_swap_fun: |
|
141 assumes f_eqvt: "\<And>pi. (pi \<bullet> (f x)) = f (pi \<bullet> x)" |
|
142 assumes a1: "a \<notin> (f x) - bs" |
|
143 and a2: "b \<notin> (f x) - bs" |
|
144 shows "\<exists>pi. (bs, x) \<approx>gen (op=) f pi ((a \<rightleftharpoons> b) \<bullet> bs, (a \<rightleftharpoons> b) \<bullet> x)" |
|
145 apply(rule_tac x="(a \<rightleftharpoons> b)" in exI) |
|
146 apply(simp add: alpha_gen) |
|
147 apply(simp add: f_eqvt[symmetric] Diff_eqvt[symmetric]) |
|
148 apply(simp add: swap_set_not_in[OF a1 a2]) |
|
149 apply(subgoal_tac "supp (a \<rightleftharpoons> b) \<subseteq> {a, b}") |
|
150 using a1 a2 |
|
151 apply(simp add: fresh_star_def fresh_def) |
|
152 apply(blast) |
|
153 apply(simp add: supp_swap) |
|
154 done |
|
155 |
|
156 fun |
|
157 supp_abs_fun |
|
158 where |
|
159 "supp_abs_fun (bs, x) = (supp x) - bs" |
|
160 |
|
161 lemma supp_abs_fun_lemma: |
|
162 assumes a: "x \<approx>abs y" |
|
163 shows "supp_abs_fun x = supp_abs_fun y" |
|
164 using a |
|
165 apply(induct rule: alpha_abs.induct) |
|
166 apply(simp add: alpha_gen) |
|
167 done |
|
168 |
|
169 quotient_type 'a abs = "(atom set \<times> 'a::pt)" / "alpha_abs" |
|
170 apply(rule equivpI) |
|
171 unfolding reflp_def symp_def transp_def |
|
172 apply(simp_all) |
|
173 (* refl *) |
|
174 apply(clarify) |
|
175 apply(rule exI) |
|
176 apply(rule alpha_gen_refl) |
|
177 apply(simp) |
|
178 (* symm *) |
|
179 apply(clarify) |
|
180 apply(rule exI) |
|
181 apply(rule alpha_gen_sym) |
|
182 apply(assumption) |
|
183 apply(clarsimp) |
|
184 (* trans *) |
|
185 apply(clarify) |
|
186 apply(rule exI) |
|
187 apply(rule alpha_gen_trans) |
|
188 apply(assumption) |
|
189 apply(assumption) |
|
190 apply(simp) |
|
191 done |
|
192 |
|
193 quotient_definition |
|
194 "Abs::atom set \<Rightarrow> ('a::pt) \<Rightarrow> 'a abs" |
|
195 is |
|
196 "Pair::atom set \<Rightarrow> ('a::pt) \<Rightarrow> (atom set \<times> 'a)" |
|
197 |
|
198 lemma [quot_respect]: |
|
199 shows "((op =) ===> (op =) ===> alpha_abs) Pair Pair" |
|
200 apply(clarsimp) |
|
201 apply(rule exI) |
|
202 apply(rule alpha_gen_refl) |
|
203 apply(simp) |
|
204 done |
|
205 |
|
206 lemma [quot_respect]: |
|
207 shows "((op =) ===> alpha_abs ===> alpha_abs) permute permute" |
|
208 apply(clarsimp) |
|
209 apply(rule exI) |
|
210 apply(rule alpha_gen_eqvt) |
|
211 apply(assumption) |
|
212 apply(simp_all add: supp_eqvt) |
|
213 done |
|
214 |
|
215 lemma [quot_respect]: |
|
216 shows "(alpha_abs ===> (op =)) supp_abs_fun supp_abs_fun" |
|
217 apply(simp add: supp_abs_fun_lemma) |
|
218 done |
|
219 |
|
220 lemma abs_induct: |
|
221 "\<lbrakk>\<And>as (x::'a::pt). P (Abs as x)\<rbrakk> \<Longrightarrow> P t" |
|
222 apply(lifting prod.induct[where 'a="atom set" and 'b="'a"]) |
|
223 done |
|
224 |
|
225 (* TEST case *) |
|
226 lemmas abs_induct2 = prod.induct[where 'a="atom set" and 'b="'a::pt", quot_lifted] |
|
227 thm abs_induct abs_induct2 |
|
228 |
|
229 instantiation abs :: (pt) pt |
|
230 begin |
|
231 |
|
232 quotient_definition |
|
233 "permute_abs::perm \<Rightarrow> ('a::pt abs) \<Rightarrow> 'a abs" |
|
234 is |
|
235 "permute:: perm \<Rightarrow> (atom set \<times> 'a::pt) \<Rightarrow> (atom set \<times> 'a::pt)" |
|
236 |
|
237 lemma permute_ABS [simp]: |
|
238 fixes x::"'a::pt" (* ??? has to be 'a \<dots> 'b does not work *) |
|
239 shows "(p \<bullet> (Abs as x)) = Abs (p \<bullet> as) (p \<bullet> x)" |
|
240 by (lifting permute_prod.simps(1)[where 'a="atom set" and 'b="'a"]) |
|
241 |
|
242 instance |
|
243 apply(default) |
|
244 apply(induct_tac [!] x rule: abs_induct) |
|
245 apply(simp_all) |
|
246 done |
|
247 |
|
248 end |
|
249 |
|
250 quotient_definition |
|
251 "supp_Abs_fun :: ('a::pt) abs \<Rightarrow> atom \<Rightarrow> bool" |
|
252 is |
|
253 "supp_abs_fun" |
|
254 |
|
255 lemma supp_Abs_fun_simp: |
|
256 shows "supp_Abs_fun (Abs bs x) = (supp x) - bs" |
|
257 by (lifting supp_abs_fun.simps(1)) |
|
258 |
|
259 lemma supp_Abs_fun_eqvt [eqvt]: |
|
260 shows "(p \<bullet> supp_Abs_fun x) = supp_Abs_fun (p \<bullet> x)" |
|
261 apply(induct_tac x rule: abs_induct) |
|
262 apply(simp add: supp_Abs_fun_simp supp_eqvt Diff_eqvt) |
|
263 done |
|
264 |
|
265 lemma supp_Abs_fun_fresh: |
|
266 shows "a \<sharp> Abs bs x \<Longrightarrow> a \<sharp> supp_Abs_fun (Abs bs x)" |
|
267 apply(rule fresh_fun_eqvt_app) |
|
268 apply(simp add: eqvts_raw) |
|
269 apply(simp) |
|
270 done |
|
271 |
|
272 lemma Abs_swap: |
|
273 assumes a1: "a \<notin> (supp x) - bs" |
|
274 and a2: "b \<notin> (supp x) - bs" |
|
275 shows "(Abs bs x) = (Abs ((a \<rightleftharpoons> b) \<bullet> bs) ((a \<rightleftharpoons> b) \<bullet> x))" |
|
276 using a1 a2 by (lifting alpha_abs_swap) |
|
277 |
|
278 lemma Abs_supports: |
|
279 shows "((supp x) - as) supports (Abs as x)" |
|
280 unfolding supports_def |
|
281 apply(clarify) |
|
282 apply(simp (no_asm)) |
|
283 apply(subst Abs_swap[symmetric]) |
|
284 apply(simp_all) |
|
285 done |
|
286 |
|
287 lemma supp_Abs_subset1: |
|
288 fixes x::"'a::fs" |
|
289 shows "(supp x) - as \<subseteq> supp (Abs as x)" |
|
290 apply(simp add: supp_conv_fresh) |
|
291 apply(auto) |
|
292 apply(drule_tac supp_Abs_fun_fresh) |
|
293 apply(simp only: supp_Abs_fun_simp) |
|
294 apply(simp add: fresh_def) |
|
295 apply(simp add: supp_finite_atom_set finite_supp) |
|
296 done |
|
297 |
|
298 lemma supp_Abs_subset2: |
|
299 fixes x::"'a::fs" |
|
300 shows "supp (Abs as x) \<subseteq> (supp x) - as" |
|
301 apply(rule supp_is_subset) |
|
302 apply(rule Abs_supports) |
|
303 apply(simp add: finite_supp) |
|
304 done |
|
305 |
|
306 lemma supp_Abs: |
|
307 fixes x::"'a::fs" |
|
308 shows "supp (Abs as x) = (supp x) - as" |
|
309 apply(rule_tac subset_antisym) |
|
310 apply(rule supp_Abs_subset2) |
|
311 apply(rule supp_Abs_subset1) |
|
312 done |
|
313 |
|
314 instance abs :: (fs) fs |
|
315 apply(default) |
|
316 apply(induct_tac x rule: abs_induct) |
|
317 apply(simp add: supp_Abs) |
|
318 apply(simp add: finite_supp) |
|
319 done |
|
320 |
|
321 lemma Abs_fresh_iff: |
|
322 fixes x::"'a::fs" |
|
323 shows "a \<sharp> Abs bs x \<longleftrightarrow> a \<in> bs \<or> (a \<notin> bs \<and> a \<sharp> x)" |
|
324 apply(simp add: fresh_def) |
|
325 apply(simp add: supp_Abs) |
|
326 apply(auto) |
|
327 done |
|
328 |
|
329 lemma Abs_eq_iff: |
|
330 shows "Abs bs x = Abs cs y \<longleftrightarrow> (\<exists>p. (bs, x) \<approx>gen (op =) supp p (cs, y))" |
|
331 by (lifting alpha_abs.simps(1)) |
|
332 |
|
333 |
|
334 |
|
335 (* |
|
336 below is a construction site for showing that in the |
|
337 single-binder case, the old and new alpha equivalence |
|
338 coincide |
|
339 *) |
|
340 |
|
341 fun |
|
342 alpha1 |
|
343 where |
|
344 "alpha1 (a, x) (b, y) \<longleftrightarrow> (a = b \<and> x = y) \<or> (a \<noteq> b \<and> x = (a \<rightleftharpoons> b) \<bullet> y \<and> a \<sharp> y)" |
|
345 |
|
346 notation |
|
347 alpha1 ("_ \<approx>abs1 _") |
|
348 |
|
349 fun |
|
350 alpha2 |
|
351 where |
|
352 "alpha2 (a, x) (b, y) \<longleftrightarrow> (\<exists>c. c \<sharp> (a,b,x,y) \<and> ((c \<rightleftharpoons> a) \<bullet> x) = ((c \<rightleftharpoons> b) \<bullet> y))" |
|
353 |
|
354 notation |
|
355 alpha2 ("_ \<approx>abs2 _") |
|
356 |
|
357 |
|
358 lemma |
|
359 assumes a: "(a, x) \<approx>abs1 (b, y)" "sort_of a = sort_of b" |
|
360 shows "({a}, x) \<approx>abs ({b}, y)" |
|
361 using a |
|
362 apply(simp) |
|
363 apply(erule disjE) |
|
364 apply(simp) |
|
365 apply(rule exI) |
|
366 apply(rule alpha_gen_refl) |
|
367 apply(simp) |
|
368 apply(rule_tac x="(a \<rightleftharpoons> b)" in exI) |
|
369 apply(simp add: alpha_gen) |
|
370 apply(simp add: fresh_def) |
|
371 apply(rule conjI) |
|
372 apply(rule_tac ?p1="(a \<rightleftharpoons> b)" in permute_eq_iff[THEN iffD1]) |
|
373 apply(rule trans) |
|
374 apply(simp add: Diff_eqvt supp_eqvt) |
|
375 apply(subst swap_set_not_in) |
|
376 back |
|
377 apply(simp) |
|
378 apply(simp) |
|
379 apply(simp add: permute_set_eq) |
|
380 apply(simp add: eqvts) |
|
381 apply(rule_tac ?p1="(a \<rightleftharpoons> b)" in fresh_star_permute_iff[THEN iffD1]) |
|
382 apply(simp add: permute_self) |
|
383 apply(simp add: Diff_eqvt supp_eqvt) |
|
384 apply(simp add: permute_set_eq) |
|
385 apply(subgoal_tac "supp (a \<rightleftharpoons> b) \<subseteq> {a, b}") |
|
386 apply(simp add: fresh_star_def fresh_def) |
|
387 apply(blast) |
|
388 apply(simp add: supp_swap) |
|
389 done |
|
390 |
|
391 lemma perm_zero: |
|
392 assumes a: "\<forall>x::atom. p \<bullet> x = x" |
|
393 shows "p = 0" |
|
394 using a |
|
395 by (simp add: expand_perm_eq) |
|
396 |
|
397 fun |
|
398 add_perm |
|
399 where |
|
400 "add_perm [] = 0" |
|
401 | "add_perm ((a, b) # xs) = (a \<rightleftharpoons> b) + add_perm xs" |
|
402 |
|
403 fun |
|
404 elem_perm |
|
405 where |
|
406 "elem_perm [] = {}" |
|
407 | "elem_perm ((a, b) # xs) = {a, b} \<union> elem_perm xs" |
|
408 |
|
409 |
|
410 lemma add_perm_apend: |
|
411 shows "add_perm (xs @ ys) = add_perm xs + add_perm ys" |
|
412 apply(induct xs arbitrary: ys) |
|
413 apply(auto simp add: add_assoc) |
|
414 done |
|
415 |
|
416 lemma perm_list_exists: |
|
417 fixes p::perm |
|
418 shows "\<exists>xs. p = add_perm xs \<and> supp xs \<subseteq> supp p" |
|
419 apply(induct p taking: "\<lambda>p::perm. card (supp p)" rule: measure_induct) |
|
420 apply(rename_tac p) |
|
421 apply(case_tac "supp p = {}") |
|
422 apply(simp) |
|
423 apply(simp add: supp_perm) |
|
424 apply(drule perm_zero) |
|
425 apply(simp) |
|
426 apply(rule_tac x="[]" in exI) |
|
427 apply(simp add: supp_Nil) |
|
428 apply(subgoal_tac "\<exists>x. x \<in> supp p") |
|
429 defer |
|
430 apply(auto)[1] |
|
431 apply(erule exE) |
|
432 apply(drule_tac x="p + (((- p) \<bullet> x) \<rightleftharpoons> x)" in spec) |
|
433 apply(drule mp) |
|
434 defer |
|
435 apply(erule exE) |
|
436 apply(rule_tac x="xs @ [((- p) \<bullet> x, x)]" in exI) |
|
437 apply(simp add: add_perm_apend) |
|
438 apply(erule conjE) |
|
439 apply(drule sym) |
|
440 apply(simp) |
|
441 apply(simp add: expand_perm_eq) |
|
442 apply(simp add: supp_append) |
|
443 apply(simp add: supp_perm supp_Cons supp_Nil supp_Pair supp_atom) |
|
444 apply(rule conjI) |
|
445 prefer 2 |
|
446 apply(auto)[1] |
|
447 apply (metis left_minus minus_unique permute_atom_def_raw permute_minus_cancel(2)) |
|
448 defer |
|
449 apply(rule psubset_card_mono) |
|
450 apply(simp add: finite_supp) |
|
451 apply(rule psubsetI) |
|
452 defer |
|
453 apply(subgoal_tac "x \<notin> supp (p + (- p \<bullet> x \<rightleftharpoons> x))") |
|
454 apply(blast) |
|
455 apply(simp add: supp_perm) |
|
456 defer |
|
457 apply(auto simp add: supp_perm)[1] |
|
458 apply(case_tac "x = xa") |
|
459 apply(simp) |
|
460 apply(case_tac "((- p) \<bullet> x) = xa") |
|
461 apply(simp) |
|
462 apply(case_tac "sort_of xa = sort_of x") |
|
463 apply(simp) |
|
464 apply(auto)[1] |
|
465 apply(simp) |
|
466 apply(simp) |
|
467 apply(subgoal_tac "{a. p \<bullet> (- p \<bullet> x \<rightleftharpoons> x) \<bullet> a \<noteq> a} \<subseteq> {a. p \<bullet> a \<noteq> a}") |
|
468 apply(blast) |
|
469 apply(auto simp add: supp_perm)[1] |
|
470 apply(case_tac "x = xa") |
|
471 apply(simp) |
|
472 apply(case_tac "((- p) \<bullet> x) = xa") |
|
473 apply(simp) |
|
474 apply(case_tac "sort_of xa = sort_of x") |
|
475 apply(simp) |
|
476 apply(auto)[1] |
|
477 apply(simp) |
|
478 apply(simp) |
|
479 done |
|
480 |
|
481 lemma tt0: |
|
482 fixes p::perm |
|
483 shows "(supp x) \<sharp>* p \<Longrightarrow> \<forall>a \<in> supp p. a \<sharp> x" |
|
484 apply(auto simp add: fresh_star_def supp_perm fresh_def) |
|
485 done |
|
486 |
|
487 lemma uu0: |
|
488 shows "(\<forall>a \<in> elem_perm xs. a \<sharp> x) \<Longrightarrow> (add_perm xs \<bullet> x) = x" |
|
489 apply(induct xs rule: add_perm.induct) |
|
490 apply(simp) |
|
491 apply(simp add: swap_fresh_fresh) |
|
492 done |
|
493 |
|
494 lemma yy0: |
|
495 fixes xs::"(atom \<times> atom) list" |
|
496 shows "supp xs = elem_perm xs" |
|
497 apply(induct xs rule: elem_perm.induct) |
|
498 apply(auto simp add: supp_Nil supp_Cons supp_Pair supp_atom) |
|
499 done |
|
500 |
|
501 lemma tt1: |
|
502 shows "(supp x) \<sharp>* p \<Longrightarrow> p \<bullet> x = x" |
|
503 apply(drule tt0) |
|
504 apply(subgoal_tac "\<exists>xs. p = add_perm xs \<and> supp xs \<subseteq> supp p") |
|
505 prefer 2 |
|
506 apply(rule perm_list_exists) |
|
507 apply(erule exE) |
|
508 apply(simp only: yy0) |
|
509 apply(rule uu0) |
|
510 apply(auto) |
|
511 done |
|
512 |
|
513 |
|
514 lemma perm_induct_test: |
|
515 fixes P :: "perm => bool" |
|
516 assumes fin: "finite (supp p)" |
|
517 assumes zero: "P 0" |
|
518 assumes swap: "\<And>a b. \<lbrakk>sort_of a = sort_of b; a \<noteq> b\<rbrakk> \<Longrightarrow> P (a \<rightleftharpoons> b)" |
|
519 assumes plus: "\<And>p1 p2. \<lbrakk>supp p1 \<inter> supp p2 = {}; P p1; P p2\<rbrakk> \<Longrightarrow> P (p1 + p2)" |
|
520 shows "P p" |
|
521 using fin |
|
522 apply(induct F\<equiv>"supp p" arbitrary: p rule: finite_induct) |
|
523 apply(simp add: supp_perm) |
|
524 apply(drule perm_zero) |
|
525 apply(simp add: zero) |
|
526 apply(rotate_tac 3) |
|
527 oops |
|
528 |
|
529 lemma yy: |
|
530 assumes "S1 - {x} = S2 - {x}" "x \<in> S1" "x \<in> S2" |
|
531 shows "S1 = S2" |
|
532 using assms |
|
533 apply (metis insert_Diff_single insert_absorb) |
|
534 done |
|
535 |
|
536 lemma permute_boolI: |
|
537 fixes P::"bool" |
|
538 shows "p \<bullet> P \<Longrightarrow> P" |
|
539 apply(simp add: permute_bool_def) |
|
540 done |
|
541 |
|
542 lemma permute_boolE: |
|
543 fixes P::"bool" |
|
544 shows "P \<Longrightarrow> p \<bullet> P" |
|
545 apply(simp add: permute_bool_def) |
|
546 done |
|
547 |
|
548 lemma kk: |
|
549 assumes a: "p \<bullet> x = y" |
|
550 shows "\<forall>a \<in> supp x. (p \<bullet> a) \<in> supp y" |
|
551 using a |
|
552 apply(auto) |
|
553 apply(rule_tac p="- p" in permute_boolI) |
|
554 apply(simp add: mem_eqvt supp_eqvt) |
|
555 done |
|
556 |
|
557 lemma ww: |
|
558 assumes "a \<notin> supp x" "b \<in> supp x" "a \<noteq> b" "sort_of a = sort_of b" |
|
559 shows "((a \<rightleftharpoons> b) \<bullet> x) \<noteq> x" |
|
560 apply(subgoal_tac "(supp x) supports x") |
|
561 apply(simp add: supports_def) |
|
562 using assms |
|
563 apply - |
|
564 apply(drule_tac x="a" in spec) |
|
565 defer |
|
566 apply(rule supp_supports) |
|
567 apply(auto) |
|
568 apply(rotate_tac 1) |
|
569 apply(drule_tac p="(a \<rightleftharpoons> b)" in permute_boolE) |
|
570 apply(simp add: mem_eqvt supp_eqvt) |
|
571 done |
|
572 |
|
573 lemma alpha_abs_sym: |
|
574 assumes a: "({a}, x) \<approx>abs ({b}, y)" |
|
575 shows "({b}, y) \<approx>abs ({a}, x)" |
|
576 using a |
|
577 apply(simp) |
|
578 apply(erule exE) |
|
579 apply(rule_tac x="- p" in exI) |
|
580 apply(simp add: alpha_gen) |
|
581 apply(simp add: fresh_star_def fresh_minus_perm) |
|
582 apply (metis permute_minus_cancel(2)) |
|
583 done |
|
584 |
|
585 lemma alpha_abs_trans: |
|
586 assumes a: "({a1}, x1) \<approx>abs ({a2}, x2)" |
|
587 assumes b: "({a2}, x2) \<approx>abs ({a3}, x3)" |
|
588 shows "({a1}, x1) \<approx>abs ({a3}, x3)" |
|
589 using a b |
|
590 apply(simp) |
|
591 apply(erule exE)+ |
|
592 apply(rule_tac x="pa + p" in exI) |
|
593 apply(simp add: alpha_gen) |
|
594 apply(simp add: fresh_star_def fresh_plus_perm) |
|
595 done |
|
596 |
|
597 lemma alpha_equal: |
|
598 assumes a: "({a}, x) \<approx>abs ({a}, y)" |
|
599 shows "(a, x) \<approx>abs1 (a, y)" |
|
600 using a |
|
601 apply(simp) |
|
602 apply(erule exE) |
|
603 apply(simp add: alpha_gen) |
|
604 apply(erule conjE)+ |
|
605 apply(case_tac "a \<notin> supp x") |
|
606 apply(simp) |
|
607 apply(subgoal_tac "supp x \<sharp>* p") |
|
608 apply(drule tt1) |
|
609 apply(simp) |
|
610 apply(simp) |
|
611 apply(simp) |
|
612 apply(case_tac "a \<notin> supp y") |
|
613 apply(simp) |
|
614 apply(drule tt1) |
|
615 apply(clarify) |
|
616 apply(simp (no_asm_use)) |
|
617 apply(simp) |
|
618 apply(simp) |
|
619 apply(drule yy) |
|
620 apply(simp) |
|
621 apply(simp) |
|
622 apply(simp) |
|
623 apply(case_tac "a \<sharp> p") |
|
624 apply(subgoal_tac "supp y \<sharp>* p") |
|
625 apply(drule tt1) |
|
626 apply(clarify) |
|
627 apply(simp (no_asm_use)) |
|
628 apply(metis) |
|
629 apply(auto simp add: fresh_star_def)[1] |
|
630 apply(frule_tac kk) |
|
631 apply(drule_tac x="a" in bspec) |
|
632 apply(simp) |
|
633 apply(simp add: fresh_def) |
|
634 apply(simp add: supp_perm) |
|
635 apply(subgoal_tac "((p \<bullet> a) \<sharp> p)") |
|
636 apply(simp add: fresh_def supp_perm) |
|
637 apply(simp add: fresh_star_def) |
|
638 done |
|
639 |
|
640 lemma alpha_unequal: |
|
641 assumes a: "({a}, x) \<approx>abs ({b}, y)" "sort_of a = sort_of b" "a \<noteq> b" |
|
642 shows "(a, x) \<approx>abs1 (b, y)" |
|
643 using a |
|
644 apply - |
|
645 apply(subgoal_tac "a \<notin> supp x - {a}") |
|
646 apply(subgoal_tac "b \<notin> supp x - {a}") |
|
647 defer |
|
648 apply(simp add: alpha_gen) |
|
649 apply(simp) |
|
650 apply(drule_tac alpha_abs_swap) |
|
651 apply(assumption) |
|
652 apply(simp only: insert_eqvt empty_eqvt swap_atom_simps) |
|
653 apply(drule alpha_abs_sym) |
|
654 apply(rotate_tac 4) |
|
655 apply(drule_tac alpha_abs_trans) |
|
656 apply(assumption) |
|
657 apply(drule alpha_equal) |
|
658 apply(simp) |
|
659 apply(rule_tac p="(a \<rightleftharpoons> b)" in permute_boolI) |
|
660 apply(simp add: fresh_eqvt) |
|
661 apply(simp add: fresh_def) |
|
662 done |
|
663 |
|
664 lemma alpha_new_old: |
|
665 assumes a: "({a}, x) \<approx>abs ({b}, y)" "sort_of a = sort_of b" |
|
666 shows "(a, x) \<approx>abs1 (b, y)" |
|
667 using a |
|
668 apply(case_tac "a=b") |
|
669 apply(simp only: alpha_equal) |
|
670 apply(drule alpha_unequal) |
|
671 apply(simp) |
|
672 apply(simp) |
|
673 apply(simp) |
|
674 done |
|
675 |
|
676 fun |
|
677 distinct_perms |
|
678 where |
|
679 "distinct_perms [] = True" |
|
680 | "distinct_perms (p # ps) = (supp p \<inter> supp ps = {} \<and> distinct_perms ps)" |
|
681 |
|
682 (* support of concrete atom sets *) |
|
683 |
|
684 lemma atom_eqvt_raw: |
|
685 fixes p::"perm" |
|
686 shows "(p \<bullet> atom) = atom" |
|
687 by (simp add: expand_fun_eq permute_fun_def atom_eqvt) |
|
688 |
|
689 lemma atom_image_cong: |
|
690 shows "(atom ` X = atom ` Y) = (X = Y)" |
|
691 apply(rule inj_image_eq_iff) |
|
692 apply(simp add: inj_on_def) |
|
693 done |
|
694 |
|
695 lemma supp_atom_image: |
|
696 fixes as::"'a::at_base set" |
|
697 shows "supp (atom ` as) = supp as" |
|
698 apply(simp add: supp_def) |
|
699 apply(simp add: image_eqvt) |
|
700 apply(simp add: atom_eqvt_raw) |
|
701 apply(simp add: atom_image_cong) |
|
702 done |
|
703 |
|
704 lemma swap_atom_image_fresh: "\<lbrakk>a \<sharp> atom ` (fn :: ('a :: at_base set)); b \<sharp> atom ` fn\<rbrakk> \<Longrightarrow> (a \<rightleftharpoons> b) \<bullet> fn = fn" |
|
705 apply (simp add: fresh_def) |
|
706 apply (simp add: supp_atom_image) |
|
707 apply (fold fresh_def) |
|
708 apply (simp add: swap_fresh_fresh) |
|
709 done |
|
710 |
|
711 |
|
712 end |
|
713 |