# HG changeset patch # User urbanc # Date 1176385572 -7200 # Node ID 0c5b22076fb3707e49150223d6a9d73acc9164cc # Parent 6cf96b9f7b9e7f6b2afebd3aca5630fc19a900ab tuned the proof of lemma pt_list_set_fresh (as suggested by Randy Pollack) and tuned the syntax for sub_contexts diff -r 6cf96b9f7b9e -r 0c5b22076fb3 src/HOL/Nominal/Examples/Crary.thy --- a/src/HOL/Nominal/Examples/Crary.thy Thu Apr 12 15:35:29 2007 +0200 +++ b/src/HOL/Nominal/Examples/Crary.thy Thu Apr 12 15:46:12 2007 +0200 @@ -267,14 +267,14 @@ valid_cons_elim_auto[elim]:"valid ((x,T)#\)" abbreviation - "sub_context" :: "Ctxt \ Ctxt \ bool" (" _ \ _ " [55,55] 55) + "sub_context" :: "Ctxt \ Ctxt \ bool" (" _ \ _ " [55,55] 55) where - "\\<^isub>1 \ \\<^isub>2 \ \a T. (a,T)\set \\<^isub>1 \ (a,T)\set \\<^isub>2" + "\\<^isub>1 \ \\<^isub>2 \ \a T. (a,T)\set \\<^isub>1 \ (a,T)\set \\<^isub>2" lemma valid_monotonicity[elim]: - assumes a: "\ \ \'" + assumes a: "\ \ \'" and b: "x\\'" - shows "(x,T\<^isub>1)#\ \ (x,T\<^isub>1)#\'" + shows "(x,T\<^isub>1)#\ \ (x,T\<^isub>1)#\'" using a b by auto lemma fresh_context: @@ -298,8 +298,8 @@ inductive2 typing :: "Ctxt\trm\ty\bool" (" _ \ _ : _ " [60,60,60] 60) where - t_Var[intro]: "\valid \; (x,T)\set \\\ \ \ Var x : T" -| t_App[intro]: "\\ \ e\<^isub>1 : T\<^isub>1\T\<^isub>2; \ \ e\<^isub>2 : T\<^isub>1\\ \ \ App e\<^isub>1 e\<^isub>2 : T\<^isub>2" + t_Var[intro]: "\valid \; (x,T)\set \\ \ \ \ Var x : T" +| t_App[intro]: "\\ \ e\<^isub>1 : T\<^isub>1\T\<^isub>2; \ \ e\<^isub>2 : T\<^isub>1\ \ \ \ App e\<^isub>1 e\<^isub>2 : T\<^isub>2" | t_Lam[intro]: "\x\\; (x,T\<^isub>1)#\ \ t : T\<^isub>2\ \ \ \ Lam [x].t : T\<^isub>1\T\<^isub>2" | t_Const[intro]: "valid \ \ \ \ Const n : TBase" | t_Unit[intro]: "valid \ \ \ \ Unit : TUnit" @@ -440,16 +440,16 @@ section {* Algorithmic Term Equivalence and Algorithmic Path Equivalence *} inductive2 - alg_equiv :: "Ctxt\trm\trm\ty\bool" ("_ \ _ \ _ : _" [60,60] 60) + alg_equiv :: "Ctxt\trm\trm\ty\bool" ("_ \ _ \ _ : _" [60,60,60,60] 60) and - alg_path_equiv :: "Ctxt\trm\trm\ty\bool" ("_ \ _ \ _ : _" [60,60] 60) + alg_path_equiv :: "Ctxt\trm\trm\ty\bool" ("_ \ _ \ _ : _" [60,60,60,60] 60) where - QAT_Base[intro]: "\s \ p; t \ q; \ \ p \ q : TBase \ \ \ \ s \ t : TBase" + QAT_Base[intro]: "\s \ p; t \ q; \ \ p \ q : TBase\ \ \ \ s \ t : TBase" | QAT_Arrow[intro]: "\x\(\,s,t); (x,T\<^isub>1)#\ \ App s (Var x) \ App t (Var x) : T\<^isub>2\ \ \ \ s \ t : T\<^isub>1 \ T\<^isub>2" | QAT_One[intro]: "valid \ \ \ \ s \ t : TUnit" | QAP_Var[intro]: "\valid \;(x,T) \ set \\ \ \ \ Var x \ Var x : T" -| QAP_App[intro]: "\\ \ p \ q : T\<^isub>1 \ T\<^isub>2; \ \ s \ t : T\<^isub>1 \ \ \ \ App p s \ App q t : T\<^isub>2" +| QAP_App[intro]: "\\ \ p \ q : T\<^isub>1 \ T\<^isub>2; \ \ s \ t : T\<^isub>1\ \ \ \ App p s \ App q t : T\<^isub>2" | QAP_Const[intro]: "valid \ \ \ \ Const n \ Const n : TBase" nominal_inductive alg_equiv @@ -579,17 +579,17 @@ done lemma algorithmic_monotonicity: - shows "\ \ s \ t : T \ \ \ \' \ valid \' \ \' \ s \ t : T" - and "\ \ s \ t : T \ \ \ \' \ valid \' \ \' \ s \ t : T" + shows "\ \ s \ t : T \ \ \ \' \ valid \' \ \' \ s \ t : T" + and "\ \ s \ t : T \ \ \ \' \ valid \' \ \' \ s \ t : T" proof (nominal_induct \ s t T and \ s t T avoiding: \' rule: alg_equiv_alg_path_equiv.strong_inducts) case (QAT_Arrow x \ s t T\<^isub>1 T\<^isub>2 \') have fs:"x\\" "x\s" "x\t" "x\\'"by fact - have h2:"\\\'" by fact - have ih:"\\'. \(x,T\<^isub>1)#\ \ \'; valid \'\ \ \' \ App s (Var x) \ App t (Var x) : T\<^isub>2" by fact + have h2:"\ \ \'" by fact + have ih:"\\'. \(x,T\<^isub>1)#\ \ \'; valid \'\ \ \' \ App s (Var x) \ App t (Var x) : T\<^isub>2" by fact have "valid \'" by fact then have "valid ((x,T\<^isub>1)#\')" using fs by auto moreover - have sub: "(x,T\<^isub>1)#\ \ (x,T\<^isub>1)#\'" using h2 by auto + have sub: "(x,T\<^isub>1)#\ \ (x,T\<^isub>1)#\'" using h2 by auto ultimately have "(x,T\<^isub>1)#\' \ App s (Var x) \ App t (Var x) : T\<^isub>2" using ih by simp then show "\' \ s \ t : T\<^isub>1\T\<^isub>2" using fs by (auto simp add: fresh_prod) qed (auto) @@ -607,7 +607,7 @@ "\ \ s is t : TUnit = True" | "\ \ s is t : TBase = \ \ s \ t : TBase" | "\ \ s is t : (T\<^isub>1 \ T\<^isub>2) = - (\\' s' t'. \\\' \ valid \' \ \' \ s' is t' : T\<^isub>1 \ (\' \ (App s s') is (App t t') : T\<^isub>2))" + (\\' s' t'. \\\' \ valid \' \ \' \ s' is t' : T\<^isub>1 \ (\' \ (App s s') is (App t t') : T\<^isub>2))" apply (auto simp add: ty.inject) apply (subgoal_tac "(\T\<^isub>1 T\<^isub>2. b=T\<^isub>1 \ T\<^isub>2) \ b=TUnit \ b=TBase" ) apply (force) @@ -621,7 +621,7 @@ lemma logical_monotonicity : assumes a1: "\ \ s is t : T" - and a2: "\\\'" + and a2: "\ \ \'" and a3: "valid \'" shows "\' \ s is t : T" using a1 a2 a3 @@ -631,7 +631,7 @@ next case (3 \ s t T\<^isub>1 T\<^isub>2 \') have "\ \ s is t : T\<^isub>1\T\<^isub>2" - and "\ \ \'" + and "\ \ \'" and "valid \'" by fact then show "\' \ s is t : T\<^isub>1\T\<^isub>2" by simp qed (auto) @@ -661,7 +661,7 @@ have ih2:"\\ s t. \\ \ s is t : T\<^isub>1; valid \\ \ \ \ s \ t : T\<^isub>1" by fact { fix \' s t - assume "\\\'" and hl:"\' \ s is t : T\<^isub>1" and hk: "valid \'" + assume "\ \ \'" and hl:"\' \ s is t : T\<^isub>1" and hk: "valid \'" then have "\' \ p \ q : T\<^isub>1 \ T\<^isub>2" using h algorithmic_monotonicity by auto moreover have "\' \ s \ t : T\<^isub>1" using ih2 hl hk by auto ultimately have "\' \ App p s \ App q t : T\<^isub>2" by auto @@ -707,7 +707,7 @@ have ih2:"\\ s t u. \\ \ s is t : T\<^isub>2; \ \ t is u : T\<^isub>2\ \ \ \ s is u : T\<^isub>2" by fact { fix \' s' u' - assume hsub:"\\\'" and hl:"\' \ s' is u' : T\<^isub>1" and hk: "valid \'" + assume hsub:"\ \ \'" and hl:"\' \ s' is u' : T\<^isub>1" and hk: "valid \'" then have "\' \ u' is s' : T\<^isub>1" using logical_symmetry by blast then have "\' \ u' is u' : T\<^isub>1" using ih1 hl by blast then have "\' \ App t u' is App u u' : T\<^isub>2" using h2 hsub hk by auto @@ -742,11 +742,11 @@ have ih:"\\ s t s'. \\ \ s is t : T\<^isub>2; s' \ s\ \ \ \ s' is t : T\<^isub>2" by fact have h2:"\ \ s is t : T\<^isub>1\T\<^isub>2" by fact then - have hb:"\\' s' t'. \\\' \ valid \' \ \' \ s' is t' : T\<^isub>1 \ (\' \ (App s s') is (App t t') : T\<^isub>2)" + have hb:"\\' s' t'. \\\' \ valid \' \ \' \ s' is t' : T\<^isub>1 \ (\' \ (App s s') is (App t t') : T\<^isub>2)" by auto { fix \' s\<^isub>2 t\<^isub>2 - assume "\\\'" and "\' \ s\<^isub>2 is t\<^isub>2 : T\<^isub>1" and "valid \'" + assume "\ \ \'" and "\' \ s\<^isub>2 is t\<^isub>2 : T\<^isub>1" and "valid \'" then have "\' \ (App s s\<^isub>2) is (App t t\<^isub>2) : T\<^isub>2" using hb by auto moreover have "(App s' s\<^isub>2) \ (App s s\<^isub>2)" using h1 by auto ultimately have "\' \ App s' s\<^isub>2 is App t t\<^isub>2 : T\<^isub>2" using ih by auto @@ -770,7 +770,7 @@ lemma logical_subst_monotonicity : assumes a: "\' \ s is t over \" - and b: "\'\\''" + and b: "\' \ \''" and c: "valid \''" shows "\'' \ s is t over \" using a b c logical_monotonicity by blast @@ -817,7 +817,7 @@ have ih:"\ \' \ \'. \\' \ \ is \' over (x,T\<^isub>1)#\; valid \'\ \ \' \ \2> is \'2> : T\<^isub>2" by fact { fix \'' s' t' - assume "\'\\''" and hl:"\''\ s' is t' : T\<^isub>1" and v: "valid \''" + assume "\' \ \''" and hl:"\''\ s' is t' : T\<^isub>1" and v: "valid \''" then have "\'' \ \ is \' over \" using logical_subst_monotonicity h by blast then have "\'' \ (x,s')#\ is (x,t')#\' over (x,T\<^isub>1)#\" using equiv_subst_ext hl fs by blast then have "\'' \ (x,s')#\2> is (x,t')#\'2> : T\<^isub>2" using ih v by auto @@ -869,7 +869,7 @@ have ih:"\\' \ \'. \\' \ \ is \' over (x,T\<^isub>1)#\; valid \'\ \ \' \ \2> is \'2> : T\<^isub>2" by fact { fix \'' s' t' - assume "\'\\''" and hl:"\''\ s' is t' : T\<^isub>1" and hk: "valid \''" + assume "\' \ \''" and hl:"\''\ s' is t' : T\<^isub>1" and hk: "valid \''" then have "\'' \ \ is \' over \" using h2 logical_subst_monotonicity by blast then have "\'' \ (x,s')#\ is (x,t')#\' over (x,T\<^isub>1)#\" using equiv_subst_ext hl fs by blast then have "\'' \ (x,s')#\2> is (x,t')#\'2> : T\<^isub>2" using ih hk by blast @@ -911,7 +911,7 @@ \ \' \ \ is \' : T\<^isub>2" by fact { fix \'' s' t' - assume hsub: "\'\\''" and hl: "\''\ s' is t' : T\<^isub>1" and hk: "valid \''" + assume hsub: "\' \ \''" and hl: "\''\ s' is t' : T\<^isub>1" and hk: "valid \''" then have "\'' \ \ is \' over \" using h2 logical_subst_monotonicity by blast then have "\'' \ (x,s')#\ is (x,t')#\' over (x,T\<^isub>1)#\" using equiv_subst_ext hl fs by blast then have "\'' \ (x,s')#\ is (x,t')#\' : T\<^isub>2" using ih hk by blast diff -r 6cf96b9f7b9e -r 0c5b22076fb3 src/HOL/Nominal/Examples/SN.thy --- a/src/HOL/Nominal/Examples/SN.thy Thu Apr 12 15:35:29 2007 +0200 +++ b/src/HOL/Nominal/Examples/SN.thy Thu Apr 12 15:46:12 2007 +0200 @@ -160,29 +160,28 @@ using a b c by (induct \) (auto dest!: fresh_context) -inductive2 typing :: "(name\ty) list\lam\ty\bool" (" _ \ _ : _ " [80,80,80] 80) +inductive2 typing :: "(name\ty) list\lam\ty\bool" ("_ \ _ : _" [60,60,60] 60) where - t1[intro]: "\valid \; (a,\)\set \\\ \ \ Var a : \" -| t2[intro]: "\\ \ t1 : \\\; \ \ t2 : \\\ \ \ App t1 t2 : \" + t1[intro]: "\valid \; (a,\)\set \\ \ \ \ Var a : \" +| t2[intro]: "\\ \ t1 : \\\; \ \ t2 : \\ \ \ \ App t1 t2 : \" | t3[intro]: "\a\\;((a,\)#\) \ t : \\ \ \ \ Lam [a].t : \\\" nominal_inductive typing by (simp_all add: abs_fresh fresh_ty) abbreviation - "sub" :: "(name\ty) list \ (name\ty) list \ bool" (" _ \ _ " [80,80] 80) where - "\1 \ \2 \ \a \. (a,\)\set \1 \ (a,\)\set \2" + "sub" :: "(name\ty) list \ (name\ty) list \ bool" ("_ \ _" [60,60] 60) +where + "\1 \ \2 \ \a \. (a,\)\set \1 \ (a,\)\set \2" lemma weakening: assumes a: "\1 \ t : \" and b: "valid \2" - and c: "\1 \ \2" - shows "\2 \ t:\" + and c: "\1 \ \2" + shows "\2 \ t : \" using a b c apply(nominal_induct \1 t \ avoiding: \2 rule: typing.strong_induct) apply(auto | atomize)+ -(* FIXME: before using meta-connectives and the new induction *) -(* method, this was completely automatic *) done lemma in_ctxt: @@ -208,7 +207,7 @@ apply(auto simp add: lam.inject lam.distinct) done -lemma t3_elim: "\\ \ Lam [a].t : \;a\\\\ \\ \'. \=\\\' \ ((a,\)#\) \ t : \'" +lemma t3_elim: "\\ \ Lam [a].t : \;a\\\ \ \\ \'. \=\\\' \ (a,\)#\ \ t : \'" apply(ind_cases2 "\ \ Lam [a].t : \") apply(auto simp add: lam.distinct lam.inject alpha) apply(drule_tac pi="[(a,aa)]::name prm" in typing.eqvt) @@ -225,14 +224,14 @@ using a by (induct, auto) lemma ty_subs: - assumes a: "((c,\)#\) \ t1:\" + assumes a: "(c,\)#\ \ t1:\" and b: "\\ t2:\" shows "\ \ t1[c::=t2]:\" using a b proof(nominal_induct t1 avoiding: \ \ \ c t2 rule: lam.induct) case (Var a) have a1: "\ \t2:\" by fact - have a2: "((c,\)#\) \ Var a:\" by fact + have a2: "(c,\)#\ \ Var a : \" by fact hence a21: "(a,\)\set((c,\)#\)" and a22: "valid((c,\)#\)" by (auto dest: t1_elim) from a22 have a23: "valid \" and a24: "c\\" by (auto dest: valid_elim) from a24 have a25: "\(\\. (c,\)\set \)" by (rule fresh_context) @@ -260,7 +259,7 @@ have ih_s1: "\c \ \ t2 \. ((c,\)#\) \ s1:\ \ \\ t2: \ \ \ \ s1[c::=t2]:\" by fact have ih_s2: "\c \ \ t2 \. ((c,\)#\) \ s2:\ \ \\ t2: \ \ \ \ s2[c::=t2]:\" by fact have "((c,\)#\)\App s1 s2 : \" by fact - hence "\\'. ((c,\)#\)\s1:\'\\ \ ((c,\)#\)\s2:\'" by (rule t2_elim) + hence "\\'. (c,\)#\ \s1:\'\\ \ (c,\)#\ \ s2 : \'" by (rule t2_elim) then obtain \' where "((c,\)#\)\s1:\'\\" and "((c,\)#\)\s2:\'" by blast moreover have "\ \t2:\" by fact @@ -270,23 +269,23 @@ 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) - have c1: "((c,\)#\)\Lam [a].s : \" by fact - hence "\\1 \2. \=\1\\2 \ ((a,\1)#(c,\)#\) \ s : \2" using f4 by (auto dest: t3_elim) + have c1: "(c,\)#\ \ Lam [a].s : \" by fact + hence "\\1 \2. \=\1\\2 \ (a,\1)#(c,\)#\ \ s : \2" using f4 by (auto dest: t3_elim) then obtain \1 \2 where c11: "\=\1\\2" and c12: "((a,\1)#(c,\)#\) \ s : \2" by force from c12 have "valid ((a,\1)#(c,\)#\)" by (rule typing_valid) hence ca: "valid \" and cb: "a\\" and cc: "c\\" by (auto simp add: fresh_list_cons) - from c12 have c14: "((c,\)#(a,\1)#\) \ s : \2" + from c12 have c14: "(c,\)#(a,\1)#\ \ s : \2" proof - - have c2: "((a,\1)#(c,\)#\) \ ((c,\)#(a,\1)#\)" by force + have c2: "(a,\1)#(c,\)#\ \ (c,\)#(a,\1)#\" by force have c3: "valid ((c,\)#(a,\1)#\)" by (rule v2, rule v2, auto simp add: fresh_list_cons fresh_prod ca cb cc f2' fresh_ty) from c12 c2 c3 show ?thesis by (force intro: weakening) qed assume c8: "\ \ t2 : \" - have c81: "((a,\1)#\)\t2 :\" + have c81: "(a,\1)#\ \ t2 :\" proof - - have c82: "\ \ ((a,\1)#\)" by force + have c82: "\ \ (a,\1)#\" by force have c83: "valid ((a,\1)#\)" using f1 ca by force with c8 c82 c83 show ?thesis by (force intro: weakening) qed diff -r 6cf96b9f7b9e -r 0c5b22076fb3 src/HOL/Nominal/Examples/SOS.thy --- a/src/HOL/Nominal/Examples/SOS.thy Thu Apr 12 15:35:29 2007 +0200 +++ b/src/HOL/Nominal/Examples/SOS.thy Thu Apr 12 15:46:12 2007 +0200 @@ -219,9 +219,9 @@ valid_cons_inv_auto[elim]:"valid ((x,T)#\)" abbreviation - "sub" :: "(name\ty) list \ (name\ty) list \ bool" ("_ \ _" [55,55] 55) + "sub" :: "(name\ty) list \ (name\ty) list \ bool" ("_ \ _" [55,55] 55) where - "\\<^isub>1 \ \\<^isub>2 \ \x T. (x,T)\set \\<^isub>1 \ (x,T)\set \\<^isub>2" + "\\<^isub>1 \ \\<^isub>2 \ \x T. (x,T)\set \\<^isub>1 \ (x,T)\set \\<^isub>2" lemma type_unicity_in_context: assumes asm1: "(x,t\<^isub>2) \ set ((x,t\<^isub>1)#\)" @@ -362,17 +362,17 @@ qed lemma weakening: - assumes "\\<^isub>1 \ e: T" and "valid \\<^isub>2" and "\\<^isub>1 \ \\<^isub>2" + assumes "\\<^isub>1 \ e: T" and "valid \\<^isub>2" and "\\<^isub>1 \ \\<^isub>2" shows "\\<^isub>2 \ e: T" using assms proof(nominal_induct \\<^isub>1 e T avoiding: \\<^isub>2 rule: typing.strong_induct) case (t_Lam x \\<^isub>1 T\<^isub>1 t T\<^isub>2 \\<^isub>2) - have ih: "\valid ((x,T\<^isub>1)#\\<^isub>2); (x,T\<^isub>1)#\\<^isub>1 \ (x,T\<^isub>1)#\\<^isub>2\ \ (x,T\<^isub>1)#\\<^isub>2 \ t : T\<^isub>2" by fact + have ih: "\valid ((x,T\<^isub>1)#\\<^isub>2); (x,T\<^isub>1)#\\<^isub>1 \ (x,T\<^isub>1)#\\<^isub>2\ \ (x,T\<^isub>1)#\\<^isub>2 \ t : T\<^isub>2" by fact have H1: "valid \\<^isub>2" by fact - have H2: "\\<^isub>1 \ \\<^isub>2" by fact + have H2: "\\<^isub>1 \ \\<^isub>2" by fact have fs: "x\\\<^isub>2" by fact then have "valid ((x,T\<^isub>1)#\\<^isub>2)" using H1 by auto - moreover have "(x,T\<^isub>1)#\\<^isub>1 \ (x,T\<^isub>1)#\\<^isub>2" using H2 by auto + moreover have "(x,T\<^isub>1)#\\<^isub>1 \ (x,T\<^isub>1)#\\<^isub>2" using H2 by auto ultimately have "(x,T\<^isub>1)#\\<^isub>2 \ t : T\<^isub>2" using ih by simp thus "\\<^isub>2 \ Lam [x].t : T\<^isub>1\T\<^isub>2" using fs by auto next @@ -398,7 +398,7 @@ then have "valid ((x\<^isub>2,T\<^isub>2)#(x\<^isub>1,T\<^isub>1)#\)" by (auto simp: fresh_list_cons fresh_atm) moreover - have "(x\<^isub>1,T\<^isub>1)#(x\<^isub>2,T\<^isub>2)#\ \ (x\<^isub>2,T\<^isub>2)#(x\<^isub>1,T\<^isub>1)#\" by auto + have "(x\<^isub>1,T\<^isub>1)#(x\<^isub>2,T\<^isub>2)#\ \ (x\<^isub>2,T\<^isub>2)#(x\<^isub>1,T\<^isub>1)#\" by auto ultimately show "(x\<^isub>2,T\<^isub>2)#(x\<^isub>1,T\<^isub>1)#\ \ e : T" using a by (auto intro: weakening) qed diff -r 6cf96b9f7b9e -r 0c5b22076fb3 src/HOL/Nominal/Examples/Weakening.thy --- a/src/HOL/Nominal/Examples/Weakening.thy Thu Apr 12 15:35:29 2007 +0200 +++ b/src/HOL/Nominal/Examples/Weakening.thy Thu Apr 12 15:46:12 2007 +0200 @@ -37,10 +37,10 @@ text{* typing judgements *} inductive2 - typing :: "(name\ty) list\lam\ty\bool" (" _ \ _ : _ " [80,80,80] 80) + typing :: "(name\ty) list\lam\ty\bool" ("_ \ _ : _" [60,60,60] 60) where - t_Var[intro]: "\valid \; (x,T)\set \\\ \ \ Var x : T" - | t_App[intro]: "\\ \ t1 : T1\T2; \ \ t2 : T1\\ \ \ App t1 t2 : T2" + t_Var[intro]: "\valid \; (x,T)\set \\ \ \ \ Var x : T" + | t_App[intro]: "\\ \ t1 : T1\T2; \ \ t2 : T1\ \ \ \ App t1 t2 : T2" | t_Lam[intro]: "\x\\;((x,T1)#\) \ t : T2\ \ \ \ Lam [x].t : T1\T2" (* automatically deriving the strong induction principle *) @@ -50,16 +50,16 @@ text {* definition of a subcontext *} abbreviation - "sub_context" :: "(name\ty) list \ (name\ty) list \ bool" (" _ \ _ " [80,80] 80) + "sub_context" :: "(name\ty) list \ (name\ty) list \ bool" ("_ \ _" [60,60] 60) where - "\1 \ \2 \ \x T. (x,T)\set \1 \ (x,T)\set \2" + "\1 \ \2 \ \x T. (x,T)\set \1 \ (x,T)\set \2" text {* Now it comes: The Weakening Lemma *} lemma weakening_version1: assumes a: "\1 \ t : T" and b: "valid \2" - and c: "\1 \ \2" + and c: "\1 \ \2" shows "\2 \ t : T" using a b c by (nominal_induct \1 t T avoiding: \2 rule: typing.strong_induct) @@ -69,14 +69,14 @@ fixes \1::"(name\ty) list" and t ::"lam" and \ ::"ty" - assumes a: "\1 \ t:T" + assumes a: "\1 \ t : T" and b: "valid \2" - and c: "\1 \ \2" - shows "\2 \ t:T" + and c: "\1 \ \2" + shows "\2 \ t : T" using a b c proof (nominal_induct \1 t T avoiding: \2 rule: typing.strong_induct) case (t_Var \1 x T) (* variable case *) - have "\1 \ \2" by fact + have "\1 \ \2" by fact moreover have "valid \2" by fact moreover @@ -85,46 +85,47 @@ next case (t_Lam x \1 T1 t T2) (* lambda case *) have vc: "x\\2" by fact (* variable convention *) - have ih: "\\3. \valid \3; ((x,T1)#\1) \ \3\ \ \3 \ t:T2" by fact - have "\1 \ \2" by fact - then have "((x,T1)#\1) \ ((x,T1)#\2)" by simp + have ih: "\valid ((x,T1)#\2); (x,T1)#\1 \ (x,T1)#\2\ \ (x,T1)#\2 \ t:T2" by fact + have "\1 \ \2" by fact + then have "(x,T1)#\1 \ (x,T1)#\2" by simp moreover have "valid \2" by fact then have "valid ((x,T1)#\2)" using vc by (simp add: v2) - ultimately have "((x,T1)#\2) \ t:T2" using ih by simp - with vc show "\2 \ (Lam [x].t) : T1\T2" by auto + ultimately have "(x,T1)#\2 \ t : T2" using ih by simp + with vc show "\2 \ Lam [x].t : T1\T2" by auto qed (auto) (* app case *) lemma weakening_version3: assumes a: "\1 \ t : T" and b: "valid \2" - and c: "\1 \ \2" + and c: "\1 \ \2" shows "\2 \ t : T" using a b c proof (nominal_induct \1 t T avoiding: \2 rule: typing.strong_induct) case (t_Lam x \1 T1 t T2) (* lambda case *) have vc: "x\\2" by fact (* variable convention *) - have ih: "\\3. \valid \3; ((x,T1)#\1) \ \3\ \ \3 \ t : T2" by fact - have "\1 \ \2" by fact - then have "((x,T1)#\1) \ ((x,T1)#\2)" by simp + have ih: "\\3. \valid \3; (x,T1)#\1 \ \3\ \ \3 \ t : T2" by fact + have "\1 \ \2" by fact + then have "(x,T1)#\1 \ (x,T1)#\2" by simp moreover have "valid \2" by fact then have "valid ((x,T1)#\2)" using vc by (simp add: v2) - ultimately have "((x,T1)#\2) \ t : T2" using ih by simp - with vc show "\2 \ (Lam [x].t) : T1 \ T2" by auto + ultimately have "(x,T1)#\2 \ t : T2" using ih by simp + with vc show "\2 \ Lam [x].t : T1 \ T2" by auto qed (auto) (* app and var case *) text{* The original induction principle for the typing relation - is not strong enough - even this simple lemma fails: *} + is not strong enough - even this simple lemma fails to be simple ;o) *} + lemma weakening_too_weak: assumes a: "\1 \ t : T" and b: "valid \2" - and c: "\1 \ \2" + and c: "\1 \ \2" shows "\2 \ t : T" using a b c proof (induct arbitrary: \2) - case (t_Var \1 x T) (* variable case *) - have "\1 \ \2" by fact + case (t_Var \1 x T) (* variable case works *) + have "\1 \ \2" by fact moreover have "valid \2" by fact moreover @@ -134,11 +135,11 @@ case (t_Lam x \1 T1 t T2) (* lambda case *) (* all assumptions available in this case*) have a0: "x\\1" by fact - have a1: "((x,T1)#\1) \ t : T2" by fact - have a2: "\1 \ \2" by fact + have a1: "(x,T1)#\1 \ t : T2" by fact + have a2: "\1 \ \2" by fact have a3: "valid \2" by fact - have ih: "\\3. \valid \3; ((x,T1)#\1) \ \3\ \ \3 \ t : T2" by fact - have "((x,T1)#\1) \ ((x,T1)#\2)" using a2 by simp + have ih: "\\3. \valid \3; (x,T1)#\1 \ \3\ \ \3 \ t : T2" by fact + have "(x,T1)#\1 \ (x,T1)#\2" using a2 by simp moreover have "valid ((x,T1)#\2)" using v2 (* fails *) oops diff -r 6cf96b9f7b9e -r 0c5b22076fb3 src/HOL/Nominal/Nominal.thy --- a/src/HOL/Nominal/Nominal.thy Thu Apr 12 15:35:29 2007 +0200 +++ b/src/HOL/Nominal/Nominal.thy Thu Apr 12 15:46:12 2007 +0200 @@ -2309,7 +2309,6 @@ assumes pt: "pt TYPE('a) TYPE('x)" and at: "at TYPE('x)" and fs: "fs TYPE('a) TYPE('x)" - and a: "a\xs" shows "a\(set xs) = a\xs" by (simp add: fresh_def pt_list_set_supp[OF pt, OF at, OF fs])