# HG changeset patch # User Cezary Kaliszyk # Date 1277275718 -7200 # Node ID b51532dd5689e252046070c2e755dd84d178a2a6 # Parent 29532d69111cef532265aa697e1133c57060bab6 Changes for PER and list_all2 committed to Isabelle diff -r 29532d69111c -r b51532dd5689 Nominal/Ex/SingleLet.thy --- a/Nominal/Ex/SingleLet.thy Fri Jun 18 15:22:58 2010 +0200 +++ b/Nominal/Ex/SingleLet.thy Wed Jun 23 08:48:38 2010 +0200 @@ -4,6 +4,8 @@ atom_decl name +ML {* val _ = cheat_equivp := true *} + nominal_datatype trm = Var "name" | App "trm" "trm" @@ -27,7 +29,7 @@ thm trm_assg.inducts thm trm_assg.distinct ML {* Sign.of_sort @{theory} (@{typ trm}, @{sort fs}) *} -thm trm_assg.fv[simplified trm_assg.supp(1-2)] +(* thm trm_assg.fv[simplified trm_assg.supp(1-2)] *) end diff -r 29532d69111c -r b51532dd5689 Nominal/FSet.thy --- a/Nominal/FSet.thy Fri Jun 18 15:22:58 2010 +0200 +++ b/Nominal/FSet.thy Wed Jun 23 08:48:38 2010 +0200 @@ -80,20 +80,20 @@ text {* Composition Quotient *} -lemma list_rel_refl1: - shows "(list_rel op \) r r" - by (rule list_rel_refl) (metis equivp_def fset_equivp) +lemma list_all2_refl1: + shows "(list_all2 op \) r r" + by (rule list_all2_refl) (metis equivp_def fset_equivp) lemma compose_list_refl: - shows "(list_rel op \ OOO op \) r r" + shows "(list_all2 op \ OOO op \) r r" proof have *: "r \ r" by (rule equivp_reflp[OF fset_equivp]) - show "list_rel op \ r r" by (rule list_rel_refl1) - with * show "(op \ OO list_rel op \) r r" .. + show "list_all2 op \ r r" by (rule list_all2_refl1) + with * show "(op \ OO list_all2 op \) r r" .. qed lemma Quotient_fset_list: - shows "Quotient (list_rel op \) (map abs_fset) (map rep_fset)" + shows "Quotient (list_all2 op \) (map abs_fset) (map rep_fset)" by (fact list_quotient[OF Quotient_fset]) lemma set_in_eq: "(\e. ((e \ xs) \ (e \ ys))) \ xs = ys" @@ -105,32 +105,32 @@ lemma quotient_compose_list[quot_thm]: - shows "Quotient ((list_rel op \) OOO (op \)) + shows "Quotient ((list_all2 op \) OOO (op \)) (abs_fset \ (map abs_fset)) ((map rep_fset) \ rep_fset)" unfolding Quotient_def comp_def proof (intro conjI allI) fix a r s show "abs_fset (map abs_fset (map rep_fset (rep_fset a))) = a" by (simp add: abs_o_rep[OF Quotient_fset] Quotient_abs_rep[OF Quotient_fset] map_id) - have b: "list_rel op \ (map rep_fset (rep_fset a)) (map rep_fset (rep_fset a))" - by (rule list_rel_refl1) - have c: "(op \ OO list_rel op \) (map rep_fset (rep_fset a)) (map rep_fset (rep_fset a))" + have b: "list_all2 op \ (map rep_fset (rep_fset a)) (map rep_fset (rep_fset a))" + by (rule list_all2_refl1) + have c: "(op \ OO list_all2 op \) (map rep_fset (rep_fset a)) (map rep_fset (rep_fset a))" by (rule, rule equivp_reflp[OF fset_equivp]) (rule b) - show "(list_rel op \ OOO op \) (map rep_fset (rep_fset a)) (map rep_fset (rep_fset a))" - by (rule, rule list_rel_refl1) (rule c) - show "(list_rel op \ OOO op \) r s = ((list_rel op \ OOO op \) r r \ - (list_rel op \ OOO op \) s s \ abs_fset (map abs_fset r) = abs_fset (map abs_fset s))" + show "(list_all2 op \ OOO op \) (map rep_fset (rep_fset a)) (map rep_fset (rep_fset a))" + by (rule, rule list_all2_refl1) (rule c) + show "(list_all2 op \ OOO op \) r s = ((list_all2 op \ OOO op \) r r \ + (list_all2 op \ OOO op \) s s \ abs_fset (map abs_fset r) = abs_fset (map abs_fset s))" proof (intro iffI conjI) - show "(list_rel op \ OOO op \) r r" by (rule compose_list_refl) - show "(list_rel op \ OOO op \) s s" by (rule compose_list_refl) + show "(list_all2 op \ OOO op \) r r" by (rule compose_list_refl) + show "(list_all2 op \ OOO op \) s s" by (rule compose_list_refl) next - assume a: "(list_rel op \ OOO op \) r s" + assume a: "(list_all2 op \ OOO op \) r s" then have b: "map abs_fset r \ map abs_fset s" proof (elim pred_compE) fix b ba - assume c: "list_rel op \ r b" + assume c: "list_all2 op \ r b" assume d: "b \ ba" - assume e: "list_rel op \ ba s" + assume e: "list_all2 op \ ba s" have f: "map abs_fset r = map abs_fset b" using Quotient_rel[OF Quotient_fset_list] c by blast have "map abs_fset ba = map abs_fset s" @@ -141,20 +141,20 @@ then show "abs_fset (map abs_fset r) = abs_fset (map abs_fset s)" using Quotient_rel[OF Quotient_fset] by blast next - assume a: "(list_rel op \ OOO op \) r r \ (list_rel op \ OOO op \) s s + assume a: "(list_all2 op \ OOO op \) r r \ (list_all2 op \ OOO op \) s s \ abs_fset (map abs_fset r) = abs_fset (map abs_fset s)" - then have s: "(list_rel op \ OOO op \) s s" by simp + then have s: "(list_all2 op \ OOO op \) s s" by simp have d: "map abs_fset r \ map abs_fset s" by (subst Quotient_rel[OF Quotient_fset]) (simp add: a) have b: "map rep_fset (map abs_fset r) \ map rep_fset (map abs_fset s)" by (rule map_rel_cong[OF d]) - have y: "list_rel op \ (map rep_fset (map abs_fset s)) s" - by (fact rep_abs_rsp_left[OF Quotient_fset_list, OF list_rel_refl1[of s]]) - have c: "(op \ OO list_rel op \) (map rep_fset (map abs_fset r)) s" + have y: "list_all2 op \ (map rep_fset (map abs_fset s)) s" + by (fact rep_abs_rsp_left[OF Quotient_fset_list, OF list_all2_refl1[of s]]) + have c: "(op \ OO list_all2 op \) (map rep_fset (map abs_fset r)) s" by (rule pred_compI) (rule b, rule y) - have z: "list_rel op \ r (map rep_fset (map abs_fset r))" - by (fact rep_abs_rsp[OF Quotient_fset_list, OF list_rel_refl1[of r]]) - then show "(list_rel op \ OOO op \) r s" + have z: "list_all2 op \ r (map rep_fset (map abs_fset r))" + by (fact rep_abs_rsp[OF Quotient_fset_list, OF list_all2_refl1[of r]]) + then show "(list_all2 op \ OOO op \) r s" using a c pred_compI by simp qed qed @@ -342,27 +342,27 @@ by (simp add: memb_def[symmetric] ffold_raw_rsp_pre) lemma concat_rsp_pre: - assumes a: "list_rel op \ x x'" + assumes a: "list_all2 op \ x x'" and b: "x' \ y'" - and c: "list_rel op \ y' y" + and c: "list_all2 op \ y' y" and d: "\x\set x. xa \ set x" shows "\x\set y. xa \ set x" proof - obtain xb where e: "xb \ set x" and f: "xa \ set xb" using d by auto - have "\y. y \ set x' \ xb \ y" by (rule list_rel_find_element[OF e a]) + have "\y. y \ set x' \ xb \ y" by (rule list_all2_find_element[OF e a]) then obtain ya where h: "ya \ set x'" and i: "xb \ ya" by auto have "ya \ set y'" using b h by simp - then have "\yb. yb \ set y \ ya \ yb" using c by (rule list_rel_find_element) + then have "\yb. yb \ set y \ ya \ yb" using c by (rule list_all2_find_element) then show ?thesis using f i by auto qed lemma concat_rsp[quot_respect]: - shows "(list_rel op \ OOO op \ ===> op \) concat concat" + shows "(list_all2 op \ OOO op \ ===> op \) concat concat" proof (rule fun_relI, elim pred_compE) fix a b ba bb - assume a: "list_rel op \ a ba" + assume a: "list_all2 op \ a ba" assume b: "ba \ bb" - assume c: "list_rel op \ bb b" + assume c: "list_all2 op \ bb b" have "\x. (\xa\set a. x \ set xa) = (\xa\set b. x \ set xa)" proof fix x show "(\xa\set a. x \ set xa) = (\xa\set b. x \ set xa)" proof @@ -370,9 +370,9 @@ show "\xa\set b. x \ set xa" by (rule concat_rsp_pre[OF a b c d]) next assume e: "\xa\set b. x \ set xa" - have a': "list_rel op \ ba a" by (rule list_rel_symp[OF list_eq_equivp, OF a]) + have a': "list_all2 op \ ba a" by (rule list_all2_symp[OF list_eq_equivp, OF a]) have b': "bb \ ba" by (rule equivp_symp[OF list_eq_equivp, OF b]) - have c': "list_rel op \ b bb" by (rule list_rel_symp[OF list_eq_equivp, OF c]) + have c': "list_all2 op \ b bb" by (rule list_all2_symp[OF list_eq_equivp, OF c]) show "\xa\set a. x \ set xa" by (rule concat_rsp_pre[OF c' b' a' e]) qed qed @@ -382,12 +382,12 @@ lemma concat_rsp_unfolded: - "\list_rel op \ a ba; ba \ bb; list_rel op \ bb b\ \ concat a \ concat b" + "\list_all2 op \ a ba; ba \ bb; list_all2 op \ bb b\ \ concat a \ concat b" proof - fix a b ba bb - assume a: "list_rel op \ a ba" + assume a: "list_all2 op \ a ba" assume b: "ba \ bb" - assume c: "list_rel op \ bb b" + assume c: "list_all2 op \ bb b" have "\x. (\xa\set a. x \ set xa) = (\xa\set b. x \ set xa)" proof fix x show "(\xa\set a. x \ set xa) = (\xa\set b. x \ set xa)" proof @@ -395,9 +395,9 @@ show "\xa\set b. x \ set xa" by (rule concat_rsp_pre[OF a b c d]) next assume e: "\xa\set b. x \ set xa" - have a': "list_rel op \ ba a" by (rule list_rel_symp[OF list_eq_equivp, OF a]) + have a': "list_all2 op \ ba a" by (rule list_all2_symp[OF list_eq_equivp, OF a]) have b': "bb \ ba" by (rule equivp_symp[OF list_eq_equivp, OF b]) - have c': "list_rel op \ b bb" by (rule list_rel_symp[OF list_eq_equivp, OF c]) + have c': "list_all2 op \ b bb" by (rule list_all2_symp[OF list_eq_equivp, OF c]) show "\xa\set a. x \ set xa" by (rule concat_rsp_pre[OF c' b' a' e]) qed qed @@ -614,14 +614,14 @@ text {* Compositional Respectfullness and Preservation *} -lemma [quot_respect]: "(list_rel op \ OOO op \) [] []" +lemma [quot_respect]: "(list_all2 op \ OOO op \) [] []" by (fact compose_list_refl) lemma [quot_preserve]: "(abs_fset \ map f) [] = abs_fset []" by simp lemma [quot_respect]: - "(op \ ===> list_rel op \ OOO op \ ===> list_rel op \ OOO op \) op # op #" + "(op \ ===> list_all2 op \ OOO op \ ===> list_all2 op \ OOO op \) op # op #" apply auto apply (simp add: set_in_eq) apply (rule_tac b="x # b" in pred_compI) @@ -645,59 +645,59 @@ by (simp add: expand_fun_eq Quotient_abs_rep[OF Quotient_fset] abs_o_rep[OF Quotient_fset] map_id sup_fset_def) -lemma list_rel_app_l: +lemma list_all2_app_l: assumes a: "reflp R" - and b: "list_rel R l r" - shows "list_rel R (z @ l) (z @ r)" + and b: "list_all2 R l r" + shows "list_all2 R (z @ l) (z @ r)" by (induct z) (simp_all add: b rev_iffD1[OF a meta_eq_to_obj_eq[OF reflp_def]]) lemma append_rsp2_pre0: - assumes a:"list_rel op \ x x'" - shows "list_rel op \ (x @ z) (x' @ z)" + assumes a:"list_all2 op \ x x'" + shows "list_all2 op \ (x @ z) (x' @ z)" using a apply (induct x x' rule: list_induct2') - by simp_all (rule list_rel_refl1) + by simp_all (rule list_all2_refl1) lemma append_rsp2_pre1: - assumes a:"list_rel op \ x x'" - shows "list_rel op \ (z @ x) (z @ x')" + assumes a:"list_all2 op \ x x'" + shows "list_all2 op \ (z @ x) (z @ x')" using a apply (induct x x' arbitrary: z rule: list_induct2') - apply (rule list_rel_refl1) + apply (rule list_all2_refl1) apply (simp_all del: list_eq.simps) - apply (rule list_rel_app_l) + apply (rule list_all2_app_l) apply (simp_all add: reflp_def) done lemma append_rsp2_pre: - assumes a:"list_rel op \ x x'" - and b: "list_rel op \ z z'" - shows "list_rel op \ (x @ z) (x' @ z')" - apply (rule list_rel_transp[OF fset_equivp]) + assumes a:"list_all2 op \ x x'" + and b: "list_all2 op \ z z'" + shows "list_all2 op \ (x @ z) (x' @ z')" + apply (rule list_all2_transp[OF fset_equivp]) apply (rule append_rsp2_pre0) apply (rule a) using b apply (induct z z' rule: list_induct2') apply (simp_all only: append_Nil2) - apply (rule list_rel_refl1) + apply (rule list_all2_refl1) apply simp_all apply (rule append_rsp2_pre1) apply simp done lemma [quot_respect]: - "(list_rel op \ OOO op \ ===> list_rel op \ OOO op \ ===> list_rel op \ OOO op \) op @ op @" + "(list_all2 op \ OOO op \ ===> list_all2 op \ OOO op \ ===> list_all2 op \ OOO op \) op @ op @" proof (intro fun_relI, elim pred_compE) fix x y z w x' z' y' w' :: "'a list list" - assume a:"list_rel op \ x x'" + assume a:"list_all2 op \ x x'" and b: "x' \ y'" - and c: "list_rel op \ y' y" - assume aa: "list_rel op \ z z'" + and c: "list_all2 op \ y' y" + assume aa: "list_all2 op \ z z'" and bb: "z' \ w'" - and cc: "list_rel op \ w' w" - have a': "list_rel op \ (x @ z) (x' @ z')" using a aa append_rsp2_pre by auto + and cc: "list_all2 op \ w' w" + have a': "list_all2 op \ (x @ z) (x' @ z')" using a aa append_rsp2_pre by auto have b': "x' @ z' \ y' @ w'" using b bb by simp - have c': "list_rel op \ (y' @ w') (y @ w)" using c cc append_rsp2_pre by auto - have d': "(op \ OO list_rel op \) (x' @ z') (y @ w)" + have c': "list_all2 op \ (y' @ w') (y @ w)" using c cc append_rsp2_pre by auto + have d': "(op \ OO list_all2 op \) (x' @ z') (y @ w)" by (rule pred_compI) (rule b', rule c') - show "(list_rel op \ OOO op \) (x @ z) (y @ w)" + show "(list_all2 op \ OOO op \) (x @ z) (y @ w)" by (rule pred_compI) (rule a', rule d') qed @@ -1677,49 +1677,49 @@ apply auto done -lemma list_rel_refl: +lemma list_all2_refl: assumes q: "equivp R" - shows "(list_rel R) r r" - by (rule list_rel_refl) (metis equivp_def fset_equivp q) + shows "(list_all2 R) r r" + by (rule list_all2_refl) (metis equivp_def fset_equivp q) lemma compose_list_refl2: assumes q: "equivp R" - shows "(list_rel R OOO op \) r r" + shows "(list_all2 R OOO op \) r r" proof have *: "r \ r" by (rule equivp_reflp[OF fset_equivp]) - show "list_rel R r r" by (rule list_rel_refl[OF q]) - with * show "(op \ OO list_rel R) r r" .. + show "list_all2 R r r" by (rule list_all2_refl[OF q]) + with * show "(op \ OO list_all2 R) r r" .. qed lemma quotient_compose_list_g[quot_thm]: assumes q: "Quotient R Abs Rep" and e: "equivp R" - shows "Quotient ((list_rel R) OOO (op \)) + shows "Quotient ((list_all2 R) OOO (op \)) (abs_fset \ (map Abs)) ((map Rep) \ rep_fset)" unfolding Quotient_def comp_def proof (intro conjI allI) fix a r s show "abs_fset (map Abs (map Rep (rep_fset a))) = a" by (simp add: abs_o_rep[OF q] Quotient_abs_rep[OF Quotient_fset] map_id) - have b: "list_rel R (map Rep (rep_fset a)) (map Rep (rep_fset a))" - by (rule list_rel_refl[OF e]) - have c: "(op \ OO list_rel R) (map Rep (rep_fset a)) (map Rep (rep_fset a))" + have b: "list_all2 R (map Rep (rep_fset a)) (map Rep (rep_fset a))" + by (rule list_all2_refl[OF e]) + have c: "(op \ OO list_all2 R) (map Rep (rep_fset a)) (map Rep (rep_fset a))" by (rule, rule equivp_reflp[OF fset_equivp]) (rule b) - show "(list_rel R OOO op \) (map Rep (rep_fset a)) (map Rep (rep_fset a))" - by (rule, rule list_rel_refl[OF e]) (rule c) - show "(list_rel R OOO op \) r s = ((list_rel R OOO op \) r r \ - (list_rel R OOO op \) s s \ abs_fset (map Abs r) = abs_fset (map Abs s))" + show "(list_all2 R OOO op \) (map Rep (rep_fset a)) (map Rep (rep_fset a))" + by (rule, rule list_all2_refl[OF e]) (rule c) + show "(list_all2 R OOO op \) r s = ((list_all2 R OOO op \) r r \ + (list_all2 R OOO op \) s s \ abs_fset (map Abs r) = abs_fset (map Abs s))" proof (intro iffI conjI) - show "(list_rel R OOO op \) r r" by (rule compose_list_refl2[OF e]) - show "(list_rel R OOO op \) s s" by (rule compose_list_refl2[OF e]) + show "(list_all2 R OOO op \) r r" by (rule compose_list_refl2[OF e]) + show "(list_all2 R OOO op \) s s" by (rule compose_list_refl2[OF e]) next - assume a: "(list_rel R OOO op \) r s" + assume a: "(list_all2 R OOO op \) r s" then have b: "map Abs r \ map Abs s" proof (elim pred_compE) fix b ba - assume c: "list_rel R r b" + assume c: "list_all2 R r b" assume d: "b \ ba" - assume e: "list_rel R ba s" + assume e: "list_all2 R ba s" have f: "map Abs r = map Abs b" using Quotient_rel[OF list_quotient[OF q]] c by blast have "map Abs ba = map Abs s" @@ -1730,20 +1730,20 @@ then show "abs_fset (map Abs r) = abs_fset (map Abs s)" using Quotient_rel[OF Quotient_fset] by blast next - assume a: "(list_rel R OOO op \) r r \ (list_rel R OOO op \) s s + assume a: "(list_all2 R OOO op \) r r \ (list_all2 R OOO op \) s s \ abs_fset (map Abs r) = abs_fset (map Abs s)" - then have s: "(list_rel R OOO op \) s s" by simp + then have s: "(list_all2 R OOO op \) s s" by simp have d: "map Abs r \ map Abs s" by (subst Quotient_rel[OF Quotient_fset]) (simp add: a) have b: "map Rep (map Abs r) \ map Rep (map Abs s)" by (rule map_rel_cong[OF d]) - have y: "list_rel R (map Rep (map Abs s)) s" - by (fact rep_abs_rsp_left[OF list_quotient[OF q], OF list_rel_refl[OF e, of s]]) - have c: "(op \ OO list_rel R) (map Rep (map Abs r)) s" + have y: "list_all2 R (map Rep (map Abs s)) s" + by (fact rep_abs_rsp_left[OF list_quotient[OF q], OF list_all2_refl[OF e, of s]]) + have c: "(op \ OO list_all2 R) (map Rep (map Abs r)) s" by (rule pred_compI) (rule b, rule y) - have z: "list_rel R r (map Rep (map Abs r))" - by (fact rep_abs_rsp[OF list_quotient[OF q], OF list_rel_refl[OF e, of r]]) - then show "(list_rel R OOO op \) r s" + have z: "list_all2 R r (map Rep (map Abs r))" + by (fact rep_abs_rsp[OF list_quotient[OF q], OF list_all2_refl[OF e, of r]]) + then show "(list_all2 R OOO op \) r s" using a c pred_compI by simp qed qed diff -r 29532d69111c -r b51532dd5689 Nominal/Manual/Term4.thy --- a/Nominal/Manual/Term4.thy Fri Jun 18 15:22:58 2010 +0200 +++ b/Nominal/Manual/Term4.thy Wed Jun 23 08:48:38 2010 +0200 @@ -42,7 +42,7 @@ local_setup {* (fn ctxt => snd (Local_Theory.note ((@{binding alpha4_inj}, []), (build_rel_inj @{thms alpha_rtrm4_alpha_rtrm4_list.intros} @{thms rtrm4.distinct rtrm4.inject list.distinct list.inject} @{thms alpha_rtrm4.cases alpha_rtrm4_list.cases} ctxt)) ctxt)) *} lemmas alpha_inj = alpha4_inj(1-3) -lemma alpha_fix: "alpha_rtrm4_list = list_rel alpha_rtrm4" +lemma alpha_fix: "alpha_rtrm4_list = list_all2 alpha_rtrm4" apply (rule ext)+ apply (induct_tac x xa rule: list_induct2') apply (simp_all add: alpha_rtrm4_alpha_rtrm4_list.intros) @@ -105,7 +105,7 @@ (fn _ => constr_rsp_tac @{thms alpha4_inj} @{thms fv_rtrm4_rsp alpha4_equivp} 1) *} lemma [quot_respect]: - "(alpha_rtrm4 ===> list_rel alpha_rtrm4 ===> alpha_rtrm4) rAp4 rAp4" + "(alpha_rtrm4 ===> list_all2 alpha_rtrm4 ===> alpha_rtrm4) rAp4 rAp4" by (simp add: alpha_inj_fixed) local_setup {* snd o prove_const_rsp [] @{binding permute_rtrm4_rsp} @@ -126,7 +126,7 @@ apply (simp add: meta_eq_to_obj_eq[OF permute_trm4_def,simplified expand_fun_eq,simplified]) done -lemma [quot_respect]: "(op = ===> list_rel alpha_rtrm4 ===> list_rel alpha_rtrm4) permute permute" +lemma [quot_respect]: "(op = ===> list_all2 alpha_rtrm4 ===> list_all2 alpha_rtrm4) permute permute" apply simp apply (rule allI)+ apply (induct_tac xa y rule: list_induct2')