102 |
102 |
103 section {* permutation equality *} |
103 section {* permutation equality *} |
104 (*==============================*) |
104 (*==============================*) |
105 |
105 |
106 constdefs |
106 constdefs |
107 prm_eq :: "'x prm \<Rightarrow> 'x prm \<Rightarrow> bool" (" _ \<sim> _ " [80,80] 80) |
107 prm_eq :: "'x prm \<Rightarrow> 'x prm \<Rightarrow> bool" (" _ \<triangleq> _ " [80,80] 80) |
108 "pi1 \<sim> pi2 \<equiv> \<forall>a::'x. pi1\<bullet>a = pi2\<bullet>a" |
108 "pi1 \<triangleq> pi2 \<equiv> \<forall>a::'x. pi1\<bullet>a = pi2\<bullet>a" |
109 |
109 |
110 section {* Support, Freshness and Supports*} |
110 section {* Support, Freshness and Supports*} |
111 (*========================================*) |
111 (*========================================*) |
112 constdefs |
112 constdefs |
113 supp :: "'a \<Rightarrow> ('x set)" |
113 supp :: "'a \<Rightarrow> ('x set)" |
256 (* properties for being a permutation type *) |
256 (* properties for being a permutation type *) |
257 constdefs |
257 constdefs |
258 "pt TYPE('a) TYPE('x) \<equiv> |
258 "pt TYPE('a) TYPE('x) \<equiv> |
259 (\<forall>(x::'a). ([]::'x prm)\<bullet>x = x) \<and> |
259 (\<forall>(x::'a). ([]::'x prm)\<bullet>x = x) \<and> |
260 (\<forall>(pi1::'x prm) (pi2::'x prm) (x::'a). (pi1@pi2)\<bullet>x = pi1\<bullet>(pi2\<bullet>x)) \<and> |
260 (\<forall>(pi1::'x prm) (pi2::'x prm) (x::'a). (pi1@pi2)\<bullet>x = pi1\<bullet>(pi2\<bullet>x)) \<and> |
261 (\<forall>(pi1::'x prm) (pi2::'x prm) (x::'a). pi1 \<sim> pi2 \<longrightarrow> pi1\<bullet>x = pi2\<bullet>x)" |
261 (\<forall>(pi1::'x prm) (pi2::'x prm) (x::'a). pi1 \<triangleq> pi2 \<longrightarrow> pi1\<bullet>x = pi2\<bullet>x)" |
262 |
262 |
263 (* properties for being an atom type *) |
263 (* properties for being an atom type *) |
264 constdefs |
264 constdefs |
265 "at TYPE('x) \<equiv> |
265 "at TYPE('x) \<equiv> |
266 (\<forall>(x::'x). ([]::'x prm)\<bullet>x = x) \<and> |
266 (\<forall>(x::'x). ([]::'x prm)\<bullet>x = x) \<and> |
428 |
428 |
429 lemma at_prm_rev_eq: |
429 lemma at_prm_rev_eq: |
430 fixes pi1 :: "'x prm" |
430 fixes pi1 :: "'x prm" |
431 and pi2 :: "'x prm" |
431 and pi2 :: "'x prm" |
432 assumes at: "at TYPE('x)" |
432 assumes at: "at TYPE('x)" |
433 shows a: "((rev pi1) \<sim> (rev pi2)) = (pi1 \<sim> pi2)" |
433 shows a: "((rev pi1) \<triangleq> (rev pi2)) = (pi1 \<triangleq> pi2)" |
434 proof (simp add: prm_eq_def, auto) |
434 proof (simp add: prm_eq_def, auto) |
435 fix x |
435 fix x |
436 assume "\<forall>x::'x. (rev pi1)\<bullet>x = (rev pi2)\<bullet>x" |
436 assume "\<forall>x::'x. (rev pi1)\<bullet>x = (rev pi2)\<bullet>x" |
437 hence "(rev (pi1::'x prm))\<bullet>(pi2\<bullet>(x::'x)) = (rev (pi2::'x prm))\<bullet>(pi2\<bullet>x)" by simp |
437 hence "(rev (pi1::'x prm))\<bullet>(pi2\<bullet>(x::'x)) = (rev (pi2::'x prm))\<bullet>(pi2\<bullet>x)" by simp |
438 hence "(rev (pi1::'x prm))\<bullet>((pi2::'x prm)\<bullet>x) = (x::'x)" by (simp add: at_rev_pi[OF at]) |
438 hence "(rev (pi1::'x prm))\<bullet>((pi2::'x prm)\<bullet>x) = (x::'x)" by (simp add: at_rev_pi[OF at]) |
439 hence "(pi2::'x prm)\<bullet>x = (pi1::'x prm)\<bullet>x" by (simp add: at_bij2[OF at]) |
439 hence "(pi2::'x prm)\<bullet>x = (pi1::'x prm)\<bullet>x" by (simp add: at_bij2[OF at]) |
440 thus "pi1 \<bullet> x = pi2 \<bullet> x" by simp |
440 thus "pi1\<bullet>x = pi2\<bullet>x" by simp |
441 next |
441 next |
442 fix x |
442 fix x |
443 assume "\<forall>x::'x. pi1\<bullet>x = pi2\<bullet>x" |
443 assume "\<forall>x::'x. pi1\<bullet>x = pi2\<bullet>x" |
444 hence "(pi1::'x prm)\<bullet>((rev pi2)\<bullet>x) = (pi2::'x prm)\<bullet>((rev pi2)\<bullet>(x::'x))" by simp |
444 hence "(pi1::'x prm)\<bullet>((rev pi2)\<bullet>x) = (pi2::'x prm)\<bullet>((rev pi2)\<bullet>(x::'x))" by simp |
445 hence "(pi1::'x prm)\<bullet>((rev pi2)\<bullet>(x::'x)) = x" by (simp add: at_pi_rev[OF at]) |
445 hence "(pi1::'x prm)\<bullet>((rev pi2)\<bullet>(x::'x)) = x" by (simp add: at_pi_rev[OF at]) |
449 |
449 |
450 lemma at_prm_rev_eq1: |
450 lemma at_prm_rev_eq1: |
451 fixes pi1 :: "'x prm" |
451 fixes pi1 :: "'x prm" |
452 and pi2 :: "'x prm" |
452 and pi2 :: "'x prm" |
453 assumes at: "at TYPE('x)" |
453 assumes at: "at TYPE('x)" |
454 shows "pi1 \<sim> pi2 \<Longrightarrow> (rev pi1) \<sim> (rev pi2)" |
454 shows "pi1 \<triangleq> pi2 \<Longrightarrow> (rev pi1) \<triangleq> (rev pi2)" |
455 by (simp add: at_prm_rev_eq[OF at]) |
455 by (simp add: at_prm_rev_eq[OF at]) |
456 |
456 |
457 lemma at_ds1: |
457 lemma at_ds1: |
458 fixes a :: "'x" |
458 fixes a :: "'x" |
459 assumes at: "at TYPE('x)" |
459 assumes at: "at TYPE('x)" |
460 shows "[(a,a)] \<sim> []" |
460 shows "[(a,a)] \<triangleq> []" |
461 by (force simp add: prm_eq_def at_calc[OF at]) |
461 by (force simp add: prm_eq_def at_calc[OF at]) |
462 |
462 |
463 lemma at_ds2: |
463 lemma at_ds2: |
464 fixes pi :: "'x prm" |
464 fixes pi :: "'x prm" |
465 and a :: "'x" |
465 and a :: "'x" |
466 and b :: "'x" |
466 and b :: "'x" |
467 assumes at: "at TYPE('x)" |
467 assumes at: "at TYPE('x)" |
468 shows "(pi@[((rev pi)\<bullet>a,(rev pi)\<bullet>b)]) \<sim> ([(a,b)]@pi)" |
468 shows "(pi@[((rev pi)\<bullet>a,(rev pi)\<bullet>b)]) \<triangleq> ([(a,b)]@pi)" |
469 by (force simp add: prm_eq_def at_append[OF at] at_bij[OF at] at_pi_rev[OF at] |
469 by (force simp add: prm_eq_def at_append[OF at] at_bij[OF at] at_pi_rev[OF at] |
470 at_rev_pi[OF at] at_calc[OF at]) |
470 at_rev_pi[OF at] at_calc[OF at]) |
471 |
471 |
472 lemma at_ds3: |
472 lemma at_ds3: |
473 fixes a :: "'x" |
473 fixes a :: "'x" |
474 and b :: "'x" |
474 and b :: "'x" |
475 and c :: "'x" |
475 and c :: "'x" |
476 assumes at: "at TYPE('x)" |
476 assumes at: "at TYPE('x)" |
477 and a: "distinct [a,b,c]" |
477 and a: "distinct [a,b,c]" |
478 shows "[(a,c),(b,c),(a,c)] \<sim> [(a,b)]" |
478 shows "[(a,c),(b,c),(a,c)] \<triangleq> [(a,b)]" |
479 using a by (force simp add: prm_eq_def at_calc[OF at]) |
479 using a by (force simp add: prm_eq_def at_calc[OF at]) |
480 |
480 |
481 lemma at_ds4: |
481 lemma at_ds4: |
482 fixes a :: "'x" |
482 fixes a :: "'x" |
483 and b :: "'x" |
483 and b :: "'x" |
484 and pi :: "'x prm" |
484 and pi :: "'x prm" |
485 assumes at: "at TYPE('x)" |
485 assumes at: "at TYPE('x)" |
486 shows "(pi@[(a,(rev pi)\<bullet>b)]) \<sim> ([(pi\<bullet>a,b)]@pi)" |
486 shows "(pi@[(a,(rev pi)\<bullet>b)]) \<triangleq> ([(pi\<bullet>a,b)]@pi)" |
487 by (force simp add: prm_eq_def at_append[OF at] at_calc[OF at] at_bij[OF at] |
487 by (force simp add: prm_eq_def at_append[OF at] at_calc[OF at] at_bij[OF at] |
488 at_pi_rev[OF at] at_rev_pi[OF at]) |
488 at_pi_rev[OF at] at_rev_pi[OF at]) |
489 |
489 |
490 lemma at_ds5: |
490 lemma at_ds5: |
491 fixes a :: "'x" |
491 fixes a :: "'x" |
492 and b :: "'x" |
492 and b :: "'x" |
493 assumes at: "at TYPE('x)" |
493 assumes at: "at TYPE('x)" |
494 shows "[(a,b)] \<sim> [(b,a)]" |
494 shows "[(a,b)] \<triangleq> [(b,a)]" |
495 by (force simp add: prm_eq_def at_calc[OF at]) |
495 by (force simp add: prm_eq_def at_calc[OF at]) |
496 |
496 |
497 lemma at_ds6: |
497 lemma at_ds6: |
498 fixes a :: "'x" |
498 fixes a :: "'x" |
499 and b :: "'x" |
499 and b :: "'x" |
500 and c :: "'x" |
500 and c :: "'x" |
501 assumes at: "at TYPE('x)" |
501 assumes at: "at TYPE('x)" |
502 and a: "distinct [a,b,c]" |
502 and a: "distinct [a,b,c]" |
503 shows "[(a,c),(a,b)] \<sim> [(b,c),(a,c)]" |
503 shows "[(a,c),(a,b)] \<triangleq> [(b,c),(a,c)]" |
504 using a by (force simp add: prm_eq_def at_calc[OF at]) |
504 using a by (force simp add: prm_eq_def at_calc[OF at]) |
505 |
505 |
506 lemma at_ds7: |
506 lemma at_ds7: |
507 fixes pi :: "'x prm" |
507 fixes pi :: "'x prm" |
508 assumes at: "at TYPE('x)" |
508 assumes at: "at TYPE('x)" |
509 shows "((rev pi)@pi) \<sim> []" |
509 shows "((rev pi)@pi) \<triangleq> []" |
510 by (simp add: prm_eq_def at1[OF at] at_append[OF at] at_rev_pi[OF at]) |
510 by (simp add: prm_eq_def at1[OF at] at_append[OF at] at_rev_pi[OF at]) |
511 |
511 |
512 lemma at_ds8_aux: |
512 lemma at_ds8_aux: |
513 fixes pi :: "'x prm" |
513 fixes pi :: "'x prm" |
514 and a :: "'x" |
514 and a :: "'x" |
541 fixes pi1 :: "'x prm" |
541 fixes pi1 :: "'x prm" |
542 and pi2 :: "'x prm" |
542 and pi2 :: "'x prm" |
543 and a :: "'x" |
543 and a :: "'x" |
544 and b :: "'x" |
544 and b :: "'x" |
545 assumes at: "at TYPE('x)" |
545 assumes at: "at TYPE('x)" |
546 shows " ((rev pi2)@(rev pi1)) \<sim> ((rev pi1)@(rev (pi1\<bullet>pi2)))" |
546 shows " ((rev pi2)@(rev pi1)) \<triangleq> ((rev pi1)@(rev (pi1\<bullet>pi2)))" |
547 apply(induct_tac pi2) |
547 apply(induct_tac pi2) |
548 apply(simp add: prm_eq_def) |
548 apply(simp add: prm_eq_def) |
549 apply(auto simp add: prm_eq_def) |
549 apply(auto simp add: prm_eq_def) |
550 apply(simp add: at_append[OF at]) |
550 apply(simp add: at_append[OF at]) |
551 apply(simp add: at2[OF at] at1[OF at]) |
551 apply(simp add: at2[OF at] at1[OF at]) |
663 lemma pt3: |
663 lemma pt3: |
664 fixes pi1::"'x prm" |
664 fixes pi1::"'x prm" |
665 and pi2::"'x prm" |
665 and pi2::"'x prm" |
666 and x ::"'a" |
666 and x ::"'a" |
667 assumes a: "pt TYPE('a) TYPE('x)" |
667 assumes a: "pt TYPE('a) TYPE('x)" |
668 shows "pi1 \<sim> pi2 \<Longrightarrow> pi1\<bullet>x = pi2\<bullet>x" |
668 shows "pi1 \<triangleq> pi2 \<Longrightarrow> pi1\<bullet>x = pi2\<bullet>x" |
669 using a by (simp add: pt_def) |
669 using a by (simp add: pt_def) |
670 |
670 |
671 lemma pt3_rev: |
671 lemma pt3_rev: |
672 fixes pi1::"'x prm" |
672 fixes pi1::"'x prm" |
673 and pi2::"'x prm" |
673 and pi2::"'x prm" |
674 and x ::"'a" |
674 and x ::"'a" |
675 assumes pt: "pt TYPE('a) TYPE('x)" |
675 assumes pt: "pt TYPE('a) TYPE('x)" |
676 and at: "at TYPE('x)" |
676 and at: "at TYPE('x)" |
677 shows "pi1 \<sim> pi2 \<Longrightarrow> (rev pi1)\<bullet>x = (rev pi2)\<bullet>x" |
677 shows "pi1 \<triangleq> pi2 \<Longrightarrow> (rev pi1)\<bullet>x = (rev pi2)\<bullet>x" |
678 by (rule pt3[OF pt], simp add: at_prm_rev_eq[OF at]) |
678 by (rule pt3[OF pt], simp add: at_prm_rev_eq[OF at]) |
679 |
679 |
680 section {* composition properties *} |
680 section {* composition properties *} |
681 (* ============================== *) |
681 (* ============================== *) |
682 lemma cp1: |
682 lemma cp1: |
769 shows "pt TYPE('a\<Rightarrow>'b) TYPE('x)" |
769 shows "pt TYPE('a\<Rightarrow>'b) TYPE('x)" |
770 apply(auto simp only: pt_def) |
770 apply(auto simp only: pt_def) |
771 apply(simp_all add: perm_fun_def) |
771 apply(simp_all add: perm_fun_def) |
772 apply(simp add: pt1[OF pta] pt1[OF ptb]) |
772 apply(simp add: pt1[OF pta] pt1[OF ptb]) |
773 apply(simp add: pt2[OF pta] pt2[OF ptb]) |
773 apply(simp add: pt2[OF pta] pt2[OF ptb]) |
774 apply(subgoal_tac "(rev pi1) \<sim> (rev pi2)")(*A*) |
774 apply(subgoal_tac "(rev pi1) \<triangleq> (rev pi2)")(*A*) |
775 apply(simp add: pt3[OF pta] pt3[OF ptb]) |
775 apply(simp add: pt3[OF pta] pt3[OF ptb]) |
776 (*A*) |
776 (*A*) |
777 apply(simp add: at_prm_rev_eq[OF at]) |
777 apply(simp add: at_prm_rev_eq[OF at]) |
778 done |
778 done |
779 |
779 |
1259 and at: "at TYPE ('x)" |
1259 and at: "at TYPE ('x)" |
1260 and a1: "a\<sharp>x" and a2: "b\<sharp>x" |
1260 and a1: "a\<sharp>x" and a2: "b\<sharp>x" |
1261 shows "[(a,b)]\<bullet>x=x" |
1261 shows "[(a,b)]\<bullet>x=x" |
1262 proof (cases "a=b") |
1262 proof (cases "a=b") |
1263 assume c1: "a=b" |
1263 assume c1: "a=b" |
1264 have "[(a,a)] \<sim> []" by (rule at_ds1[OF at]) |
1264 have "[(a,a)] \<triangleq> []" by (rule at_ds1[OF at]) |
1265 hence "[(a,b)] \<sim> []" using c1 by simp |
1265 hence "[(a,b)] \<triangleq> []" using c1 by simp |
1266 hence "[(a,b)]\<bullet>x=([]::'x prm)\<bullet>x" by (rule pt3[OF pt]) |
1266 hence "[(a,b)]\<bullet>x=([]::'x prm)\<bullet>x" by (rule pt3[OF pt]) |
1267 thus ?thesis by (simp only: pt1[OF pt]) |
1267 thus ?thesis by (simp only: pt1[OF pt]) |
1268 next |
1268 next |
1269 assume c2: "a\<noteq>b" |
1269 assume c2: "a\<noteq>b" |
1270 from a1 have f1: "finite {c. [(a,c)]\<bullet>x \<noteq> x}" by (simp add: fresh_def supp_def) |
1270 from a1 have f1: "finite {c. [(a,c)]\<bullet>x \<noteq> x}" by (simp add: fresh_def supp_def) |
1283 and eq2: "[(b,c)]\<bullet>x = x" |
1283 and eq2: "[(b,c)]\<bullet>x = x" |
1284 and ineq: "a\<noteq>c \<and> b\<noteq>c" |
1284 and ineq: "a\<noteq>c \<and> b\<noteq>c" |
1285 by (force) |
1285 by (force) |
1286 hence "[(a,c)]\<bullet>([(b,c)]\<bullet>([(a,c)]\<bullet>x)) = x" by simp |
1286 hence "[(a,c)]\<bullet>([(b,c)]\<bullet>([(a,c)]\<bullet>x)) = x" by simp |
1287 hence eq3: "[(a,c),(b,c),(a,c)]\<bullet>x = x" by (simp add: pt2[OF pt,symmetric]) |
1287 hence eq3: "[(a,c),(b,c),(a,c)]\<bullet>x = x" by (simp add: pt2[OF pt,symmetric]) |
1288 from c2 ineq have "[(a,c),(b,c),(a,c)] \<sim> [(a,b)]" by (simp add: at_ds3[OF at]) |
1288 from c2 ineq have "[(a,c),(b,c),(a,c)] \<triangleq> [(a,b)]" by (simp add: at_ds3[OF at]) |
1289 hence "[(a,c),(b,c),(a,c)]\<bullet>x = [(a,b)]\<bullet>x" by (rule pt3[OF pt]) |
1289 hence "[(a,c),(b,c),(a,c)]\<bullet>x = [(a,b)]\<bullet>x" by (rule pt3[OF pt]) |
1290 thus ?thesis using eq3 by simp |
1290 thus ?thesis using eq3 by simp |
1291 qed |
1291 qed |
1292 |
1292 |
1293 lemma pt_perm_compose: |
1293 lemma pt_perm_compose: |
2336 have "c\<sharp>x = c\<sharp>y" using a2 a5 by (force simp add: at_calc[OF at] pt_fresh_left[OF pt, OF at]) |
2336 have "c\<sharp>x = c\<sharp>y" using a2 a5 by (force simp add: at_calc[OF at] pt_fresh_left[OF pt, OF at]) |
2337 moreover |
2337 moreover |
2338 have "c\<sharp>y \<longrightarrow> [(a,c)]\<bullet>x = [(b,c)]\<bullet>y" |
2338 have "c\<sharp>y \<longrightarrow> [(a,c)]\<bullet>x = [(b,c)]\<bullet>y" |
2339 proof (intro strip) |
2339 proof (intro strip) |
2340 assume a6: "c\<sharp>y" |
2340 assume a6: "c\<sharp>y" |
2341 have "[(a,c),(b,c),(a,c)] \<sim> [(a,b)]" using a1 a5 by (force intro: at_ds3[OF at]) |
2341 have "[(a,c),(b,c),(a,c)] \<triangleq> [(a,b)]" using a1 a5 by (force intro: at_ds3[OF at]) |
2342 hence "[(a,c)]\<bullet>([(b,c)]\<bullet>([(a,c)]\<bullet>y)) = [(a,b)]\<bullet>y" |
2342 hence "[(a,c)]\<bullet>([(b,c)]\<bullet>([(a,c)]\<bullet>y)) = [(a,b)]\<bullet>y" |
2343 by (simp add: pt2[OF pt, symmetric] pt3[OF pt]) |
2343 by (simp add: pt2[OF pt, symmetric] pt3[OF pt]) |
2344 hence "[(a,c)]\<bullet>([(b,c)]\<bullet>y) = [(a,b)]\<bullet>y" using a3 a6 |
2344 hence "[(a,c)]\<bullet>([(b,c)]\<bullet>y) = [(a,b)]\<bullet>y" using a3 a6 |
2345 by (simp add: pt_fresh_fresh[OF pt, OF at]) |
2345 by (simp add: pt_fresh_fresh[OF pt, OF at]) |
2346 hence "[(a,c)]\<bullet>([(b,c)]\<bullet>y) = x" using a2 by simp |
2346 hence "[(a,c)]\<bullet>([(b,c)]\<bullet>y) = x" using a2 by simp |