# HG changeset patch # User urbanc # Date 1133414921 -3600 # Node ID e61d2424863d3c4926009a68dad1f76214be585d # Parent c68296902ddb922d83f174d587054d3718b2ea93 initial cleanup to use the new induction method diff -r c68296902ddb -r e61d2424863d src/HOL/Nominal/Examples/SN.thy --- a/src/HOL/Nominal/Examples/SN.thy Thu Dec 01 05:20:13 2005 +0100 +++ b/src/HOL/Nominal/Examples/SN.thy Thu Dec 01 06:28:41 2005 +0100 @@ -1,7 +1,5 @@ (* $Id$ *) - - theory sn imports lam_substs Accessible_Part begin @@ -10,45 +8,41 @@ section {* Beta Reduction *} + lemma subst_rename[rule_format]: - fixes c :: "name" - and a :: "name" - and t1 :: "lam" - and t2 :: "lam" shows "c\t1 \ (t1[a::=t2] = ([(c,a)]\t1)[c::=t2])" -apply(nominal_induct t1 rule: lam_induct) -apply(auto simp add: calc_atm fresh_atm fresh_prod abs_fresh) +apply(nominal_induct t1 avoiding: a c t2 rule: lam_induct) +apply(auto simp add: calc_atm fresh_atm abs_fresh) done -lemma forget[rule_format]: - shows "a\t1 \ t1[a::=t2] = t1" -apply (nominal_induct t1 rule: lam_induct) -apply(auto simp add: abs_fresh fresh_atm fresh_prod) +lemma forget: + assumes a: "a\t1" + shows "t1[a::=t2] = t1" + using a +apply (nominal_induct t1 avoiding: a t2 rule: lam_induct) +apply(auto simp add: abs_fresh fresh_atm) done -lemma fresh_fact[rule_format]: - fixes b :: "name" - and a :: "name" - and t1 :: "lam" - and t2 :: "lam" - shows "a\t1\a\t2\a\(t1[b::=t2])" -apply(nominal_induct t1 rule: lam_induct) -apply(auto simp add: abs_fresh fresh_prod fresh_atm) +lemma fresh_fact: + fixes a::"name" + assumes a: "a\t1" + and b: "a\t2" + shows "a\(t1[b::=t2])" +using a b +apply(nominal_induct t1 avoiding: a b t2 rule: lam_induct) +apply(auto simp add: abs_fresh fresh_atm) done lemma subs_lemma: - fixes x::"name" - and y::"name" - and L::"lam" - and M::"lam" - and N::"lam" - shows "x\y\x\L\M[x::=N][y::=L] = M[y::=L][x::=N[y::=L]]" -apply(nominal_induct M rule: lam_induct) -apply(auto simp add: fresh_fact forget fresh_prod fresh_atm) -done + assumes a: "x\y" + and b: "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) lemma id_subs: "t[x::=Var x] = t" -apply(nominal_induct t rule: lam_induct) +apply(nominal_induct t avoiding: x rule: lam_induct) apply(simp_all add: fresh_atm) done @@ -71,93 +65,75 @@ fixes pi :: "name prm" and t :: "lam" and s :: "lam" - shows "t\\<^isub>\s \ (pi\t)\\<^isub>\(pi\s)" - apply(erule Beta.induct) - apply(auto) - done + assumes a: "t\\<^isub>\s" + shows "(pi\t)\\<^isub>\(pi\s)" + using a by (induct, auto) -lemma beta_induct_aux[rule_format]: - fixes P :: "lam \ lam \'a::fs_name\bool" - and t :: "lam" - and s :: "lam" - assumes a: "t\\<^isub>\s" - and a1: "\x t s1 s2. - s1\\<^isub>\s2 \ (\z. P s1 s2 z) \ P (App s1 t) (App s2 t) x" - and a2: "\x t s1 s2. - s1\\<^isub>\s2 \ (\z. P s1 s2 z) \ P (App t s1) (App t s2) x" - and a3: "\x (a::name) s1 s2. - a\x \ s1\\<^isub>\s2 \ (\z. P s1 s2 z) \ P (Lam [a].s1) (Lam [a].s2) x" - and a4: "\x (a::name) t1 s1. a\(s1,x) \ P (App (Lam [a].t1) s1) (t1[a::=s1]) x" - shows "\x (pi::name prm). P (pi\t) (pi\s) x" -using a -proof (induct) - case b1 thus ?case using a1 by (simp, blast intro: eqvt_beta) -next - case b2 thus ?case using a2 by (simp, blast intro: eqvt_beta) -next - case (b3 a s1 s2) - assume j1: "s1 \\<^isub>\ s2" - assume j2: "\x (pi::name prm). P (pi\s1) (pi\s2) x" - show ?case - proof (simp, intro strip) - fix pi::"name prm" and x::"'a::fs_name" - have f: "\c::name. c\(pi\a,pi\s1,pi\s2,x)" - by (rule at_exists_fresh[OF at_name_inst], simp add: fs_name1) - then obtain c::"name" - where f1: "c\(pi\a)" and f2: "c\x" and f3: "c\(pi\s1)" and f4: "c\(pi\s2)" - by (force simp add: fresh_prod fresh_atm) - have x: "P (Lam [c].(([(c,pi\a)]@pi)\s1)) (Lam [c].(([(c,pi\a)]@pi)\s2)) x" - using a3 f2 j1 j2 by (simp, 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: "(Lam [c].([(c,pi\a)]\(pi\s2))) = (Lam [(pi\a)].(pi\s2))" using f1 f3 - by (simp add: lam.inject alpha) - show " P (Lam [(pi\a)].(pi\s1)) (Lam [(pi\a)].(pi\s2)) x" - using x alpha1 alpha2 by (simp only: pt_name2) - qed -next - case (b4 a s1 s2) - show ?case - proof (simp add: subst_eqvt, intro strip) - fix pi::"name prm" and x::"'a::fs_name" - have f: "\c::name. c\(pi\a,pi\s1,pi\s2,x)" - by (rule at_exists_fresh[OF at_name_inst], simp add: fs_name1) - then obtain c::"name" - where f1: "c\(pi\a)" and f2: "c\(pi\s2,x)" and f3: "c\(pi\s1)" and f4: "c\(pi\s2)" - by (force simp add: fresh_prod fresh_atm) - have x: "P (App (Lam [c].(([(c,pi\a)]@pi)\s1)) (pi\s2)) ((([(c,pi\a)]@pi)\s1)[c::=(pi\s2)]) x" - using a4 f2 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 (App (Lam [(pi\a)].(pi\s1)) (pi\s2)) ((pi\s1)[(pi\a)::=(pi\s2)]) x" - using x alpha1 alpha2 by (simp only: pt_name2) - qed -qed - -lemma beta_induct[case_names b1 b2 b3 b4]: - fixes P :: "lam \ lam \'a::fs_name\bool" +lemma beta_induct[consumes 1, case_names b1 b2 b3 b4]: + 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: "\x t s1 s2. - s1\\<^isub>\s2 \ (\z. P s1 s2 z) \ P (App s1 t) (App s2 t) x" - and a2: "\x t s1 s2. - s1\\<^isub>\s2 \ (\z. P s1 s2 z) \ P (App t s1) (App t s2) x" - and a3: "\x (a::name) s1 s2. - a\x \ s1\\<^isub>\s2 \ (\z. P s1 s2 z) \ P (Lam [a].s1) (Lam [a].s2) x" - and a4: "\x (a::name) t1 s1. - a\(s1,x) \ P (App (Lam [a].t1) s1) (t1[a::=s1]) x" - shows "P t s x" -using a a1 a2 a3 a4 -by (auto intro!: beta_induct_aux[of "t" "s" "P" "[]" "x", simplified]) + 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\(s1,x) \ P x (App (Lam [a].t1) s1) (t1[a::=s1])" + shows "P x t s" +proof - + from a have "\(pi::name prm) x. P x (pi\t) (pi\s)" + proof (induct) + case b1 thus ?case using a1 by (simp, blast intro: eqvt_beta) + next + case b2 thus ?case using a2 by (simp, blast intro: eqvt_beta) + next + case (b3 a s1 s2) + have j1: "s1 \\<^isub>\ s2" by fact + have j2: "\x (pi::name prm). P x (pi\s1) (pi\s2)" by fact + show ?case + proof (simp) + have f: "\c::name. c\(pi\a,pi\s1,pi\s2,x)" + by (rule at_exists_fresh[OF at_name_inst], simp add: fs_name1) + then obtain c::"name" + where f1: "c\(pi\a)" and f2: "c\x" and f3: "c\(pi\s1)" and f4: "c\(pi\s2)" + by (force simp add: fresh_prod fresh_atm) + have x: "P x (Lam [c].(([(c,pi\a)]@pi)\s1)) (Lam [c].(([(c,pi\a)]@pi)\s2))" + using a3 f2 j1 j2 by (simp, 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: "(Lam [c].([(c,pi\a)]\(pi\s2))) = (Lam [(pi\a)].(pi\s2))" using f1 f3 + by (simp add: lam.inject alpha) + show " P x (Lam [(pi\a)].(pi\s1)) (Lam [(pi\a)].(pi\s2))" + using x alpha1 alpha2 by (simp only: pt_name2) + qed + next + case (b4 a s1 s2) + show ?case + proof (simp add: subst_eqvt) + have f: "\c::name. c\(pi\a,pi\s1,pi\s2,x)" + by (rule at_exists_fresh[OF at_name_inst], simp add: fs_name1) + then obtain c::"name" + where f1: "c\(pi\a)" and f2: "c\(pi\s2,x)" and f3: "c\(pi\s1)" and f4: "c\(pi\s2)" + by (force simp add: fresh_prod fresh_atm) + have x: "P x (App (Lam [c].(([(c,pi\a)]@pi)\s1)) (pi\s2)) ((([(c,pi\a)]@pi)\s1)[c::=(pi\s2)])" + using a4 f2 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 lemma supp_beta: "t\\<^isub>\ s\(supp s)\((supp t)::name set)" apply(erule Beta.induct) apply(auto intro!: simp add: abs_supp lam.supp subst_supp) done + lemma beta_abs: "Lam [a].t\\<^isub>\ t'\\t''. t'=Lam [a].t'' \ t\\<^isub>\ t''" apply(ind_cases "Lam [a].t \\<^isub>\ t'") apply(auto simp add: lam.distinct lam.inject) @@ -175,17 +151,12 @@ apply(force intro!: eqvt_beta) done -lemma beta_subst[rule_format]: +lemma beta_subst: assumes a: "M \\<^isub>\ M'" shows "M[x::=N]\\<^isub>\ M'[x::=N]" using a -apply(nominal_induct M M' rule: beta_induct) -apply(auto simp add: fresh_prod fresh_atm subs_lemma) -done - -instance nat :: fs_name -apply(intro_classes) -apply(simp_all add: supp_def perm_nat_def) +apply(nominal_induct M M' avoiding: x N rule: beta_induct) +apply(auto simp add: fresh_atm subs_lemma) done datatype ty = @@ -283,7 +254,7 @@ t2[intro]: "\\ \ t1 : \\\; \ \ t2 : \\\ \ \ App t1 t2 : \" t3[intro]: "\a\\;((a,\)#\) \ t : \\ \ \ \ Lam [a].t : \\\" -lemma typing_eqvt: +lemma eqvt_typing: fixes \ :: "(name\ty) list" and t :: "lam" and \ :: "ty" @@ -296,104 +267,88 @@ have "valid (pi\\)" by (rule valid_eqvt) moreover have "(pi\(a,\))\((pi::name prm)\set \)" by (rule pt_set_bij2[OF pt_name_inst, OF at_name_inst]) - ultimately show "(pi\\) \ (pi\Var a) : \" - using typing.intros by (auto simp add: pt_list_set_pi[OF pt_name_inst]) + ultimately show "(pi\\) \ ((pi::name prm)\Var a) : \" + using typing.intros by (force simp add: pt_list_set_pi[OF pt_name_inst, symmetric]) next case (t3 \ \ \ a t) moreover have "(pi\a)\(pi\\)" by (rule pt_fresh_bij1[OF pt_name_inst, OF at_name_inst]) - ultimately show "(pi\\) \ (pi\Lam [a].t) : \\\" - using typing.intros by (force) + ultimately show "(pi\\) \ (pi\Lam [a].t) :\\\" by force qed (auto) -lemma typing_induct_aux[rule_format]: - fixes P :: "(name\ty) list \ lam \ ty \'a::fs_name\bool" - and \ :: "(name\ty) list" - and t :: "lam" - and \ :: "ty" - assumes a: "\ \ t : \" - and a1: "\x \ (a::name) \. valid \ \ (a,\) \ set \ \ P \ (Var a) \ x" - and a2: "\x \ \ \ t1 t2. - \ \ t1 : \\\ \ (\z. P \ t1 (\\\) z) \ \ \ t2 : \ \ (\z. P \ t2 \ z) - \ P \ (App t1 t2) \ x" - and a3: "\x (a::name) \ \ \ t. - a\x \ a\\ \ ((a,\) # \) \ t : \ \ (\z. P ((a,\)#\) t \ z) - \ P \ (Lam [a].t) (\\\) x" - shows "\(pi::name prm) (x::'a::fs_name). P (pi\\) (pi\t) \ x" -using a -proof (induct) - case (t1 \ \ a) - assume j1: "valid \" - assume j2: "(a,\)\set \" - show ?case - proof (intro strip, simp) - fix pi::"name prm" and x::"'a::fs_name" - from j1 have j3: "valid (pi\\)" by (rule valid_eqvt) - from j2 have "pi\(a,\)\pi\(set \)" by (simp only: pt_set_bij[OF pt_name_inst, OF at_name_inst]) - hence j4: "(pi\a,\)\set (pi\\)" by (simp add: pt_list_set_pi[OF pt_name_inst]) - show "P (pi\\) (Var (pi\a)) \ x" using a1 j3 j4 by force - qed -next - case (t2 \ \ \ t1 t2) - thus ?case using a2 by (simp, blast intro: typing_eqvt) -next - case (t3 \ \ \ a t) - have k1: "a\\" by fact - have k2: "((a,\)#\)\t:\" by fact - have k3: "\(pi::name prm) (x::'a::fs_name). P (pi \ ((a,\)#\)) (pi\t) \ x" by fact - show ?case - proof (intro strip, simp) - fix pi::"name prm" and x::"'a::fs_name" - have f: "\c::name. c\(pi\a,pi\t,pi\\,x)" - by (rule at_exists_fresh[OF at_name_inst], simp add: fs_name1) - then obtain c::"name" - where f1: "c\(pi\a)" and f2: "c\x" and f3: "c\(pi\t)" and f4: "c\(pi\\)" - by (force simp add: fresh_prod fresh_atm) - from k1 have k1a: "(pi\a)\(pi\\)" - by (simp add: pt_fresh_left[OF pt_name_inst, OF at_name_inst] - pt_rev_pi[OF pt_name_inst, OF at_name_inst]) - have l1: "(([(c,pi\a)]@pi)\\) = (pi\\)" using f4 k1a - by (simp only: pt_name2, rule pt_fresh_fresh[OF pt_name_inst, OF at_name_inst]) - have "\x. P (([(c,pi\a)]@pi)\((a,\)#\)) (([(c,pi\a)]@pi)\t) \ x" using k3 by force - hence l2: "\x. P ((c, \)#(pi\\)) (([(c,pi\a)]@pi)\t) \ x" using f1 l1 - by (force simp add: pt_name2 calc_atm split: if_splits) - have "(([(c,pi\a)]@pi)\((a,\)#\)) \ (([(c,pi\a)]@pi)\t) : \" using k2 by (rule typing_eqvt) - hence l3: "((c, \)#(pi\\)) \ (([(c,pi\a)]@pi)\t) : \" using l1 f1 - by (force simp add: pt_name2 calc_atm split: if_splits) - have l4: "P (pi\\) (Lam [c].(([(c,pi\a)]@pi)\t)) (\ \ \) x" using f2 f4 l2 l3 a3 by auto - have alpha: "(Lam [c].([(c,pi\a)]\(pi\t))) = (Lam [(pi\a)].(pi\t))" using f1 f3 - by (simp add: lam.inject alpha) - show "P (pi\\) (Lam [(pi\a)].(pi\t)) (\ \ \) x" using l4 alpha - by (simp only: pt_name2) - qed -qed - -lemma typing_induct[case_names t1 t2 t3]: - fixes P :: "(name\ty) list \ lam \ ty \'a::fs_name\bool" +lemma typing_induct[consumes 1, case_names t1 t2 t3]: + fixes P :: "'a::fs_name\(name\ty) list \ lam \ ty \bool" and \ :: "(name\ty) list" and t :: "lam" and \ :: "ty" and x :: "'a::fs_name" assumes a: "\ \ t : \" - and a1: "\x \ (a::name) \. valid \ \ (a,\) \ set \ \ P \ (Var a) \ x" - and a2: "\x \ \ \ t1 t2. - \ \ t1 : \\\ \ (\z. P \ t1 (\\\) z) \ \ \ t2 : \ \ (\z. P \ t2 \ z) - \ P \ (App t1 t2) \ x" - and a3: "\x (a::name) \ \ \ t. - a\x \ a\\ \ ((a,\) # \) \ t : \ \ (\z. P ((a,\)#\) t \ z) - \ P \ (Lam [a].t) (\\\) x" - shows "P \ t \ x" -using a a1 a2 a3 typing_induct_aux[of "\" "t" "\" "P" "[]" "x", simplified] by force + and a1: "\\ (a::name) \ x. valid \ \ (a,\) \ set \ \ P x \ (Var a) \" + and a2: "\\ \ \ t1 t2 x. + \ \ t1 : \\\ \ (\z. P z \ t1 (\\\)) \ \ \ t2 : \ \ (\z. P z \ t2 \) + \ P x \ (App t1 t2) \" + and a3: "\a \ \ \ t x. a\x \ a\\ \ ((a,\) # \) \ t : \ \ (\z. P z ((a,\)#\) t \) + \ P x \ (Lam [a].t) (\\\)" + shows "P x \ t \" +proof - + from a have "\(pi::name prm) x. P x (pi\\) (pi\t) \" + proof (induct) + case (t1 \ \ a) + have j1: "valid \" by fact + have j2: "(a,\)\set \" by fact + from j1 have j3: "valid (pi\\)" by (rule valid_eqvt) + from j2 have "pi\(a,\)\pi\(set \)" by (simp only: pt_set_bij[OF pt_name_inst, OF at_name_inst]) + hence j4: "(pi\a,\)\set (pi\\)" by (simp add: pt_list_set_pi[OF pt_name_inst]) + show "P x (pi\\) (pi\(Var a)) \" using a1 j3 j4 by simp + next + case (t2 \ \ \ t1 t2) + thus ?case using a2 by (simp, blast intro: eqvt_typing) + next + case (t3 \ \ \ a t) + have k1: "a\\" by fact + have k2: "((a,\)#\)\t:\" by fact + have k3: "\(pi::name prm) (x::'a::fs_name). P x (pi \((a,\)#\)) (pi\t) \" by fact + have f: "\c::name. c\(pi\a,pi\t,pi\\,x)" + by (rule at_exists_fresh[OF at_name_inst], simp add: fs_name1) + then obtain c::"name" + where f1: "c\(pi\a)" and f2: "c\x" and f3: "c\(pi\t)" and f4: "c\(pi\\)" + by (force simp add: fresh_prod at_fresh[OF at_name_inst]) + from k1 have k1a: "(pi\a)\(pi\\)" + by (simp add: pt_fresh_left[OF pt_name_inst, OF at_name_inst] + pt_rev_pi[OF pt_name_inst, OF at_name_inst]) + have l1: "(([(c,pi\a)]@pi)\\) = (pi\\)" using f4 k1a + by (simp only: pt2[OF pt_name_inst], rule pt_fresh_fresh[OF pt_name_inst, OF at_name_inst]) + have "\x. P x (([(c,pi\a)]@pi)\((a,\)#\)) (([(c,pi\a)]@pi)\t) \" using k3 by force + hence l2: "\x. P x ((c, \)#(pi\\)) (([(c,pi\a)]@pi)\t) \" using f1 l1 + by (force simp add: pt2[OF pt_name_inst] at_calc[OF at_name_inst]) + have "(([(c,pi\a)]@pi)\((a,\)#\)) \ (([(c,pi\a)]@pi)\t) : \" using k2 by (rule eqvt_typing) + hence l3: "((c, \)#(pi\\)) \ (([(c,pi\a)]@pi)\t) : \" using l1 f1 + by (force simp add: pt2[OF pt_name_inst] at_calc[OF at_name_inst]) + have l4: "P x (pi\\) (Lam [c].(([(c,pi\a)]@pi)\t)) (\ \ \)" using f2 f4 l2 l3 a3 by auto + have alpha: "(Lam [c].([(c,pi\a)]\(pi\t))) = (Lam [(pi\a)].(pi\t))" using f1 f3 + by (simp add: lam.inject alpha) + show "P x (pi\\) (pi\(Lam [a].t)) (\ \ \)" using l4 alpha + by (simp only: pt2[OF pt_name_inst], simp) + qed + hence "P x (([]::name prm)\\) (([]::name prm)\t) \" by blast + thus "P x \ t \" by simp +qed constdefs "sub" :: "(name\ty) list \ (name\ty) list \ bool" (" _ \ _ " [80,80] 80) "\1 \ \2 \ \a \. (a,\)\set \1 \ (a,\)\set \2" -lemma weakening[rule_format]: - assumes a: "\1 \ t : \" - shows "valid \2 \ \1 \ \2 \ \2 \ t:\" -using a -apply(nominal_induct \1 t \ rule: typing_induct) +lemma weakening: + assumes a: "\1 \ t : \" + and b: "valid \2" + and c: "\1 \ \2" + shows "\2 \ t:\" +using a b c +apply(nominal_induct \1 t \ avoiding: \2 rule: typing_induct) apply(auto simp add: sub_def) +(* FIXME: before using meta-connectives and the new induction *) +(* method, this was completely automatic *) +apply(atomize) +apply(auto) done lemma in_ctxt[rule_format]: "(a,\)\set \ \ (a\set(dom_ty \))" @@ -422,7 +377,7 @@ lemma t3_elim: "\\ \ Lam [a].t : \;a\\\\ \\ \'. \=\\\' \ ((a,\)#\) \ t : \'" apply(ind_cases "\ \ Lam [a].t : \") apply(auto simp add: lam.distinct lam.inject alpha) -apply(drule_tac pi="[(a,aa)]::name prm" in typing_eqvt) +apply(drule_tac pi="[(a,aa)]::name prm" in eqvt_typing) apply(simp) apply(subgoal_tac "([(a,aa)]::name prm)\\ = \")(*A*) apply(force simp add: calc_atm) @@ -443,8 +398,8 @@ and \ ::"ty" and c ::"name" shows "((c,\)#\) \ t1:\\ \\ t2:\\ \ \ t1[c::=t2]:\" -proof(nominal_induct t1 rule: lam_induct) - case (Var \ \ \ c t2 a) +proof(nominal_induct t1 avoiding: \ \ \ c t2 rule: lam_induct) + case (Var a) show ?case proof(intro strip) assume a1: "\ \t2:\" @@ -473,7 +428,7 @@ qed qed next - case (App \ \ \ c t2 s1 s2) + case (App s1 s2) show ?case proof (intro strip, simp) assume b1: "\ \t2:\" @@ -484,8 +439,8 @@ using b1 b3a b3b App by (rule_tac \="\'" in t2, auto) qed next - case (Lam \ \ \ c t2 a s) - assume "a\(\,\,\,c,t2)" + case (Lam a s) + have "a\\" "a\\" "a\\" "a\c" "a\t2" by fact hence f1: "a\\" and f2: "a\c" and f2': "c\a" and f3: "a\t2" and f4: "a\((c,\)#\)" by (auto simp add: fresh_atm fresh_prod fresh_list_cons) show ?case using f2 f3 @@ -523,33 +478,31 @@ assumes a: "t1\\<^isub>\t2" shows "(\ \ t1:\) \ (\ \ t2:\)" using a -proof (nominal_induct t1 t2 rule: beta_induct, auto) - case (b1 \ \ t s1 s2) - assume i: "\\ \. \ \ s1 : \ \ \ \ s2 : \" - assume "\ \ App s1 t : \" +proof (nominal_induct t1 t2 avoiding: \ \ rule: beta_induct, auto) + case (b1 t s1 s2) + have i: "\\ \. \ \ s1:\ \ \ \ s2 : \" by fact + assume "\ \ App s1 t : \" hence "\\. (\ \ s1 : \\\ \ \ \ t : \)" by (rule t2_elim) then obtain \ where a1: "\ \ s1 : \\\" and a2: "\ \ t : \" by force thus "\ \ App s2 t : \" using i by force next - case (b2 \ \ t s1 s2) - assume i: "\\ \. \ \ s1 : \ \ \ \ s2 : \" - assume "\ \ App t s1 : \" + case (b2 t s1 s2) + have i: "\\ \. \ \ s1 : \ \ \ \ s2 : \" by fact + assume "\ \ App t s1 : \" hence "\\. (\ \ t : \\\ \ \ \ s1 : \)" by (rule t2_elim) then obtain \ where a1: "\ \ t : \\\" and a2: "\ \ s1 : \" by force thus "\ \ App t s2 : \" using i by force next - case (b3 \ \ a s1 s2) - assume "a\(\,\)" - hence f: "a\\" by (simp add: fresh_prod) - assume i: "\\ \. \ \ s1 : \ \ \ \ s2 : \" + case (b3 a s1 s2) + have f: "a\\" and "a\\" by fact+ + have i: "\\ \. \ \ s1 : \ \ \ \ s2 : \" by fact assume "\ \ Lam [a].s1 : \" with f have "\\1 \2. \=\1\\2 \ ((a,\1)#\) \ s1 : \2" by (force dest: t3_elim) then obtain \1 \2 where a1: "\=\1\\2" and a2: "((a,\1)#\) \ s1 : \2" by force thus "\ \ Lam [a].s2 : \" using f i by force next - case (b4 \ \ a s1 s2) - have "a\(s2,\,\)" by fact - hence f: "a\\" by (simp add: fresh_prod) + case (b4 a s1 s2) + have f: "a\\" by fact assume "\ \ App (Lam [a].s1) s2 : \" hence "\\. (\ \ (Lam [a].s1) : \\\ \ \ \ s2 : \)" by (rule t2_elim) then obtain \ where a1: "\ \ (Lam [(a::name)].s1) : \\\" and a2: "\ \ s2 : \" by force @@ -557,7 +510,6 @@ with a2 show "\ \ s1[a::=s2] : \" by (force intro: ty_subs) qed - lemma subject[rule_format]: fixes \ ::"(name\ty) list" and t1 ::"lam" @@ -566,12 +518,10 @@ assumes a: "t1\\<^isub>\t2" shows "\ \ t1:\ \ \ \ t2:\" using a -apply(nominal_induct t1 t2 rule: beta_induct) -apply(auto dest!: t2_elim t3_elim intro: ty_subs simp add: fresh_prod) +apply(nominal_induct t1 t2 avoiding: \ \ rule: beta_induct) +apply(auto dest!: t2_elim t3_elim intro: ty_subs) done - - subsection {* some facts about beta *} constdefs @@ -887,33 +837,49 @@ done lemma psubs_subs[rule_format]: "c\\\ (t[<\>])[c::=s] = t[<((c,s)#\)>]" -apply(nominal_induct t rule: lam_induct) +apply(nominal_induct t avoiding: \ c s rule: lam_induct) apply(auto dest: fresh_domain) apply(drule fresh_at) apply(assumption) apply(rule forget) apply(assumption) -apply(subgoal_tac "ab\((aa,b)#a)")(*A*) -apply(simp add: fresh_prod) +apply(subgoal_tac "a\((c,s)#\)")(*A*) +apply(simp) (*A*) apply(simp add: fresh_list_cons fresh_prod) done lemma all_RED: - "\\t:\ \ (\a \. (a,\)\set(\)\(a\set(domain \)\\\RED \)) \ (t[<\>]\RED \)" -apply(nominal_induct t rule: lam_induct) + "\\t:\ \ (\a \. (a,\)\set(\)\(a\set(domain \)\\\RED \)) \ (t[<\>]\RED \)" +apply(nominal_induct t avoiding: \ \ \ rule: lam_induct) (* Variables *) apply(force dest: t1_elim) (* Applications *) +apply(atomize) +apply(force dest!: t2_elim) +(* Abstractions *) +apply(auto dest!: t3_elim simp only:) +apply(simp only: fresh_prod psubst_Lam) +apply(rule abs_RED[THEN mp]) +apply(force dest: fresh_context simp add: psubs_subs) +done + +lemma all_RED: + "\\t:\ \ (\a \. (a,\)\set(\)\(a\set(domain \)\\\RED \)) \ (t[<\>]\RED \)" +apply(nominal_induct t avoiding: \ \ \ rule: lam_induct) +(* Variables *) +apply(force dest: t1_elim) +(* Applications *) +apply(atomize) apply(clarify) apply(drule t2_elim) apply(erule exE, erule conjE) -apply(drule_tac x="a" in spec) -apply(drule_tac x="a" in spec) -apply(drule_tac x="\\aa" in spec) -apply(drule_tac x="\" in spec) -apply(drule_tac x="b" in spec) -apply(drule_tac x="b" in spec) +apply(drule_tac x="\" in spec) +apply(drule_tac x="\" in spec) +apply(drule_tac x="\'\\" in spec) +apply(drule_tac x="\'" in spec) +apply(drule_tac x="\" in spec) +apply(drule_tac x="\" in spec) apply(force) (* Abstractions *) apply(clarify) @@ -924,31 +890,10 @@ apply(simp only: fresh_prod psubst_Lam) apply(rule abs_RED[THEN mp]) apply(clarify) -apply(drule_tac x="(ab,\)#a" in spec) -apply(drule_tac x="\'" in spec) -apply(drule_tac x="(ab,s)#b" in spec) -apply(simp (no_asm_use)) -apply(simp add: split_if) -apply(auto) -apply(drule fresh_context) -apply(simp) -apply(simp add: psubs_subs) +apply(atomize) +apply(force dest: fresh_context simp add: psubs_subs) done -lemma all_RED: - "\\t:\ \ (\a \. (a,\)\set(\)\(a\set(domain \)\\\RED \)) \ (t[<\>]\RED \)" -apply(nominal_induct t rule: lam_induct) -(* Variables *) -apply(force dest: t1_elim) -(* Applications *) -apply(force dest!: t2_elim) -(* Abstractions *) -apply(auto dest!: t3_elim simp only:) -apply(simp add: fresh_prod) -apply(simp only: fresh_prod psubst_Lam) -apply(rule abs_RED[THEN mp]) -apply(force dest: fresh_context simp add: psubs_subs) -done lemma all_RED: "\\t:\ \ (\a \. (a,\)\set(\)\(a\set(domain \)\\\RED \)) \ (t[<\>]\RED \)"