41 notation |
41 notation |
42 alpha_gen ("_ \<approx>gen _ _ _ _" [100, 100, 100, 100, 100] 100) and |
42 alpha_gen ("_ \<approx>gen _ _ _ _" [100, 100, 100, 100, 100] 100) and |
43 alpha_res ("_ \<approx>res _ _ _ _" [100, 100, 100, 100, 100] 100) and |
43 alpha_res ("_ \<approx>res _ _ _ _" [100, 100, 100, 100, 100] 100) and |
44 alpha_lst ("_ \<approx>lst _ _ _ _" [100, 100, 100, 100, 100] 100) |
44 alpha_lst ("_ \<approx>lst _ _ _ _" [100, 100, 100, 100, 100] 100) |
45 |
45 |
46 (* monos *) |
46 section {* Mono *} |
|
47 |
47 lemma [mono]: |
48 lemma [mono]: |
48 shows "R1 \<le> R2 \<Longrightarrow> alpha_gen bs R1 \<le> alpha_gen bs R2" |
49 shows "R1 \<le> R2 \<Longrightarrow> alpha_gen bs R1 \<le> alpha_gen bs R2" |
49 and "R1 \<le> R2 \<Longrightarrow> alpha_res bs R1 \<le> alpha_res bs R2" |
50 and "R1 \<le> R2 \<Longrightarrow> alpha_res bs R1 \<le> alpha_res bs R2" |
50 and "R1 \<le> R2 \<Longrightarrow> alpha_lst cs R1 \<le> alpha_lst cs R2" |
51 and "R1 \<le> R2 \<Longrightarrow> alpha_lst cs R1 \<le> alpha_lst cs R2" |
51 by (case_tac [!] bs, case_tac [!] cs) |
52 by (case_tac [!] bs, case_tac [!] cs) |
52 (auto simp add: le_fun_def le_bool_def alphas) |
53 (auto simp add: le_fun_def le_bool_def alphas) |
53 |
54 |
54 (* equivariance *) |
55 section {* Equivariance *} |
55 lemma alpha_gen_eqvt[eqvt]: |
56 |
|
57 lemma alpha_eqvt[eqvt]: |
56 shows "(bs, x) \<approx>gen R f q (cs, y) \<Longrightarrow> (p \<bullet> bs, p \<bullet> x) \<approx>gen (p \<bullet> R) (p \<bullet> f) (p \<bullet> q) (p \<bullet> cs, p \<bullet> y)" |
58 shows "(bs, x) \<approx>gen R f q (cs, y) \<Longrightarrow> (p \<bullet> bs, p \<bullet> x) \<approx>gen (p \<bullet> R) (p \<bullet> f) (p \<bullet> q) (p \<bullet> cs, p \<bullet> y)" |
57 and "(bs, x) \<approx>res R f q (cs, y) \<Longrightarrow> (p \<bullet> bs, p \<bullet> x) \<approx>res (p \<bullet> R) (p \<bullet> f) (p \<bullet> q) (p \<bullet> cs, p \<bullet> y)" |
59 and "(bs, x) \<approx>res R f q (cs, y) \<Longrightarrow> (p \<bullet> bs, p \<bullet> x) \<approx>res (p \<bullet> R) (p \<bullet> f) (p \<bullet> q) (p \<bullet> cs, p \<bullet> y)" |
58 and "(ds, x) \<approx>lst R f q (es, y) \<Longrightarrow> (p \<bullet> ds, p \<bullet> x) \<approx>lst (p \<bullet> R) (p \<bullet> f) (p \<bullet> q) (p \<bullet> es, p \<bullet> y)" |
60 and "(ds, x) \<approx>lst R f q (es, y) \<Longrightarrow> (p \<bullet> ds, p \<bullet> x) \<approx>lst (p \<bullet> R) (p \<bullet> f) (p \<bullet> q) (p \<bullet> es, p \<bullet> y)" |
59 unfolding alphas |
61 unfolding alphas |
60 unfolding permute_eqvt[symmetric] |
62 unfolding permute_eqvt[symmetric] |
61 unfolding set_eqvt[symmetric] |
63 unfolding set_eqvt[symmetric] |
62 unfolding permute_fun_app_eq[symmetric] |
64 unfolding permute_fun_app_eq[symmetric] |
63 unfolding Diff_eqvt[symmetric] |
65 unfolding Diff_eqvt[symmetric] |
64 by (auto simp add: permute_bool_def fresh_star_permute_iff) |
66 by (auto simp add: permute_bool_def fresh_star_permute_iff) |
65 |
67 |
66 (* equivalence *) |
68 |
67 lemma alpha_gen_refl: |
69 section {* Equivalence *} |
|
70 |
|
71 lemma alpha_refl: |
68 assumes a: "R x x" |
72 assumes a: "R x x" |
69 shows "(bs, x) \<approx>gen R f 0 (bs, x)" |
73 shows "(bs, x) \<approx>gen R f 0 (bs, x)" |
70 and "(bs, x) \<approx>res R f 0 (bs, x)" |
74 and "(bs, x) \<approx>res R f 0 (bs, x)" |
71 and "(cs, x) \<approx>lst R f 0 (cs, x)" |
75 and "(cs, x) \<approx>lst R f 0 (cs, x)" |
72 using a |
76 using a |
73 unfolding alphas |
77 unfolding alphas |
74 unfolding fresh_star_def |
78 unfolding fresh_star_def |
75 by (simp_all add: fresh_zero_perm) |
79 by (simp_all add: fresh_zero_perm) |
76 |
80 |
77 lemma alpha_gen_sym: |
81 lemma alpha_sym: |
78 assumes a: "R (p \<bullet> x) y \<Longrightarrow> R (- p \<bullet> y) x" |
82 assumes a: "R (p \<bullet> x) y \<Longrightarrow> R (- p \<bullet> y) x" |
79 shows "(bs, x) \<approx>gen R f p (cs, y) \<Longrightarrow> (cs, y) \<approx>gen R f (- p) (bs, x)" |
83 shows "(bs, x) \<approx>gen R f p (cs, y) \<Longrightarrow> (cs, y) \<approx>gen R f (- p) (bs, x)" |
80 and "(bs, x) \<approx>res R f p (cs, y) \<Longrightarrow> (cs, y) \<approx>res R f (- p) (bs, x)" |
84 and "(bs, x) \<approx>res R f p (cs, y) \<Longrightarrow> (cs, y) \<approx>res R f (- p) (bs, x)" |
81 and "(ds, x) \<approx>lst R f p (es, y) \<Longrightarrow> (es, y) \<approx>lst R f (- p) (ds, x)" |
85 and "(ds, x) \<approx>lst R f p (es, y) \<Longrightarrow> (es, y) \<approx>lst R f (- p) (ds, x)" |
82 unfolding alphas fresh_star_def |
86 unfolding alphas fresh_star_def |
83 using a |
87 using a |
84 by (auto simp add: fresh_minus_perm) |
88 by (auto simp add: fresh_minus_perm) |
85 |
89 |
86 lemma alpha_gen_sym_eqvt: |
90 lemma alpha_trans: |
|
91 assumes a: "\<lbrakk>R (p \<bullet> x) y; R (q \<bullet> y) z\<rbrakk> \<Longrightarrow> R ((q + p) \<bullet> x) z" |
|
92 shows "\<lbrakk>(bs, x) \<approx>gen R f p (cs, y); (cs, y) \<approx>gen R f q (ds, z)\<rbrakk> \<Longrightarrow> (bs, x) \<approx>gen R f (q + p) (ds, z)" |
|
93 and "\<lbrakk>(bs, x) \<approx>res R f p (cs, y); (cs, y) \<approx>res R f q (ds, z)\<rbrakk> \<Longrightarrow> (bs, x) \<approx>res R f (q + p) (ds, z)" |
|
94 and "\<lbrakk>(es, x) \<approx>lst R f p (gs, y); (gs, y) \<approx>lst R f q (hs, z)\<rbrakk> \<Longrightarrow> (es, x) \<approx>lst R f (q + p) (hs, z)" |
|
95 using a |
|
96 unfolding alphas fresh_star_def |
|
97 by (simp_all add: fresh_plus_perm) |
|
98 |
|
99 lemma alpha_sym_eqvt: |
87 assumes a: "R (p \<bullet> x) y \<Longrightarrow> R y (p \<bullet> x)" |
100 assumes a: "R (p \<bullet> x) y \<Longrightarrow> R y (p \<bullet> x)" |
88 and b: "p \<bullet> R = R" |
101 and b: "p \<bullet> R = R" |
89 shows "(bs, x) \<approx>gen R f p (cs, y) \<Longrightarrow> (cs, y) \<approx>gen R f (- p) (bs, x)" |
102 shows "(bs, x) \<approx>gen R f p (cs, y) \<Longrightarrow> (cs, y) \<approx>gen R f (- p) (bs, x)" |
90 and "(bs, x) \<approx>res R f p (cs, y) \<Longrightarrow> (cs, y) \<approx>res R f (- p) (bs, x)" |
103 and "(bs, x) \<approx>res R f p (cs, y) \<Longrightarrow> (cs, y) \<approx>res R f (- p) (bs, x)" |
91 and "(ds, x) \<approx>lst R f p (es, y) \<Longrightarrow> (es, y) \<approx>lst R f (- p) (ds, x)" |
104 and "(ds, x) \<approx>lst R f p (es, y) \<Longrightarrow> (es, y) \<approx>lst R f (- p) (ds, x)" |
92 apply(auto intro!: alpha_gen_sym) |
105 apply(auto intro!: alpha_sym) |
93 apply(drule_tac [!] a) |
106 apply(drule_tac [!] a) |
94 apply(rule_tac [!] p="p" in permute_boolE) |
107 apply(rule_tac [!] p="p" in permute_boolE) |
95 apply(perm_simp add: permute_minus_cancel b) |
108 apply(perm_simp add: permute_minus_cancel b) |
96 apply(assumption) |
109 apply(assumption) |
97 apply(perm_simp add: permute_minus_cancel b) |
110 apply(perm_simp add: permute_minus_cancel b) |
98 apply(assumption) |
111 apply(assumption) |
99 apply(perm_simp add: permute_minus_cancel b) |
112 apply(perm_simp add: permute_minus_cancel b) |
100 apply(assumption) |
113 apply(assumption) |
101 done |
114 done |
102 |
115 |
103 lemma alpha_gen_trans: |
|
104 assumes a: "\<lbrakk>R (p \<bullet> x) y; R (q \<bullet> y) z\<rbrakk> \<Longrightarrow> R ((q + p) \<bullet> x) z" |
|
105 shows "\<lbrakk>(bs, x) \<approx>gen R f p (cs, y); (cs, y) \<approx>gen R f q (ds, z)\<rbrakk> \<Longrightarrow> (bs, x) \<approx>gen R f (q + p) (ds, z)" |
|
106 and "\<lbrakk>(bs, x) \<approx>res R f p (cs, y); (cs, y) \<approx>res R f q (ds, z)\<rbrakk> \<Longrightarrow> (bs, x) \<approx>res R f (q + p) (ds, z)" |
|
107 and "\<lbrakk>(es, x) \<approx>lst R f p (gs, y); (gs, y) \<approx>lst R f q (hs, z)\<rbrakk> \<Longrightarrow> (es, x) \<approx>lst R f (q + p) (hs, z)" |
|
108 using a |
|
109 unfolding alphas fresh_star_def |
|
110 by (simp_all add: fresh_plus_perm) |
|
111 |
|
112 |
|
113 lemma alpha_gen_trans_eqvt: |
116 lemma alpha_gen_trans_eqvt: |
114 assumes b: "(cs, y) \<approx>gen R f q (ds, z)" |
117 assumes b: "(cs, y) \<approx>gen R f q (ds, z)" |
115 and a: "(bs, x) \<approx>gen R f p (cs, y)" |
118 and a: "(bs, x) \<approx>gen R f p (cs, y)" |
116 and d: "q \<bullet> R = R" |
119 and d: "q \<bullet> R = R" |
117 and c: "\<lbrakk>R (p \<bullet> x) y; R y (- q \<bullet> z)\<rbrakk> \<Longrightarrow> R (p \<bullet> x) (- q \<bullet> z)" |
120 and c: "\<lbrakk>R (p \<bullet> x) y; R y (- q \<bullet> z)\<rbrakk> \<Longrightarrow> R (p \<bullet> x) (- q \<bullet> z)" |
118 shows "(bs, x) \<approx>gen R f (q + p) (ds, z)" |
121 shows "(bs, x) \<approx>gen R f (q + p) (ds, z)" |
119 apply(rule alpha_gen_trans) |
122 apply(rule alpha_trans) |
120 defer |
123 defer |
121 apply(rule a) |
124 apply(rule a) |
122 apply(rule b) |
125 apply(rule b) |
123 apply(drule c) |
126 apply(drule c) |
124 apply(rule_tac p="q" in permute_boolE) |
127 apply(rule_tac p="q" in permute_boolE) |
577 "(bsl, x1, x2, x3) \<approx>lst (\<lambda>(x1, y1, z1) (x2, y2, z2). R1 x1 x2 \<and> R2 y1 y2 \<and> R3 z1 z2) (\<lambda>(a, b, c). f1 a \<union> (f2 b \<union> f3 c)) pi (csl, y1, y2, y3) = (f1 x1 \<union> (f2 x2 \<union> f3 x3) - set bsl = f1 y1 \<union> (f2 y2 \<union> f3 y3) - set csl \<and> |
623 "(bsl, x1, x2, x3) \<approx>lst (\<lambda>(x1, y1, z1) (x2, y2, z2). R1 x1 x2 \<and> R2 y1 y2 \<and> R3 z1 z2) (\<lambda>(a, b, c). f1 a \<union> (f2 b \<union> f3 c)) pi (csl, y1, y2, y3) = (f1 x1 \<union> (f2 x2 \<union> f3 x3) - set bsl = f1 y1 \<union> (f2 y2 \<union> f3 y3) - set csl \<and> |
578 (f1 x1 \<union> (f2 x2 \<union> f3 x3) - set bsl) \<sharp>* pi \<and> |
624 (f1 x1 \<union> (f2 x2 \<union> f3 x3) - set bsl) \<sharp>* pi \<and> |
579 R1 (pi \<bullet> x1) y1 \<and> R2 (pi \<bullet> x2) y2 \<and> R3 (pi \<bullet> x3) y3 \<and> pi \<bullet> bsl = csl)" |
625 R1 (pi \<bullet> x1) y1 \<and> R2 (pi \<bullet> x2) y2 \<and> R3 (pi \<bullet> x3) y3 \<and> pi \<bullet> bsl = csl)" |
580 by (simp add: alphas) |
626 by (simp add: alphas) |
581 |
627 |
582 lemma alpha_gen_simpler: |
|
583 assumes fv_rsp: "\<And>x y. R y x \<Longrightarrow> f x = f y" |
|
584 and fin_fv: "finite (f x)" |
|
585 and fv_eqvt: "pi \<bullet> f x = f (pi \<bullet> x)" |
|
586 shows "alpha_gen (bs, x) R f pi (cs, y) \<longleftrightarrow> |
|
587 (f x - bs) \<sharp>* pi \<and> |
|
588 R (pi \<bullet> x) y \<and> |
|
589 pi \<bullet> bs = cs" |
|
590 apply rule |
|
591 unfolding alpha_gen |
|
592 apply clarify |
|
593 apply (erule conjE)+ |
|
594 apply (simp) |
|
595 apply (subgoal_tac "f y - cs = pi \<bullet> (f x - bs)") |
|
596 apply (rule sym) |
|
597 apply simp |
|
598 apply (rule supp_perm_eq) |
|
599 apply (subst supp_finite_atom_set) |
|
600 apply (rule finite_Diff) |
|
601 apply (rule fin_fv) |
|
602 apply (assumption) |
|
603 apply (simp add: eqvts fv_eqvt) |
|
604 apply (subst fv_rsp) |
|
605 apply assumption |
|
606 apply (simp) |
|
607 done |
|
608 |
|
609 lemma alpha_lst_simpler: |
|
610 assumes fv_rsp: "\<And>x y. R y x \<Longrightarrow> f x = f y" |
|
611 and fin_fv: "finite (f x)" |
|
612 and fv_eqvt: "pi \<bullet> f x = f (pi \<bullet> x)" |
|
613 shows "alpha_lst (bs, x) R f pi (cs, y) \<longleftrightarrow> |
|
614 (f x - set bs) \<sharp>* pi \<and> |
|
615 R (pi \<bullet> x) y \<and> |
|
616 pi \<bullet> bs = cs" |
|
617 apply rule |
|
618 unfolding alpha_lst |
|
619 apply clarify |
|
620 apply (erule conjE)+ |
|
621 apply (simp) |
|
622 apply (subgoal_tac "f y - set cs = pi \<bullet> (f x - set bs)") |
|
623 apply (rule sym) |
|
624 apply simp |
|
625 apply (rule supp_perm_eq) |
|
626 apply (subst supp_finite_atom_set) |
|
627 apply (rule finite_Diff) |
|
628 apply (rule fin_fv) |
|
629 apply (assumption) |
|
630 apply (simp add: eqvts fv_eqvt) |
|
631 apply (subst fv_rsp) |
|
632 apply assumption |
|
633 apply (simp) |
|
634 done |
|
635 |
|
636 fun |
|
637 prod_fv :: "('a \<Rightarrow> atom set) \<Rightarrow> ('b \<Rightarrow> atom set) \<Rightarrow> ('a \<times> 'b) \<Rightarrow> atom set" |
|
638 where |
|
639 "prod_fv fvx fvy (x, y) = (fvx x \<union> fvy y)" |
|
640 |
|
641 definition |
|
642 prod_alpha :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> ('b \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> ('a \<times> 'b \<Rightarrow> 'a \<times> 'b \<Rightarrow> bool)" |
|
643 where |
|
644 "prod_alpha = prod_rel" |
|
645 |
|
646 |
|
647 lemma [quot_respect]: |
|
648 shows "((R1 ===> op =) ===> (R2 ===> op =) ===> prod_rel R1 R2 ===> op =) prod_fv prod_fv" |
|
649 by auto |
|
650 |
|
651 lemma [quot_preserve]: |
|
652 assumes q1: "Quotient R1 abs1 rep1" |
|
653 and q2: "Quotient R2 abs2 rep2" |
|
654 shows "((abs1 ---> id) ---> (abs2 ---> id) ---> prod_fun rep1 rep2 ---> id) prod_fv = prod_fv" |
|
655 by (simp add: expand_fun_eq Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2]) |
|
656 |
|
657 lemma [mono]: |
|
658 shows "A <= B \<Longrightarrow> C <= D ==> prod_alpha A C <= prod_alpha B D" |
|
659 unfolding prod_alpha_def |
|
660 by auto |
|
661 |
|
662 lemma [eqvt]: |
|
663 shows "p \<bullet> prod_alpha A B x y = prod_alpha (p \<bullet> A) (p \<bullet> B) (p \<bullet> x) (p \<bullet> y)" |
|
664 unfolding prod_alpha_def |
|
665 unfolding prod_rel.simps |
|
666 by (perm_simp) (rule refl) |
|
667 |
|
668 lemma [eqvt]: |
|
669 shows "p \<bullet> prod_fv A B (x, y) = prod_fv (p \<bullet> A) (p \<bullet> B) (p \<bullet> x, p \<bullet> y)" |
|
670 unfolding prod_fv.simps |
|
671 by (perm_simp) (rule refl) |
|
672 |
|
673 |
628 |
674 end |
629 end |
675 |
630 |