# HG changeset patch # User Christian Urban # Date 1268484555 -3600 # Node ID 04dad9b0136d40eec340dacb0af536ba0f5b2f38 # Parent 55b49de0c2c7317a0372df53171efb7bb853b0f5 started supp-fv proofs (is going to work) diff -r 55b49de0c2c7 -r 04dad9b0136d Nominal/Abs.thy --- a/Nominal/Abs.thy Fri Mar 12 17:42:31 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,757 +0,0 @@ -theory Abs -imports "Nominal2_Atoms" "Nominal2_Eqvt" "Nominal2_Supp" "../Quotient" "../Quotient_Product" -begin - -(* the next three lemmas that should be in Nominal \\must be cleaned *) -lemma ball_image: - shows "(\x \ p \ S. P x) = (\x \ S. P (p \ x))" -apply(auto) -apply(drule_tac x="p \ x" in bspec) -apply(simp add: mem_permute_iff) -apply(simp) -apply(drule_tac x="(- p) \ x" in bspec) -apply(rule_tac p1="p" in mem_permute_iff[THEN iffD1]) -apply(simp) -apply(simp) -done - -lemma fresh_star_plus: - fixes p q::perm - shows "\a \* p; a \* q\ \ a \* (p + q)" - unfolding fresh_star_def - by (simp add: fresh_plus_perm) - -lemma fresh_star_permute_iff: - shows "(p \ a) \* (p \ x) \ a \* x" -apply(simp add: fresh_star_def) -apply(simp add: ball_image) -apply(simp add: fresh_permute_iff) -done - -fun - alpha_gen -where - alpha_gen[simp del]: - "alpha_gen (bs, x) R f pi (cs, y) \ f x - bs = f y - cs \ (f x - bs) \* pi \ R (pi \ x) y" - -notation - alpha_gen ("_ \gen _ _ _ _" [100, 100, 100, 100, 100] 100) - -lemma [mono]: "R1 \ R2 \ alpha_gen x R1 \ alpha_gen x R2" - by (cases x) (auto simp add: le_fun_def le_bool_def alpha_gen.simps) - -lemma alpha_gen_refl: - assumes a: "R x x" - shows "(bs, x) \gen R f 0 (bs, x)" - using a by (simp add: alpha_gen fresh_star_def fresh_zero_perm) - -lemma alpha_gen_sym: - assumes a: "(bs, x) \gen R f p (cs, y)" - and b: "R (p \ x) y \ R (- p \ y) x" - 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 - -lemma alpha_gen_compose_sym: - fixes pi - assumes b: "(aa, t) \gen (\x1 x2. R x1 x2 \ R x2 x1) f pi (ab, s)" - and a: "\pi t s. (R t s \ R (pi \ t) (pi \ s))" - shows "(ab, s) \gen R f (- pi) (aa, t)" - using b apply - - apply(simp add: alpha_gen.simps) - apply(erule conjE)+ - apply(rule conjI) - apply(simp add: fresh_star_def fresh_minus_perm) - apply(subgoal_tac "R (- pi \ s) ((- pi) \ (pi \ t))") - apply simp - apply(rule a) - apply assumption - done - -lemma alpha_gen_compose_trans: - fixes pi pia - assumes b: "(aa, t) \gen (\x1 x2. R x1 x2 \ (\x. R x2 x \ R x1 x)) f pi (ab, ta)" - and c: "(ab, ta) \gen R f pia (ac, sa)" - and a: "\pi t s. (R t s \ R (pi \ t) (pi \ s))" - shows "(aa, t) \gen R f (pia + pi) (ac, sa)" - using b c apply - - apply(simp add: alpha_gen.simps) - apply(erule conjE)+ - apply(simp add: fresh_star_plus) - apply(drule_tac x="- pia \ sa" in spec) - apply(drule mp) - apply(rotate_tac 4) - apply(drule_tac pi="- pia" in a) - apply(simp) - apply(rotate_tac 6) - apply(drule_tac pi="pia" in a) - apply(simp) - done - -lemma alpha_gen_compose_eqvt: - fixes pia - assumes b: "(g d, t) \gen (\x1 x2. R x1 x2 \ R (pi \ x1) (pi \ x2)) f pia (g e, s)" - and c: "\y. pi \ (g y) = g (pi \ y)" - and a: "\x. pi \ (f x) = f (pi \ x)" - shows "(g (pi \ d), pi \ t) \gen R f (pi \ pia) (g (pi \ e), pi \ s)" - using b - apply - - apply(simp add: alpha_gen.simps) - apply(erule conjE)+ - apply(rule conjI) - apply(rule_tac ?p1="- pi" in permute_eq_iff[THEN iffD1]) - apply(simp add: a[symmetric] atom_eqvt Diff_eqvt insert_eqvt set_eqvt empty_eqvt c[symmetric]) - apply(rule conjI) - apply(rule_tac ?p1="- pi" in fresh_star_permute_iff[THEN iffD1]) - apply(simp add: a[symmetric] atom_eqvt Diff_eqvt insert_eqvt set_eqvt empty_eqvt c[symmetric]) - apply(subst permute_eqvt[symmetric]) - apply(simp) - done - -fun - alpha_abs -where - "alpha_abs (bs, x) (cs, y) = (\p. (bs, x) \gen (op=) supp p (cs, y))" - -notation - alpha_abs ("_ \abs _") - -lemma alpha_abs_swap: - assumes a1: "a \ (supp x) - bs" - and a2: "b \ (supp x) - bs" - shows "(bs, x) \abs ((a \ b) \ bs, (a \ b) \ x)" - apply(simp) - apply(rule_tac x="(a \ b)" in exI) - apply(simp add: alpha_gen) - apply(simp add: supp_eqvt[symmetric] Diff_eqvt[symmetric]) - apply(simp add: swap_set_not_in[OF a1 a2]) - apply(subgoal_tac "supp (a \ b) \ {a, b}") - using a1 a2 - apply(simp add: fresh_star_def fresh_def) - apply(blast) - apply(simp add: supp_swap) - done - -fun - supp_abs_fun -where - "supp_abs_fun (bs, x) = (supp x) - bs" - -lemma supp_abs_fun_lemma: - assumes a: "x \abs y" - shows "supp_abs_fun x = supp_abs_fun y" - using a - apply(induct rule: alpha_abs.induct) - apply(simp add: alpha_gen) - done - -quotient_type 'a abs = "(atom set \ 'a::pt)" / "alpha_abs" - apply(rule equivpI) - unfolding reflp_def symp_def transp_def - apply(simp_all) - (* refl *) - apply(clarify) - apply(rule exI) - apply(rule alpha_gen_refl) - apply(simp) - (* symm *) - apply(clarify) - apply(rule exI) - apply(rule alpha_gen_sym) - apply(assumption) - apply(clarsimp) - (* trans *) - apply(clarify) - apply(rule exI) - apply(rule alpha_gen_trans) - apply(assumption) - apply(assumption) - apply(simp) - done - -quotient_definition - "Abs::atom set \ ('a::pt) \ 'a abs" -is - "Pair::atom set \ ('a::pt) \ (atom set \ 'a)" - -lemma [quot_respect]: - shows "((op =) ===> (op =) ===> alpha_abs) Pair Pair" - apply(clarsimp) - apply(rule exI) - apply(rule alpha_gen_refl) - apply(simp) - done - -lemma [quot_respect]: - shows "((op =) ===> alpha_abs ===> alpha_abs) permute permute" - apply(clarsimp) - apply(rule exI) - apply(rule alpha_gen_eqvt) - apply(assumption) - apply(simp_all add: supp_eqvt) - done - -lemma [quot_respect]: - shows "(alpha_abs ===> (op =)) supp_abs_fun supp_abs_fun" - apply(simp add: supp_abs_fun_lemma) - done - -lemma abs_induct: - "\\as (x::'a::pt). P (Abs as x)\ \ P t" - apply(lifting prod.induct[where 'a="atom set" and 'b="'a"]) - done - -(* TEST case *) -lemmas abs_induct2 = prod.induct[where 'a="atom set" and 'b="'a::pt", quot_lifted] -thm abs_induct abs_induct2 - -instantiation abs :: (pt) pt -begin - -quotient_definition - "permute_abs::perm \ ('a::pt abs) \ 'a abs" -is - "permute:: perm \ (atom set \ 'a::pt) \ (atom set \ 'a::pt)" - -lemma permute_ABS [simp]: - fixes x::"'a::pt" (* ??? has to be 'a \ 'b does not work *) - shows "(p \ (Abs as x)) = Abs (p \ as) (p \ x)" - by (lifting permute_prod.simps(1)[where 'a="atom set" and 'b="'a"]) - -instance - apply(default) - apply(induct_tac [!] x rule: abs_induct) - apply(simp_all) - done - -end - -quotient_definition - "supp_Abs_fun :: ('a::pt) abs \ atom \ bool" -is - "supp_abs_fun" - -lemma supp_Abs_fun_simp: - shows "supp_Abs_fun (Abs bs x) = (supp x) - bs" - by (lifting supp_abs_fun.simps(1)) - -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 - -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: eqvts_raw) - apply(simp) - done - -lemma Abs_swap: - assumes a1: "a \ (supp x) - bs" - and a2: "b \ (supp x) - bs" - shows "(Abs bs x) = (Abs ((a \ b) \ bs) ((a \ b) \ x))" - using a1 a2 by (lifting alpha_abs_swap) - -lemma Abs_supports: - shows "((supp x) - as) supports (Abs as x)" - unfolding supports_def - apply(clarify) - apply(simp (no_asm)) - apply(subst Abs_swap[symmetric]) - apply(simp_all) - done - -lemma supp_Abs_subset1: - fixes x::"'a::fs" - shows "(supp x) - as \ supp (Abs as x)" - apply(simp add: supp_conv_fresh) - apply(auto) - apply(drule_tac supp_Abs_fun_fresh) - apply(simp only: supp_Abs_fun_simp) - apply(simp add: fresh_def) - apply(simp add: supp_finite_atom_set finite_supp) - done - -lemma supp_Abs_subset2: - fixes x::"'a::fs" - shows "supp (Abs as x) \ (supp x) - as" - apply(rule supp_is_subset) - apply(rule Abs_supports) - apply(simp add: finite_supp) - done - -lemma supp_Abs: - fixes x::"'a::fs" - shows "supp (Abs as x) = (supp x) - as" - apply(rule_tac subset_antisym) - apply(rule supp_Abs_subset2) - apply(rule supp_Abs_subset1) - done - -instance abs :: (fs) fs - apply(default) - apply(induct_tac x rule: abs_induct) - apply(simp add: supp_Abs) - apply(simp add: finite_supp) - done - -lemma Abs_fresh_iff: - fixes x::"'a::fs" - 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))" - by (lifting alpha_abs.simps(1)) - - - -(* - below is a construction site for showing that in the - single-binder case, the old and new alpha equivalence - coincide -*) - -fun - alpha1 -where - "alpha1 (a, x) (b, y) \ (a = b \ x = y) \ (a \ b \ x = (a \ b) \ y \ a \ y)" - -notation - alpha1 ("_ \abs1 _") - -fun - alpha2 -where - "alpha2 (a, x) (b, y) \ (\c. c \ (a,b,x,y) \ ((c \ a) \ x) = ((c \ b) \ y))" - -notation - alpha2 ("_ \abs2 _") - - - -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 - assumes a: "(a, x) \abs1 (b, y)" "sort_of a = sort_of b" - shows "({a}, x) \abs ({b}, y)" -using a -apply(simp) -apply(erule disjE) -apply(simp) -apply(rule exI) -apply(rule alpha_gen_refl) -apply(simp) -apply(rule_tac x="(a \ b)" in exI) -apply(simp add: alpha_gen) -apply(simp add: fresh_def) -apply(rule conjI) -apply(rule_tac ?p1="(a \ b)" in permute_eq_iff[THEN iffD1]) -apply(rule trans) -apply(simp add: Diff_eqvt supp_eqvt) -apply(subst swap_set_not_in) -back -apply(simp) -apply(simp) -apply(simp add: permute_set_eq) -apply(rule_tac ?p1="(a \ b)" in fresh_star_permute_iff[THEN iffD1]) -apply(simp add: permute_self) -apply(simp add: Diff_eqvt supp_eqvt) -apply(simp add: permute_set_eq) -apply(subgoal_tac "supp (a \ b) \ {a, b}") -apply(simp add: fresh_star_def fresh_def) -apply(blast) -apply(simp add: supp_swap) -done - -lemma perm_zero: - assumes a: "\x::atom. p \ x = x" - shows "p = 0" -using a -by (simp add: expand_perm_eq) - -fun - add_perm -where - "add_perm [] = 0" -| "add_perm ((a, b) # xs) = (a \ b) + add_perm xs" - -fun - elem_perm -where - "elem_perm [] = {}" -| "elem_perm ((a, b) # xs) = {a, b} \ elem_perm xs" - - -lemma add_perm_apend: - shows "add_perm (xs @ ys) = add_perm xs + add_perm ys" -apply(induct xs arbitrary: ys) -apply(auto simp add: add_assoc) -done - -lemma perm_list_exists: - fixes p::perm - shows "\xs. p = add_perm xs \ supp xs \ supp p" -apply(induct p taking: "\p::perm. card (supp p)" rule: measure_induct) -apply(rename_tac p) -apply(case_tac "supp p = {}") -apply(simp) -apply(simp add: supp_perm) -apply(drule perm_zero) -apply(simp) -apply(rule_tac x="[]" in exI) -apply(simp add: supp_Nil) -apply(subgoal_tac "\x. x \ supp p") -defer -apply(auto)[1] -apply(erule exE) -apply(drule_tac x="p + (((- p) \ x) \ x)" in spec) -apply(drule mp) -defer -apply(erule exE) -apply(rule_tac x="xs @ [((- p) \ x, x)]" in exI) -apply(simp add: add_perm_apend) -apply(erule conjE) -apply(drule sym) -apply(simp) -apply(simp add: expand_perm_eq) -apply(simp add: supp_append) -apply(simp add: supp_perm supp_Cons supp_Nil supp_Pair supp_atom) -apply(rule conjI) -prefer 2 -apply(auto)[1] -apply (metis left_minus minus_unique permute_atom_def_raw permute_minus_cancel(2)) -defer -apply(rule psubset_card_mono) -apply(simp add: finite_supp) -apply(rule psubsetI) -defer -apply(subgoal_tac "x \ supp (p + (- p \ x \ x))") -apply(blast) -apply(simp add: supp_perm) -defer -apply(auto simp add: supp_perm)[1] -apply(case_tac "x = xa") -apply(simp) -apply(case_tac "((- p) \ x) = xa") -apply(simp) -apply(case_tac "sort_of xa = sort_of x") -apply(simp) -apply(auto)[1] -apply(simp) -apply(simp) -apply(subgoal_tac "{a. p \ (- p \ x \ x) \ a \ a} \ {a. p \ a \ a}") -apply(blast) -apply(auto simp add: supp_perm)[1] -apply(case_tac "x = xa") -apply(simp) -apply(case_tac "((- p) \ x) = xa") -apply(simp) -apply(case_tac "sort_of xa = sort_of x") -apply(simp) -apply(auto)[1] -apply(simp) -apply(simp) -done - -lemma tt0: - fixes p::perm - shows "(supp x) \* p \ \a \ supp p. a \ x" -apply(auto simp add: fresh_star_def supp_perm fresh_def) -done - -lemma uu0: - shows "(\a \ elem_perm xs. a \ x) \ (add_perm xs \ x) = x" -apply(induct xs rule: add_perm.induct) -apply(simp) -apply(simp add: swap_fresh_fresh) -done - -lemma yy0: - fixes xs::"(atom \ atom) list" - shows "supp xs = elem_perm xs" -apply(induct xs rule: elem_perm.induct) -apply(auto simp add: supp_Nil supp_Cons supp_Pair supp_atom) -done - -lemma tt1: - shows "(supp x) \* p \ p \ x = x" -apply(drule tt0) -apply(subgoal_tac "\xs. p = add_perm xs \ supp xs \ supp p") -prefer 2 -apply(rule perm_list_exists) -apply(erule exE) -apply(simp only: yy0) -apply(rule uu0) -apply(auto) -done - - -lemma perm_induct_test: - fixes P :: "perm => bool" - assumes fin: "finite (supp p)" - 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 \ supp p2 = {}; P p1; P p2\ \ P (p1 + p2)" - shows "P p" -using fin -apply(induct F\"supp p" arbitrary: p rule: finite_induct) -apply(simp add: supp_perm) -apply(drule perm_zero) -apply(simp add: zero) -apply(rotate_tac 3) -oops -lemma tt: - "(supp x) \* p \ p \ x = x" -oops - -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 permute_boolI: - fixes P::"bool" - shows "p \ P \ P" -apply(simp add: permute_bool_def) -done - -lemma permute_boolE: - fixes P::"bool" - shows "P \ p \ P" -apply(simp add: permute_bool_def) -done - -lemma fresh_star_eqvt: - shows "(p \ (as \* x)) = (p \ as) \* (p \ x)" -apply(simp add: permute_bool_def) -apply(auto simp add: fresh_star_def) -apply(drule_tac x="(- p) \ xa" in bspec) -apply(rule_tac p="p" in permute_boolI) -apply(simp add: mem_eqvt) -apply(rule_tac p="- p" in permute_boolI) -apply(simp add: fresh_eqvt) -apply(drule_tac x="p \ xa" in bspec) -apply(rule_tac p="- p" in permute_boolI) -apply(simp add: mem_eqvt) -apply(rule_tac p="p" in permute_boolI) -apply(simp add: fresh_eqvt) -done - -lemma kk: - assumes a: "p \ x = y" - shows "\a \ supp x. (p \ a) \ supp y" -using a -apply(auto) -apply(rule_tac p="- p" in permute_boolI) -apply(simp add: mem_eqvt supp_eqvt) -done - -lemma ww: - assumes "a \ supp x" "b \ supp x" "a \ b" "sort_of a = sort_of b" - shows "((a \ b) \ x) \ x" -apply(subgoal_tac "(supp x) supports x") -apply(simp add: supports_def) -using assms -apply - -apply(drule_tac x="a" in spec) -defer -apply(rule supp_supports) -apply(auto) -apply(rotate_tac 1) -apply(drule_tac p="(a \ b)" in permute_boolE) -apply(simp add: mem_eqvt supp_eqvt) -done - -lemma zz: - assumes "p \ x \ p \ y" - shows "x \ y" -using assms -apply(auto) -done - -lemma alpha_abs_sym: - assumes a: "({a}, x) \abs ({b}, y)" - shows "({b}, y) \abs ({a}, x)" -using a -apply(simp) -apply(erule exE) -apply(rule_tac x="- p" in exI) -apply(simp add: alpha_gen) -apply(simp add: fresh_star_def fresh_minus_perm) -apply (metis permute_minus_cancel(2)) -done - -lemma alpha_abs_trans: - assumes a: "({a1}, x1) \abs ({a2}, x2)" - assumes b: "({a2}, x2) \abs ({a3}, x3)" - shows "({a1}, x1) \abs ({a3}, x3)" -using a b -apply(simp) -apply(erule exE)+ -apply(rule_tac x="pa + p" in exI) -apply(simp add: alpha_gen) -apply(simp add: fresh_star_def fresh_plus_perm) -done - -lemma alpha_equal: - assumes a: "({a}, x) \abs ({a}, y)" - shows "(a, x) \abs1 (a, y)" -using a -apply(simp) -apply(erule exE) -apply(simp add: alpha_gen) -apply(erule conjE)+ -apply(case_tac "a \ supp x") -apply(simp) -apply(subgoal_tac "supp x \* p") -apply(drule tt1) -apply(simp) -apply(simp) -apply(simp) -apply(case_tac "a \ supp y") -apply(simp) -apply(drule tt1) -apply(clarify) -apply(simp (no_asm_use)) -apply(simp) -apply(simp) -apply(drule yy) -apply(simp) -apply(simp) -apply(simp) -apply(case_tac "a \ p") -apply(subgoal_tac "supp y \* p") -apply(drule tt1) -apply(clarify) -apply(simp (no_asm_use)) -apply(metis) -apply(auto simp add: fresh_star_def)[1] -apply(frule_tac kk) -apply(drule_tac x="a" in bspec) -apply(simp) -apply(simp add: fresh_def) -apply(simp add: supp_perm) -apply(subgoal_tac "((p \ a) \ p)") -apply(simp add: fresh_def supp_perm) -apply(simp add: fresh_star_def) -done - -lemma alpha_unequal: - assumes a: "({a}, x) \abs ({b}, y)" "sort_of a = sort_of b" "a \ b" - shows "(a, x) \abs1 (b, y)" -using a -apply - -apply(subgoal_tac "a \ supp x - {a}") -apply(subgoal_tac "b \ supp x - {a}") -defer -apply(simp add: alpha_gen) -apply(simp) -apply(drule_tac alpha_abs_swap) -apply(assumption) -apply(simp only: insert_eqvt empty_eqvt swap_atom_simps) -apply(drule alpha_abs_sym) -apply(rotate_tac 4) -apply(drule_tac alpha_abs_trans) -apply(assumption) -apply(drule alpha_equal) -apply(simp) -apply(rule_tac p="(a \ b)" in permute_boolI) -apply(simp add: fresh_eqvt) -apply(simp add: fresh_def) -done - -lemma alpha_new_old: - 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 only: alpha_equal) -apply(drule alpha_unequal) -apply(simp) -apply(simp) -apply(simp) -done - -fun - distinct_perms -where - "distinct_perms [] = True" -| "distinct_perms (p # ps) = (supp p \ supp ps = {} \ distinct_perms ps)" - -(* support of concrete atom sets *) - -lemma atom_eqvt_raw: - fixes p::"perm" - shows "(p \ atom) = atom" -by (simp add: expand_fun_eq permute_fun_def atom_eqvt) - -lemma atom_image_cong: - shows "(atom ` X = atom ` Y) = (X = Y)" -apply(rule inj_image_eq_iff) -apply(simp add: inj_on_def) -done - -lemma supp_atom_image: - fixes as::"'a::at_base set" - shows "supp (atom ` as) = supp as" -apply(simp add: supp_def) -apply(simp add: image_eqvt) -apply(simp add: atom_eqvt_raw) -apply(simp add: atom_image_cong) -done - -lemma swap_atom_image_fresh: "\a \ atom ` (fn :: ('a :: at_base set)); b \ atom ` fn\ \ (a \ b) \ fn = fn" - apply (simp add: fresh_def) - apply (simp add: supp_atom_image) - apply (fold fresh_def) - apply (simp add: swap_fresh_fresh) - done - - -end - diff -r 55b49de0c2c7 -r 04dad9b0136d Nominal/Abs_res.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Nominal/Abs_res.thy Sat Mar 13 13:49:15 2010 +0100 @@ -0,0 +1,723 @@ +theory Abs_res +imports "Nominal2_Atoms" "Nominal2_Eqvt" "Nominal2_Supp" "../Quotient" "../Quotient_Product" +begin + +fun + alpha_gen +where + alpha_gen[simp del]: + "alpha_gen (bs, x) R f pi (cs, y) \ f x - bs = f y - cs \ (f x - bs) \* pi \ R (pi \ x) y" + +notation + alpha_gen ("_ \gen _ _ _ _" [100, 100, 100, 100, 100] 100) + +lemma [mono]: "R1 \ R2 \ alpha_gen x R1 \ alpha_gen x R2" + by (cases x) (auto simp add: le_fun_def le_bool_def alpha_gen.simps) + +lemma alpha_gen_refl: + assumes a: "R x x" + shows "(bs, x) \gen R f 0 (bs, x)" + using a by (simp add: alpha_gen fresh_star_def fresh_zero_perm) + +lemma alpha_gen_sym: + assumes a: "(bs, x) \gen R f p (cs, y)" + and b: "R (p \ x) y \ R (- p \ y) x" + 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 + +lemma alpha_gen_compose_sym: + fixes pi + assumes b: "(aa, t) \gen (\x1 x2. R x1 x2 \ R x2 x1) f pi (ab, s)" + and a: "\pi t s. (R t s \ R (pi \ t) (pi \ s))" + shows "(ab, s) \gen R f (- pi) (aa, t)" + using b apply - + apply(simp add: alpha_gen.simps) + apply(erule conjE)+ + apply(rule conjI) + apply(simp add: fresh_star_def fresh_minus_perm) + apply(subgoal_tac "R (- pi \ s) ((- pi) \ (pi \ t))") + apply simp + apply(rule a) + apply assumption + done + +lemma alpha_gen_compose_trans: + fixes pi pia + assumes b: "(aa, t) \gen (\x1 x2. R x1 x2 \ (\x. R x2 x \ R x1 x)) f pi (ab, ta)" + and c: "(ab, ta) \gen R f pia (ac, sa)" + and a: "\pi t s. (R t s \ R (pi \ t) (pi \ s))" + shows "(aa, t) \gen R f (pia + pi) (ac, sa)" + using b c apply - + apply(simp add: alpha_gen.simps) + apply(erule conjE)+ + apply(simp add: fresh_star_plus) + apply(drule_tac x="- pia \ sa" in spec) + apply(drule mp) + apply(rotate_tac 4) + apply(drule_tac pi="- pia" in a) + apply(simp) + apply(rotate_tac 6) + apply(drule_tac pi="pia" in a) + apply(simp) + done + +lemma alpha_gen_compose_eqvt: + fixes pia + assumes b: "(g d, t) \gen (\x1 x2. R x1 x2 \ R (pi \ x1) (pi \ x2)) f pia (g e, s)" + and c: "\y. pi \ (g y) = g (pi \ y)" + and a: "\x. pi \ (f x) = f (pi \ x)" + shows "(g (pi \ d), pi \ t) \gen R f (pi \ pia) (g (pi \ e), pi \ s)" + using b + apply - + apply(simp add: alpha_gen.simps) + apply(erule conjE)+ + apply(rule conjI) + apply(rule_tac ?p1="- pi" in permute_eq_iff[THEN iffD1]) + apply(simp add: a[symmetric] atom_eqvt Diff_eqvt insert_eqvt set_eqvt empty_eqvt c[symmetric]) + apply(rule conjI) + apply(rule_tac ?p1="- pi" in fresh_star_permute_iff[THEN iffD1]) + apply(simp add: a[symmetric] atom_eqvt Diff_eqvt insert_eqvt set_eqvt empty_eqvt c[symmetric]) + apply(subst permute_eqvt[symmetric]) + apply(simp) + done + +fun + alpha_abs +where + "alpha_abs (bs, x) (cs, y) = (\p. (bs, x) \gen (op=) supp p (cs, y))" + +notation + alpha_abs ("_ \abs _") + +lemma alpha_abs_swap: + assumes a1: "a \ (supp x) - bs" + and a2: "b \ (supp x) - bs" + shows "(bs, x) \abs ((a \ b) \ bs, (a \ b) \ x)" + apply(simp) + apply(rule_tac x="(a \ b)" in exI) + apply(simp add: alpha_gen) + apply(simp add: supp_eqvt[symmetric] Diff_eqvt[symmetric]) + apply(simp add: swap_set_not_in[OF a1 a2]) + apply(subgoal_tac "supp (a \ b) \ {a, b}") + using a1 a2 + apply(simp add: fresh_star_def fresh_def) + apply(blast) + apply(simp add: supp_swap) + done + +lemma alpha_gen_swap_fun: + assumes f_eqvt: "\pi. (pi \ (f x)) = f (pi \ x)" + assumes a1: "a \ (f x) - bs" + and a2: "b \ (f x) - bs" + shows "\pi. (bs, x) \gen (op=) f pi ((a \ b) \ bs, (a \ b) \ x)" + apply(rule_tac x="(a \ b)" in exI) + apply(simp add: alpha_gen) + apply(simp add: f_eqvt[symmetric] Diff_eqvt[symmetric]) + apply(simp add: swap_set_not_in[OF a1 a2]) + apply(subgoal_tac "supp (a \ b) \ {a, b}") + using a1 a2 + apply(simp add: fresh_star_def fresh_def) + apply(blast) + apply(simp add: supp_swap) + done + + +fun + supp_abs_fun +where + "supp_abs_fun (bs, x) = (supp x) - bs" + +lemma supp_abs_fun_lemma: + assumes a: "x \abs y" + shows "supp_abs_fun x = supp_abs_fun y" + using a + apply(induct rule: alpha_abs.induct) + apply(simp add: alpha_gen) + done + +quotient_type 'a abs = "(atom set \ 'a::pt)" / "alpha_abs" + apply(rule equivpI) + unfolding reflp_def symp_def transp_def + apply(simp_all) + (* refl *) + apply(clarify) + apply(rule exI) + apply(rule alpha_gen_refl) + apply(simp) + (* symm *) + apply(clarify) + apply(rule exI) + apply(rule alpha_gen_sym) + apply(assumption) + apply(clarsimp) + (* trans *) + apply(clarify) + apply(rule exI) + apply(rule alpha_gen_trans) + apply(assumption) + apply(assumption) + apply(simp) + done + +quotient_definition + "Abs::atom set \ ('a::pt) \ 'a abs" +is + "Pair::atom set \ ('a::pt) \ (atom set \ 'a)" + +lemma [quot_respect]: + shows "((op =) ===> (op =) ===> alpha_abs) Pair Pair" + apply(clarsimp) + apply(rule exI) + apply(rule alpha_gen_refl) + apply(simp) + done + +lemma [quot_respect]: + shows "((op =) ===> alpha_abs ===> alpha_abs) permute permute" + apply(clarsimp) + apply(rule exI) + apply(rule alpha_gen_eqvt) + apply(assumption) + apply(simp_all add: supp_eqvt) + done + +lemma [quot_respect]: + shows "(alpha_abs ===> (op =)) supp_abs_fun supp_abs_fun" + apply(simp add: supp_abs_fun_lemma) + done + +lemma abs_induct: + "\\as (x::'a::pt). P (Abs as x)\ \ P t" + apply(lifting prod.induct[where 'a="atom set" and 'b="'a"]) + done + +(* TEST case *) +lemmas abs_induct2 = prod.induct[where 'a="atom set" and 'b="'a::pt", quot_lifted] +thm abs_induct abs_induct2 + +instantiation abs :: (pt) pt +begin + +quotient_definition + "permute_abs::perm \ ('a::pt abs) \ 'a abs" +is + "permute:: perm \ (atom set \ 'a::pt) \ (atom set \ 'a::pt)" + +lemma permute_ABS [simp]: + fixes x::"'a::pt" (* ??? has to be 'a \ 'b does not work *) + shows "(p \ (Abs as x)) = Abs (p \ as) (p \ x)" + by (lifting permute_prod.simps(1)[where 'a="atom set" and 'b="'a"]) + +instance + apply(default) + apply(induct_tac [!] x rule: abs_induct) + apply(simp_all) + done + +end + +quotient_definition + "supp_Abs_fun :: ('a::pt) abs \ atom \ bool" +is + "supp_abs_fun" + +lemma supp_Abs_fun_simp: + shows "supp_Abs_fun (Abs bs x) = (supp x) - bs" + by (lifting supp_abs_fun.simps(1)) + +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 + +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: eqvts_raw) + apply(simp) + done + +lemma Abs_swap: + assumes a1: "a \ (supp x) - bs" + and a2: "b \ (supp x) - bs" + shows "(Abs bs x) = (Abs ((a \ b) \ bs) ((a \ b) \ x))" + using a1 a2 by (lifting alpha_abs_swap) + +lemma Abs_supports: + shows "((supp x) - as) supports (Abs as x)" + unfolding supports_def + apply(clarify) + apply(simp (no_asm)) + apply(subst Abs_swap[symmetric]) + apply(simp_all) + done + +lemma supp_Abs_subset1: + fixes x::"'a::fs" + shows "(supp x) - as \ supp (Abs as x)" + apply(simp add: supp_conv_fresh) + apply(auto) + apply(drule_tac supp_Abs_fun_fresh) + apply(simp only: supp_Abs_fun_simp) + apply(simp add: fresh_def) + apply(simp add: supp_finite_atom_set finite_supp) + done + +lemma supp_Abs_subset2: + fixes x::"'a::fs" + shows "supp (Abs as x) \ (supp x) - as" + apply(rule supp_is_subset) + apply(rule Abs_supports) + apply(simp add: finite_supp) + done + +lemma supp_Abs: + fixes x::"'a::fs" + shows "supp (Abs as x) = (supp x) - as" + apply(rule_tac subset_antisym) + apply(rule supp_Abs_subset2) + apply(rule supp_Abs_subset1) + done + +instance abs :: (fs) fs + apply(default) + apply(induct_tac x rule: abs_induct) + apply(simp add: supp_Abs) + apply(simp add: finite_supp) + done + +lemma Abs_fresh_iff: + fixes x::"'a::fs" + 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))" + by (lifting alpha_abs.simps(1)) + + + +(* + below is a construction site for showing that in the + single-binder case, the old and new alpha equivalence + coincide +*) + +fun + alpha1 +where + "alpha1 (a, x) (b, y) \ (a = b \ x = y) \ (a \ b \ x = (a \ b) \ y \ a \ y)" + +notation + alpha1 ("_ \abs1 _") + +fun + alpha2 +where + "alpha2 (a, x) (b, y) \ (\c. c \ (a,b,x,y) \ ((c \ a) \ x) = ((c \ b) \ y))" + +notation + alpha2 ("_ \abs2 _") + +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_old_new: + assumes a: "(a, x) \abs1 (b, y)" "sort_of a = sort_of b" + shows "({a}, x) \abs ({b}, y)" +using a +apply(simp) +apply(erule disjE) +apply(simp) +apply(rule exI) +apply(rule alpha_gen_refl) +apply(simp) +apply(rule_tac x="(a \ b)" in exI) +apply(simp add: alpha_gen) +apply(simp add: fresh_def) +apply(rule conjI) +apply(rule_tac ?p1="(a \ b)" in permute_eq_iff[THEN iffD1]) +apply(rule trans) +apply(simp add: Diff_eqvt supp_eqvt) +apply(subst swap_set_not_in) +back +apply(simp) +apply(simp) +apply(simp add: permute_set_eq) +apply(rule_tac ?p1="(a \ b)" in fresh_star_permute_iff[THEN iffD1]) +apply(simp add: permute_self) +apply(simp add: Diff_eqvt supp_eqvt) +apply(simp add: permute_set_eq) +apply(subgoal_tac "supp (a \ b) \ {a, b}") +apply(simp add: fresh_star_def fresh_def) +apply(blast) +apply(simp add: supp_swap) +done + +lemma perm_zero: + assumes a: "\x::atom. p \ x = x" + shows "p = 0" +using a +by (simp add: expand_perm_eq) + +fun + add_perm +where + "add_perm [] = 0" +| "add_perm ((a, b) # xs) = (a \ b) + add_perm xs" + +fun + elem_perm +where + "elem_perm [] = {}" +| "elem_perm ((a, b) # xs) = {a, b} \ elem_perm xs" + + +lemma add_perm_apend: + shows "add_perm (xs @ ys) = add_perm xs + add_perm ys" +apply(induct xs arbitrary: ys) +apply(auto simp add: add_assoc) +done + +lemma perm_list_exists: + fixes p::perm + shows "\xs. p = add_perm xs \ supp xs \ supp p" +apply(induct p taking: "\p::perm. card (supp p)" rule: measure_induct) +apply(rename_tac p) +apply(case_tac "supp p = {}") +apply(simp) +apply(simp add: supp_perm) +apply(drule perm_zero) +apply(simp) +apply(rule_tac x="[]" in exI) +apply(simp add: supp_Nil) +apply(subgoal_tac "\x. x \ supp p") +defer +apply(auto)[1] +apply(erule exE) +apply(drule_tac x="p + (((- p) \ x) \ x)" in spec) +apply(drule mp) +defer +apply(erule exE) +apply(rule_tac x="xs @ [((- p) \ x, x)]" in exI) +apply(simp add: add_perm_apend) +apply(erule conjE) +apply(drule sym) +apply(simp) +apply(simp add: expand_perm_eq) +apply(simp add: supp_append) +apply(simp add: supp_perm supp_Cons supp_Nil supp_Pair supp_atom) +apply(rule conjI) +prefer 2 +apply(auto)[1] +apply (metis left_minus minus_unique permute_atom_def_raw permute_minus_cancel(2)) +defer +apply(rule psubset_card_mono) +apply(simp add: finite_supp) +apply(rule psubsetI) +defer +apply(subgoal_tac "x \ supp (p + (- p \ x \ x))") +apply(blast) +apply(simp add: supp_perm) +defer +apply(auto simp add: supp_perm)[1] +apply(case_tac "x = xa") +apply(simp) +apply(case_tac "((- p) \ x) = xa") +apply(simp) +apply(case_tac "sort_of xa = sort_of x") +apply(simp) +apply(auto)[1] +apply(simp) +apply(simp) +apply(subgoal_tac "{a. p \ (- p \ x \ x) \ a \ a} \ {a. p \ a \ a}") +apply(blast) +apply(auto simp add: supp_perm)[1] +apply(case_tac "x = xa") +apply(simp) +apply(case_tac "((- p) \ x) = xa") +apply(simp) +apply(case_tac "sort_of xa = sort_of x") +apply(simp) +apply(auto)[1] +apply(simp) +apply(simp) +done + +lemma tt0: + fixes p::perm + shows "(supp x) \* p \ \a \ supp p. a \ x" +apply(auto simp add: fresh_star_def supp_perm fresh_def) +done + +lemma uu0: + shows "(\a \ elem_perm xs. a \ x) \ (add_perm xs \ x) = x" +apply(induct xs rule: add_perm.induct) +apply(simp) +apply(simp add: swap_fresh_fresh) +done + +lemma yy0: + fixes xs::"(atom \ atom) list" + shows "supp xs = elem_perm xs" +apply(induct xs rule: elem_perm.induct) +apply(auto simp add: supp_Nil supp_Cons supp_Pair supp_atom) +done + +lemma tt1: + shows "(supp x) \* p \ p \ x = x" +apply(drule tt0) +apply(subgoal_tac "\xs. p = add_perm xs \ supp xs \ supp p") +prefer 2 +apply(rule perm_list_exists) +apply(erule exE) +apply(simp only: yy0) +apply(rule uu0) +apply(auto) +done + + +lemma perm_induct_test: + fixes P :: "perm => bool" + assumes fin: "finite (supp p)" + 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 \ supp p2 = {}; P p1; P p2\ \ P (p1 + p2)" + shows "P p" +using fin +apply(induct F\"supp p" arbitrary: p rule: finite_induct) +apply(simp add: supp_perm) +apply(drule perm_zero) +apply(simp add: zero) +apply(rotate_tac 3) +oops +lemma tt: + "(supp x) \* p \ p \ x = x" +oops + +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 permute_boolI: + fixes P::"bool" + shows "p \ P \ P" +apply(simp add: permute_bool_def) +done + +lemma permute_boolE: + fixes P::"bool" + shows "P \ p \ P" +apply(simp add: permute_bool_def) +done + +lemma kk: + assumes a: "p \ x = y" + shows "\a \ supp x. (p \ a) \ supp y" +using a +apply(auto) +apply(rule_tac p="- p" in permute_boolI) +apply(simp add: mem_eqvt supp_eqvt) +done + +lemma ww: + assumes "a \ supp x" "b \ supp x" "a \ b" "sort_of a = sort_of b" + shows "((a \ b) \ x) \ x" +apply(subgoal_tac "(supp x) supports x") +apply(simp add: supports_def) +using assms +apply - +apply(drule_tac x="a" in spec) +defer +apply(rule supp_supports) +apply(auto) +apply(rotate_tac 1) +apply(drule_tac p="(a \ b)" in permute_boolE) +apply(simp add: mem_eqvt supp_eqvt) +done + +lemma alpha_abs_sym: + assumes a: "({a}, x) \abs ({b}, y)" + shows "({b}, y) \abs ({a}, x)" +using a +apply(simp) +apply(erule exE) +apply(rule_tac x="- p" in exI) +apply(simp add: alpha_gen) +apply(simp add: fresh_star_def fresh_minus_perm) +apply (metis permute_minus_cancel(2)) +done + +lemma alpha_abs_trans: + assumes a: "({a1}, x1) \abs ({a2}, x2)" + assumes b: "({a2}, x2) \abs ({a3}, x3)" + shows "({a1}, x1) \abs ({a3}, x3)" +using a b +apply(simp) +apply(erule exE)+ +apply(rule_tac x="pa + p" in exI) +apply(simp add: alpha_gen) +apply(simp add: fresh_star_def fresh_plus_perm) +done + +lemma alpha_equal: + assumes a: "({a}, x) \abs ({a}, y)" + shows "(a, x) \abs1 (a, y)" +using a +apply(simp) +apply(erule exE) +apply(simp add: alpha_gen) +apply(erule conjE)+ +apply(case_tac "a \ supp x") +apply(simp) +apply(subgoal_tac "supp x \* p") +apply(drule tt1) +apply(simp) +apply(simp) +apply(simp) +apply(case_tac "a \ supp y") +apply(simp) +apply(drule tt1) +apply(clarify) +apply(simp (no_asm_use)) +apply(simp) +apply(simp) +apply(drule yy) +apply(simp) +apply(simp) +apply(simp) +apply(case_tac "a \ p") +apply(subgoal_tac "supp y \* p") +apply(drule tt1) +apply(clarify) +apply(simp (no_asm_use)) +apply(metis) +apply(auto simp add: fresh_star_def)[1] +apply(frule_tac kk) +apply(drule_tac x="a" in bspec) +apply(simp) +apply(simp add: fresh_def) +apply(simp add: supp_perm) +apply(subgoal_tac "((p \ a) \ p)") +apply(simp add: fresh_def supp_perm) +apply(simp add: fresh_star_def) +done + +lemma alpha_unequal: + assumes a: "({a}, x) \abs ({b}, y)" "sort_of a = sort_of b" "a \ b" + shows "(a, x) \abs1 (b, y)" +using a +apply - +apply(subgoal_tac "a \ supp x - {a}") +apply(subgoal_tac "b \ supp x - {a}") +defer +apply(simp add: alpha_gen) +apply(simp) +apply(drule_tac alpha_abs_swap) +apply(assumption) +apply(simp only: insert_eqvt empty_eqvt swap_atom_simps) +apply(drule alpha_abs_sym) +apply(rotate_tac 4) +apply(drule_tac alpha_abs_trans) +apply(assumption) +apply(drule alpha_equal) +apply(simp) +apply(rule_tac p="(a \ b)" in permute_boolI) +apply(simp add: fresh_eqvt) +apply(simp add: fresh_def) +done + +lemma alpha_new_old: + 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 only: alpha_equal) +apply(drule alpha_unequal) +apply(simp) +apply(simp) +apply(simp) +done + +fun + distinct_perms +where + "distinct_perms [] = True" +| "distinct_perms (p # ps) = (supp p \ supp ps = {} \ distinct_perms ps)" + +(* support of concrete atom sets *) + +lemma atom_eqvt_raw: + fixes p::"perm" + shows "(p \ atom) = atom" +by (simp add: expand_fun_eq permute_fun_def atom_eqvt) + +lemma atom_image_cong: + shows "(atom ` X = atom ` Y) = (X = Y)" +apply(rule inj_image_eq_iff) +apply(simp add: inj_on_def) +done + +lemma supp_atom_image: + fixes as::"'a::at_base set" + shows "supp (atom ` as) = supp as" +apply(simp add: supp_def) +apply(simp add: image_eqvt) +apply(simp add: atom_eqvt_raw) +apply(simp add: atom_image_cong) +done + +lemma swap_atom_image_fresh: "\a \ atom ` (fn :: ('a :: at_base set)); b \ atom ` fn\ \ (a \ b) \ fn = fn" + apply (simp add: fresh_def) + apply (simp add: supp_atom_image) + apply (fold fresh_def) + apply (simp add: swap_fresh_fresh) + done + + +end + diff -r 55b49de0c2c7 -r 04dad9b0136d Nominal/Nominal2_Supp.thy --- a/Nominal/Nominal2_Supp.thy Fri Mar 12 17:42:31 2010 +0100 +++ b/Nominal/Nominal2_Supp.thy Sat Mar 13 13:49:15 2010 +0100 @@ -57,6 +57,25 @@ shows "(a \* (x, y) \ PROP C) \ (a \* x \ a \* y \ PROP C)" by (rule, simp_all add: fresh_star_prod) +lemma fresh_star_plus: + fixes p q::perm + shows "\a \* p; a \* q\ \ a \* (p + q)" + unfolding fresh_star_def + by (simp add: fresh_plus_perm) + +lemma fresh_star_permute_iff: + shows "(p \ a) \* (p \ x) \ a \* x" + unfolding fresh_star_def + by (metis mem_permute_iff permute_minus_cancel fresh_permute_iff) + +lemma fresh_star_eqvt: + shows "(p \ (as \* x)) = (p \ as) \* (p \ x)" +unfolding fresh_star_def +unfolding Ball_def +apply(simp add: all_eqvt) +apply(subst permute_fun_def) +apply(simp add: imp_eqvt fresh_eqvt mem_eqvt) +done section {* Avoiding of atom sets *} diff -r 55b49de0c2c7 -r 04dad9b0136d Nominal/Parser.thy --- a/Nominal/Parser.thy Fri Mar 12 17:42:31 2010 +0100 +++ b/Nominal/Parser.thy Sat Mar 13 13:49:15 2010 +0100 @@ -502,6 +502,10 @@ *} ML {* +val recursive = ref false +*} + +ML {* fun prepare_binds dt_strs lthy = let fun extract_annos_binds dt_strs = @@ -510,7 +514,7 @@ fun prep_bn env bn_str = case (Syntax.read_term lthy bn_str) of Free (x, _) => (NONE, env_lookup env x) - | Const (a, T) $ Free (x, _) => (SOME (Const (a, T), true), env_lookup env x) + | Const (a, T) $ Free (x, _) => (SOME (Const (a, T), !recursive), env_lookup env x) | _ => error (bn_str ^ " not allowed as binding specification."); fun prep_typ env (i, opt_name) = diff -r 55b49de0c2c7 -r 04dad9b0136d Nominal/Term1.thy --- a/Nominal/Term1.thy Fri Mar 12 17:42:31 2010 +0100 +++ b/Nominal/Term1.thy Sat Mar 13 13:49:15 2010 +0100 @@ -262,6 +262,8 @@ apply (simp add: atom_eqvt[symmetric]) sorry +thm trm1_bp_inducts + lemma supp_fv: "supp t = fv_trm1 t" "supp b = fv_bp b" @@ -280,9 +282,7 @@ apply(simp add: supp_eqvt[symmetric] fv_trm1_eqvt[symmetric]) defer apply(simp (no_asm) add: supp_def permute_set_eq atom_eqvt) -apply(simp (no_asm) add: supp_def eqvts) -apply(fold supp_def) -apply(simp add: supp_at_base) +apply(simp only: supp_at_base[simplified supp_def]) apply(simp (no_asm) add: supp_def Collect_imp_eq Collect_neg_eq) apply(simp add: Collect_imp_eq[symmetric] Collect_neg_eq[symmetric] supp_def[symmetric]) (*apply(rule supp_fv_let) apply(simp_all)*) @@ -300,8 +300,6 @@ apply(simp only: ex_out) apply(simp only: Collect_neg_conj finite_Un Diff_cancel) apply(simp) -apply(simp add: Collect_imp_eq) -apply(simp add: Collect_neg_eq[symmetric] fresh_star_def) apply(fold supp_def) sorry diff -r 55b49de0c2c7 -r 04dad9b0136d Nominal/Test.thy --- a/Nominal/Test.thy Fri Mar 12 17:42:31 2010 +0100 +++ b/Nominal/Test.thy Sat Mar 13 13:49:15 2010 +0100 @@ -26,11 +26,61 @@ ML {* Sign.of_sort @{theory} (@{typ lam}, @{sort fs}) *} term "supp (x :: lam)" +lemmas lam_bp_inducts = lam_raw_bp_raw.inducts[quot_lifted] -(* compat should be -compat (BP x t) pi (BP x' t') - \ alpha_trm t t' \ pi o x = x' -*) +lemma infinite_Un: + shows "infinite (S \ T) \ infinite S \ infinite T" +apply(auto) +done + +lemma bi_eqvt: + shows "(p \ (bi b)) = bi (p \ b)" +sorry + +lemma supp_fv: + "supp t = fv_lam t" and + "supp b = fv_bp b" +apply(induct t and b rule: lam_bp_inducts) +apply(simp_all add: lam_bp_fv) +(* VAR case *) +apply(simp only: supp_def) +apply(simp only: lam_bp_perm) +apply(simp only: lam_bp_inject) +apply(simp only: supp_def[symmetric]) +apply(simp only: supp_at_base) +(* APP case *) +apply(simp only: supp_def) +apply(simp only: lam_bp_perm) +apply(simp only: lam_bp_inject) +apply(simp only: de_Morgan_conj) +apply(simp only: Collect_disj_eq) +apply(simp only: infinite_Un) +apply(simp only: Collect_disj_eq) +(* LET case *) +defer +(* BP case *) +apply(simp only: supp_def) +apply(simp only: lam_bp_perm) +apply(simp only: lam_bp_inject) +apply(simp only: de_Morgan_conj) +apply(simp only: Collect_disj_eq) +apply(simp only: infinite_Un) +apply(simp only: Collect_disj_eq) +apply(simp only: supp_def[symmetric]) +apply(simp only: supp_at_base) +apply(simp) +(* LET case *) +apply(simp only: supp_def) +apply(simp only: lam_bp_perm) +apply(simp only: lam_bp_inject) +apply(simp only: alpha_gen) + +thm alpha_gen +thm lam_bp_fv +thm lam_bp_inject +oops + + text {* example 2 *}