49 and "R1 \<le> R2 \<Longrightarrow> alpha_res bs R1 \<le> alpha_res bs R2" |
49 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" |
50 and "R1 \<le> R2 \<Longrightarrow> alpha_lst cs R1 \<le> alpha_lst cs R2" |
51 by (case_tac [!] bs, case_tac [!] cs) |
51 by (case_tac [!] bs, case_tac [!] cs) |
52 (auto simp add: le_fun_def le_bool_def alphas) |
52 (auto simp add: le_fun_def le_bool_def alphas) |
53 |
53 |
54 lemma alpha_gen_refl: |
54 fun |
55 assumes a: "R x x" |
55 alpha_abs |
56 shows "(bs, x) \<approx>gen R f 0 (bs, x)" |
56 where |
57 and "(bs, x) \<approx>res R f 0 (bs, x)" |
57 "alpha_abs (bs, x) (cs, y) \<longleftrightarrow> (\<exists>p. (bs, x) \<approx>gen (op=) supp p (cs, y))" |
58 and "(cs, x) \<approx>lst R f 0 (cs, x)" |
58 |
59 using a |
59 fun |
|
60 alpha_abs_lst |
|
61 where |
|
62 "alpha_abs_lst (bs, x) (cs, y) \<longleftrightarrow> (\<exists>p. (bs, x) \<approx>lst (op=) supp p (cs, y))" |
|
63 |
|
64 fun |
|
65 alpha_abs_res |
|
66 where |
|
67 "alpha_abs_res (bs, x) (cs, y) \<longleftrightarrow> (\<exists>p. (bs, x) \<approx>res (op=) supp p (cs, y))" |
|
68 |
|
69 notation |
|
70 alpha_abs ("_ \<approx>abs _") and |
|
71 alpha_abs_lst ("_ \<approx>abs'_lst _") and |
|
72 alpha_abs_res ("_ \<approx>abs'_res _") |
|
73 |
|
74 lemmas alphas_abs = alpha_abs.simps alpha_abs_res.simps alpha_abs_lst.simps |
|
75 |
|
76 lemma alphas_abs_refl: |
|
77 shows "(bs, x) \<approx>abs (bs, x)" |
|
78 and "(bs, x) \<approx>abs_res (bs, x)" |
|
79 and "(cs, x) \<approx>abs_lst (cs, x)" |
|
80 unfolding alphas_abs |
60 unfolding alphas |
81 unfolding alphas |
61 unfolding fresh_star_def |
82 unfolding fresh_star_def |
62 by (simp_all add: fresh_zero_perm) |
83 by (rule_tac [!] x="0" in exI) |
63 |
84 (simp_all add: fresh_zero_perm) |
64 lemma alpha_gen_sym: |
85 |
65 assumes a: "R (p \<bullet> x) y \<Longrightarrow> R (- p \<bullet> y) x" |
86 lemma alphas_abs_sym: |
66 shows "(bs, x) \<approx>gen R f p (cs, y) \<Longrightarrow> (cs, y) \<approx>gen R f (- p) (bs, x)" |
87 shows "(bs, x) \<approx>abs (cs, y) \<Longrightarrow> (cs, y) \<approx>abs (bs, x)" |
67 and "(bs, x) \<approx>res R f p (cs, y) \<Longrightarrow> (cs, y) \<approx>res R f (- p) (bs, x)" |
88 and "(bs, x) \<approx>abs_res (cs, y) \<Longrightarrow> (cs, y) \<approx>abs_res (bs, x)" |
68 and "(ds, x) \<approx>lst R f p (es, y) \<Longrightarrow> (es, y) \<approx>lst R f (- p) (ds, x)" |
89 and "(ds, x) \<approx>abs_lst (es, y) \<Longrightarrow> (es, y) \<approx>abs_lst (ds, x)" |
69 using a |
90 unfolding alphas_abs |
70 unfolding alphas |
91 unfolding alphas |
71 unfolding fresh_star_def |
92 unfolding fresh_star_def |
72 by (auto simp add: fresh_minus_perm) |
93 by (erule_tac [!] exE, rule_tac [!] x="-p" in exI) |
73 |
94 (auto simp add: fresh_minus_perm) |
74 lemma alpha_gen_trans: |
95 |
75 assumes a: "\<lbrakk>R (p \<bullet> x) y; R (q \<bullet> y) z\<rbrakk> \<Longrightarrow> R ((q + p) \<bullet> x) z" |
96 lemma alphas_abs_trans: |
76 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)" |
97 shows "\<lbrakk>(bs, x) \<approx>abs (cs, y); (cs, y) \<approx>abs (ds, z)\<rbrakk> \<Longrightarrow> (bs, x) \<approx>abs (ds, z)" |
77 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)" |
98 and "\<lbrakk>(bs, x) \<approx>abs_res (cs, y); (cs, y) \<approx>abs_res (ds, z)\<rbrakk> \<Longrightarrow> (bs, x) \<approx>abs_res (ds, z)" |
78 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)" |
99 and "\<lbrakk>(es, x) \<approx>abs_lst (gs, y); (gs, y) \<approx>abs_lst (hs, z)\<rbrakk> \<Longrightarrow> (es, x) \<approx>abs_lst (hs, z)" |
79 using a |
100 unfolding alphas_abs |
80 unfolding alphas |
101 unfolding alphas |
81 unfolding fresh_star_def |
102 unfolding fresh_star_def |
|
103 apply(erule_tac [!] exE, erule_tac [!] exE) |
|
104 apply(rule_tac [!] x="pa + p" in exI) |
82 by (simp_all add: fresh_plus_perm) |
105 by (simp_all add: fresh_plus_perm) |
83 |
106 |
84 lemma alpha_gen_eqvt: |
107 lemma alphas_abs_eqvt: |
85 assumes a: "R (q \<bullet> x) y \<Longrightarrow> R (p \<bullet> (q \<bullet> x)) (p \<bullet> y)" |
108 shows "(bs, x) \<approx>abs (cs, y) \<Longrightarrow> (p \<bullet> bs, p \<bullet> x) \<approx>abs (p \<bullet> cs, p \<bullet> y)" |
86 and b: "p \<bullet> (f x) = f (p \<bullet> x)" |
109 and "(bs, x) \<approx>abs_res (cs, y) \<Longrightarrow> (p \<bullet> bs, p \<bullet> x) \<approx>abs_res (p \<bullet> cs, p \<bullet> y)" |
87 and c: "p \<bullet> (f y) = f (p \<bullet> y)" |
110 and "(ds, x) \<approx>abs_lst (es, y) \<Longrightarrow> (p \<bullet> ds, p \<bullet> x) \<approx>abs_lst (p \<bullet> es, p \<bullet> y)" |
88 shows "(bs, x) \<approx>gen R f q (cs, y) \<Longrightarrow> (p \<bullet> bs, p \<bullet> x) \<approx>gen R f (p \<bullet> q) (p \<bullet> cs, p \<bullet> y)" |
111 unfolding alphas_abs |
89 and "(bs, x) \<approx>res R f q (cs, y) \<Longrightarrow> (p \<bullet> bs, p \<bullet> x) \<approx>res R f (p \<bullet> q) (p \<bullet> cs, p \<bullet> y)" |
|
90 and "(ds, x) \<approx>lst R f q (es, y) \<Longrightarrow> (p \<bullet> ds, p \<bullet> x) \<approx>lst R f (p \<bullet> q) (p \<bullet> es, p \<bullet> y)" |
|
91 unfolding alphas |
112 unfolding alphas |
92 unfolding set_eqvt[symmetric] |
113 unfolding set_eqvt[symmetric] |
93 unfolding b[symmetric] c[symmetric] |
114 unfolding supp_eqvt[symmetric] |
94 unfolding Diff_eqvt[symmetric] |
115 unfolding Diff_eqvt[symmetric] |
95 unfolding permute_eqvt[symmetric] |
116 apply(erule_tac [!] exE) |
96 using a |
117 apply(rule_tac [!] x="p \<bullet> pa" in exI) |
97 by (auto simp add: fresh_star_permute_iff) |
118 by (auto simp add: fresh_star_permute_iff permute_eqvt[symmetric]) |
98 |
119 |
99 fun |
120 lemma alphas_abs_swap1: |
100 alpha_abs |
|
101 where |
|
102 "alpha_abs (bs, x) (cs, y) \<longleftrightarrow> (\<exists>p. (bs, x) \<approx>gen (op=) supp p (cs, y))" |
|
103 |
|
104 notation |
|
105 alpha_abs ("_ \<approx>abs _") |
|
106 |
|
107 lemma alpha_abs_swap: |
|
108 assumes a1: "a \<notin> (supp x) - bs" |
121 assumes a1: "a \<notin> (supp x) - bs" |
109 and a2: "b \<notin> (supp x) - bs" |
122 and a2: "b \<notin> (supp x) - bs" |
110 shows "(bs, x) \<approx>abs ((a \<rightleftharpoons> b) \<bullet> bs, (a \<rightleftharpoons> b) \<bullet> x)" |
123 shows "(bs, x) \<approx>abs ((a \<rightleftharpoons> b) \<bullet> bs, (a \<rightleftharpoons> b) \<bullet> x)" |
|
124 and "(bs, x) \<approx>abs_res ((a \<rightleftharpoons> b) \<bullet> bs, (a \<rightleftharpoons> b) \<bullet> x)" |
111 using a1 a2 |
125 using a1 a2 |
112 unfolding Diff_iff |
126 unfolding alphas_abs |
113 unfolding alpha_abs.simps |
127 unfolding alphas |
114 unfolding alphas |
128 unfolding supp_eqvt[symmetric] Diff_eqvt[symmetric] |
115 unfolding supp_eqvt[symmetric] Diff_eqvt[symmetric] |
|
116 unfolding fresh_star_def fresh_def |
129 unfolding fresh_star_def fresh_def |
117 unfolding swap_set_not_in[OF a1 a2] |
130 unfolding swap_set_not_in[OF a1 a2] |
118 by (rule_tac x="(a \<rightleftharpoons> b)" in exI) |
131 by (rule_tac [!] x="(a \<rightleftharpoons> b)" in exI) |
119 (auto simp add: supp_perm swap_atom) |
132 (auto simp add: supp_perm swap_atom) |
120 |
133 |
121 fun |
134 lemma alphas_abs_swap2: |
122 supp_abs_fun |
135 assumes a1: "a \<notin> (supp x) - (set bs)" |
123 where |
136 and a2: "b \<notin> (supp x) - (set bs)" |
124 "supp_abs_fun (bs, x) = (supp x) - bs" |
137 shows "(bs, x) \<approx>abs_lst ((a \<rightleftharpoons> b) \<bullet> bs, (a \<rightleftharpoons> b) \<bullet> x)" |
125 |
138 using a1 a2 |
126 |
139 unfolding alphas_abs |
127 lemma supp_abs_fun_lemma: |
140 unfolding alphas |
128 assumes a: "x \<approx>abs y" |
141 unfolding supp_eqvt[symmetric] Diff_eqvt[symmetric] set_eqvt[symmetric] |
129 shows "supp_abs_fun x = supp_abs_fun y" |
142 unfolding fresh_star_def fresh_def |
|
143 unfolding swap_set_not_in[OF a1 a2] |
|
144 by (rule_tac [!] x="(a \<rightleftharpoons> b)" in exI) |
|
145 (auto simp add: supp_perm swap_atom) |
|
146 |
|
147 fun |
|
148 aux_set |
|
149 where |
|
150 "aux_set (bs, x) = (supp x) - bs" |
|
151 |
|
152 fun |
|
153 aux_list |
|
154 where |
|
155 "aux_list (cs, x) = (supp x) - (set cs)" |
|
156 |
|
157 lemma aux_abs_lemma: |
|
158 assumes a: "(bs, x) \<approx>abs (cs, y)" |
|
159 shows "aux_set (bs, x) = aux_set (cs, y)" |
130 using a |
160 using a |
131 apply(induct rule: alpha_abs.induct) |
161 by (induct rule: alpha_abs.induct) |
132 apply(simp add: alpha_gen) |
162 (simp add: alphas_abs alphas) |
133 done |
163 |
134 |
164 lemma aux_abs_res_lemma: |
135 |
165 assumes a: "(bs, x) \<approx>abs_res (cs, y)" |
136 quotient_type 'a abs_gen = "(atom set \<times> 'a::pt)" / "alpha_abs" |
166 shows "aux_set (bs, x) = aux_set (cs, y)" |
137 apply(rule equivpI) |
167 using a |
|
168 by (induct rule: alpha_abs_res.induct) |
|
169 (simp add: alphas_abs alphas) |
|
170 |
|
171 lemma aux_abs_list_lemma: |
|
172 assumes a: "(bs, x) \<approx>abs_lst (cs, y)" |
|
173 shows "aux_list (bs, x) = aux_list (cs, y)" |
|
174 using a |
|
175 by (induct rule: alpha_abs_lst.induct) |
|
176 (simp add: alphas_abs alphas) |
|
177 |
|
178 quotient_type |
|
179 'a abs_gen = "(atom set \<times> 'a::pt)" / "alpha_abs" |
|
180 and 'b abs_res = "(atom set \<times> 'b::pt)" / "alpha_abs_res" |
|
181 and 'c abs_lst = "(atom list \<times> 'c::pt)" / "alpha_abs_lst" |
|
182 apply(rule_tac [!] equivpI) |
138 unfolding reflp_def symp_def transp_def |
183 unfolding reflp_def symp_def transp_def |
139 apply(simp_all) |
184 by (auto intro: alphas_abs_sym alphas_abs_refl alphas_abs_trans simp only:) |
140 (* refl *) |
|
141 apply(clarify) |
|
142 apply(rule_tac x="0" in exI) |
|
143 apply(rule alpha_gen_refl) |
|
144 apply(simp) |
|
145 (* symm *) |
|
146 apply(clarify) |
|
147 apply(rule_tac x="- p" in exI) |
|
148 apply(rule alpha_gen_sym) |
|
149 apply(clarsimp) |
|
150 apply(assumption) |
|
151 (* trans *) |
|
152 apply(clarify) |
|
153 apply(rule_tac x="pa + p" in exI) |
|
154 apply(rule alpha_gen_trans) |
|
155 apply(auto) |
|
156 done |
|
157 |
185 |
158 quotient_definition |
186 quotient_definition |
159 "Abs::atom set \<Rightarrow> ('a::pt) \<Rightarrow> 'a abs_gen" |
187 "Abs::atom set \<Rightarrow> ('a::pt) \<Rightarrow> 'a abs_gen" |
160 is |
188 is |
161 "Pair::atom set \<Rightarrow> ('a::pt) \<Rightarrow> (atom set \<times> 'a)" |
189 "Pair::atom set \<Rightarrow> ('a::pt) \<Rightarrow> (atom set \<times> 'a)" |
162 |
190 |
|
191 quotient_definition |
|
192 "Abs_res::atom set \<Rightarrow> ('a::pt) \<Rightarrow> 'a abs_res" |
|
193 is |
|
194 "Pair::atom set \<Rightarrow> ('a::pt) \<Rightarrow> (atom set \<times> 'a)" |
|
195 |
|
196 quotient_definition |
|
197 "Abs_lst::atom list \<Rightarrow> ('a::pt) \<Rightarrow> 'a abs_lst" |
|
198 is |
|
199 "Pair::atom list \<Rightarrow> ('a::pt) \<Rightarrow> (atom list \<times> 'a)" |
|
200 |
163 lemma [quot_respect]: |
201 lemma [quot_respect]: |
164 shows "((op =) ===> (op =) ===> alpha_abs) Pair Pair" |
202 shows "(op= ===> op= ===> alpha_abs) Pair Pair" |
165 apply(clarsimp) |
203 and "(op= ===> op= ===> alpha_abs_res) Pair Pair" |
166 apply(rule exI) |
204 and "(op= ===> op= ===> alpha_abs_lst) Pair Pair" |
167 apply(rule alpha_gen_refl) |
205 unfolding fun_rel_def |
168 apply(simp) |
206 by (auto intro: alphas_abs_refl simp only:) |
169 done |
|
170 |
207 |
171 lemma [quot_respect]: |
208 lemma [quot_respect]: |
172 shows "((op =) ===> alpha_abs ===> alpha_abs) permute permute" |
209 shows "(op= ===> alpha_abs ===> alpha_abs) permute permute" |
173 apply(clarsimp) |
210 and "(op= ===> alpha_abs_res ===> alpha_abs_res) permute permute" |
174 apply(rule exI) |
211 and "(op= ===> alpha_abs_lst ===> alpha_abs_lst) permute permute" |
175 apply(rule alpha_gen_eqvt) |
212 unfolding fun_rel_def |
176 apply(simp_all add: supp_eqvt) |
213 by (auto intro: alphas_abs_eqvt simp only: Pair_eqvt) |
177 done |
|
178 |
214 |
179 lemma [quot_respect]: |
215 lemma [quot_respect]: |
180 shows "(alpha_abs ===> (op =)) supp_abs_fun supp_abs_fun" |
216 shows "(alpha_abs ===> op=) aux_set aux_set" |
181 apply(simp add: supp_abs_fun_lemma) |
217 and "(alpha_abs_res ===> op=) aux_set aux_set" |
182 done |
218 and "(alpha_abs_lst ===> op=) aux_list aux_list" |
183 |
219 unfolding fun_rel_def |
184 lemma abs_induct: |
220 apply(rule_tac [!] allI) |
185 "\<lbrakk>\<And>as (x::'a::pt). P (Abs as x)\<rbrakk> \<Longrightarrow> P t" |
221 apply(rule_tac [!] allI) |
|
222 apply(case_tac [!] x, case_tac [!] y) |
|
223 apply(rule_tac [!] impI) |
|
224 by (simp_all only: aux_abs_lemma aux_abs_res_lemma aux_abs_list_lemma) |
|
225 |
|
226 lemma abs_inducts: |
|
227 shows "(\<And>as (x::'a::pt). P1 (Abs as x)) \<Longrightarrow> P1 x1" |
|
228 and "(\<And>as (x::'a::pt). P2 (Abs_res as x)) \<Longrightarrow> P2 x2" |
|
229 and "(\<And>as (x::'a::pt). P3 (Abs_lst as x)) \<Longrightarrow> P3 x3" |
186 apply(lifting prod.induct[where 'a="atom set" and 'b="'a"]) |
230 apply(lifting prod.induct[where 'a="atom set" and 'b="'a"]) |
187 done |
231 apply(lifting prod.induct[where 'a="atom set" and 'b="'a"]) |
188 |
232 apply(lifting prod.induct[where 'a="atom list" and 'b="'a"]) |
189 (* TEST case *) |
233 done |
190 lemmas abs_induct2 = prod.induct[where 'a="atom set" and 'b="'a::pt", quot_lifted] |
|
191 thm abs_induct abs_induct2 |
|
192 |
234 |
193 instantiation abs_gen :: (pt) pt |
235 instantiation abs_gen :: (pt) pt |
194 begin |
236 begin |
195 |
237 |
196 quotient_definition |
238 quotient_definition |
197 "permute_abs_gen::perm \<Rightarrow> ('a::pt abs_gen) \<Rightarrow> 'a abs_gen" |
239 "permute_abs_gen::perm \<Rightarrow> ('a::pt abs_gen) \<Rightarrow> 'a abs_gen" |
198 is |
240 is |
199 "permute:: perm \<Rightarrow> (atom set \<times> 'a::pt) \<Rightarrow> (atom set \<times> 'a::pt)" |
241 "permute:: perm \<Rightarrow> (atom set \<times> 'a::pt) \<Rightarrow> (atom set \<times> 'a::pt)" |
200 |
242 |
201 (* ??? has to be 'a \<dots> 'b does not work *) |
243 lemma permute_Abs[simp]: |
202 lemma permute_ABS [simp]: |
|
203 fixes x::"'a::pt" |
244 fixes x::"'a::pt" |
204 shows "(p \<bullet> (Abs as x)) = Abs (p \<bullet> as) (p \<bullet> x)" |
245 shows "(p \<bullet> (Abs as x)) = Abs (p \<bullet> as) (p \<bullet> x)" |
205 thm permute_prod.simps |
246 by (lifting permute_prod.simps[where 'a="atom set" and 'b="'a"]) |
206 by (lifting permute_prod.simps(1)[where 'a="atom set" and 'b="'a"]) |
|
207 |
247 |
208 instance |
248 instance |
209 apply(default) |
249 apply(default) |
210 apply(induct_tac [!] x rule: abs_induct) |
250 apply(induct_tac [!] x rule: abs_inducts(1)) |
211 apply(simp_all) |
251 apply(simp_all) |
212 done |
252 done |
213 |
253 |
214 end |
254 end |
215 |
255 |
216 quotient_definition |
256 instantiation abs_res :: (pt) pt |
217 "supp_Abs_fun :: ('a::pt) abs_gen \<Rightarrow> atom \<Rightarrow> bool" |
257 begin |
218 is |
258 |
219 "supp_abs_fun" |
259 quotient_definition |
220 |
260 "permute_abs_res::perm \<Rightarrow> ('a::pt abs_res) \<Rightarrow> 'a abs_res" |
221 lemma supp_Abs_fun_simp: |
261 is |
222 shows "supp_Abs_fun (Abs bs x) = (supp x) - bs" |
262 "permute:: perm \<Rightarrow> (atom set \<times> 'a::pt) \<Rightarrow> (atom set \<times> 'a::pt)" |
223 by (lifting supp_abs_fun.simps(1)) |
263 |
224 |
264 lemma permute_Abs_res[simp]: |
225 lemma supp_Abs_fun_eqvt [eqvt]: |
265 fixes x::"'a::pt" |
226 shows "(p \<bullet> supp_Abs_fun x) = supp_Abs_fun (p \<bullet> x)" |
266 shows "(p \<bullet> (Abs_res as x)) = Abs_res (p \<bullet> as) (p \<bullet> x)" |
227 apply(induct_tac x rule: abs_induct) |
267 by (lifting permute_prod.simps[where 'a="atom set" and 'b="'a"]) |
228 apply(simp add: supp_Abs_fun_simp supp_eqvt Diff_eqvt) |
268 |
229 done |
269 instance |
230 |
270 apply(default) |
231 lemma supp_Abs_fun_fresh: |
271 apply(induct_tac [!] x rule: abs_inducts(2)) |
232 shows "a \<sharp> Abs bs x \<Longrightarrow> a \<sharp> supp_Abs_fun (Abs bs x)" |
272 apply(simp_all) |
233 apply(rule fresh_fun_eqvt_app) |
273 done |
234 apply(simp add: eqvts_raw) |
274 |
235 apply(simp) |
275 end |
236 done |
276 |
237 |
277 instantiation abs_lst :: (pt) pt |
238 lemma Abs_swap: |
278 begin |
|
279 |
|
280 quotient_definition |
|
281 "permute_abs_lst::perm \<Rightarrow> ('a::pt abs_lst) \<Rightarrow> 'a abs_lst" |
|
282 is |
|
283 "permute:: perm \<Rightarrow> (atom list \<times> 'a::pt) \<Rightarrow> (atom list \<times> 'a::pt)" |
|
284 |
|
285 lemma permute_Abs_lst[simp]: |
|
286 fixes x::"'a::pt" |
|
287 shows "(p \<bullet> (Abs_lst as x)) = Abs_lst (p \<bullet> as) (p \<bullet> x)" |
|
288 by (lifting permute_prod.simps[where 'a="atom list" and 'b="'a"]) |
|
289 |
|
290 instance |
|
291 apply(default) |
|
292 apply(induct_tac [!] x rule: abs_inducts(3)) |
|
293 apply(simp_all) |
|
294 done |
|
295 |
|
296 end |
|
297 |
|
298 lemmas permute_abs = permute_Abs permute_Abs_res permute_Abs_lst |
|
299 |
|
300 |
|
301 quotient_definition |
|
302 "supp_gen :: ('a::pt) abs_gen \<Rightarrow> atom set" |
|
303 is |
|
304 "aux_set" |
|
305 |
|
306 quotient_definition |
|
307 "supp_res :: ('a::pt) abs_res \<Rightarrow> atom set" |
|
308 is |
|
309 "aux_set" |
|
310 |
|
311 quotient_definition |
|
312 "supp_lst :: ('a::pt) abs_lst \<Rightarrow> atom set" |
|
313 is |
|
314 "aux_list" |
|
315 |
|
316 lemma aux_supps: |
|
317 shows "supp_gen (Abs bs x) = (supp x) - bs" |
|
318 and "supp_res (Abs_res bs x) = (supp x) - bs" |
|
319 and "supp_lst (Abs_lst cs x) = (supp x) - (set cs)" |
|
320 apply(lifting aux_set.simps) |
|
321 apply(lifting aux_set.simps) |
|
322 apply(lifting aux_list.simps) |
|
323 done |
|
324 |
|
325 lemma aux_supp_eqvt[eqvt]: |
|
326 shows "(p \<bullet> supp_gen x) = supp_gen (p \<bullet> x)" |
|
327 and "(p \<bullet> supp_res y) = supp_res (p \<bullet> y)" |
|
328 and "(p \<bullet> supp_lst z) = supp_lst (p \<bullet> z)" |
|
329 apply(induct_tac x rule: abs_inducts(1)) |
|
330 apply(simp add: aux_supps supp_eqvt Diff_eqvt) |
|
331 apply(induct_tac y rule: abs_inducts(2)) |
|
332 apply(simp add: aux_supps supp_eqvt Diff_eqvt) |
|
333 apply(induct_tac z rule: abs_inducts(3)) |
|
334 apply(simp add: aux_supps supp_eqvt Diff_eqvt set_eqvt) |
|
335 done |
|
336 |
|
337 lemma aux_fresh: |
|
338 shows "a \<sharp> Abs bs x \<Longrightarrow> a \<sharp> supp_gen (Abs bs x)" |
|
339 and "a \<sharp> Abs_res bs x \<Longrightarrow> a \<sharp> supp_res (Abs_res bs x)" |
|
340 and "a \<sharp> Abs_lst cs x \<Longrightarrow> a \<sharp> supp_lst (Abs_lst cs x)" |
|
341 apply(rule_tac [!] fresh_fun_eqvt_app) |
|
342 apply(simp_all add: eqvts_raw) |
|
343 done |
|
344 |
|
345 lemma abs_swap1: |
239 assumes a1: "a \<notin> (supp x) - bs" |
346 assumes a1: "a \<notin> (supp x) - bs" |
240 and a2: "b \<notin> (supp x) - bs" |
347 and a2: "b \<notin> (supp x) - bs" |
241 shows "(Abs bs x) = (Abs ((a \<rightleftharpoons> b) \<bullet> bs) ((a \<rightleftharpoons> b) \<bullet> x))" |
348 shows "Abs bs x = Abs ((a \<rightleftharpoons> b) \<bullet> bs) ((a \<rightleftharpoons> b) \<bullet> x)" |
242 using a1 a2 by (lifting alpha_abs_swap) |
349 and "Abs_res bs x = Abs_res ((a \<rightleftharpoons> b) \<bullet> bs) ((a \<rightleftharpoons> b) \<bullet> x)" |
243 |
350 using a1 a2 |
244 lemma Abs_supports: |
351 apply(lifting alphas_abs_swap1(1)) |
|
352 apply(lifting alphas_abs_swap1(2)) |
|
353 done |
|
354 |
|
355 lemma abs_swap2: |
|
356 assumes a1: "a \<notin> (supp x) - (set bs)" |
|
357 and a2: "b \<notin> (supp x) - (set bs)" |
|
358 shows "Abs_lst bs x = Abs_lst ((a \<rightleftharpoons> b) \<bullet> bs) ((a \<rightleftharpoons> b) \<bullet> x)" |
|
359 using a1 a2 by (lifting alphas_abs_swap2) |
|
360 |
|
361 lemma abs_supports: |
245 shows "((supp x) - as) supports (Abs as x)" |
362 shows "((supp x) - as) supports (Abs as x)" |
|
363 and "((supp x) - as) supports (Abs_res as x)" |
|
364 and "((supp x) - (set bs)) supports (Abs_lst bs x)" |
246 unfolding supports_def |
365 unfolding supports_def |
247 apply(clarify) |
366 unfolding permute_abs |
248 apply(simp (no_asm)) |
367 by (simp_all add: abs_swap1[symmetric] abs_swap2[symmetric]) |
249 apply(subst Abs_swap[symmetric]) |
368 |
250 apply(simp_all) |
369 lemma supp_abs_subset1: |
251 done |
370 assumes a: "finite (supp x)" |
252 |
|
253 lemma finite_supp_Abs_subset1: |
|
254 assumes "finite (supp x)" |
|
255 shows "(supp x) - as \<subseteq> supp (Abs as x)" |
371 shows "(supp x) - as \<subseteq> supp (Abs as x)" |
256 apply(simp add: supp_conv_fresh) |
372 and "(supp x) - as \<subseteq> supp (Abs_res as x)" |
257 apply(auto) |
373 and "(supp x) - (set bs) \<subseteq> supp (Abs_lst bs x)" |
258 apply(drule_tac supp_Abs_fun_fresh) |
374 unfolding supp_conv_fresh |
259 apply(simp only: supp_Abs_fun_simp) |
375 apply(auto dest!: aux_fresh simp add: aux_supps) |
260 apply(simp add: fresh_def) |
376 apply(simp_all add: fresh_def supp_finite_atom_set a) |
261 apply(simp add: supp_finite_atom_set assms) |
377 done |
262 done |
378 |
263 |
379 lemma supp_abs_subset2: |
264 lemma finite_supp_Abs_subset2: |
380 assumes a: "finite (supp x)" |
265 assumes "finite (supp x)" |
|
266 shows "supp (Abs as x) \<subseteq> (supp x) - as" |
381 shows "supp (Abs as x) \<subseteq> (supp x) - as" |
267 apply(rule supp_is_subset) |
382 and "supp (Abs_res as x) \<subseteq> (supp x) - as" |
268 apply(rule Abs_supports) |
383 and "supp (Abs_lst bs x) \<subseteq> (supp x) - (set bs)" |
269 apply(simp add: assms) |
384 apply(rule_tac [!] supp_is_subset) |
270 done |
385 apply(simp_all add: abs_supports a) |
271 |
386 done |
272 lemma finite_supp_Abs: |
387 |
273 assumes "finite (supp x)" |
388 lemma abs_finite_supp: |
|
389 assumes a: "finite (supp x)" |
274 shows "supp (Abs as x) = (supp x) - as" |
390 shows "supp (Abs as x) = (supp x) - as" |
275 apply(rule_tac subset_antisym) |
391 and "supp (Abs_res as x) = (supp x) - as" |
276 apply(rule finite_supp_Abs_subset2[OF assms]) |
392 and "supp (Abs_lst bs x) = (supp x) - (set bs)" |
277 apply(rule finite_supp_Abs_subset1[OF assms]) |
393 apply(rule_tac [!] subset_antisym) |
278 done |
394 apply(simp_all add: supp_abs_subset1[OF a] supp_abs_subset2[OF a]) |
279 |
395 done |
280 lemma supp_Abs: |
396 |
|
397 lemma supp_abs: |
281 fixes x::"'a::fs" |
398 fixes x::"'a::fs" |
282 shows "supp (Abs as x) = (supp x) - as" |
399 shows "supp (Abs as x) = (supp x) - as" |
283 apply(rule finite_supp_Abs) |
400 and "supp (Abs_res as x) = (supp x) - as" |
284 apply(simp add: finite_supp) |
401 and "supp (Abs_lst bs x) = (supp x) - (set bs)" |
|
402 apply(rule_tac [!] abs_finite_supp) |
|
403 apply(simp_all add: finite_supp) |
285 done |
404 done |
286 |
405 |
287 instance abs_gen :: (fs) fs |
406 instance abs_gen :: (fs) fs |
288 apply(default) |
407 apply(default) |
289 apply(induct_tac x rule: abs_induct) |
408 apply(induct_tac x rule: abs_inducts(1)) |
290 apply(simp add: supp_Abs) |
409 apply(simp add: supp_abs finite_supp) |
291 apply(simp add: finite_supp) |
410 done |
292 done |
411 |
293 |
412 instance abs_res :: (fs) fs |
294 lemma Abs_fresh_iff: |
413 apply(default) |
|
414 apply(induct_tac x rule: abs_inducts(2)) |
|
415 apply(simp add: supp_abs finite_supp) |
|
416 done |
|
417 |
|
418 instance abs_lst :: (fs) fs |
|
419 apply(default) |
|
420 apply(induct_tac x rule: abs_inducts(3)) |
|
421 apply(simp add: supp_abs finite_supp) |
|
422 done |
|
423 |
|
424 lemma abs_fresh_iff: |
295 fixes x::"'a::fs" |
425 fixes x::"'a::fs" |
296 shows "a \<sharp> Abs bs x \<longleftrightarrow> a \<in> bs \<or> (a \<notin> bs \<and> a \<sharp> x)" |
426 shows "a \<sharp> Abs bs x \<longleftrightarrow> a \<in> bs \<or> (a \<notin> bs \<and> a \<sharp> x)" |
297 apply(simp add: fresh_def) |
427 and "a \<sharp> Abs_res bs x \<longleftrightarrow> a \<in> bs \<or> (a \<notin> bs \<and> a \<sharp> x)" |
298 apply(simp add: supp_Abs) |
428 and "a \<sharp> Abs_lst cs x \<longleftrightarrow> a \<in> (set cs) \<or> (a \<notin> (set cs) \<and> a \<sharp> x)" |
299 apply(auto) |
429 unfolding fresh_def |
300 done |
430 unfolding supp_abs |
301 |
431 by auto |
302 lemma Abs_eq_iff: |
432 |
303 shows "Abs bs x = Abs cs y \<longleftrightarrow> (\<exists>p. (bs, x) \<approx>gen (op =) supp p (cs, y))" |
433 lemma abs_eq_iff: |
304 by (lifting alpha_abs.simps(1)) |
434 shows "Abs bs x = Abs cs y \<longleftrightarrow> (bs, x) \<approx>abs (cs, y)" |
305 |
435 and "Abs_res bs x = Abs_res cs y \<longleftrightarrow> (bs, x) \<approx>abs_res (cs, y)" |
306 |
436 and "Abs_lst ds x = Abs_lst hs y \<longleftrightarrow> (ds, x) \<approx>abs_lst (hs, y)" |
307 |
437 apply(simp_all) |
308 (* |
438 apply(lifting alphas_abs) |
309 below is a construction site for showing that in the |
439 done |
310 single-binder case, the old and new alpha equivalence |
440 |
311 coincide |
441 |
312 *) |
442 section {* BELOW is stuff that may or may not be needed *} |
313 |
|
314 fun |
|
315 alpha1 |
|
316 where |
|
317 "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)" |
|
318 |
|
319 notation |
|
320 alpha1 ("_ \<approx>abs1 _") |
|
321 |
|
322 fun |
|
323 alpha2 |
|
324 where |
|
325 "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))" |
|
326 |
|
327 notation |
|
328 alpha2 ("_ \<approx>abs2 _") |
|
329 |
|
330 lemma alpha_old_new: |
|
331 assumes a: "(a, x) \<approx>abs1 (b, y)" "sort_of a = sort_of b" |
|
332 shows "({a}, x) \<approx>abs ({b}, y)" |
|
333 using a |
|
334 apply(simp) |
|
335 apply(erule disjE) |
|
336 apply(simp) |
|
337 apply(rule exI) |
|
338 apply(rule alpha_gen_refl) |
|
339 apply(simp) |
|
340 apply(rule_tac x="(a \<rightleftharpoons> b)" in exI) |
|
341 apply(simp add: alpha_gen) |
|
342 apply(simp add: fresh_def) |
|
343 apply(rule conjI) |
|
344 apply(rule_tac ?p1="(a \<rightleftharpoons> b)" in permute_eq_iff[THEN iffD1]) |
|
345 apply(rule trans) |
|
346 apply(simp add: Diff_eqvt supp_eqvt) |
|
347 apply(subst swap_set_not_in) |
|
348 back |
|
349 apply(simp) |
|
350 apply(simp) |
|
351 apply(simp add: permute_set_eq) |
|
352 apply(rule conjI) |
|
353 apply(rule_tac ?p1="(a \<rightleftharpoons> b)" in fresh_star_permute_iff[THEN iffD1]) |
|
354 apply(simp add: permute_self) |
|
355 apply(simp add: Diff_eqvt supp_eqvt) |
|
356 apply(simp add: permute_set_eq) |
|
357 apply(subgoal_tac "supp (a \<rightleftharpoons> b) \<subseteq> {a, b}") |
|
358 apply(simp add: fresh_star_def fresh_def) |
|
359 apply(blast) |
|
360 apply(simp add: supp_swap) |
|
361 apply(simp add: eqvts) |
|
362 done |
|
363 |
|
364 |
|
365 lemma perm_induct_test: |
|
366 fixes P :: "perm => bool" |
|
367 assumes fin: "finite (supp p)" |
|
368 assumes zero: "P 0" |
|
369 assumes swap: "\<And>a b. \<lbrakk>sort_of a = sort_of b; a \<noteq> b\<rbrakk> \<Longrightarrow> P (a \<rightleftharpoons> b)" |
|
370 assumes plus: "\<And>p1 p2. \<lbrakk>supp p1 \<inter> supp p2 = {}; P p1; P p2\<rbrakk> \<Longrightarrow> P (p1 + p2)" |
|
371 shows "P p" |
|
372 using fin |
|
373 apply(induct F\<equiv>"supp p" arbitrary: p rule: finite_induct) |
|
374 oops |
|
375 |
|
376 lemma ii: |
|
377 assumes "\<forall>x \<in> A. p \<bullet> x = x" |
|
378 shows "p \<bullet> A = A" |
|
379 using assms |
|
380 apply(auto) |
|
381 apply (metis Collect_def Collect_mem_eq Int_absorb assms eqvt_bound inf_Int_eq mem_def mem_permute_iff) |
|
382 apply (metis Collect_def Collect_mem_eq Int_absorb assms eqvt_apply eqvt_bound eqvt_lambda inf_Int_eq mem_def mem_permute_iff permute_minus_cancel(2) permute_pure) |
|
383 done |
|
384 |
|
385 |
|
386 |
|
387 lemma alpha_abs_Pair: |
|
388 shows "(bs, (x1, x2)) \<approx>gen (\<lambda>(x1,x2) (y1,y2). x1=y1 \<and> x2=y2) (\<lambda>(x,y). supp x \<union> supp y) p (cs, (y1, y2)) |
|
389 \<longleftrightarrow> ((bs, x1) \<approx>gen (op=) supp p (cs, y1) \<and> (bs, x2) \<approx>gen (op=) supp p (cs, y2))" |
|
390 apply(simp add: alpha_gen) |
|
391 apply(simp add: fresh_star_def) |
|
392 apply(simp add: ball_Un Un_Diff) |
|
393 apply(rule iffI) |
|
394 apply(simp) |
|
395 defer |
|
396 apply(simp) |
|
397 apply(rule conjI) |
|
398 apply(clarify) |
|
399 apply(simp add: supp_eqvt[symmetric] Diff_eqvt[symmetric]) |
|
400 apply(rule sym) |
|
401 apply(rule ii) |
|
402 apply(simp add: fresh_def supp_perm) |
|
403 apply(clarify) |
|
404 apply(simp add: supp_eqvt[symmetric] Diff_eqvt[symmetric]) |
|
405 apply(simp add: fresh_def supp_perm) |
|
406 apply(rule sym) |
|
407 apply(rule ii) |
|
408 apply(simp) |
|
409 done |
|
410 |
|
411 |
|
412 lemma yy: |
|
413 assumes "S1 - {x} = S2 - {x}" "x \<in> S1" "x \<in> S2" |
|
414 shows "S1 = S2" |
|
415 using assms |
|
416 apply (metis insert_Diff_single insert_absorb) |
|
417 done |
|
418 |
|
419 lemma kk: |
|
420 assumes a: "p \<bullet> x = y" |
|
421 shows "\<forall>a \<in> supp x. (p \<bullet> a) \<in> supp y" |
|
422 using a |
|
423 apply(auto) |
|
424 apply(rule_tac p="- p" in permute_boolE) |
|
425 apply(simp add: mem_eqvt supp_eqvt) |
|
426 done |
|
427 |
|
428 lemma ww: |
|
429 assumes "a \<notin> supp x" "b \<in> supp x" "a \<noteq> b" "sort_of a = sort_of b" |
|
430 shows "((a \<rightleftharpoons> b) \<bullet> x) \<noteq> x" |
|
431 apply(subgoal_tac "(supp x) supports x") |
|
432 apply(simp add: supports_def) |
|
433 using assms |
|
434 apply - |
|
435 apply(drule_tac x="a" in spec) |
|
436 defer |
|
437 apply(rule supp_supports) |
|
438 apply(auto) |
|
439 apply(rotate_tac 1) |
|
440 apply(drule_tac p="(a \<rightleftharpoons> b)" in permute_boolI) |
|
441 apply(simp add: mem_eqvt supp_eqvt) |
|
442 done |
|
443 |
|
444 lemma alpha_abs_sym: |
|
445 assumes a: "({a}, x) \<approx>abs ({b}, y)" |
|
446 shows "({b}, y) \<approx>abs ({a}, x)" |
|
447 using a |
|
448 apply(simp) |
|
449 apply(erule exE) |
|
450 apply(rule_tac x="- p" in exI) |
|
451 apply(simp add: alpha_gen) |
|
452 apply(simp add: fresh_star_def fresh_minus_perm) |
|
453 apply (metis permute_minus_cancel(2)) |
|
454 done |
|
455 |
|
456 lemma alpha_abs_trans: |
|
457 assumes a: "({a1}, x1) \<approx>abs ({a2}, x2)" |
|
458 assumes b: "({a2}, x2) \<approx>abs ({a3}, x3)" |
|
459 shows "({a1}, x1) \<approx>abs ({a3}, x3)" |
|
460 using a b |
|
461 apply(simp) |
|
462 apply(erule exE)+ |
|
463 apply(rule_tac x="pa + p" in exI) |
|
464 apply(simp add: alpha_gen) |
|
465 apply(simp add: fresh_star_def fresh_plus_perm) |
|
466 done |
|
467 |
|
468 lemma alpha_equal: |
|
469 assumes a: "({a}, x) \<approx>abs ({a}, y)" |
|
470 shows "(a, x) \<approx>abs1 (a, y)" |
|
471 using a |
|
472 apply(simp) |
|
473 apply(erule exE) |
|
474 apply(simp add: alpha_gen) |
|
475 apply(erule conjE)+ |
|
476 apply(case_tac "a \<notin> supp x") |
|
477 apply(simp) |
|
478 apply(subgoal_tac "supp x \<sharp>* p") |
|
479 apply(drule supp_perm_eq) |
|
480 apply(simp) |
|
481 apply(simp) |
|
482 apply(simp) |
|
483 apply(case_tac "a \<notin> supp y") |
|
484 apply(simp) |
|
485 apply(drule supp_perm_eq) |
|
486 apply(clarify) |
|
487 apply(simp (no_asm_use)) |
|
488 apply(simp) |
|
489 apply(simp) |
|
490 apply(drule yy) |
|
491 apply(simp) |
|
492 apply(simp) |
|
493 apply(simp) |
|
494 apply(case_tac "a \<sharp> p") |
|
495 apply(subgoal_tac "supp y \<sharp>* p") |
|
496 apply(drule supp_perm_eq) |
|
497 apply(clarify) |
|
498 apply(simp (no_asm_use)) |
|
499 apply(metis) |
|
500 apply(auto simp add: fresh_star_def)[1] |
|
501 apply(frule_tac kk) |
|
502 apply(drule_tac x="a" in bspec) |
|
503 apply(simp) |
|
504 apply(simp add: fresh_def) |
|
505 apply(simp add: supp_perm) |
|
506 apply(subgoal_tac "((p \<bullet> a) \<sharp> p)") |
|
507 apply(simp add: fresh_def supp_perm) |
|
508 apply(simp add: fresh_star_def) |
|
509 done |
|
510 |
|
511 lemma alpha_unequal: |
|
512 assumes a: "({a}, x) \<approx>abs ({b}, y)" "sort_of a = sort_of b" "a \<noteq> b" |
|
513 shows "(a, x) \<approx>abs1 (b, y)" |
|
514 using a |
|
515 apply - |
|
516 apply(subgoal_tac "a \<notin> supp x - {a}") |
|
517 apply(subgoal_tac "b \<notin> supp x - {a}") |
|
518 defer |
|
519 apply(simp add: alpha_gen) |
|
520 apply(simp) |
|
521 apply(drule_tac alpha_abs_swap) |
|
522 apply(assumption) |
|
523 apply(simp only: insert_eqvt empty_eqvt swap_atom_simps) |
|
524 apply(drule alpha_abs_sym) |
|
525 apply(rotate_tac 4) |
|
526 apply(drule_tac alpha_abs_trans) |
|
527 apply(assumption) |
|
528 apply(drule alpha_equal) |
|
529 apply(simp) |
|
530 apply(rule_tac p="(a \<rightleftharpoons> b)" in permute_boolE) |
|
531 apply(simp add: fresh_eqvt) |
|
532 apply(simp add: fresh_def) |
|
533 done |
|
534 |
|
535 lemma alpha_new_old: |
|
536 assumes a: "({a}, x) \<approx>abs ({b}, y)" "sort_of a = sort_of b" |
|
537 shows "(a, x) \<approx>abs1 (b, y)" |
|
538 using a |
|
539 apply(case_tac "a=b") |
|
540 apply(simp only: alpha_equal) |
|
541 apply(drule alpha_unequal) |
|
542 apply(simp) |
|
543 apply(simp) |
|
544 apply(simp) |
|
545 done |
|
546 |
443 |
547 (* support of concrete atom sets *) |
444 (* support of concrete atom sets *) |
548 |
445 |
549 lemma supp_atom_image: |
446 lemma supp_atom_image: |
550 fixes as::"'a::at_base set" |
447 fixes as::"'a::at_base set" |