# HG changeset patch # User urbanc # Date 1141310602 -3600 # Node ID ad36a9b42cf39ef21d56363eed2d7680dd1871de # Parent 17b952ec56414a6bff0f097d228a608d4db82cee made some small changes to generate nicer latex-output diff -r 17b952ec5641 -r ad36a9b42cf3 src/HOL/Nominal/Examples/CR.thy --- a/src/HOL/Nominal/Examples/CR.thy Thu Mar 02 15:05:09 2006 +0100 +++ b/src/HOL/Nominal/Examples/CR.thy Thu Mar 02 15:43:22 2006 +0100 @@ -29,11 +29,10 @@ qed lemma forget_automatic: - assumes a: "a\t1" - shows "t1[a::=t2] = t1" - using a - by (nominal_induct t1 avoiding: a t2 rule: lam.induct) - (auto simp add: abs_fresh fresh_atm) + assumes asm: "a\t\<^isub>1" + shows "t\<^isub>1[a::=t\<^isub>2] = t\<^isub>1" + using asm by (nominal_induct t\<^isub>1 avoiding: a t\<^isub>2 rule: lam.induct) + (auto simp add: abs_fresh fresh_atm) lemma fresh_fact: fixes a :: "name" @@ -60,13 +59,10 @@ lemma fresh_fact_automatic: fixes a::"name" - assumes a: "a\t1" - and b: "a\t2" - shows "a\(t1[b::=t2])" -using a b -by (nominal_induct t1 avoiding: a b t2 rule: lam.induct) - (auto simp add: abs_fresh fresh_atm) - + assumes asm: "a\t\<^isub>1" "a\t\<^isub>2" + shows "a\(t\<^isub>1[b::=t\<^isub>2])" +using asm by (nominal_induct t\<^isub>1 avoiding: a b t\<^isub>2 rule: lam.induct) + (auto simp add: abs_fresh fresh_atm) lemma subs_lemma: fixes x::"name" @@ -109,7 +105,7 @@ qed next case (Lam z M1) (* case 2: lambdas *) - have ih: "\x y N L. x\y \ x\L \ M1[x::=N][y::=L] = M1[y::=L][x::=N[y::=L]]" by fact + have ih: "\x y N L. \x\y; x\L\ \ M1[x::=N][y::=L] = M1[y::=L][x::=N[y::=L]]" by fact have "x\y" by fact have "x\L" by fact have "z\x" "z\y" "z\N" "z\L" by fact @@ -128,12 +124,10 @@ qed lemma subs_lemma_automatic: - assumes a: "x\y" - and b: "x\L" + assumes asm: "x\y" "x\L" shows "M[x::=N][y::=L] = M[y::=L][x::=N[y::=L]]" -using a b -by (nominal_induct M avoiding: x y N L rule: lam.induct) - (auto simp add: fresh_fact forget) +using asm by (nominal_induct M avoiding: x y N L rule: lam.induct) + (auto simp add: fresh_fact forget) lemma subst_rename: assumes a: "c\t1" @@ -255,6 +249,79 @@ thus ?thesis by simp qed +lemma beta_induct_aux: + fixes P :: "'a::fs_name\lam \ lam \bool" + and t :: "lam" + and s :: "lam" + and x :: "'a::fs_name" + assumes a: "t\\<^isub>\s" + and a1: "\t s1 s2 x. s1\\<^isub>\s2 \ (\z. P z s1 s2) \ P x (App s1 t) (App s2 t)" + and a2: "\t s1 s2 x. s1\\<^isub>\s2 \ (\z. P z s1 s2) \ P x (App t s1) (App t s2)" + and a3: "\a s1 s2 x. a\x \ s1\\<^isub>\s2 \ (\z. P z s1 s2) \ P x (Lam [a].s1) (Lam [a].s2)" + and a4: "\a t1 s1 x. a\(x,s1) \ P x (App (Lam [a].t1) s1) (t1[a::=s1])" + and eq: "\(pi::name prm) x t s. P x t s \ P (pi\x) (pi\t) (pi\s)" + shows "P x t s" +using a +proof (induct fixing: x) + case b1 thus ?case using a1 by blast + next + case b2 thus ?case using a2 by blast + next + case (b3 a s1 s2) + have j1: "s1 \\<^isub>\ s2" by fact + have j2: "\x. P x s1 s2" by fact + show ?case + proof - + have f: "\c::name. c\(a,s1,s2,x)" + by (rule at_exists_fresh[OF at_name_inst], simp add: fs_name1) + then obtain c::"name" + where f1: "c\a" and f2: "c\x" and f3: "c\s1" and f4: "c\s2" + by (force simp add: fresh_prod fresh_atm) + have x1: "([(c,a)]\s1) \\<^isub>\ ([(c,a)]\s2)" using j1 by (rule eqvt_beta) + have x2: "\x. P x ([(c,a)]\s1) ([(c,a)]\s2)" using j2 eq + apply - + apply(drule_tac x="[(c,a)]\x" in meta_spec) + apply(drule_tac x="[(c,a)]\x" in meta_spec) + apply(drule_tac x="s1" in meta_spec) + apply(drule_tac x="s2" in meta_spec) + apply(drule_tac x="[(c,a)]" in meta_spec) + apply(simp add: perm_swap) + done + have x: "P x (Lam [c].([(c,a)]\s1)) (Lam [c].([(c,a)]\s2))" + using a3 f2 x1 x2 by blast + have alpha1: "(Lam [c].([(c,a)]\s1)) = (Lam [a].s1)" using f1 f3 + by (simp add: lam.inject alpha) + have alpha2: "(Lam [c].([(c,a)]\s2)) = (Lam [a].s2)" using f1 f3 + by (simp add: lam.inject alpha) + show " P x (Lam [a].s1) (Lam [a].s2)" + using x alpha1 alpha2 by (simp only: pt_name2) + qed + next + case (b4 a s1 s2) + show ?case + proof - + have f: "\c::name. c\(a,s1,s2,x)" + by (rule at_exists_fresh[OF at_name_inst], simp add: fs_name1) + then obtain c::"name" + where f1: "c\a" and f2: "c\x" and f3: "c\s1" and f4: "c\s2" and f5: "c\(x,s2)" + by (force simp add: fresh_prod fresh_atm) + have x: "P x (App (Lam [c].([(c,a)]\s1)) s2) (([(c,a)]\s1)[c::=s2])" + using a4 f5 + (* HERE *) + + by (blast intro!: eqvt_beta) + have alpha1: "(Lam [c].([(c,pi\a)]\(pi\s1))) = (Lam [(pi\a)].(pi\s1))" using f1 f3 + by (simp add: lam.inject alpha) + have alpha2: "(([(c,pi\a)]@pi)\s1)[c::=(pi\s2)] = (pi\s1)[(pi\a)::=(pi\s2)]" + using f3 by (simp only: subst_rename[symmetric] pt_name2) + show "P x (App (Lam [(pi\a)].(pi\s1)) (pi\s2)) ((pi\s1)[(pi\a)::=(pi\s2)])" + using x alpha1 alpha2 by (simp only: pt_name2) + qed + qed + hence "P x (([]::name prm)\t) (([]::name prm)\s)" by blast + thus ?thesis by simp +qed + section {* One-Reduction *} consts