Adapted to changes in induct method.
authorberghofe
Sun Jan 10 18:43:45 2010 +0100 (2010-01-10)
changeset 349157894c7dab132
parent 34914 e391c3de0f6b
child 34916 f625d8d6fcf3
Adapted to changes in induct method.
src/HOL/Algebra/UnivPoly.thy
src/HOL/Bali/Basis.thy
src/HOL/Bali/DeclConcepts.thy
src/HOL/Bali/WellForm.thy
src/HOL/Code_Numeral.thy
src/HOL/Decision_Procs/Reflected_Multivariate_Polynomial.thy
src/HOL/GCD.thy
src/HOL/Induct/Common_Patterns.thy
src/HOL/Isar_Examples/Puzzle.thy
src/HOL/Library/Fundamental_Theorem_Algebra.thy
src/HOL/Library/Polynomial.thy
src/HOL/Library/Word.thy
src/HOL/MicroJava/BV/EffectMono.thy
src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy
src/HOL/Multivariate_Analysis/Euclidean_Space.thy
src/HOL/Nominal/Examples/Class.thy
src/HOL/Nominal/Examples/Fsub.thy
src/HOL/Nominal/Examples/Pattern.thy
src/HOL/Nominal/Examples/SOS.thy
src/HOL/Old_Number_Theory/Legacy_GCD.thy
src/HOL/ex/ThreeDivides.thy
src/HOLCF/Universal.thy
     1.1 --- a/src/HOL/Algebra/UnivPoly.thy	Sun Jan 10 18:41:07 2010 +0100
     1.2 +++ b/src/HOL/Algebra/UnivPoly.thy	Sun Jan 10 18:43:45 2010 +0100
     1.3 @@ -1581,14 +1581,10 @@
     1.4      {
     1.5        (*JE: we now apply the induction hypothesis with some additional facts required*)
     1.6        from f_in_P deg_g_le_deg_f show ?thesis
     1.7 -      proof (induct n \<equiv> "deg R f" arbitrary: "f" rule: nat_less_induct)
     1.8 -        fix n f
     1.9 -        assume hypo: "\<forall>m<n. \<forall>x. x \<in> carrier P \<longrightarrow>
    1.10 -          deg R g \<le> deg R x \<longrightarrow> 
    1.11 -          m = deg R x \<longrightarrow>
    1.12 -          (\<exists>q r (k::nat). q \<in> carrier P \<and> r \<in> carrier P \<and> lcoeff g (^) k \<odot>\<^bsub>P\<^esub> x = g \<otimes>\<^bsub>P\<^esub> q \<oplus>\<^bsub>P\<^esub> r & (r = \<zero>\<^bsub>P\<^esub> | deg R r < deg R g))"
    1.13 -          and prem: "n = deg R f" and f_in_P [simp]: "f \<in> carrier P"
    1.14 -          and deg_g_le_deg_f: "deg R g \<le> deg R f"
    1.15 +      proof (induct "deg R f" arbitrary: "f" rule: less_induct)
    1.16 +        case less
    1.17 +        note f_in_P [simp] = `f \<in> carrier P`
    1.18 +          and deg_g_le_deg_f = `deg R g \<le> deg R f`
    1.19          let ?k = "1::nat" and ?r = "(g \<otimes>\<^bsub>P\<^esub> (monom P (lcoeff f) (deg R f - deg R g))) \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> (lcoeff g \<odot>\<^bsub>P\<^esub> f)"
    1.20            and ?q = "monom P (lcoeff f) (deg R f - deg R g)"
    1.21          show "\<exists> q r (k::nat). q \<in> carrier P \<and> r \<in> carrier P \<and> lcoeff g (^) k \<odot>\<^bsub>P\<^esub> f = g \<otimes>\<^bsub>P\<^esub> q \<oplus>\<^bsub>P\<^esub> r & (r = \<zero>\<^bsub>P\<^esub> | deg R r < deg R g)"
    1.22 @@ -1631,13 +1627,13 @@
    1.23                  {
    1.24                    (*JE: now it only remains the case where the induction hypothesis can be used.*)
    1.25                    (*JE: we first prove that the degree of the remainder is smaller than the one of f*)
    1.26 -                  have deg_remainder_l_f: "deg R (\<ominus>\<^bsub>P\<^esub> ?r) < n"
    1.27 +                  have deg_remainder_l_f: "deg R (\<ominus>\<^bsub>P\<^esub> ?r) < deg R f"
    1.28                    proof -
    1.29                      have "deg R (\<ominus>\<^bsub>P\<^esub> ?r) = deg R ?r" using deg_uminus [of ?r] by simp
    1.30                      also have "\<dots> < deg R f"
    1.31                      proof (rule deg_lcoeff_cancel)
    1.32                        show "deg R (\<ominus>\<^bsub>P\<^esub> (lcoeff g \<odot>\<^bsub>P\<^esub> f)) \<le> deg R f"
    1.33 -                        using deg_smult_ring [of "lcoeff g" f] using prem
    1.34 +                        using deg_smult_ring [of "lcoeff g" f]
    1.35                          using lcoeff_nonzero2 [OF g_in_P g_not_zero] by simp
    1.36                        show "deg R (g \<otimes>\<^bsub>P\<^esub> ?q) \<le> deg R f"
    1.37                          using monom_deg_mult [OF _ g_in_P, of f "lcoeff f"] and deg_g_le_deg_f
    1.38 @@ -1651,7 +1647,7 @@
    1.39                          using R.finsum_singleton [of "deg R g" "{.. deg R f}" "(\<lambda>i. coeff P g i \<otimes> lcoeff f)"]
    1.40                          unfolding Pi_def using deg_g_le_deg_f by force
    1.41                      qed (simp_all add: deg_f_nzero)
    1.42 -                    finally show "deg R (\<ominus>\<^bsub>P\<^esub> ?r) < n" unfolding prem .
    1.43 +                    finally show "deg R (\<ominus>\<^bsub>P\<^esub> ?r) < deg R f" .
    1.44                    qed
    1.45                    moreover have "\<ominus>\<^bsub>P\<^esub> ?r \<in> carrier P" by simp
    1.46                    moreover obtain m where deg_rem_eq_m: "deg R (\<ominus>\<^bsub>P\<^esub> ?r) = m" by auto
    1.47 @@ -1660,7 +1656,7 @@
    1.48                    ultimately obtain q' r' k'
    1.49                      where rem_desc: "lcoeff g (^) (k'::nat) \<odot>\<^bsub>P\<^esub> (\<ominus>\<^bsub>P\<^esub> ?r) = g \<otimes>\<^bsub>P\<^esub> q' \<oplus>\<^bsub>P\<^esub> r'"and rem_deg: "(r' = \<zero>\<^bsub>P\<^esub> \<or> deg R r' < deg R g)"
    1.50                      and q'_in_carrier: "q' \<in> carrier P" and r'_in_carrier: "r' \<in> carrier P"
    1.51 -                    using hypo by blast
    1.52 +                    using less by blast
    1.53                        (*JE: we now prove that the new quotient, remainder and exponent can be used to get 
    1.54                        the quotient, remainder and exponent of the long division theorem*)
    1.55                    show ?thesis
     2.1 --- a/src/HOL/Bali/Basis.thy	Sun Jan 10 18:41:07 2010 +0100
     2.2 +++ b/src/HOL/Bali/Basis.thy	Sun Jan 10 18:43:45 2010 +0100
     2.3 @@ -1,7 +1,5 @@
     2.4  (*  Title:      HOL/Bali/Basis.thy
     2.5 -    ID:         $Id$
     2.6      Author:     David von Oheimb
     2.7 -
     2.8  *)
     2.9  header {* Definitions extending HOL as logical basis of Bali *}
    2.10  
    2.11 @@ -66,8 +64,6 @@
    2.12   "\<lbrakk> \<And> a b c. \<lbrakk>(a,b)\<in>r; (a,c)\<in>r\<rbrakk> \<Longrightarrow> b=c; (a,x)\<in>r\<^sup>*; (a,y)\<in>r\<^sup>*\<rbrakk> 
    2.13   \<Longrightarrow> (x,y)\<in>r\<^sup>* \<or> (y,x)\<in>r\<^sup>*"
    2.14  proof -
    2.15 -  note converse_rtrancl_induct = converse_rtrancl_induct [consumes 1]
    2.16 -  note converse_rtranclE = converse_rtranclE [consumes 1] 
    2.17    assume unique: "\<And> a b c. \<lbrakk>(a,b)\<in>r; (a,c)\<in>r\<rbrakk> \<Longrightarrow> b=c"
    2.18    assume "(a,x)\<in>r\<^sup>*" 
    2.19    then show "(a,y)\<in>r\<^sup>* \<Longrightarrow> (x,y)\<in>r\<^sup>* \<or> (y,x)\<in>r\<^sup>*"
    2.20 @@ -110,13 +106,6 @@
    2.21  apply (auto dest: rtrancl_into_trancl1)
    2.22  done
    2.23  
    2.24 -(* ### To Transitive_Closure *)
    2.25 -theorems converse_rtrancl_induct 
    2.26 - = converse_rtrancl_induct [consumes 1,case_names Id Step]
    2.27 -
    2.28 -theorems converse_trancl_induct 
    2.29 -         = converse_trancl_induct [consumes 1,case_names Single Step]
    2.30 -
    2.31  (* context (theory "Set") *)
    2.32  lemma Ball_weaken:"\<lbrakk>Ball s P;\<And> x. P x\<longrightarrow>Q x\<rbrakk>\<Longrightarrow>Ball s Q"
    2.33  by auto
     3.1 --- a/src/HOL/Bali/DeclConcepts.thy	Sun Jan 10 18:41:07 2010 +0100
     3.2 +++ b/src/HOL/Bali/DeclConcepts.thy	Sun Jan 10 18:43:45 2010 +0100
     3.3 @@ -1,5 +1,4 @@
     3.4  (*  Title:      HOL/Bali/DeclConcepts.thy
     3.5 -    ID:         $Id$
     3.6      Author:     Norbert Schirmer
     3.7  *)
     3.8  header {* Advanced concepts on Java declarations like overriding, inheritance,
     3.9 @@ -2282,74 +2281,47 @@
    3.10  done
    3.11  
    3.12  lemma superclasses_mono:
    3.13 -"\<lbrakk>G\<turnstile>C \<prec>\<^sub>C D;ws_prog G; class G C = Some c;
    3.14 -  \<And> C c. \<lbrakk>class G C = Some c;C\<noteq>Object\<rbrakk> \<Longrightarrow> \<exists> sc. class G (super c) = Some sc;
    3.15 -  x\<in>superclasses G D 
    3.16 -\<rbrakk> \<Longrightarrow> x\<in>superclasses G C" 
    3.17 -proof -
    3.18 -  
    3.19 -  assume     ws: "ws_prog G"          and 
    3.20 -          cls_C: "class G C = Some c" and
    3.21 -             wf: "\<And>C c. \<lbrakk>class G C = Some c; C \<noteq> Object\<rbrakk>
    3.22 -                  \<Longrightarrow> \<exists>sc. class G (super c) = Some sc"
    3.23 -  assume clsrel: "G\<turnstile>C\<prec>\<^sub>C D"           
    3.24 -  thus "\<And> c. \<lbrakk>class G C = Some c; x\<in>superclasses G D\<rbrakk>\<Longrightarrow>
    3.25 -        x\<in>superclasses G C" (is "PROP ?P C"  
    3.26 -                             is "\<And> c. ?CLS C c \<Longrightarrow> ?SUP D \<Longrightarrow> ?SUP C")
    3.27 -  proof (induct ?P C  rule: converse_trancl_induct)
    3.28 -    fix C c
    3.29 -    assume "G\<turnstile>C\<prec>\<^sub>C\<^sub>1D" "class G C = Some c" "x \<in> superclasses G D"
    3.30 -    with wf ws show "?SUP C"
    3.31 -      by (auto    intro: no_subcls1_Object 
    3.32 -               simp add: superclasses_rec subcls1_def)
    3.33 -  next
    3.34 -    fix C S c
    3.35 -    assume clsrel': "G\<turnstile>C \<prec>\<^sub>C\<^sub>1 S" "G\<turnstile>S \<prec>\<^sub>C D"
    3.36 -       and    hyp : "\<And> s. \<lbrakk>class G S = Some s; x \<in> superclasses G D\<rbrakk>
    3.37 -                           \<Longrightarrow> x \<in> superclasses G S"
    3.38 -       and  cls_C': "class G C = Some c"
    3.39 -       and       x: "x \<in> superclasses G D"
    3.40 -    moreover note wf ws
    3.41 -    moreover from calculation 
    3.42 -    have "?SUP S" 
    3.43 -      by (force intro: no_subcls1_Object simp add: subcls1_def)
    3.44 -    moreover from calculation 
    3.45 -    have "super c = S" 
    3.46 -      by (auto intro: no_subcls1_Object simp add: subcls1_def)
    3.47 -    ultimately show "?SUP C" 
    3.48 -      by (auto intro: no_subcls1_Object simp add: superclasses_rec)
    3.49 -  qed
    3.50 +  assumes clsrel: "G\<turnstile>C\<prec>\<^sub>C D"
    3.51 +  and ws: "ws_prog G"
    3.52 +  and cls_C: "class G C = Some c"
    3.53 +  and wf: "\<And>C c. \<lbrakk>class G C = Some c; C \<noteq> Object\<rbrakk>
    3.54 +    \<Longrightarrow> \<exists>sc. class G (super c) = Some sc"
    3.55 +  and x: "x\<in>superclasses G D"
    3.56 +  shows "x\<in>superclasses G C" using clsrel cls_C x
    3.57 +proof (induct arbitrary: c rule: converse_trancl_induct)
    3.58 +  case (base C)
    3.59 +  with wf ws show ?case
    3.60 +    by (auto    intro: no_subcls1_Object 
    3.61 +             simp add: superclasses_rec subcls1_def)
    3.62 +next
    3.63 +  case (step C S)
    3.64 +  moreover note wf ws
    3.65 +  moreover from calculation 
    3.66 +  have "x\<in>superclasses G S"
    3.67 +    by (force intro: no_subcls1_Object simp add: subcls1_def)
    3.68 +  moreover from calculation 
    3.69 +  have "super c = S" 
    3.70 +    by (auto intro: no_subcls1_Object simp add: subcls1_def)
    3.71 +  ultimately show ?case 
    3.72 +    by (auto intro: no_subcls1_Object simp add: superclasses_rec)
    3.73  qed
    3.74  
    3.75  lemma subclsEval:
    3.76 -"\<lbrakk>G\<turnstile>C \<prec>\<^sub>C D;ws_prog G; class G C = Some c;
    3.77 -  \<And> C c. \<lbrakk>class G C = Some c;C\<noteq>Object\<rbrakk> \<Longrightarrow> \<exists> sc. class G (super c) = Some sc 
    3.78 - \<rbrakk> \<Longrightarrow> D\<in>superclasses G C" 
    3.79 -proof -
    3.80 -  note converse_trancl_induct 
    3.81 -       = converse_trancl_induct [consumes 1,case_names Single Step]
    3.82 -  assume 
    3.83 -             ws: "ws_prog G"          and 
    3.84 -          cls_C: "class G C = Some c" and
    3.85 -             wf: "\<And>C c. \<lbrakk>class G C = Some c; C \<noteq> Object\<rbrakk>
    3.86 -                  \<Longrightarrow> \<exists>sc. class G (super c) = Some sc"
    3.87 -  assume clsrel: "G\<turnstile>C\<prec>\<^sub>C D"           
    3.88 -  thus "\<And> c. class G C = Some c\<Longrightarrow> D\<in>superclasses G C" 
    3.89 -    (is "PROP ?P C"  is "\<And> c. ?CLS C c  \<Longrightarrow> ?SUP C")
    3.90 -  proof (induct ?P C  rule: converse_trancl_induct)
    3.91 -    fix C c
    3.92 -    assume "G\<turnstile>C \<prec>\<^sub>C\<^sub>1 D" "class G C = Some c"
    3.93 -    with ws wf show "?SUP C"
    3.94 -      by (auto intro: no_subcls1_Object simp add: superclasses_rec subcls1_def)
    3.95 -  next
    3.96 -    fix C S c
    3.97 -    assume "G\<turnstile>C \<prec>\<^sub>C\<^sub>1 S" "G\<turnstile>S\<prec>\<^sub>C D" 
    3.98 -           "\<And>s. class G S = Some s \<Longrightarrow> D \<in> superclasses G S"
    3.99 -           "class G C = Some c" 
   3.100 -    with ws wf show "?SUP C"
   3.101 -      by - (rule superclasses_mono,
   3.102 -            auto dest: no_subcls1_Object simp add: subcls1_def )
   3.103 -  qed
   3.104 +  assumes clsrel: "G\<turnstile>C\<prec>\<^sub>C D"
   3.105 +  and ws: "ws_prog G"
   3.106 +  and cls_C: "class G C = Some c"
   3.107 +  and wf: "\<And>C c. \<lbrakk>class G C = Some c; C \<noteq> Object\<rbrakk>
   3.108 +    \<Longrightarrow> \<exists>sc. class G (super c) = Some sc"
   3.109 +  shows "D\<in>superclasses G C" using clsrel cls_C
   3.110 +proof (induct arbitrary: c rule: converse_trancl_induct)
   3.111 +  case (base C)
   3.112 +  with ws wf show ?case
   3.113 +    by (auto intro: no_subcls1_Object simp add: superclasses_rec subcls1_def)
   3.114 +next
   3.115 +  case (step C S)
   3.116 +  with ws wf show ?case
   3.117 +    by - (rule superclasses_mono,
   3.118 +          auto dest: no_subcls1_Object simp add: subcls1_def )
   3.119  qed
   3.120  
   3.121  end
     4.1 --- a/src/HOL/Bali/WellForm.thy	Sun Jan 10 18:41:07 2010 +0100
     4.2 +++ b/src/HOL/Bali/WellForm.thy	Sun Jan 10 18:43:45 2010 +0100
     4.3 @@ -1,5 +1,4 @@
     4.4  (*  Title:      HOL/Bali/WellForm.thy
     4.5 -    ID:         $Id$
     4.6      Author:     David von Oheimb and Norbert Schirmer
     4.7  *)
     4.8  
     4.9 @@ -1409,8 +1408,7 @@
    4.10    from clsC ws 
    4.11    show "methd G C sig = Some m 
    4.12          \<Longrightarrow> G\<turnstile>(mdecl (sig,mthd m)) declared_in (declclass m)"
    4.13 -    (is "PROP ?P C") 
    4.14 -  proof (induct ?P C rule: ws_class_induct')
    4.15 +  proof (induct C rule: ws_class_induct')
    4.16      case Object
    4.17      assume "methd G Object sig = Some m" 
    4.18      with wf show ?thesis
    4.19 @@ -1755,28 +1753,20 @@
    4.20  lemma ballE': "\<forall>x\<in>A. P x \<Longrightarrow> (x \<notin> A \<Longrightarrow> Q) \<Longrightarrow> (P x \<Longrightarrow> Q) \<Longrightarrow> Q" by blast
    4.21  
    4.22  lemma subint_widen_imethds: 
    4.23 - "\<lbrakk>G\<turnstile>I\<preceq>I J; wf_prog G; is_iface G J; jm \<in> imethds G J sig\<rbrakk> \<Longrightarrow>   
    4.24 -  \<exists> im \<in> imethds G I sig. is_static im = is_static jm \<and> 
    4.25 +  assumes irel: "G\<turnstile>I\<preceq>I J"
    4.26 +  and wf: "wf_prog G"
    4.27 +  and is_iface: "is_iface G J"
    4.28 +  and jm: "jm \<in> imethds G J sig"
    4.29 +  shows "\<exists>im \<in> imethds G I sig. is_static im = is_static jm \<and> 
    4.30                            accmodi im = accmodi jm \<and>
    4.31                            G\<turnstile>resTy im\<preceq>resTy jm"
    4.32 -proof -
    4.33 -  assume irel: "G\<turnstile>I\<preceq>I J" and
    4.34 -           wf: "wf_prog G" and
    4.35 -     is_iface: "is_iface G J"
    4.36 -  from irel show "jm \<in> imethds G J sig \<Longrightarrow> ?thesis" 
    4.37 -               (is "PROP ?P I" is "PROP ?Prem J \<Longrightarrow> ?Concl I")
    4.38 -  proof (induct ?P I rule: converse_rtrancl_induct) 
    4.39 -    case Id
    4.40 -    assume "jm \<in> imethds G J sig"
    4.41 -    then show "?Concl J" by  (blast elim: bexI')
    4.42 +  using irel jm
    4.43 +proof (induct rule: converse_rtrancl_induct)
    4.44 +    case base
    4.45 +    then show ?case by  (blast elim: bexI')
    4.46    next
    4.47 -    case Step
    4.48 -    fix I SI
    4.49 -    assume subint1_I_SI: "G\<turnstile>I \<prec>I1 SI" and 
    4.50 -            subint_SI_J: "G\<turnstile>SI \<preceq>I J" and
    4.51 -                    hyp: "PROP ?P SI" and
    4.52 -                     jm: "jm \<in> imethds G J sig"
    4.53 -    from subint1_I_SI 
    4.54 +    case (step I SI)
    4.55 +    from `G\<turnstile>I \<prec>I1 SI`
    4.56      obtain i where
    4.57        ifI: "iface G I = Some i" and
    4.58         SI: "SI \<in> set (isuperIfs i)"
    4.59 @@ -1784,10 +1774,10 @@
    4.60  
    4.61      let ?newMethods 
    4.62            = "(Option.set \<circ> table_of (map (\<lambda>(sig, mh). (sig, I, mh)) (imethods i)))"
    4.63 -    show "?Concl I"
    4.64 +    show ?case
    4.65      proof (cases "?newMethods sig = {}")
    4.66        case True
    4.67 -      with ifI SI hyp wf jm 
    4.68 +      with ifI SI step wf
    4.69        show "?thesis" 
    4.70          by (auto simp add: imethds_rec) 
    4.71      next
    4.72 @@ -1816,7 +1806,7 @@
    4.73          wf_SI: "wf_idecl G (SI,si)" 
    4.74          by (auto dest!: wf_idecl_supD is_acc_ifaceD
    4.75                    dest: wf_prog_idecl)
    4.76 -      from jm hyp 
    4.77 +      from step
    4.78        obtain sim::"qtname \<times> mhead"  where
    4.79                        sim: "sim \<in> imethds G SI sig" and
    4.80           eq_static_sim_jm: "is_static sim = is_static jm" and 
    4.81 @@ -1841,7 +1831,6 @@
    4.82        show ?thesis 
    4.83          by auto 
    4.84      qed
    4.85 -  qed
    4.86  qed
    4.87       
    4.88  (* Tactical version *)
    4.89 @@ -1974,30 +1963,20 @@
    4.90    from clsC ws 
    4.91    show "\<And> m d. \<lbrakk>methd G C sig = Some m; class G (declclass m) = Some d\<rbrakk>
    4.92          \<Longrightarrow> table_of (methods d) sig  = Some (mthd m)" 
    4.93 -         (is "PROP ?P C") 
    4.94 -  proof (induct ?P C rule: ws_class_induct)
    4.95 +  proof (induct rule: ws_class_induct)
    4.96      case Object
    4.97 -    fix m d
    4.98 -    assume "methd G Object sig = Some m" 
    4.99 -           "class G (declclass m) = Some d"
   4.100      with wf show "?thesis m d" by auto
   4.101    next
   4.102 -    case Subcls
   4.103 -    fix C c m d
   4.104 -    assume hyp: "PROP ?P (super c)"
   4.105 -    and      m: "methd G C sig = Some m"
   4.106 -    and  declC: "class G (declclass m) = Some d"
   4.107 -    and   clsC: "class G C = Some c"
   4.108 -    and   nObj: "C \<noteq> Object"
   4.109 +    case (Subcls C c)
   4.110      let ?newMethods = "table_of (map (\<lambda>(s, m). (s, C, m)) (methods c)) sig"
   4.111      show "?thesis m d" 
   4.112      proof (cases "?newMethods")
   4.113        case None
   4.114 -      from None clsC nObj ws m declC
   4.115 -      show "?thesis" by (auto simp add: methd_rec) (rule hyp)
   4.116 +      from None ws Subcls
   4.117 +      show "?thesis" by (auto simp add: methd_rec) (rule Subcls)
   4.118      next
   4.119        case Some
   4.120 -      from Some clsC nObj ws m declC
   4.121 +      from Some ws Subcls
   4.122        show "?thesis" 
   4.123          by (auto simp add: methd_rec
   4.124                       dest: wf_prog_cdecl wf_cdecl_supD is_acc_class_is_class)
     5.1 --- a/src/HOL/Code_Numeral.thy	Sun Jan 10 18:41:07 2010 +0100
     5.2 +++ b/src/HOL/Code_Numeral.thy	Sun Jan 10 18:43:45 2010 +0100
     5.3 @@ -83,7 +83,7 @@
     5.4      then have "\<And>n. P (of_nat n) \<Longrightarrow> P (Suc_code_numeral (of_nat n))" .
     5.5      then have step: "\<And>n. P (of_nat n) \<Longrightarrow> P (of_nat (Suc n))" by simp
     5.6    from init step have "P (of_nat (nat_of k))"
     5.7 -    by (induct "nat_of k") simp_all
     5.8 +    by (induct ("nat_of k")) simp_all
     5.9    then show "P k" by simp
    5.10  qed simp_all
    5.11  
    5.12 @@ -100,7 +100,7 @@
    5.13    fix k
    5.14    have "code_numeral_size k = nat_size (nat_of k)"
    5.15      by (induct k rule: code_numeral.induct) (simp_all del: zero_code_numeral_def Suc_code_numeral_def, simp_all)
    5.16 -  also have "nat_size (nat_of k) = nat_of k" by (induct "nat_of k") simp_all
    5.17 +  also have "nat_size (nat_of k) = nat_of k" by (induct ("nat_of k")) simp_all
    5.18    finally show "code_numeral_size k = nat_of k" .
    5.19  qed
    5.20  
     6.1 --- a/src/HOL/Decision_Procs/Reflected_Multivariate_Polynomial.thy	Sun Jan 10 18:41:07 2010 +0100
     6.2 +++ b/src/HOL/Decision_Procs/Reflected_Multivariate_Polynomial.thy	Sun Jan 10 18:43:45 2010 +0100
     6.3 @@ -987,16 +987,14 @@
     6.4    assumes nq: "isnpolyh p n0" and eq :"\<forall>bs. wf_bs bs p \<longrightarrow> \<lparr>p\<rparr>\<^sub>p\<^bsup>bs\<^esup> = (0::'a::{ring_char_0,power,division_by_zero,field})"
     6.5    shows "p = 0\<^sub>p"
     6.6  using nq eq
     6.7 -proof (induct n\<equiv>"maxindex p" arbitrary: p n0 rule: nat_less_induct)
     6.8 -  fix n p n0
     6.9 -  assume H: "\<forall>m<n. \<forall>p n0. isnpolyh p n0 \<longrightarrow>
    6.10 -    (\<forall>bs. wf_bs bs p \<longrightarrow> \<lparr>p\<rparr>\<^sub>p\<^bsup>bs\<^esup> = (0::'a)) \<longrightarrow> m = maxindex p \<longrightarrow> p = 0\<^sub>p"
    6.11 -    and np: "isnpolyh p n0" and zp: "\<forall>bs. wf_bs bs p \<longrightarrow> \<lparr>p\<rparr>\<^sub>p\<^bsup>bs\<^esup> = (0::'a)" and n: "n = maxindex p"
    6.12 -  {assume nz: "n = 0"
    6.13 -    then obtain c where "p = C c" using n np by (cases p, auto)
    6.14 +proof (induct "maxindex p" arbitrary: p n0 rule: less_induct)
    6.15 +  case less
    6.16 +  note np = `isnpolyh p n0` and zp = `\<forall>bs. wf_bs bs p \<longrightarrow> \<lparr>p\<rparr>\<^sub>p\<^bsup>bs\<^esup> = (0::'a)`
    6.17 +  {assume nz: "maxindex p = 0"
    6.18 +    then obtain c where "p = C c" using np by (cases p, auto)
    6.19      with zp np have "p = 0\<^sub>p" unfolding wf_bs_def by simp}
    6.20    moreover
    6.21 -  {assume nz: "n \<noteq> 0"
    6.22 +  {assume nz: "maxindex p \<noteq> 0"
    6.23      let ?h = "head p"
    6.24      let ?hd = "decrpoly ?h"
    6.25      let ?ihd = "maxindex ?hd"
    6.26 @@ -1005,24 +1003,23 @@
    6.27      hence nhd: "isnpolyh ?hd (n0 - 1)" using decrpoly_normh by blast
    6.28      
    6.29      from maxindex_coefficients[of p] coefficients_head[of p, symmetric]
    6.30 -    have mihn: "maxindex ?h \<le> n" unfolding n by auto
    6.31 -    with decr_maxindex[OF h(2)] nz  have ihd_lt_n: "?ihd < n" by auto
    6.32 +    have mihn: "maxindex ?h \<le> maxindex p" by auto
    6.33 +    with decr_maxindex[OF h(2)] nz  have ihd_lt_n: "?ihd < maxindex p" by auto
    6.34      {fix bs:: "'a list"  assume bs: "wf_bs bs ?hd"
    6.35        let ?ts = "take ?ihd bs"
    6.36        let ?rs = "drop ?ihd bs"
    6.37        have ts: "wf_bs ?ts ?hd" using bs unfolding wf_bs_def by simp
    6.38        have bs_ts_eq: "?ts@ ?rs = bs" by simp
    6.39        from wf_bs_decrpoly[OF ts] have tsh: " \<forall>x. wf_bs (x#?ts) ?h" by simp
    6.40 -      from ihd_lt_n have "ALL x. length (x#?ts) \<le> n" by simp
    6.41 -      with length_le_list_ex obtain xs where xs:"length ((x#?ts) @ xs) = n" by blast
    6.42 -      hence "\<forall> x. wf_bs ((x#?ts) @ xs) p" using n unfolding wf_bs_def by simp
    6.43 +      from ihd_lt_n have "ALL x. length (x#?ts) \<le> maxindex p" by simp
    6.44 +      with length_le_list_ex obtain xs where xs:"length ((x#?ts) @ xs) = maxindex p" by blast
    6.45 +      hence "\<forall> x. wf_bs ((x#?ts) @ xs) p" unfolding wf_bs_def by simp
    6.46        with zp have "\<forall> x. Ipoly ((x#?ts) @ xs) p = 0" by blast
    6.47        hence "\<forall> x. Ipoly (x#(?ts @ xs)) p = 0" by simp
    6.48        with polypoly_poly[OF np, where ?'a = 'a] polypoly_polypoly'[OF np, where ?'a = 'a]
    6.49        have "\<forall>x. poly (polypoly' (?ts @ xs) p) x = poly [] x"  by simp
    6.50        hence "poly (polypoly' (?ts @ xs) p) = poly []" by (auto intro: ext) 
    6.51        hence "\<forall> c \<in> set (coefficients p). Ipoly (?ts @ xs) (decrpoly c) = 0"
    6.52 -        thm poly_zero
    6.53          using poly_zero[where ?'a='a] by (simp add: polypoly'_def list_all_iff)
    6.54        with coefficients_head[of p, symmetric]
    6.55        have th0: "Ipoly (?ts @ xs) ?hd = 0" by simp
    6.56 @@ -1031,7 +1028,7 @@
    6.57        with wf'' wf_bs_I[of ?ts ?hd ?rs] bs_ts_eq have "\<lparr>?hd\<rparr>\<^sub>p\<^bsup>bs\<^esup> = 0" by simp }
    6.58      then have hdz: "\<forall>bs. wf_bs bs ?hd \<longrightarrow> \<lparr>?hd\<rparr>\<^sub>p\<^bsup>bs\<^esup> = (0::'a)" by blast
    6.59      
    6.60 -    from H[rule_format, OF ihd_lt_n nhd] hdz have "?hd = 0\<^sub>p" by blast
    6.61 +    from less(1)[OF ihd_lt_n nhd] hdz have "?hd = 0\<^sub>p" by blast
    6.62      hence "?h = 0\<^sub>p" by simp
    6.63      with head_nz[OF np] have "p = 0\<^sub>p" by simp}
    6.64    ultimately show "p = 0\<^sub>p" by blast
    6.65 @@ -1357,8 +1354,8 @@
    6.66    (polydivide_aux (a,n,p,k,s) = (k',r) \<longrightarrow> (k' \<ge> k) \<and> (degree r = 0 \<or> degree r < degree p) 
    6.67            \<and> (\<exists>nr. isnpolyh r nr) \<and> (\<exists>q n1. isnpolyh q n1 \<and> ((polypow (k' - k) a) *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)))"
    6.68    using ns
    6.69 -proof(induct d\<equiv>"degree s" arbitrary: s k k' r n1 rule: nat_less_induct)
    6.70 -  fix d s k k' r n1
    6.71 +proof(induct "degree s" arbitrary: s k k' r n1 rule: less_induct)
    6.72 +  case less
    6.73    let ?D = "polydivide_aux_dom"
    6.74    let ?dths = "?D (a, n, p, k, s)"
    6.75    let ?qths = "\<exists>q n1. isnpolyh q n1 \<and> (a ^\<^sub>p (k' - k) *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)"
    6.76 @@ -1366,20 +1363,13 @@
    6.77      \<and> (\<exists>nr. isnpolyh r nr) \<and> ?qths"
    6.78    let ?ths = "?dths \<and> ?qrths"
    6.79    let ?b = "head s"
    6.80 -  let ?p' = "funpow (d - n) shift1 p"
    6.81 -  let ?xdn = "funpow (d - n) shift1 1\<^sub>p"
    6.82 +  let ?p' = "funpow (degree s - n) shift1 p"
    6.83 +  let ?xdn = "funpow (degree s - n) shift1 1\<^sub>p"
    6.84    let ?akk' = "a ^\<^sub>p (k' - k)"
    6.85 -  assume H: "\<forall>m<d. \<forall>x xa xb xc xd.
    6.86 -    isnpolyh x xd \<longrightarrow>
    6.87 -    m = degree x \<longrightarrow> ?D (a, n, p, xa, x) \<and>
    6.88 -    (polydivide_aux (a, n, p, xa, x) = (xb, xc) \<longrightarrow>
    6.89 -    xa \<le> xb \<and> (degree xc = 0 \<or> degree xc < degree p) \<and> 
    6.90 -    (\<exists> nr. isnpolyh xc nr) \<and>
    6.91 -    (\<exists>q n1. isnpolyh q n1 \<and> a ^\<^sub>p xb - xa *\<^sub>p x = p *\<^sub>p q +\<^sub>p xc))"
    6.92 -    and ns: "isnpolyh s n1" and ds: "d = degree s"
    6.93 +  note ns = `isnpolyh s n1`
    6.94    from np have np0: "isnpolyh p 0" 
    6.95      using isnpolyh_mono[where n="n0" and n'="0" and p="p"]  by simp
    6.96 -  have np': "isnpolyh ?p' 0" using funpow_shift1_isnpoly[OF np0[simplified isnpoly_def[symmetric]] pnz, where n="d -n"] isnpoly_def by simp
    6.97 +  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
    6.98    have headp': "head ?p' = head p" using funpow_shift1_head[OF np pnz] by simp
    6.99    from funpow_shift1_isnpoly[where p="1\<^sub>p"] have nxdn: "isnpolyh ?xdn 0" by (simp add: isnpoly_def)
   6.100    from polypow_normh [OF head_isnpolyh[OF np0], where k="k' - k"] ap 
   6.101 @@ -1391,31 +1381,31 @@
   6.102      hence ?ths using dom by blast}
   6.103    moreover
   6.104    {assume sz: "s \<noteq> 0\<^sub>p"
   6.105 -    {assume dn: "d < n"
   6.106 -      with sz ds  have dom:"?dths" by - (rule polydivide_aux_real_domintros,simp_all) 
   6.107 -      from polydivide_aux.psimps[OF dom] sz dn ds
   6.108 +    {assume dn: "degree s < n"
   6.109 +      with sz have dom:"?dths" by - (rule polydivide_aux_real_domintros,simp_all) 
   6.110 +      from polydivide_aux.psimps[OF dom] sz dn
   6.111        have "?qrths" using ns ndp np by auto (rule exI[where x="0\<^sub>p"],simp)
   6.112        with dom have ?ths by blast}
   6.113      moreover 
   6.114 -    {assume dn': "\<not> d < n" hence dn: "d \<ge> n" by arith
   6.115 +    {assume dn': "\<not> degree s < n" hence dn: "degree s \<ge> n" by arith
   6.116        have degsp': "degree s = degree ?p'" 
   6.117 -        using ds dn ndp funpow_shift1_degree[where k = "d - n" and p="p"] by simp
   6.118 +        using dn ndp funpow_shift1_degree[where k = "degree s - n" and p="p"] by simp
   6.119        {assume ba: "?b = a"
   6.120          hence headsp': "head s = head ?p'" using ap headp' by simp
   6.121          have nr: "isnpolyh (s -\<^sub>p ?p') 0" using polysub_normh[OF ns np'] by simp
   6.122 -        from ds degree_polysub_samehead[OF ns np' headsp' degsp']
   6.123 -        have "degree (s -\<^sub>p ?p') < d \<or> s -\<^sub>p ?p' = 0\<^sub>p" by simp
   6.124 +        from degree_polysub_samehead[OF ns np' headsp' degsp']
   6.125 +        have "degree (s -\<^sub>p ?p') < degree s \<or> s -\<^sub>p ?p' = 0\<^sub>p" by simp
   6.126          moreover 
   6.127 -        {assume deglt:"degree (s -\<^sub>p ?p') < d"
   6.128 -          from  H[rule_format, OF deglt nr,simplified] 
   6.129 +        {assume deglt:"degree (s -\<^sub>p ?p') < degree s"
   6.130 +          from  less(1)[OF deglt nr] 
   6.131            have domsp: "?D (a, n, p, k, s -\<^sub>p ?p')" by blast 
   6.132            have dom: ?dths apply (rule polydivide_aux_real_domintros) 
   6.133 -            using ba ds dn' domsp by simp_all
   6.134 -          from polydivide_aux.psimps[OF dom] sz dn' ba ds
   6.135 +            using ba dn' domsp by simp_all
   6.136 +          from polydivide_aux.psimps[OF dom] sz dn' ba
   6.137            have eq: "polydivide_aux (a,n,p,k,s) = polydivide_aux (a,n,p,k, s -\<^sub>p ?p')"
   6.138              by (simp add: Let_def)
   6.139            {assume h1: "polydivide_aux (a, n, p, k, s) = (k', r)"
   6.140 -            from H[rule_format, OF deglt nr, where xa = "k" and xb="k'" and xc="r", simplified]
   6.141 +            from less(1)[OF deglt nr, of k k' r]
   6.142                trans[OF eq[symmetric] h1]
   6.143              have kk': "k \<le> k'" and nr:"\<exists>nr. isnpolyh r nr" and dr: "degree r = 0 \<or> degree r < degree p"
   6.144                and q1:"\<exists>q nq. isnpolyh q nq \<and> (a ^\<^sub>p k' - k *\<^sub>p (s -\<^sub>p ?p') = p *\<^sub>p q +\<^sub>p r)" by auto
   6.145 @@ -1434,19 +1424,19 @@
   6.146                Ipoly bs (a^\<^sub>p (k' - k)) * Ipoly bs ?p' + Ipoly bs p * Ipoly bs q + Ipoly bs r" 
   6.147                by (simp add: ring_simps)
   6.148              hence " \<forall>(bs:: 'a::{ring_char_0,division_by_zero,field} list). Ipoly bs (a ^\<^sub>p (k' - k) *\<^sub>p s) = 
   6.149 -              Ipoly bs (a^\<^sub>p (k' - k)) * Ipoly bs (funpow (d - n) shift1 1\<^sub>p *\<^sub>p p) 
   6.150 +              Ipoly bs (a^\<^sub>p (k' - k)) * Ipoly bs (funpow (degree s - n) shift1 1\<^sub>p *\<^sub>p p) 
   6.151                + Ipoly bs p * Ipoly bs q + Ipoly bs r"
   6.152                by (auto simp only: funpow_shift1_1) 
   6.153              hence "\<forall>(bs:: 'a::{ring_char_0,division_by_zero,field} list). Ipoly bs (a ^\<^sub>p (k' - k) *\<^sub>p s) = 
   6.154 -              Ipoly bs p * (Ipoly bs (a^\<^sub>p (k' - k)) * Ipoly bs (funpow (d - n) shift1 1\<^sub>p) 
   6.155 +              Ipoly bs p * (Ipoly bs (a^\<^sub>p (k' - k)) * Ipoly bs (funpow (degree s - n) shift1 1\<^sub>p) 
   6.156                + Ipoly bs q) + Ipoly bs r" by (simp add: ring_simps)
   6.157              hence "\<forall>(bs:: 'a::{ring_char_0,division_by_zero,field} list). Ipoly bs (a ^\<^sub>p (k' - k) *\<^sub>p s) = 
   6.158 -              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
   6.159 +              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
   6.160              with isnpolyh_unique[OF nakks' nqr']
   6.161              have "a ^\<^sub>p (k' - k) *\<^sub>p s = 
   6.162 -              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
   6.163 +              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
   6.164              hence ?qths using nq'
   6.165 -              apply (rule_tac x="(a^\<^sub>p (k' - k)) *\<^sub>p (funpow (d - n) shift1 1\<^sub>p) +\<^sub>p q" in exI)
   6.166 +              apply (rule_tac x="(a^\<^sub>p (k' - k)) *\<^sub>p (funpow (degree s - n) shift1 1\<^sub>p) +\<^sub>p q" in exI)
   6.167                apply (rule_tac x="0" in exI) by simp
   6.168              with kk' nr dr have "k \<le> k' \<and> (degree r = 0 \<or> degree r < degree p) \<and> (\<exists>nr. isnpolyh r nr) \<and> ?qths"
   6.169                by blast } hence ?qrths by blast
   6.170 @@ -1456,25 +1446,23 @@
   6.171            hence domsp: "?D (a, n, p, k, s -\<^sub>p ?p')" 
   6.172              apply (simp) by (rule polydivide_aux_real_domintros, simp_all)
   6.173            have dom: ?dths apply (rule polydivide_aux_real_domintros) 
   6.174 -            using ba ds dn' domsp by simp_all
   6.175 +            using ba dn' domsp by simp_all
   6.176            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}"]
   6.177            have " \<forall>(bs:: 'a::{ring_char_0,division_by_zero,field} list). Ipoly bs s = Ipoly bs ?p'" by simp
   6.178            hence "\<forall>(bs:: 'a::{ring_char_0,division_by_zero,field} list). Ipoly bs s = Ipoly bs (?xdn *\<^sub>p p)" using np nxdn apply simp
   6.179              by (simp only: funpow_shift1_1) simp
   6.180            hence sp': "s = ?xdn *\<^sub>p p" using isnpolyh_unique[OF ns polymul_normh[OF nxdn np]] by blast
   6.181            {assume h1: "polydivide_aux (a,n,p,k,s) = (k',r)"
   6.182 -            from polydivide_aux.psimps[OF dom] sz dn' ba ds
   6.183 +            from polydivide_aux.psimps[OF dom] sz dn' ba
   6.184              have eq: "polydivide_aux (a,n,p,k,s) = polydivide_aux (a,n,p,k, s -\<^sub>p ?p')"
   6.185                by (simp add: Let_def)
   6.186              also have "\<dots> = (k,0\<^sub>p)" using polydivide_aux.psimps[OF domsp] spz by simp
   6.187              finally have "(k',r) = (k,0\<^sub>p)" using h1 by simp
   6.188 -            with sp' ns np nxdn polyadd_0(1)[OF polymul_normh[OF np nxdn]]
   6.189 +            with sp'[symmetric] ns np nxdn polyadd_0(1)[OF polymul_normh[OF np nxdn]]
   6.190                polyadd_0(2)[OF polymul_normh[OF np nxdn]] have ?qrths
   6.191                apply auto
   6.192                apply (rule exI[where x="?xdn"])        
   6.193 -              apply auto
   6.194 -              apply (rule polymul_commute)
   6.195 -              apply simp_all
   6.196 +              apply (auto simp add: polymul_commute[of p])
   6.197                done}
   6.198            with dom have ?ths by blast}
   6.199          ultimately have ?ths by blast }
   6.200 @@ -1488,31 +1476,30 @@
   6.201              polymul_eq0_iff[OF head_isnpolyh[OF ns] np']head_nz[OF np0] ap pnz sz head_nz[OF ns]
   6.202              funpow_shift1_nz[OF pnz] by simp_all
   6.203          from polymul_head_polyeq[OF head_isnpolyh[OF np] ns] head_nz[OF np] sz ap head_head[OF np] pnz
   6.204 -          polymul_head_polyeq[OF head_isnpolyh[OF ns] np'] head_nz [OF ns] sz funpow_shift1_nz[OF pnz, where n="d - n"]
   6.205 +          polymul_head_polyeq[OF head_isnpolyh[OF ns] np'] head_nz [OF ns] sz funpow_shift1_nz[OF pnz, where n="degree s - n"]
   6.206          have hdth: "head (a *\<^sub>p s) = head (?b *\<^sub>p ?p')" 
   6.207            using head_head[OF ns] funpow_shift1_head[OF np pnz]
   6.208              polymul_commute[OF head_isnpolyh[OF np] head_isnpolyh[OF ns]]
   6.209            by (simp add: ap)
   6.210          from polymul_degreen[OF head_isnpolyh[OF np] ns, where m="0"]
   6.211            head_nz[OF np] pnz sz ap[symmetric]
   6.212 -          funpow_shift1_nz[OF pnz, where n="d - n"]
   6.213 +          funpow_shift1_nz[OF pnz, where n="degree s - n"]
   6.214            polymul_degreen[OF head_isnpolyh[OF ns] np', where m="0"]  head_nz[OF ns]
   6.215 -          ndp ds[symmetric] dn
   6.216 +          ndp dn
   6.217          have degth: "degree (a *\<^sub>p s) = degree (?b *\<^sub>p ?p') "
   6.218            by (simp add: degree_eq_degreen0[symmetric] funpow_shift1_degree)
   6.219 -        {assume dth: "degree ((a *\<^sub>p s) -\<^sub>p (?b *\<^sub>p ?p')) < d"
   6.220 +        {assume dth: "degree ((a *\<^sub>p s) -\<^sub>p (?b *\<^sub>p ?p')) < degree s"
   6.221            have th: "?D (a, n, p, Suc k, (a *\<^sub>p s) -\<^sub>p (?b *\<^sub>p ?p'))"
   6.222 -            using H[rule_format, OF dth nth, simplified] by blast 
   6.223 -          have dom: ?dths
   6.224 -            using ba ds dn' th apply simp apply (rule polydivide_aux_real_domintros)  
   6.225 -            using ba ds dn'  by simp_all
   6.226 +            using less(1)[OF dth nth] by blast 
   6.227 +          have dom: ?dths using ba dn' th
   6.228 +            by - (rule polydivide_aux_real_domintros, simp_all)
   6.229            from polysub_normh[OF polymul_normh[OF head_isnpolyh[OF np] ns] polymul_normh[OF head_isnpolyh[OF ns]np']]
   6.230            ap have nasbp': "isnpolyh ((a *\<^sub>p s) -\<^sub>p (?b *\<^sub>p ?p')) 0" by simp
   6.231            {assume h1:"polydivide_aux (a,n,p,k,s) = (k', r)"
   6.232 -            from h1  polydivide_aux.psimps[OF dom] sz dn' ba ds
   6.233 +            from h1  polydivide_aux.psimps[OF dom] sz dn' ba
   6.234              have eq:"polydivide_aux (a,n,p,Suc k,(a *\<^sub>p s) -\<^sub>p (?b *\<^sub>p ?p')) = (k',r)"
   6.235                by (simp add: Let_def)
   6.236 -            with H[rule_format, OF dth nasbp', simplified, where xa="Suc k" and xb="k'" and xc="r"]
   6.237 +            with less(1)[OF dth nasbp', of "Suc k" k' r]
   6.238              obtain q nq nr where kk': "Suc k \<le> k'" and nr: "isnpolyh r nr" and nq: "isnpolyh q nq" 
   6.239                and dr: "degree r = 0 \<or> degree r < degree p"
   6.240                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
   6.241 @@ -1524,7 +1511,7 @@
   6.242              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"
   6.243                by (simp add: ring_simps power_Suc)
   6.244              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"
   6.245 -              by (simp add:kk'' funpow_shift1_1[where n="d - n" and p="p"])
   6.246 +              by (simp add:kk'' funpow_shift1_1[where n="degree s - n" and p="p"])
   6.247              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"
   6.248                by (simp add: ring_simps)}
   6.249              hence ieq:"\<forall>(bs :: 'a::{ring_char_0,division_by_zero,field} list). Ipoly bs (a ^\<^sub>p (k' - k) *\<^sub>p s) = 
   6.250 @@ -1546,13 +1533,13 @@
   6.251          {assume spz: "a *\<^sub>p s -\<^sub>p (?b *\<^sub>p ?p') = 0\<^sub>p"
   6.252            hence domsp: "?D (a, n, p, Suc k, a *\<^sub>p s -\<^sub>p (?b *\<^sub>p ?p'))" 
   6.253              apply (simp) by (rule polydivide_aux_real_domintros, simp_all)
   6.254 -          have dom: ?dths using sz ba dn' ds domsp 
   6.255 +          have dom: ?dths using sz ba dn' domsp 
   6.256              by - (rule polydivide_aux_real_domintros, simp_all)
   6.257            {fix bs :: "'a::{ring_char_0,division_by_zero,field} list"
   6.258              from isnpolyh_unique[OF nth, where ?'a="'a" and q="0\<^sub>p",simplified,symmetric] spz
   6.259            have "Ipoly bs (a*\<^sub>p s) = Ipoly bs ?b * Ipoly bs ?p'" by simp
   6.260            hence "Ipoly bs (a*\<^sub>p s) = Ipoly bs (?b *\<^sub>p ?xdn) * Ipoly bs p" 
   6.261 -            by (simp add: funpow_shift1_1[where n="d - n" and p="p"])
   6.262 +            by (simp add: funpow_shift1_1[where n="degree s - n" and p="p"])
   6.263            hence "Ipoly bs (a*\<^sub>p s) = Ipoly bs (p *\<^sub>p (?b *\<^sub>p ?xdn))" by simp
   6.264          }
   6.265          hence hth: "\<forall> (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))" ..
   6.266 @@ -1562,7 +1549,7 @@
   6.267                      polymul_normh[OF np polymul_normh[OF head_isnpolyh[OF ns] nxdn]],
   6.268                simplified ap] by simp
   6.269            {assume h1: "polydivide_aux (a,n,p,k,s) = (k', r)"
   6.270 -          from h1 sz ds ba dn' spz polydivide_aux.psimps[OF dom] polydivide_aux.psimps[OF domsp] 
   6.271 +          from h1 sz ba dn' spz polydivide_aux.psimps[OF dom] polydivide_aux.psimps[OF domsp] 
   6.272            have "(k',r) = (Suc k, 0\<^sub>p)" by (simp add: Let_def)
   6.273            with h1 np head_isnpolyh[OF np, simplified ap] ns polymul_normh[OF head_isnpolyh[OF ns] nxdn]
   6.274              polymul_normh[OF np polymul_normh[OF head_isnpolyh[OF ns] nxdn]] asq
   6.275 @@ -1573,7 +1560,7 @@
   6.276          hence ?qrths by blast
   6.277          with dom have ?ths by blast}
   6.278          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"]
   6.279 -          head_nz[OF np] pnz sz ap[symmetric] ds[symmetric] 
   6.280 +          head_nz[OF np] pnz sz ap[symmetric]
   6.281            by (simp add: degree_eq_degreen0[symmetric]) blast }
   6.282        ultimately have ?ths by blast
   6.283      }
     7.1 --- a/src/HOL/GCD.thy	Sun Jan 10 18:41:07 2010 +0100
     7.2 +++ b/src/HOL/GCD.thy	Sun Jan 10 18:43:45 2010 +0100
     7.3 @@ -16,7 +16,7 @@
     7.4  another extension of the notions to the integers, and added a number
     7.5  of results to "Primes" and "GCD". IntPrimes also defined and developed
     7.6  the congruence relations on the integers. The notion was extended to
     7.7 -the natural numbers by Chiaeb.
     7.8 +the natural numbers by Chaieb.
     7.9  
    7.10  Jeremy Avigad combined all of these, made everything uniform for the
    7.11  natural numbers and the integers, and added a number of new theorems.
    7.12 @@ -25,7 +25,7 @@
    7.13  *)
    7.14  
    7.15  
    7.16 -header {* Greates common divisor and least common multiple *}
    7.17 +header {* Greatest common divisor and least common multiple *}
    7.18  
    7.19  theory GCD
    7.20  imports Fact Parity
    7.21 @@ -1074,34 +1074,35 @@
    7.22    assumes c: " \<forall>a b. P (a::nat) b \<longleftrightarrow> P b a" and z: "\<forall>a. P a 0"
    7.23    and add: "\<forall>a b. P a b \<longrightarrow> P a (a + b)"
    7.24    shows "P a b"
    7.25 -proof(induct n\<equiv>"a+b" arbitrary: a b rule: nat_less_induct)
    7.26 -  fix n a b
    7.27 -  assume H: "\<forall>m < n. \<forall>a b. m = a + b \<longrightarrow> P a b" "n = a + b"
    7.28 +proof(induct "a + b" arbitrary: a b rule: less_induct)
    7.29 +  case less
    7.30    have "a = b \<or> a < b \<or> b < a" by arith
    7.31    moreover {assume eq: "a= b"
    7.32      from add[rule_format, OF z[rule_format, of a]] have "P a b" using eq
    7.33      by simp}
    7.34    moreover
    7.35    {assume lt: "a < b"
    7.36 -    hence "a + b - a < n \<or> a = 0"  using H(2) by arith
    7.37 +    hence "a + b - a < a + b \<or> a = 0" by arith
    7.38      moreover
    7.39      {assume "a =0" with z c have "P a b" by blast }
    7.40      moreover
    7.41 -    {assume ab: "a + b - a < n"
    7.42 -      have th0: "a + b - a = a + (b - a)" using lt by arith
    7.43 -      from add[rule_format, OF H(1)[rule_format, OF ab th0]]
    7.44 -      have "P a b" by (simp add: th0[symmetric])}
    7.45 +    {assume "a + b - a < a + b"
    7.46 +      also have th0: "a + b - a = a + (b - a)" using lt by arith
    7.47 +      finally have "a + (b - a) < a + b" .
    7.48 +      then have "P a (a + (b - a))" by (rule add[rule_format, OF less])
    7.49 +      then have "P a b" by (simp add: th0[symmetric])}
    7.50      ultimately have "P a b" by blast}
    7.51    moreover
    7.52    {assume lt: "a > b"
    7.53 -    hence "b + a - b < n \<or> b = 0"  using H(2) by arith
    7.54 +    hence "b + a - b < a + b \<or> b = 0" by arith
    7.55      moreover
    7.56      {assume "b =0" with z c have "P a b" by blast }
    7.57      moreover
    7.58 -    {assume ab: "b + a - b < n"
    7.59 -      have th0: "b + a - b = b + (a - b)" using lt by arith
    7.60 -      from add[rule_format, OF H(1)[rule_format, OF ab th0]]
    7.61 -      have "P b a" by (simp add: th0[symmetric])
    7.62 +    {assume "b + a - b < a + b"
    7.63 +      also have th0: "b + a - b = b + (a - b)" using lt by arith
    7.64 +      finally have "b + (a - b) < a + b" .
    7.65 +      then have "P b (b + (a - b))" by (rule add[rule_format, OF less])
    7.66 +      then have "P b a" by (simp add: th0[symmetric])
    7.67        hence "P a b" using c by blast }
    7.68      ultimately have "P a b" by blast}
    7.69  ultimately  show "P a b" by blast
     8.1 --- a/src/HOL/Induct/Common_Patterns.thy	Sun Jan 10 18:41:07 2010 +0100
     8.2 +++ b/src/HOL/Induct/Common_Patterns.thy	Sun Jan 10 18:43:45 2010 +0100
     8.3 @@ -73,7 +73,7 @@
     8.4    show "P (a x)" sorry
     8.5  next
     8.6    case (Suc n)
     8.7 -  note hyp = `\<And>x. A (a x) \<Longrightarrow> n = a x \<Longrightarrow> P (a x)`
     8.8 +  note hyp = `\<And>x. n = a x \<Longrightarrow> A (a x) \<Longrightarrow> P (a x)`
     8.9      and prem = `A (a x)`
    8.10      and defn = `Suc n = a x`
    8.11    show "P (a x)" sorry
     9.1 --- a/src/HOL/Isar_Examples/Puzzle.thy	Sun Jan 10 18:41:07 2010 +0100
     9.2 +++ b/src/HOL/Isar_Examples/Puzzle.thy	Sun Jan 10 18:43:45 2010 +0100
     9.3 @@ -22,17 +22,16 @@
     9.4  proof (rule order_antisym)
     9.5    {
     9.6      fix n show "n \<le> f n"
     9.7 -    proof (induct k \<equiv> "f n" arbitrary: n rule: less_induct)
     9.8 -      case (less k n)
     9.9 -      then have hyp: "\<And>m. f m < f n \<Longrightarrow> m \<le> f m" by (simp only:)
    9.10 +    proof (induct "f n" arbitrary: n rule: less_induct)
    9.11 +      case less
    9.12        show "n \<le> f n"
    9.13        proof (cases n)
    9.14          case (Suc m)
    9.15          from f_ax have "f (f m) < f n" by (simp only: Suc)
    9.16 -        with hyp have "f m \<le> f (f m)" .
    9.17 +        with less have "f m \<le> f (f m)" .
    9.18          also from f_ax have "\<dots> < f n" by (simp only: Suc)
    9.19          finally have "f m < f n" .
    9.20 -        with hyp have "m \<le> f m" .
    9.21 +        with less have "m \<le> f m" .
    9.22          also note `\<dots> < f n`
    9.23          finally have "m < f n" .
    9.24          then have "n \<le> f n" by (simp only: Suc)
    10.1 --- a/src/HOL/Library/Fundamental_Theorem_Algebra.thy	Sun Jan 10 18:41:07 2010 +0100
    10.2 +++ b/src/HOL/Library/Fundamental_Theorem_Algebra.thy	Sun Jan 10 18:43:45 2010 +0100
    10.3 @@ -621,19 +621,18 @@
    10.4      done
    10.5  qed
    10.6  
    10.7 -text{* Fundamental theorem of algebral *}
    10.8 +text{* Fundamental theorem of algebra *}
    10.9  
   10.10  lemma fundamental_theorem_of_algebra:
   10.11    assumes nc: "~constant(poly p)"
   10.12    shows "\<exists>z::complex. poly p z = 0"
   10.13  using nc
   10.14 -proof(induct n\<equiv> "psize p" arbitrary: p rule: nat_less_induct)
   10.15 -  fix n fix p :: "complex poly"
   10.16 +proof(induct "psize p" arbitrary: p rule: less_induct)
   10.17 +  case less
   10.18    let ?p = "poly p"
   10.19 -  assume H: "\<forall>m<n. \<forall>p. \<not> constant (poly p) \<longrightarrow> m = psize p \<longrightarrow> (\<exists>(z::complex). poly p z = 0)" and nc: "\<not> constant ?p" and n: "n = psize p"
   10.20    let ?ths = "\<exists>z. ?p z = 0"
   10.21  
   10.22 -  from nonconstant_length[OF nc] have n2: "n\<ge> 2" by (simp add: n)
   10.23 +  from nonconstant_length[OF less(2)] have n2: "psize p \<ge> 2" .
   10.24    from poly_minimum_modulus obtain c where
   10.25      c: "\<forall>w. cmod (?p c) \<le> cmod (?p w)" by blast
   10.26    {assume pc: "?p c = 0" hence ?ths by blast}
   10.27 @@ -649,7 +648,7 @@
   10.28            using h unfolding constant_def by blast
   10.29          also have "\<dots> = ?p y" using th by auto
   10.30          finally have "?p x = ?p y" .}
   10.31 -      with nc have False unfolding constant_def by blast }
   10.32 +      with less(2) have False unfolding constant_def by blast }
   10.33      hence qnc: "\<not> constant (poly q)" by blast
   10.34      from q(2) have pqc0: "?p c = poly q 0" by simp
   10.35      from c pqc0 have cq0: "\<forall>w. cmod (poly q 0) \<le> cmod (?p w)" by simp
   10.36 @@ -682,8 +681,8 @@
   10.37      from poly_decompose[OF rnc] obtain k a s where
   10.38        kas: "a\<noteq>0" "k\<noteq>0" "psize s + k + 1 = psize ?r"
   10.39        "\<forall>z. poly ?r z = poly ?r 0 + z^k* poly (pCons a s) z" by blast
   10.40 -    {assume "k + 1 = n"
   10.41 -      with kas(3) lgqr[symmetric] q(1) n[symmetric] have s0:"s=0" by auto
   10.42 +    {assume "psize p = k + 1"
   10.43 +      with kas(3) lgqr[symmetric] q(1) have s0:"s=0" by auto
   10.44        {fix w
   10.45          have "cmod (poly ?r w) = cmod (1 + a * w ^ k)"
   10.46            using kas(4)[rule_format, of w] s0 r01 by (simp add: algebra_simps)}
   10.47 @@ -691,15 +690,15 @@
   10.48          from reduce_poly_simple[OF kas(1,2)]
   10.49        have "\<exists>w. cmod (poly ?r w) < 1" unfolding hth by blast}
   10.50      moreover
   10.51 -    {assume kn: "k+1 \<noteq> n"
   10.52 -      from kn kas(3) q(1) n[symmetric] lgqr have k1n: "k + 1 < n" by simp
   10.53 +    {assume kn: "psize p \<noteq> k+1"
   10.54 +      from kn kas(3) q(1) lgqr have k1n: "k + 1 < psize p" by simp
   10.55        have th01: "\<not> constant (poly (pCons 1 (monom a (k - 1))))"
   10.56          unfolding constant_def poly_pCons poly_monom
   10.57          using kas(1) apply simp
   10.58          by (rule exI[where x=0], rule exI[where x=1], simp)
   10.59        from kas(1) kas(2) have th02: "k+1 = psize (pCons 1 (monom a (k - 1)))"
   10.60          by (simp add: psize_def degree_monom_eq)
   10.61 -      from H[rule_format, OF k1n th01 th02]
   10.62 +      from less(1) [OF k1n [simplified th02] th01]
   10.63        obtain w where w: "1 + w^k * a = 0"
   10.64          unfolding poly_pCons poly_monom
   10.65          using kas(2) by (cases k, auto simp add: algebra_simps)
    11.1 --- a/src/HOL/Library/Polynomial.thy	Sun Jan 10 18:41:07 2010 +0100
    11.2 +++ b/src/HOL/Library/Polynomial.thy	Sun Jan 10 18:43:45 2010 +0100
    11.3 @@ -1384,7 +1384,7 @@
    11.4      with k have "degree p = Suc (degree k)"
    11.5        by (simp add: degree_mult_eq del: mult_pCons_left)
    11.6      with `Suc n = degree p` have "n = degree k" by simp
    11.7 -    with `k \<noteq> 0` have "finite {x. poly k x = 0}" by (rule Suc.hyps)
    11.8 +    then have "finite {x. poly k x = 0}" using `k \<noteq> 0` by (rule Suc.hyps)
    11.9      then have "finite (insert a {x. poly k x = 0})" by simp
   11.10      then show "finite {x. poly p x = 0}"
   11.11        by (simp add: k uminus_add_conv_diff Collect_disj_eq
    12.1 --- a/src/HOL/Library/Word.thy	Sun Jan 10 18:41:07 2010 +0100
    12.2 +++ b/src/HOL/Library/Word.thy	Sun Jan 10 18:43:45 2010 +0100
    12.3 @@ -436,7 +436,7 @@
    12.4        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"
    12.5        proof -
    12.6          have "(2::nat) ^ (length xs + length l2) = 2 ^ length xs * 2 ^ length l2"
    12.7 -          by (induct "length xs",simp_all)
    12.8 +          by (induct ("length xs")) simp_all
    12.9          hence "bitval x * 2 ^ (length xs + length l2) + bv_to_nat xs * 2 ^ length l2 =
   12.10            bitval x * 2 ^ length xs * 2 ^ length l2 + bv_to_nat xs * 2 ^ length l2"
   12.11            by simp
   12.12 @@ -2165,13 +2165,13 @@
   12.13    apply (simp add: bv_extend_def)
   12.14    apply (subst bv_to_nat_dist_append)
   12.15    apply simp
   12.16 -  apply (induct "n - length w")
   12.17 +  apply (induct ("n - length w"))
   12.18     apply simp_all
   12.19    done
   12.20  
   12.21  lemma bv_msb_extend_same [simp]: "bv_msb w = b ==> bv_msb (bv_extend n b w) = b"
   12.22    apply (simp add: bv_extend_def)
   12.23 -  apply (induct "n - length w")
   12.24 +  apply (cases "n - length w")
   12.25     apply simp_all
   12.26    done
   12.27  
   12.28 @@ -2188,7 +2188,7 @@
   12.29    show ?thesis
   12.30      apply (simp add: bv_to_int_def)
   12.31      apply (simp add: bv_extend_def)
   12.32 -    apply (induct "n - length w",simp_all)
   12.33 +    apply (induct ("n - length w"), simp_all)
   12.34      done
   12.35  qed
   12.36  
    13.1 --- a/src/HOL/MicroJava/BV/EffectMono.thy	Sun Jan 10 18:41:07 2010 +0100
    13.2 +++ b/src/HOL/MicroJava/BV/EffectMono.thy	Sun Jan 10 18:43:45 2010 +0100
    13.3 @@ -15,12 +15,13 @@
    13.4  
    13.5  lemma sup_loc_some [rule_format]:
    13.6  "\<forall>y n. (G \<turnstile> b <=l y) \<longrightarrow> n < length y \<longrightarrow> y!n = OK t \<longrightarrow> 
    13.7 -  (\<exists>t. b!n = OK t \<and> (G \<turnstile> (b!n) <=o (y!n)))" (is "?P b")
    13.8 -proof (induct ?P b)
    13.9 -  show "?P []" by simp
   13.10 +  (\<exists>t. b!n = OK t \<and> (G \<turnstile> (b!n) <=o (y!n)))"
   13.11 +proof (induct b)
   13.12 +  case Nil
   13.13 +  show ?case by simp
   13.14  next
   13.15    case (Cons a list)
   13.16 -  show "?P (a#list)" 
   13.17 +  show ?case 
   13.18    proof (clarsimp simp add: list_all2_Cons1 sup_loc_def Listn.le_def lesub_def)
   13.19      fix z zs n
   13.20      assume *: 
   13.21 @@ -60,13 +61,14 @@
   13.22   
   13.23  
   13.24  lemma append_length_n [rule_format]: 
   13.25 -"\<forall>n. n \<le> length x \<longrightarrow> (\<exists>a b. x = a@b \<and> length a = n)" (is "?P x")
   13.26 -proof (induct ?P x)
   13.27 -  show "?P []" by simp
   13.28 +"\<forall>n. n \<le> length x \<longrightarrow> (\<exists>a b. x = a@b \<and> length a = n)"
   13.29 +proof (induct x)
   13.30 +  case Nil
   13.31 +  show ?case by simp
   13.32  next
   13.33 -  fix l ls assume Cons: "?P ls"
   13.34 +  case (Cons l ls)
   13.35  
   13.36 -  show "?P (l#ls)"
   13.37 +  show ?case
   13.38    proof (intro allI impI)
   13.39      fix n
   13.40      assume l: "n \<le> length (l # ls)"
    14.1 --- a/src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy	Sun Jan 10 18:41:07 2010 +0100
    14.2 +++ b/src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy	Sun Jan 10 18:43:45 2010 +0100
    14.3 @@ -170,8 +170,8 @@
    14.4    next assume "card s > 2" thus ?thesis using as and n_def proof(induct n arbitrary: u s)
    14.5        case (Suc n) fix s::"'a set" and u::"'a \<Rightarrow> real"
    14.6        assume IA:"\<And>u s.  \<lbrakk>2 < card s; \<forall>x\<in>V. \<forall>y\<in>V. \<forall>u v. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> V; finite s;
    14.7 -               s \<noteq> {}; s \<subseteq> V; setsum u s = 1; n \<equiv> card s \<rbrakk> \<Longrightarrow> (\<Sum>x\<in>s. u x *\<^sub>R x) \<in> V" and
    14.8 -        as:"Suc n \<equiv> card s" "2 < card s" "\<forall>x\<in>V. \<forall>y\<in>V. \<forall>u v. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> V"
    14.9 +               s \<noteq> {}; s \<subseteq> V; setsum u s = 1; n = card s \<rbrakk> \<Longrightarrow> (\<Sum>x\<in>s. u x *\<^sub>R x) \<in> V" and
   14.10 +        as:"Suc n = card s" "2 < card s" "\<forall>x\<in>V. \<forall>y\<in>V. \<forall>u v. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> V"
   14.11             "finite s" "s \<noteq> {}" "s \<subseteq> V" "setsum u s = 1"
   14.12        have "\<exists>x\<in>s. u x \<noteq> 1" proof(rule_tac ccontr)
   14.13          assume " \<not> (\<exists>x\<in>s. u x \<noteq> 1)" hence "setsum u s = real_of_nat (card s)" unfolding card_eq_setsum by auto
   14.14 @@ -1345,7 +1345,7 @@
   14.15  next
   14.16    case False then obtain w where "w\<in>s" by auto
   14.17    show ?thesis unfolding caratheodory[of s]
   14.18 -  proof(induct "CARD('n) + 1")
   14.19 +  proof(induct ("CARD('n) + 1"))
   14.20      have *:"{x.\<exists>sa. finite sa \<and> sa \<subseteq> s \<and> card sa \<le> 0 \<and> x \<in> convex hull sa} = {}" 
   14.21        using compact_empty by (auto simp add: convex_hull_empty)
   14.22      case 0 thus ?case unfolding * by simp
    15.1 --- a/src/HOL/Multivariate_Analysis/Euclidean_Space.thy	Sun Jan 10 18:41:07 2010 +0100
    15.2 +++ b/src/HOL/Multivariate_Analysis/Euclidean_Space.thy	Sun Jan 10 18:43:45 2010 +0100
    15.3 @@ -3542,17 +3542,9 @@
    15.4    and sp:"s \<subseteq> span t"
    15.5    shows "\<exists>t'. (card t' = card t) \<and> finite t' \<and> s \<subseteq> t' \<and> t' \<subseteq> s \<union> t \<and> s \<subseteq> span t'"
    15.6  using f i sp
    15.7 -proof(induct c\<equiv>"card(t - s)" arbitrary: s t rule: nat_less_induct)
    15.8 -  fix n:: nat and s t :: "('a ^'n) set"
    15.9 -  assume H: " \<forall>m<n. \<forall>(x:: ('a ^'n) set) xa.
   15.10 -                finite xa \<longrightarrow>
   15.11 -                independent x \<longrightarrow>
   15.12 -                x \<subseteq> span xa \<longrightarrow>
   15.13 -                m = card (xa - x) \<longrightarrow>
   15.14 -                (\<exists>t'. (card t' = card xa) \<and> finite t' \<and>
   15.15 -                      x \<subseteq> t' \<and> t' \<subseteq> x \<union> xa \<and> x \<subseteq> span t')"
   15.16 -    and ft: "finite t" and s: "independent s" and sp: "s \<subseteq> span t"
   15.17 -    and n: "n = card (t - s)"
   15.18 +proof(induct "card (t - s)" arbitrary: s t rule: less_induct)
   15.19 +  case less
   15.20 +  note ft = `finite t` and s = `independent s` and sp = `s \<subseteq> span t`
   15.21    let ?P = "\<lambda>t'. (card t' = card t) \<and> finite t' \<and> s \<subseteq> t' \<and> t' \<subseteq> s \<union> t \<and> s \<subseteq> span t'"
   15.22    let ?ths = "\<exists>t'. ?P t'"
   15.23    {assume st: "s \<subseteq> t"
   15.24 @@ -3568,12 +3560,12 @@
   15.25    {assume st: "\<not> s \<subseteq> t" "\<not> t \<subseteq> s"
   15.26      from st(2) obtain b where b: "b \<in> t" "b \<notin> s" by blast
   15.27        from b have "t - {b} - s \<subset> t - s" by blast
   15.28 -      then have cardlt: "card (t - {b} - s) < n" using n ft
   15.29 +      then have cardlt: "card (t - {b} - s) < card (t - s)" using ft
   15.30          by (auto intro: psubset_card_mono)
   15.31        from b ft have ct0: "card t \<noteq> 0" by auto
   15.32      {assume stb: "s \<subseteq> span(t -{b})"
   15.33        from ft have ftb: "finite (t -{b})" by auto
   15.34 -      from H[rule_format, OF cardlt ftb s stb]
   15.35 +      from less(1)[OF cardlt ftb s stb]
   15.36        obtain u where u: "card u = card (t-{b})" "s \<subseteq> u" "u \<subseteq> s \<union> (t - {b})" "s \<subseteq> span u" and fu: "finite u" by blast
   15.37        let ?w = "insert b u"
   15.38        have th0: "s \<subseteq> insert b u" using u by blast
   15.39 @@ -3594,8 +3586,8 @@
   15.40        from stb obtain a where a: "a \<in> s" "a \<notin> span (t - {b})" by blast
   15.41        have ab: "a \<noteq> b" using a b by blast
   15.42        have at: "a \<notin> t" using a ab span_superset[of a "t- {b}"] by auto
   15.43 -      have mlt: "card ((insert a (t - {b})) - s) < n"
   15.44 -        using cardlt ft n  a b by auto
   15.45 +      have mlt: "card ((insert a (t - {b})) - s) < card (t - s)"
   15.46 +        using cardlt ft a b by auto
   15.47        have ft': "finite (insert a (t - {b}))" using ft by auto
   15.48        {fix x assume xs: "x \<in> s"
   15.49          have t: "t \<subseteq> (insert b (insert a (t -{b})))" using b by auto
   15.50 @@ -3608,7 +3600,7 @@
   15.51          from span_trans[OF bs x] have "x \<in> span (insert a (t - {b}))"  .}
   15.52        then have sp': "s \<subseteq> span (insert a (t - {b}))" by blast
   15.53  
   15.54 -      from H[rule_format, OF mlt ft' s sp' refl] obtain u where
   15.55 +      from less(1)[OF mlt ft' s sp'] obtain u where
   15.56          u: "card u = card (insert a (t -{b}))" "finite u" "s \<subseteq> u" "u \<subseteq> s \<union> insert a (t -{b})"
   15.57          "s \<subseteq> span u" by blast
   15.58        from u a b ft at ct0 have "?P u" by auto
   15.59 @@ -3657,11 +3649,9 @@
   15.60    assumes sv: "(S::(real^'n) set) \<subseteq> V" and iS: "independent S"
   15.61    shows "\<exists>B. S \<subseteq> B \<and> B \<subseteq> V \<and> independent B \<and> V \<subseteq> span B"
   15.62    using sv iS
   15.63 -proof(induct d\<equiv> "CARD('n) - card S" arbitrary: S rule: nat_less_induct)
   15.64 -  fix n and S:: "(real^'n) set"
   15.65 -  assume H: "\<forall>m<n. \<forall>S \<subseteq> V. independent S \<longrightarrow> m = CARD('n) - card S \<longrightarrow>
   15.66 -              (\<exists>B. S \<subseteq> B \<and> B \<subseteq> V \<and> independent B \<and> V \<subseteq> span B)"
   15.67 -    and sv: "S \<subseteq> V" and i: "independent S" and n: "n = CARD('n) - card S"
   15.68 +proof(induct "CARD('n) - card S" arbitrary: S rule: less_induct)
   15.69 +  case less
   15.70 +  note sv = `S \<subseteq> V` and i = `independent S`
   15.71    let ?P = "\<lambda>B. S \<subseteq> B \<and> B \<subseteq> V \<and> independent B \<and> V \<subseteq> span B"
   15.72    let ?ths = "\<exists>x. ?P x"
   15.73    let ?d = "CARD('n)"
   15.74 @@ -3674,11 +3664,11 @@
   15.75      have th0: "insert a S \<subseteq> V" using a sv by blast
   15.76      from independent_insert[of a S]  i a
   15.77      have th1: "independent (insert a S)" by auto
   15.78 -    have mlt: "?d - card (insert a S) < n"
   15.79 -      using aS a n independent_bound[OF th1]
   15.80 +    have mlt: "?d - card (insert a S) < ?d - card S"
   15.81 +      using aS a independent_bound[OF th1]
   15.82        by auto
   15.83  
   15.84 -    from H[rule_format, OF mlt th0 th1 refl]
   15.85 +    from less(1)[OF mlt th0 th1]
   15.86      obtain B where B: "insert a S \<subseteq> B" "B \<subseteq> V" "independent B" " V \<subseteq> span B"
   15.87        by blast
   15.88      from B have "?P B" by auto
    16.1 --- a/src/HOL/Nominal/Examples/Class.thy	Sun Jan 10 18:41:07 2010 +0100
    16.2 +++ b/src/HOL/Nominal/Examples/Class.thy	Sun Jan 10 18:43:45 2010 +0100
    16.3 @@ -15069,11 +15069,9 @@
    16.4    assumes a: "(M[a\<turnstile>c>b]) \<longrightarrow>\<^isub>a M'" "a\<noteq>b"
    16.5    shows "\<exists>M0. M0[a\<turnstile>c>b]=M' \<and> M \<longrightarrow>\<^isub>a M0"
    16.6  using a
    16.7 -apply(nominal_induct M\<equiv>"M[a\<turnstile>c>b]" M' avoiding: M a b rule: a_redu.strong_induct)
    16.8 -apply(simp)
    16.9 +apply(nominal_induct "M[a\<turnstile>c>b]" M' avoiding: M a b rule: a_redu.strong_induct)
   16.10  apply(drule  crename_lredu)
   16.11  apply(blast)
   16.12 -apply(simp)
   16.13  apply(drule  crename_credu)
   16.14  apply(blast)
   16.15  (* Cut *)
   16.16 @@ -16132,11 +16130,9 @@
   16.17    assumes a: "(M[x\<turnstile>n>y]) \<longrightarrow>\<^isub>a M'" "x\<noteq>y"
   16.18    shows "\<exists>M0. M0[x\<turnstile>n>y]=M' \<and> M \<longrightarrow>\<^isub>a M0"
   16.19  using a
   16.20 -apply(nominal_induct M\<equiv>"M[x\<turnstile>n>y]" M' avoiding: M x y rule: a_redu.strong_induct)
   16.21 -apply(simp)
   16.22 +apply(nominal_induct "M[x\<turnstile>n>y]" M' avoiding: M x y rule: a_redu.strong_induct)
   16.23  apply(drule  nrename_lredu)
   16.24  apply(blast)
   16.25 -apply(simp)
   16.26  apply(drule  nrename_credu)
   16.27  apply(blast)
   16.28  (* Cut *)
    17.1 --- a/src/HOL/Nominal/Examples/Fsub.thy	Sun Jan 10 18:41:07 2010 +0100
    17.2 +++ b/src/HOL/Nominal/Examples/Fsub.thy	Sun Jan 10 18:43:45 2010 +0100
    17.3 @@ -982,19 +982,18 @@
    17.4      from `(\<Delta>@[(TVarB X Q)]@\<Gamma>) \<turnstile> M <: N` 
    17.5        and `\<Gamma> \<turnstile> P<:Q` 
    17.6      show "(\<Delta>@[(TVarB X P)]@\<Gamma>) \<turnstile> M <: N" 
    17.7 -    proof (induct \<Gamma>\<equiv>"\<Delta>@[(TVarB X Q)]@\<Gamma>" M N arbitrary: \<Gamma> X \<Delta> rule: subtype_of.induct) 
    17.8 -      case (SA_Top _ S \<Gamma> X \<Delta>)
    17.9 -      then have lh_drv_prm\<^isub>1: "\<turnstile> (\<Delta>@[(TVarB X Q)]@\<Gamma>) ok" 
   17.10 -        and lh_drv_prm\<^isub>2: "S closed_in (\<Delta>@[(TVarB X Q)]@\<Gamma>)" by simp_all
   17.11 -      have rh_drv: "\<Gamma> \<turnstile> P <: Q" by fact
   17.12 -      hence "P closed_in \<Gamma>" by (simp add: subtype_implies_closed)
   17.13 -      with lh_drv_prm\<^isub>1 have "\<turnstile> (\<Delta>@[(TVarB X P)]@\<Gamma>) ok" by (simp add: replace_type)
   17.14 +    proof (induct "\<Delta>@[(TVarB X Q)]@\<Gamma>" M N arbitrary: \<Gamma> X \<Delta> rule: subtype_of.induct) 
   17.15 +      case (SA_Top S \<Gamma> X \<Delta>)
   17.16 +      from `\<Gamma> \<turnstile> P <: Q`
   17.17 +      have "P closed_in \<Gamma>" by (simp add: subtype_implies_closed)
   17.18 +      with `\<turnstile> (\<Delta>@[(TVarB X Q)]@\<Gamma>) ok` have "\<turnstile> (\<Delta>@[(TVarB X P)]@\<Gamma>) ok"
   17.19 +        by (simp add: replace_type)
   17.20        moreover
   17.21 -      from lh_drv_prm\<^isub>2 have "S closed_in (\<Delta>@[(TVarB X P)]@\<Gamma>)" 
   17.22 +      from `S closed_in (\<Delta>@[(TVarB X Q)]@\<Gamma>)` have "S closed_in (\<Delta>@[(TVarB X P)]@\<Gamma>)" 
   17.23          by (simp add: closed_in_def doms_append)
   17.24        ultimately show "(\<Delta>@[(TVarB X P)]@\<Gamma>) \<turnstile> S <: Top" by (simp add: subtype_of.SA_Top)
   17.25      next
   17.26 -      case (SA_trans_TVar Y S _ N \<Gamma> X \<Delta>) 
   17.27 +      case (SA_trans_TVar Y S N \<Gamma> X \<Delta>) 
   17.28        then have IH_inner: "(\<Delta>@[(TVarB X P)]@\<Gamma>) \<turnstile> S <: N"
   17.29          and lh_drv_prm: "(TVarB Y S) \<in> set (\<Delta>@[(TVarB X Q)]@\<Gamma>)"
   17.30          and rh_drv: "\<Gamma> \<turnstile> P<:Q"
   17.31 @@ -1020,23 +1019,23 @@
   17.32          then show "(\<Delta>@[(TVarB X P)]@\<Gamma>) \<turnstile> Tvar Y <: N" using memb\<^isub>X\<^isub>P eq by auto
   17.33        qed
   17.34      next
   17.35 -      case (SA_refl_TVar _ Y \<Gamma> X \<Delta>)
   17.36 -      then have lh_drv_prm\<^isub>1: "\<turnstile> (\<Delta>@[(TVarB X Q)]@\<Gamma>) ok" 
   17.37 -        and lh_drv_prm\<^isub>2: "Y \<in> ty_dom (\<Delta>@[(TVarB X Q)]@\<Gamma>)" by simp_all
   17.38 -      have "\<Gamma> \<turnstile> P <: Q" by fact
   17.39 -      hence "P closed_in \<Gamma>" by (simp add: subtype_implies_closed)
   17.40 -      with lh_drv_prm\<^isub>1 have "\<turnstile> (\<Delta>@[(TVarB X P)]@\<Gamma>) ok" by (simp add: replace_type)
   17.41 +      case (SA_refl_TVar Y \<Gamma> X \<Delta>)
   17.42 +      from `\<Gamma> \<turnstile> P <: Q`
   17.43 +      have "P closed_in \<Gamma>" by (simp add: subtype_implies_closed)
   17.44 +      with `\<turnstile> (\<Delta>@[(TVarB X Q)]@\<Gamma>) ok` have "\<turnstile> (\<Delta>@[(TVarB X P)]@\<Gamma>) ok"
   17.45 +        by (simp add: replace_type)
   17.46        moreover
   17.47 -      from lh_drv_prm\<^isub>2 have "Y \<in> ty_dom (\<Delta>@[(TVarB X P)]@\<Gamma>)" by (simp add: doms_append)
   17.48 +      from `Y \<in> ty_dom (\<Delta>@[(TVarB X Q)]@\<Gamma>)` have "Y \<in> ty_dom (\<Delta>@[(TVarB X P)]@\<Gamma>)"
   17.49 +        by (simp add: doms_append)
   17.50        ultimately show "(\<Delta>@[(TVarB X P)]@\<Gamma>) \<turnstile> Tvar Y <: Tvar Y" by (simp add: subtype_of.SA_refl_TVar)
   17.51      next
   17.52 -      case (SA_arrow _ S\<^isub>1 Q\<^isub>1 Q\<^isub>2 S\<^isub>2 \<Gamma> X \<Delta>) 
   17.53 +      case (SA_arrow S\<^isub>1 Q\<^isub>1 Q\<^isub>2 S\<^isub>2 \<Gamma> X \<Delta>) 
   17.54        then show "(\<Delta>@[(TVarB X P)]@\<Gamma>) \<turnstile> Q\<^isub>1 \<rightarrow> Q\<^isub>2 <: S\<^isub>1 \<rightarrow> S\<^isub>2" by blast 
   17.55      next
   17.56 -      case (SA_all _ T\<^isub>1 S\<^isub>1 Y S\<^isub>2 T\<^isub>2 \<Gamma> X \<Delta>)
   17.57 -      from SA_all(2,4,5,6)
   17.58 +      case (SA_all T\<^isub>1 S\<^isub>1 Y S\<^isub>2 T\<^isub>2 \<Gamma> X \<Delta>)
   17.59        have IH_inner\<^isub>1: "(\<Delta>@[(TVarB X P)]@\<Gamma>) \<turnstile> T\<^isub>1 <: S\<^isub>1" 
   17.60 -        and IH_inner\<^isub>2: "(((TVarB Y T\<^isub>1)#\<Delta>)@[(TVarB X P)]@\<Gamma>) \<turnstile> S\<^isub>2 <: T\<^isub>2" by force+
   17.61 +        and IH_inner\<^isub>2: "(((TVarB Y T\<^isub>1)#\<Delta>)@[(TVarB X P)]@\<Gamma>) \<turnstile> S\<^isub>2 <: T\<^isub>2"
   17.62 +        by (fastsimp intro: SA_all)+
   17.63        then show "(\<Delta>@[(TVarB X P)]@\<Gamma>) \<turnstile> (\<forall>Y<:S\<^isub>1. S\<^isub>2) <: (\<forall>Y<:T\<^isub>1. T\<^isub>2)" by auto
   17.64      qed
   17.65    } 
   17.66 @@ -1263,7 +1262,7 @@
   17.67    assumes "\<turnstile> (\<Gamma> @ VarB x Q # \<Delta>) ok"
   17.68    shows "\<turnstile> (\<Gamma> @ \<Delta>) ok"
   17.69    using assms
   17.70 -proof (induct  \<Gamma>' \<equiv> "\<Gamma> @ VarB x Q # \<Delta>" arbitrary: \<Gamma> \<Delta>)
   17.71 +proof (induct "\<Gamma> @ VarB x Q # \<Delta>" arbitrary: \<Gamma> \<Delta>)
   17.72    case valid_nil
   17.73    have "[] = \<Gamma> @ VarB x Q # \<Delta>" by fact
   17.74    then have "False" by auto
   17.75 @@ -1314,14 +1313,14 @@
   17.76    and     "\<turnstile> (\<Delta> @ B # \<Gamma>) ok"
   17.77    shows   "(\<Delta> @ B # \<Gamma>) \<turnstile> t : T"
   17.78  using assms
   17.79 -proof(nominal_induct \<Gamma>'\<equiv> "\<Delta> @ \<Gamma>" t T avoiding: \<Delta> \<Gamma> B rule: typing.strong_induct)
   17.80 -  case (T_Var x' T \<Gamma>' \<Gamma>'' \<Delta>')
   17.81 +proof(nominal_induct "\<Delta> @ \<Gamma>" t T avoiding: \<Delta> \<Gamma> B rule: typing.strong_induct)
   17.82 +  case (T_Var x T)
   17.83    then show ?case by auto
   17.84  next
   17.85 -  case (T_App \<Gamma> t\<^isub>1 T\<^isub>1 T\<^isub>2 t\<^isub>2 \<Gamma> \<Delta>)
   17.86 +  case (T_App X t\<^isub>1 T\<^isub>2 T\<^isub>1\<^isub>1 T\<^isub>1\<^isub>2)
   17.87    then show ?case by force
   17.88  next
   17.89 -  case (T_Abs y T\<^isub>1 \<Gamma>' t\<^isub>2 T\<^isub>2 \<Delta> \<Gamma>)
   17.90 +  case (T_Abs y T\<^isub>1 t\<^isub>2 T\<^isub>2 \<Delta> \<Gamma>)
   17.91    then have "VarB y T\<^isub>1 # \<Delta> @ \<Gamma> \<turnstile> t\<^isub>2 : T\<^isub>2" by simp
   17.92    then have closed: "T\<^isub>1 closed_in (\<Delta> @ \<Gamma>)"
   17.93      by (auto dest: typing_ok)
   17.94 @@ -1336,22 +1335,22 @@
   17.95      apply (rule closed)
   17.96      done
   17.97    then have "\<turnstile> ((VarB y T\<^isub>1 # \<Delta>) @ B # \<Gamma>) ok" by simp
   17.98 -  then have "(VarB y T\<^isub>1 # \<Delta>) @ B # \<Gamma> \<turnstile> t\<^isub>2 : T\<^isub>2"
   17.99 -    by (rule T_Abs) (simp add: T_Abs)
  17.100 +  with _ have "(VarB y T\<^isub>1 # \<Delta>) @ B # \<Gamma> \<turnstile> t\<^isub>2 : T\<^isub>2"
  17.101 +    by (rule T_Abs) simp
  17.102    then have "VarB y T\<^isub>1 # \<Delta> @ B # \<Gamma> \<turnstile> t\<^isub>2 : T\<^isub>2" by simp
  17.103    then show ?case by (rule typing.T_Abs)
  17.104  next
  17.105 -  case (T_Sub \<Gamma>' t S T \<Delta> \<Gamma>)
  17.106 -  from `\<turnstile> (\<Delta> @ B # \<Gamma>) ok` and `\<Gamma>' = \<Delta> @ \<Gamma>`
  17.107 +  case (T_Sub t S T \<Delta> \<Gamma>)
  17.108 +  from refl and `\<turnstile> (\<Delta> @ B # \<Gamma>) ok`
  17.109    have "\<Delta> @ B # \<Gamma> \<turnstile> t : S" by (rule T_Sub)
  17.110 -  moreover from  `\<Gamma>'\<turnstile>S<:T` and `\<turnstile> (\<Delta> @ B # \<Gamma>) ok`
  17.111 +  moreover from  `(\<Delta> @ \<Gamma>)\<turnstile>S<:T` and `\<turnstile> (\<Delta> @ B # \<Gamma>) ok`
  17.112    have "(\<Delta> @ B # \<Gamma>)\<turnstile>S<:T"
  17.113      by (rule weakening) (simp add: extends_def T_Sub)
  17.114    ultimately show ?case by (rule typing.T_Sub)
  17.115  next
  17.116 -  case (T_TAbs X T\<^isub>1 \<Gamma>' t\<^isub>2 T\<^isub>2 \<Delta> \<Gamma>)
  17.117 -  then have "TVarB X T\<^isub>1 # \<Delta> @ \<Gamma> \<turnstile> t\<^isub>2 : T\<^isub>2" by simp
  17.118 -  then have closed: "T\<^isub>1 closed_in (\<Delta> @ \<Gamma>)"
  17.119 +  case (T_TAbs X T\<^isub>1 t\<^isub>2 T\<^isub>2 \<Delta> \<Gamma>)
  17.120 +  from `TVarB X T\<^isub>1 # \<Delta> @ \<Gamma> \<turnstile> t\<^isub>2 : T\<^isub>2`
  17.121 +  have closed: "T\<^isub>1 closed_in (\<Delta> @ \<Gamma>)"
  17.122      by (auto dest: typing_ok)
  17.123    have "\<turnstile> (TVarB X T\<^isub>1 # \<Delta> @ B # \<Gamma>) ok"
  17.124      apply (rule valid_consT)
  17.125 @@ -1364,15 +1363,15 @@
  17.126      apply (rule closed)
  17.127      done
  17.128    then have "\<turnstile> ((TVarB X T\<^isub>1 # \<Delta>) @ B # \<Gamma>) ok" by simp
  17.129 -  then have "(TVarB X T\<^isub>1 # \<Delta>) @ B # \<Gamma> \<turnstile> t\<^isub>2 : T\<^isub>2"
  17.130 -    by (rule T_TAbs) (simp add: T_TAbs)
  17.131 +  with _ have "(TVarB X T\<^isub>1 # \<Delta>) @ B # \<Gamma> \<turnstile> t\<^isub>2 : T\<^isub>2"
  17.132 +    by (rule T_TAbs) simp
  17.133    then have "TVarB X T\<^isub>1 # \<Delta> @ B # \<Gamma> \<turnstile> t\<^isub>2 : T\<^isub>2" by simp
  17.134    then show ?case by (rule typing.T_TAbs)
  17.135  next
  17.136 -  case (T_TApp X \<Gamma>' t\<^isub>1 T2 T11 T12 \<Delta> \<Gamma>)
  17.137 +  case (T_TApp X t\<^isub>1 T2 T11 T12 \<Delta> \<Gamma>)
  17.138    have "\<Delta> @ B # \<Gamma> \<turnstile> t\<^isub>1 : (\<forall>X<:T11. T12)"
  17.139 -    by (rule T_TApp)+
  17.140 -  moreover from `\<Gamma>'\<turnstile>T2<:T11` and `\<turnstile> (\<Delta> @ B # \<Gamma>) ok`
  17.141 +    by (rule T_TApp refl)+
  17.142 +  moreover from `(\<Delta> @ \<Gamma>)\<turnstile>T2<:T11` and `\<turnstile> (\<Delta> @ B # \<Gamma>) ok`
  17.143    have "(\<Delta> @ B # \<Gamma>)\<turnstile>T2<:T11"
  17.144      by (rule weakening) (simp add: extends_def T_TApp)
  17.145    ultimately show ?case by (rule better_T_TApp)
  17.146 @@ -1393,24 +1392,22 @@
  17.147    assumes "(\<Gamma> @ VarB x Q # \<Delta>) \<turnstile> S <: T"
  17.148    shows  "(\<Gamma>@\<Delta>) \<turnstile> S <: T"
  17.149    using assms
  17.150 -proof (induct  \<Gamma>' \<equiv> "\<Gamma> @ VarB x Q # \<Delta>" S T arbitrary: \<Gamma>)
  17.151 -  case (SA_Top G' S G)
  17.152 -  then have "\<turnstile> (G @ \<Delta>) ok" by (auto dest: valid_cons')
  17.153 -  moreover have "S closed_in (G @ \<Delta>)" using SA_Top by (auto dest: closed_in_cons)
  17.154 +proof (induct "\<Gamma> @ VarB x Q # \<Delta>" S T arbitrary: \<Gamma>)
  17.155 +  case (SA_Top S)
  17.156 +  then have "\<turnstile> (\<Gamma> @ \<Delta>) ok" by (auto dest: valid_cons')
  17.157 +  moreover have "S closed_in (\<Gamma> @ \<Delta>)" using SA_Top by (auto dest: closed_in_cons)
  17.158    ultimately show ?case using subtype_of.SA_Top by auto
  17.159  next
  17.160 -  case (SA_refl_TVar G X' G')
  17.161 -  then have "\<turnstile> (G' @ VarB x Q # \<Delta>) ok" by simp
  17.162 -  then have h1:"\<turnstile> (G' @ \<Delta>) ok" by (auto dest: valid_cons')
  17.163 -  have "X' \<in> ty_dom (G' @ VarB x Q # \<Delta>)" using SA_refl_TVar by auto
  17.164 -  then have h2:"X' \<in> ty_dom (G' @ \<Delta>)" using ty_dom_vrs by auto
  17.165 +  case (SA_refl_TVar X)
  17.166 +  from `\<turnstile> (\<Gamma> @ VarB x Q # \<Delta>) ok`
  17.167 +  have h1:"\<turnstile> (\<Gamma> @ \<Delta>) ok" by (auto dest: valid_cons')
  17.168 +  have "X \<in> ty_dom (\<Gamma> @ VarB x Q # \<Delta>)" using SA_refl_TVar by auto
  17.169 +  then have h2:"X \<in> ty_dom (\<Gamma> @ \<Delta>)" using ty_dom_vrs by auto
  17.170    show ?case using h1 h2 by auto
  17.171  next
  17.172 -  case (SA_all G T1 S1 X S2 T2 G')
  17.173 -  have ih1:"TVarB X T1 # G = (TVarB X T1 # G') @ VarB x Q # \<Delta> \<Longrightarrow> ((TVarB X T1 # G') @ \<Delta>)\<turnstile>S2<:T2" by fact
  17.174 -  then have h1:"(TVarB X T1 # (G' @ \<Delta>))\<turnstile>S2<:T2" using SA_all by auto
  17.175 -  have ih2:"G = G' @ VarB x Q # \<Delta> \<Longrightarrow> (G' @ \<Delta>)\<turnstile>T1<:S1" by fact
  17.176 -  then have h2:"(G' @ \<Delta>)\<turnstile>T1<:S1" using SA_all by auto
  17.177 +  case (SA_all T1 S1 X S2 T2)
  17.178 +  have h1:"((TVarB X T1 # \<Gamma>) @ \<Delta>)\<turnstile>S2<:T2" by (fastsimp intro: SA_all)
  17.179 +  have h2:"(\<Gamma> @ \<Delta>)\<turnstile>T1<:S1" using SA_all by auto
  17.180    then show ?case using h1 h2 by auto
  17.181  qed (auto)
  17.182  
  17.183 @@ -1418,26 +1415,26 @@
  17.184    assumes H: "\<Delta> @ (TVarB X Q) # \<Gamma> \<turnstile> t : T"
  17.185    shows "\<Gamma> \<turnstile> P <: Q \<Longrightarrow> \<Delta> @ (TVarB X P) # \<Gamma> \<turnstile> t : T"
  17.186    using H
  17.187 -  proof (nominal_induct \<Gamma>' \<equiv> "\<Delta> @ (TVarB X Q) # \<Gamma>" t T avoiding: P arbitrary: \<Delta> rule: typing.strong_induct)
  17.188 -    case (T_Var x T G P D)
  17.189 +  proof (nominal_induct "\<Delta> @ (TVarB X Q) # \<Gamma>" t T avoiding: P arbitrary: \<Delta> rule: typing.strong_induct)
  17.190 +    case (T_Var x T P D)
  17.191      then have "VarB x T \<in> set (D @ TVarB X P # \<Gamma>)" 
  17.192        and "\<turnstile>  (D @ TVarB X P # \<Gamma>) ok"
  17.193        by (auto intro: replace_type dest!: subtype_implies_closed)
  17.194      then show ?case by auto
  17.195    next
  17.196 -    case (T_App G t1 T1 T2 t2 P D)
  17.197 +    case (T_App t1 T1 T2 t2 P D)
  17.198      then show ?case by force
  17.199    next
  17.200 -    case (T_Abs x T1 G t2 T2 P D)
  17.201 +    case (T_Abs x T1 t2 T2 P D)
  17.202      then show ?case by (fastsimp dest: typing_ok)
  17.203    next
  17.204 -    case (T_Sub G t S T D)
  17.205 +    case (T_Sub t S T P D)
  17.206      then show ?case using subtype_narrow by fastsimp
  17.207    next
  17.208 -    case (T_TAbs X' T1 G t2 T2 P D)
  17.209 +    case (T_TAbs X' T1 t2 T2 P D)
  17.210      then show ?case by (fastsimp dest: typing_ok)
  17.211    next
  17.212 -    case (T_TApp X' G t1 T2 T11 T12 P D)
  17.213 +    case (T_TApp X' t1 T2 T11 T12 P D)
  17.214      then have "D @ TVarB X P # \<Gamma> \<turnstile> t1 : Forall X' T12 T11" by fastsimp
  17.215      moreover have "(D @ [TVarB X Q] @ \<Gamma>) \<turnstile> T2<:T11" using T_TApp by auto
  17.216      then have "(D @ [TVarB X P] @ \<Gamma>) \<turnstile> T2<:T11" using `\<Gamma>\<turnstile>P<:Q`
  17.217 @@ -1454,8 +1451,8 @@
  17.218  theorem subst_type: -- {* A.8 *}
  17.219    assumes H: "(\<Delta> @ (VarB x U) # \<Gamma>) \<turnstile> t : T"
  17.220    shows "\<Gamma> \<turnstile> u : U \<Longrightarrow> \<Delta> @ \<Gamma> \<turnstile> t[x \<mapsto> u] : T" using H
  17.221 - proof (nominal_induct \<Gamma>' \<equiv> "\<Delta> @ (VarB x U) # \<Gamma>" t T avoiding: x u arbitrary: \<Delta> rule: typing.strong_induct)
  17.222 -   case (T_Var y T G x u D)
  17.223 + proof (nominal_induct "\<Delta> @ (VarB x U) # \<Gamma>" t T avoiding: x u arbitrary: \<Delta> rule: typing.strong_induct)
  17.224 +   case (T_Var y T x u D)
  17.225     show ?case
  17.226     proof (cases "x = y")
  17.227       assume eq:"x=y"
  17.228 @@ -1468,23 +1465,23 @@
  17.229         by (auto simp add:binding.inject dest: valid_cons')
  17.230     qed
  17.231   next
  17.232 -   case (T_App G t1 T1 T2 t2 x u D)
  17.233 +   case (T_App t1 T1 T2 t2 x u D)
  17.234     then show ?case by force
  17.235   next
  17.236 -   case (T_Abs y T1 G t2 T2 x u D)
  17.237 +   case (T_Abs y T1 t2 T2 x u D)
  17.238     then show ?case by force
  17.239   next
  17.240 -   case (T_Sub G t S T x u D)
  17.241 +   case (T_Sub t S T x u D)
  17.242     then have "D @ \<Gamma> \<turnstile> t[x \<mapsto> u] : S" by auto
  17.243     moreover have "(D @ \<Gamma>) \<turnstile> S<:T" using T_Sub by (auto dest: strengthening)
  17.244     ultimately show ?case by auto 
  17.245   next
  17.246 -   case (T_TAbs X T1 G t2 T2 x u D)
  17.247 -   from `TVarB X T1 # G \<turnstile> t2 : T2` have "X \<sharp> T1"
  17.248 +   case (T_TAbs X T1 t2 T2 x u D)
  17.249 +   from `TVarB X T1 # D @ VarB x U # \<Gamma> \<turnstile> t2 : T2` have "X \<sharp> T1"
  17.250       by (auto simp add: valid_ty_dom_fresh dest: typing_ok intro!: closed_in_fresh)
  17.251     with `X \<sharp> u` and T_TAbs show ?case by fastsimp
  17.252   next
  17.253 -   case (T_TApp X G t1 T2 T11 T12 x u D)
  17.254 +   case (T_TApp X t1 T2 T11 T12 x u D)
  17.255     then have "(D@\<Gamma>) \<turnstile>T2<:T11" using T_TApp by (auto dest: strengthening)
  17.256     then show "((D @ \<Gamma>) \<turnstile> ((t1 \<cdot>\<^sub>\<tau> T2)[x \<mapsto> u]) : (T12[X \<mapsto> T2]\<^sub>\<tau>))" using T_TApp
  17.257       by (force simp add: fresh_prod fresh_list_append fresh_list_cons subst_trm_fresh_tyvar)
  17.258 @@ -1496,8 +1493,8 @@
  17.259    assumes H: "(\<Delta> @ ((TVarB X Q) # \<Gamma>)) \<turnstile> S <: T"
  17.260    shows "\<Gamma> \<turnstile> P <: Q \<Longrightarrow> (\<Delta>[X \<mapsto> P]\<^sub>e @ \<Gamma>) \<turnstile> S[X \<mapsto> P]\<^sub>\<tau> <: T[X \<mapsto> P]\<^sub>\<tau>" 
  17.261    using H
  17.262 -proof (nominal_induct \<Gamma>' \<equiv> "\<Delta> @ TVarB X Q # \<Gamma>" S T avoiding: X P arbitrary: \<Delta> rule: subtype_of.strong_induct)
  17.263 -  case (SA_Top G S X P D)
  17.264 +proof (nominal_induct "\<Delta> @ TVarB X Q # \<Gamma>" S T avoiding: X P arbitrary: \<Delta> rule: subtype_of.strong_induct)
  17.265 +  case (SA_Top S X P D)
  17.266    then have "\<turnstile> (D @ TVarB X Q # \<Gamma>) ok" by simp
  17.267    moreover have closed: "P closed_in \<Gamma>" using SA_Top subtype_implies_closed by auto 
  17.268    ultimately have "\<turnstile> (D[X \<mapsto> P]\<^sub>e @ \<Gamma>) ok" by (rule valid_subst)
  17.269 @@ -1505,17 +1502,18 @@
  17.270    then have "S[X \<mapsto> P]\<^sub>\<tau> closed_in  (D[X \<mapsto> P]\<^sub>e @ \<Gamma>)" using closed by (rule subst_closed_in)
  17.271    ultimately show ?case by auto
  17.272  next
  17.273 -  case (SA_trans_TVar Y S G T X P D)
  17.274 -  have h:"G\<turnstile>S<:T" by fact
  17.275 +  case (SA_trans_TVar Y S T X P D)
  17.276 +  have h:"(D @ TVarB X Q # \<Gamma>)\<turnstile>S<:T" by fact
  17.277    then have ST: "(D[X \<mapsto> P]\<^sub>e @ \<Gamma>) \<turnstile> S[X \<mapsto> P]\<^sub>\<tau> <: T[X \<mapsto> P]\<^sub>\<tau>" using SA_trans_TVar by auto
  17.278 -  from `G\<turnstile>S<:T` have G_ok: "\<turnstile> G ok" by (rule subtype_implies_ok)
  17.279 +  from h have G_ok: "\<turnstile> (D @ TVarB X Q # \<Gamma>) ok" by (rule subtype_implies_ok)
  17.280    from G_ok and SA_trans_TVar have X\<Gamma>_ok: "\<turnstile> (TVarB X Q # \<Gamma>) ok"
  17.281      by (auto intro: validE_append)
  17.282    show "(D[X \<mapsto> P]\<^sub>e @ \<Gamma>) \<turnstile> Tvar Y[X \<mapsto> P]\<^sub>\<tau><:T[X \<mapsto> P]\<^sub>\<tau>"
  17.283    proof (cases "X = Y")
  17.284      assume eq: "X = Y"
  17.285 -    from eq and SA_trans_TVar have "TVarB Y Q \<in> set G" by simp
  17.286 -    with G_ok have QS: "Q = S" using `TVarB Y S \<in> set G` by (rule uniqueness_of_ctxt)
  17.287 +    from eq and SA_trans_TVar have "TVarB Y Q \<in> set (D @ TVarB X Q # \<Gamma>)" by simp
  17.288 +    with G_ok have QS: "Q = S" using `TVarB Y S \<in> set (D @ TVarB X Q # \<Gamma>)`
  17.289 +      by (rule uniqueness_of_ctxt)
  17.290      from X\<Gamma>_ok have "X \<sharp> ty_dom \<Gamma>" and "Q closed_in \<Gamma>" by auto
  17.291      then have XQ: "X \<sharp> Q" by (rule closed_in_fresh)
  17.292      note `\<Gamma>\<turnstile>P<:Q`
  17.293 @@ -1552,8 +1550,8 @@
  17.294      qed
  17.295    qed
  17.296  next
  17.297 -  case (SA_refl_TVar G Y X P D)
  17.298 -  then have "\<turnstile> (D @ TVarB X Q # \<Gamma>) ok" by simp
  17.299 +  case (SA_refl_TVar Y X P D)
  17.300 +  note `\<turnstile> (D @ TVarB X Q # \<Gamma>) ok`
  17.301    moreover from SA_refl_TVar have closed: "P closed_in \<Gamma>"
  17.302      by (auto dest: subtype_implies_closed)
  17.303    ultimately have ok: "\<turnstile> (D[X \<mapsto> P]\<^sub>e @ \<Gamma>) ok" using valid_subst by auto
  17.304 @@ -1571,12 +1569,12 @@
  17.305      with neq and ok show ?thesis by auto
  17.306    qed
  17.307  next
  17.308 -  case (SA_arrow G T1 S1 S2 T2 X P D)
  17.309 +  case (SA_arrow T1 S1 S2 T2 X P D)
  17.310    then have h1:"(D[X \<mapsto> P]\<^sub>e @ \<Gamma>)\<turnstile>T1[X \<mapsto> P]\<^sub>\<tau><:S1[X \<mapsto> P]\<^sub>\<tau>" using SA_arrow by auto
  17.311    from SA_arrow have h2:"(D[X \<mapsto> P]\<^sub>e @ \<Gamma>)\<turnstile>S2[X \<mapsto> P]\<^sub>\<tau><:T2[X \<mapsto> P]\<^sub>\<tau>" using SA_arrow by auto
  17.312    show ?case using subtype_of.SA_arrow h1 h2 by auto
  17.313  next
  17.314 -  case (SA_all G T1 S1 Y S2 T2 X P D)
  17.315 +  case (SA_all T1 S1 Y S2 T2 X P D)
  17.316    then have Y: "Y \<sharp> ty_dom (D @ TVarB X Q # \<Gamma>)"
  17.317      by (auto dest: subtype_implies_ok intro: fresh_dom)
  17.318    moreover from SA_all have "S1 closed_in (D @ TVarB X Q # \<Gamma>)"
  17.319 @@ -1594,13 +1592,13 @@
  17.320    assumes H: "(D @ TVarB X Q # G) \<turnstile> t : T"
  17.321    shows "G \<turnstile> P <: Q \<Longrightarrow>
  17.322      (D[X \<mapsto> P]\<^sub>e @ G) \<turnstile> t[X \<mapsto>\<^sub>\<tau> P] : T[X \<mapsto> P]\<^sub>\<tau>" using H
  17.323 -proof (nominal_induct \<Gamma>'\<equiv>"(D @ TVarB X Q # G)" t T avoiding: X P arbitrary: D rule: typing.strong_induct)
  17.324 -  case (T_Var x T G' X P D')
  17.325 +proof (nominal_induct "D @ TVarB X Q # G" t T avoiding: X P arbitrary: D rule: typing.strong_induct)
  17.326 +  case (T_Var x T X P D')
  17.327    have "G\<turnstile>P<:Q" by fact
  17.328    then have "P closed_in G" using subtype_implies_closed by auto
  17.329 -  moreover have "\<turnstile> (D' @ TVarB X Q # G) ok" using T_Var by auto
  17.330 +  moreover note `\<turnstile> (D' @ TVarB X Q # G) ok`
  17.331    ultimately have "\<turnstile> (D'[X \<mapsto> P]\<^sub>e @ G) ok" using valid_subst by auto
  17.332 -  moreover have "VarB x T \<in> set (D' @ TVarB X Q # G)" using T_Var by auto
  17.333 +  moreover note `VarB x T \<in> set (D' @ TVarB X Q # G)`
  17.334    then have "VarB x T \<in> set D' \<or> VarB x T \<in> set G" by simp
  17.335    then have "(VarB x (T[X \<mapsto> P]\<^sub>\<tau>)) \<in> set (D'[X \<mapsto> P]\<^sub>e @ G)"
  17.336    proof
  17.337 @@ -1621,25 +1619,25 @@
  17.338    qed
  17.339    ultimately show ?case by auto
  17.340  next
  17.341 -  case (T_App G' t1 T1 T2 t2 X P D')
  17.342 +  case (T_App t1 T1 T2 t2 X P D')
  17.343    then have "D'[X \<mapsto> P]\<^sub>e @ G \<turnstile> t1[X \<mapsto>\<^sub>\<tau> P] : (T1 \<rightarrow> T2)[X \<mapsto> P]\<^sub>\<tau>" by auto
  17.344    moreover from T_App have "D'[X \<mapsto> P]\<^sub>e @ G \<turnstile> t2[X \<mapsto>\<^sub>\<tau> P] : T1[X \<mapsto> P]\<^sub>\<tau>" by auto
  17.345    ultimately show ?case by auto
  17.346  next
  17.347 -  case (T_Abs x T1 G' t2 T2 X P D')
  17.348 +  case (T_Abs x T1 t2 T2 X P D')
  17.349    then show ?case by force
  17.350  next
  17.351 -  case (T_Sub G' t S T X P D')
  17.352 +  case (T_Sub t S T X P D')
  17.353    then show ?case using substT_subtype by force
  17.354  next
  17.355 -  case (T_TAbs X' G' T1 t2 T2 X P D')
  17.356 +  case (T_TAbs X' T1 t2 T2 X P D')
  17.357    then have "X' \<sharp> ty_dom (D' @ TVarB X Q # G)"
  17.358 -  and "G' closed_in (D' @ TVarB X Q # G)"
  17.359 +  and "T1 closed_in (D' @ TVarB X Q # G)"
  17.360      by (auto dest: typing_ok)
  17.361 -  then have "X' \<sharp> G'" by (rule closed_in_fresh)
  17.362 +  then have "X' \<sharp> T1" by (rule closed_in_fresh)
  17.363    with T_TAbs show ?case by force
  17.364  next
  17.365 -  case (T_TApp X' G' t1 T2 T11 T12 X P D')
  17.366 +  case (T_TApp X' t1 T2 T11 T12 X P D')
  17.367    then have "X' \<sharp> ty_dom (D' @ TVarB X Q # G)"
  17.368      by (simp add: fresh_dom)
  17.369    moreover from T_TApp have "T11 closed_in (D' @ TVarB X Q # G)"
  17.370 @@ -1824,22 +1822,22 @@
  17.371  lemma Fun_canonical: -- {* A.14(1) *}
  17.372    assumes ty: "[] \<turnstile> v : T\<^isub>1 \<rightarrow> T\<^isub>2"
  17.373    shows "val v \<Longrightarrow> \<exists>x t S. v = (\<lambda>x:S. t)" using ty
  17.374 -proof (induct \<Gamma>\<equiv>"[]::env" v T\<equiv>"T\<^isub>1 \<rightarrow> T\<^isub>2" arbitrary: T\<^isub>1 T\<^isub>2)
  17.375 -  case (T_Sub \<Gamma> t S T)
  17.376 -  hence "\<Gamma> \<turnstile> S <: T\<^isub>1 \<rightarrow> T\<^isub>2" by simp
  17.377 -  then obtain S\<^isub>1 S\<^isub>2 where S: "S = S\<^isub>1 \<rightarrow> S\<^isub>2" 
  17.378 +proof (induct "[]::env" v "T\<^isub>1 \<rightarrow> T\<^isub>2" arbitrary: T\<^isub>1 T\<^isub>2)
  17.379 +  case (T_Sub t S)
  17.380 +  from `[] \<turnstile> S <: T\<^isub>1 \<rightarrow> T\<^isub>2`
  17.381 +  obtain S\<^isub>1 S\<^isub>2 where S: "S = S\<^isub>1 \<rightarrow> S\<^isub>2" 
  17.382      by cases (auto simp add: T_Sub)
  17.383 -  with `val t` and `\<Gamma> = []` show ?case by (rule T_Sub)
  17.384 +  then show ?case using `val t` by (rule T_Sub)
  17.385  qed (auto)
  17.386  
  17.387  lemma TyAll_canonical: -- {* A.14(3) *}
  17.388    fixes X::tyvrs
  17.389    assumes ty: "[] \<turnstile> v : (\<forall>X<:T\<^isub>1. T\<^isub>2)"
  17.390    shows "val v \<Longrightarrow> \<exists>X t S. v = (\<lambda>X<:S. t)" using ty
  17.391 -proof (induct \<Gamma>\<equiv>"[]::env" v T\<equiv>"\<forall>X<:T\<^isub>1. T\<^isub>2" arbitrary: X T\<^isub>1 T\<^isub>2)
  17.392 -  case (T_Sub  \<Gamma> t S T)
  17.393 -  hence "\<Gamma> \<turnstile> S <: (\<forall>X<:T\<^isub>1. T\<^isub>2)" by simp
  17.394 -  then obtain X S\<^isub>1 S\<^isub>2 where S: "S = (\<forall>X<:S\<^isub>1. S\<^isub>2)"
  17.395 +proof (induct "[]::env" v "\<forall>X<:T\<^isub>1. T\<^isub>2" arbitrary: X T\<^isub>1 T\<^isub>2)
  17.396 +  case (T_Sub t S)
  17.397 +  from `[] \<turnstile> S <: (\<forall>X<:T\<^isub>1. T\<^isub>2)`
  17.398 +  obtain X S\<^isub>1 S\<^isub>2 where S: "S = (\<forall>X<:S\<^isub>1. S\<^isub>2)"
  17.399      by cases (auto simp add: T_Sub)
  17.400    then show ?case using T_Sub by auto 
  17.401  qed (auto)
  17.402 @@ -1848,8 +1846,8 @@
  17.403    assumes "[] \<turnstile> t : T"
  17.404    shows "val t \<or> (\<exists>t'. t \<longmapsto> t')" 
  17.405  using assms
  17.406 -proof (induct \<Gamma> \<equiv> "[]::env" t T)
  17.407 -  case (T_App \<Gamma> t\<^isub>1 T\<^isub>1\<^isub>1  T\<^isub>1\<^isub>2 t\<^isub>2)
  17.408 +proof (induct "[]::env" t T)
  17.409 +  case (T_App t\<^isub>1 T\<^isub>1\<^isub>1  T\<^isub>1\<^isub>2 t\<^isub>2)
  17.410    hence "val t\<^isub>1 \<or> (\<exists>t'. t\<^isub>1 \<longmapsto> t')" by simp
  17.411    thus ?case
  17.412    proof
  17.413 @@ -1875,7 +1873,7 @@
  17.414      thus ?case by auto
  17.415    qed
  17.416  next
  17.417 -  case (T_TApp X \<Gamma> t\<^isub>1 T\<^isub>2 T\<^isub>1\<^isub>1 T\<^isub>1\<^isub>2)
  17.418 +  case (T_TApp X t\<^isub>1 T\<^isub>2 T\<^isub>1\<^isub>1 T\<^isub>1\<^isub>2)
  17.419    hence "val t\<^isub>1 \<or> (\<exists>t'. t\<^isub>1 \<longmapsto> t')" by simp
  17.420    thus ?case
  17.421    proof
    18.1 --- a/src/HOL/Nominal/Examples/Pattern.thy	Sun Jan 10 18:41:07 2010 +0100
    18.2 +++ b/src/HOL/Nominal/Examples/Pattern.thy	Sun Jan 10 18:43:45 2010 +0100
    18.3 @@ -410,37 +410,34 @@
    18.4    and b: "\<Gamma> \<turnstile> u : U"
    18.5    shows "\<Delta> @ \<Gamma> \<turnstile> t[x\<mapsto>u] : T" using a b
    18.6  proof (nominal_induct \<Gamma>'\<equiv>"\<Delta> @ [(x, U)] @ \<Gamma>" t T avoiding: x u \<Delta> rule: typing.strong_induct)
    18.7 -  case (Var \<Gamma>' y T x u \<Delta>)
    18.8 -  then have a1: "valid (\<Delta> @ [(x, U)] @ \<Gamma>)" 
    18.9 -       and  a2: "(y, T) \<in> set (\<Delta> @ [(x, U)] @ \<Gamma>)" 
   18.10 -       and  a3: "\<Gamma> \<turnstile> u : U" by simp_all
   18.11 -  from a1 have a4: "valid (\<Delta> @ \<Gamma>)" by (rule valid_insert)
   18.12 +  case (Var y T x u \<Delta>)
   18.13 +  from `valid (\<Delta> @ [(x, U)] @ \<Gamma>)`
   18.14 +  have valid: "valid (\<Delta> @ \<Gamma>)" by (rule valid_insert)
   18.15    show "\<Delta> @ \<Gamma> \<turnstile> Var y[x\<mapsto>u] : T"
   18.16    proof cases
   18.17      assume eq: "x = y"
   18.18 -    from a1 a2 have "T = U" using eq by (auto intro: context_unique)
   18.19 -    with a3 show "\<Delta> @ \<Gamma> \<turnstile> Var y[x\<mapsto>u] : T" using eq a4 by (auto intro: weakening)
   18.20 +    from Var eq have "T = U" by (auto intro: context_unique)
   18.21 +    with Var eq valid show "\<Delta> @ \<Gamma> \<turnstile> Var y[x\<mapsto>u] : T" by (auto intro: weakening)
   18.22    next
   18.23      assume ineq: "x \<noteq> y"
   18.24 -    from a2 have "(y, T) \<in> set (\<Delta> @ \<Gamma>)" using ineq by simp
   18.25 -    then show "\<Delta> @ \<Gamma> \<turnstile> Var y[x\<mapsto>u] : T" using ineq a4 by auto
   18.26 +    from Var ineq have "(y, T) \<in> set (\<Delta> @ \<Gamma>)" by simp
   18.27 +    then show "\<Delta> @ \<Gamma> \<turnstile> Var y[x\<mapsto>u] : T" using ineq valid by auto
   18.28    qed
   18.29  next
   18.30 -  case (Tuple \<Gamma>' t\<^isub>1 T\<^isub>1 t\<^isub>2 T\<^isub>2)
   18.31 -  from `\<Gamma> \<turnstile> u : U` `\<Gamma>' = \<Delta> @ [(x, U)] @ \<Gamma>`
   18.32 +  case (Tuple t\<^isub>1 T\<^isub>1 t\<^isub>2 T\<^isub>2)
   18.33 +  from refl `\<Gamma> \<turnstile> u : U`
   18.34    have "\<Delta> @ \<Gamma> \<turnstile> t\<^isub>1[x\<mapsto>u] : T\<^isub>1" by (rule Tuple)
   18.35 -  moreover from `\<Gamma> \<turnstile> u : U` `\<Gamma>' = \<Delta> @ [(x, U)] @ \<Gamma>`
   18.36 +  moreover from refl `\<Gamma> \<turnstile> u : U`
   18.37    have "\<Delta> @ \<Gamma> \<turnstile> t\<^isub>2[x\<mapsto>u] : T\<^isub>2" by (rule Tuple)
   18.38    ultimately have "\<Delta> @ \<Gamma> \<turnstile> \<langle>t\<^isub>1[x\<mapsto>u], t\<^isub>2[x\<mapsto>u]\<rangle> : T\<^isub>1 \<otimes> T\<^isub>2" ..
   18.39    then show ?case by simp
   18.40  next
   18.41 -  case (Let p t \<Gamma>' T \<Delta>' s S)
   18.42 -  from `\<Gamma> \<turnstile> u : U` `\<Gamma>' = \<Delta> @ [(x, U)] @ \<Gamma>`
   18.43 +  case (Let p t T \<Delta>' s S)
   18.44 +  from refl `\<Gamma> \<turnstile> u : U`
   18.45    have "\<Delta> @ \<Gamma> \<turnstile> t[x\<mapsto>u] : T" by (rule Let)
   18.46    moreover note `\<turnstile> p : T \<Rightarrow> \<Delta>'`
   18.47 -  moreover from `\<Gamma>' = \<Delta> @ [(x, U)] @ \<Gamma>`
   18.48 -  have "\<Delta>' @ \<Gamma>' = (\<Delta>' @ \<Delta>) @ [(x, U)] @ \<Gamma>" by simp
   18.49 -  with `\<Gamma> \<turnstile> u : U` have "(\<Delta>' @ \<Delta>) @ \<Gamma> \<turnstile> s[x\<mapsto>u] : S" by (rule Let)
   18.50 +  moreover have "\<Delta>' @ (\<Delta> @ [(x, U)] @ \<Gamma>) = (\<Delta>' @ \<Delta>) @ [(x, U)] @ \<Gamma>" by simp
   18.51 +  then have "(\<Delta>' @ \<Delta>) @ \<Gamma> \<turnstile> s[x\<mapsto>u] : S" using `\<Gamma> \<turnstile> u : U` by (rule Let)
   18.52    then have "\<Delta>' @ \<Delta> @ \<Gamma> \<turnstile> s[x\<mapsto>u] : S" by simp
   18.53    ultimately have "\<Delta> @ \<Gamma> \<turnstile> (LET p = t[x\<mapsto>u] IN s[x\<mapsto>u]) : S"
   18.54      by (rule better_T_Let)
   18.55 @@ -448,10 +445,10 @@
   18.56      by (simp add: fresh_star_def fresh_list_nil fresh_list_cons)
   18.57    ultimately show ?case by simp
   18.58  next
   18.59 -  case (Abs y T \<Gamma>' t S)
   18.60 -  from `\<Gamma>' = \<Delta> @ [(x, U)] @ \<Gamma>` have "(y, T) # \<Gamma>' = ((y, T) # \<Delta>) @ [(x, U)] @ \<Gamma>"
   18.61 +  case (Abs y T t S)
   18.62 +  have "(y, T) # \<Delta> @ [(x, U)] @ \<Gamma> = ((y, T) # \<Delta>) @ [(x, U)] @ \<Gamma>"
   18.63      by simp
   18.64 -  with `\<Gamma> \<turnstile> u : U` have "((y, T) # \<Delta>) @ \<Gamma> \<turnstile> t[x\<mapsto>u] : S" by (rule Abs)
   18.65 +  then have "((y, T) # \<Delta>) @ \<Gamma> \<turnstile> t[x\<mapsto>u] : S" using `\<Gamma> \<turnstile> u : U` by (rule Abs)
   18.66    then have "(y, T) # \<Delta> @ \<Gamma> \<turnstile> t[x\<mapsto>u] : S" by simp
   18.67    then have "\<Delta> @ \<Gamma> \<turnstile> (\<lambda>y:T. t[x\<mapsto>u]) : T \<rightarrow> S"
   18.68      by (rule typing.Abs)
   18.69 @@ -459,10 +456,10 @@
   18.70      by (simp add: fresh_list_nil fresh_list_cons)
   18.71    ultimately show ?case by simp
   18.72  next
   18.73 -  case (App \<Gamma>' t\<^isub>1 T S t\<^isub>2)
   18.74 -  from `\<Gamma> \<turnstile> u : U` `\<Gamma>' = \<Delta> @ [(x, U)] @ \<Gamma>`
   18.75 +  case (App t\<^isub>1 T S t\<^isub>2)
   18.76 +  from refl `\<Gamma> \<turnstile> u : U`
   18.77    have "\<Delta> @ \<Gamma> \<turnstile> t\<^isub>1[x\<mapsto>u] : T \<rightarrow> S" by (rule App)
   18.78 -  moreover from `\<Gamma> \<turnstile> u : U` `\<Gamma>' = \<Delta> @ [(x, U)] @ \<Gamma>`
   18.79 +  moreover from refl `\<Gamma> \<turnstile> u : U`
   18.80    have "\<Delta> @ \<Gamma> \<turnstile> t\<^isub>2[x\<mapsto>u] : T" by (rule App)
   18.81    ultimately have "\<Delta> @ \<Gamma> \<turnstile> (t\<^isub>1[x\<mapsto>u]) \<cdot> (t\<^isub>2[x\<mapsto>u]) : S"
   18.82      by (rule typing.App)
    19.1 --- a/src/HOL/Nominal/Examples/SOS.thy	Sun Jan 10 18:41:07 2010 +0100
    19.2 +++ b/src/HOL/Nominal/Examples/SOS.thy	Sun Jan 10 18:43:45 2010 +0100
    19.3 @@ -220,10 +220,10 @@
    19.4    shows "(\<Delta>@\<Gamma>) \<turnstile> e[x::=e'] : T" 
    19.5  using a b 
    19.6  proof (nominal_induct \<Gamma>\<equiv>"\<Delta>@[(x,T')]@\<Gamma>" e T avoiding: e' \<Delta> rule: typing.strong_induct)
    19.7 -  case (t_Var \<Gamma>' y T e' \<Delta>)
    19.8 +  case (t_Var y T e' \<Delta>)
    19.9    then have a1: "valid (\<Delta>@[(x,T')]@\<Gamma>)" 
   19.10         and  a2: "(y,T) \<in> set (\<Delta>@[(x,T')]@\<Gamma>)" 
   19.11 -       and  a3: "\<Gamma> \<turnstile> e' : T'" by simp_all
   19.12 +       and  a3: "\<Gamma> \<turnstile> e' : T'" .
   19.13    from a1 have a4: "valid (\<Delta>@\<Gamma>)" by (rule valid_insert)
   19.14    { assume eq: "x=y"
   19.15      from a1 a2 have "T=T'" using eq by (auto intro: context_unique)
    20.1 --- a/src/HOL/Old_Number_Theory/Legacy_GCD.thy	Sun Jan 10 18:41:07 2010 +0100
    20.2 +++ b/src/HOL/Old_Number_Theory/Legacy_GCD.thy	Sun Jan 10 18:43:45 2010 +0100
    20.3 @@ -233,37 +233,39 @@
    20.4    with gcd_unique[of "gcd u v" x y]  show ?thesis by auto
    20.5  qed
    20.6  
    20.7 -lemma ind_euclid: 
    20.8 -  assumes c: " \<forall>a b. P (a::nat) b \<longleftrightarrow> P b a" and z: "\<forall>a. P a 0" 
    20.9 -  and add: "\<forall>a b. P a b \<longrightarrow> P a (a + b)" 
   20.10 +lemma ind_euclid:
   20.11 +  assumes c: " \<forall>a b. P (a::nat) b \<longleftrightarrow> P b a" and z: "\<forall>a. P a 0"
   20.12 +  and add: "\<forall>a b. P a b \<longrightarrow> P a (a + b)"
   20.13    shows "P a b"
   20.14 -proof(induct n\<equiv>"a+b" arbitrary: a b rule: nat_less_induct)
   20.15 -  fix n a b
   20.16 -  assume H: "\<forall>m < n. \<forall>a b. m = a + b \<longrightarrow> P a b" "n = a + b"
   20.17 +proof(induct "a + b" arbitrary: a b rule: less_induct)
   20.18 +  case less
   20.19    have "a = b \<or> a < b \<or> b < a" by arith
   20.20    moreover {assume eq: "a= b"
   20.21 -    from add[rule_format, OF z[rule_format, of a]] have "P a b" using eq by simp}
   20.22 +    from add[rule_format, OF z[rule_format, of a]] have "P a b" using eq
   20.23 +    by simp}
   20.24    moreover
   20.25    {assume lt: "a < b"
   20.26 -    hence "a + b - a < n \<or> a = 0"  using H(2) by arith
   20.27 +    hence "a + b - a < a + b \<or> a = 0" by arith
   20.28      moreover
   20.29      {assume "a =0" with z c have "P a b" by blast }
   20.30      moreover
   20.31 -    {assume ab: "a + b - a < n"
   20.32 -      have th0: "a + b - a = a + (b - a)" using lt by arith
   20.33 -      from add[rule_format, OF H(1)[rule_format, OF ab th0]]
   20.34 -      have "P a b" by (simp add: th0[symmetric])}
   20.35 +    {assume "a + b - a < a + b"
   20.36 +      also have th0: "a + b - a = a + (b - a)" using lt by arith
   20.37 +      finally have "a + (b - a) < a + b" .
   20.38 +      then have "P a (a + (b - a))" by (rule add[rule_format, OF less])
   20.39 +      then have "P a b" by (simp add: th0[symmetric])}
   20.40      ultimately have "P a b" by blast}
   20.41    moreover
   20.42    {assume lt: "a > b"
   20.43 -    hence "b + a - b < n \<or> b = 0"  using H(2) by arith
   20.44 +    hence "b + a - b < a + b \<or> b = 0" by arith
   20.45      moreover
   20.46      {assume "b =0" with z c have "P a b" by blast }
   20.47      moreover
   20.48 -    {assume ab: "b + a - b < n"
   20.49 -      have th0: "b + a - b = b + (a - b)" using lt by arith
   20.50 -      from add[rule_format, OF H(1)[rule_format, OF ab th0]]
   20.51 -      have "P b a" by (simp add: th0[symmetric])
   20.52 +    {assume "b + a - b < a + b"
   20.53 +      also have th0: "b + a - b = b + (a - b)" using lt by arith
   20.54 +      finally have "b + (a - b) < a + b" .
   20.55 +      then have "P b (b + (a - b))" by (rule add[rule_format, OF less])
   20.56 +      then have "P b a" by (simp add: th0[symmetric])
   20.57        hence "P a b" using c by blast }
   20.58      ultimately have "P a b" by blast}
   20.59  ultimately  show "P a b" by blast
    21.1 --- a/src/HOL/ex/ThreeDivides.thy	Sun Jan 10 18:41:07 2010 +0100
    21.2 +++ b/src/HOL/ex/ThreeDivides.thy	Sun Jan 10 18:43:45 2010 +0100
    21.3 @@ -178,21 +178,17 @@
    21.4  
    21.5  lemma exp_exists:
    21.6    "m = (\<Sum>x<nlen m. (m div (10::nat)^x mod 10) * 10^x)"
    21.7 -proof (induct nd \<equiv> "nlen m" arbitrary: m)
    21.8 +proof (induct "nlen m" arbitrary: m)
    21.9    case 0 thus ?case by (simp add: nlen_zero)
   21.10  next
   21.11    case (Suc nd)
   21.12 -  hence IH:
   21.13 -    "nd = nlen (m div 10) \<Longrightarrow>
   21.14 -    m div 10 = (\<Sum>x<nd. m div 10 div 10^x mod 10 * 10^x)"
   21.15 -    by blast
   21.16    obtain c where mexp: "m = 10*(m div 10) + c \<and> c < 10"
   21.17      and cdef: "c = m mod 10" by simp
   21.18    show "m = (\<Sum>x<nlen m. m div 10^x mod 10 * 10^x)"
   21.19    proof -
   21.20      from `Suc nd = nlen m`
   21.21      have "nd = nlen (m div 10)" by (rule nlen_suc)
   21.22 -    with IH have
   21.23 +    with Suc have
   21.24        "m div 10 = (\<Sum>x<nd. m div 10 div 10^x mod 10 * 10^x)" by simp
   21.25      with mexp have
   21.26        "m = 10*(\<Sum>x<nd. m div 10 div 10^x mod 10 * 10^x) + c" by simp
    22.1 --- a/src/HOLCF/Universal.thy	Sun Jan 10 18:41:07 2010 +0100
    22.2 +++ b/src/HOLCF/Universal.thy	Sun Jan 10 18:43:45 2010 +0100
    22.3 @@ -694,13 +694,8 @@
    22.4  
    22.5  lemma basis_emb_mono:
    22.6    "x \<sqsubseteq> y \<Longrightarrow> ubasis_le (basis_emb x) (basis_emb y)"
    22.7 -proof (induct n \<equiv> "max (place x) (place y)" arbitrary: x y rule: less_induct)
    22.8 -  case (less n)
    22.9 -  hence IH:
   22.10 -    "\<And>(a::'a compact_basis) b.
   22.11 -     \<lbrakk>max (place a) (place b) < max (place x) (place y); a \<sqsubseteq> b\<rbrakk>
   22.12 -        \<Longrightarrow> ubasis_le (basis_emb a) (basis_emb b)"
   22.13 -    by simp
   22.14 +proof (induct "max (place x) (place y)" arbitrary: x y rule: less_induct)
   22.15 +  case less
   22.16    show ?case proof (rule linorder_cases)
   22.17      assume "place x < place y"
   22.18      then have "rank x < rank y"
   22.19 @@ -709,7 +704,7 @@
   22.20        apply (case_tac "y = compact_bot", simp)
   22.21        apply (simp add: basis_emb.simps [of y])
   22.22        apply (rule ubasis_le_trans [OF _ ubasis_le_lower [OF fin2]])
   22.23 -      apply (rule IH)
   22.24 +      apply (rule less)
   22.25         apply (simp add: less_max_iff_disj)
   22.26         apply (erule place_sub_less)
   22.27        apply (erule rank_less_imp_below_sub [OF `x \<sqsubseteq> y`])
   22.28 @@ -724,7 +719,7 @@
   22.29        apply (case_tac "x = compact_bot", simp add: ubasis_le_minimal)
   22.30        apply (simp add: basis_emb.simps [of x])
   22.31        apply (rule ubasis_le_upper [OF fin2], simp)
   22.32 -      apply (rule IH)
   22.33 +      apply (rule less)
   22.34         apply (simp add: less_max_iff_disj)
   22.35         apply (erule place_sub_less)
   22.36        apply (erule rev_below_trans)