# HG changeset patch # User berghofe # Date 1263145425 -3600 # Node ID 7894c7dab1328f3e9c3890a00770b4299b3a569d # Parent e391c3de0f6bd741a74b0df88d6b5d9e04cb3637 Adapted to changes in induct method. diff -r e391c3de0f6b -r 7894c7dab132 src/HOL/Algebra/UnivPoly.thy --- a/src/HOL/Algebra/UnivPoly.thy Sun Jan 10 18:41:07 2010 +0100 +++ b/src/HOL/Algebra/UnivPoly.thy Sun Jan 10 18:43:45 2010 +0100 @@ -1581,14 +1581,10 @@ { (*JE: we now apply the induction hypothesis with some additional facts required*) from f_in_P deg_g_le_deg_f show ?thesis - proof (induct n \ "deg R f" arbitrary: "f" rule: nat_less_induct) - fix n f - assume hypo: "\mx. x \ carrier P \ - deg R g \ deg R x \ - m = deg R x \ - (\q r (k::nat). q \ carrier P \ r \ carrier P \ lcoeff g (^) k \\<^bsub>P\<^esub> x = g \\<^bsub>P\<^esub> q \\<^bsub>P\<^esub> r & (r = \\<^bsub>P\<^esub> | deg R r < deg R g))" - and prem: "n = deg R f" and f_in_P [simp]: "f \ carrier P" - and deg_g_le_deg_f: "deg R g \ deg R f" + proof (induct "deg R f" arbitrary: "f" rule: less_induct) + case less + note f_in_P [simp] = `f \ carrier P` + and deg_g_le_deg_f = `deg R g \ deg R f` let ?k = "1::nat" and ?r = "(g \\<^bsub>P\<^esub> (monom P (lcoeff f) (deg R f - deg R g))) \\<^bsub>P\<^esub> \\<^bsub>P\<^esub> (lcoeff g \\<^bsub>P\<^esub> f)" and ?q = "monom P (lcoeff f) (deg R f - deg R g)" show "\ q r (k::nat). q \ carrier P \ r \ carrier P \ lcoeff g (^) k \\<^bsub>P\<^esub> f = g \\<^bsub>P\<^esub> q \\<^bsub>P\<^esub> r & (r = \\<^bsub>P\<^esub> | deg R r < deg R g)" @@ -1631,13 +1627,13 @@ { (*JE: now it only remains the case where the induction hypothesis can be used.*) (*JE: we first prove that the degree of the remainder is smaller than the one of f*) - have deg_remainder_l_f: "deg R (\\<^bsub>P\<^esub> ?r) < n" + have deg_remainder_l_f: "deg R (\\<^bsub>P\<^esub> ?r) < deg R f" proof - have "deg R (\\<^bsub>P\<^esub> ?r) = deg R ?r" using deg_uminus [of ?r] by simp also have "\ < deg R f" proof (rule deg_lcoeff_cancel) show "deg R (\\<^bsub>P\<^esub> (lcoeff g \\<^bsub>P\<^esub> f)) \ deg R f" - using deg_smult_ring [of "lcoeff g" f] using prem + using deg_smult_ring [of "lcoeff g" f] using lcoeff_nonzero2 [OF g_in_P g_not_zero] by simp show "deg R (g \\<^bsub>P\<^esub> ?q) \ deg R f" using monom_deg_mult [OF _ g_in_P, of f "lcoeff f"] and deg_g_le_deg_f @@ -1651,7 +1647,7 @@ using R.finsum_singleton [of "deg R g" "{.. deg R f}" "(\i. coeff P g i \ lcoeff f)"] unfolding Pi_def using deg_g_le_deg_f by force qed (simp_all add: deg_f_nzero) - finally show "deg R (\\<^bsub>P\<^esub> ?r) < n" unfolding prem . + finally show "deg R (\\<^bsub>P\<^esub> ?r) < deg R f" . qed moreover have "\\<^bsub>P\<^esub> ?r \ carrier P" by simp moreover obtain m where deg_rem_eq_m: "deg R (\\<^bsub>P\<^esub> ?r) = m" by auto @@ -1660,7 +1656,7 @@ ultimately obtain q' r' k' where rem_desc: "lcoeff g (^) (k'::nat) \\<^bsub>P\<^esub> (\\<^bsub>P\<^esub> ?r) = g \\<^bsub>P\<^esub> q' \\<^bsub>P\<^esub> r'"and rem_deg: "(r' = \\<^bsub>P\<^esub> \ deg R r' < deg R g)" and q'_in_carrier: "q' \ carrier P" and r'_in_carrier: "r' \ carrier P" - using hypo by blast + using less by blast (*JE: we now prove that the new quotient, remainder and exponent can be used to get the quotient, remainder and exponent of the long division theorem*) show ?thesis diff -r e391c3de0f6b -r 7894c7dab132 src/HOL/Bali/Basis.thy --- a/src/HOL/Bali/Basis.thy Sun Jan 10 18:41:07 2010 +0100 +++ b/src/HOL/Bali/Basis.thy Sun Jan 10 18:43:45 2010 +0100 @@ -1,7 +1,5 @@ (* Title: HOL/Bali/Basis.thy - ID: $Id$ Author: David von Oheimb - *) header {* Definitions extending HOL as logical basis of Bali *} @@ -66,8 +64,6 @@ "\ \ a b c. \(a,b)\r; (a,c)\r\ \ b=c; (a,x)\r\<^sup>*; (a,y)\r\<^sup>*\ \ (x,y)\r\<^sup>* \ (y,x)\r\<^sup>*" proof - - note converse_rtrancl_induct = converse_rtrancl_induct [consumes 1] - note converse_rtranclE = converse_rtranclE [consumes 1] assume unique: "\ a b c. \(a,b)\r; (a,c)\r\ \ b=c" assume "(a,x)\r\<^sup>*" then show "(a,y)\r\<^sup>* \ (x,y)\r\<^sup>* \ (y,x)\r\<^sup>*" @@ -110,13 +106,6 @@ apply (auto dest: rtrancl_into_trancl1) done -(* ### To Transitive_Closure *) -theorems converse_rtrancl_induct - = converse_rtrancl_induct [consumes 1,case_names Id Step] - -theorems converse_trancl_induct - = converse_trancl_induct [consumes 1,case_names Single Step] - (* context (theory "Set") *) lemma Ball_weaken:"\Ball s P;\ x. P x\Q x\\Ball s Q" by auto diff -r e391c3de0f6b -r 7894c7dab132 src/HOL/Bali/DeclConcepts.thy --- a/src/HOL/Bali/DeclConcepts.thy Sun Jan 10 18:41:07 2010 +0100 +++ b/src/HOL/Bali/DeclConcepts.thy Sun Jan 10 18:43:45 2010 +0100 @@ -1,5 +1,4 @@ (* Title: HOL/Bali/DeclConcepts.thy - ID: $Id$ Author: Norbert Schirmer *) header {* Advanced concepts on Java declarations like overriding, inheritance, @@ -2282,74 +2281,47 @@ done lemma superclasses_mono: -"\G\C \\<^sub>C D;ws_prog G; class G C = Some c; - \ C c. \class G C = Some c;C\Object\ \ \ sc. class G (super c) = Some sc; - x\superclasses G D -\ \ x\superclasses G C" -proof - - - assume ws: "ws_prog G" and - cls_C: "class G C = Some c" and - wf: "\C c. \class G C = Some c; C \ Object\ - \ \sc. class G (super c) = Some sc" - assume clsrel: "G\C\\<^sub>C D" - thus "\ c. \class G C = Some c; x\superclasses G D\\ - x\superclasses G C" (is "PROP ?P C" - is "\ c. ?CLS C c \ ?SUP D \ ?SUP C") - proof (induct ?P C rule: converse_trancl_induct) - fix C c - assume "G\C\\<^sub>C\<^sub>1D" "class G C = Some c" "x \ superclasses G D" - with wf ws show "?SUP C" - by (auto intro: no_subcls1_Object - simp add: superclasses_rec subcls1_def) - next - fix C S c - assume clsrel': "G\C \\<^sub>C\<^sub>1 S" "G\S \\<^sub>C D" - and hyp : "\ s. \class G S = Some s; x \ superclasses G D\ - \ x \ superclasses G S" - and cls_C': "class G C = Some c" - and x: "x \ superclasses G D" - moreover note wf ws - moreover from calculation - have "?SUP S" - by (force intro: no_subcls1_Object simp add: subcls1_def) - moreover from calculation - have "super c = S" - by (auto intro: no_subcls1_Object simp add: subcls1_def) - ultimately show "?SUP C" - by (auto intro: no_subcls1_Object simp add: superclasses_rec) - qed + assumes clsrel: "G\C\\<^sub>C D" + and ws: "ws_prog G" + and cls_C: "class G C = Some c" + and wf: "\C c. \class G C = Some c; C \ Object\ + \ \sc. class G (super c) = Some sc" + and x: "x\superclasses G D" + shows "x\superclasses G C" using clsrel cls_C x +proof (induct arbitrary: c rule: converse_trancl_induct) + case (base C) + with wf ws show ?case + by (auto intro: no_subcls1_Object + simp add: superclasses_rec subcls1_def) +next + case (step C S) + moreover note wf ws + moreover from calculation + have "x\superclasses G S" + by (force intro: no_subcls1_Object simp add: subcls1_def) + moreover from calculation + have "super c = S" + by (auto intro: no_subcls1_Object simp add: subcls1_def) + ultimately show ?case + by (auto intro: no_subcls1_Object simp add: superclasses_rec) qed lemma subclsEval: -"\G\C \\<^sub>C D;ws_prog G; class G C = Some c; - \ C c. \class G C = Some c;C\Object\ \ \ sc. class G (super c) = Some sc - \ \ D\superclasses G C" -proof - - note converse_trancl_induct - = converse_trancl_induct [consumes 1,case_names Single Step] - assume - ws: "ws_prog G" and - cls_C: "class G C = Some c" and - wf: "\C c. \class G C = Some c; C \ Object\ - \ \sc. class G (super c) = Some sc" - assume clsrel: "G\C\\<^sub>C D" - thus "\ c. class G C = Some c\ D\superclasses G C" - (is "PROP ?P C" is "\ c. ?CLS C c \ ?SUP C") - proof (induct ?P C rule: converse_trancl_induct) - fix C c - assume "G\C \\<^sub>C\<^sub>1 D" "class G C = Some c" - with ws wf show "?SUP C" - by (auto intro: no_subcls1_Object simp add: superclasses_rec subcls1_def) - next - fix C S c - assume "G\C \\<^sub>C\<^sub>1 S" "G\S\\<^sub>C D" - "\s. class G S = Some s \ D \ superclasses G S" - "class G C = Some c" - with ws wf show "?SUP C" - by - (rule superclasses_mono, - auto dest: no_subcls1_Object simp add: subcls1_def ) - qed + assumes clsrel: "G\C\\<^sub>C D" + and ws: "ws_prog G" + and cls_C: "class G C = Some c" + and wf: "\C c. \class G C = Some c; C \ Object\ + \ \sc. class G (super c) = Some sc" + shows "D\superclasses G C" using clsrel cls_C +proof (induct arbitrary: c rule: converse_trancl_induct) + case (base C) + with ws wf show ?case + by (auto intro: no_subcls1_Object simp add: superclasses_rec subcls1_def) +next + case (step C S) + with ws wf show ?case + by - (rule superclasses_mono, + auto dest: no_subcls1_Object simp add: subcls1_def ) qed end diff -r e391c3de0f6b -r 7894c7dab132 src/HOL/Bali/WellForm.thy --- a/src/HOL/Bali/WellForm.thy Sun Jan 10 18:41:07 2010 +0100 +++ b/src/HOL/Bali/WellForm.thy Sun Jan 10 18:43:45 2010 +0100 @@ -1,5 +1,4 @@ (* Title: HOL/Bali/WellForm.thy - ID: $Id$ Author: David von Oheimb and Norbert Schirmer *) @@ -1409,8 +1408,7 @@ from clsC ws show "methd G C sig = Some m \ G\(mdecl (sig,mthd m)) declared_in (declclass m)" - (is "PROP ?P C") - proof (induct ?P C rule: ws_class_induct') + proof (induct C rule: ws_class_induct') case Object assume "methd G Object sig = Some m" with wf show ?thesis @@ -1755,28 +1753,20 @@ lemma ballE': "\x\A. P x \ (x \ A \ Q) \ (P x \ Q) \ Q" by blast lemma subint_widen_imethds: - "\G\I\I J; wf_prog G; is_iface G J; jm \ imethds G J sig\ \ - \ im \ imethds G I sig. is_static im = is_static jm \ + assumes irel: "G\I\I J" + and wf: "wf_prog G" + and is_iface: "is_iface G J" + and jm: "jm \ imethds G J sig" + shows "\im \ imethds G I sig. is_static im = is_static jm \ accmodi im = accmodi jm \ G\resTy im\resTy jm" -proof - - assume irel: "G\I\I J" and - wf: "wf_prog G" and - is_iface: "is_iface G J" - from irel show "jm \ imethds G J sig \ ?thesis" - (is "PROP ?P I" is "PROP ?Prem J \ ?Concl I") - proof (induct ?P I rule: converse_rtrancl_induct) - case Id - assume "jm \ imethds G J sig" - then show "?Concl J" by (blast elim: bexI') + using irel jm +proof (induct rule: converse_rtrancl_induct) + case base + then show ?case by (blast elim: bexI') next - case Step - fix I SI - assume subint1_I_SI: "G\I \I1 SI" and - subint_SI_J: "G\SI \I J" and - hyp: "PROP ?P SI" and - jm: "jm \ imethds G J sig" - from subint1_I_SI + case (step I SI) + from `G\I \I1 SI` obtain i where ifI: "iface G I = Some i" and SI: "SI \ set (isuperIfs i)" @@ -1784,10 +1774,10 @@ let ?newMethods = "(Option.set \ table_of (map (\(sig, mh). (sig, I, mh)) (imethods i)))" - show "?Concl I" + show ?case proof (cases "?newMethods sig = {}") case True - with ifI SI hyp wf jm + with ifI SI step wf show "?thesis" by (auto simp add: imethds_rec) next @@ -1816,7 +1806,7 @@ wf_SI: "wf_idecl G (SI,si)" by (auto dest!: wf_idecl_supD is_acc_ifaceD dest: wf_prog_idecl) - from jm hyp + from step obtain sim::"qtname \ mhead" where sim: "sim \ imethds G SI sig" and eq_static_sim_jm: "is_static sim = is_static jm" and @@ -1841,7 +1831,6 @@ show ?thesis by auto qed - qed qed (* Tactical version *) @@ -1974,30 +1963,20 @@ from clsC ws show "\ m d. \methd G C sig = Some m; class G (declclass m) = Some d\ \ table_of (methods d) sig = Some (mthd m)" - (is "PROP ?P C") - proof (induct ?P C rule: ws_class_induct) + proof (induct rule: ws_class_induct) case Object - fix m d - assume "methd G Object sig = Some m" - "class G (declclass m) = Some d" with wf show "?thesis m d" by auto next - case Subcls - fix C c m d - assume hyp: "PROP ?P (super c)" - and m: "methd G C sig = Some m" - and declC: "class G (declclass m) = Some d" - and clsC: "class G C = Some c" - and nObj: "C \ Object" + case (Subcls C c) let ?newMethods = "table_of (map (\(s, m). (s, C, m)) (methods c)) sig" show "?thesis m d" proof (cases "?newMethods") case None - from None clsC nObj ws m declC - show "?thesis" by (auto simp add: methd_rec) (rule hyp) + from None ws Subcls + show "?thesis" by (auto simp add: methd_rec) (rule Subcls) next case Some - from Some clsC nObj ws m declC + from Some ws Subcls show "?thesis" by (auto simp add: methd_rec dest: wf_prog_cdecl wf_cdecl_supD is_acc_class_is_class) diff -r e391c3de0f6b -r 7894c7dab132 src/HOL/Code_Numeral.thy --- a/src/HOL/Code_Numeral.thy Sun Jan 10 18:41:07 2010 +0100 +++ b/src/HOL/Code_Numeral.thy Sun Jan 10 18:43:45 2010 +0100 @@ -83,7 +83,7 @@ then have "\n. P (of_nat n) \ P (Suc_code_numeral (of_nat n))" . then have step: "\n. P (of_nat n) \ P (of_nat (Suc n))" by simp from init step have "P (of_nat (nat_of k))" - by (induct "nat_of k") simp_all + by (induct ("nat_of k")) simp_all then show "P k" by simp qed simp_all @@ -100,7 +100,7 @@ fix k have "code_numeral_size k = nat_size (nat_of k)" by (induct k rule: code_numeral.induct) (simp_all del: zero_code_numeral_def Suc_code_numeral_def, simp_all) - also have "nat_size (nat_of k) = nat_of k" by (induct "nat_of k") simp_all + also have "nat_size (nat_of k) = nat_of k" by (induct ("nat_of k")) simp_all finally show "code_numeral_size k = nat_of k" . qed diff -r e391c3de0f6b -r 7894c7dab132 src/HOL/Decision_Procs/Reflected_Multivariate_Polynomial.thy --- a/src/HOL/Decision_Procs/Reflected_Multivariate_Polynomial.thy Sun Jan 10 18:41:07 2010 +0100 +++ b/src/HOL/Decision_Procs/Reflected_Multivariate_Polynomial.thy Sun Jan 10 18:43:45 2010 +0100 @@ -987,16 +987,14 @@ assumes nq: "isnpolyh p n0" and eq :"\bs. wf_bs bs p \ \p\\<^sub>p\<^bsup>bs\<^esup> = (0::'a::{ring_char_0,power,division_by_zero,field})" shows "p = 0\<^sub>p" using nq eq -proof (induct n\"maxindex p" arbitrary: p n0 rule: nat_less_induct) - fix n p n0 - assume H: "\mp n0. isnpolyh p n0 \ - (\bs. wf_bs bs p \ \p\\<^sub>p\<^bsup>bs\<^esup> = (0::'a)) \ m = maxindex p \ p = 0\<^sub>p" - and np: "isnpolyh p n0" and zp: "\bs. wf_bs bs p \ \p\\<^sub>p\<^bsup>bs\<^esup> = (0::'a)" and n: "n = maxindex p" - {assume nz: "n = 0" - then obtain c where "p = C c" using n np by (cases p, auto) +proof (induct "maxindex p" arbitrary: p n0 rule: less_induct) + case less + note np = `isnpolyh p n0` and zp = `\bs. wf_bs bs p \ \p\\<^sub>p\<^bsup>bs\<^esup> = (0::'a)` + {assume nz: "maxindex p = 0" + then obtain c where "p = C c" using np by (cases p, auto) with zp np have "p = 0\<^sub>p" unfolding wf_bs_def by simp} moreover - {assume nz: "n \ 0" + {assume nz: "maxindex p \ 0" let ?h = "head p" let ?hd = "decrpoly ?h" let ?ihd = "maxindex ?hd" @@ -1005,24 +1003,23 @@ hence nhd: "isnpolyh ?hd (n0 - 1)" using decrpoly_normh by blast from maxindex_coefficients[of p] coefficients_head[of p, symmetric] - have mihn: "maxindex ?h \ n" unfolding n by auto - with decr_maxindex[OF h(2)] nz have ihd_lt_n: "?ihd < n" by auto + have mihn: "maxindex ?h \ maxindex p" by auto + with decr_maxindex[OF h(2)] nz have ihd_lt_n: "?ihd < maxindex p" by auto {fix bs:: "'a list" assume bs: "wf_bs bs ?hd" let ?ts = "take ?ihd bs" let ?rs = "drop ?ihd bs" have ts: "wf_bs ?ts ?hd" using bs unfolding wf_bs_def by simp have bs_ts_eq: "?ts@ ?rs = bs" by simp from wf_bs_decrpoly[OF ts] have tsh: " \x. wf_bs (x#?ts) ?h" by simp - from ihd_lt_n have "ALL x. length (x#?ts) \ n" by simp - with length_le_list_ex obtain xs where xs:"length ((x#?ts) @ xs) = n" by blast - hence "\ x. wf_bs ((x#?ts) @ xs) p" using n unfolding wf_bs_def by simp + from ihd_lt_n have "ALL x. length (x#?ts) \ maxindex p" by simp + with length_le_list_ex obtain xs where xs:"length ((x#?ts) @ xs) = maxindex p" by blast + hence "\ x. wf_bs ((x#?ts) @ xs) p" unfolding wf_bs_def by simp with zp have "\ x. Ipoly ((x#?ts) @ xs) p = 0" by blast hence "\ x. Ipoly (x#(?ts @ xs)) p = 0" by simp with polypoly_poly[OF np, where ?'a = 'a] polypoly_polypoly'[OF np, where ?'a = 'a] have "\x. poly (polypoly' (?ts @ xs) p) x = poly [] x" by simp hence "poly (polypoly' (?ts @ xs) p) = poly []" by (auto intro: ext) hence "\ c \ set (coefficients p). Ipoly (?ts @ xs) (decrpoly c) = 0" - thm poly_zero using poly_zero[where ?'a='a] by (simp add: polypoly'_def list_all_iff) with coefficients_head[of p, symmetric] have th0: "Ipoly (?ts @ xs) ?hd = 0" by simp @@ -1031,7 +1028,7 @@ with wf'' wf_bs_I[of ?ts ?hd ?rs] bs_ts_eq have "\?hd\\<^sub>p\<^bsup>bs\<^esup> = 0" by simp } then have hdz: "\bs. wf_bs bs ?hd \ \?hd\\<^sub>p\<^bsup>bs\<^esup> = (0::'a)" by blast - from H[rule_format, OF ihd_lt_n nhd] hdz have "?hd = 0\<^sub>p" by blast + from less(1)[OF ihd_lt_n nhd] hdz have "?hd = 0\<^sub>p" by blast hence "?h = 0\<^sub>p" by simp with head_nz[OF np] have "p = 0\<^sub>p" by simp} ultimately show "p = 0\<^sub>p" by blast @@ -1357,8 +1354,8 @@ (polydivide_aux (a,n,p,k,s) = (k',r) \ (k' \ k) \ (degree r = 0 \ degree r < degree p) \ (\nr. isnpolyh r nr) \ (\q n1. isnpolyh q n1 \ ((polypow (k' - k) a) *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)))" using ns -proof(induct d\"degree s" arbitrary: s k k' r n1 rule: nat_less_induct) - fix d s k k' r n1 +proof(induct "degree s" arbitrary: s k k' r n1 rule: less_induct) + case less let ?D = "polydivide_aux_dom" let ?dths = "?D (a, n, p, k, s)" let ?qths = "\q n1. isnpolyh q n1 \ (a ^\<^sub>p (k' - k) *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)" @@ -1366,20 +1363,13 @@ \ (\nr. isnpolyh r nr) \ ?qths" let ?ths = "?dths \ ?qrths" let ?b = "head s" - let ?p' = "funpow (d - n) shift1 p" - let ?xdn = "funpow (d - n) shift1 1\<^sub>p" + let ?p' = "funpow (degree s - n) shift1 p" + let ?xdn = "funpow (degree s - n) shift1 1\<^sub>p" let ?akk' = "a ^\<^sub>p (k' - k)" - assume H: "\mx xa xb xc xd. - isnpolyh x xd \ - m = degree x \ ?D (a, n, p, xa, x) \ - (polydivide_aux (a, n, p, xa, x) = (xb, xc) \ - xa \ xb \ (degree xc = 0 \ degree xc < degree p) \ - (\ nr. isnpolyh xc nr) \ - (\q n1. isnpolyh q n1 \ a ^\<^sub>p xb - xa *\<^sub>p x = p *\<^sub>p q +\<^sub>p xc))" - and ns: "isnpolyh s n1" and ds: "d = degree s" + note ns = `isnpolyh s n1` from np have np0: "isnpolyh p 0" using isnpolyh_mono[where n="n0" and n'="0" and p="p"] by simp - have np': "isnpolyh ?p' 0" using funpow_shift1_isnpoly[OF np0[simplified isnpoly_def[symmetric]] pnz, where n="d -n"] isnpoly_def by simp + have np': "isnpolyh ?p' 0" using funpow_shift1_isnpoly[OF np0[simplified isnpoly_def[symmetric]] pnz, where n="degree s - n"] isnpoly_def by simp have headp': "head ?p' = head p" using funpow_shift1_head[OF np pnz] by simp from funpow_shift1_isnpoly[where p="1\<^sub>p"] have nxdn: "isnpolyh ?xdn 0" by (simp add: isnpoly_def) from polypow_normh [OF head_isnpolyh[OF np0], where k="k' - k"] ap @@ -1391,31 +1381,31 @@ hence ?ths using dom by blast} moreover {assume sz: "s \ 0\<^sub>p" - {assume dn: "d < n" - with sz ds have dom:"?dths" by - (rule polydivide_aux_real_domintros,simp_all) - from polydivide_aux.psimps[OF dom] sz dn ds + {assume dn: "degree s < n" + with sz have dom:"?dths" by - (rule polydivide_aux_real_domintros,simp_all) + from polydivide_aux.psimps[OF dom] sz dn have "?qrths" using ns ndp np by auto (rule exI[where x="0\<^sub>p"],simp) with dom have ?ths by blast} moreover - {assume dn': "\ d < n" hence dn: "d \ n" by arith + {assume dn': "\ degree s < n" hence dn: "degree s \ n" by arith have degsp': "degree s = degree ?p'" - using ds dn ndp funpow_shift1_degree[where k = "d - n" and p="p"] by simp + using dn ndp funpow_shift1_degree[where k = "degree s - n" and p="p"] by simp {assume ba: "?b = a" hence headsp': "head s = head ?p'" using ap headp' by simp have nr: "isnpolyh (s -\<^sub>p ?p') 0" using polysub_normh[OF ns np'] by simp - from ds degree_polysub_samehead[OF ns np' headsp' degsp'] - have "degree (s -\<^sub>p ?p') < d \ s -\<^sub>p ?p' = 0\<^sub>p" by simp + from degree_polysub_samehead[OF ns np' headsp' degsp'] + have "degree (s -\<^sub>p ?p') < degree s \ s -\<^sub>p ?p' = 0\<^sub>p" by simp moreover - {assume deglt:"degree (s -\<^sub>p ?p') < d" - from H[rule_format, OF deglt nr,simplified] + {assume deglt:"degree (s -\<^sub>p ?p') < degree s" + from less(1)[OF deglt nr] have domsp: "?D (a, n, p, k, s -\<^sub>p ?p')" by blast have dom: ?dths apply (rule polydivide_aux_real_domintros) - using ba ds dn' domsp by simp_all - from polydivide_aux.psimps[OF dom] sz dn' ba ds + using ba dn' domsp by simp_all + from polydivide_aux.psimps[OF dom] sz dn' ba have eq: "polydivide_aux (a,n,p,k,s) = polydivide_aux (a,n,p,k, s -\<^sub>p ?p')" by (simp add: Let_def) {assume h1: "polydivide_aux (a, n, p, k, s) = (k', r)" - from H[rule_format, OF deglt nr, where xa = "k" and xb="k'" and xc="r", simplified] + from less(1)[OF deglt nr, of k k' r] trans[OF eq[symmetric] h1] have kk': "k \ k'" and nr:"\nr. isnpolyh r nr" and dr: "degree r = 0 \ degree r < degree p" and q1:"\q nq. isnpolyh q nq \ (a ^\<^sub>p k' - k *\<^sub>p (s -\<^sub>p ?p') = p *\<^sub>p q +\<^sub>p r)" by auto @@ -1434,19 +1424,19 @@ Ipoly bs (a^\<^sub>p (k' - k)) * Ipoly bs ?p' + Ipoly bs p * Ipoly bs q + Ipoly bs r" by (simp add: ring_simps) hence " \(bs:: 'a::{ring_char_0,division_by_zero,field} list). Ipoly bs (a ^\<^sub>p (k' - k) *\<^sub>p s) = - Ipoly bs (a^\<^sub>p (k' - k)) * Ipoly bs (funpow (d - n) shift1 1\<^sub>p *\<^sub>p p) + Ipoly bs (a^\<^sub>p (k' - k)) * Ipoly bs (funpow (degree s - n) shift1 1\<^sub>p *\<^sub>p p) + Ipoly bs p * Ipoly bs q + Ipoly bs r" by (auto simp only: funpow_shift1_1) hence "\(bs:: 'a::{ring_char_0,division_by_zero,field} list). Ipoly bs (a ^\<^sub>p (k' - k) *\<^sub>p s) = - Ipoly bs p * (Ipoly bs (a^\<^sub>p (k' - k)) * Ipoly bs (funpow (d - n) shift1 1\<^sub>p) + Ipoly bs p * (Ipoly bs (a^\<^sub>p (k' - k)) * Ipoly bs (funpow (degree s - n) shift1 1\<^sub>p) + Ipoly bs q) + Ipoly bs r" by (simp add: ring_simps) hence "\(bs:: 'a::{ring_char_0,division_by_zero,field} list). Ipoly bs (a ^\<^sub>p (k' - k) *\<^sub>p s) = - Ipoly bs (p *\<^sub>p ((a^\<^sub>p (k' - k)) *\<^sub>p (funpow (d - n) shift1 1\<^sub>p) +\<^sub>p q) +\<^sub>p r)" by simp + Ipoly bs (p *\<^sub>p ((a^\<^sub>p (k' - k)) *\<^sub>p (funpow (degree s - n) shift1 1\<^sub>p) +\<^sub>p q) +\<^sub>p r)" by simp with isnpolyh_unique[OF nakks' nqr'] have "a ^\<^sub>p (k' - k) *\<^sub>p s = - p *\<^sub>p ((a^\<^sub>p (k' - k)) *\<^sub>p (funpow (d - n) shift1 1\<^sub>p) +\<^sub>p q) +\<^sub>p r" by blast + p *\<^sub>p ((a^\<^sub>p (k' - k)) *\<^sub>p (funpow (degree s - n) shift1 1\<^sub>p) +\<^sub>p q) +\<^sub>p r" by blast hence ?qths using nq' - apply (rule_tac x="(a^\<^sub>p (k' - k)) *\<^sub>p (funpow (d - n) shift1 1\<^sub>p) +\<^sub>p q" in exI) + apply (rule_tac x="(a^\<^sub>p (k' - k)) *\<^sub>p (funpow (degree s - n) shift1 1\<^sub>p) +\<^sub>p q" in exI) apply (rule_tac x="0" in exI) by simp with kk' nr dr have "k \ k' \ (degree r = 0 \ degree r < degree p) \ (\nr. isnpolyh r nr) \ ?qths" by blast } hence ?qrths by blast @@ -1456,25 +1446,23 @@ hence domsp: "?D (a, n, p, k, s -\<^sub>p ?p')" apply (simp) by (rule polydivide_aux_real_domintros, simp_all) have dom: ?dths apply (rule polydivide_aux_real_domintros) - using ba ds dn' domsp by simp_all + using ba dn' domsp by simp_all from spz isnpolyh_unique[OF polysub_normh[OF ns np'], where q="0\<^sub>p", symmetric, where ?'a = "'a::{ring_char_0,division_by_zero,field}"] have " \(bs:: 'a::{ring_char_0,division_by_zero,field} list). Ipoly bs s = Ipoly bs ?p'" by simp hence "\(bs:: 'a::{ring_char_0,division_by_zero,field} list). Ipoly bs s = Ipoly bs (?xdn *\<^sub>p p)" using np nxdn apply simp by (simp only: funpow_shift1_1) simp hence sp': "s = ?xdn *\<^sub>p p" using isnpolyh_unique[OF ns polymul_normh[OF nxdn np]] by blast {assume h1: "polydivide_aux (a,n,p,k,s) = (k',r)" - from polydivide_aux.psimps[OF dom] sz dn' ba ds + from polydivide_aux.psimps[OF dom] sz dn' ba have eq: "polydivide_aux (a,n,p,k,s) = polydivide_aux (a,n,p,k, s -\<^sub>p ?p')" by (simp add: Let_def) also have "\ = (k,0\<^sub>p)" using polydivide_aux.psimps[OF domsp] spz by simp finally have "(k',r) = (k,0\<^sub>p)" using h1 by simp - with sp' ns np nxdn polyadd_0(1)[OF polymul_normh[OF np nxdn]] + with sp'[symmetric] ns np nxdn polyadd_0(1)[OF polymul_normh[OF np nxdn]] polyadd_0(2)[OF polymul_normh[OF np nxdn]] have ?qrths apply auto apply (rule exI[where x="?xdn"]) - apply auto - apply (rule polymul_commute) - apply simp_all + apply (auto simp add: polymul_commute[of p]) done} with dom have ?ths by blast} ultimately have ?ths by blast } @@ -1488,31 +1476,30 @@ polymul_eq0_iff[OF head_isnpolyh[OF ns] np']head_nz[OF np0] ap pnz sz head_nz[OF ns] funpow_shift1_nz[OF pnz] by simp_all from polymul_head_polyeq[OF head_isnpolyh[OF np] ns] head_nz[OF np] sz ap head_head[OF np] pnz - polymul_head_polyeq[OF head_isnpolyh[OF ns] np'] head_nz [OF ns] sz funpow_shift1_nz[OF pnz, where n="d - n"] + polymul_head_polyeq[OF head_isnpolyh[OF ns] np'] head_nz [OF ns] sz funpow_shift1_nz[OF pnz, where n="degree s - n"] have hdth: "head (a *\<^sub>p s) = head (?b *\<^sub>p ?p')" using head_head[OF ns] funpow_shift1_head[OF np pnz] polymul_commute[OF head_isnpolyh[OF np] head_isnpolyh[OF ns]] by (simp add: ap) from polymul_degreen[OF head_isnpolyh[OF np] ns, where m="0"] head_nz[OF np] pnz sz ap[symmetric] - funpow_shift1_nz[OF pnz, where n="d - n"] + funpow_shift1_nz[OF pnz, where n="degree s - n"] polymul_degreen[OF head_isnpolyh[OF ns] np', where m="0"] head_nz[OF ns] - ndp ds[symmetric] dn + ndp dn have degth: "degree (a *\<^sub>p s) = degree (?b *\<^sub>p ?p') " by (simp add: degree_eq_degreen0[symmetric] funpow_shift1_degree) - {assume dth: "degree ((a *\<^sub>p s) -\<^sub>p (?b *\<^sub>p ?p')) < d" + {assume dth: "degree ((a *\<^sub>p s) -\<^sub>p (?b *\<^sub>p ?p')) < degree s" have th: "?D (a, n, p, Suc k, (a *\<^sub>p s) -\<^sub>p (?b *\<^sub>p ?p'))" - using H[rule_format, OF dth nth, simplified] by blast - have dom: ?dths - using ba ds dn' th apply simp apply (rule polydivide_aux_real_domintros) - using ba ds dn' by simp_all + using less(1)[OF dth nth] by blast + have dom: ?dths using ba dn' th + by - (rule polydivide_aux_real_domintros, simp_all) from polysub_normh[OF polymul_normh[OF head_isnpolyh[OF np] ns] polymul_normh[OF head_isnpolyh[OF ns]np']] ap have nasbp': "isnpolyh ((a *\<^sub>p s) -\<^sub>p (?b *\<^sub>p ?p')) 0" by simp {assume h1:"polydivide_aux (a,n,p,k,s) = (k', r)" - from h1 polydivide_aux.psimps[OF dom] sz dn' ba ds + from h1 polydivide_aux.psimps[OF dom] sz dn' ba have eq:"polydivide_aux (a,n,p,Suc k,(a *\<^sub>p s) -\<^sub>p (?b *\<^sub>p ?p')) = (k',r)" by (simp add: Let_def) - with H[rule_format, OF dth nasbp', simplified, where xa="Suc k" and xb="k'" and xc="r"] + with less(1)[OF dth nasbp', of "Suc k" k' r] obtain q nq nr where kk': "Suc k \ k'" and nr: "isnpolyh r nr" and nq: "isnpolyh q nq" and dr: "degree r = 0 \ degree r < degree p" and qr: "a ^\<^sub>p (k' - Suc k) *\<^sub>p ((a *\<^sub>p s) -\<^sub>p (?b *\<^sub>p ?p')) = p *\<^sub>p q +\<^sub>p r" by auto @@ -1524,7 +1511,7 @@ hence "Ipoly bs a ^ (Suc (k' - Suc k)) * Ipoly bs s = Ipoly bs p * Ipoly bs q + Ipoly bs a ^ (k' - Suc k) * Ipoly bs ?b * Ipoly bs ?p' + Ipoly bs r" by (simp add: ring_simps power_Suc) hence "Ipoly bs a ^ (k' - k) * Ipoly bs s = Ipoly bs p * Ipoly bs q + Ipoly bs a ^ (k' - Suc k) * Ipoly bs ?b * Ipoly bs ?xdn * Ipoly bs p + Ipoly bs r" - by (simp add:kk'' funpow_shift1_1[where n="d - n" and p="p"]) + by (simp add:kk'' funpow_shift1_1[where n="degree s - n" and p="p"]) hence "Ipoly bs (a ^\<^sub>p (k' - k) *\<^sub>p s) = Ipoly bs p * (Ipoly bs q + Ipoly bs a ^ (k' - Suc k) * Ipoly bs ?b * Ipoly bs ?xdn) + Ipoly bs r" by (simp add: ring_simps)} hence ieq:"\(bs :: 'a::{ring_char_0,division_by_zero,field} list). Ipoly bs (a ^\<^sub>p (k' - k) *\<^sub>p s) = @@ -1546,13 +1533,13 @@ {assume spz: "a *\<^sub>p s -\<^sub>p (?b *\<^sub>p ?p') = 0\<^sub>p" hence domsp: "?D (a, n, p, Suc k, a *\<^sub>p s -\<^sub>p (?b *\<^sub>p ?p'))" apply (simp) by (rule polydivide_aux_real_domintros, simp_all) - have dom: ?dths using sz ba dn' ds domsp + have dom: ?dths using sz ba dn' domsp by - (rule polydivide_aux_real_domintros, simp_all) {fix bs :: "'a::{ring_char_0,division_by_zero,field} list" from isnpolyh_unique[OF nth, where ?'a="'a" and q="0\<^sub>p",simplified,symmetric] spz have "Ipoly bs (a*\<^sub>p s) = Ipoly bs ?b * Ipoly bs ?p'" by simp hence "Ipoly bs (a*\<^sub>p s) = Ipoly bs (?b *\<^sub>p ?xdn) * Ipoly bs p" - by (simp add: funpow_shift1_1[where n="d - n" and p="p"]) + by (simp add: funpow_shift1_1[where n="degree s - n" and p="p"]) hence "Ipoly bs (a*\<^sub>p s) = Ipoly bs (p *\<^sub>p (?b *\<^sub>p ?xdn))" by simp } hence hth: "\ (bs:: 'a::{ring_char_0,division_by_zero,field} list). Ipoly bs (a*\<^sub>p s) = Ipoly bs (p *\<^sub>p (?b *\<^sub>p ?xdn))" .. @@ -1562,7 +1549,7 @@ polymul_normh[OF np polymul_normh[OF head_isnpolyh[OF ns] nxdn]], simplified ap] by simp {assume h1: "polydivide_aux (a,n,p,k,s) = (k', r)" - from h1 sz ds ba dn' spz polydivide_aux.psimps[OF dom] polydivide_aux.psimps[OF domsp] + from h1 sz ba dn' spz polydivide_aux.psimps[OF dom] polydivide_aux.psimps[OF domsp] have "(k',r) = (Suc k, 0\<^sub>p)" by (simp add: Let_def) with h1 np head_isnpolyh[OF np, simplified ap] ns polymul_normh[OF head_isnpolyh[OF ns] nxdn] polymul_normh[OF np polymul_normh[OF head_isnpolyh[OF ns] nxdn]] asq @@ -1573,7 +1560,7 @@ hence ?qrths by blast with dom have ?ths by blast} ultimately have ?ths using degree_polysub_samehead[OF polymul_normh[OF head_isnpolyh[OF np0, simplified ap] ns] polymul_normh[OF head_isnpolyh[OF ns] np'] hdth degth] polymul_degreen[OF head_isnpolyh[OF np] ns, where m="0"] - head_nz[OF np] pnz sz ap[symmetric] ds[symmetric] + head_nz[OF np] pnz sz ap[symmetric] by (simp add: degree_eq_degreen0[symmetric]) blast } ultimately have ?ths by blast } diff -r e391c3de0f6b -r 7894c7dab132 src/HOL/GCD.thy --- a/src/HOL/GCD.thy Sun Jan 10 18:41:07 2010 +0100 +++ b/src/HOL/GCD.thy Sun Jan 10 18:43:45 2010 +0100 @@ -16,7 +16,7 @@ another extension of the notions to the integers, and added a number of results to "Primes" and "GCD". IntPrimes also defined and developed the congruence relations on the integers. The notion was extended to -the natural numbers by Chiaeb. +the natural numbers by Chaieb. Jeremy Avigad combined all of these, made everything uniform for the natural numbers and the integers, and added a number of new theorems. @@ -25,7 +25,7 @@ *) -header {* Greates common divisor and least common multiple *} +header {* Greatest common divisor and least common multiple *} theory GCD imports Fact Parity @@ -1074,34 +1074,35 @@ assumes c: " \a b. P (a::nat) b \ P b a" and z: "\a. P a 0" and add: "\a b. P a b \ P a (a + b)" shows "P a b" -proof(induct n\"a+b" arbitrary: a b rule: nat_less_induct) - fix n a b - assume H: "\m < n. \a b. m = a + b \ P a b" "n = a + b" +proof(induct "a + b" arbitrary: a b rule: less_induct) + case less have "a = b \ a < b \ b < a" by arith moreover {assume eq: "a= b" from add[rule_format, OF z[rule_format, of a]] have "P a b" using eq by simp} moreover {assume lt: "a < b" - hence "a + b - a < n \ a = 0" using H(2) by arith + hence "a + b - a < a + b \ a = 0" by arith moreover {assume "a =0" with z c have "P a b" by blast } moreover - {assume ab: "a + b - a < n" - have th0: "a + b - a = a + (b - a)" using lt by arith - from add[rule_format, OF H(1)[rule_format, OF ab th0]] - have "P a b" by (simp add: th0[symmetric])} + {assume "a + b - a < a + b" + also have th0: "a + b - a = a + (b - a)" using lt by arith + finally have "a + (b - a) < a + b" . + then have "P a (a + (b - a))" by (rule add[rule_format, OF less]) + then have "P a b" by (simp add: th0[symmetric])} ultimately have "P a b" by blast} moreover {assume lt: "a > b" - hence "b + a - b < n \ b = 0" using H(2) by arith + hence "b + a - b < a + b \ b = 0" by arith moreover {assume "b =0" with z c have "P a b" by blast } moreover - {assume ab: "b + a - b < n" - have th0: "b + a - b = b + (a - b)" using lt by arith - from add[rule_format, OF H(1)[rule_format, OF ab th0]] - have "P b a" by (simp add: th0[symmetric]) + {assume "b + a - b < a + b" + also have th0: "b + a - b = b + (a - b)" using lt by arith + finally have "b + (a - b) < a + b" . + then have "P b (b + (a - b))" by (rule add[rule_format, OF less]) + then have "P b a" by (simp add: th0[symmetric]) hence "P a b" using c by blast } ultimately have "P a b" by blast} ultimately show "P a b" by blast diff -r e391c3de0f6b -r 7894c7dab132 src/HOL/Induct/Common_Patterns.thy --- a/src/HOL/Induct/Common_Patterns.thy Sun Jan 10 18:41:07 2010 +0100 +++ b/src/HOL/Induct/Common_Patterns.thy Sun Jan 10 18:43:45 2010 +0100 @@ -73,7 +73,7 @@ show "P (a x)" sorry next case (Suc n) - note hyp = `\x. A (a x) \ n = a x \ P (a x)` + note hyp = `\x. n = a x \ A (a x) \ P (a x)` and prem = `A (a x)` and defn = `Suc n = a x` show "P (a x)" sorry diff -r e391c3de0f6b -r 7894c7dab132 src/HOL/Isar_Examples/Puzzle.thy --- a/src/HOL/Isar_Examples/Puzzle.thy Sun Jan 10 18:41:07 2010 +0100 +++ b/src/HOL/Isar_Examples/Puzzle.thy Sun Jan 10 18:43:45 2010 +0100 @@ -22,17 +22,16 @@ proof (rule order_antisym) { fix n show "n \ f n" - proof (induct k \ "f n" arbitrary: n rule: less_induct) - case (less k n) - then have hyp: "\m. f m < f n \ m \ f m" by (simp only:) + proof (induct "f n" arbitrary: n rule: less_induct) + case less show "n \ f n" proof (cases n) case (Suc m) from f_ax have "f (f m) < f n" by (simp only: Suc) - with hyp have "f m \ f (f m)" . + with less have "f m \ f (f m)" . also from f_ax have "\ < f n" by (simp only: Suc) finally have "f m < f n" . - with hyp have "m \ f m" . + with less have "m \ f m" . also note `\ < f n` finally have "m < f n" . then have "n \ f n" by (simp only: Suc) diff -r e391c3de0f6b -r 7894c7dab132 src/HOL/Library/Fundamental_Theorem_Algebra.thy --- a/src/HOL/Library/Fundamental_Theorem_Algebra.thy Sun Jan 10 18:41:07 2010 +0100 +++ b/src/HOL/Library/Fundamental_Theorem_Algebra.thy Sun Jan 10 18:43:45 2010 +0100 @@ -621,19 +621,18 @@ done qed -text{* Fundamental theorem of algebral *} +text{* Fundamental theorem of algebra *} lemma fundamental_theorem_of_algebra: assumes nc: "~constant(poly p)" shows "\z::complex. poly p z = 0" using nc -proof(induct n\ "psize p" arbitrary: p rule: nat_less_induct) - fix n fix p :: "complex poly" +proof(induct "psize p" arbitrary: p rule: less_induct) + case less let ?p = "poly p" - assume H: "\mp. \ constant (poly p) \ m = psize p \ (\(z::complex). poly p z = 0)" and nc: "\ constant ?p" and n: "n = psize p" let ?ths = "\z. ?p z = 0" - from nonconstant_length[OF nc] have n2: "n\ 2" by (simp add: n) + from nonconstant_length[OF less(2)] have n2: "psize p \ 2" . from poly_minimum_modulus obtain c where c: "\w. cmod (?p c) \ cmod (?p w)" by blast {assume pc: "?p c = 0" hence ?ths by blast} @@ -649,7 +648,7 @@ using h unfolding constant_def by blast also have "\ = ?p y" using th by auto finally have "?p x = ?p y" .} - with nc have False unfolding constant_def by blast } + with less(2) have False unfolding constant_def by blast } hence qnc: "\ constant (poly q)" by blast from q(2) have pqc0: "?p c = poly q 0" by simp from c pqc0 have cq0: "\w. cmod (poly q 0) \ cmod (?p w)" by simp @@ -682,8 +681,8 @@ from poly_decompose[OF rnc] obtain k a s where kas: "a\0" "k\0" "psize s + k + 1 = psize ?r" "\z. poly ?r z = poly ?r 0 + z^k* poly (pCons a s) z" by blast - {assume "k + 1 = n" - with kas(3) lgqr[symmetric] q(1) n[symmetric] have s0:"s=0" by auto + {assume "psize p = k + 1" + with kas(3) lgqr[symmetric] q(1) have s0:"s=0" by auto {fix w have "cmod (poly ?r w) = cmod (1 + a * w ^ k)" using kas(4)[rule_format, of w] s0 r01 by (simp add: algebra_simps)} @@ -691,15 +690,15 @@ from reduce_poly_simple[OF kas(1,2)] have "\w. cmod (poly ?r w) < 1" unfolding hth by blast} moreover - {assume kn: "k+1 \ n" - from kn kas(3) q(1) n[symmetric] lgqr have k1n: "k + 1 < n" by simp + {assume kn: "psize p \ k+1" + from kn kas(3) q(1) lgqr have k1n: "k + 1 < psize p" by simp have th01: "\ constant (poly (pCons 1 (monom a (k - 1))))" unfolding constant_def poly_pCons poly_monom using kas(1) apply simp by (rule exI[where x=0], rule exI[where x=1], simp) from kas(1) kas(2) have th02: "k+1 = psize (pCons 1 (monom a (k - 1)))" by (simp add: psize_def degree_monom_eq) - from H[rule_format, OF k1n th01 th02] + from less(1) [OF k1n [simplified th02] th01] obtain w where w: "1 + w^k * a = 0" unfolding poly_pCons poly_monom using kas(2) by (cases k, auto simp add: algebra_simps) diff -r e391c3de0f6b -r 7894c7dab132 src/HOL/Library/Polynomial.thy --- a/src/HOL/Library/Polynomial.thy Sun Jan 10 18:41:07 2010 +0100 +++ b/src/HOL/Library/Polynomial.thy Sun Jan 10 18:43:45 2010 +0100 @@ -1384,7 +1384,7 @@ with k have "degree p = Suc (degree k)" by (simp add: degree_mult_eq del: mult_pCons_left) with `Suc n = degree p` have "n = degree k" by simp - with `k \ 0` have "finite {x. poly k x = 0}" by (rule Suc.hyps) + then have "finite {x. poly k x = 0}" using `k \ 0` by (rule Suc.hyps) then have "finite (insert a {x. poly k x = 0})" by simp then show "finite {x. poly p x = 0}" by (simp add: k uminus_add_conv_diff Collect_disj_eq diff -r e391c3de0f6b -r 7894c7dab132 src/HOL/Library/Word.thy --- a/src/HOL/Library/Word.thy Sun Jan 10 18:41:07 2010 +0100 +++ b/src/HOL/Library/Word.thy Sun Jan 10 18:43:45 2010 +0100 @@ -436,7 +436,7 @@ show "bitval x * 2 ^ (length xs + length l2) + bv_to_nat xs * 2 ^ length l2 = (bitval x * 2 ^ length xs + bv_to_nat xs) * 2 ^ length l2" proof - have "(2::nat) ^ (length xs + length l2) = 2 ^ length xs * 2 ^ length l2" - by (induct "length xs",simp_all) + by (induct ("length xs")) simp_all hence "bitval x * 2 ^ (length xs + length l2) + bv_to_nat xs * 2 ^ length l2 = bitval x * 2 ^ length xs * 2 ^ length l2 + bv_to_nat xs * 2 ^ length l2" by simp @@ -2165,13 +2165,13 @@ apply (simp add: bv_extend_def) apply (subst bv_to_nat_dist_append) apply simp - apply (induct "n - length w") + apply (induct ("n - length w")) apply simp_all done lemma bv_msb_extend_same [simp]: "bv_msb w = b ==> bv_msb (bv_extend n b w) = b" apply (simp add: bv_extend_def) - apply (induct "n - length w") + apply (cases "n - length w") apply simp_all done @@ -2188,7 +2188,7 @@ show ?thesis apply (simp add: bv_to_int_def) apply (simp add: bv_extend_def) - apply (induct "n - length w",simp_all) + apply (induct ("n - length w"), simp_all) done qed diff -r e391c3de0f6b -r 7894c7dab132 src/HOL/MicroJava/BV/EffectMono.thy --- a/src/HOL/MicroJava/BV/EffectMono.thy Sun Jan 10 18:41:07 2010 +0100 +++ b/src/HOL/MicroJava/BV/EffectMono.thy Sun Jan 10 18:43:45 2010 +0100 @@ -15,12 +15,13 @@ lemma sup_loc_some [rule_format]: "\y n. (G \ b <=l y) \ n < length y \ y!n = OK t \ - (\t. b!n = OK t \ (G \ (b!n) <=o (y!n)))" (is "?P b") -proof (induct ?P b) - show "?P []" by simp + (\t. b!n = OK t \ (G \ (b!n) <=o (y!n)))" +proof (induct b) + case Nil + show ?case by simp next case (Cons a list) - show "?P (a#list)" + show ?case proof (clarsimp simp add: list_all2_Cons1 sup_loc_def Listn.le_def lesub_def) fix z zs n assume *: @@ -60,13 +61,14 @@ lemma append_length_n [rule_format]: -"\n. n \ length x \ (\a b. x = a@b \ length a = n)" (is "?P x") -proof (induct ?P x) - show "?P []" by simp +"\n. n \ length x \ (\a b. x = a@b \ length a = n)" +proof (induct x) + case Nil + show ?case by simp next - fix l ls assume Cons: "?P ls" + case (Cons l ls) - show "?P (l#ls)" + show ?case proof (intro allI impI) fix n assume l: "n \ length (l # ls)" diff -r e391c3de0f6b -r 7894c7dab132 src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy --- a/src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy Sun Jan 10 18:41:07 2010 +0100 +++ b/src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy Sun Jan 10 18:43:45 2010 +0100 @@ -170,8 +170,8 @@ next assume "card s > 2" thus ?thesis using as and n_def proof(induct n arbitrary: u s) case (Suc n) fix s::"'a set" and u::"'a \ real" assume IA:"\u s. \2 < card s; \x\V. \y\V. \u v. u + v = 1 \ u *\<^sub>R x + v *\<^sub>R y \ V; finite s; - s \ {}; s \ V; setsum u s = 1; n \ card s \ \ (\x\s. u x *\<^sub>R x) \ V" and - as:"Suc n \ card s" "2 < card s" "\x\V. \y\V. \u v. u + v = 1 \ u *\<^sub>R x + v *\<^sub>R y \ V" + s \ {}; s \ V; setsum u s = 1; n = card s \ \ (\x\s. u x *\<^sub>R x) \ V" and + as:"Suc n = card s" "2 < card s" "\x\V. \y\V. \u v. u + v = 1 \ u *\<^sub>R x + v *\<^sub>R y \ V" "finite s" "s \ {}" "s \ V" "setsum u s = 1" have "\x\s. u x \ 1" proof(rule_tac ccontr) assume " \ (\x\s. u x \ 1)" hence "setsum u s = real_of_nat (card s)" unfolding card_eq_setsum by auto @@ -1345,7 +1345,7 @@ next case False then obtain w where "w\s" by auto show ?thesis unfolding caratheodory[of s] - proof(induct "CARD('n) + 1") + proof(induct ("CARD('n) + 1")) have *:"{x.\sa. finite sa \ sa \ s \ card sa \ 0 \ x \ convex hull sa} = {}" using compact_empty by (auto simp add: convex_hull_empty) case 0 thus ?case unfolding * by simp diff -r e391c3de0f6b -r 7894c7dab132 src/HOL/Multivariate_Analysis/Euclidean_Space.thy --- a/src/HOL/Multivariate_Analysis/Euclidean_Space.thy Sun Jan 10 18:41:07 2010 +0100 +++ b/src/HOL/Multivariate_Analysis/Euclidean_Space.thy Sun Jan 10 18:43:45 2010 +0100 @@ -3542,17 +3542,9 @@ and sp:"s \ span t" shows "\t'. (card t' = card t) \ finite t' \ s \ t' \ t' \ s \ t \ s \ span t'" using f i sp -proof(induct c\"card(t - s)" arbitrary: s t rule: nat_less_induct) - fix n:: nat and s t :: "('a ^'n) set" - assume H: " \m(x:: ('a ^'n) set) xa. - finite xa \ - independent x \ - x \ span xa \ - m = card (xa - x) \ - (\t'. (card t' = card xa) \ finite t' \ - x \ t' \ t' \ x \ xa \ x \ span t')" - and ft: "finite t" and s: "independent s" and sp: "s \ span t" - and n: "n = card (t - s)" +proof(induct "card (t - s)" arbitrary: s t rule: less_induct) + case less + note ft = `finite t` and s = `independent s` and sp = `s \ span t` let ?P = "\t'. (card t' = card t) \ finite t' \ s \ t' \ t' \ s \ t \ s \ span t'" let ?ths = "\t'. ?P t'" {assume st: "s \ t" @@ -3568,12 +3560,12 @@ {assume st: "\ s \ t" "\ t \ s" from st(2) obtain b where b: "b \ t" "b \ s" by blast from b have "t - {b} - s \ t - s" by blast - then have cardlt: "card (t - {b} - s) < n" using n ft + then have cardlt: "card (t - {b} - s) < card (t - s)" using ft by (auto intro: psubset_card_mono) from b ft have ct0: "card t \ 0" by auto {assume stb: "s \ span(t -{b})" from ft have ftb: "finite (t -{b})" by auto - from H[rule_format, OF cardlt ftb s stb] + from less(1)[OF cardlt ftb s stb] obtain u where u: "card u = card (t-{b})" "s \ u" "u \ s \ (t - {b})" "s \ span u" and fu: "finite u" by blast let ?w = "insert b u" have th0: "s \ insert b u" using u by blast @@ -3594,8 +3586,8 @@ from stb obtain a where a: "a \ s" "a \ span (t - {b})" by blast have ab: "a \ b" using a b by blast have at: "a \ t" using a ab span_superset[of a "t- {b}"] by auto - have mlt: "card ((insert a (t - {b})) - s) < n" - using cardlt ft n a b by auto + have mlt: "card ((insert a (t - {b})) - s) < card (t - s)" + using cardlt ft a b by auto have ft': "finite (insert a (t - {b}))" using ft by auto {fix x assume xs: "x \ s" have t: "t \ (insert b (insert a (t -{b})))" using b by auto @@ -3608,7 +3600,7 @@ from span_trans[OF bs x] have "x \ span (insert a (t - {b}))" .} then have sp': "s \ span (insert a (t - {b}))" by blast - from H[rule_format, OF mlt ft' s sp' refl] obtain u where + from less(1)[OF mlt ft' s sp'] obtain u where u: "card u = card (insert a (t -{b}))" "finite u" "s \ u" "u \ s \ insert a (t -{b})" "s \ span u" by blast from u a b ft at ct0 have "?P u" by auto @@ -3657,11 +3649,9 @@ assumes sv: "(S::(real^'n) set) \ V" and iS: "independent S" shows "\B. S \ B \ B \ V \ independent B \ V \ span B" using sv iS -proof(induct d\ "CARD('n) - card S" arbitrary: S rule: nat_less_induct) - fix n and S:: "(real^'n) set" - assume H: "\mS \ V. independent S \ m = CARD('n) - card S \ - (\B. S \ B \ B \ V \ independent B \ V \ span B)" - and sv: "S \ V" and i: "independent S" and n: "n = CARD('n) - card S" +proof(induct "CARD('n) - card S" arbitrary: S rule: less_induct) + case less + note sv = `S \ V` and i = `independent S` let ?P = "\B. S \ B \ B \ V \ independent B \ V \ span B" let ?ths = "\x. ?P x" let ?d = "CARD('n)" @@ -3674,11 +3664,11 @@ have th0: "insert a S \ V" using a sv by blast from independent_insert[of a S] i a have th1: "independent (insert a S)" by auto - have mlt: "?d - card (insert a S) < n" - using aS a n independent_bound[OF th1] + have mlt: "?d - card (insert a S) < ?d - card S" + using aS a independent_bound[OF th1] by auto - from H[rule_format, OF mlt th0 th1 refl] + from less(1)[OF mlt th0 th1] obtain B where B: "insert a S \ B" "B \ V" "independent B" " V \ span B" by blast from B have "?P B" by auto diff -r e391c3de0f6b -r 7894c7dab132 src/HOL/Nominal/Examples/Class.thy --- a/src/HOL/Nominal/Examples/Class.thy Sun Jan 10 18:41:07 2010 +0100 +++ b/src/HOL/Nominal/Examples/Class.thy Sun Jan 10 18:43:45 2010 +0100 @@ -15069,11 +15069,9 @@ assumes a: "(M[a\c>b]) \\<^isub>a M'" "a\b" shows "\M0. M0[a\c>b]=M' \ M \\<^isub>a M0" using a -apply(nominal_induct M\"M[a\c>b]" M' avoiding: M a b rule: a_redu.strong_induct) -apply(simp) +apply(nominal_induct "M[a\c>b]" M' avoiding: M a b rule: a_redu.strong_induct) apply(drule crename_lredu) apply(blast) -apply(simp) apply(drule crename_credu) apply(blast) (* Cut *) @@ -16132,11 +16130,9 @@ assumes a: "(M[x\n>y]) \\<^isub>a M'" "x\y" shows "\M0. M0[x\n>y]=M' \ M \\<^isub>a M0" using a -apply(nominal_induct M\"M[x\n>y]" M' avoiding: M x y rule: a_redu.strong_induct) -apply(simp) +apply(nominal_induct "M[x\n>y]" M' avoiding: M x y rule: a_redu.strong_induct) apply(drule nrename_lredu) apply(blast) -apply(simp) apply(drule nrename_credu) apply(blast) (* Cut *) diff -r e391c3de0f6b -r 7894c7dab132 src/HOL/Nominal/Examples/Fsub.thy --- a/src/HOL/Nominal/Examples/Fsub.thy Sun Jan 10 18:41:07 2010 +0100 +++ b/src/HOL/Nominal/Examples/Fsub.thy Sun Jan 10 18:43:45 2010 +0100 @@ -982,19 +982,18 @@ from `(\@[(TVarB X Q)]@\) \ M <: N` and `\ \ P<:Q` show "(\@[(TVarB X P)]@\) \ M <: N" - proof (induct \\"\@[(TVarB X Q)]@\" M N arbitrary: \ X \ rule: subtype_of.induct) - case (SA_Top _ S \ X \) - then have lh_drv_prm\<^isub>1: "\ (\@[(TVarB X Q)]@\) ok" - and lh_drv_prm\<^isub>2: "S closed_in (\@[(TVarB X Q)]@\)" by simp_all - have rh_drv: "\ \ P <: Q" by fact - hence "P closed_in \" by (simp add: subtype_implies_closed) - with lh_drv_prm\<^isub>1 have "\ (\@[(TVarB X P)]@\) ok" by (simp add: replace_type) + proof (induct "\@[(TVarB X Q)]@\" M N arbitrary: \ X \ rule: subtype_of.induct) + case (SA_Top S \ X \) + from `\ \ P <: Q` + have "P closed_in \" by (simp add: subtype_implies_closed) + with `\ (\@[(TVarB X Q)]@\) ok` have "\ (\@[(TVarB X P)]@\) ok" + by (simp add: replace_type) moreover - from lh_drv_prm\<^isub>2 have "S closed_in (\@[(TVarB X P)]@\)" + from `S closed_in (\@[(TVarB X Q)]@\)` have "S closed_in (\@[(TVarB X P)]@\)" by (simp add: closed_in_def doms_append) ultimately show "(\@[(TVarB X P)]@\) \ S <: Top" by (simp add: subtype_of.SA_Top) next - case (SA_trans_TVar Y S _ N \ X \) + case (SA_trans_TVar Y S N \ X \) then have IH_inner: "(\@[(TVarB X P)]@\) \ S <: N" and lh_drv_prm: "(TVarB Y S) \ set (\@[(TVarB X Q)]@\)" and rh_drv: "\ \ P<:Q" @@ -1020,23 +1019,23 @@ then show "(\@[(TVarB X P)]@\) \ Tvar Y <: N" using memb\<^isub>X\<^isub>P eq by auto qed next - case (SA_refl_TVar _ Y \ X \) - then have lh_drv_prm\<^isub>1: "\ (\@[(TVarB X Q)]@\) ok" - and lh_drv_prm\<^isub>2: "Y \ ty_dom (\@[(TVarB X Q)]@\)" by simp_all - have "\ \ P <: Q" by fact - hence "P closed_in \" by (simp add: subtype_implies_closed) - with lh_drv_prm\<^isub>1 have "\ (\@[(TVarB X P)]@\) ok" by (simp add: replace_type) + case (SA_refl_TVar Y \ X \) + from `\ \ P <: Q` + have "P closed_in \" by (simp add: subtype_implies_closed) + with `\ (\@[(TVarB X Q)]@\) ok` have "\ (\@[(TVarB X P)]@\) ok" + by (simp add: replace_type) moreover - from lh_drv_prm\<^isub>2 have "Y \ ty_dom (\@[(TVarB X P)]@\)" by (simp add: doms_append) + from `Y \ ty_dom (\@[(TVarB X Q)]@\)` have "Y \ ty_dom (\@[(TVarB X P)]@\)" + by (simp add: doms_append) ultimately show "(\@[(TVarB X P)]@\) \ Tvar Y <: Tvar Y" by (simp add: subtype_of.SA_refl_TVar) next - case (SA_arrow _ S\<^isub>1 Q\<^isub>1 Q\<^isub>2 S\<^isub>2 \ X \) + case (SA_arrow S\<^isub>1 Q\<^isub>1 Q\<^isub>2 S\<^isub>2 \ X \) then show "(\@[(TVarB X P)]@\) \ Q\<^isub>1 \ Q\<^isub>2 <: S\<^isub>1 \ S\<^isub>2" by blast next - case (SA_all _ T\<^isub>1 S\<^isub>1 Y S\<^isub>2 T\<^isub>2 \ X \) - from SA_all(2,4,5,6) + case (SA_all T\<^isub>1 S\<^isub>1 Y S\<^isub>2 T\<^isub>2 \ X \) have IH_inner\<^isub>1: "(\@[(TVarB X P)]@\) \ T\<^isub>1 <: S\<^isub>1" - and IH_inner\<^isub>2: "(((TVarB Y T\<^isub>1)#\)@[(TVarB X P)]@\) \ S\<^isub>2 <: T\<^isub>2" by force+ + and IH_inner\<^isub>2: "(((TVarB Y T\<^isub>1)#\)@[(TVarB X P)]@\) \ S\<^isub>2 <: T\<^isub>2" + by (fastsimp intro: SA_all)+ then show "(\@[(TVarB X P)]@\) \ (\Y<:S\<^isub>1. S\<^isub>2) <: (\Y<:T\<^isub>1. T\<^isub>2)" by auto qed } @@ -1263,7 +1262,7 @@ assumes "\ (\ @ VarB x Q # \) ok" shows "\ (\ @ \) ok" using assms -proof (induct \' \ "\ @ VarB x Q # \" arbitrary: \ \) +proof (induct "\ @ VarB x Q # \" arbitrary: \ \) case valid_nil have "[] = \ @ VarB x Q # \" by fact then have "False" by auto @@ -1314,14 +1313,14 @@ and "\ (\ @ B # \) ok" shows "(\ @ B # \) \ t : T" using assms -proof(nominal_induct \'\ "\ @ \" t T avoiding: \ \ B rule: typing.strong_induct) - case (T_Var x' T \' \'' \') +proof(nominal_induct "\ @ \" t T avoiding: \ \ B rule: typing.strong_induct) + case (T_Var x T) then show ?case by auto next - case (T_App \ t\<^isub>1 T\<^isub>1 T\<^isub>2 t\<^isub>2 \ \) + case (T_App X t\<^isub>1 T\<^isub>2 T\<^isub>1\<^isub>1 T\<^isub>1\<^isub>2) then show ?case by force next - case (T_Abs y T\<^isub>1 \' t\<^isub>2 T\<^isub>2 \ \) + case (T_Abs y T\<^isub>1 t\<^isub>2 T\<^isub>2 \ \) then have "VarB y T\<^isub>1 # \ @ \ \ t\<^isub>2 : T\<^isub>2" by simp then have closed: "T\<^isub>1 closed_in (\ @ \)" by (auto dest: typing_ok) @@ -1336,22 +1335,22 @@ apply (rule closed) done then have "\ ((VarB y T\<^isub>1 # \) @ B # \) ok" by simp - then have "(VarB y T\<^isub>1 # \) @ B # \ \ t\<^isub>2 : T\<^isub>2" - by (rule T_Abs) (simp add: T_Abs) + with _ have "(VarB y T\<^isub>1 # \) @ B # \ \ t\<^isub>2 : T\<^isub>2" + by (rule T_Abs) simp then have "VarB y T\<^isub>1 # \ @ B # \ \ t\<^isub>2 : T\<^isub>2" by simp then show ?case by (rule typing.T_Abs) next - case (T_Sub \' t S T \ \) - from `\ (\ @ B # \) ok` and `\' = \ @ \` + case (T_Sub t S T \ \) + from refl and `\ (\ @ B # \) ok` have "\ @ B # \ \ t : S" by (rule T_Sub) - moreover from `\'\S<:T` and `\ (\ @ B # \) ok` + moreover from `(\ @ \)\S<:T` and `\ (\ @ B # \) ok` have "(\ @ B # \)\S<:T" by (rule weakening) (simp add: extends_def T_Sub) ultimately show ?case by (rule typing.T_Sub) next - case (T_TAbs X T\<^isub>1 \' t\<^isub>2 T\<^isub>2 \ \) - then have "TVarB X T\<^isub>1 # \ @ \ \ t\<^isub>2 : T\<^isub>2" by simp - then have closed: "T\<^isub>1 closed_in (\ @ \)" + case (T_TAbs X T\<^isub>1 t\<^isub>2 T\<^isub>2 \ \) + from `TVarB X T\<^isub>1 # \ @ \ \ t\<^isub>2 : T\<^isub>2` + have closed: "T\<^isub>1 closed_in (\ @ \)" by (auto dest: typing_ok) have "\ (TVarB X T\<^isub>1 # \ @ B # \) ok" apply (rule valid_consT) @@ -1364,15 +1363,15 @@ apply (rule closed) done then have "\ ((TVarB X T\<^isub>1 # \) @ B # \) ok" by simp - then have "(TVarB X T\<^isub>1 # \) @ B # \ \ t\<^isub>2 : T\<^isub>2" - by (rule T_TAbs) (simp add: T_TAbs) + with _ have "(TVarB X T\<^isub>1 # \) @ B # \ \ t\<^isub>2 : T\<^isub>2" + by (rule T_TAbs) simp then have "TVarB X T\<^isub>1 # \ @ B # \ \ t\<^isub>2 : T\<^isub>2" by simp then show ?case by (rule typing.T_TAbs) next - case (T_TApp X \' t\<^isub>1 T2 T11 T12 \ \) + case (T_TApp X t\<^isub>1 T2 T11 T12 \ \) have "\ @ B # \ \ t\<^isub>1 : (\X<:T11. T12)" - by (rule T_TApp)+ - moreover from `\'\T2<:T11` and `\ (\ @ B # \) ok` + by (rule T_TApp refl)+ + moreover from `(\ @ \)\T2<:T11` and `\ (\ @ B # \) ok` have "(\ @ B # \)\T2<:T11" by (rule weakening) (simp add: extends_def T_TApp) ultimately show ?case by (rule better_T_TApp) @@ -1393,24 +1392,22 @@ assumes "(\ @ VarB x Q # \) \ S <: T" shows "(\@\) \ S <: T" using assms -proof (induct \' \ "\ @ VarB x Q # \" S T arbitrary: \) - case (SA_Top G' S G) - then have "\ (G @ \) ok" by (auto dest: valid_cons') - moreover have "S closed_in (G @ \)" using SA_Top by (auto dest: closed_in_cons) +proof (induct "\ @ VarB x Q # \" S T arbitrary: \) + case (SA_Top S) + then have "\ (\ @ \) ok" by (auto dest: valid_cons') + moreover have "S closed_in (\ @ \)" using SA_Top by (auto dest: closed_in_cons) ultimately show ?case using subtype_of.SA_Top by auto next - case (SA_refl_TVar G X' G') - then have "\ (G' @ VarB x Q # \) ok" by simp - then have h1:"\ (G' @ \) ok" by (auto dest: valid_cons') - have "X' \ ty_dom (G' @ VarB x Q # \)" using SA_refl_TVar by auto - then have h2:"X' \ ty_dom (G' @ \)" using ty_dom_vrs by auto + case (SA_refl_TVar X) + from `\ (\ @ VarB x Q # \) ok` + have h1:"\ (\ @ \) ok" by (auto dest: valid_cons') + have "X \ ty_dom (\ @ VarB x Q # \)" using SA_refl_TVar by auto + then have h2:"X \ ty_dom (\ @ \)" using ty_dom_vrs by auto show ?case using h1 h2 by auto next - case (SA_all G T1 S1 X S2 T2 G') - have ih1:"TVarB X T1 # G = (TVarB X T1 # G') @ VarB x Q # \ \ ((TVarB X T1 # G') @ \)\S2<:T2" by fact - then have h1:"(TVarB X T1 # (G' @ \))\S2<:T2" using SA_all by auto - have ih2:"G = G' @ VarB x Q # \ \ (G' @ \)\T1<:S1" by fact - then have h2:"(G' @ \)\T1<:S1" using SA_all by auto + case (SA_all T1 S1 X S2 T2) + have h1:"((TVarB X T1 # \) @ \)\S2<:T2" by (fastsimp intro: SA_all) + have h2:"(\ @ \)\T1<:S1" using SA_all by auto then show ?case using h1 h2 by auto qed (auto) @@ -1418,26 +1415,26 @@ assumes H: "\ @ (TVarB X Q) # \ \ t : T" shows "\ \ P <: Q \ \ @ (TVarB X P) # \ \ t : T" using H - proof (nominal_induct \' \ "\ @ (TVarB X Q) # \" t T avoiding: P arbitrary: \ rule: typing.strong_induct) - case (T_Var x T G P D) + proof (nominal_induct "\ @ (TVarB X Q) # \" t T avoiding: P arbitrary: \ rule: typing.strong_induct) + case (T_Var x T P D) then have "VarB x T \ set (D @ TVarB X P # \)" and "\ (D @ TVarB X P # \) ok" by (auto intro: replace_type dest!: subtype_implies_closed) then show ?case by auto next - case (T_App G t1 T1 T2 t2 P D) + case (T_App t1 T1 T2 t2 P D) then show ?case by force next - case (T_Abs x T1 G t2 T2 P D) + case (T_Abs x T1 t2 T2 P D) then show ?case by (fastsimp dest: typing_ok) next - case (T_Sub G t S T D) + case (T_Sub t S T P D) then show ?case using subtype_narrow by fastsimp next - case (T_TAbs X' T1 G t2 T2 P D) + case (T_TAbs X' T1 t2 T2 P D) then show ?case by (fastsimp dest: typing_ok) next - case (T_TApp X' G t1 T2 T11 T12 P D) + case (T_TApp X' t1 T2 T11 T12 P D) then have "D @ TVarB X P # \ \ t1 : Forall X' T12 T11" by fastsimp moreover have "(D @ [TVarB X Q] @ \) \ T2<:T11" using T_TApp by auto then have "(D @ [TVarB X P] @ \) \ T2<:T11" using `\\P<:Q` @@ -1454,8 +1451,8 @@ theorem subst_type: -- {* A.8 *} assumes H: "(\ @ (VarB x U) # \) \ t : T" shows "\ \ u : U \ \ @ \ \ t[x \ u] : T" using H - proof (nominal_induct \' \ "\ @ (VarB x U) # \" t T avoiding: x u arbitrary: \ rule: typing.strong_induct) - case (T_Var y T G x u D) + proof (nominal_induct "\ @ (VarB x U) # \" t T avoiding: x u arbitrary: \ rule: typing.strong_induct) + case (T_Var y T x u D) show ?case proof (cases "x = y") assume eq:"x=y" @@ -1468,23 +1465,23 @@ by (auto simp add:binding.inject dest: valid_cons') qed next - case (T_App G t1 T1 T2 t2 x u D) + case (T_App t1 T1 T2 t2 x u D) then show ?case by force next - case (T_Abs y T1 G t2 T2 x u D) + case (T_Abs y T1 t2 T2 x u D) then show ?case by force next - case (T_Sub G t S T x u D) + case (T_Sub t S T x u D) then have "D @ \ \ t[x \ u] : S" by auto moreover have "(D @ \) \ S<:T" using T_Sub by (auto dest: strengthening) ultimately show ?case by auto next - case (T_TAbs X T1 G t2 T2 x u D) - from `TVarB X T1 # G \ t2 : T2` have "X \ T1" + case (T_TAbs X T1 t2 T2 x u D) + from `TVarB X T1 # D @ VarB x U # \ \ t2 : T2` have "X \ T1" by (auto simp add: valid_ty_dom_fresh dest: typing_ok intro!: closed_in_fresh) with `X \ u` and T_TAbs show ?case by fastsimp next - case (T_TApp X G t1 T2 T11 T12 x u D) + case (T_TApp X t1 T2 T11 T12 x u D) then have "(D@\) \T2<:T11" using T_TApp by (auto dest: strengthening) then show "((D @ \) \ ((t1 \\<^sub>\ T2)[x \ u]) : (T12[X \ T2]\<^sub>\))" using T_TApp by (force simp add: fresh_prod fresh_list_append fresh_list_cons subst_trm_fresh_tyvar) @@ -1496,8 +1493,8 @@ assumes H: "(\ @ ((TVarB X Q) # \)) \ S <: T" shows "\ \ P <: Q \ (\[X \ P]\<^sub>e @ \) \ S[X \ P]\<^sub>\ <: T[X \ P]\<^sub>\" using H -proof (nominal_induct \' \ "\ @ TVarB X Q # \" S T avoiding: X P arbitrary: \ rule: subtype_of.strong_induct) - case (SA_Top G S X P D) +proof (nominal_induct "\ @ TVarB X Q # \" S T avoiding: X P arbitrary: \ rule: subtype_of.strong_induct) + case (SA_Top S X P D) then have "\ (D @ TVarB X Q # \) ok" by simp moreover have closed: "P closed_in \" using SA_Top subtype_implies_closed by auto ultimately have "\ (D[X \ P]\<^sub>e @ \) ok" by (rule valid_subst) @@ -1505,17 +1502,18 @@ then have "S[X \ P]\<^sub>\ closed_in (D[X \ P]\<^sub>e @ \)" using closed by (rule subst_closed_in) ultimately show ?case by auto next - case (SA_trans_TVar Y S G T X P D) - have h:"G\S<:T" by fact + case (SA_trans_TVar Y S T X P D) + have h:"(D @ TVarB X Q # \)\S<:T" by fact then have ST: "(D[X \ P]\<^sub>e @ \) \ S[X \ P]\<^sub>\ <: T[X \ P]\<^sub>\" using SA_trans_TVar by auto - from `G\S<:T` have G_ok: "\ G ok" by (rule subtype_implies_ok) + from h have G_ok: "\ (D @ TVarB X Q # \) ok" by (rule subtype_implies_ok) from G_ok and SA_trans_TVar have X\_ok: "\ (TVarB X Q # \) ok" by (auto intro: validE_append) show "(D[X \ P]\<^sub>e @ \) \ Tvar Y[X \ P]\<^sub>\<:T[X \ P]\<^sub>\" proof (cases "X = Y") assume eq: "X = Y" - from eq and SA_trans_TVar have "TVarB Y Q \ set G" by simp - with G_ok have QS: "Q = S" using `TVarB Y S \ set G` by (rule uniqueness_of_ctxt) + from eq and SA_trans_TVar have "TVarB Y Q \ set (D @ TVarB X Q # \)" by simp + with G_ok have QS: "Q = S" using `TVarB Y S \ set (D @ TVarB X Q # \)` + by (rule uniqueness_of_ctxt) from X\_ok have "X \ ty_dom \" and "Q closed_in \" by auto then have XQ: "X \ Q" by (rule closed_in_fresh) note `\\P<:Q` @@ -1552,8 +1550,8 @@ qed qed next - case (SA_refl_TVar G Y X P D) - then have "\ (D @ TVarB X Q # \) ok" by simp + case (SA_refl_TVar Y X P D) + note `\ (D @ TVarB X Q # \) ok` moreover from SA_refl_TVar have closed: "P closed_in \" by (auto dest: subtype_implies_closed) ultimately have ok: "\ (D[X \ P]\<^sub>e @ \) ok" using valid_subst by auto @@ -1571,12 +1569,12 @@ with neq and ok show ?thesis by auto qed next - case (SA_arrow G T1 S1 S2 T2 X P D) + case (SA_arrow T1 S1 S2 T2 X P D) then have h1:"(D[X \ P]\<^sub>e @ \)\T1[X \ P]\<^sub>\<:S1[X \ P]\<^sub>\" using SA_arrow by auto from SA_arrow have h2:"(D[X \ P]\<^sub>e @ \)\S2[X \ P]\<^sub>\<:T2[X \ P]\<^sub>\" using SA_arrow by auto show ?case using subtype_of.SA_arrow h1 h2 by auto next - case (SA_all G T1 S1 Y S2 T2 X P D) + case (SA_all T1 S1 Y S2 T2 X P D) then have Y: "Y \ ty_dom (D @ TVarB X Q # \)" by (auto dest: subtype_implies_ok intro: fresh_dom) moreover from SA_all have "S1 closed_in (D @ TVarB X Q # \)" @@ -1594,13 +1592,13 @@ assumes H: "(D @ TVarB X Q # G) \ t : T" shows "G \ P <: Q \ (D[X \ P]\<^sub>e @ G) \ t[X \\<^sub>\ P] : T[X \ P]\<^sub>\" using H -proof (nominal_induct \'\"(D @ TVarB X Q # G)" t T avoiding: X P arbitrary: D rule: typing.strong_induct) - case (T_Var x T G' X P D') +proof (nominal_induct "D @ TVarB X Q # G" t T avoiding: X P arbitrary: D rule: typing.strong_induct) + case (T_Var x T X P D') have "G\P<:Q" by fact then have "P closed_in G" using subtype_implies_closed by auto - moreover have "\ (D' @ TVarB X Q # G) ok" using T_Var by auto + moreover note `\ (D' @ TVarB X Q # G) ok` ultimately have "\ (D'[X \ P]\<^sub>e @ G) ok" using valid_subst by auto - moreover have "VarB x T \ set (D' @ TVarB X Q # G)" using T_Var by auto + moreover note `VarB x T \ set (D' @ TVarB X Q # G)` then have "VarB x T \ set D' \ VarB x T \ set G" by simp then have "(VarB x (T[X \ P]\<^sub>\)) \ set (D'[X \ P]\<^sub>e @ G)" proof @@ -1621,25 +1619,25 @@ qed ultimately show ?case by auto next - case (T_App G' t1 T1 T2 t2 X P D') + case (T_App t1 T1 T2 t2 X P D') then have "D'[X \ P]\<^sub>e @ G \ t1[X \\<^sub>\ P] : (T1 \ T2)[X \ P]\<^sub>\" by auto moreover from T_App have "D'[X \ P]\<^sub>e @ G \ t2[X \\<^sub>\ P] : T1[X \ P]\<^sub>\" by auto ultimately show ?case by auto next - case (T_Abs x T1 G' t2 T2 X P D') + case (T_Abs x T1 t2 T2 X P D') then show ?case by force next - case (T_Sub G' t S T X P D') + case (T_Sub t S T X P D') then show ?case using substT_subtype by force next - case (T_TAbs X' G' T1 t2 T2 X P D') + case (T_TAbs X' T1 t2 T2 X P D') then have "X' \ ty_dom (D' @ TVarB X Q # G)" - and "G' closed_in (D' @ TVarB X Q # G)" + and "T1 closed_in (D' @ TVarB X Q # G)" by (auto dest: typing_ok) - then have "X' \ G'" by (rule closed_in_fresh) + then have "X' \ T1" by (rule closed_in_fresh) with T_TAbs show ?case by force next - case (T_TApp X' G' t1 T2 T11 T12 X P D') + case (T_TApp X' t1 T2 T11 T12 X P D') then have "X' \ ty_dom (D' @ TVarB X Q # G)" by (simp add: fresh_dom) moreover from T_TApp have "T11 closed_in (D' @ TVarB X Q # G)" @@ -1824,22 +1822,22 @@ lemma Fun_canonical: -- {* A.14(1) *} assumes ty: "[] \ v : T\<^isub>1 \ T\<^isub>2" shows "val v \ \x t S. v = (\x:S. t)" using ty -proof (induct \\"[]::env" v T\"T\<^isub>1 \ T\<^isub>2" arbitrary: T\<^isub>1 T\<^isub>2) - case (T_Sub \ t S T) - hence "\ \ S <: T\<^isub>1 \ T\<^isub>2" by simp - then obtain S\<^isub>1 S\<^isub>2 where S: "S = S\<^isub>1 \ S\<^isub>2" +proof (induct "[]::env" v "T\<^isub>1 \ T\<^isub>2" arbitrary: T\<^isub>1 T\<^isub>2) + case (T_Sub t S) + from `[] \ S <: T\<^isub>1 \ T\<^isub>2` + obtain S\<^isub>1 S\<^isub>2 where S: "S = S\<^isub>1 \ S\<^isub>2" by cases (auto simp add: T_Sub) - with `val t` and `\ = []` show ?case by (rule T_Sub) + then show ?case using `val t` by (rule T_Sub) qed (auto) lemma TyAll_canonical: -- {* A.14(3) *} fixes X::tyvrs assumes ty: "[] \ v : (\X<:T\<^isub>1. T\<^isub>2)" shows "val v \ \X t S. v = (\X<:S. t)" using ty -proof (induct \\"[]::env" v T\"\X<:T\<^isub>1. T\<^isub>2" arbitrary: X T\<^isub>1 T\<^isub>2) - case (T_Sub \ t S T) - hence "\ \ S <: (\X<:T\<^isub>1. T\<^isub>2)" by simp - then obtain X S\<^isub>1 S\<^isub>2 where S: "S = (\X<:S\<^isub>1. S\<^isub>2)" +proof (induct "[]::env" v "\X<:T\<^isub>1. T\<^isub>2" arbitrary: X T\<^isub>1 T\<^isub>2) + case (T_Sub t S) + from `[] \ S <: (\X<:T\<^isub>1. T\<^isub>2)` + obtain X S\<^isub>1 S\<^isub>2 where S: "S = (\X<:S\<^isub>1. S\<^isub>2)" by cases (auto simp add: T_Sub) then show ?case using T_Sub by auto qed (auto) @@ -1848,8 +1846,8 @@ assumes "[] \ t : T" shows "val t \ (\t'. t \ t')" using assms -proof (induct \ \ "[]::env" t T) - case (T_App \ t\<^isub>1 T\<^isub>1\<^isub>1 T\<^isub>1\<^isub>2 t\<^isub>2) +proof (induct "[]::env" t T) + case (T_App t\<^isub>1 T\<^isub>1\<^isub>1 T\<^isub>1\<^isub>2 t\<^isub>2) hence "val t\<^isub>1 \ (\t'. t\<^isub>1 \ t')" by simp thus ?case proof @@ -1875,7 +1873,7 @@ thus ?case by auto qed next - case (T_TApp X \ t\<^isub>1 T\<^isub>2 T\<^isub>1\<^isub>1 T\<^isub>1\<^isub>2) + case (T_TApp X t\<^isub>1 T\<^isub>2 T\<^isub>1\<^isub>1 T\<^isub>1\<^isub>2) hence "val t\<^isub>1 \ (\t'. t\<^isub>1 \ t')" by simp thus ?case proof diff -r e391c3de0f6b -r 7894c7dab132 src/HOL/Nominal/Examples/Pattern.thy --- a/src/HOL/Nominal/Examples/Pattern.thy Sun Jan 10 18:41:07 2010 +0100 +++ b/src/HOL/Nominal/Examples/Pattern.thy Sun Jan 10 18:43:45 2010 +0100 @@ -410,37 +410,34 @@ and b: "\ \ u : U" shows "\ @ \ \ t[x\u] : T" using a b proof (nominal_induct \'\"\ @ [(x, U)] @ \" t T avoiding: x u \ rule: typing.strong_induct) - case (Var \' y T x u \) - then have a1: "valid (\ @ [(x, U)] @ \)" - and a2: "(y, T) \ set (\ @ [(x, U)] @ \)" - and a3: "\ \ u : U" by simp_all - from a1 have a4: "valid (\ @ \)" by (rule valid_insert) + case (Var y T x u \) + from `valid (\ @ [(x, U)] @ \)` + have valid: "valid (\ @ \)" by (rule valid_insert) show "\ @ \ \ Var y[x\u] : T" proof cases assume eq: "x = y" - from a1 a2 have "T = U" using eq by (auto intro: context_unique) - with a3 show "\ @ \ \ Var y[x\u] : T" using eq a4 by (auto intro: weakening) + from Var eq have "T = U" by (auto intro: context_unique) + with Var eq valid show "\ @ \ \ Var y[x\u] : T" by (auto intro: weakening) next assume ineq: "x \ y" - from a2 have "(y, T) \ set (\ @ \)" using ineq by simp - then show "\ @ \ \ Var y[x\u] : T" using ineq a4 by auto + from Var ineq have "(y, T) \ set (\ @ \)" by simp + then show "\ @ \ \ Var y[x\u] : T" using ineq valid by auto qed next - case (Tuple \' t\<^isub>1 T\<^isub>1 t\<^isub>2 T\<^isub>2) - from `\ \ u : U` `\' = \ @ [(x, U)] @ \` + case (Tuple t\<^isub>1 T\<^isub>1 t\<^isub>2 T\<^isub>2) + from refl `\ \ u : U` have "\ @ \ \ t\<^isub>1[x\u] : T\<^isub>1" by (rule Tuple) - moreover from `\ \ u : U` `\' = \ @ [(x, U)] @ \` + moreover from refl `\ \ u : U` have "\ @ \ \ t\<^isub>2[x\u] : T\<^isub>2" by (rule Tuple) ultimately have "\ @ \ \ \t\<^isub>1[x\u], t\<^isub>2[x\u]\ : T\<^isub>1 \ T\<^isub>2" .. then show ?case by simp next - case (Let p t \' T \' s S) - from `\ \ u : U` `\' = \ @ [(x, U)] @ \` + case (Let p t T \' s S) + from refl `\ \ u : U` have "\ @ \ \ t[x\u] : T" by (rule Let) moreover note `\ p : T \ \'` - moreover from `\' = \ @ [(x, U)] @ \` - have "\' @ \' = (\' @ \) @ [(x, U)] @ \" by simp - with `\ \ u : U` have "(\' @ \) @ \ \ s[x\u] : S" by (rule Let) + moreover have "\' @ (\ @ [(x, U)] @ \) = (\' @ \) @ [(x, U)] @ \" by simp + then have "(\' @ \) @ \ \ s[x\u] : S" using `\ \ u : U` by (rule Let) then have "\' @ \ @ \ \ s[x\u] : S" by simp ultimately have "\ @ \ \ (LET p = t[x\u] IN s[x\u]) : S" by (rule better_T_Let) @@ -448,10 +445,10 @@ by (simp add: fresh_star_def fresh_list_nil fresh_list_cons) ultimately show ?case by simp next - case (Abs y T \' t S) - from `\' = \ @ [(x, U)] @ \` have "(y, T) # \' = ((y, T) # \) @ [(x, U)] @ \" + case (Abs y T t S) + have "(y, T) # \ @ [(x, U)] @ \ = ((y, T) # \) @ [(x, U)] @ \" by simp - with `\ \ u : U` have "((y, T) # \) @ \ \ t[x\u] : S" by (rule Abs) + then have "((y, T) # \) @ \ \ t[x\u] : S" using `\ \ u : U` by (rule Abs) then have "(y, T) # \ @ \ \ t[x\u] : S" by simp then have "\ @ \ \ (\y:T. t[x\u]) : T \ S" by (rule typing.Abs) @@ -459,10 +456,10 @@ by (simp add: fresh_list_nil fresh_list_cons) ultimately show ?case by simp next - case (App \' t\<^isub>1 T S t\<^isub>2) - from `\ \ u : U` `\' = \ @ [(x, U)] @ \` + case (App t\<^isub>1 T S t\<^isub>2) + from refl `\ \ u : U` have "\ @ \ \ t\<^isub>1[x\u] : T \ S" by (rule App) - moreover from `\ \ u : U` `\' = \ @ [(x, U)] @ \` + moreover from refl `\ \ u : U` have "\ @ \ \ t\<^isub>2[x\u] : T" by (rule App) ultimately have "\ @ \ \ (t\<^isub>1[x\u]) \ (t\<^isub>2[x\u]) : S" by (rule typing.App) diff -r e391c3de0f6b -r 7894c7dab132 src/HOL/Nominal/Examples/SOS.thy --- a/src/HOL/Nominal/Examples/SOS.thy Sun Jan 10 18:41:07 2010 +0100 +++ b/src/HOL/Nominal/Examples/SOS.thy Sun Jan 10 18:43:45 2010 +0100 @@ -220,10 +220,10 @@ shows "(\@\) \ e[x::=e'] : T" using a b proof (nominal_induct \\"\@[(x,T')]@\" e T avoiding: e' \ rule: typing.strong_induct) - case (t_Var \' y T e' \) + case (t_Var y T e' \) then have a1: "valid (\@[(x,T')]@\)" and a2: "(y,T) \ set (\@[(x,T')]@\)" - and a3: "\ \ e' : T'" by simp_all + and a3: "\ \ e' : T'" . from a1 have a4: "valid (\@\)" by (rule valid_insert) { assume eq: "x=y" from a1 a2 have "T=T'" using eq by (auto intro: context_unique) diff -r e391c3de0f6b -r 7894c7dab132 src/HOL/Old_Number_Theory/Legacy_GCD.thy --- a/src/HOL/Old_Number_Theory/Legacy_GCD.thy Sun Jan 10 18:41:07 2010 +0100 +++ b/src/HOL/Old_Number_Theory/Legacy_GCD.thy Sun Jan 10 18:43:45 2010 +0100 @@ -233,37 +233,39 @@ with gcd_unique[of "gcd u v" x y] show ?thesis by auto qed -lemma ind_euclid: - assumes c: " \a b. P (a::nat) b \ P b a" and z: "\a. P a 0" - and add: "\a b. P a b \ P a (a + b)" +lemma ind_euclid: + assumes c: " \a b. P (a::nat) b \ P b a" and z: "\a. P a 0" + and add: "\a b. P a b \ P a (a + b)" shows "P a b" -proof(induct n\"a+b" arbitrary: a b rule: nat_less_induct) - fix n a b - assume H: "\m < n. \a b. m = a + b \ P a b" "n = a + b" +proof(induct "a + b" arbitrary: a b rule: less_induct) + case less have "a = b \ a < b \ b < a" by arith moreover {assume eq: "a= b" - from add[rule_format, OF z[rule_format, of a]] have "P a b" using eq by simp} + from add[rule_format, OF z[rule_format, of a]] have "P a b" using eq + by simp} moreover {assume lt: "a < b" - hence "a + b - a < n \ a = 0" using H(2) by arith + hence "a + b - a < a + b \ a = 0" by arith moreover {assume "a =0" with z c have "P a b" by blast } moreover - {assume ab: "a + b - a < n" - have th0: "a + b - a = a + (b - a)" using lt by arith - from add[rule_format, OF H(1)[rule_format, OF ab th0]] - have "P a b" by (simp add: th0[symmetric])} + {assume "a + b - a < a + b" + also have th0: "a + b - a = a + (b - a)" using lt by arith + finally have "a + (b - a) < a + b" . + then have "P a (a + (b - a))" by (rule add[rule_format, OF less]) + then have "P a b" by (simp add: th0[symmetric])} ultimately have "P a b" by blast} moreover {assume lt: "a > b" - hence "b + a - b < n \ b = 0" using H(2) by arith + hence "b + a - b < a + b \ b = 0" by arith moreover {assume "b =0" with z c have "P a b" by blast } moreover - {assume ab: "b + a - b < n" - have th0: "b + a - b = b + (a - b)" using lt by arith - from add[rule_format, OF H(1)[rule_format, OF ab th0]] - have "P b a" by (simp add: th0[symmetric]) + {assume "b + a - b < a + b" + also have th0: "b + a - b = b + (a - b)" using lt by arith + finally have "b + (a - b) < a + b" . + then have "P b (b + (a - b))" by (rule add[rule_format, OF less]) + then have "P b a" by (simp add: th0[symmetric]) hence "P a b" using c by blast } ultimately have "P a b" by blast} ultimately show "P a b" by blast diff -r e391c3de0f6b -r 7894c7dab132 src/HOL/ex/ThreeDivides.thy --- a/src/HOL/ex/ThreeDivides.thy Sun Jan 10 18:41:07 2010 +0100 +++ b/src/HOL/ex/ThreeDivides.thy Sun Jan 10 18:43:45 2010 +0100 @@ -178,21 +178,17 @@ lemma exp_exists: "m = (\x "nlen m" arbitrary: m) +proof (induct "nlen m" arbitrary: m) case 0 thus ?case by (simp add: nlen_zero) next case (Suc nd) - hence IH: - "nd = nlen (m div 10) \ - m div 10 = (\x c < 10" and cdef: "c = m mod 10" by simp show "m = (\xxx y \ ubasis_le (basis_emb x) (basis_emb y)" -proof (induct n \ "max (place x) (place y)" arbitrary: x y rule: less_induct) - case (less n) - hence IH: - "\(a::'a compact_basis) b. - \max (place a) (place b) < max (place x) (place y); a \ b\ - \ ubasis_le (basis_emb a) (basis_emb b)" - by simp +proof (induct "max (place x) (place y)" arbitrary: x y rule: less_induct) + case less show ?case proof (rule linorder_cases) assume "place x < place y" then have "rank x < rank y" @@ -709,7 +704,7 @@ apply (case_tac "y = compact_bot", simp) apply (simp add: basis_emb.simps [of y]) apply (rule ubasis_le_trans [OF _ ubasis_le_lower [OF fin2]]) - apply (rule IH) + apply (rule less) apply (simp add: less_max_iff_disj) apply (erule place_sub_less) apply (erule rank_less_imp_below_sub [OF `x \ y`]) @@ -724,7 +719,7 @@ apply (case_tac "x = compact_bot", simp add: ubasis_le_minimal) apply (simp add: basis_emb.simps [of x]) apply (rule ubasis_le_upper [OF fin2], simp) - apply (rule IH) + apply (rule less) apply (simp add: less_max_iff_disj) apply (erule place_sub_less) apply (erule rev_below_trans)