# HG changeset patch # User Cezary Kaliszyk # Date 1265725710 -3600 # Node ID f64d826a3f55a3dc5ff497863a4688485392c7e6 # Parent 551eacf071d731700a0e6e8f90ec5487769c7deb# Parent a69ec3f3f53507f3209db518215d8a90eb9f2d95 merge diff -r 551eacf071d7 -r f64d826a3f55 Quot/Nominal/Abs.thy --- a/Quot/Nominal/Abs.thy Tue Feb 09 15:28:15 2010 +0100 +++ b/Quot/Nominal/Abs.thy Tue Feb 09 15:28:30 2010 +0100 @@ -51,6 +51,30 @@ shows "(cs, y) \gen R f (- p) (bs, x)" using a b by (simp add: alpha_gen fresh_star_def fresh_def supp_minus_perm) +lemma alpha_gen_trans: + assumes a: "(bs, x) \gen R f p1 (cs, y)" + and b: "(cs, y) \gen R f p2 (ds, z)" + and c: "\R (p1 \ x) y; R (p2 \ y) z\ \ R ((p2 + p1) \ x) z" + shows "(bs, x) \gen R f (p2 + p1) (ds, z)" + using a b c using supp_plus_perm + apply(simp add: alpha_gen fresh_star_def fresh_def) + apply(blast) + done + +lemma alpha_gen_eqvt: + assumes a: "(bs, x) \gen R f q (cs, y)" + and b: "R (q \ x) y \ R (p \ (q \ x)) (p \ y)" + and c: "p \ (f x) = f (p \ x)" + and d: "p \ (f y) = f (p \ y)" + shows "(p \ bs, p \ x) \gen R f (p \ q) (p \ cs, p \ y)" + using a b + apply(simp add: alpha_gen c[symmetric] d[symmetric] Diff_eqvt[symmetric]) + apply(simp add: permute_eqvt[symmetric]) + apply(simp add: fresh_star_permute_iff) + apply(clarsimp) + done + +(* introduced for examples *) lemma alpha_gen_atom_sym: assumes a: "\pi t s. (R t s \ R (pi \ t) (pi \ s))" shows "\pi. ({atom a}, t) \gen (\x1 x2. R x1 x2 \ R x2 x1) f pi ({atom b}, s) \ @@ -67,16 +91,6 @@ apply assumption done -lemma alpha_gen_trans: - assumes a: "(bs, x) \gen R f p1 (cs, y)" - and b: "(cs, y) \gen R f p2 (ds, z)" - and c: "\R (p1 \ x) y; R (p2 \ y) z\ \ R ((p2 + p1) \ x) z" - shows "(bs, x) \gen R f (p2 + p1) (ds, z)" - using a b c using supp_plus_perm - apply(simp add: alpha_gen fresh_star_def fresh_def) - apply(blast) - done - lemma alpha_gen_atom_trans: assumes a: "\pi t s. (R t s \ R (pi \ t) (pi \ s))" shows "\\pi\perm. ({atom a}, t) \gen (\x1 x2. R x1 x2 \ (\x. R x2 x \ R x1 x)) f pi ({atom aa}, ta); @@ -98,19 +112,6 @@ apply(simp) done -lemma alpha_gen_eqvt: - assumes a: "(bs, x) \gen R f q (cs, y)" - and b: "R (q \ x) y \ R (p \ (q \ x)) (p \ y)" - and c: "p \ (f x) = f (p \ x)" - and d: "p \ (f y) = f (p \ y)" - shows "(p \ bs, p \ x) \gen R f (p \ q) (p \ cs, p \ y)" - using a b - apply(simp add: alpha_gen c[symmetric] d[symmetric] Diff_eqvt[symmetric]) - apply(simp add: permute_eqvt[symmetric]) - apply(simp add: fresh_star_permute_iff) - apply(clarsimp) - done - lemma alpha_gen_atom_eqvt: assumes a: "\x. pi \ (f x) = f (pi \ x)" and b: "\pia. ({atom a}, t) \gen (\x1 x2. R x1 x2 \ R (pi \ x1) (pi \ x2)) f pia ({atom b}, s)" @@ -258,11 +259,8 @@ shows "supp_Abs_fun (Abs bs x) = (supp x) - bs" by (lifting supp_abs_fun.simps(1)) -lemma supp_Abs_fun_eqvt: - shows "(p \ supp_Abs_fun) = supp_Abs_fun" - apply(subst permute_fun_def) - apply(subst expand_fun_eq) - apply(rule allI) +lemma supp_Abs_fun_eqvt [eqvt]: + shows "(p \ supp_Abs_fun x) = supp_Abs_fun (p \ x)" apply(induct_tac x rule: abs_induct) apply(simp add: supp_Abs_fun_simp supp_eqvt Diff_eqvt) done @@ -270,7 +268,7 @@ lemma supp_Abs_fun_fresh: shows "a \ Abs bs x \ a \ supp_Abs_fun (Abs bs x)" apply(rule fresh_fun_eqvt_app) - apply(simp add: supp_Abs_fun_eqvt) + apply(simp add: eqvts_raw) apply(simp) done @@ -325,14 +323,14 @@ lemma Abs_fresh_iff: fixes x::"'a::fs" - shows "a \ Abs bs x = (a \ bs \ (a \ bs \ a \ x))" + shows "a \ Abs bs x \ a \ bs \ (a \ bs \ a \ x)" apply(simp add: fresh_def) apply(simp add: supp_Abs) apply(auto) done lemma Abs_eq_iff: - shows "(Abs bs x) = (Abs cs y) \ (\p. (bs, x) \gen (op =) supp p (cs, y))" + shows "Abs bs x = Abs cs y \ (\p. (bs, x) \gen (op =) supp p (cs, y))" by (lifting alpha_abs.simps(1)) @@ -346,11 +344,47 @@ fun alpha1 where - "alpha1 (a, x) (b, y) \ ((a = b \ x = y) \ (a \ b \ x = (a \ b) \ y \ a \ y))" + "alpha1 (a, x) (b, y) \ (a = b \ x = y) \ (a \ b \ x = (a \ b) \ y \ a \ y)" notation alpha1 ("_ \abs1 _") +thm swap_set_not_in + +lemma qq: + fixes S::"atom set" + assumes a: "supp p \ S = {}" + shows "p \ S = S" +using a +apply(simp add: supp_perm permute_set_eq) +apply(auto) +apply(simp only: disjoint_iff_not_equal) +apply(simp) +apply (metis permute_atom_def_raw) +apply(rule_tac x="(- p) \ x" in exI) +apply(simp) +apply(simp only: disjoint_iff_not_equal) +apply(simp) +apply(metis permute_minus_cancel) +done + +lemma alpha_abs_swap: + assumes a1: "(supp x - bs) \* p" + and a2: "(supp x - bs) \* p" + shows "(bs, x) \abs (p \ bs, p \ x)" + apply(simp) + apply(rule_tac x="p" in exI) + apply(simp add: alpha_gen) + apply(simp add: supp_eqvt[symmetric] Diff_eqvt[symmetric]) + apply(rule conjI) + apply(rule sym) + apply(rule qq) + using a1 a2 + apply(auto)[1] + oops + + + lemma assumes a: "(a, x) \abs1 (b, y)" "sort_of a = sort_of b" shows "({a}, x) \abs ({b}, y)" @@ -383,6 +417,60 @@ apply(simp add: supp_swap) done +thm supp_perm + +lemma perm_induct_test: + fixes P :: "perm => bool" + assumes zero: "P 0" + assumes swap: "\a b. \sort_of a = sort_of b; a \ b\ \ P (a \ b)" + assumes plus: "\p1 p2. \supp (p1 + p2) = (supp p1 \ supp p2); P p1; P p2\ \ P (p1 + p2)" + shows "P p" +sorry + + +lemma tt: + "(supp x) \* p \ p \ x = x" +apply(induct p rule: perm_induct_test) +apply(simp) +apply(rule swap_fresh_fresh) +apply(case_tac "a \ supp x") +apply(simp add: fresh_star_def) +apply(drule_tac x="a" in bspec) +apply(simp) +apply(simp add: fresh_def) +apply(simp add: supp_swap) +apply(simp add: fresh_def) +apply(case_tac "b \ supp x") +apply(simp add: fresh_star_def) +apply(drule_tac x="b" in bspec) +apply(simp) +apply(simp add: fresh_def) +apply(simp add: supp_swap) +apply(simp add: fresh_def) +apply(simp) +apply(drule meta_mp) +apply(simp add: fresh_star_def fresh_def) +apply(drule meta_mp) +apply(simp add: fresh_star_def fresh_def) +apply(simp) +done + +lemma yy: + assumes "S1 - {x} = S2 - {x}" "x \ S1" "x \ S2" + shows "S1 = S2" +using assms +apply (metis insert_Diff_single insert_absorb) +done + + +lemma + assumes a: "({a}, x) \abs ({b}, y)" "sort_of a = sort_of b" + shows "(a, x) \abs1 (b, y)" +using a +apply(case_tac "a = b") +apply(simp) +oops + end diff -r 551eacf071d7 -r f64d826a3f55 Quot/quotient_term.ML --- a/Quot/quotient_term.ML Tue Feb 09 15:28:15 2010 +0100 +++ b/Quot/quotient_term.ML Tue Feb 09 15:28:30 2010 +0100 @@ -687,9 +687,9 @@ -(*** Wrapper for transforming an rthm into a qthm ***) +(*** Wrapper for automatically transforming an rthm into a qthm ***) -(* subst_tys takes a list of (rty,qty) substitution pairs +(* subst_tys takes a list of (rty, qty) substitution pairs and replaces all occurences of rty in the given type by appropriate qty, with substitution *) fun subst_ty thy ty (rty, qty) r = @@ -705,7 +705,7 @@ Type (s, tys) => Type (s, map (subst_tys thy substs) tys) | x => x) -(* subst_trms takes a list of (rtrm,qtrm) substitution pairs +(* subst_trms takes a list of (rtrm, qtrm) substitution pairs and if the given term matches any of the raw terms it returns the appropriate qtrm instantiated. If none of them matched it returns NONE. *) @@ -722,9 +722,9 @@ fun get_ty_trm_substs ctxt = let val thy = ProofContext.theory_of ctxt - val quot_infos = Quotient_Info.quotdata_dest ctxt + val quot_infos = Quotient_Info.quotdata_dest ctxt + val const_infos = Quotient_Info.qconsts_dest ctxt val ty_substs = map (fn ri => (#rtyp ri, #qtyp ri)) quot_infos - val const_infos = Quotient_Info.qconsts_dest ctxt val const_substs = map (fn ci => (#rconst ci, #qconst ci)) const_infos fun rel_eq rel = HOLogic.eq_const (subst_tys thy ty_substs (domain_type (fastype_of rel))) val rel_substs = map (fn ri => (#equiv_rel ri, rel_eq (#equiv_rel ri))) quot_infos @@ -734,14 +734,14 @@ (* -Finds subterms of a term that can be lifted and: +Takes a term and -* replaces subterms matching lifted constants by the lifted constants +* replaces raw constants by the quotient constants * replaces equivalence relations by equalities -* In constants, frees and schematic variables replaces - subtypes matching lifted types by those types +* replaces raw types by the quotient types + *) fun quotient_lift_all ctxt t = @@ -770,7 +770,6 @@ end - end; (* structure *)