# HG changeset patch # User Christian Urban # Date 1264690055 -3600 # Node ID 8e2dd0b29466e71186bed631897182e8ae029da6 # Parent 31b4ac97cfea3ac03d037aad0b9b859922264b38 attempt of a general abstraction operator diff -r 31b4ac97cfea -r 8e2dd0b29466 Quot/Nominal/Abs.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Quot/Nominal/Abs.thy Thu Jan 28 15:47:35 2010 +0100 @@ -0,0 +1,191 @@ +theory LamEx +imports "Nominal2_Atoms" "Nominal2_Eqvt" "Nominal2_Supp" "../QuotMain" +begin + +datatype 'a ABS_raw = Abs_raw "atom list" "'a::pt" + +primrec + Abs_raw_map +where + "Abs_raw_map f (Abs_raw as x) = Abs_raw as (f x)" + +fun + Abs_raw_rel +where + "Abs_raw_rel R (Abs_raw as x) (Abs_raw bs y) = R x y" + +declare [[map "ABS_raw" = (Abs_raw_map, Abs_raw_rel)]] + +instantiation ABS_raw :: (pt) pt +begin + +primrec + permute_ABS_raw +where + "permute_ABS_raw p (Abs_raw as x) = Abs_raw (p \ as) (p \ x)" + +instance +apply(default) +apply(case_tac [!] x) +apply(simp_all) +done + +end + +inductive + alpha_abs :: "('a::pt) ABS_raw \ 'a ABS_raw \ bool" +where + "\\pi. (supp x) - (set as) = (supp y) - (set bs) \ ((supp x) - (set as)) \* pi \ pi \ x = y\ + \ alpha_abs (Abs_raw as x) (Abs_raw bs y)" + + +lemma Abs_raw_eq1: + assumes "alpha_abs (Abs_raw bs x) (Abs_raw bs y)" + shows "x = y" +using assms +apply(erule_tac alpha_abs.cases) +apply(auto) +apply(drule sym) +apply(simp) +sorry + + +quotient_type 'a ABS = "('a::pt) ABS_raw" / "alpha_abs::('a::pt) ABS_raw \ 'a ABS_raw \ bool" + sorry + +quotient_definition + "Abs::atom list \ ('a::pt) \ 'a ABS" +as + "Abs_raw" + +lemma [quot_respect]: + shows "((op =) ===> (op =) ===> alpha_abs) Abs_raw Abs_raw" +apply(auto) +apply(rule alpha_abs.intros) +apply(rule_tac x="0" in exI) +apply(simp add: fresh_star_def fresh_zero_perm) +done + +lemma [quot_respect]: + shows "((op =) ===> alpha_abs ===> alpha_abs) permute permute" +apply(auto) +sorry + +lemma ABS_induct: + "\\as (x::'a::pt). P (Abs as x)\ \ P t" +apply(lifting ABS_raw.induct) +done + +lemma Abs_eq1: + assumes "(Abs bs x) = (Abs bs y)" + shows "x = y" +using assms +apply(lifting Abs_raw_eq1) +done + + +instantiation ABS :: (pt) pt +begin + +quotient_definition + "permute_ABS::perm \ ('a::pt ABS) \ 'a ABS" +as + "permute::perm \ ('a::pt ABS_raw) \ 'a ABS_raw" + +lemma permute_ABS [simp]: + fixes x::"'b::pt" (* ??? has to be 'b \ 'a doe not work *) + shows "(p \ (Abs as x)) = Abs (p \ as) (p \ x)" +apply(lifting permute_ABS_raw.simps(1)) +done + +instance + apply(default) + apply(induct_tac [!] x rule: ABS_induct) + apply(simp_all) + done + +end + +lemma Abs_supports: + shows "(supp (as, x)) supports (Abs as x) " +unfolding supports_def +unfolding fresh_def[symmetric] +apply(simp add: fresh_Pair swap_fresh_fresh) +done + +instance ABS :: (fs) fs +apply(default) +apply(induct_tac x rule: ABS_induct) +thm supports_finite +apply(rule supports_finite) +apply(rule Abs_supports) +apply(simp add: supp_Pair finite_supp) +done + +lemma Abs_fresh1: + fixes x::"'a::fs" + assumes a1: "a \ bs" + and a2: "a \ x" + shows "a \ Abs bs x" +proof - + obtain c where + fr: "c \ bs" "c \ x" "c \ Abs bs x" "sort_of c = sort_of a" + apply(rule_tac X="supp (bs, x, Abs bs x)" in obtain_atom) + unfolding fresh_def[symmetric] + apply(auto simp add: supp_Pair finite_supp fresh_Pair fresh_atom) + done + have "(c \ a) \ (Abs bs x) = Abs bs x" using a1 a2 fr(1) fr(2) + by (simp add: swap_fresh_fresh) + moreover from fr(3) + have "((c \ a) \ c) \ ((c \ a) \(Abs bs x))" + by (simp only: fresh_permute_iff) + ultimately show "a \ Abs bs x" using fr(4) + by simp +qed + +lemma Abs_fresh2: + fixes x :: "'a::fs" + assumes a1: "a \ Abs bs x" + and a2: "a \ bs" + shows "a \ x" +proof - + obtain c where + fr: "c \ bs" "c \ x" "c \ Abs bs x" "sort_of c = sort_of a" + apply(rule_tac X="supp (bs, x, Abs bs x)" in obtain_atom) + unfolding fresh_def[symmetric] + apply(auto simp add: supp_Pair finite_supp fresh_Pair fresh_atom) + done + have "Abs bs x = (c \ a) \ (Abs bs x)" using a1 fr(3) + by (simp only: swap_fresh_fresh) + also have "\ = Abs bs ((c \ a) \ x)" using a2 fr(1) + by (simp add: swap_fresh_fresh) + ultimately have "Abs bs x = Abs bs ((c \ a) \ x)" by simp + then have "x = (c \ a) \ x" by (rule Abs_eq1) + moreover from fr(2) + have "((c \ a) \ c) \ ((c \ a) \ x)" + by (simp only: fresh_permute_iff) + ultimately show "a \ x" using fr(4) + by simp +qed + +lemma Abs_fresh3: + fixes x :: "'a::fs" + assumes "a \ set bs" + shows "a \ Abs bs x" +proof - + obtain c where + fr: "c \ a" "c \ x" "c \ Abs bs x" "sort_of c = sort_of a" + apply(rule_tac X="supp (a, x, Abs bs x)" in obtain_atom) + unfolding fresh_def[symmetric] + apply(auto simp add: supp_Pair finite_supp fresh_Pair fresh_atom) + done + from fr(3) have "((c \ a) \ c) \ ((c \ a) \ Abs bs x)" + by (simp only: fresh_permute_iff) + moreover + have "((c \ a) \ Abs bs x) = Abs bs x" using assms fr(1) fr(2) sorry + ultimately + show "a \ Abs bs x" using fr(4) by simp +qed + +done + diff -r 31b4ac97cfea -r 8e2dd0b29466 Quot/Nominal/LamEx.thy --- a/Quot/Nominal/LamEx.thy Thu Jan 28 14:20:26 2010 +0100 +++ b/Quot/Nominal/LamEx.thy Thu Jan 28 15:47:35 2010 +0100 @@ -47,7 +47,18 @@ unfolding fresh_star_def by (simp add: fresh_plus) - +lemma supp_finite_set: + fixes S::"atom set" + assumes "finite S" + shows "supp S = S" + apply(rule finite_supp_unique) + apply(simp add: supports_def) + apply(auto simp add: permute_set_eq swap_atom)[1] + apply(metis) + apply(rule assms) + apply(auto simp add: permute_set_eq swap_atom)[1] +done + atom_decl name @@ -244,9 +255,30 @@ inductive alpha2 :: "rlam \ rlam \ bool" ("_ \2 _" [100, 100] 100) where - a1: "a = b \ (rVar a) \2 (rVar b)" -| a2: "\t1 \2 t2; s1 \2 s2\ \ rApp t1 s1 \2 rApp t2 s2" -| a3: "(a = b \ t \2 s) \ (a \ b \ ((a \ b) \ t) \2 s \ atom b \ rfv t)\ rLam a t \2 rLam b s" + a21: "a = b \ (rVar a) \2 (rVar b)" +| a22: "\t1 \2 t2; s1 \2 s2\ \ rApp t1 s1 \2 rApp t2 s2" +| a23: "(a = b \ t \2 s) \ (a \ b \ ((a \ b) \ t) \2 s \ atom b \ rfv t)\ rLam a t \2 rLam b s" + +lemma fv_vars: + fixes a::name + assumes a1: "\x \ rfv t - {atom a}. pi \ x = x" + shows "(pi \ t) \2 ((a \ (pi \ a)) \ t)" +using a1 +apply(induct t) +apply(auto) +apply(rule a21) +apply(case_tac "name = a") +apply(simp) +apply(simp) +defer +apply(rule a22) +apply(simp) +apply(simp) +apply(rule a23) +apply(case_tac "a = name") +apply(simp) +oops + lemma assumes a1: "t \2 s" @@ -272,9 +304,11 @@ apply(drule alpha_rfv) apply(drule sym) apply(simp) +apply(simp add: rfv_eqvt[symmetric]) defer apply(subgoal_tac "atom a \ (rfv t - {atom a})") apply(subgoal_tac "atom b \ (rfv t - {atom a})") + defer sorry @@ -300,6 +334,7 @@ apply(simp) defer apply(simp) +apply(simp add: fresh_star_def) sorry quotient_type lam = rlam / alpha