# HG changeset patch # User Christian Urban # Date 1295344977 -3600 # Node ID 1d1772a89026d33f28effe3b6c19f319704aa3f2 # Parent 92c001d932258402bdd0b8cb3f9853a02407ab43 the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions diff -r 92c001d93225 -r 1d1772a89026 Nominal/Ex/Lambda.thy --- a/Nominal/Ex/Lambda.thy Tue Jan 18 06:55:18 2011 +0100 +++ b/Nominal/Ex/Lambda.thy Tue Jan 18 11:02:57 2011 +0100 @@ -102,6 +102,58 @@ apply(simp_all add: lam.supp supp_at_base) done +nominal_datatype ln = + LNBnd nat +| LNVar name +| LNApp ln ln +| LNLam ln + +fun + lookup :: "name list \ nat \ name \ ln" +where + "lookup [] n x = LNVar x" +| "lookup (y # ys) n x = (if x = y then LNBnd n else (lookup ys (n + 1) x))" + +lemma [eqvt]: + shows "(p \ lookup xs n x) = lookup (p \ xs) (p \ n) (p \ x)" +apply(induct xs arbitrary: n) +apply(simp_all add: permute_pure) +done + +nominal_primrec + trans :: "lam \ name list \ ln" +where + "trans (Var x) xs = lookup xs 0 x" +| "trans (App t1 t2) xs = LNApp (trans t1 xs) (trans t2 xs)" +| "atom x \ xs \ trans (Lam x t) xs = LNLam (trans t (x # xs))" +apply(case_tac x) +apply(simp) +apply(rule_tac y="a" and c="b" in lam.strong_exhaust) +apply(simp_all)[3] +apply(blast) +apply(blast) +apply(simp add: fresh_star_def) +apply(simp_all add: lam.distinct) +apply(simp add: lam.eq_iff) +apply(simp add: lam.eq_iff) +apply(simp add: lam.eq_iff) +apply(simp add: Abs_eq_iff) +apply(erule conjE) +apply(erule exE) +apply(simp add: alphas) +apply(simp add: atom_eqvt) +apply(clarify) +apply(rule trans) +apply(rule_tac p="p" in supp_perm_eq[symmetric]) +apply(simp (no_asm) add: ln.supp) +apply(drule supp_eqvt_at) +apply(simp add: finite_supp) +oops + + + + + nominal_datatype db = DBVar nat | DBApp db db @@ -112,7 +164,6 @@ where "c \= f \ case c of None => None | (Some v) => f v" - lemma mbind_eqvt: fixes c::"'a::pt option" shows "(p \ (c \= f)) = ((p \ c) \= (p \ f))" diff -r 92c001d93225 -r 1d1772a89026 Nominal/Nominal2_Abs.thy --- a/Nominal/Nominal2_Abs.thy Tue Jan 18 06:55:18 2011 +0100 +++ b/Nominal/Nominal2_Abs.thy Tue Jan 18 11:02:57 2011 +0100 @@ -342,6 +342,41 @@ by (auto dest: disjoint_right_eq) qed +lemma alpha_abs_res_stronger1: + fixes x::"'a::fs" + assumes asm: "(as, x) \res (op =) supp p' (as', x')" + shows "\p. (as, x) \res (op =) supp p (as', x') \ supp p \ (supp x \ as) \ (supp x' \ as')" +proof - + from asm have 0: "(supp x - as) \* p'" by (auto simp only: alphas) + then have #: "p' \ (supp x - as) = (supp x - as)" + by (simp add: atom_set_perm_eq) + have "finite (supp x)" by (simp add: finite_supp) + then obtain p where *: "\b \ supp x. p \ b = p' \ b" and **: "supp p \ supp x \ p' \ supp x" + using set_renaming_perm by blast + from * have a: "p \ x = p' \ x" using supp_perm_perm_eq by auto + from 0 have 1: "(supp x - as) \* p" using * + by (auto simp add: fresh_star_def fresh_perm) + then have 2: "(supp x - as) \ supp p = {}" + by (auto simp add: fresh_star_def fresh_def) + have b: "supp x = (supp x - as) \ (supp x \ as)" by auto + have "supp p \ supp x \ p' \ supp x" using ** by simp + also have "\ = (supp x - as) \ (supp x \ as) \ (p' \ ((supp x - as) \ (supp x \ as)))" + using b by simp + also have "\ = (supp x - as) \ (supp x \ as) \ ((p' \ (supp x - as)) \ (p' \ (supp x \ as)))" + by (simp add: union_eqvt) + also have "\ = (supp x - as) \ (supp x \ as) \ (p' \ (supp x \ as))" + using # by auto + also have "\ = (supp x - as) \ (supp x \ as) \ (supp x' \ as')" using asm + by (simp add: supp_property_res) + finally have "supp p \ (supp x - as) \ (supp x \ as) \ (supp x' \ as')" . + then + have "supp p \ (supp x \ as) \ (supp x' \ as')" using 2 by auto + moreover + have "(as, x) \res (op =) supp p (as', x')" using asm 1 a by (simp add: alphas) + ultimately + show "\p. (as, x) \res (op =) supp p (as', x') \ supp p \ (supp x \ as) \ (supp x' \ as')" by blast +qed + section {* Quotient types *} diff -r 92c001d93225 -r 1d1772a89026 Nominal/Nominal2_Base.thy --- a/Nominal/Nominal2_Base.thy Tue Jan 18 06:55:18 2011 +0100 +++ b/Nominal/Nominal2_Base.thy Tue Jan 18 11:02:57 2011 +0100 @@ -518,6 +518,18 @@ unfolding permute_set_eq using a by (auto simp add: swap_atom) +lemma swap_set_in_eq: + assumes a: "a \ S" "b \ S" "sort_of a = sort_of b" + shows "(a \ b) \ S = (S - {a}) \ {b}" + unfolding permute_set_eq + using a by (auto simp add: swap_atom) + +lemma swap_set_both_in: + assumes a: "a \ S" "b \ S" + shows "(a \ b) \ S = S" + unfolding permute_set_eq + using a by (auto simp add: swap_atom) + lemma mem_permute_iff: shows "(p \ x) \ (p \ X) \ x \ X" unfolding mem_def permute_fun_def permute_bool_def @@ -1717,7 +1729,7 @@ by (rule_tac S="supp p" in perm_struct_induct) (auto intro: zero swap) -lemma perm_subset_induct[consumes 1, case_names zero swap plus]: +lemma perm_struct_induct2[consumes 1, case_names zero swap plus]: assumes S: "supp p \ S" assumes zero: "P 0" assumes swap: "\a b. \sort_of a = sort_of b; a \ b; a \ S; b \ S\ \ P (a \ b)" @@ -1727,6 +1739,14 @@ by (induct p rule: perm_struct_induct) (auto intro: zero plus swap simp add: supp_swap) +lemma perm_simple_struct_induct2[case_names zero swap plus]: + assumes zero: "P 0" + assumes swap: "\a b. \sort_of a = sort_of b; a \ b\ \ P (a \ b)" + assumes plus: "\p1 p2. \P p1; P p2\ \ P (p1 + p2)" + shows "P p" +by (rule_tac S="supp p" in perm_struct_induct2) + (auto intro: zero swap plus) + lemma supp_perm_eq: assumes "(supp x) \* p" shows "p \ x = x" @@ -1751,7 +1771,7 @@ from assms have "supp p \ {a. a \ x}" unfolding supp_perm fresh_star_def fresh_def by auto then show "p \ x = x" - proof (induct p rule: perm_subset_induct) + proof (induct p rule: perm_struct_induct2) case zero show "0 \ x = x" by simp next @@ -1925,7 +1945,6 @@ section {* Renaming permutations *} - lemma set_renaming_perm: assumes b: "finite bs" shows "\q. (\b \ bs. q \ b = p \ b) \ supp q \ bs \ (p \ bs)"