37 thm trm_assn.distinct |
37 thm trm_assn.distinct |
38 thm trm_assn.supp |
38 thm trm_assn.supp |
39 thm trm_assn.fresh |
39 thm trm_assn.fresh |
40 thm trm_assn.exhaust |
40 thm trm_assn.exhaust |
41 thm trm_assn.strong_exhaust |
41 thm trm_assn.strong_exhaust |
42 |
42 thm trm_assn.perm_bn_simps |
43 lemma alpha_bn_inducts_raw: |
43 |
|
44 lemma alpha_bn_inducts_raw[consumes 1]: |
44 "\<lbrakk>alpha_bn_raw a b; P3 ANil_raw ANil_raw; |
45 "\<lbrakk>alpha_bn_raw a b; P3 ANil_raw ANil_raw; |
45 \<And>trm_raw trm_rawa assn_raw assn_rawa name namea. |
46 \<And>trm_raw trm_rawa assn_raw assn_rawa name namea. |
46 \<lbrakk>alpha_trm_raw trm_raw trm_rawa; alpha_bn_raw assn_raw assn_rawa; |
47 \<lbrakk>alpha_trm_raw trm_raw trm_rawa; alpha_bn_raw assn_raw assn_rawa; |
47 P3 assn_raw assn_rawa\<rbrakk> |
48 P3 assn_raw assn_rawa\<rbrakk> |
48 \<Longrightarrow> P3 (ACons_raw name trm_raw assn_raw) |
49 \<Longrightarrow> P3 (ACons_raw name trm_raw assn_raw) |
49 (ACons_raw namea trm_rawa assn_rawa)\<rbrakk> \<Longrightarrow> P3 a b" |
50 (ACons_raw namea trm_rawa assn_rawa)\<rbrakk> \<Longrightarrow> P3 a b" |
50 by (erule alpha_trm_raw_alpha_assn_raw_alpha_bn_raw.inducts(3)[of _ _ "\<lambda>x y. True" _ "\<lambda>x y. True", simplified]) auto |
51 by (erule alpha_trm_raw_alpha_assn_raw_alpha_bn_raw.inducts(3)[of _ _ "\<lambda>x y. True" _ "\<lambda>x y. True", simplified]) auto |
51 |
52 |
52 lemmas alpha_bn_inducts = alpha_bn_inducts_raw[quot_lifted] |
53 lemmas alpha_bn_inducts[consumes 1] = alpha_bn_inducts_raw[quot_lifted] |
53 |
54 |
54 |
55 |
55 |
56 |
56 lemma alpha_bn_refl: "alpha_bn x x" |
57 lemma alpha_bn_refl: "alpha_bn x x" |
57 by (induct x rule: trm_assn.inducts(2)) |
58 by (induct x rule: trm_assn.inducts(2)) |
83 using b trm_assn.permute_bn by simp |
95 using b trm_assn.permute_bn by simp |
84 ultimately have "permute_bn q x = permute_bn r y" |
96 ultimately have "permute_bn q x = permute_bn r y" |
85 using bn_inj by simp |
97 using bn_inj by simp |
86 *) |
98 *) |
87 |
99 |
88 lemma lets_bla: |
|
89 "x \<noteq> z \<Longrightarrow> y \<noteq> z \<Longrightarrow> x \<noteq> y \<Longrightarrow>(Let (ACons x (Var y) ANil) (Var x)) \<noteq> (Let (ACons x (Var z) ANil) (Var x))" |
|
90 by (simp add: trm_assn.eq_iff) |
|
91 |
|
92 |
|
93 lemma lets_ok: |
|
94 "(Let (ACons x (Var y) ANil) (Var x)) = (Let (ACons y (Var y) ANil) (Var y))" |
|
95 apply (simp add: trm_assn.eq_iff Abs_eq_iff ) |
|
96 apply (rule_tac x="(x \<leftrightarrow> y)" in exI) |
|
97 apply (simp_all add: alphas atom_eqvt supp_at_base fresh_star_def trm_assn.bn_defs trm_assn.supp) |
|
98 done |
|
99 |
|
100 lemma lets_ok3: |
|
101 "x \<noteq> y \<Longrightarrow> |
|
102 (Let (ACons x (App (Var y) (Var x)) (ACons y (Var y) ANil)) (App (Var x) (Var y))) \<noteq> |
|
103 (Let (ACons y (App (Var x) (Var y)) (ACons x (Var x) ANil)) (App (Var x) (Var y)))" |
|
104 apply (simp add: trm_assn.eq_iff) |
|
105 done |
|
106 |
|
107 lemma lets_not_ok1: |
|
108 "x \<noteq> y \<Longrightarrow> |
|
109 (Let (ACons x (Var x) (ACons y (Var y) ANil)) (App (Var x) (Var y))) \<noteq> |
|
110 (Let (ACons y (Var x) (ACons x (Var y) ANil)) (App (Var x) (Var y)))" |
|
111 apply (simp add: alphas trm_assn.eq_iff trm_assn.supp fresh_star_def atom_eqvt Abs_eq_iff trm_assn.bn_defs) |
|
112 done |
|
113 |
|
114 lemma lets_nok: |
|
115 "x \<noteq> y \<Longrightarrow> x \<noteq> z \<Longrightarrow> z \<noteq> y \<Longrightarrow> |
|
116 (Let (ACons x (App (Var z) (Var z)) (ACons y (Var z) ANil)) (App (Var x) (Var y))) \<noteq> |
|
117 (Let (ACons y (Var z) (ACons x (App (Var z) (Var z)) ANil)) (App (Var x) (Var y)))" |
|
118 apply (simp add: alphas trm_assn.eq_iff fresh_star_def trm_assn.bn_defs Abs_eq_iff trm_assn.supp trm_assn.distinct) |
|
119 done |
|
120 |
|
121 lemma |
|
122 fixes a b c :: name |
|
123 assumes x: "a \<noteq> c" and y: "b \<noteq> c" |
|
124 shows "\<exists>p.([atom a], Var c) \<approx>lst (op =) supp p ([atom b], Var c)" |
|
125 apply (rule_tac x="(a \<leftrightarrow> b)" in exI) |
|
126 apply (simp add: alphas trm_assn.supp supp_at_base x y fresh_star_def atom_eqvt) |
|
127 by (metis Rep_name_inverse atom_name_def flip_fresh_fresh fresh_atom fresh_perm x y) |
|
128 |
|
129 |
100 |
130 lemma max_eqvt[eqvt]: "p \<bullet> (max (a :: _ :: pure) b) = max (p \<bullet> a) (p \<bullet> b)" |
101 lemma max_eqvt[eqvt]: "p \<bullet> (max (a :: _ :: pure) b) = max (p \<bullet> a) (p \<bullet> b)" |
131 by (simp add: permute_pure) |
102 by (simp add: permute_pure) |
132 |
103 |
133 |
104 |
134 lemma Abs_lst_fcb2: |
105 lemma Abs_lst_fcb2: |
135 fixes as bs :: "'a :: fs" |
106 fixes as bs :: "'a :: fs" |
136 and x y :: "'b :: fs" |
107 and x y :: "'b :: fs" |
137 and c::"'c::fs" |
|
138 assumes eq: "[ba as]lst. x = [ba bs]lst. y" |
108 assumes eq: "[ba as]lst. x = [ba bs]lst. y" |
|
109 and ctxt: "finite (supp c)" |
139 and fcb1: "set (ba as) \<sharp>* f as x c" |
110 and fcb1: "set (ba as) \<sharp>* f as x c" |
140 and fresh1: "set (ba as) \<sharp>* c" |
111 and fresh1: "set (ba as) \<sharp>* c" |
141 and fresh2: "set (ba bs) \<sharp>* c" |
112 and fresh2: "set (ba bs) \<sharp>* c" |
142 and perm1: "\<And>p. supp p \<sharp>* c \<Longrightarrow> p \<bullet> (f as x c) = f (p \<bullet> as) (p \<bullet> x) c" |
113 and perm1: "\<And>p. supp p \<sharp>* c \<Longrightarrow> p \<bullet> (f as x c) = f (p \<bullet> as) (p \<bullet> x) c" |
143 and perm2: "\<And>p. supp p \<sharp>* c \<Longrightarrow> p \<bullet> (f bs y c) = f (p \<bullet> bs) (p \<bullet> y) c" |
114 and perm2: "\<And>p. supp p \<sharp>* c \<Longrightarrow> p \<bullet> (f bs y c) = f (p \<bullet> bs) (p \<bullet> y) c" |
144 (* What we would like in this proof, and lets this proof finish *) |
115 (* What we would like in this proof, and lets this proof finish *) |
145 and ba_inj: "\<And>q r. q \<bullet> ba as = r \<bullet> ba bs \<Longrightarrow> q \<bullet> as = r \<bullet> bs" |
116 and ba_inj: "\<And>q r. q \<bullet> ba as = r \<bullet> ba bs \<Longrightarrow> pn q as = pn r bs" |
146 (* What the user can supply with the help of alpha_bn *) |
|
147 (* and bainj: "ba as = ba bs \<Longrightarrow> as = bs"*) |
|
148 shows "f as x c = f bs y c" |
117 shows "f as x c = f bs y c" |
149 proof - |
118 proof - |
150 have "supp (as, x, c) supports (f as x c)" |
119 have "supp (as, x, c) supports (f as x c)" |
151 unfolding supports_def fresh_def[symmetric] |
120 unfolding supports_def fresh_def[symmetric] |
152 by (simp add: fresh_Pair perm1 fresh_star_def supp_swap swap_fresh_fresh) |
121 apply (simp add: fresh_Pair perm1 fresh_star_def supp_swap swap_fresh_fresh) |
|
122 sorry |
153 then have fin1: "finite (supp (f as x c))" |
123 then have fin1: "finite (supp (f as x c))" |
154 by (auto intro: supports_finite simp add: finite_supp) |
124 by (auto intro: supports_finite simp add: finite_supp supp_Pair ctxt) |
155 have "supp (bs, y, c) supports (f bs y c)" |
125 have "supp (bs, y, c) supports (f bs y c)" |
156 unfolding supports_def fresh_def[symmetric] |
126 unfolding supports_def fresh_def[symmetric] |
157 by (simp add: fresh_Pair perm2 fresh_star_def supp_swap swap_fresh_fresh) |
127 apply (simp add: fresh_Pair perm2 fresh_star_def supp_swap swap_fresh_fresh) |
|
128 sorry |
158 then have fin2: "finite (supp (f bs y c))" |
129 then have fin2: "finite (supp (f bs y c))" |
159 by (auto intro: supports_finite simp add: finite_supp) |
130 by (auto intro: supports_finite simp add: finite_supp supp_Pair ctxt) |
160 obtain q::"perm" where |
131 obtain q::"perm" where |
161 fr1: "(q \<bullet> (set (ba as))) \<sharp>* (x, c, f as x c, f bs y c)" and |
132 fr1: "(q \<bullet> (set (ba as))) \<sharp>* (x, c, f as x c, f bs y c)" and |
162 fr2: "supp q \<sharp>* ([ba as]lst. x)" and |
133 fr2: "supp q \<sharp>* ([ba as]lst. x)" and |
163 inc: "supp q \<subseteq> (set (ba as)) \<union> q \<bullet> (set (ba as))" |
134 inc: "supp q \<subseteq> (set (ba as)) \<union> q \<bullet> (set (ba as))" |
164 using at_set_avoiding3[where xs="set (ba as)" and c="(x, c, f as x c, f bs y c)" |
135 using at_set_avoiding3[where xs="set (ba as)" and c="(x, c, f as x c, f bs y c)" |
165 and x="[ba as]lst. x"] fin1 fin2 |
136 and x="[ba as]lst. x"] fin1 fin2 |
166 by (auto simp add: supp_Pair finite_supp Abs_fresh_star dest: fresh_star_supp_conv) |
137 by (auto simp add: supp_Pair finite_supp ctxt Abs_fresh_star dest: fresh_star_supp_conv) |
167 have "[q \<bullet> (ba as)]lst. (q \<bullet> x) = q \<bullet> ([ba as]lst. x)" by simp |
138 have "[q \<bullet> (ba as)]lst. (q \<bullet> x) = q \<bullet> ([ba as]lst. x)" by simp |
168 also have "\<dots> = [ba as]lst. x" |
139 also have "\<dots> = [ba as]lst. x" |
169 by (simp only: fr2 perm_supp_eq) |
140 by (simp only: fr2 perm_supp_eq) |
170 finally have "[q \<bullet> (ba as)]lst. (q \<bullet> x) = [ba bs]lst. y" using eq by simp |
141 finally have "[q \<bullet> (ba as)]lst. (q \<bullet> x) = [ba bs]lst. y" using eq by simp |
171 then obtain r::perm where |
142 then obtain r::perm where |
177 apply(erule exE) |
148 apply(erule exE) |
178 apply(erule conjE)+ |
149 apply(erule conjE)+ |
179 apply(drule_tac x="p" in meta_spec) |
150 apply(drule_tac x="p" in meta_spec) |
180 apply(simp add: set_eqvt) |
151 apply(simp add: set_eqvt) |
181 apply(blast) |
152 apply(blast) |
182 done |
153 done |
183 have "(set (ba as)) \<sharp>* f as x c" by (rule fcb1) |
154 have "(set (ba as)) \<sharp>* f as x c" by (rule fcb1) |
184 then have "q \<bullet> ((set (ba as)) \<sharp>* f as x c)" |
155 then have "q \<bullet> ((set (ba as)) \<sharp>* f as x c)" |
185 by (simp add: permute_bool_def) |
156 by (simp add: permute_bool_def) |
186 then have "set (q \<bullet> (ba as)) \<sharp>* f (q \<bullet> as) (q \<bullet> x) c" |
157 then have "set (q \<bullet> (ba as)) \<sharp>* f (q \<bullet> as) (q \<bullet> x) c" |
187 apply(simp add: fresh_star_eqvt set_eqvt) |
158 apply(simp add: fresh_star_eqvt set_eqvt) |
188 apply(subst (asm) perm1) |
159 apply(subst (asm) perm1) |
189 using inc fresh1 fr1 |
160 using inc fresh1 fr1 |
190 apply(auto simp add: fresh_star_def fresh_Pair) |
161 apply(auto simp add: fresh_star_def fresh_Pair) |
191 done |
162 done |
192 then have "set (r \<bullet> (ba bs)) \<sharp>* f (r \<bullet> bs) (r \<bullet> y) c" using qq1 qq2 ba_inj |
163 then have "set (r \<bullet> (ba bs)) \<sharp>* f (r \<bullet> bs) (r \<bullet> y) c" using qq1 qq2 ba_inj |
193 by simp |
164 apply simp |
|
165 sorry |
194 then have "r \<bullet> ((set (ba bs)) \<sharp>* f bs y c)" |
166 then have "r \<bullet> ((set (ba bs)) \<sharp>* f bs y c)" |
195 apply(simp add: fresh_star_eqvt set_eqvt) |
167 apply(simp add: fresh_star_eqvt set_eqvt) |
196 apply(subst (asm) perm2[symmetric]) |
168 apply(subst (asm) perm2[symmetric]) |
197 using qq3 fresh2 fr1 |
169 using qq3 fresh2 fr1 |
198 apply(auto simp add: set_eqvt fresh_star_def fresh_Pair) |
170 apply(auto simp add: set_eqvt fresh_star_def fresh_Pair) |
232 apply (drule_tac x="assn" in meta_spec) |
206 apply (drule_tac x="assn" in meta_spec) |
233 apply (drule_tac x="trm" in meta_spec) |
207 apply (drule_tac x="trm" in meta_spec) |
234 apply (simp add: alpha_bn_refl) |
208 apply (simp add: alpha_bn_refl) |
235 apply (case_tac b rule: trm_assn.exhaust(2)) |
209 apply (case_tac b rule: trm_assn.exhaust(2)) |
236 apply (auto)[2] |
210 apply (auto)[2] |
237 apply(simp_all) |
211 apply(simp_all del: trm_assn.eq_iff) |
238 apply (erule_tac c="()" in Abs_lst_fcb2) |
212 apply(simp) |
|
213 prefer 3 |
|
214 apply(simp) |
|
215 apply(simp) |
|
216 apply (erule_tac c="()" and pn="permute" in Abs_lst_fcb2) |
|
217 apply(simp add: finite_supp) |
239 apply (simp_all add: pure_fresh fresh_star_def)[3] |
218 apply (simp_all add: pure_fresh fresh_star_def)[3] |
240 apply (simp add: eqvt_at_def) |
219 apply (simp add: eqvt_at_def) |
241 apply (simp add: eqvt_at_def) |
220 apply (simp add: eqvt_at_def) |
242 apply assumption |
221 apply(auto)[1] |
243 apply(erule conjE) |
222 --"other case" |
244 apply (simp add: meta_eq_to_obj_eq[OF height_trm_def, symmetric, unfolded fun_eq_iff]) |
223 apply (simp only: meta_eq_to_obj_eq[OF height_trm_def, symmetric, unfolded fun_eq_iff]) |
245 apply (simp add: meta_eq_to_obj_eq[OF height_assn_def, symmetric, unfolded fun_eq_iff]) |
224 apply (simp only: meta_eq_to_obj_eq[OF height_assn_def, symmetric, unfolded fun_eq_iff]) |
246 apply (subgoal_tac "eqvt_at height_assn as") |
225 apply (subgoal_tac "eqvt_at height_assn as") |
247 apply (subgoal_tac "eqvt_at height_assn asa") |
226 apply (subgoal_tac "eqvt_at height_assn asa") |
248 apply (subgoal_tac "eqvt_at height_trm b") |
227 apply (subgoal_tac "eqvt_at height_trm b") |
249 apply (subgoal_tac "eqvt_at height_trm ba") |
228 apply (subgoal_tac "eqvt_at height_trm ba") |
250 apply (thin_tac "eqvt_at height_trm_height_assn_sumC (Inr as)") |
229 apply (thin_tac "eqvt_at height_trm_height_assn_sumC (Inr as)") |
257 apply (simp add: eqvt_at_def height_assn_def) |
236 apply (simp add: eqvt_at_def height_assn_def) |
258 apply (simp add: eqvt_at_def height_assn_def) |
237 apply (simp add: eqvt_at_def height_assn_def) |
259 apply (subgoal_tac "height_assn as = height_assn asa") |
238 apply (subgoal_tac "height_assn as = height_assn asa") |
260 apply (subgoal_tac "height_trm b = height_trm ba") |
239 apply (subgoal_tac "height_trm b = height_trm ba") |
261 apply simp |
240 apply simp |
262 apply (erule_tac c="()" in Abs_lst_fcb2) |
241 apply(simp) |
|
242 apply(erule conjE) |
|
243 apply (erule_tac c="()" and pn="permute_bn" in Abs_lst_fcb2) |
|
244 apply(simp add: finite_supp) |
263 apply (simp_all add: pure_fresh fresh_star_def)[3] |
245 apply (simp_all add: pure_fresh fresh_star_def)[3] |
264 apply (simp_all add: eqvt_at_def)[2] |
246 apply (simp_all add: eqvt_at_def)[2] |
265 apply assumption |
247 apply(simp add: bn_inj2) |
266 apply (erule_tac c="()" and ba="bn" in Abs_lst_fcb2) |
248 apply(simp) |
|
249 apply(erule conjE) |
|
250 thm trm_assn.fv_defs |
|
251 (*apply(simp add: Abs_eq_iff alphas)*) |
|
252 apply (erule_tac c="()" and pn="permute_bn" and ba="bn" in Abs_lst_fcb2) |
|
253 defer |
267 apply (simp_all add: pure_fresh fresh_star_def)[3] |
254 apply (simp_all add: pure_fresh fresh_star_def)[3] |
|
255 defer |
|
256 defer |
268 apply (simp_all add: eqvt_at_def)[2] |
257 apply (simp_all add: eqvt_at_def)[2] |
269 apply (rule bn_inj) |
258 apply (rule bn_inj) |
270 prefer 2 |
259 prefer 2 |
271 apply (simp add: eqvts) |
260 apply (simp add: eqvts) |
272 oops |
261 oops |
305 prefer 6 |
294 prefer 6 |
306 apply (erule alpha_bn_inducts) |
295 apply (erule alpha_bn_inducts) |
307 oops |
296 oops |
308 |
297 |
309 |
298 |
|
299 lemma lets_bla: |
|
300 "x \<noteq> z \<Longrightarrow> y \<noteq> z \<Longrightarrow> x \<noteq> y \<Longrightarrow>(Let (ACons x (Var y) ANil) (Var x)) \<noteq> (Let (ACons x (Var z) ANil) (Var x))" |
|
301 by (simp add: trm_assn.eq_iff) |
|
302 |
|
303 |
|
304 lemma lets_ok: |
|
305 "(Let (ACons x (Var y) ANil) (Var x)) = (Let (ACons y (Var y) ANil) (Var y))" |
|
306 apply (simp add: trm_assn.eq_iff Abs_eq_iff ) |
|
307 apply (rule_tac x="(x \<leftrightarrow> y)" in exI) |
|
308 apply (simp_all add: alphas atom_eqvt supp_at_base fresh_star_def trm_assn.bn_defs trm_assn.supp) |
|
309 done |
|
310 |
|
311 lemma lets_ok3: |
|
312 "x \<noteq> y \<Longrightarrow> |
|
313 (Let (ACons x (App (Var y) (Var x)) (ACons y (Var y) ANil)) (App (Var x) (Var y))) \<noteq> |
|
314 (Let (ACons y (App (Var x) (Var y)) (ACons x (Var x) ANil)) (App (Var x) (Var y)))" |
|
315 apply (simp add: trm_assn.eq_iff) |
|
316 done |
|
317 |
|
318 lemma lets_not_ok1: |
|
319 "x \<noteq> y \<Longrightarrow> |
|
320 (Let (ACons x (Var x) (ACons y (Var y) ANil)) (App (Var x) (Var y))) \<noteq> |
|
321 (Let (ACons y (Var x) (ACons x (Var y) ANil)) (App (Var x) (Var y)))" |
|
322 apply (simp add: alphas trm_assn.eq_iff trm_assn.supp fresh_star_def atom_eqvt Abs_eq_iff trm_assn.bn_defs) |
|
323 done |
|
324 |
|
325 lemma lets_nok: |
|
326 "x \<noteq> y \<Longrightarrow> x \<noteq> z \<Longrightarrow> z \<noteq> y \<Longrightarrow> |
|
327 (Let (ACons x (App (Var z) (Var z)) (ACons y (Var z) ANil)) (App (Var x) (Var y))) \<noteq> |
|
328 (Let (ACons y (Var z) (ACons x (App (Var z) (Var z)) ANil)) (App (Var x) (Var y)))" |
|
329 apply (simp add: alphas trm_assn.eq_iff fresh_star_def trm_assn.bn_defs Abs_eq_iff trm_assn.supp trm_assn.distinct) |
|
330 done |
|
331 |
|
332 lemma |
|
333 fixes a b c :: name |
|
334 assumes x: "a \<noteq> c" and y: "b \<noteq> c" |
|
335 shows "\<exists>p.([atom a], Var c) \<approx>lst (op =) supp p ([atom b], Var c)" |
|
336 apply (rule_tac x="(a \<leftrightarrow> b)" in exI) |
|
337 apply (simp add: alphas trm_assn.supp supp_at_base x y fresh_star_def atom_eqvt) |
|
338 by (metis Rep_name_inverse atom_name_def flip_fresh_fresh fresh_atom fresh_perm x y) |
|
339 |
310 end |
340 end |
311 |
|
312 |
|
313 |
|