# HG changeset patch # User paulson # Date 1713864364 -3600 # Node ID 378593bf510950032638c24528a96afe565c706d # Parent 34e0ddfc6dcccaff7d3c9e9b9ff28d02f71e3ace Tidying up another of the nominal examples diff -r 34e0ddfc6dcc -r 378593bf5109 src/HOL/Nominal/Examples/SN.thy --- a/src/HOL/Nominal/Examples/SN.thy Mon Apr 22 22:08:28 2024 +0100 +++ b/src/HOL/Nominal/Examples/SN.thy Tue Apr 23 10:26:04 2024 +0100 @@ -88,9 +88,8 @@ assumes a: "t\\<^sub>\ s" shows "a\t \ a\s" using a -apply(nominal_induct t s avoiding: a rule: Beta.strong_induct) -apply(auto simp add: abs_fresh fresh_fact fresh_atm) -done + by (nominal_induct t s avoiding: a rule: Beta.strong_induct) + (auto simp add: abs_fresh fresh_fact fresh_atm) lemma beta_abs: assumes a: "Lam [a].t\\<^sub>\ t'" @@ -200,13 +199,8 @@ thus ?case proof (induct b rule: SN.SN.induct) case (SN_intro y) - show ?case - apply (rule hyp) - apply (erule SNI') - apply (erule SNI') - apply (rule SN.SN_intro) - apply (erule SN_intro)+ - done + with SNI' show ?case + by (metis SN.simps hyp) qed qed from b show ?thesis by (rule r) @@ -218,10 +212,7 @@ and c: "\x z. \\y. x \\<^sub>\ y \ P y z; \u. z \\<^sub>\ u \ P x u\ \ P x z" shows "P a b" using a b c -apply(rule_tac double_SN_aux) -apply(assumption)+ -apply(blast) -done + by (smt (verit, best) double_SN_aux) section \Candidates\ @@ -249,11 +240,7 @@ "fst_app_aux (Var a) = None" | "fst_app_aux (App t1 t2) = Some t1" | "fst_app_aux (Lam [x].t) = None" -apply(finite_guess)+ -apply(rule TrueI)+ -apply(simp add: fresh_none) -apply(fresh_guess)+ -done +by (finite_guess | simp add: fresh_none | fresh_guess)+ definition fst_app_def[simp]: "fst_app t = the (fst_app_aux t)" @@ -425,66 +412,40 @@ fix t u assume ih1: "\t'. \t \\<^sub>\ t'; u\RED \; \s\RED \. t'[x::=s]\RED \\ \ App (Lam [x].t') u \ RED \" assume ih2: "\u'. \u \\<^sub>\ u'; u'\RED \; \s\RED \. t[x::=s]\RED \\ \ App (Lam [x].t) u' \ RED \" - assume as1: "u \ RED \" - assume as2: "\s\RED \. t[x::=s]\RED \" + assume u: "u \ RED \" + assume t: "\s\RED \. t[x::=s]\RED \" have "CR3_RED (App (Lam [x].t) u) \" unfolding CR3_RED_def proof(intro strip) fix r assume red: "App (Lam [x].t) u \\<^sub>\ r" moreover { assume "\t'. t \\<^sub>\ t' \ r = App (Lam [x].t') u" - then obtain t' where a1: "t \\<^sub>\ t'" and a2: "r = App (Lam [x].t') u" by blast - have "App (Lam [x].t') u\RED \" using ih1 a1 as1 as2 - apply(auto) - apply(drule_tac x="t'" in meta_spec) - apply(simp) - apply(drule meta_mp) - prefer 2 - apply(auto)[1] - apply(rule ballI) - apply(drule_tac x="s" in bspec) - apply(simp) - apply(subgoal_tac "CR2 \")(*A*) - apply(unfold CR2_def)[1] - apply(drule_tac x="t[x::=s]" in spec) - apply(drule_tac x="t'[x::=s]" in spec) - apply(simp add: beta_subst) - (*A*) - apply(simp add: RED_props) - done - then have "r\RED \" using a2 by simp + then obtain t' where "t \\<^sub>\ t'" and t': "r = App (Lam [x].t') u" + by blast + then have "\s\RED \. t'[x::=s] \ RED \" + using CR2_def RED_props(2) t beta_subst by blast + then have "App (Lam [x].t') u\RED \" + using \t \\<^sub>\ t'\ u ih1 by blast + then have "r\RED \" using t' by simp } moreover { assume "\u'. u \\<^sub>\ u' \ r = App (Lam [x].t) u'" - then obtain u' where b1: "u \\<^sub>\ u'" and b2: "r = App (Lam [x].t) u'" by blast - have "App (Lam [x].t) u'\RED \" using ih2 b1 as1 as2 - apply(auto) - apply(drule_tac x="u'" in meta_spec) - apply(simp) - apply(drule meta_mp) - apply(subgoal_tac "CR2 \") - apply(unfold CR2_def)[1] - apply(drule_tac x="u" in spec) - apply(drule_tac x="u'" in spec) - apply(simp) - apply(simp add: RED_props) - apply(simp) - done - then have "r\RED \" using b2 by simp + then obtain u' where "u \\<^sub>\ u'" and u': "r = App (Lam [x].t) u'" by blast + have "CR2 \" + by (simp add: RED_props(2)) + then + have "App (Lam [x].t) u'\RED \" + using CR2_def ih2 \u \\<^sub>\ u'\ t u by blast + then have "r\RED \" using u' by simp } moreover { assume "r = t[x::=u]" - then have "r\RED \" using as1 as2 by auto + then have "r\RED \" using u t by auto } - ultimately show "r \ RED \" + ultimately show "r \ RED \" + by cases (auto simp: alpha subst_rename lam.inject dest: beta_abs) (* one wants to use the strong elimination principle; for this one has to know that x\u *) - apply(cases) - apply(auto simp add: lam.inject) - apply(drule beta_abs) - apply(auto)[1] - apply(auto simp add: alpha subst_rename) - done qed moreover have "NEUT (App (Lam [x].t) u)" unfolding NEUT_def by (auto) @@ -545,18 +506,9 @@ lemma id_closes: shows "(id \) closes \" -apply(auto) -apply(simp add: id_maps) -apply(subgoal_tac "CR3 T") \ \A\ -apply(drule CR3_implies_CR4) -apply(simp add: CR4_def) -apply(drule_tac x="Var x" in spec) -apply(force simp add: NEUT_def NORMAL_Var) -\ \A\ -apply(rule RED_props) -done + by (metis CR3_implies_CR4 CR4_def NEUT_def NORMAL_Var RED_props(3) id_maps) -lemma typing_implies_RED: +lemma typing_implies_RED: assumes a: "\ \ t : \" shows "t \ RED \" proof -