merged
authorhuffman
Mon Apr 26 09:45:22 2010 -0700 (2010-04-26)
changeset 3636518bf20d0c2df
parent 36364 0e2679025aeb
parent 36353 7b92238454d6
child 36366 886b94b1bed7
merged
src/HOL/HOL.thy
src/HOL/Multivariate_Analysis/Brouwer_Fixpoint.thy
src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy
src/HOL/Multivariate_Analysis/Derivative.thy
src/HOL/Multivariate_Analysis/Determinants.thy
src/HOL/Multivariate_Analysis/Euclidean_Space.thy
src/HOL/Multivariate_Analysis/Integration.thy
src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy
src/HOL/SetInterval.thy
     1.1 --- a/NEWS	Mon Apr 26 09:37:46 2010 -0700
     1.2 +++ b/NEWS	Mon Apr 26 09:45:22 2010 -0700
     1.3 @@ -119,8 +119,12 @@
     1.4  *** HOL ***
     1.5  
     1.6  * Abstract algebra:
     1.7 -  * class division_by_zero includes division_ring;
     1.8 +  * classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
     1.9 +    include rule inverse 0 = 0 -- subsumes former division_by_zero class.
    1.10    * numerous lemmas have been ported from field to division_ring;
    1.11 +  * dropped theorem group group_simps, use algebra_simps instead;
    1.12 +  * dropped theorem group ring_simps, use field_simps instead;
    1.13 +  * proper theorem collection field_simps subsumes former theorem groups field_eq_simps and field_simps;
    1.14    * dropped lemma eq_minus_self_iff which is a duplicate for equal_neg_zero.
    1.15  
    1.16    INCOMPATIBILITY.
     2.1 --- a/doc-src/IsarImplementation/Thy/Logic.thy	Mon Apr 26 09:37:46 2010 -0700
     2.2 +++ b/doc-src/IsarImplementation/Thy/Logic.thy	Mon Apr 26 09:45:22 2010 -0700
     2.3 @@ -128,8 +128,7 @@
     2.4    @{index_ML Sign.subsort: "theory -> sort * sort -> bool"} \\
     2.5    @{index_ML Sign.of_sort: "theory -> typ * sort -> bool"} \\
     2.6    @{index_ML Sign.add_types: "(binding * int * mixfix) list -> theory -> theory"} \\
     2.7 -  @{index_ML Sign.add_tyabbrs_i: "
     2.8 -  (binding * string list * typ * mixfix) list -> theory -> theory"} \\
     2.9 +  @{index_ML Sign.add_type_abbrev: "binding * string list * typ -> theory -> theory"} \\
    2.10    @{index_ML Sign.primitive_class: "binding * class list -> theory -> theory"} \\
    2.11    @{index_ML Sign.primitive_classrel: "class * class -> theory -> theory"} \\
    2.12    @{index_ML Sign.primitive_arity: "arity -> theory -> theory"} \\
    2.13 @@ -168,9 +167,9 @@
    2.14    type constructors @{text "\<kappa>"} with @{text "k"} arguments and
    2.15    optional mixfix syntax.
    2.16  
    2.17 -  \item @{ML Sign.add_tyabbrs_i}~@{text "[(\<kappa>, \<^vec>\<alpha>, \<tau>, mx), \<dots>]"}
    2.18 -  defines a new type abbreviation @{text "(\<^vec>\<alpha>)\<kappa> = \<tau>"} with
    2.19 -  optional mixfix syntax.
    2.20 +  \item @{ML Sign.add_type_abbrev}~@{text "(\<kappa>, \<^vec>\<alpha>,
    2.21 +  \<tau>)"} defines a new type abbreviation @{text
    2.22 +  "(\<^vec>\<alpha>)\<kappa> = \<tau>"}.
    2.23  
    2.24    \item @{ML Sign.primitive_class}~@{text "(c, [c\<^isub>1, \<dots>,
    2.25    c\<^isub>n])"} declares a new class @{text "c"}, together with class
     3.1 --- a/doc-src/IsarImplementation/Thy/document/Logic.tex	Mon Apr 26 09:37:46 2010 -0700
     3.2 +++ b/doc-src/IsarImplementation/Thy/document/Logic.tex	Mon Apr 26 09:45:22 2010 -0700
     3.3 @@ -139,8 +139,7 @@
     3.4    \indexdef{}{ML}{Sign.subsort}\verb|Sign.subsort: theory -> sort * sort -> bool| \\
     3.5    \indexdef{}{ML}{Sign.of\_sort}\verb|Sign.of_sort: theory -> typ * sort -> bool| \\
     3.6    \indexdef{}{ML}{Sign.add\_types}\verb|Sign.add_types: (binding * int * mixfix) list -> theory -> theory| \\
     3.7 -  \indexdef{}{ML}{Sign.add\_tyabbrs\_i}\verb|Sign.add_tyabbrs_i: |\isasep\isanewline%
     3.8 -\verb|  (binding * string list * typ * mixfix) list -> theory -> theory| \\
     3.9 +  \indexdef{}{ML}{Sign.add\_type\_abbrev}\verb|Sign.add_type_abbrev: binding * string list * typ -> theory -> theory| \\
    3.10    \indexdef{}{ML}{Sign.primitive\_class}\verb|Sign.primitive_class: binding * class list -> theory -> theory| \\
    3.11    \indexdef{}{ML}{Sign.primitive\_classrel}\verb|Sign.primitive_classrel: class * class -> theory -> theory| \\
    3.12    \indexdef{}{ML}{Sign.primitive\_arity}\verb|Sign.primitive_arity: arity -> theory -> theory| \\
    3.13 @@ -176,9 +175,7 @@
    3.14    type constructors \isa{{\isasymkappa}} with \isa{k} arguments and
    3.15    optional mixfix syntax.
    3.16  
    3.17 -  \item \verb|Sign.add_tyabbrs_i|~\isa{{\isacharbrackleft}{\isacharparenleft}{\isasymkappa}{\isacharcomma}\ \isactrlvec {\isasymalpha}{\isacharcomma}\ {\isasymtau}{\isacharcomma}\ mx{\isacharparenright}{\isacharcomma}\ {\isasymdots}{\isacharbrackright}}
    3.18 -  defines a new type abbreviation \isa{{\isacharparenleft}\isactrlvec {\isasymalpha}{\isacharparenright}{\isasymkappa}\ {\isacharequal}\ {\isasymtau}} with
    3.19 -  optional mixfix syntax.
    3.20 +  \item \verb|Sign.add_type_abbrev|~\isa{{\isacharparenleft}{\isasymkappa}{\isacharcomma}\ \isactrlvec {\isasymalpha}{\isacharcomma}\ {\isasymtau}{\isacharparenright}} defines a new type abbreviation \isa{{\isacharparenleft}\isactrlvec {\isasymalpha}{\isacharparenright}{\isasymkappa}\ {\isacharequal}\ {\isasymtau}}.
    3.21  
    3.22    \item \verb|Sign.primitive_class|~\isa{{\isacharparenleft}c{\isacharcomma}\ {\isacharbrackleft}c\isactrlisub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ c\isactrlisub n{\isacharbrackright}{\isacharparenright}} declares a new class \isa{c}, together with class
    3.23    relations \isa{c\ {\isasymsubseteq}\ c\isactrlisub i}, for \isa{i\ {\isacharequal}\ {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ n}.
     4.1 --- a/src/HOL/Big_Operators.thy	Mon Apr 26 09:37:46 2010 -0700
     4.2 +++ b/src/HOL/Big_Operators.thy	Mon Apr 26 09:45:22 2010 -0700
     4.3 @@ -1033,12 +1033,12 @@
     4.4    by (erule finite_induct) (auto simp add: insert_Diff_if)
     4.5  
     4.6  lemma setprod_inversef: 
     4.7 -  fixes f :: "'b \<Rightarrow> 'a::{field,division_by_zero}"
     4.8 +  fixes f :: "'b \<Rightarrow> 'a::{field,division_ring_inverse_zero}"
     4.9    shows "finite A ==> setprod (inverse \<circ> f) A = inverse (setprod f A)"
    4.10  by (erule finite_induct) auto
    4.11  
    4.12  lemma setprod_dividef:
    4.13 -  fixes f :: "'b \<Rightarrow> 'a::{field,division_by_zero}"
    4.14 +  fixes f :: "'b \<Rightarrow> 'a::{field,division_ring_inverse_zero}"
    4.15    shows "finite A
    4.16      ==> setprod (%x. f x / g x) A = setprod f A / setprod g A"
    4.17  apply (subgoal_tac
    4.18 @@ -1140,7 +1140,7 @@
    4.19        using setprod_Un_disjoint[OF fAB dj, of ?f, unfolded eq[symmetric]]
    4.20        by simp
    4.21      then have ?thesis using a cA
    4.22 -      by (simp add: fA1 ring_simps cong add: setprod_cong cong del: if_weak_cong)}
    4.23 +      by (simp add: fA1 field_simps cong add: setprod_cong cong del: if_weak_cong)}
    4.24    ultimately show ?thesis by blast
    4.25  qed
    4.26  
     5.1 --- a/src/HOL/Boogie/Tools/boogie_commands.ML	Mon Apr 26 09:37:46 2010 -0700
     5.2 +++ b/src/HOL/Boogie/Tools/boogie_commands.ML	Mon Apr 26 09:45:22 2010 -0700
     5.3 @@ -99,7 +99,7 @@
     5.4      |> (fn ctxt1 => ctxt1
     5.5      |> prepare
     5.6      |-> (fn us => fn ctxt2 => ctxt2
     5.7 -    |> Proof.theorem_i NONE (fn thmss => fn ctxt =>
     5.8 +    |> Proof.theorem NONE (fn thmss => fn ctxt =>
     5.9           let val export = map (finish ctxt1) o ProofContext.export ctxt ctxt2
    5.10           in after_qed (map export thmss) ctxt end) [map (rpair []) us]))
    5.11    end
    5.12 @@ -188,7 +188,7 @@
    5.13  
    5.14    fun prove thy meth vc =
    5.15      ProofContext.init thy
    5.16 -    |> Proof.theorem_i NONE (K I) [[(Boogie_VCs.prop_of_vc vc, [])]]
    5.17 +    |> Proof.theorem NONE (K I) [[(Boogie_VCs.prop_of_vc vc, [])]]
    5.18      |> Proof.apply meth
    5.19      |> Seq.hd
    5.20      |> Proof.global_done_proof
     6.1 --- a/src/HOL/Complex.thy	Mon Apr 26 09:37:46 2010 -0700
     6.2 +++ b/src/HOL/Complex.thy	Mon Apr 26 09:45:22 2010 -0700
     6.3 @@ -99,7 +99,7 @@
     6.4  
     6.5  subsection {* Multiplication and Division *}
     6.6  
     6.7 -instantiation complex :: "{field, division_by_zero}"
     6.8 +instantiation complex :: "{field, division_ring_inverse_zero}"
     6.9  begin
    6.10  
    6.11  definition
     7.1 --- a/src/HOL/Decision_Procs/Decision_Procs.thy	Mon Apr 26 09:37:46 2010 -0700
     7.2 +++ b/src/HOL/Decision_Procs/Decision_Procs.thy	Mon Apr 26 09:45:22 2010 -0700
     7.3 @@ -8,4 +8,4 @@
     7.4    "ex/Commutative_Ring_Ex" "ex/Approximation_Ex" "ex/Dense_Linear_Order_Ex"
     7.5  begin
     7.6  
     7.7 -end
     7.8 \ No newline at end of file
     7.9 +end
     8.1 --- a/src/HOL/Decision_Procs/Parametric_Ferrante_Rackoff.thy	Mon Apr 26 09:37:46 2010 -0700
     8.2 +++ b/src/HOL/Decision_Procs/Parametric_Ferrante_Rackoff.thy	Mon Apr 26 09:45:22 2010 -0700
     8.3 @@ -27,7 +27,7 @@
     8.4    "tmsize (CNP n c a) = 3 + polysize c + tmsize a "
     8.5  
     8.6    (* Semantics of terms tm *)
     8.7 -consts Itm :: "'a::{ring_char_0,division_by_zero,field} list \<Rightarrow> 'a list \<Rightarrow> tm \<Rightarrow> 'a"
     8.8 +consts Itm :: "'a::{ring_char_0,division_ring_inverse_zero,field} list \<Rightarrow> 'a list \<Rightarrow> tm \<Rightarrow> 'a"
     8.9  primrec
    8.10    "Itm vs bs (CP c) = (Ipoly vs c)"
    8.11    "Itm vs bs (Bound n) = bs!n"
    8.12 @@ -239,7 +239,7 @@
    8.13  lemma tmadd[simp]: "Itm vs bs (tmadd (t,s)) = Itm vs bs (Add t s)"
    8.14  apply (induct t s rule: tmadd.induct, simp_all add: Let_def)
    8.15  apply (case_tac "c1 +\<^sub>p c2 = 0\<^sub>p",case_tac "n1 \<le> n2", simp_all)
    8.16 -apply (case_tac "n1 = n2", simp_all add: ring_simps)
    8.17 +apply (case_tac "n1 = n2", simp_all add: field_simps)
    8.18  apply (simp only: right_distrib[symmetric]) 
    8.19  by (auto simp del: polyadd simp add: polyadd[symmetric])
    8.20  
    8.21 @@ -259,7 +259,7 @@
    8.22    "tmmul t = (\<lambda> i. Mul i t)"
    8.23  
    8.24  lemma tmmul[simp]: "Itm vs bs (tmmul t i) = Itm vs bs (Mul i t)"
    8.25 -by (induct t arbitrary: i rule: tmmul.induct, simp_all add: ring_simps)
    8.26 +by (induct t arbitrary: i rule: tmmul.induct, simp_all add: field_simps)
    8.27  
    8.28  lemma tmmul_nb0[simp]: "tmbound0 t \<Longrightarrow> tmbound0 (tmmul t i)"
    8.29  by (induct t arbitrary: i rule: tmmul.induct, auto )
    8.30 @@ -270,7 +270,7 @@
    8.31  by (induct t arbitrary: i rule: tmmul.induct, auto simp add: Let_def)
    8.32  
    8.33  lemma tmmul_allpolys_npoly[simp]: 
    8.34 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero, field})"
    8.35 +  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero, field})"
    8.36    shows "allpolys isnpoly t \<Longrightarrow> isnpoly c \<Longrightarrow> allpolys isnpoly (tmmul t c)" by (induct t rule: tmmul.induct, simp_all add: Let_def polymul_norm)
    8.37  
    8.38  definition tmneg :: "tm \<Rightarrow> tm" where
    8.39 @@ -296,7 +296,7 @@
    8.40  using tmneg_def by simp
    8.41  lemma [simp]: "isnpoly (C (-1,1))" unfolding isnpoly_def by simp
    8.42  lemma tmneg_allpolys_npoly[simp]: 
    8.43 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero, field})"
    8.44 +  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero, field})"
    8.45    shows "allpolys isnpoly t \<Longrightarrow> allpolys isnpoly (tmneg t)" 
    8.46    unfolding tmneg_def by auto
    8.47  
    8.48 @@ -310,7 +310,7 @@
    8.49  lemma tmsub_blt[simp]: "\<lbrakk>tmboundslt n t ; tmboundslt n s\<rbrakk> \<Longrightarrow> tmboundslt n (tmsub t s )"
    8.50  using tmsub_def by simp
    8.51  lemma tmsub_allpolys_npoly[simp]: 
    8.52 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero, field})"
    8.53 +  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero, field})"
    8.54    shows "allpolys isnpoly t \<Longrightarrow> allpolys isnpoly s \<Longrightarrow> allpolys isnpoly (tmsub t s)" 
    8.55    unfolding tmsub_def by (simp add: isnpoly_def)
    8.56  
    8.57 @@ -324,8 +324,8 @@
    8.58    "simptm (CNP n c t) = (let c' = polynate c in if c' = 0\<^sub>p then simptm t else tmadd (CNP n c' (CP 0\<^sub>p ), simptm t))"
    8.59  
    8.60  lemma polynate_stupid: 
    8.61 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero, field})"
    8.62 -  shows "polynate t = 0\<^sub>p \<Longrightarrow> Ipoly bs t = (0::'a::{ring_char_0,division_by_zero, field})" 
    8.63 +  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero, field})"
    8.64 +  shows "polynate t = 0\<^sub>p \<Longrightarrow> Ipoly bs t = (0::'a::{ring_char_0,division_ring_inverse_zero, field})" 
    8.65  apply (subst polynate[symmetric])
    8.66  apply simp
    8.67  done
    8.68 @@ -345,7 +345,7 @@
    8.69  lemma [simp]: "isnpoly 0\<^sub>p" and [simp]: "isnpoly (C(1,1))" 
    8.70    by (simp_all add: isnpoly_def)
    8.71  lemma simptm_allpolys_npoly[simp]: 
    8.72 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero, field})"
    8.73 +  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero, field})"
    8.74    shows "allpolys isnpoly (simptm p)"
    8.75    by (induct p rule: simptm.induct, auto simp add: Let_def)
    8.76  
    8.77 @@ -369,14 +369,14 @@
    8.78    "tmbound 0 (snd (split0 t)) \<and> (Itm vs bs (CNP 0 (fst (split0 t)) (snd (split0 t))) = Itm vs bs t)"
    8.79    apply (induct t rule: split0.induct)
    8.80    apply simp
    8.81 -  apply (simp add: Let_def split_def ring_simps)
    8.82 -  apply (simp add: Let_def split_def ring_simps)
    8.83 -  apply (simp add: Let_def split_def ring_simps)
    8.84 -  apply (simp add: Let_def split_def ring_simps)
    8.85 -  apply (simp add: Let_def split_def ring_simps)
    8.86 +  apply (simp add: Let_def split_def field_simps)
    8.87 +  apply (simp add: Let_def split_def field_simps)
    8.88 +  apply (simp add: Let_def split_def field_simps)
    8.89 +  apply (simp add: Let_def split_def field_simps)
    8.90 +  apply (simp add: Let_def split_def field_simps)
    8.91    apply (simp add: Let_def split_def mult_assoc right_distrib[symmetric])
    8.92 -  apply (simp add: Let_def split_def ring_simps)
    8.93 -  apply (simp add: Let_def split_def ring_simps)
    8.94 +  apply (simp add: Let_def split_def field_simps)
    8.95 +  apply (simp add: Let_def split_def field_simps)
    8.96    done
    8.97  
    8.98  lemma split0_ci: "split0 t = (c',t') \<Longrightarrow> Itm vs bs t = Itm vs bs (CNP 0 c' t')"
    8.99 @@ -387,7 +387,7 @@
   8.100  qed
   8.101  
   8.102  lemma split0_nb0: 
   8.103 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero, field})"
   8.104 +  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero, field})"
   8.105    shows "split0 t = (c',t') \<Longrightarrow>  tmbound 0 t'"
   8.106  proof-
   8.107    fix c' t'
   8.108 @@ -395,7 +395,7 @@
   8.109    with conjunct1[OF split0[where t="t"]] show "tmbound 0 t'" by simp
   8.110  qed
   8.111  
   8.112 -lemma split0_nb0'[simp]:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero, field})"
   8.113 +lemma split0_nb0'[simp]:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero, field})"
   8.114    shows "tmbound0 (snd (split0 t))"
   8.115    using split0_nb0[of t "fst (split0 t)" "snd (split0 t)"] by (simp add: tmbound0_tmbound_iff)
   8.116  
   8.117 @@ -418,7 +418,7 @@
   8.118  lemma allpolys_split0: "allpolys isnpoly p \<Longrightarrow> allpolys isnpoly (snd (split0 p))"
   8.119  by (induct p rule: split0.induct, auto simp  add: isnpoly_def Let_def split_def split0_stupid)
   8.120  
   8.121 -lemma isnpoly_fst_split0:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero, field})"
   8.122 +lemma isnpoly_fst_split0:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero, field})"
   8.123    shows 
   8.124    "allpolys isnpoly p \<Longrightarrow> isnpoly (fst (split0 p))"
   8.125    by (induct p rule: split0.induct, 
   8.126 @@ -447,7 +447,7 @@
   8.127  by (induct p rule: fmsize.induct) simp_all
   8.128  
   8.129    (* Semantics of formulae (fm) *)
   8.130 -consts Ifm ::"'a::{division_by_zero,linordered_field} list \<Rightarrow> 'a list \<Rightarrow> fm \<Rightarrow> bool"
   8.131 +consts Ifm ::"'a::{division_ring_inverse_zero,linordered_field} list \<Rightarrow> 'a list \<Rightarrow> fm \<Rightarrow> bool"
   8.132  primrec
   8.133    "Ifm vs bs T = True"
   8.134    "Ifm vs bs F = False"
   8.135 @@ -969,24 +969,24 @@
   8.136  definition "simpeq t = (let (c,s) = split0 (simptm t) in if c= 0\<^sub>p then eq s else Eq (CNP 0 c s))"
   8.137  definition "simpneq t = (let (c,s) = split0 (simptm t) in if c= 0\<^sub>p then neq s else NEq (CNP 0 c s))"
   8.138  
   8.139 -lemma simplt_islin[simp]:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
   8.140 +lemma simplt_islin[simp]:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero,field})"
   8.141    shows "islin (simplt t)"
   8.142    unfolding simplt_def 
   8.143    using split0_nb0'
   8.144  by (auto simp add: lt_lin Let_def split_def isnpoly_fst_split0[OF simptm_allpolys_npoly] islin_stupid allpolys_split0[OF simptm_allpolys_npoly])
   8.145    
   8.146 -lemma simple_islin[simp]:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
   8.147 +lemma simple_islin[simp]:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero,field})"
   8.148    shows "islin (simple t)"
   8.149    unfolding simple_def 
   8.150    using split0_nb0'
   8.151  by (auto simp add: Let_def split_def isnpoly_fst_split0[OF simptm_allpolys_npoly] islin_stupid allpolys_split0[OF simptm_allpolys_npoly] le_lin)
   8.152 -lemma simpeq_islin[simp]:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
   8.153 +lemma simpeq_islin[simp]:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero,field})"
   8.154    shows "islin (simpeq t)"
   8.155    unfolding simpeq_def 
   8.156    using split0_nb0'
   8.157  by (auto simp add: Let_def split_def isnpoly_fst_split0[OF simptm_allpolys_npoly] islin_stupid allpolys_split0[OF simptm_allpolys_npoly] eq_lin)
   8.158  
   8.159 -lemma simpneq_islin[simp]:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
   8.160 +lemma simpneq_islin[simp]:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero,field})"
   8.161    shows "islin (simpneq t)"
   8.162    unfolding simpneq_def 
   8.163    using split0_nb0'
   8.164 @@ -994,7 +994,7 @@
   8.165  
   8.166  lemma really_stupid: "\<not> (\<forall>c1 s'. (c1, s') \<noteq> split0 s)"
   8.167    by (cases "split0 s", auto)
   8.168 -lemma split0_npoly:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
   8.169 +lemma split0_npoly:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero,field})"
   8.170    and n: "allpolys isnpoly t"
   8.171    shows "isnpoly (fst (split0 t))" and "allpolys isnpoly (snd (split0 t))"
   8.172    using n
   8.173 @@ -1083,7 +1083,7 @@
   8.174    apply (case_tac poly, auto)
   8.175    done
   8.176  
   8.177 -lemma simplt_nb[simp]:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
   8.178 +lemma simplt_nb[simp]:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero,field})"
   8.179    shows "tmbound0 t \<Longrightarrow> bound0 (simplt t)"
   8.180    using split0 [of "simptm t" vs bs]
   8.181  proof(simp add: simplt_def Let_def split_def)
   8.182 @@ -1100,7 +1100,7 @@
   8.183         fst (split0 (simptm t)) = 0\<^sub>p" by (simp add: simplt_def Let_def split_def lt_nb)
   8.184  qed
   8.185  
   8.186 -lemma simple_nb[simp]:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
   8.187 +lemma simple_nb[simp]:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero,field})"
   8.188    shows "tmbound0 t \<Longrightarrow> bound0 (simple t)"
   8.189    using split0 [of "simptm t" vs bs]
   8.190  proof(simp add: simple_def Let_def split_def)
   8.191 @@ -1117,7 +1117,7 @@
   8.192         fst (split0 (simptm t)) = 0\<^sub>p" by (simp add: simplt_def Let_def split_def le_nb)
   8.193  qed
   8.194  
   8.195 -lemma simpeq_nb[simp]:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
   8.196 +lemma simpeq_nb[simp]:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero,field})"
   8.197    shows "tmbound0 t \<Longrightarrow> bound0 (simpeq t)"
   8.198    using split0 [of "simptm t" vs bs]
   8.199  proof(simp add: simpeq_def Let_def split_def)
   8.200 @@ -1134,7 +1134,7 @@
   8.201         fst (split0 (simptm t)) = 0\<^sub>p" by (simp add: simpeq_def Let_def split_def eq_nb)
   8.202  qed
   8.203  
   8.204 -lemma simpneq_nb[simp]:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
   8.205 +lemma simpneq_nb[simp]:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero,field})"
   8.206    shows "tmbound0 t \<Longrightarrow> bound0 (simpneq t)"
   8.207    using split0 [of "simptm t" vs bs]
   8.208  proof(simp add: simpneq_def Let_def split_def)
   8.209 @@ -1267,7 +1267,7 @@
   8.210  lemma simpfm[simp]: "Ifm vs bs (simpfm p) = Ifm vs bs p"
   8.211  by(induct p arbitrary: bs rule: simpfm.induct, auto)
   8.212  
   8.213 -lemma simpfm_bound0:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
   8.214 +lemma simpfm_bound0:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero,field})"
   8.215    shows "bound0 p \<Longrightarrow> bound0 (simpfm p)"
   8.216  by (induct p rule: simpfm.induct, auto)
   8.217  
   8.218 @@ -1296,7 +1296,7 @@
   8.219  lemma disj_lin: "islin p \<Longrightarrow> islin q \<Longrightarrow> islin (disj p q)" by (simp add: disj_def)
   8.220  lemma conj_lin: "islin p \<Longrightarrow> islin q \<Longrightarrow> islin (conj p q)" by (simp add: conj_def)
   8.221  
   8.222 -lemma   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
   8.223 +lemma   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero,field})"
   8.224    shows "qfree p \<Longrightarrow> islin (simpfm p)" 
   8.225    apply (induct p rule: simpfm.induct)
   8.226    apply (simp_all add: conj_lin disj_lin)
   8.227 @@ -1698,11 +1698,11 @@
   8.228    {assume c: "?N c > 0"
   8.229        from px pos_less_divide_eq[OF c, where a="x" and b="-?Nt x s"]  
   8.230        have px': "x < - ?Nt x s / ?N c" 
   8.231 -        by (auto simp add: not_less ring_simps) 
   8.232 +        by (auto simp add: not_less field_simps) 
   8.233      {assume y: "y < - ?Nt x s / ?N c" 
   8.234        hence "y * ?N c < - ?Nt x s"
   8.235          by (simp add: pos_less_divide_eq[OF c, where a="y" and b="-?Nt x s", symmetric])
   8.236 -      hence "?N c * y + ?Nt x s < 0" by (simp add: ring_simps)
   8.237 +      hence "?N c * y + ?Nt x s < 0" by (simp add: field_simps)
   8.238        hence ?case using tmbound0_I[OF lin(3), where bs="bs" and b="x" and b'="y"] by simp}
   8.239      moreover
   8.240      {assume y: "y > -?Nt x s / ?N c" 
   8.241 @@ -1715,11 +1715,11 @@
   8.242    {assume c: "?N c < 0"
   8.243        from px neg_divide_less_eq[OF c, where a="x" and b="-?Nt x s"]  
   8.244        have px': "x > - ?Nt x s / ?N c" 
   8.245 -        by (auto simp add: not_less ring_simps) 
   8.246 +        by (auto simp add: not_less field_simps) 
   8.247      {assume y: "y > - ?Nt x s / ?N c" 
   8.248        hence "y * ?N c < - ?Nt x s"
   8.249          by (simp add: neg_divide_less_eq[OF c, where a="y" and b="-?Nt x s", symmetric])
   8.250 -      hence "?N c * y + ?Nt x s < 0" by (simp add: ring_simps)
   8.251 +      hence "?N c * y + ?Nt x s < 0" by (simp add: field_simps)
   8.252        hence ?case using tmbound0_I[OF lin(3), where bs="bs" and b="x" and b'="y"] by simp}
   8.253      moreover
   8.254      {assume y: "y < -?Nt x s / ?N c" 
   8.255 @@ -1743,11 +1743,11 @@
   8.256    moreover
   8.257    {assume c: "?N c > 0"
   8.258        from px pos_le_divide_eq[OF c, where a="x" and b="-?Nt x s"]  
   8.259 -      have px': "x <= - ?Nt x s / ?N c" by (simp add: not_less ring_simps) 
   8.260 +      have px': "x <= - ?Nt x s / ?N c" by (simp add: not_less field_simps) 
   8.261      {assume y: "y < - ?Nt x s / ?N c" 
   8.262        hence "y * ?N c < - ?Nt x s"
   8.263          by (simp add: pos_less_divide_eq[OF c, where a="y" and b="-?Nt x s", symmetric])
   8.264 -      hence "?N c * y + ?Nt x s < 0" by (simp add: ring_simps)
   8.265 +      hence "?N c * y + ?Nt x s < 0" by (simp add: field_simps)
   8.266        hence ?case using tmbound0_I[OF lin(3), where bs="bs" and b="x" and b'="y"] by simp}
   8.267      moreover
   8.268      {assume y: "y > -?Nt x s / ?N c" 
   8.269 @@ -1759,11 +1759,11 @@
   8.270    moreover
   8.271    {assume c: "?N c < 0"
   8.272        from px neg_divide_le_eq[OF c, where a="x" and b="-?Nt x s"]  
   8.273 -      have px': "x >= - ?Nt x s / ?N c" by (simp add: ring_simps) 
   8.274 +      have px': "x >= - ?Nt x s / ?N c" by (simp add: field_simps) 
   8.275      {assume y: "y > - ?Nt x s / ?N c" 
   8.276        hence "y * ?N c < - ?Nt x s"
   8.277          by (simp add: neg_divide_less_eq[OF c, where a="y" and b="-?Nt x s", symmetric])
   8.278 -      hence "?N c * y + ?Nt x s < 0" by (simp add: ring_simps)
   8.279 +      hence "?N c * y + ?Nt x s < 0" by (simp add: field_simps)
   8.280        hence ?case using tmbound0_I[OF lin(3), where bs="bs" and b="x" and b'="y"] by simp}
   8.281      moreover
   8.282      {assume y: "y < -?Nt x s / ?N c" 
   8.283 @@ -1787,7 +1787,7 @@
   8.284    moreover
   8.285    {assume c: "?N c > 0" hence cnz: "?N c \<noteq> 0" by simp
   8.286      from px eq_divide_eq[of "x" "-?Nt x s" "?N c"]  cnz
   8.287 -    have px': "x = - ?Nt x s / ?N c" by (simp add: ring_simps)
   8.288 +    have px': "x = - ?Nt x s / ?N c" by (simp add: field_simps)
   8.289      {assume y: "y < -?Nt x s / ?N c" 
   8.290        with ly have eu: "l < - ?Nt x s / ?N c" by auto
   8.291        with noS ly yu have th: "- ?Nt x s / ?N c \<ge> u" by (cases "- ?Nt x s / ?N c < u", auto)
   8.292 @@ -1802,7 +1802,7 @@
   8.293    moreover
   8.294    {assume c: "?N c < 0" hence cnz: "?N c \<noteq> 0" by simp
   8.295      from px eq_divide_eq[of "x" "-?Nt x s" "?N c"]  cnz
   8.296 -    have px': "x = - ?Nt x s / ?N c" by (simp add: ring_simps)
   8.297 +    have px': "x = - ?Nt x s / ?N c" by (simp add: field_simps)
   8.298      {assume y: "y < -?Nt x s / ?N c" 
   8.299        with ly have eu: "l < - ?Nt x s / ?N c" by auto
   8.300        with noS ly yu have th: "- ?Nt x s / ?N c \<ge> u" by (cases "- ?Nt x s / ?N c < u", auto)
   8.301 @@ -1829,7 +1829,7 @@
   8.302    moreover
   8.303    {assume c: "?N c \<noteq> 0"
   8.304      from yne c eq_divide_eq[of "y" "- ?Nt x s" "?N c"] have ?case
   8.305 -      by (simp add: ring_simps tmbound0_I[OF lin(3), of vs x bs y] sum_eq[symmetric]) }
   8.306 +      by (simp add: field_simps tmbound0_I[OF lin(3), of vs x bs y] sum_eq[symmetric]) }
   8.307    ultimately show ?case by blast
   8.308  qed (auto simp add: nth_pos2 tmbound0_I[where vs=vs and bs="bs" and b="y" and b'="x"] bound0_I[where vs=vs and bs="bs" and b="y" and b'="x"])
   8.309  
   8.310 @@ -1844,7 +1844,7 @@
   8.311  
   8.312  lemma half_sum_eq: "(u + u) / (1+1) = (u::'a::{linordered_field})" 
   8.313  proof-
   8.314 -  have "(u + u) = (1 + 1) * u" by (simp add: ring_simps)
   8.315 +  have "(u + u) = (1 + 1) * u" by (simp add: field_simps)
   8.316    hence "(u + u) / (1+1) = (1 + 1)*u / (1 + 1)" by simp
   8.317    with nonzero_mult_divide_cancel_left[OF one_plus_one_nonzero, of u] show ?thesis by simp
   8.318  qed
   8.319 @@ -1987,7 +1987,7 @@
   8.320      also have "\<dots> \<longleftrightarrow> (1 + 1)*?d * (?a * (-?s / ((1 + 1)*?d)) + ?r) = 0" 
   8.321        using d mult_cancel_left[of "(1 + 1)*?d" "(?a * (-?s / ((1 + 1)*?d)) + ?r)" 0] by simp
   8.322      also have "\<dots> \<longleftrightarrow> (- ?a * ?s) * ((1 + 1)*?d / ((1 + 1)*?d)) + (1 + 1)*?d*?r= 0"
   8.323 -      by (simp add: ring_simps right_distrib[of "(1 + 1)*?d"] del: right_distrib)
   8.324 +      by (simp add: field_simps right_distrib[of "(1 + 1)*?d"] del: right_distrib)
   8.325      
   8.326      also have "\<dots> \<longleftrightarrow> - (?a * ?s) + (1 + 1)*?d*?r = 0" using d by simp 
   8.327      finally have ?thesis using c d 
   8.328 @@ -2003,7 +2003,7 @@
   8.329      also have "\<dots> \<longleftrightarrow> (1 + 1)*?c * (?a * (-?t / ((1 + 1)*?c)) + ?r) = 0" 
   8.330        using c mult_cancel_left[of "(1 + 1)*?c" "(?a * (-?t / ((1 + 1)*?c)) + ?r)" 0] by simp
   8.331      also have "\<dots> \<longleftrightarrow> (?a * -?t)* ((1 + 1)*?c) / ((1 + 1)*?c) + (1 + 1)*?c*?r= 0"
   8.332 -      by (simp add: ring_simps right_distrib[of "(1 + 1)*?c"] del: right_distrib)
   8.333 +      by (simp add: field_simps right_distrib[of "(1 + 1)*?c"] del: right_distrib)
   8.334      also have "\<dots> \<longleftrightarrow> - (?a * ?t) + (1 + 1)*?c*?r = 0" using c by simp 
   8.335      finally have ?thesis using c d 
   8.336        apply (simp add: r[of "- (?t/ ((1 + 1)*?c))"] msubsteq_def Let_def evaldjf_ex del: one_add_one_is_two)
   8.337 @@ -2014,19 +2014,19 @@
   8.338    {assume c: "?c \<noteq> 0" and d: "?d\<noteq>0" hence dc: "?c * ?d *(1 + 1) \<noteq> 0" by simp
   8.339      from add_frac_eq[OF c d, of "- ?t" "- ?s"]
   8.340      have th: "(- ?t / ?c + - ?s / ?d)/(1 + 1) = - (?d * ?t + ?c* ?s )/ ((1 + 1)*?c*?d)" 
   8.341 -      by (simp add: ring_simps)
   8.342 +      by (simp add: field_simps)
   8.343      have "?rhs \<longleftrightarrow> Ifm vs (- (?d * ?t + ?c* ?s )/ ((1 + 1)*?c*?d) # bs) (Eq (CNP 0 a r))" by (simp only: th)
   8.344      also have "\<dots> \<longleftrightarrow> ?a * (- (?d * ?t + ?c* ?s )/ ((1 + 1)*?c*?d)) + ?r = 0" 
   8.345        by (simp add: r[of "(- (?d * ?t) + - (?c *?s)) / ((1 + 1) * ?c * ?d)"])
   8.346      also have "\<dots> \<longleftrightarrow> ((1 + 1) * ?c * ?d) * (?a * (- (?d * ?t + ?c* ?s )/ ((1 + 1)*?c*?d)) + ?r) =0 "
   8.347        using c d mult_cancel_left[of "(1 + 1) * ?c * ?d" "?a * (- (?d * ?t + ?c* ?s)/ ((1 + 1)*?c*?d)) + ?r" 0] by simp
   8.348      also have "\<dots> \<longleftrightarrow> ?a * (- (?d * ?t + ?c* ?s )) + (1 + 1)*?c*?d*?r =0" 
   8.349 -      using nonzero_mult_divide_cancel_left[OF dc] c d
   8.350 -      by (simp add: ring_simps diff_divide_distrib del: left_distrib)
   8.351 +      using nonzero_mult_divide_cancel_left [OF dc] c d
   8.352 +      by (simp add: algebra_simps diff_divide_distrib del: left_distrib)
   8.353      finally  have ?thesis using c d 
   8.354 -      apply (simp add: r[of "(- (?d * ?t) + - (?c *?s)) / ((1 + 1) * ?c * ?d)"] msubsteq_def Let_def evaldjf_ex ring_simps)
   8.355 +      apply (simp add: r[of "(- (?d * ?t) + - (?c *?s)) / ((1 + 1) * ?c * ?d)"] msubsteq_def Let_def evaldjf_ex field_simps)
   8.356        apply (simp only: one_add_one_is_two[symmetric] of_int_add)
   8.357 -      apply (simp add: ring_simps)
   8.358 +      apply (simp add: field_simps)
   8.359        done }
   8.360    ultimately show ?thesis by blast
   8.361  qed
   8.362 @@ -2075,7 +2075,7 @@
   8.363      also have "\<dots> \<longleftrightarrow> (1 + 1)*?d * (?a * (-?s / ((1 + 1)*?d)) + ?r) \<noteq> 0" 
   8.364        using d mult_cancel_left[of "(1 + 1)*?d" "(?a * (-?s / ((1 + 1)*?d)) + ?r)" 0] by simp
   8.365      also have "\<dots> \<longleftrightarrow> (- ?a * ?s) * ((1 + 1)*?d / ((1 + 1)*?d)) + (1 + 1)*?d*?r\<noteq> 0"
   8.366 -      by (simp add: ring_simps right_distrib[of "(1 + 1)*?d"] del: right_distrib)
   8.367 +      by (simp add: field_simps right_distrib[of "(1 + 1)*?d"] del: right_distrib)
   8.368      
   8.369      also have "\<dots> \<longleftrightarrow> - (?a * ?s) + (1 + 1)*?d*?r \<noteq> 0" using d by simp 
   8.370      finally have ?thesis using c d 
   8.371 @@ -2091,7 +2091,7 @@
   8.372      also have "\<dots> \<longleftrightarrow> (1 + 1)*?c * (?a * (-?t / ((1 + 1)*?c)) + ?r) \<noteq> 0" 
   8.373        using c mult_cancel_left[of "(1 + 1)*?c" "(?a * (-?t / ((1 + 1)*?c)) + ?r)" 0] by simp
   8.374      also have "\<dots> \<longleftrightarrow> (?a * -?t)* ((1 + 1)*?c) / ((1 + 1)*?c) + (1 + 1)*?c*?r \<noteq> 0"
   8.375 -      by (simp add: ring_simps right_distrib[of "(1 + 1)*?c"] del: right_distrib)
   8.376 +      by (simp add: field_simps right_distrib[of "(1 + 1)*?c"] del: right_distrib)
   8.377      also have "\<dots> \<longleftrightarrow> - (?a * ?t) + (1 + 1)*?c*?r \<noteq> 0" using c by simp 
   8.378      finally have ?thesis using c d 
   8.379        apply (simp add: r[of "- (?t/ ((1 + 1)*?c))"] msubstneq_def Let_def evaldjf_ex del: one_add_one_is_two)
   8.380 @@ -2102,7 +2102,7 @@
   8.381    {assume c: "?c \<noteq> 0" and d: "?d\<noteq>0" hence dc: "?c * ?d *(1 + 1) \<noteq> 0" by simp
   8.382      from add_frac_eq[OF c d, of "- ?t" "- ?s"]
   8.383      have th: "(- ?t / ?c + - ?s / ?d)/(1 + 1) = - (?d * ?t + ?c* ?s )/ ((1 + 1)*?c*?d)" 
   8.384 -      by (simp add: ring_simps)
   8.385 +      by (simp add: field_simps)
   8.386      have "?rhs \<longleftrightarrow> Ifm vs (- (?d * ?t + ?c* ?s )/ ((1 + 1)*?c*?d) # bs) (NEq (CNP 0 a r))" by (simp only: th)
   8.387      also have "\<dots> \<longleftrightarrow> ?a * (- (?d * ?t + ?c* ?s )/ ((1 + 1)*?c*?d)) + ?r \<noteq> 0" 
   8.388        by (simp add: r[of "(- (?d * ?t) + - (?c *?s)) / ((1 + 1) * ?c * ?d)"])
   8.389 @@ -2110,11 +2110,11 @@
   8.390        using c d mult_cancel_left[of "(1 + 1) * ?c * ?d" "?a * (- (?d * ?t + ?c* ?s)/ ((1 + 1)*?c*?d)) + ?r" 0] by simp
   8.391      also have "\<dots> \<longleftrightarrow> ?a * (- (?d * ?t + ?c* ?s )) + (1 + 1)*?c*?d*?r \<noteq> 0" 
   8.392        using nonzero_mult_divide_cancel_left[OF dc] c d
   8.393 -      by (simp add: ring_simps diff_divide_distrib del: left_distrib)
   8.394 +      by (simp add: algebra_simps diff_divide_distrib del: left_distrib)
   8.395      finally  have ?thesis using c d 
   8.396 -      apply (simp add: r[of "(- (?d * ?t) + - (?c *?s)) / ((1 + 1) * ?c * ?d)"] msubstneq_def Let_def evaldjf_ex ring_simps)
   8.397 +      apply (simp add: r[of "(- (?d * ?t) + - (?c *?s)) / ((1 + 1) * ?c * ?d)"] msubstneq_def Let_def evaldjf_ex field_simps)
   8.398        apply (simp only: one_add_one_is_two[symmetric] of_int_add)
   8.399 -      apply (simp add: ring_simps)
   8.400 +      apply (simp add: field_simps)
   8.401        done }
   8.402    ultimately show ?thesis by blast
   8.403  qed
   8.404 @@ -2169,7 +2169,7 @@
   8.405      from dc' have dc'': "\<not> (1 + 1)*?c *?d < 0" by simp
   8.406      from add_frac_eq[OF c d, of "- ?t" "- ?s"]
   8.407      have th: "(- ?t / ?c + - ?s / ?d)/(1 + 1) = - (?d * ?t + ?c* ?s )/ ((1 + 1)*?c*?d)" 
   8.408 -      by (simp add: ring_simps)
   8.409 +      by (simp add: field_simps)
   8.410      have "?rhs \<longleftrightarrow> Ifm vs (- (?d * ?t + ?c* ?s )/ ((1 + 1)*?c*?d) # bs) (Lt (CNP 0 a r))" by (simp only: th)
   8.411      also have "\<dots> \<longleftrightarrow> ?a * (- (?d * ?t + ?c* ?s )/ ((1 + 1)*?c*?d)) + ?r < 0" 
   8.412        by (simp add: r[of "(- (?d * ?t) + - (?c *?s)) / ((1 + 1) * ?c * ?d)"])
   8.413 @@ -2178,11 +2178,11 @@
   8.414        using dc' dc'' mult_less_cancel_left_disj[of "(1 + 1) * ?c * ?d" "?a * (- (?d * ?t + ?c* ?s)/ ((1 + 1)*?c*?d)) + ?r" 0] by simp
   8.415      also have "\<dots> \<longleftrightarrow> ?a * (- (?d * ?t + ?c* ?s )) + (1 + 1)*?c*?d*?r < 0" 
   8.416        using nonzero_mult_divide_cancel_left[of "(1 + 1)*?c*?d"] c d
   8.417 -      by (simp add: ring_simps diff_divide_distrib del: left_distrib)
   8.418 +      by (simp add: algebra_simps diff_divide_distrib del: left_distrib)
   8.419      finally  have ?thesis using dc c d  nc nd dc'
   8.420 -      apply (simp add: r[of "(- (?d * ?t) + - (?c *?s)) / ((1 + 1) * ?c * ?d)"] msubstlt_def Let_def evaldjf_ex ring_simps lt polyneg_norm polymul_norm) 
   8.421 +      apply (simp add: r[of "(- (?d * ?t) + - (?c *?s)) / ((1 + 1) * ?c * ?d)"] msubstlt_def Let_def evaldjf_ex field_simps lt polyneg_norm polymul_norm) 
   8.422      apply (simp only: one_add_one_is_two[symmetric] of_int_add)
   8.423 -    by (simp add: ring_simps order_less_not_sym[OF dc])}
   8.424 +    by (simp add: field_simps order_less_not_sym[OF dc])}
   8.425    moreover
   8.426    {assume dc: "?c*?d < 0" 
   8.427  
   8.428 @@ -2191,7 +2191,7 @@
   8.429      hence c:"?c \<noteq> 0" and d: "?d\<noteq> 0" by auto
   8.430      from add_frac_eq[OF c d, of "- ?t" "- ?s"]
   8.431      have th: "(- ?t / ?c + - ?s / ?d)/(1 + 1) = - (?d * ?t + ?c* ?s )/ ((1 + 1)*?c*?d)" 
   8.432 -      by (simp add: ring_simps)
   8.433 +      by (simp add: field_simps)
   8.434      have "?rhs \<longleftrightarrow> Ifm vs (- (?d * ?t + ?c* ?s )/ ((1 + 1)*?c*?d) # bs) (Lt (CNP 0 a r))" by (simp only: th)
   8.435      also have "\<dots> \<longleftrightarrow> ?a * (- (?d * ?t + ?c* ?s )/ ((1 + 1)*?c*?d)) + ?r < 0" 
   8.436        by (simp add: r[of "(- (?d * ?t) + - (?c *?s)) / ((1 + 1) * ?c * ?d)"])
   8.437 @@ -2201,78 +2201,78 @@
   8.438        using dc' order_less_not_sym[OF dc'] mult_less_cancel_left_disj[of "(1 + 1) * ?c * ?d" 0 "?a * (- (?d * ?t + ?c* ?s)/ ((1 + 1)*?c*?d)) + ?r"] by simp
   8.439      also have "\<dots> \<longleftrightarrow> ?a * ((?d * ?t + ?c* ?s )) - (1 + 1)*?c*?d*?r < 0" 
   8.440        using nonzero_mult_divide_cancel_left[of "(1 + 1)*?c*?d"] c d
   8.441 -      by (simp add: ring_simps diff_divide_distrib del: left_distrib)
   8.442 +      by (simp add: algebra_simps diff_divide_distrib del: left_distrib)
   8.443      finally  have ?thesis using dc c d  nc nd
   8.444 -      apply (simp add: r[of "(- (?d * ?t) + - (?c *?s)) / ((1 + 1) * ?c * ?d)"] msubstlt_def Let_def evaldjf_ex ring_simps lt polyneg_norm polymul_norm) 
   8.445 +      apply (simp add: r[of "(- (?d * ?t) + - (?c *?s)) / ((1 + 1) * ?c * ?d)"] msubstlt_def Let_def evaldjf_ex field_simps lt polyneg_norm polymul_norm) 
   8.446        apply (simp only: one_add_one_is_two[symmetric] of_int_add)
   8.447 -      by (simp add: ring_simps order_less_not_sym[OF dc]) }
   8.448 +      by (simp add: field_simps order_less_not_sym[OF dc]) }
   8.449    moreover
   8.450    {assume c: "?c > 0" and d: "?d=0"  
   8.451      from c have c'': "(1 + 1)*?c > 0" by (simp add: zero_less_mult_iff)
   8.452      from c have c': "(1 + 1)*?c \<noteq> 0" by simp
   8.453 -    from d have th: "(- ?t / ?c + - ?s / ?d)/(1 + 1) = - ?t / ((1 + 1)*?c)"  by (simp add: ring_simps)
   8.454 +    from d have th: "(- ?t / ?c + - ?s / ?d)/(1 + 1) = - ?t / ((1 + 1)*?c)"  by (simp add: field_simps)
   8.455      have "?rhs \<longleftrightarrow> Ifm vs (- ?t / ((1 + 1)*?c) # bs) (Lt (CNP 0 a r))" by (simp only: th)
   8.456      also have "\<dots> \<longleftrightarrow> ?a* (- ?t / ((1 + 1)*?c))+ ?r < 0" by (simp add: r[of "- (?t / ((1 + 1)*?c))"])
   8.457      also have "\<dots> \<longleftrightarrow> (1 + 1)*?c * (?a* (- ?t / ((1 + 1)*?c))+ ?r) < 0"
   8.458        using c mult_less_cancel_left_disj[of "(1 + 1) * ?c" "?a* (- ?t / ((1 + 1)*?c))+ ?r" 0] c' c'' order_less_not_sym[OF c''] by simp
   8.459      also have "\<dots> \<longleftrightarrow> - ?a*?t+  (1 + 1)*?c *?r < 0" 
   8.460        using nonzero_mult_divide_cancel_left[OF c'] c
   8.461 -      by (simp add: ring_simps diff_divide_distrib less_le del: left_distrib)
   8.462 +      by (simp add: algebra_simps diff_divide_distrib less_le del: left_distrib)
   8.463      finally have ?thesis using c d nc nd 
   8.464 -      apply(simp add: r[of "- (?t / ((1 + 1)*?c))"] msubstlt_def Let_def evaldjf_ex ring_simps lt polyneg_norm polymul_norm)
   8.465 +      apply(simp add: r[of "- (?t / ((1 + 1)*?c))"] msubstlt_def Let_def evaldjf_ex field_simps lt polyneg_norm polymul_norm)
   8.466        apply (simp only: one_add_one_is_two[symmetric] of_int_add)
   8.467        using c order_less_not_sym[OF c] less_imp_neq[OF c]
   8.468 -      by (simp add: ring_simps )  }
   8.469 +      by (simp add: field_simps )  }
   8.470    moreover
   8.471    {assume c: "?c < 0" and d: "?d=0"  hence c': "(1 + 1)*?c \<noteq> 0" by simp
   8.472      from c have c'': "(1 + 1)*?c < 0" by (simp add: mult_less_0_iff)
   8.473 -    from d have th: "(- ?t / ?c + - ?s / ?d)/(1 + 1) = - ?t / ((1 + 1)*?c)"  by (simp add: ring_simps)
   8.474 +    from d have th: "(- ?t / ?c + - ?s / ?d)/(1 + 1) = - ?t / ((1 + 1)*?c)"  by (simp add: field_simps)
   8.475      have "?rhs \<longleftrightarrow> Ifm vs (- ?t / ((1 + 1)*?c) # bs) (Lt (CNP 0 a r))" by (simp only: th)
   8.476      also have "\<dots> \<longleftrightarrow> ?a* (- ?t / ((1 + 1)*?c))+ ?r < 0" by (simp add: r[of "- (?t / ((1 + 1)*?c))"])
   8.477      also have "\<dots> \<longleftrightarrow> (1 + 1)*?c * (?a* (- ?t / ((1 + 1)*?c))+ ?r) > 0"
   8.478        using c order_less_not_sym[OF c''] less_imp_neq[OF c''] c'' mult_less_cancel_left_disj[of "(1 + 1) * ?c" 0 "?a* (- ?t / ((1 + 1)*?c))+ ?r"] by simp
   8.479      also have "\<dots> \<longleftrightarrow> ?a*?t -  (1 + 1)*?c *?r < 0" 
   8.480        using nonzero_mult_divide_cancel_left[OF c'] c order_less_not_sym[OF c''] less_imp_neq[OF c''] c''
   8.481 -        by (simp add: ring_simps diff_divide_distrib del:  left_distrib)
   8.482 +        by (simp add: algebra_simps diff_divide_distrib del:  left_distrib)
   8.483      finally have ?thesis using c d nc nd 
   8.484 -      apply(simp add: r[of "- (?t / ((1 + 1)*?c))"] msubstlt_def Let_def evaldjf_ex ring_simps lt polyneg_norm polymul_norm)
   8.485 +      apply(simp add: r[of "- (?t / ((1 + 1)*?c))"] msubstlt_def Let_def evaldjf_ex field_simps lt polyneg_norm polymul_norm)
   8.486        apply (simp only: one_add_one_is_two[symmetric] of_int_add)
   8.487        using c order_less_not_sym[OF c] less_imp_neq[OF c]
   8.488 -      by (simp add: ring_simps )    }
   8.489 +      by (simp add: field_simps )    }
   8.490    moreover
   8.491    moreover
   8.492    {assume c: "?c = 0" and d: "?d>0"  
   8.493      from d have d'': "(1 + 1)*?d > 0" by (simp add: zero_less_mult_iff)
   8.494      from d have d': "(1 + 1)*?d \<noteq> 0" by simp
   8.495 -    from c have th: "(- ?t / ?c + - ?s / ?d)/(1 + 1) = - ?s / ((1 + 1)*?d)"  by (simp add: ring_simps)
   8.496 +    from c have th: "(- ?t / ?c + - ?s / ?d)/(1 + 1) = - ?s / ((1 + 1)*?d)"  by (simp add: field_simps)
   8.497      have "?rhs \<longleftrightarrow> Ifm vs (- ?s / ((1 + 1)*?d) # bs) (Lt (CNP 0 a r))" by (simp only: th)
   8.498      also have "\<dots> \<longleftrightarrow> ?a* (- ?s / ((1 + 1)*?d))+ ?r < 0" by (simp add: r[of "- (?s / ((1 + 1)*?d))"])
   8.499      also have "\<dots> \<longleftrightarrow> (1 + 1)*?d * (?a* (- ?s / ((1 + 1)*?d))+ ?r) < 0"
   8.500        using d mult_less_cancel_left_disj[of "(1 + 1) * ?d" "?a* (- ?s / ((1 + 1)*?d))+ ?r" 0] d' d'' order_less_not_sym[OF d''] by simp
   8.501      also have "\<dots> \<longleftrightarrow> - ?a*?s+  (1 + 1)*?d *?r < 0" 
   8.502        using nonzero_mult_divide_cancel_left[OF d'] d
   8.503 -      by (simp add: ring_simps diff_divide_distrib less_le del: left_distrib)
   8.504 +      by (simp add: algebra_simps diff_divide_distrib less_le del: left_distrib)
   8.505      finally have ?thesis using c d nc nd 
   8.506 -      apply(simp add: r[of "- (?s / ((1 + 1)*?d))"] msubstlt_def Let_def evaldjf_ex ring_simps lt polyneg_norm polymul_norm)
   8.507 +      apply(simp add: r[of "- (?s / ((1 + 1)*?d))"] msubstlt_def Let_def evaldjf_ex field_simps lt polyneg_norm polymul_norm)
   8.508        apply (simp only: one_add_one_is_two[symmetric] of_int_add)
   8.509        using d order_less_not_sym[OF d] less_imp_neq[OF d]
   8.510 -      by (simp add: ring_simps )  }
   8.511 +      by (simp add: field_simps)  }
   8.512    moreover
   8.513    {assume c: "?c = 0" and d: "?d<0"  hence d': "(1 + 1)*?d \<noteq> 0" by simp
   8.514      from d have d'': "(1 + 1)*?d < 0" by (simp add: mult_less_0_iff)
   8.515 -    from c have th: "(- ?t / ?c + - ?s / ?d)/(1 + 1) = - ?s / ((1 + 1)*?d)"  by (simp add: ring_simps)
   8.516 +    from c have th: "(- ?t / ?c + - ?s / ?d)/(1 + 1) = - ?s / ((1 + 1)*?d)"  by (simp add: field_simps)
   8.517      have "?rhs \<longleftrightarrow> Ifm vs (- ?s / ((1 + 1)*?d) # bs) (Lt (CNP 0 a r))" by (simp only: th)
   8.518      also have "\<dots> \<longleftrightarrow> ?a* (- ?s / ((1 + 1)*?d))+ ?r < 0" by (simp add: r[of "- (?s / ((1 + 1)*?d))"])
   8.519      also have "\<dots> \<longleftrightarrow> (1 + 1)*?d * (?a* (- ?s / ((1 + 1)*?d))+ ?r) > 0"
   8.520        using d order_less_not_sym[OF d''] less_imp_neq[OF d''] d'' mult_less_cancel_left_disj[of "(1 + 1) * ?d" 0 "?a* (- ?s / ((1 + 1)*?d))+ ?r"] by simp
   8.521      also have "\<dots> \<longleftrightarrow> ?a*?s -  (1 + 1)*?d *?r < 0" 
   8.522        using nonzero_mult_divide_cancel_left[OF d'] d order_less_not_sym[OF d''] less_imp_neq[OF d''] d''
   8.523 -        by (simp add: ring_simps diff_divide_distrib del:  left_distrib)
   8.524 +        by (simp add: algebra_simps diff_divide_distrib del:  left_distrib)
   8.525      finally have ?thesis using c d nc nd 
   8.526 -      apply(simp add: r[of "- (?s / ((1 + 1)*?d))"] msubstlt_def Let_def evaldjf_ex ring_simps lt polyneg_norm polymul_norm)
   8.527 +      apply(simp add: r[of "- (?s / ((1 + 1)*?d))"] msubstlt_def Let_def evaldjf_ex field_simps lt polyneg_norm polymul_norm)
   8.528        apply (simp only: one_add_one_is_two[symmetric] of_int_add)
   8.529        using d order_less_not_sym[OF d] less_imp_neq[OF d]
   8.530 -      by (simp add: ring_simps )    }
   8.531 +      by (simp add: field_simps )    }
   8.532  ultimately show ?thesis by blast
   8.533  qed
   8.534  
   8.535 @@ -2325,7 +2325,7 @@
   8.536      from dc' have dc'': "\<not> (1 + 1)*?c *?d < 0" by simp
   8.537      from add_frac_eq[OF c d, of "- ?t" "- ?s"]
   8.538      have th: "(- ?t / ?c + - ?s / ?d)/(1 + 1) = - (?d * ?t + ?c* ?s )/ ((1 + 1)*?c*?d)" 
   8.539 -      by (simp add: ring_simps)
   8.540 +      by (simp add: field_simps)
   8.541      have "?rhs \<longleftrightarrow> Ifm vs (- (?d * ?t + ?c* ?s )/ ((1 + 1)*?c*?d) # bs) (Le (CNP 0 a r))" by (simp only: th)
   8.542      also have "\<dots> \<longleftrightarrow> ?a * (- (?d * ?t + ?c* ?s )/ ((1 + 1)*?c*?d)) + ?r <= 0" 
   8.543        by (simp add: r[of "(- (?d * ?t) + - (?c *?s)) / ((1 + 1) * ?c * ?d)"])
   8.544 @@ -2334,11 +2334,11 @@
   8.545        using dc' dc'' mult_le_cancel_left[of "(1 + 1) * ?c * ?d" "?a * (- (?d * ?t + ?c* ?s)/ ((1 + 1)*?c*?d)) + ?r" 0] by simp
   8.546      also have "\<dots> \<longleftrightarrow> ?a * (- (?d * ?t + ?c* ?s )) + (1 + 1)*?c*?d*?r <= 0" 
   8.547        using nonzero_mult_divide_cancel_left[of "(1 + 1)*?c*?d"] c d
   8.548 -      by (simp add: ring_simps diff_divide_distrib del: left_distrib)
   8.549 +      by (simp add: algebra_simps diff_divide_distrib del: left_distrib)
   8.550      finally  have ?thesis using dc c d  nc nd dc'
   8.551 -      apply (simp add: r[of "(- (?d * ?t) + - (?c *?s)) / ((1 + 1) * ?c * ?d)"] msubstle_def Let_def evaldjf_ex ring_simps lt polyneg_norm polymul_norm) 
   8.552 +      apply (simp add: r[of "(- (?d * ?t) + - (?c *?s)) / ((1 + 1) * ?c * ?d)"] msubstle_def Let_def evaldjf_ex field_simps lt polyneg_norm polymul_norm) 
   8.553      apply (simp only: one_add_one_is_two[symmetric] of_int_add)
   8.554 -    by (simp add: ring_simps order_less_not_sym[OF dc])}
   8.555 +    by (simp add: field_simps order_less_not_sym[OF dc])}
   8.556    moreover
   8.557    {assume dc: "?c*?d < 0" 
   8.558  
   8.559 @@ -2347,7 +2347,7 @@
   8.560      hence c:"?c \<noteq> 0" and d: "?d\<noteq> 0" by auto
   8.561      from add_frac_eq[OF c d, of "- ?t" "- ?s"]
   8.562      have th: "(- ?t / ?c + - ?s / ?d)/(1 + 1) = - (?d * ?t + ?c* ?s )/ ((1 + 1)*?c*?d)" 
   8.563 -      by (simp add: ring_simps)
   8.564 +      by (simp add: field_simps)
   8.565      have "?rhs \<longleftrightarrow> Ifm vs (- (?d * ?t + ?c* ?s )/ ((1 + 1)*?c*?d) # bs) (Le (CNP 0 a r))" by (simp only: th)
   8.566      also have "\<dots> \<longleftrightarrow> ?a * (- (?d * ?t + ?c* ?s )/ ((1 + 1)*?c*?d)) + ?r <= 0" 
   8.567        by (simp add: r[of "(- (?d * ?t) + - (?c *?s)) / ((1 + 1) * ?c * ?d)"])
   8.568 @@ -2357,78 +2357,78 @@
   8.569        using dc' order_less_not_sym[OF dc'] mult_le_cancel_left[of "(1 + 1) * ?c * ?d" 0 "?a * (- (?d * ?t + ?c* ?s)/ ((1 + 1)*?c*?d)) + ?r"] by simp
   8.570      also have "\<dots> \<longleftrightarrow> ?a * ((?d * ?t + ?c* ?s )) - (1 + 1)*?c*?d*?r <= 0" 
   8.571        using nonzero_mult_divide_cancel_left[of "(1 + 1)*?c*?d"] c d
   8.572 -      by (simp add: ring_simps diff_divide_distrib del: left_distrib)
   8.573 +      by (simp add: algebra_simps diff_divide_distrib del: left_distrib)
   8.574      finally  have ?thesis using dc c d  nc nd
   8.575 -      apply (simp add: r[of "(- (?d * ?t) + - (?c *?s)) / ((1 + 1) * ?c * ?d)"] msubstle_def Let_def evaldjf_ex ring_simps lt polyneg_norm polymul_norm) 
   8.576 +      apply (simp add: r[of "(- (?d * ?t) + - (?c *?s)) / ((1 + 1) * ?c * ?d)"] msubstle_def Let_def evaldjf_ex field_simps lt polyneg_norm polymul_norm) 
   8.577        apply (simp only: one_add_one_is_two[symmetric] of_int_add)
   8.578 -      by (simp add: ring_simps order_less_not_sym[OF dc]) }
   8.579 +      by (simp add: field_simps order_less_not_sym[OF dc]) }
   8.580    moreover
   8.581    {assume c: "?c > 0" and d: "?d=0"  
   8.582      from c have c'': "(1 + 1)*?c > 0" by (simp add: zero_less_mult_iff)
   8.583      from c have c': "(1 + 1)*?c \<noteq> 0" by simp
   8.584 -    from d have th: "(- ?t / ?c + - ?s / ?d)/(1 + 1) = - ?t / ((1 + 1)*?c)"  by (simp add: ring_simps)
   8.585 +    from d have th: "(- ?t / ?c + - ?s / ?d)/(1 + 1) = - ?t / ((1 + 1)*?c)"  by (simp add: field_simps)
   8.586      have "?rhs \<longleftrightarrow> Ifm vs (- ?t / ((1 + 1)*?c) # bs) (Le (CNP 0 a r))" by (simp only: th)
   8.587      also have "\<dots> \<longleftrightarrow> ?a* (- ?t / ((1 + 1)*?c))+ ?r <= 0" by (simp add: r[of "- (?t / ((1 + 1)*?c))"])
   8.588      also have "\<dots> \<longleftrightarrow> (1 + 1)*?c * (?a* (- ?t / ((1 + 1)*?c))+ ?r) <= 0"
   8.589        using c mult_le_cancel_left[of "(1 + 1) * ?c" "?a* (- ?t / ((1 + 1)*?c))+ ?r" 0] c' c'' order_less_not_sym[OF c''] by simp
   8.590      also have "\<dots> \<longleftrightarrow> - ?a*?t+  (1 + 1)*?c *?r <= 0" 
   8.591        using nonzero_mult_divide_cancel_left[OF c'] c
   8.592 -      by (simp add: ring_simps diff_divide_distrib less_le del: left_distrib)
   8.593 +      by (simp add: algebra_simps diff_divide_distrib less_le del: left_distrib)
   8.594      finally have ?thesis using c d nc nd 
   8.595 -      apply(simp add: r[of "- (?t / ((1 + 1)*?c))"] msubstle_def Let_def evaldjf_ex ring_simps lt polyneg_norm polymul_norm)
   8.596 +      apply(simp add: r[of "- (?t / ((1 + 1)*?c))"] msubstle_def Let_def evaldjf_ex field_simps lt polyneg_norm polymul_norm)
   8.597        apply (simp only: one_add_one_is_two[symmetric] of_int_add)
   8.598        using c order_less_not_sym[OF c] less_imp_neq[OF c]
   8.599 -      by (simp add: ring_simps )  }
   8.600 +      by (simp add: field_simps )  }
   8.601    moreover
   8.602    {assume c: "?c < 0" and d: "?d=0"  hence c': "(1 + 1)*?c \<noteq> 0" by simp
   8.603      from c have c'': "(1 + 1)*?c < 0" by (simp add: mult_less_0_iff)
   8.604 -    from d have th: "(- ?t / ?c + - ?s / ?d)/(1 + 1) = - ?t / ((1 + 1)*?c)"  by (simp add: ring_simps)
   8.605 +    from d have th: "(- ?t / ?c + - ?s / ?d)/(1 + 1) = - ?t / ((1 + 1)*?c)"  by (simp add: field_simps)
   8.606      have "?rhs \<longleftrightarrow> Ifm vs (- ?t / ((1 + 1)*?c) # bs) (Le (CNP 0 a r))" by (simp only: th)
   8.607      also have "\<dots> \<longleftrightarrow> ?a* (- ?t / ((1 + 1)*?c))+ ?r <= 0" by (simp add: r[of "- (?t / ((1 + 1)*?c))"])
   8.608      also have "\<dots> \<longleftrightarrow> (1 + 1)*?c * (?a* (- ?t / ((1 + 1)*?c))+ ?r) >= 0"
   8.609        using c order_less_not_sym[OF c''] less_imp_neq[OF c''] c'' mult_le_cancel_left[of "(1 + 1) * ?c" 0 "?a* (- ?t / ((1 + 1)*?c))+ ?r"] by simp
   8.610      also have "\<dots> \<longleftrightarrow> ?a*?t -  (1 + 1)*?c *?r <= 0" 
   8.611        using nonzero_mult_divide_cancel_left[OF c'] c order_less_not_sym[OF c''] less_imp_neq[OF c''] c''
   8.612 -        by (simp add: ring_simps diff_divide_distrib del:  left_distrib)
   8.613 +        by (simp add: algebra_simps diff_divide_distrib del:  left_distrib)
   8.614      finally have ?thesis using c d nc nd 
   8.615 -      apply(simp add: r[of "- (?t / ((1 + 1)*?c))"] msubstle_def Let_def evaldjf_ex ring_simps lt polyneg_norm polymul_norm)
   8.616 +      apply(simp add: r[of "- (?t / ((1 + 1)*?c))"] msubstle_def Let_def evaldjf_ex field_simps lt polyneg_norm polymul_norm)
   8.617        apply (simp only: one_add_one_is_two[symmetric] of_int_add)
   8.618        using c order_less_not_sym[OF c] less_imp_neq[OF c]
   8.619 -      by (simp add: ring_simps )    }
   8.620 +      by (simp add: field_simps )    }
   8.621    moreover
   8.622    moreover
   8.623    {assume c: "?c = 0" and d: "?d>0"  
   8.624      from d have d'': "(1 + 1)*?d > 0" by (simp add: zero_less_mult_iff)
   8.625      from d have d': "(1 + 1)*?d \<noteq> 0" by simp
   8.626 -    from c have th: "(- ?t / ?c + - ?s / ?d)/(1 + 1) = - ?s / ((1 + 1)*?d)"  by (simp add: ring_simps)
   8.627 +    from c have th: "(- ?t / ?c + - ?s / ?d)/(1 + 1) = - ?s / ((1 + 1)*?d)"  by (simp add: field_simps)
   8.628      have "?rhs \<longleftrightarrow> Ifm vs (- ?s / ((1 + 1)*?d) # bs) (Le (CNP 0 a r))" by (simp only: th)
   8.629      also have "\<dots> \<longleftrightarrow> ?a* (- ?s / ((1 + 1)*?d))+ ?r <= 0" by (simp add: r[of "- (?s / ((1 + 1)*?d))"])
   8.630      also have "\<dots> \<longleftrightarrow> (1 + 1)*?d * (?a* (- ?s / ((1 + 1)*?d))+ ?r) <= 0"
   8.631        using d mult_le_cancel_left[of "(1 + 1) * ?d" "?a* (- ?s / ((1 + 1)*?d))+ ?r" 0] d' d'' order_less_not_sym[OF d''] by simp
   8.632      also have "\<dots> \<longleftrightarrow> - ?a*?s+  (1 + 1)*?d *?r <= 0" 
   8.633        using nonzero_mult_divide_cancel_left[OF d'] d
   8.634 -      by (simp add: ring_simps diff_divide_distrib less_le del: left_distrib)
   8.635 +      by (simp add: algebra_simps diff_divide_distrib less_le del: left_distrib)
   8.636      finally have ?thesis using c d nc nd 
   8.637 -      apply(simp add: r[of "- (?s / ((1 + 1)*?d))"] msubstle_def Let_def evaldjf_ex ring_simps lt polyneg_norm polymul_norm)
   8.638 +      apply(simp add: r[of "- (?s / ((1 + 1)*?d))"] msubstle_def Let_def evaldjf_ex field_simps lt polyneg_norm polymul_norm)
   8.639        apply (simp only: one_add_one_is_two[symmetric] of_int_add)
   8.640        using d order_less_not_sym[OF d] less_imp_neq[OF d]
   8.641 -      by (simp add: ring_simps )  }
   8.642 +      by (simp add: field_simps )  }
   8.643    moreover
   8.644    {assume c: "?c = 0" and d: "?d<0"  hence d': "(1 + 1)*?d \<noteq> 0" by simp
   8.645      from d have d'': "(1 + 1)*?d < 0" by (simp add: mult_less_0_iff)
   8.646 -    from c have th: "(- ?t / ?c + - ?s / ?d)/(1 + 1) = - ?s / ((1 + 1)*?d)"  by (simp add: ring_simps)
   8.647 +    from c have th: "(- ?t / ?c + - ?s / ?d)/(1 + 1) = - ?s / ((1 + 1)*?d)"  by (simp add: field_simps)
   8.648      have "?rhs \<longleftrightarrow> Ifm vs (- ?s / ((1 + 1)*?d) # bs) (Le (CNP 0 a r))" by (simp only: th)
   8.649      also have "\<dots> \<longleftrightarrow> ?a* (- ?s / ((1 + 1)*?d))+ ?r <= 0" by (simp add: r[of "- (?s / ((1 + 1)*?d))"])
   8.650      also have "\<dots> \<longleftrightarrow> (1 + 1)*?d * (?a* (- ?s / ((1 + 1)*?d))+ ?r) >= 0"
   8.651        using d order_less_not_sym[OF d''] less_imp_neq[OF d''] d'' mult_le_cancel_left[of "(1 + 1) * ?d" 0 "?a* (- ?s / ((1 + 1)*?d))+ ?r"] by simp
   8.652      also have "\<dots> \<longleftrightarrow> ?a*?s -  (1 + 1)*?d *?r <= 0" 
   8.653        using nonzero_mult_divide_cancel_left[OF d'] d order_less_not_sym[OF d''] less_imp_neq[OF d''] d''
   8.654 -        by (simp add: ring_simps diff_divide_distrib del:  left_distrib)
   8.655 +        by (simp add: algebra_simps diff_divide_distrib del:  left_distrib)
   8.656      finally have ?thesis using c d nc nd 
   8.657 -      apply(simp add: r[of "- (?s / ((1 + 1)*?d))"] msubstle_def Let_def evaldjf_ex ring_simps lt polyneg_norm polymul_norm)
   8.658 +      apply(simp add: r[of "- (?s / ((1 + 1)*?d))"] msubstle_def Let_def evaldjf_ex field_simps lt polyneg_norm polymul_norm)
   8.659        apply (simp only: one_add_one_is_two[symmetric] of_int_add)
   8.660        using d order_less_not_sym[OF d] less_imp_neq[OF d]
   8.661 -      by (simp add: ring_simps )    }
   8.662 +      by (simp add: field_simps )    }
   8.663  ultimately show ?thesis by blast
   8.664  qed
   8.665  
   8.666 @@ -2519,7 +2519,7 @@
   8.667  lemma remdps_set[simp]: "set (remdps xs) = set xs"
   8.668    by (induct xs rule: remdps.induct, auto)
   8.669  
   8.670 -lemma simpfm_lin:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
   8.671 +lemma simpfm_lin:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero,field})"
   8.672    shows "qfree p \<Longrightarrow> islin (simpfm p)"
   8.673    by (induct p rule: simpfm.induct, auto simp add: conj_lin disj_lin)
   8.674  
   8.675 @@ -2551,7 +2551,7 @@
   8.676    {fix c t d s assume ctU: "(c,t) \<in> set ?U" and dsU: "(d,s) \<in> set ?U"
   8.677      from U_l ctU dsU have norm: "isnpoly c" "isnpoly d" by auto
   8.678      from msubst_I[OF lq norm, of vs x bs t s] msubst_I[OF lq norm(2,1), of vs x bs s t]
   8.679 -    have "?I (msubst ?q ((c,t),(d,s))) = ?I (msubst ?q ((d,s),(c,t)))" by (simp add: ring_simps)}
   8.680 +    have "?I (msubst ?q ((c,t),(d,s))) = ?I (msubst ?q ((d,s),(c,t)))" by (simp add: field_simps)}
   8.681    hence th0: "\<forall>x \<in> set ?U. \<forall>y \<in> set ?U. ?I (msubst ?q (x, y)) \<longleftrightarrow> ?I (msubst ?q (y, x))" by clarsimp
   8.682    {fix x assume xUp: "x \<in> set ?Up" 
   8.683      then  obtain c t d s where ctU: "(c,t) \<in> set ?U" and dsU: "(d,s) \<in> set ?U" 
   8.684 @@ -2616,7 +2616,7 @@
   8.685      let ?s = "Itm vs (x # bs) s"
   8.686      let ?t = "Itm vs (x # bs) t"
   8.687      have eq2: "\<And>(x::'a). x + x = (1 + 1) * x"
   8.688 -      by  (simp add: ring_simps)
   8.689 +      by  (simp add: field_simps)
   8.690      {assume "?c = 0 \<and> ?d = 0"
   8.691        with ct have ?D by simp}
   8.692      moreover
   8.693 @@ -2747,12 +2747,12 @@
   8.694  using lp tnb
   8.695  by (induct p c t rule: msubstpos.induct, auto simp add: msubsteq2_nb msubstltpos_nb msubstlepos_nb)
   8.696  
   8.697 -lemma msubstneg_nb: assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})" and lp: "islin p" and tnb: "tmbound0 t"
   8.698 +lemma msubstneg_nb: assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero,field})" and lp: "islin p" and tnb: "tmbound0 t"
   8.699    shows "bound0 (msubstneg p c t)"
   8.700  using lp tnb
   8.701  by (induct p c t rule: msubstneg.induct, auto simp add: msubsteq2_nb msubstltneg_nb msubstleneg_nb)
   8.702  
   8.703 -lemma msubst2_nb: assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})" and lp: "islin p" and tnb: "tmbound0 t"
   8.704 +lemma msubst2_nb: assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero,field})" and lp: "islin p" and tnb: "tmbound0 t"
   8.705    shows "bound0 (msubst2 p c t)"
   8.706  using lp tnb
   8.707  by (simp add: msubst2_def msubstneg_nb msubstpos_nb conj_nb disj_nb lt_nb simpfm_bound0)
   8.708 @@ -2899,14 +2899,14 @@
   8.709          by (auto simp add: msubst2_def lt[OF stupid(3)] lt[OF stupid(1)] mult_less_0_iff zero_less_mult_iff)
   8.710        from msubst2[OF lq norm2(1) z(1), of x bs] 
   8.711          msubst2[OF lq norm2(2) z(2), of x bs] H 
   8.712 -      show ?rhs by (simp add: ring_simps)
   8.713 +      show ?rhs by (simp add: field_simps)
   8.714      next
   8.715        assume H: ?rhs
   8.716        hence z: "\<lparr>C (-2, 1) *\<^sub>p b *\<^sub>p d\<rparr>\<^sub>p\<^bsup>vs\<^esup> \<noteq> 0" "\<lparr>C (-2, 1) *\<^sub>p d *\<^sub>p b\<rparr>\<^sub>p\<^bsup>vs\<^esup> \<noteq> 0" 
   8.717          by (auto simp add: msubst2_def lt[OF stupid(4)] lt[OF stupid(2)] mult_less_0_iff zero_less_mult_iff)
   8.718        from msubst2[OF lq norm2(1) z(1), of x bs] 
   8.719          msubst2[OF lq norm2(2) z(2), of x bs] H 
   8.720 -      show ?lhs by (simp add: ring_simps)
   8.721 +      show ?lhs by (simp add: field_simps)
   8.722      qed}
   8.723    hence th0: "\<forall>x \<in> set ?U. \<forall>y \<in> set ?U. ?I (?s (x, y)) \<longleftrightarrow> ?I (?s (y, x))"
   8.724      by clarsimp
   8.725 @@ -3156,54 +3156,54 @@
   8.726  *} "Parametric QE for linear Arithmetic over fields, Version 2"
   8.727  
   8.728  
   8.729 -lemma "\<exists>(x::'a::{division_by_zero,linordered_field,number_ring}). y \<noteq> -1 \<longrightarrow> (y + 1)*x < 0"
   8.730 -  apply (frpar type: "'a::{division_by_zero,linordered_field,number_ring}" pars: "y::'a::{division_by_zero,linordered_field,number_ring}")
   8.731 -  apply (simp add: ring_simps)
   8.732 +lemma "\<exists>(x::'a::{linordered_field, division_ring_inverse_zero, number_ring}). y \<noteq> -1 \<longrightarrow> (y + 1)*x < 0"
   8.733 +  apply (frpar type: "'a::{linordered_field, division_ring_inverse_zero, number_ring}" pars: "y::'a::{linordered_field, division_ring_inverse_zero, number_ring}")
   8.734 +  apply (simp add: field_simps)
   8.735    apply (rule spec[where x=y])
   8.736 -  apply (frpar type: "'a::{division_by_zero,linordered_field,number_ring}" pars: "z::'a::{division_by_zero,linordered_field,number_ring}")
   8.737 +  apply (frpar type: "'a::{linordered_field, division_ring_inverse_zero, number_ring}" pars: "z::'a::{linordered_field, division_ring_inverse_zero, number_ring}")
   8.738    by simp
   8.739  
   8.740  text{* Collins/Jones Problem *}
   8.741  (*
   8.742 -lemma "\<exists>(r::'a::{division_by_zero,linordered_field,number_ring}). 0 < r \<and> r < 1 \<and> 0 < (2 - 3*r) *(a^2 + b^2) + (2*a)*r \<and> (2 - 3*r) *(a^2 + b^2) + 4*a*r - 2*a - r < 0"
   8.743 +lemma "\<exists>(r::'a::{linordered_field, division_ring_inverse_zero, number_ring}). 0 < r \<and> r < 1 \<and> 0 < (2 - 3*r) *(a^2 + b^2) + (2*a)*r \<and> (2 - 3*r) *(a^2 + b^2) + 4*a*r - 2*a - r < 0"
   8.744  proof-
   8.745 -  have "(\<exists>(r::'a::{division_by_zero,linordered_field,number_ring}). 0 < r \<and> r < 1 \<and> 0 < (2 - 3*r) *(a^2 + b^2) + (2*a)*r \<and> (2 - 3*r) *(a^2 + b^2) + 4*a*r - 2*a - r < 0) \<longleftrightarrow> (\<exists>(r::'a::{division_by_zero,linordered_field,number_ring}). 0 < r \<and> r < 1 \<and> 0 < 2 *(a^2 + b^2) - (3*(a^2 + b^2)) * r + (2*a)*r \<and> 2*(a^2 + b^2) - (3*(a^2 + b^2) - 4*a + 1)*r - 2*a < 0)" (is "?lhs \<longleftrightarrow> ?rhs")
   8.746 -by (simp add: ring_simps)
   8.747 +  have "(\<exists>(r::'a::{linordered_field, division_ring_inverse_zero, number_ring}). 0 < r \<and> r < 1 \<and> 0 < (2 - 3*r) *(a^2 + b^2) + (2*a)*r \<and> (2 - 3*r) *(a^2 + b^2) + 4*a*r - 2*a - r < 0) \<longleftrightarrow> (\<exists>(r::'a::{linordered_field, division_ring_inverse_zero, number_ring}). 0 < r \<and> r < 1 \<and> 0 < 2 *(a^2 + b^2) - (3*(a^2 + b^2)) * r + (2*a)*r \<and> 2*(a^2 + b^2) - (3*(a^2 + b^2) - 4*a + 1)*r - 2*a < 0)" (is "?lhs \<longleftrightarrow> ?rhs")
   8.748 +by (simp add: field_simps)
   8.749  have "?rhs"
   8.750  
   8.751 -  apply (frpar type: "'a::{division_by_zero,linordered_field,number_ring}" pars: "a::'a::{division_by_zero,linordered_field,number_ring}" "b::'a::{division_by_zero,linordered_field,number_ring}")
   8.752 -  apply (simp add: ring_simps)
   8.753 +  apply (frpar type: "'a::{linordered_field, division_ring_inverse_zero, number_ring}" pars: "a::'a::{linordered_field, division_ring_inverse_zero, number_ring}" "b::'a::{linordered_field, division_ring_inverse_zero, number_ring}")
   8.754 +  apply (simp add: field_simps)
   8.755  oops
   8.756  *)
   8.757  (*
   8.758 -lemma "ALL (x::'a::{division_by_zero,linordered_field,number_ring}) y. (1 - t)*x \<le> (1+t)*y \<and> (1 - t)*y \<le> (1+t)*x --> 0 \<le> y"
   8.759 -apply (frpar type: "'a::{division_by_zero,linordered_field,number_ring}" pars: "t::'a::{division_by_zero,linordered_field,number_ring}")
   8.760 +lemma "ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y. (1 - t)*x \<le> (1+t)*y \<and> (1 - t)*y \<le> (1+t)*x --> 0 \<le> y"
   8.761 +apply (frpar type: "'a::{linordered_field, division_ring_inverse_zero, number_ring}" pars: "t::'a::{linordered_field, division_ring_inverse_zero, number_ring}")
   8.762  oops
   8.763  *)
   8.764  
   8.765 -lemma "\<exists>(x::'a::{division_by_zero,linordered_field,number_ring}). y \<noteq> -1 \<longrightarrow> (y + 1)*x < 0"
   8.766 -  apply (frpar2 type: "'a::{division_by_zero,linordered_field,number_ring}" pars: "y::'a::{division_by_zero,linordered_field,number_ring}")
   8.767 -  apply (simp add: ring_simps)
   8.768 +lemma "\<exists>(x::'a::{linordered_field, division_ring_inverse_zero, number_ring}). y \<noteq> -1 \<longrightarrow> (y + 1)*x < 0"
   8.769 +  apply (frpar2 type: "'a::{linordered_field, division_ring_inverse_zero, number_ring}" pars: "y::'a::{linordered_field, division_ring_inverse_zero, number_ring}")
   8.770 +  apply (simp add: field_simps)
   8.771    apply (rule spec[where x=y])
   8.772 -  apply (frpar2 type: "'a::{division_by_zero,linordered_field,number_ring}" pars: "z::'a::{division_by_zero,linordered_field,number_ring}")
   8.773 +  apply (frpar2 type: "'a::{linordered_field, division_ring_inverse_zero, number_ring}" pars: "z::'a::{linordered_field, division_ring_inverse_zero, number_ring}")
   8.774    by simp
   8.775  
   8.776  text{* Collins/Jones Problem *}
   8.777  
   8.778  (*
   8.779 -lemma "\<exists>(r::'a::{division_by_zero,linordered_field,number_ring}). 0 < r \<and> r < 1 \<and> 0 < (2 - 3*r) *(a^2 + b^2) + (2*a)*r \<and> (2 - 3*r) *(a^2 + b^2) + 4*a*r - 2*a - r < 0"
   8.780 +lemma "\<exists>(r::'a::{linordered_field, division_ring_inverse_zero, number_ring}). 0 < r \<and> r < 1 \<and> 0 < (2 - 3*r) *(a^2 + b^2) + (2*a)*r \<and> (2 - 3*r) *(a^2 + b^2) + 4*a*r - 2*a - r < 0"
   8.781  proof-
   8.782 -  have "(\<exists>(r::'a::{division_by_zero,linordered_field,number_ring}). 0 < r \<and> r < 1 \<and> 0 < (2 - 3*r) *(a^2 + b^2) + (2*a)*r \<and> (2 - 3*r) *(a^2 + b^2) + 4*a*r - 2*a - r < 0) \<longleftrightarrow> (\<exists>(r::'a::{division_by_zero,linordered_field,number_ring}). 0 < r \<and> r < 1 \<and> 0 < 2 *(a^2 + b^2) - (3*(a^2 + b^2)) * r + (2*a)*r \<and> 2*(a^2 + b^2) - (3*(a^2 + b^2) - 4*a + 1)*r - 2*a < 0)" (is "?lhs \<longleftrightarrow> ?rhs")
   8.783 -by (simp add: ring_simps)
   8.784 +  have "(\<exists>(r::'a::{linordered_field, division_ring_inverse_zero, number_ring}). 0 < r \<and> r < 1 \<and> 0 < (2 - 3*r) *(a^2 + b^2) + (2*a)*r \<and> (2 - 3*r) *(a^2 + b^2) + 4*a*r - 2*a - r < 0) \<longleftrightarrow> (\<exists>(r::'a::{linordered_field, division_ring_inverse_zero, number_ring}). 0 < r \<and> r < 1 \<and> 0 < 2 *(a^2 + b^2) - (3*(a^2 + b^2)) * r + (2*a)*r \<and> 2*(a^2 + b^2) - (3*(a^2 + b^2) - 4*a + 1)*r - 2*a < 0)" (is "?lhs \<longleftrightarrow> ?rhs")
   8.785 +by (simp add: field_simps)
   8.786  have "?rhs"
   8.787 -  apply (frpar2 type: "'a::{division_by_zero,linordered_field,number_ring}" pars: "a::'a::{division_by_zero,linordered_field,number_ring}" "b::'a::{division_by_zero,linordered_field,number_ring}")
   8.788 +  apply (frpar2 type: "'a::{linordered_field, division_ring_inverse_zero, number_ring}" pars: "a::'a::{linordered_field, division_ring_inverse_zero, number_ring}" "b::'a::{linordered_field, division_ring_inverse_zero, number_ring}")
   8.789    apply simp
   8.790  oops
   8.791  *)
   8.792  
   8.793  (*
   8.794 -lemma "ALL (x::'a::{division_by_zero,linordered_field,number_ring}) y. (1 - t)*x \<le> (1+t)*y \<and> (1 - t)*y \<le> (1+t)*x --> 0 \<le> y"
   8.795 -apply (frpar2 type: "'a::{division_by_zero,linordered_field,number_ring}" pars: "t::'a::{division_by_zero,linordered_field,number_ring}")
   8.796 +lemma "ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y. (1 - t)*x \<le> (1+t)*y \<and> (1 - t)*y \<le> (1+t)*x --> 0 \<le> y"
   8.797 +apply (frpar2 type: "'a::{linordered_field, division_ring_inverse_zero, number_ring}" pars: "t::'a::{linordered_field, division_ring_inverse_zero, number_ring}")
   8.798  apply (simp add: field_simps linorder_neq_iff[symmetric])
   8.799  apply ferrack
   8.800  oops
     9.1 --- a/src/HOL/Decision_Procs/Polynomial_List.thy	Mon Apr 26 09:37:46 2010 -0700
     9.2 +++ b/src/HOL/Decision_Procs/Polynomial_List.thy	Mon Apr 26 09:45:22 2010 -0700
     9.3 @@ -283,11 +283,11 @@
     9.4  apply (drule_tac x = "%m. if m = Suc n then a else i m" in spec, safe)
     9.5  apply (drule poly_mult_eq_zero_disj [THEN iffD1], safe)
     9.6  apply (drule_tac x = "Suc (length q)" in spec)
     9.7 -apply (auto simp add: ring_simps)
     9.8 +apply (auto simp add: field_simps)
     9.9  apply (drule_tac x = xa in spec)
    9.10 -apply (clarsimp simp add: ring_simps)
    9.11 +apply (clarsimp simp add: field_simps)
    9.12  apply (drule_tac x = m in spec)
    9.13 -apply (auto simp add:ring_simps)
    9.14 +apply (auto simp add:field_simps)
    9.15  done
    9.16  lemmas poly_roots_index_lemma1 = conjI [THEN poly_roots_index_lemma0, standard]
    9.17  
    9.18 @@ -327,7 +327,7 @@
    9.19  apply (drule_tac x = "a#i" in spec)
    9.20  apply (auto simp only: poly_mult List.list.size)
    9.21  apply (drule_tac x = xa in spec)
    9.22 -apply (clarsimp simp add: ring_simps)
    9.23 +apply (clarsimp simp add: field_simps)
    9.24  done
    9.25  
    9.26  lemmas poly_roots_index_lemma2 = conjI [THEN poly_roots_index_lemma, standard]
    9.27 @@ -413,7 +413,7 @@
    9.28  by (auto intro!: ext)
    9.29  
    9.30  lemma poly_add_minus_zero_iff: "(poly (p +++ -- q) = poly []) = (poly p = poly q)"
    9.31 -by (auto simp add: ring_simps poly_add poly_minus_def fun_eq poly_cmult)
    9.32 +by (auto simp add: field_simps poly_add poly_minus_def fun_eq poly_cmult)
    9.33  
    9.34  lemma poly_add_minus_mult_eq: "poly (p *** q +++ --(p *** r)) = poly (p *** (q +++ -- r))"
    9.35  by (auto simp add: poly_add poly_minus_def fun_eq poly_mult poly_cmult right_distrib)
    10.1 --- a/src/HOL/Decision_Procs/Reflected_Multivariate_Polynomial.thy	Mon Apr 26 09:37:46 2010 -0700
    10.2 +++ b/src/HOL/Decision_Procs/Reflected_Multivariate_Polynomial.thy	Mon Apr 26 09:45:22 2010 -0700
    10.3 @@ -230,7 +230,7 @@
    10.4  
    10.5  subsection{* Semantics of the polynomial representation *}
    10.6  
    10.7 -consts Ipoly :: "'a list \<Rightarrow> poly \<Rightarrow> 'a::{ring_char_0,power,division_by_zero,field}"
    10.8 +consts Ipoly :: "'a list \<Rightarrow> poly \<Rightarrow> 'a::{ring_char_0,power,division_ring_inverse_zero,field}"
    10.9  primrec
   10.10    "Ipoly bs (C c) = INum c"
   10.11    "Ipoly bs (Bound n) = bs!n"
   10.12 @@ -241,7 +241,7 @@
   10.13    "Ipoly bs (Pw t n) = (Ipoly bs t) ^ n"
   10.14    "Ipoly bs (CN c n p) = (Ipoly bs c) + (bs!n)*(Ipoly bs p)"
   10.15  abbreviation
   10.16 -  Ipoly_syntax :: "poly \<Rightarrow> 'a list \<Rightarrow>'a::{ring_char_0,power,division_by_zero,field}" ("\<lparr>_\<rparr>\<^sub>p\<^bsup>_\<^esup>")
   10.17 +  Ipoly_syntax :: "poly \<Rightarrow> 'a list \<Rightarrow>'a::{ring_char_0,power,division_ring_inverse_zero,field}" ("\<lparr>_\<rparr>\<^sub>p\<^bsup>_\<^esup>")
   10.18    where "\<lparr>p\<rparr>\<^sub>p\<^bsup>bs\<^esup> \<equiv> Ipoly bs p"
   10.19  
   10.20  lemma Ipoly_CInt: "Ipoly bs (C (i,1)) = of_int i" 
   10.21 @@ -322,7 +322,7 @@
   10.22  qed auto
   10.23  
   10.24  lemma polyadd[simp]: "Ipoly bs (polyadd (p,q)) = (Ipoly bs p) + (Ipoly bs q)"
   10.25 -by (induct p q rule: polyadd.induct, auto simp add: Let_def ring_simps right_distrib[symmetric] simp del: right_distrib)
   10.26 +by (induct p q rule: polyadd.induct, auto simp add: Let_def field_simps right_distrib[symmetric] simp del: right_distrib)
   10.27  
   10.28  lemma polyadd_norm: "\<lbrakk> isnpoly p ; isnpoly q\<rbrakk> \<Longrightarrow> isnpoly (polyadd(p,q))"
   10.29    using polyadd_normh[of "p" "0" "q" "0"] isnpoly_def by simp
   10.30 @@ -394,7 +394,7 @@
   10.31  qed simp_all
   10.32  
   10.33  lemma polymul_properties:
   10.34 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
   10.35 +  assumes "SORT_CONSTRAINT('a::{field, division_ring_inverse_zero, ring_char_0})"
   10.36    and np: "isnpolyh p n0" and nq: "isnpolyh q n1" and m: "m \<le> min n0 n1"
   10.37    shows "isnpolyh (p *\<^sub>p q) (min n0 n1)" 
   10.38    and "(p *\<^sub>p q = 0\<^sub>p) = (p = 0\<^sub>p \<or> q = 0\<^sub>p)" 
   10.39 @@ -565,22 +565,22 @@
   10.40  qed auto
   10.41  
   10.42  lemma polymul[simp]: "Ipoly bs (p *\<^sub>p q) = (Ipoly bs p) * (Ipoly bs q)"
   10.43 -by(induct p q rule: polymul.induct, auto simp add: ring_simps)
   10.44 +by(induct p q rule: polymul.induct, auto simp add: field_simps)
   10.45  
   10.46  lemma polymul_normh: 
   10.47 -    assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
   10.48 +    assumes "SORT_CONSTRAINT('a::{field, division_ring_inverse_zero, ring_char_0})"
   10.49    shows "\<lbrakk>isnpolyh p n0 ; isnpolyh q n1\<rbrakk> \<Longrightarrow> isnpolyh (p *\<^sub>p q) (min n0 n1)"
   10.50    using polymul_properties(1)  by blast
   10.51  lemma polymul_eq0_iff: 
   10.52 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
   10.53 +  assumes "SORT_CONSTRAINT('a::{field, division_ring_inverse_zero, ring_char_0})"
   10.54    shows "\<lbrakk> isnpolyh p n0 ; isnpolyh q n1\<rbrakk> \<Longrightarrow> (p *\<^sub>p q = 0\<^sub>p) = (p = 0\<^sub>p \<or> q = 0\<^sub>p) "
   10.55    using polymul_properties(2)  by blast
   10.56  lemma polymul_degreen:  
   10.57 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
   10.58 +  assumes "SORT_CONSTRAINT('a::{field, division_ring_inverse_zero, ring_char_0})"
   10.59    shows "\<lbrakk> isnpolyh p n0 ; isnpolyh q n1 ; m \<le> min n0 n1\<rbrakk> \<Longrightarrow> degreen (p *\<^sub>p q) m = (if (p = 0\<^sub>p \<or> q = 0\<^sub>p) then 0 else degreen p m + degreen q m)"
   10.60    using polymul_properties(3) by blast
   10.61  lemma polymul_norm:   
   10.62 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
   10.63 +  assumes "SORT_CONSTRAINT('a::{field, division_ring_inverse_zero, ring_char_0})"
   10.64    shows "\<lbrakk> isnpoly p; isnpoly q\<rbrakk> \<Longrightarrow> isnpoly (polymul (p,q))"
   10.65    using polymul_normh[of "p" "0" "q" "0"] isnpoly_def by simp
   10.66  
   10.67 @@ -591,7 +591,7 @@
   10.68    by (induct p arbitrary: n0, auto)
   10.69  
   10.70  lemma monic_eqI: assumes np: "isnpolyh p n0" 
   10.71 -  shows "INum (headconst p) * Ipoly bs (fst (monic p)) = (Ipoly bs p ::'a::{ring_char_0,power,division_by_zero,field})"
   10.72 +  shows "INum (headconst p) * Ipoly bs (fst (monic p)) = (Ipoly bs p ::'a::{ring_char_0,power,division_ring_inverse_zero,field})"
   10.73    unfolding monic_def Let_def
   10.74  proof(cases "headconst p = 0\<^sub>N", simp_all add: headconst_zero[OF np])
   10.75    let ?h = "headconst p"
   10.76 @@ -629,13 +629,13 @@
   10.77  
   10.78  lemma polysub_norm: "\<lbrakk> isnpoly p; isnpoly q\<rbrakk> \<Longrightarrow> isnpoly (polysub(p,q))"
   10.79    using polyadd_norm polyneg_norm by (simp add: polysub_def) 
   10.80 -lemma polysub_same_0[simp]:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
   10.81 +lemma polysub_same_0[simp]:   assumes "SORT_CONSTRAINT('a::{field, division_ring_inverse_zero, ring_char_0})"
   10.82    shows "isnpolyh p n0 \<Longrightarrow> polysub (p, p) = 0\<^sub>p"
   10.83  unfolding polysub_def split_def fst_conv snd_conv
   10.84  by (induct p arbitrary: n0,auto simp add: Let_def Nsub0[simplified Nsub_def])
   10.85  
   10.86  lemma polysub_0: 
   10.87 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
   10.88 +  assumes "SORT_CONSTRAINT('a::{field, division_ring_inverse_zero, ring_char_0})"
   10.89    shows "\<lbrakk> isnpolyh p n0 ; isnpolyh q n1\<rbrakk> \<Longrightarrow> (p -\<^sub>p q = 0\<^sub>p) = (p = q)"
   10.90    unfolding polysub_def split_def fst_conv snd_conv
   10.91    apply (induct p q arbitrary: n0 n1 rule:polyadd.induct, simp_all add: Nsub0[simplified Nsub_def])
   10.92 @@ -657,7 +657,7 @@
   10.93    done
   10.94  
   10.95  text{* polypow is a power function and preserves normal forms *}
   10.96 -lemma polypow[simp]: "Ipoly bs (polypow n p) = ((Ipoly bs p :: 'a::{ring_char_0,division_by_zero,field})) ^ n"
   10.97 +lemma polypow[simp]: "Ipoly bs (polypow n p) = ((Ipoly bs p :: 'a::{field, division_ring_inverse_zero, ring_char_0})) ^ n"
   10.98  proof(induct n rule: polypow.induct)
   10.99    case 1 thus ?case by simp
  10.100  next
  10.101 @@ -688,7 +688,7 @@
  10.102  qed
  10.103  
  10.104  lemma polypow_normh: 
  10.105 -    assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  10.106 +    assumes "SORT_CONSTRAINT('a::{field, division_ring_inverse_zero, ring_char_0})"
  10.107    shows "isnpolyh p n \<Longrightarrow> isnpolyh (polypow k p) n"
  10.108  proof (induct k arbitrary: n rule: polypow.induct)
  10.109    case (2 k n)
  10.110 @@ -701,17 +701,17 @@
  10.111  qed auto 
  10.112  
  10.113  lemma polypow_norm:   
  10.114 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  10.115 +  assumes "SORT_CONSTRAINT('a::{field, division_ring_inverse_zero, ring_char_0})"
  10.116    shows "isnpoly p \<Longrightarrow> isnpoly (polypow k p)"
  10.117    by (simp add: polypow_normh isnpoly_def)
  10.118  
  10.119  text{* Finally the whole normalization*}
  10.120  
  10.121 -lemma polynate[simp]: "Ipoly bs (polynate p) = (Ipoly bs p :: 'a ::{ring_char_0,division_by_zero,field})"
  10.122 +lemma polynate[simp]: "Ipoly bs (polynate p) = (Ipoly bs p :: 'a ::{field, division_ring_inverse_zero, ring_char_0})"
  10.123  by (induct p rule:polynate.induct, auto)
  10.124  
  10.125  lemma polynate_norm[simp]: 
  10.126 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  10.127 +  assumes "SORT_CONSTRAINT('a::{field, division_ring_inverse_zero, ring_char_0})"
  10.128    shows "isnpoly (polynate p)"
  10.129    by (induct p rule: polynate.induct, simp_all add: polyadd_norm polymul_norm polysub_norm polyneg_norm polypow_norm) (simp_all add: isnpoly_def)
  10.130  
  10.131 @@ -736,29 +736,29 @@
  10.132    shows "isnpolyh (funpow k f p) n"
  10.133    using f np by (induct k arbitrary: p, auto)
  10.134  
  10.135 -lemma funpow_shift1: "(Ipoly bs (funpow n shift1 p) :: 'a :: {ring_char_0,division_by_zero,field}) = Ipoly bs (Mul (Pw (Bound 0) n) p)"
  10.136 +lemma funpow_shift1: "(Ipoly bs (funpow n shift1 p) :: 'a :: {field, division_ring_inverse_zero, ring_char_0}) = Ipoly bs (Mul (Pw (Bound 0) n) p)"
  10.137    by (induct n arbitrary: p, simp_all add: shift1_isnpoly shift1 power_Suc )
  10.138  
  10.139  lemma shift1_isnpolyh: "isnpolyh p n0 \<Longrightarrow> p\<noteq> 0\<^sub>p \<Longrightarrow> isnpolyh (shift1 p) 0"
  10.140    using isnpolyh_mono[where n="n0" and n'="0" and p="p"] by (simp add: shift1_def)
  10.141  
  10.142  lemma funpow_shift1_1: 
  10.143 -  "(Ipoly bs (funpow n shift1 p) :: 'a :: {ring_char_0,division_by_zero,field}) = Ipoly bs (funpow n shift1 1\<^sub>p *\<^sub>p p)"
  10.144 +  "(Ipoly bs (funpow n shift1 p) :: 'a :: {field, division_ring_inverse_zero, ring_char_0}) = Ipoly bs (funpow n shift1 1\<^sub>p *\<^sub>p p)"
  10.145    by (simp add: funpow_shift1)
  10.146  
  10.147  lemma poly_cmul[simp]: "Ipoly bs (poly_cmul c p) = Ipoly bs (Mul (C c) p)"
  10.148 -by (induct p  arbitrary: n0 rule: poly_cmul.induct, auto simp add: ring_simps)
  10.149 +by (induct p  arbitrary: n0 rule: poly_cmul.induct, auto simp add: field_simps)
  10.150  
  10.151  lemma behead:
  10.152    assumes np: "isnpolyh p n"
  10.153 -  shows "Ipoly bs (Add (Mul (head p) (Pw (Bound 0) (degree p))) (behead p)) = (Ipoly bs p :: 'a :: {ring_char_0,division_by_zero,field})"
  10.154 +  shows "Ipoly bs (Add (Mul (head p) (Pw (Bound 0) (degree p))) (behead p)) = (Ipoly bs p :: 'a :: {field, division_ring_inverse_zero, ring_char_0})"
  10.155    using np
  10.156  proof (induct p arbitrary: n rule: behead.induct)
  10.157    case (1 c p n) hence pn: "isnpolyh p n" by simp
  10.158    from prems(2)[OF pn] 
  10.159    have th:"Ipoly bs (Add (Mul (head p) (Pw (Bound 0) (degree p))) (behead p)) = Ipoly bs p" . 
  10.160    then show ?case using "1.hyps" apply (simp add: Let_def,cases "behead p = 0\<^sub>p")
  10.161 -    by (simp_all add: th[symmetric] ring_simps power_Suc)
  10.162 +    by (simp_all add: th[symmetric] field_simps power_Suc)
  10.163  qed (auto simp add: Let_def)
  10.164  
  10.165  lemma behead_isnpolyh:
  10.166 @@ -981,7 +981,7 @@
  10.167    by (simp add: head_eq_headn0)
  10.168  
  10.169  lemma isnpolyh_zero_iff: 
  10.170 -  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})"
  10.171 +  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_ring_inverse_zero,field})"
  10.172    shows "p = 0\<^sub>p"
  10.173  using nq eq
  10.174  proof (induct "maxindex p" arbitrary: p n0 rule: less_induct)
  10.175 @@ -1033,7 +1033,7 @@
  10.176  
  10.177  lemma isnpolyh_unique:  
  10.178    assumes np:"isnpolyh p n0" and nq: "isnpolyh q n1"
  10.179 -  shows "(\<forall>bs. \<lparr>p\<rparr>\<^sub>p\<^bsup>bs\<^esup> = (\<lparr>q\<rparr>\<^sub>p\<^bsup>bs\<^esup> :: 'a::{ring_char_0,power,division_by_zero,field})) \<longleftrightarrow>  p = q"
  10.180 +  shows "(\<forall>bs. \<lparr>p\<rparr>\<^sub>p\<^bsup>bs\<^esup> = (\<lparr>q\<rparr>\<^sub>p\<^bsup>bs\<^esup> :: 'a::{ring_char_0,power,division_ring_inverse_zero,field})) \<longleftrightarrow>  p = q"
  10.181  proof(auto)
  10.182    assume H: "\<forall>bs. (\<lparr>p\<rparr>\<^sub>p\<^bsup>bs\<^esup> ::'a)= \<lparr>q\<rparr>\<^sub>p\<^bsup>bs\<^esup>"
  10.183    hence "\<forall>bs.\<lparr>p -\<^sub>p q\<rparr>\<^sub>p\<^bsup>bs\<^esup>= (0::'a)" by simp
  10.184 @@ -1046,50 +1046,50 @@
  10.185  
  10.186  text{* consequenses of unicity on the algorithms for polynomial normalization *}
  10.187  
  10.188 -lemma polyadd_commute:   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  10.189 +lemma polyadd_commute:   assumes "SORT_CONSTRAINT('a::{field, division_ring_inverse_zero, ring_char_0})"
  10.190    and np: "isnpolyh p n0" and nq: "isnpolyh q n1" shows "p +\<^sub>p q = q +\<^sub>p p"
  10.191    using isnpolyh_unique[OF polyadd_normh[OF np nq] polyadd_normh[OF nq np]] by simp
  10.192  
  10.193  lemma zero_normh: "isnpolyh 0\<^sub>p n" by simp
  10.194  lemma one_normh: "isnpolyh 1\<^sub>p n" by simp
  10.195  lemma polyadd_0[simp]: 
  10.196 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  10.197 +  assumes "SORT_CONSTRAINT('a::{field, division_ring_inverse_zero, ring_char_0})"
  10.198    and np: "isnpolyh p n0" shows "p +\<^sub>p 0\<^sub>p = p" and "0\<^sub>p +\<^sub>p p = p"
  10.199    using isnpolyh_unique[OF polyadd_normh[OF np zero_normh] np] 
  10.200      isnpolyh_unique[OF polyadd_normh[OF zero_normh np] np] by simp_all
  10.201  
  10.202  lemma polymul_1[simp]: 
  10.203 -    assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  10.204 +    assumes "SORT_CONSTRAINT('a::{field, division_ring_inverse_zero, ring_char_0})"
  10.205    and np: "isnpolyh p n0" shows "p *\<^sub>p 1\<^sub>p = p" and "1\<^sub>p *\<^sub>p p = p"
  10.206    using isnpolyh_unique[OF polymul_normh[OF np one_normh] np] 
  10.207      isnpolyh_unique[OF polymul_normh[OF one_normh np] np] by simp_all
  10.208  lemma polymul_0[simp]: 
  10.209 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  10.210 +  assumes "SORT_CONSTRAINT('a::{field, division_ring_inverse_zero, ring_char_0})"
  10.211    and np: "isnpolyh p n0" shows "p *\<^sub>p 0\<^sub>p = 0\<^sub>p" and "0\<^sub>p *\<^sub>p p = 0\<^sub>p"
  10.212    using isnpolyh_unique[OF polymul_normh[OF np zero_normh] zero_normh] 
  10.213      isnpolyh_unique[OF polymul_normh[OF zero_normh np] zero_normh] by simp_all
  10.214  
  10.215  lemma polymul_commute: 
  10.216 -    assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  10.217 +    assumes "SORT_CONSTRAINT('a::{field, division_ring_inverse_zero, ring_char_0})"
  10.218    and np:"isnpolyh p n0" and nq: "isnpolyh q n1"
  10.219    shows "p *\<^sub>p q = q *\<^sub>p p"
  10.220 -using isnpolyh_unique[OF polymul_normh[OF np nq] polymul_normh[OF nq np], where ?'a = "'a\<Colon>{ring_char_0,power,division_by_zero,field}"] by simp
  10.221 +using isnpolyh_unique[OF polymul_normh[OF np nq] polymul_normh[OF nq np], where ?'a = "'a\<Colon>{ring_char_0,power,division_ring_inverse_zero,field}"] by simp
  10.222  
  10.223  declare polyneg_polyneg[simp]
  10.224    
  10.225  lemma isnpolyh_polynate_id[simp]: 
  10.226 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  10.227 +  assumes "SORT_CONSTRAINT('a::{field, division_ring_inverse_zero, ring_char_0})"
  10.228    and np:"isnpolyh p n0" shows "polynate p = p"
  10.229 -  using isnpolyh_unique[where ?'a= "'a::{ring_char_0,division_by_zero,field}", OF polynate_norm[of p, unfolded isnpoly_def] np] polynate[where ?'a = "'a::{ring_char_0,division_by_zero,field}"] by simp
  10.230 +  using isnpolyh_unique[where ?'a= "'a::{field, division_ring_inverse_zero, ring_char_0}", OF polynate_norm[of p, unfolded isnpoly_def] np] polynate[where ?'a = "'a::{field, division_ring_inverse_zero, ring_char_0}"] by simp
  10.231  
  10.232  lemma polynate_idempotent[simp]: 
  10.233 -    assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  10.234 +    assumes "SORT_CONSTRAINT('a::{field, division_ring_inverse_zero, ring_char_0})"
  10.235    shows "polynate (polynate p) = polynate p"
  10.236    using isnpolyh_polynate_id[OF polynate_norm[of p, unfolded isnpoly_def]] .
  10.237  
  10.238  lemma poly_nate_polypoly': "poly_nate bs p = polypoly' bs (polynate p)"
  10.239    unfolding poly_nate_def polypoly'_def ..
  10.240 -lemma poly_nate_poly: shows "poly (poly_nate bs p) = (\<lambda>x:: 'a ::{ring_char_0,division_by_zero,field}. \<lparr>p\<rparr>\<^sub>p\<^bsup>x # bs\<^esup>)"
  10.241 +lemma poly_nate_poly: shows "poly (poly_nate bs p) = (\<lambda>x:: 'a ::{field, division_ring_inverse_zero, ring_char_0}. \<lparr>p\<rparr>\<^sub>p\<^bsup>x # bs\<^esup>)"
  10.242    using polypoly'_poly[OF polynate_norm[unfolded isnpoly_def], symmetric, of bs p]
  10.243    unfolding poly_nate_polypoly' by (auto intro: ext)
  10.244  
  10.245 @@ -1116,7 +1116,7 @@
  10.246  qed
  10.247  
  10.248  lemma degree_polysub_samehead: 
  10.249 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  10.250 +  assumes "SORT_CONSTRAINT('a::{field, division_ring_inverse_zero, ring_char_0})"
  10.251    and np: "isnpolyh p n0" and nq: "isnpolyh q n1" and h: "head p = head q" 
  10.252    and d: "degree p = degree q"
  10.253    shows "degree (p -\<^sub>p q) < degree p \<or> (p -\<^sub>p q = 0\<^sub>p)"
  10.254 @@ -1226,7 +1226,7 @@
  10.255  done
  10.256  
  10.257  lemma polymul_head_polyeq: 
  10.258 -   assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  10.259 +   assumes "SORT_CONSTRAINT('a::{field, division_ring_inverse_zero, ring_char_0})"
  10.260    shows "\<lbrakk>isnpolyh p n0; isnpolyh q n1 ; p \<noteq> 0\<^sub>p ; q \<noteq> 0\<^sub>p \<rbrakk> \<Longrightarrow> head (p *\<^sub>p q) = head p *\<^sub>p head q"
  10.261  proof (induct p q arbitrary: n0 n1 rule: polymul.induct)
  10.262    case (2 a b c' n' p' n0 n1)
  10.263 @@ -1300,7 +1300,7 @@
  10.264    by (induct p arbitrary: n0 rule: polyneg.induct, auto)
  10.265  
  10.266  lemma degree_polymul:
  10.267 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  10.268 +  assumes "SORT_CONSTRAINT('a::{field, division_ring_inverse_zero, ring_char_0})"
  10.269    and np: "isnpolyh p n0" and nq: "isnpolyh q n1"
  10.270    shows "degree (p *\<^sub>p q) \<le> degree p + degree q"
  10.271    using polymul_degreen[OF np nq, where m="0"]  degree_eq_degreen0 by simp
  10.272 @@ -1344,7 +1344,7 @@
  10.273  qed
  10.274  
  10.275  lemma polydivide_aux_properties:
  10.276 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  10.277 +  assumes "SORT_CONSTRAINT('a::{field, division_ring_inverse_zero, ring_char_0})"
  10.278    and np: "isnpolyh p n0" and ns: "isnpolyh s n1"
  10.279    and ap: "head p = a" and ndp: "degree p = n" and pnz: "p \<noteq> 0\<^sub>p"
  10.280    shows "polydivide_aux_dom (a,n,p,k,s) \<and> 
  10.281 @@ -1415,19 +1415,19 @@
  10.282              from polyadd_normh[OF polymul_normh[OF np 
  10.283                polyadd_normh[OF polymul_normh[OF nakk' nxdn] nq]] nr']
  10.284              have nqr': "isnpolyh (p *\<^sub>p (?akk' *\<^sub>p ?xdn +\<^sub>p q) +\<^sub>p r) 0" by simp 
  10.285 -            from asp have "\<forall> (bs:: 'a::{ring_char_0,division_by_zero,field} list). Ipoly bs (a^\<^sub>p (k' - k) *\<^sub>p (s -\<^sub>p ?p')) = 
  10.286 +            from asp have "\<forall> (bs:: 'a::{field, division_ring_inverse_zero, ring_char_0} list). Ipoly bs (a^\<^sub>p (k' - k) *\<^sub>p (s -\<^sub>p ?p')) = 
  10.287                Ipoly bs (p *\<^sub>p q +\<^sub>p r)" by simp
  10.288 -            hence " \<forall>(bs:: 'a::{ring_char_0,division_by_zero,field} list). Ipoly bs (a^\<^sub>p (k' - k)*\<^sub>p s) = 
  10.289 +            hence " \<forall>(bs:: 'a::{field, division_ring_inverse_zero, ring_char_0} list). Ipoly bs (a^\<^sub>p (k' - k)*\<^sub>p s) = 
  10.290                Ipoly bs (a^\<^sub>p (k' - k)) * Ipoly bs ?p' + Ipoly bs p * Ipoly bs q + Ipoly bs r" 
  10.291 -              by (simp add: ring_simps)
  10.292 -            hence " \<forall>(bs:: 'a::{ring_char_0,division_by_zero,field} list). Ipoly bs (a ^\<^sub>p (k' - k) *\<^sub>p s) = 
  10.293 +              by (simp add: field_simps)
  10.294 +            hence " \<forall>(bs:: 'a::{field, division_ring_inverse_zero, ring_char_0} list). Ipoly bs (a ^\<^sub>p (k' - k) *\<^sub>p s) = 
  10.295                Ipoly bs (a^\<^sub>p (k' - k)) * Ipoly bs (funpow (degree s - n) shift1 1\<^sub>p *\<^sub>p p) 
  10.296                + Ipoly bs p * Ipoly bs q + Ipoly bs r"
  10.297                by (auto simp only: funpow_shift1_1) 
  10.298 -            hence "\<forall>(bs:: 'a::{ring_char_0,division_by_zero,field} list). Ipoly bs (a ^\<^sub>p (k' - k) *\<^sub>p s) = 
  10.299 +            hence "\<forall>(bs:: 'a::{field, division_ring_inverse_zero, ring_char_0} list). Ipoly bs (a ^\<^sub>p (k' - k) *\<^sub>p s) = 
  10.300                Ipoly bs p * (Ipoly bs (a^\<^sub>p (k' - k)) * Ipoly bs (funpow (degree s - n) shift1 1\<^sub>p) 
  10.301 -              + Ipoly bs q) + Ipoly bs r" by (simp add: ring_simps)
  10.302 -            hence "\<forall>(bs:: 'a::{ring_char_0,division_by_zero,field} list). Ipoly bs (a ^\<^sub>p (k' - k) *\<^sub>p s) = 
  10.303 +              + Ipoly bs q) + Ipoly bs r" by (simp add: field_simps)
  10.304 +            hence "\<forall>(bs:: 'a::{field, division_ring_inverse_zero, ring_char_0} list). Ipoly bs (a ^\<^sub>p (k' - k) *\<^sub>p s) = 
  10.305                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
  10.306              with isnpolyh_unique[OF nakks' nqr']
  10.307              have "a ^\<^sub>p (k' - k) *\<^sub>p s = 
  10.308 @@ -1444,9 +1444,9 @@
  10.309              apply (simp) by (rule polydivide_aux_real_domintros, simp_all)
  10.310            have dom: ?dths apply (rule polydivide_aux_real_domintros) 
  10.311              using ba dn' domsp by simp_all
  10.312 -          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}"]
  10.313 -          have " \<forall>(bs:: 'a::{ring_char_0,division_by_zero,field} list). Ipoly bs s = Ipoly bs ?p'" by simp
  10.314 -          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
  10.315 +          from spz isnpolyh_unique[OF polysub_normh[OF ns np'], where q="0\<^sub>p", symmetric, where ?'a = "'a::{field, division_ring_inverse_zero, ring_char_0}"]
  10.316 +          have " \<forall>(bs:: 'a::{field, division_ring_inverse_zero, ring_char_0} list). Ipoly bs s = Ipoly bs ?p'" by simp
  10.317 +          hence "\<forall>(bs:: 'a::{field, division_ring_inverse_zero, ring_char_0} list). Ipoly bs s = Ipoly bs (?xdn *\<^sub>p p)" using np nxdn apply simp
  10.318              by (simp only: funpow_shift1_1) simp
  10.319            hence sp': "s = ?xdn *\<^sub>p p" using isnpolyh_unique[OF ns polymul_normh[OF nxdn np]] by blast
  10.320            {assume h1: "polydivide_aux (a,n,p,k,s) = (k',r)"
  10.321 @@ -1501,17 +1501,17 @@
  10.322                and dr: "degree r = 0 \<or> degree r < degree p"
  10.323                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
  10.324              from kk' have kk'':"Suc (k' - Suc k) = k' - k" by arith
  10.325 -            {fix bs:: "'a::{ring_char_0,division_by_zero,field} list"
  10.326 +            {fix bs:: "'a::{field, division_ring_inverse_zero, ring_char_0} list"
  10.327                
  10.328              from qr isnpolyh_unique[OF polypow_normh[OF head_isnpolyh[OF np], where k="k' - Suc k", simplified ap] nasbp', symmetric]
  10.329              have "Ipoly bs (a ^\<^sub>p (k' - Suc k) *\<^sub>p ((a *\<^sub>p s) -\<^sub>p (?b *\<^sub>p ?p'))) = Ipoly bs (p *\<^sub>p q +\<^sub>p r)" by simp
  10.330              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"
  10.331 -              by (simp add: ring_simps power_Suc)
  10.332 +              by (simp add: field_simps power_Suc)
  10.333              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"
  10.334                by (simp add:kk'' funpow_shift1_1[where n="degree s - n" and p="p"])
  10.335              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"
  10.336 -              by (simp add: ring_simps)}
  10.337 -            hence ieq:"\<forall>(bs :: 'a::{ring_char_0,division_by_zero,field} list). Ipoly bs (a ^\<^sub>p (k' - k) *\<^sub>p s) = 
  10.338 +              by (simp add: field_simps)}
  10.339 +            hence ieq:"\<forall>(bs :: 'a::{field, division_ring_inverse_zero, ring_char_0} list). Ipoly bs (a ^\<^sub>p (k' - k) *\<^sub>p s) = 
  10.340                Ipoly bs (p *\<^sub>p (q +\<^sub>p (a ^\<^sub>p (k' - Suc k) *\<^sub>p ?b *\<^sub>p ?xdn)) +\<^sub>p r)" by auto 
  10.341              let ?q = "q +\<^sub>p (a ^\<^sub>p (k' - Suc k) *\<^sub>p ?b *\<^sub>p ?xdn)"
  10.342              from polyadd_normh[OF nq polymul_normh[OF polymul_normh[OF polypow_normh[OF head_isnpolyh[OF np], where k="k' - Suc k"] head_isnpolyh[OF ns], simplified ap ] nxdn]]
  10.343 @@ -1532,17 +1532,17 @@
  10.344              apply (simp) by (rule polydivide_aux_real_domintros, simp_all)
  10.345            have dom: ?dths using sz ba dn' domsp 
  10.346              by - (rule polydivide_aux_real_domintros, simp_all)
  10.347 -          {fix bs :: "'a::{ring_char_0,division_by_zero,field} list"
  10.348 +          {fix bs :: "'a::{field, division_ring_inverse_zero, ring_char_0} list"
  10.349              from isnpolyh_unique[OF nth, where ?'a="'a" and q="0\<^sub>p",simplified,symmetric] spz
  10.350            have "Ipoly bs (a*\<^sub>p s) = Ipoly bs ?b * Ipoly bs ?p'" by simp
  10.351            hence "Ipoly bs (a*\<^sub>p s) = Ipoly bs (?b *\<^sub>p ?xdn) * Ipoly bs p" 
  10.352              by (simp add: funpow_shift1_1[where n="degree s - n" and p="p"])
  10.353            hence "Ipoly bs (a*\<^sub>p s) = Ipoly bs (p *\<^sub>p (?b *\<^sub>p ?xdn))" by simp
  10.354          }
  10.355 -        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))" ..
  10.356 +        hence hth: "\<forall> (bs:: 'a::{field, division_ring_inverse_zero, ring_char_0} list). Ipoly bs (a*\<^sub>p s) = Ipoly bs (p *\<^sub>p (?b *\<^sub>p ?xdn))" ..
  10.357            from hth
  10.358            have asq: "a *\<^sub>p s = p *\<^sub>p (?b *\<^sub>p ?xdn)" 
  10.359 -            using isnpolyh_unique[where ?'a = "'a::{ring_char_0,division_by_zero,field}", OF polymul_normh[OF head_isnpolyh[OF np] ns] 
  10.360 +            using isnpolyh_unique[where ?'a = "'a::{field, division_ring_inverse_zero, ring_char_0}", OF polymul_normh[OF head_isnpolyh[OF np] ns] 
  10.361                      polymul_normh[OF np polymul_normh[OF head_isnpolyh[OF ns] nxdn]],
  10.362                simplified ap] by simp
  10.363            {assume h1: "polydivide_aux (a,n,p,k,s) = (k', r)"
  10.364 @@ -1566,7 +1566,7 @@
  10.365  qed
  10.366  
  10.367  lemma polydivide_properties: 
  10.368 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  10.369 +  assumes "SORT_CONSTRAINT('a::{field, division_ring_inverse_zero, ring_char_0})"
  10.370    and np: "isnpolyh p n0" and ns: "isnpolyh s n1" and pnz: "p \<noteq> 0\<^sub>p"
  10.371    shows "(\<exists> k r. polydivide s p = (k,r) \<and> (\<exists>nr. isnpolyh r nr) \<and> (degree r = 0 \<or> degree r < degree p) 
  10.372    \<and> (\<exists>q n1. isnpolyh q n1 \<and> ((polypow k (head p)) *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)))"
  10.373 @@ -1698,11 +1698,11 @@
  10.374  definition "swapnorm n m t = polynate (swap n m t)"
  10.375  
  10.376  lemma swapnorm: assumes nbs: "n < length bs" and mbs: "m < length bs"
  10.377 -  shows "((Ipoly bs (swapnorm n m t) :: 'a\<Colon>{ring_char_0,division_by_zero,field})) = Ipoly ((bs[n:= bs!m])[m:= bs!n]) t"
  10.378 +  shows "((Ipoly bs (swapnorm n m t) :: 'a\<Colon>{field, division_ring_inverse_zero, ring_char_0})) = Ipoly ((bs[n:= bs!m])[m:= bs!n]) t"
  10.379    using swap[OF prems] swapnorm_def by simp
  10.380  
  10.381  lemma swapnorm_isnpoly[simp]: 
  10.382 -    assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  10.383 +    assumes "SORT_CONSTRAINT('a::{field, division_ring_inverse_zero, ring_char_0})"
  10.384    shows "isnpoly (swapnorm n m p)"
  10.385    unfolding swapnorm_def by simp
  10.386  
    11.1 --- a/src/HOL/Decision_Procs/ex/Dense_Linear_Order_Ex.thy	Mon Apr 26 09:37:46 2010 -0700
    11.2 +++ b/src/HOL/Decision_Procs/ex/Dense_Linear_Order_Ex.thy	Mon Apr 26 09:45:22 2010 -0700
    11.3 @@ -7,147 +7,147 @@
    11.4  begin
    11.5  
    11.6  lemma
    11.7 -  "\<exists>(y::'a::{linordered_field,number_ring, division_by_zero}) <2. x + 3* y < 0 \<and> x - y >0"
    11.8 +  "\<exists>(y::'a::{linordered_field, division_ring_inverse_zero, number_ring}) <2. x + 3* y < 0 \<and> x - y >0"
    11.9    by ferrack
   11.10  
   11.11 -lemma "~ (ALL x (y::'a::{linordered_field,number_ring, division_by_zero}). x < y --> 10*x < 11*y)"
   11.12 +lemma "~ (ALL x (y::'a::{linordered_field, division_ring_inverse_zero, number_ring}). x < y --> 10*x < 11*y)"
   11.13    by ferrack
   11.14  
   11.15 -lemma "ALL (x::'a::{linordered_field,number_ring, division_by_zero}) y. x < y --> (10*(x + 5*y + -1) < 60*y)"
   11.16 +lemma "ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y. x < y --> (10*(x + 5*y + -1) < 60*y)"
   11.17    by ferrack
   11.18  
   11.19 -lemma "EX (x::'a::{linordered_field,number_ring, division_by_zero}) y. x ~= y --> x < y"
   11.20 +lemma "EX (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y. x ~= y --> x < y"
   11.21    by ferrack
   11.22  
   11.23 -lemma "EX (x::'a::{linordered_field,number_ring, division_by_zero}) y. (x ~= y & 10*x ~= 9*y & 10*x < y) --> x < y"
   11.24 +lemma "EX (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y. (x ~= y & 10*x ~= 9*y & 10*x < y) --> x < y"
   11.25    by ferrack
   11.26  
   11.27 -lemma "ALL (x::'a::{linordered_field,number_ring, division_by_zero}) y. (x ~= y & 5*x <= y) --> 500*x <= 100*y"
   11.28 +lemma "ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y. (x ~= y & 5*x <= y) --> 500*x <= 100*y"
   11.29    by ferrack
   11.30  
   11.31 -lemma "ALL (x::'a::{linordered_field,number_ring, division_by_zero}). (EX (y::'a::{linordered_field,number_ring, division_by_zero}). 4*x + 3*y <= 0 & 4*x + 3*y >= -1)"
   11.32 +lemma "ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}). (EX (y::'a::{linordered_field, division_ring_inverse_zero, number_ring}). 4*x + 3*y <= 0 & 4*x + 3*y >= -1)"
   11.33    by ferrack
   11.34  
   11.35 -lemma "ALL (x::'a::{linordered_field,number_ring, division_by_zero}) < 0. (EX (y::'a::{linordered_field,number_ring, division_by_zero}) > 0. 7*x + y > 0 & x - y <= 9)"
   11.36 +lemma "ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) < 0. (EX (y::'a::{linordered_field, division_ring_inverse_zero, number_ring}) > 0. 7*x + y > 0 & x - y <= 9)"
   11.37    by ferrack
   11.38  
   11.39 -lemma "EX (x::'a::{linordered_field,number_ring, division_by_zero}). (0 < x & x < 1) --> (ALL y > 1. x + y ~= 1)"
   11.40 +lemma "EX (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}). (0 < x & x < 1) --> (ALL y > 1. x + y ~= 1)"
   11.41    by ferrack
   11.42  
   11.43 -lemma "EX x. (ALL (y::'a::{linordered_field,number_ring, division_by_zero}). y < 2 -->  2*(y - x) \<le> 0 )"
   11.44 +lemma "EX x. (ALL (y::'a::{linordered_field, division_ring_inverse_zero, number_ring}). y < 2 -->  2*(y - x) \<le> 0 )"
   11.45    by ferrack
   11.46  
   11.47 -lemma "ALL (x::'a::{linordered_field,number_ring, division_by_zero}). x < 10 | x > 20 | (EX y. y>= 0 & y <= 10 & x+y = 20)"
   11.48 +lemma "ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}). x < 10 | x > 20 | (EX y. y>= 0 & y <= 10 & x+y = 20)"
   11.49    by ferrack
   11.50  
   11.51 -lemma "ALL (x::'a::{linordered_field,number_ring, division_by_zero}) y z. x + y < z --> y >= z --> x < 0"
   11.52 +lemma "ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y z. x + y < z --> y >= z --> x < 0"
   11.53    by ferrack
   11.54  
   11.55 -lemma "EX (x::'a::{linordered_field,number_ring, division_by_zero}) y z. x + 7*y < 5* z & 5*y >= 7*z & x < 0"
   11.56 +lemma "EX (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y z. x + 7*y < 5* z & 5*y >= 7*z & x < 0"
   11.57    by ferrack
   11.58  
   11.59 -lemma "ALL (x::'a::{linordered_field,number_ring, division_by_zero}) y z. abs (x + y) <= z --> (abs z = z)"
   11.60 +lemma "ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y z. abs (x + y) <= z --> (abs z = z)"
   11.61    by ferrack
   11.62  
   11.63 -lemma "EX (x::'a::{linordered_field,number_ring, division_by_zero}) y z. x + 7*y - 5* z < 0 & 5*y + 7*z + 3*x < 0"
   11.64 +lemma "EX (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y z. x + 7*y - 5* z < 0 & 5*y + 7*z + 3*x < 0"
   11.65    by ferrack
   11.66  
   11.67 -lemma "ALL (x::'a::{linordered_field,number_ring, division_by_zero}) y z. (abs (5*x+3*y+z) <= 5*x+3*y+z & abs (5*x+3*y+z) >= - (5*x+3*y+z)) | (abs (5*x+3*y+z) >= 5*x+3*y+z & abs (5*x+3*y+z) <= - (5*x+3*y+z))"
   11.68 +lemma "ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y z. (abs (5*x+3*y+z) <= 5*x+3*y+z & abs (5*x+3*y+z) >= - (5*x+3*y+z)) | (abs (5*x+3*y+z) >= 5*x+3*y+z & abs (5*x+3*y+z) <= - (5*x+3*y+z))"
   11.69    by ferrack
   11.70  
   11.71 -lemma "ALL (x::'a::{linordered_field,number_ring, division_by_zero}) y. x < y --> (EX z>0. x+z = y)"
   11.72 +lemma "ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y. x < y --> (EX z>0. x+z = y)"
   11.73    by ferrack
   11.74  
   11.75 -lemma "ALL (x::'a::{linordered_field,number_ring, division_by_zero}) y. x < y --> (EX z>0. x+z = y)"
   11.76 +lemma "ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y. x < y --> (EX z>0. x+z = y)"
   11.77    by ferrack
   11.78  
   11.79 -lemma "ALL (x::'a::{linordered_field,number_ring, division_by_zero}) y. (EX z>0. abs (x - y) <= z )"
   11.80 +lemma "ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y. (EX z>0. abs (x - y) <= z )"
   11.81    by ferrack
   11.82  
   11.83 -lemma "EX (x::'a::{linordered_field,number_ring, division_by_zero}) y. (ALL z<0. (z < x --> z <= y) & (z > y --> z >= x))"
   11.84 +lemma "EX (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y. (ALL z<0. (z < x --> z <= y) & (z > y --> z >= x))"
   11.85    by ferrack
   11.86  
   11.87 -lemma "EX (x::'a::{linordered_field,number_ring, division_by_zero}) y. (ALL z>=0. abs (3*x+7*y) <= 2*z + 1)"
   11.88 +lemma "EX (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y. (ALL z>=0. abs (3*x+7*y) <= 2*z + 1)"
   11.89    by ferrack
   11.90  
   11.91 -lemma "EX (x::'a::{linordered_field,number_ring, division_by_zero}) y. (ALL z<0. (z < x --> z <= y) & (z > y --> z >= x))"
   11.92 +lemma "EX (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y. (ALL z<0. (z < x --> z <= y) & (z > y --> z >= x))"
   11.93    by ferrack
   11.94  
   11.95 -lemma "EX (x::'a::{linordered_field,number_ring, division_by_zero})>0. (ALL y. (EX z. 13* abs z \<noteq> abs (12*y - x) & 5*x - 3*(abs y) <= 7*z))"
   11.96 +lemma "EX (x::'a::{linordered_field, division_ring_inverse_zero, number_ring})>0. (ALL y. (EX z. 13* abs z \<noteq> abs (12*y - x) & 5*x - 3*(abs y) <= 7*z))"
   11.97    by ferrack
   11.98  
   11.99 -lemma "EX (x::'a::{linordered_field,number_ring, division_by_zero}). abs (4*x + 17) < 4 & (ALL y . abs (x*34 - 34*y - 9) \<noteq> 0 \<longrightarrow> (EX z. 5*x - 3*abs y <= 7*z))"
  11.100 +lemma "EX (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}). abs (4*x + 17) < 4 & (ALL y . abs (x*34 - 34*y - 9) \<noteq> 0 \<longrightarrow> (EX z. 5*x - 3*abs y <= 7*z))"
  11.101    by ferrack
  11.102  
  11.103 -lemma "ALL (x::'a::{linordered_field,number_ring, division_by_zero}). (EX y > abs (23*x - 9). (ALL z > abs (3*y - 19* abs x). x+z > 2*y))"
  11.104 +lemma "ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}). (EX y > abs (23*x - 9). (ALL z > abs (3*y - 19* abs x). x+z > 2*y))"
  11.105    by ferrack
  11.106  
  11.107 -lemma "ALL (x::'a::{linordered_field,number_ring, division_by_zero}). (EX y< abs (3*x - 1). (ALL z >= (3*abs x - 1). abs (12*x - 13*y + 19*z) > abs (23*x) ))"
  11.108 +lemma "ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}). (EX y< abs (3*x - 1). (ALL z >= (3*abs x - 1). abs (12*x - 13*y + 19*z) > abs (23*x) ))"
  11.109    by ferrack
  11.110  
  11.111 -lemma "EX (x::'a::{linordered_field,number_ring, division_by_zero}). abs x < 100 & (ALL y > x. (EX z<2*y - x. 5*x - 3*y <= 7*z))"
  11.112 +lemma "EX (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}). abs x < 100 & (ALL y > x. (EX z<2*y - x. 5*x - 3*y <= 7*z))"
  11.113    by ferrack
  11.114  
  11.115 -lemma "ALL (x::'a::{linordered_field,number_ring, division_by_zero}) y z w. 7*x<3*y --> 5*y < 7*z --> z < 2*w --> 7*(2*w-x) > 2*y"
  11.116 +lemma "ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y z w. 7*x<3*y --> 5*y < 7*z --> z < 2*w --> 7*(2*w-x) > 2*y"
  11.117    by ferrack
  11.118  
  11.119 -lemma "EX (x::'a::{linordered_field,number_ring, division_by_zero}) y z w. 5*x + 3*z - 17*w + abs (y - 8*x + z) <= 89"
  11.120 +lemma "EX (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y z w. 5*x + 3*z - 17*w + abs (y - 8*x + z) <= 89"
  11.121    by ferrack
  11.122  
  11.123 -lemma "EX (x::'a::{linordered_field,number_ring, division_by_zero}) y z w. 5*x + 3*z - 17*w + 7* (y - 8*x + z) <= max y (7*z - x + w)"
  11.124 +lemma "EX (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y z w. 5*x + 3*z - 17*w + 7* (y - 8*x + z) <= max y (7*z - x + w)"
  11.125    by ferrack
  11.126  
  11.127 -lemma "EX (x::'a::{linordered_field,number_ring, division_by_zero}) y z w. min (5*x + 3*z) (17*w) + 5* abs (y - 8*x + z) <= max y (7*z - x + w)"
  11.128 +lemma "EX (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y z w. min (5*x + 3*z) (17*w) + 5* abs (y - 8*x + z) <= max y (7*z - x + w)"
  11.129    by ferrack
  11.130  
  11.131 -lemma "ALL (x::'a::{linordered_field,number_ring, division_by_zero}) y z. (EX w >= (x+y+z). w <= abs x + abs y + abs z)"
  11.132 +lemma "ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y z. (EX w >= (x+y+z). w <= abs x + abs y + abs z)"
  11.133    by ferrack
  11.134  
  11.135 -lemma "~(ALL (x::'a::{linordered_field,number_ring, division_by_zero}). (EX y z w. 3* x + z*4 = 3*y & x + y < z & x> w & 3*x < w + y))"
  11.136 +lemma "~(ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}). (EX y z w. 3* x + z*4 = 3*y & x + y < z & x> w & 3*x < w + y))"
  11.137    by ferrack
  11.138  
  11.139 -lemma "ALL (x::'a::{linordered_field,number_ring, division_by_zero}) y. (EX z w. abs (x-y) = (z-w) & z*1234 < 233*x & w ~= y)"
  11.140 +lemma "ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y. (EX z w. abs (x-y) = (z-w) & z*1234 < 233*x & w ~= y)"
  11.141    by ferrack
  11.142  
  11.143 -lemma "ALL (x::'a::{linordered_field,number_ring, division_by_zero}). (EX y z w. min (5*x + 3*z) (17*w) + 5* abs (y - 8*x + z) <= max y (7*z - x + w))"
  11.144 +lemma "ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}). (EX y z w. min (5*x + 3*z) (17*w) + 5* abs (y - 8*x + z) <= max y (7*z - x + w))"
  11.145    by ferrack
  11.146  
  11.147 -lemma "EX (x::'a::{linordered_field,number_ring, division_by_zero}) y z. (ALL w >= abs (x+y+z). w >= abs x + abs y + abs z)"
  11.148 +lemma "EX (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y z. (ALL w >= abs (x+y+z). w >= abs x + abs y + abs z)"
  11.149    by ferrack
  11.150  
  11.151 -lemma "EX z. (ALL (x::'a::{linordered_field,number_ring, division_by_zero}) y. (EX w >= (x+y+z). w <= abs x + abs y + abs z))"
  11.152 +lemma "EX z. (ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y. (EX w >= (x+y+z). w <= abs x + abs y + abs z))"
  11.153    by ferrack
  11.154  
  11.155 -lemma "EX z. (ALL (x::'a::{linordered_field,number_ring, division_by_zero}) < abs z. (EX y w. x< y & x < z & x> w & 3*x < w + y))"
  11.156 +lemma "EX z. (ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) < abs z. (EX y w. x< y & x < z & x> w & 3*x < w + y))"
  11.157    by ferrack
  11.158  
  11.159 -lemma "ALL (x::'a::{linordered_field,number_ring, division_by_zero}) y. (EX z. (ALL w. abs (x-y) = abs (z-w) --> z < x & w ~= y))"
  11.160 +lemma "ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y. (EX z. (ALL w. abs (x-y) = abs (z-w) --> z < x & w ~= y))"
  11.161    by ferrack
  11.162  
  11.163 -lemma "EX y. (ALL (x::'a::{linordered_field,number_ring, division_by_zero}). (EX z w. min (5*x + 3*z) (17*w) + 5* abs (y - 8*x + z) <= max y (7*z - x + w)))"
  11.164 +lemma "EX y. (ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}). (EX z w. min (5*x + 3*z) (17*w) + 5* abs (y - 8*x + z) <= max y (7*z - x + w)))"
  11.165    by ferrack
  11.166  
  11.167 -lemma "EX (x::'a::{linordered_field,number_ring, division_by_zero}) z. (ALL w >= 13*x - 4*z. (EX y. w >= abs x + abs y + z))"
  11.168 +lemma "EX (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) z. (ALL w >= 13*x - 4*z. (EX y. w >= abs x + abs y + z))"
  11.169    by ferrack
  11.170  
  11.171 -lemma "EX (x::'a::{linordered_field,number_ring, division_by_zero}). (ALL y < x. (EX z > (x+y).
  11.172 +lemma "EX (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}). (ALL y < x. (EX z > (x+y).
  11.173    (ALL w. 5*w + 10*x - z >= y --> w + 7*x + 3*z >= 2*y)))"
  11.174    by ferrack
  11.175  
  11.176 -lemma "EX (x::'a::{linordered_field,number_ring, division_by_zero}). (ALL y. (EX z > y.
  11.177 +lemma "EX (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}). (ALL y. (EX z > y.
  11.178    (ALL w . w < 13 --> w + 10*x - z >= y --> 5*w + 7*x + 13*z >= 2*y)))"
  11.179    by ferrack
  11.180  
  11.181 -lemma "EX (x::'a::{linordered_field,number_ring, division_by_zero}) y z w. min (5*x + 3*z) (17*w) + 5* abs (y - 8*x + z) <= max y (7*z - x + w)"
  11.182 +lemma "EX (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}) y z w. min (5*x + 3*z) (17*w) + 5* abs (y - 8*x + z) <= max y (7*z - x + w)"
  11.183    by ferrack
  11.184  
  11.185 -lemma "ALL (x::'a::{linordered_field,number_ring, division_by_zero}). (EX y. (ALL z>19. y <= x + z & (EX w. abs (y - x) < w)))"
  11.186 +lemma "ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}). (EX y. (ALL z>19. y <= x + z & (EX w. abs (y - x) < w)))"
  11.187    by ferrack
  11.188  
  11.189 -lemma "ALL (x::'a::{linordered_field,number_ring, division_by_zero}). (EX y. (ALL z>19. y <= x + z & (EX w. abs (x + z) < w - y)))"
  11.190 +lemma "ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}). (EX y. (ALL z>19. y <= x + z & (EX w. abs (x + z) < w - y)))"
  11.191    by ferrack
  11.192  
  11.193 -lemma "ALL (x::'a::{linordered_field,number_ring, division_by_zero}). (EX y. abs y ~= abs x & (ALL z> max x y. (EX w. w ~= y & w ~= z & 3*w - z >= x + y)))"
  11.194 +lemma "ALL (x::'a::{linordered_field, division_ring_inverse_zero, number_ring}). (EX y. abs y ~= abs x & (ALL z> max x y. (EX w. w ~= y & w ~= z & 3*w - z >= x + y)))"
  11.195    by ferrack
  11.196  
  11.197  end
    12.1 --- a/src/HOL/Fields.thy	Mon Apr 26 09:37:46 2010 -0700
    12.2 +++ b/src/HOL/Fields.thy	Mon Apr 26 09:45:22 2010 -0700
    12.3 @@ -96,51 +96,45 @@
    12.4    "\<lbrakk>b \<noteq> 0; c \<noteq> 0\<rbrakk> \<Longrightarrow> (a * c) / (c * b) = a / b"
    12.5  using nonzero_mult_divide_mult_cancel_right [of b c a] by (simp add: mult_ac)
    12.6  
    12.7 -lemma add_divide_eq_iff:
    12.8 +lemma add_divide_eq_iff [field_simps]:
    12.9    "z \<noteq> 0 \<Longrightarrow> x + y / z = (z * x + y) / z"
   12.10    by (simp add: add_divide_distrib)
   12.11  
   12.12 -lemma divide_add_eq_iff:
   12.13 +lemma divide_add_eq_iff [field_simps]:
   12.14    "z \<noteq> 0 \<Longrightarrow> x / z + y = (x + z * y) / z"
   12.15    by (simp add: add_divide_distrib)
   12.16  
   12.17 -lemma diff_divide_eq_iff:
   12.18 +lemma diff_divide_eq_iff [field_simps]:
   12.19    "z \<noteq> 0 \<Longrightarrow> x - y / z = (z * x - y) / z"
   12.20    by (simp add: diff_divide_distrib)
   12.21  
   12.22 -lemma divide_diff_eq_iff:
   12.23 +lemma divide_diff_eq_iff [field_simps]:
   12.24    "z \<noteq> 0 \<Longrightarrow> x / z - y = (x - z * y) / z"
   12.25    by (simp add: diff_divide_distrib)
   12.26  
   12.27 -lemmas field_eq_simps[no_atp] = algebra_simps
   12.28 -  (* pull / out*)
   12.29 -  add_divide_eq_iff divide_add_eq_iff
   12.30 -  diff_divide_eq_iff divide_diff_eq_iff
   12.31 -  (* multiply eqn *)
   12.32 -  nonzero_eq_divide_eq nonzero_divide_eq_eq
   12.33 -  times_divide_eq_left times_divide_eq_right
   12.34 -
   12.35 -text{*An example:*}
   12.36 -lemma "\<lbrakk>a\<noteq>b; c\<noteq>d; e\<noteq>f\<rbrakk> \<Longrightarrow> ((a-b)*(c-d)*(e-f))/((c-d)*(e-f)*(a-b)) = 1"
   12.37 -apply(subgoal_tac "(c-d)*(e-f)*(a-b) \<noteq> 0")
   12.38 - apply(simp add:field_eq_simps)
   12.39 -apply(simp)
   12.40 -done
   12.41 -
   12.42  lemma diff_frac_eq:
   12.43    "y \<noteq> 0 \<Longrightarrow> z \<noteq> 0 \<Longrightarrow> x / y - w / z = (x * z - w * y) / (y * z)"
   12.44 -  by (simp add: field_eq_simps times_divide_eq)
   12.45 +  by (simp add: field_simps)
   12.46  
   12.47  lemma frac_eq_eq:
   12.48    "y \<noteq> 0 \<Longrightarrow> z \<noteq> 0 \<Longrightarrow> (x / y = w / z) = (x * z = w * y)"
   12.49 -  by (simp add: field_eq_simps times_divide_eq)
   12.50 +  by (simp add: field_simps)
   12.51 +
   12.52 +end
   12.53 +
   12.54 +class field_inverse_zero = field +
   12.55 +  assumes field_inverse_zero: "inverse 0 = 0"
   12.56 +begin
   12.57 +
   12.58 +subclass division_ring_inverse_zero proof
   12.59 +qed (fact field_inverse_zero)
   12.60  
   12.61  end
   12.62  
   12.63  text{*This version builds in division by zero while also re-orienting
   12.64        the right-hand side.*}
   12.65  lemma inverse_mult_distrib [simp]:
   12.66 -     "inverse(a*b) = inverse(a) * inverse(b::'a::{field,division_by_zero})"
   12.67 +     "inverse(a*b) = inverse(a) * inverse(b::'a::{field,division_ring_inverse_zero})"
   12.68    proof cases
   12.69      assume "a \<noteq> 0 & b \<noteq> 0" 
   12.70      thus ?thesis by (simp add: nonzero_inverse_mult_distrib mult_ac)
   12.71 @@ -150,7 +144,7 @@
   12.72    qed
   12.73  
   12.74  lemma inverse_divide [simp]:
   12.75 -  "inverse (a/b) = b / (a::'a::{field,division_by_zero})"
   12.76 +  "inverse (a/b) = b / (a::'a::{field,division_ring_inverse_zero})"
   12.77    by (simp add: divide_inverse mult_commute)
   12.78  
   12.79  
   12.80 @@ -161,85 +155,85 @@
   12.81  because the latter are covered by a simproc. *}
   12.82  
   12.83  lemma mult_divide_mult_cancel_left:
   12.84 -  "c\<noteq>0 ==> (c*a) / (c*b) = a / (b::'a::{field,division_by_zero})"
   12.85 +  "c\<noteq>0 ==> (c*a) / (c*b) = a / (b::'a::{field,division_ring_inverse_zero})"
   12.86  apply (cases "b = 0")
   12.87  apply simp_all
   12.88  done
   12.89  
   12.90  lemma mult_divide_mult_cancel_right:
   12.91 -  "c\<noteq>0 ==> (a*c) / (b*c) = a / (b::'a::{field,division_by_zero})"
   12.92 +  "c\<noteq>0 ==> (a*c) / (b*c) = a / (b::'a::{field,division_ring_inverse_zero})"
   12.93  apply (cases "b = 0")
   12.94  apply simp_all
   12.95  done
   12.96  
   12.97  lemma divide_divide_eq_right [simp,no_atp]:
   12.98 -  "a / (b/c) = (a*c) / (b::'a::{field,division_by_zero})"
   12.99 +  "a / (b/c) = (a*c) / (b::'a::{field,division_ring_inverse_zero})"
  12.100  by (simp add: divide_inverse mult_ac)
  12.101  
  12.102  lemma divide_divide_eq_left [simp,no_atp]:
  12.103 -  "(a / b) / (c::'a::{field,division_by_zero}) = a / (b*c)"
  12.104 +  "(a / b) / (c::'a::{field,division_ring_inverse_zero}) = a / (b*c)"
  12.105  by (simp add: divide_inverse mult_assoc)
  12.106  
  12.107  
  12.108  text {*Special Cancellation Simprules for Division*}
  12.109  
  12.110  lemma mult_divide_mult_cancel_left_if[simp,no_atp]:
  12.111 -fixes c :: "'a :: {field,division_by_zero}"
  12.112 +fixes c :: "'a :: {field,division_ring_inverse_zero}"
  12.113  shows "(c*a) / (c*b) = (if c=0 then 0 else a/b)"
  12.114  by (simp add: mult_divide_mult_cancel_left)
  12.115  
  12.116  
  12.117  text {* Division and Unary Minus *}
  12.118  
  12.119 -lemma minus_divide_right: "- (a/b) = a / -(b::'a::{field,division_by_zero})"
  12.120 +lemma minus_divide_right: "- (a/b) = a / -(b::'a::{field,division_ring_inverse_zero})"
  12.121  by (simp add: divide_inverse)
  12.122  
  12.123  lemma divide_minus_right [simp, no_atp]:
  12.124 -  "a / -(b::'a::{field,division_by_zero}) = -(a / b)"
  12.125 +  "a / -(b::'a::{field,division_ring_inverse_zero}) = -(a / b)"
  12.126  by (simp add: divide_inverse)
  12.127  
  12.128  lemma minus_divide_divide:
  12.129 -  "(-a)/(-b) = a / (b::'a::{field,division_by_zero})"
  12.130 +  "(-a)/(-b) = a / (b::'a::{field,division_ring_inverse_zero})"
  12.131  apply (cases "b=0", simp) 
  12.132  apply (simp add: nonzero_minus_divide_divide) 
  12.133  done
  12.134  
  12.135  lemma eq_divide_eq:
  12.136 -  "((a::'a::{field,division_by_zero}) = b/c) = (if c\<noteq>0 then a*c = b else a=0)"
  12.137 +  "((a::'a::{field,division_ring_inverse_zero}) = b/c) = (if c\<noteq>0 then a*c = b else a=0)"
  12.138  by (simp add: nonzero_eq_divide_eq)
  12.139  
  12.140  lemma divide_eq_eq:
  12.141 -  "(b/c = (a::'a::{field,division_by_zero})) = (if c\<noteq>0 then b = a*c else a=0)"
  12.142 +  "(b/c = (a::'a::{field,division_ring_inverse_zero})) = (if c\<noteq>0 then b = a*c else a=0)"
  12.143  by (force simp add: nonzero_divide_eq_eq)
  12.144  
  12.145  lemma inverse_eq_1_iff [simp]:
  12.146 -  "(inverse x = 1) = (x = (1::'a::{field,division_by_zero}))"
  12.147 +  "(inverse x = 1) = (x = (1::'a::{field,division_ring_inverse_zero}))"
  12.148  by (insert inverse_eq_iff_eq [of x 1], simp) 
  12.149  
  12.150  lemma divide_eq_0_iff [simp,no_atp]:
  12.151 -     "(a/b = 0) = (a=0 | b=(0::'a::{field,division_by_zero}))"
  12.152 +     "(a/b = 0) = (a=0 | b=(0::'a::{field,division_ring_inverse_zero}))"
  12.153  by (simp add: divide_inverse)
  12.154  
  12.155  lemma divide_cancel_right [simp,no_atp]:
  12.156 -     "(a/c = b/c) = (c = 0 | a = (b::'a::{field,division_by_zero}))"
  12.157 +     "(a/c = b/c) = (c = 0 | a = (b::'a::{field,division_ring_inverse_zero}))"
  12.158  apply (cases "c=0", simp)
  12.159  apply (simp add: divide_inverse)
  12.160  done
  12.161  
  12.162  lemma divide_cancel_left [simp,no_atp]:
  12.163 -     "(c/a = c/b) = (c = 0 | a = (b::'a::{field,division_by_zero}))" 
  12.164 +     "(c/a = c/b) = (c = 0 | a = (b::'a::{field,division_ring_inverse_zero}))" 
  12.165  apply (cases "c=0", simp)
  12.166  apply (simp add: divide_inverse)
  12.167  done
  12.168  
  12.169  lemma divide_eq_1_iff [simp,no_atp]:
  12.170 -     "(a/b = 1) = (b \<noteq> 0 & a = (b::'a::{field,division_by_zero}))"
  12.171 +     "(a/b = 1) = (b \<noteq> 0 & a = (b::'a::{field,division_ring_inverse_zero}))"
  12.172  apply (cases "b=0", simp)
  12.173  apply (simp add: right_inverse_eq)
  12.174  done
  12.175  
  12.176  lemma one_eq_divide_iff [simp,no_atp]:
  12.177 -     "(1 = a/b) = (b \<noteq> 0 & a = (b::'a::{field,division_by_zero}))"
  12.178 +     "(1 = a/b) = (b \<noteq> 0 & a = (b::'a::{field,division_ring_inverse_zero}))"
  12.179  by (simp add: eq_commute [of 1])
  12.180  
  12.181  
  12.182 @@ -391,7 +385,7 @@
  12.183    "a < 0 \<Longrightarrow> b < 0 \<Longrightarrow> inverse a \<le> inverse b \<longleftrightarrow> b \<le> a"
  12.184    by (blast intro: le_imp_inverse_le_neg dest: inverse_le_imp_le_neg) 
  12.185  
  12.186 -lemma pos_le_divide_eq: "0 < c ==> (a \<le> b/c) = (a*c \<le> b)"
  12.187 +lemma pos_le_divide_eq [field_simps]: "0 < c ==> (a \<le> b/c) = (a*c \<le> b)"
  12.188  proof -
  12.189    assume less: "0<c"
  12.190    hence "(a \<le> b/c) = (a*c \<le> (b/c)*c)"
  12.191 @@ -401,7 +395,7 @@
  12.192    finally show ?thesis .
  12.193  qed
  12.194  
  12.195 -lemma neg_le_divide_eq: "c < 0 ==> (a \<le> b/c) = (b \<le> a*c)"
  12.196 +lemma neg_le_divide_eq [field_simps]: "c < 0 ==> (a \<le> b/c) = (b \<le> a*c)"
  12.197  proof -
  12.198    assume less: "c<0"
  12.199    hence "(a \<le> b/c) = ((b/c)*c \<le> a*c)"
  12.200 @@ -411,7 +405,7 @@
  12.201    finally show ?thesis .
  12.202  qed
  12.203  
  12.204 -lemma pos_less_divide_eq:
  12.205 +lemma pos_less_divide_eq [field_simps]:
  12.206       "0 < c ==> (a < b/c) = (a*c < b)"
  12.207  proof -
  12.208    assume less: "0<c"
  12.209 @@ -422,7 +416,7 @@
  12.210    finally show ?thesis .
  12.211  qed
  12.212  
  12.213 -lemma neg_less_divide_eq:
  12.214 +lemma neg_less_divide_eq [field_simps]:
  12.215   "c < 0 ==> (a < b/c) = (b < a*c)"
  12.216  proof -
  12.217    assume less: "c<0"
  12.218 @@ -433,7 +427,7 @@
  12.219    finally show ?thesis .
  12.220  qed
  12.221  
  12.222 -lemma pos_divide_less_eq:
  12.223 +lemma pos_divide_less_eq [field_simps]:
  12.224       "0 < c ==> (b/c < a) = (b < a*c)"
  12.225  proof -
  12.226    assume less: "0<c"
  12.227 @@ -444,7 +438,7 @@
  12.228    finally show ?thesis .
  12.229  qed
  12.230  
  12.231 -lemma neg_divide_less_eq:
  12.232 +lemma neg_divide_less_eq [field_simps]:
  12.233   "c < 0 ==> (b/c < a) = (a*c < b)"
  12.234  proof -
  12.235    assume less: "c<0"
  12.236 @@ -455,7 +449,7 @@
  12.237    finally show ?thesis .
  12.238  qed
  12.239  
  12.240 -lemma pos_divide_le_eq: "0 < c ==> (b/c \<le> a) = (b \<le> a*c)"
  12.241 +lemma pos_divide_le_eq [field_simps]: "0 < c ==> (b/c \<le> a) = (b \<le> a*c)"
  12.242  proof -
  12.243    assume less: "0<c"
  12.244    hence "(b/c \<le> a) = ((b/c)*c \<le> a*c)"
  12.245 @@ -465,7 +459,7 @@
  12.246    finally show ?thesis .
  12.247  qed
  12.248  
  12.249 -lemma neg_divide_le_eq: "c < 0 ==> (b/c \<le> a) = (a*c \<le> b)"
  12.250 +lemma neg_divide_le_eq [field_simps]: "c < 0 ==> (b/c \<le> a) = (a*c \<le> b)"
  12.251  proof -
  12.252    assume less: "c<0"
  12.253    hence "(b/c \<le> a) = (a*c \<le> (b/c)*c)"
  12.254 @@ -475,24 +469,15 @@
  12.255    finally show ?thesis .
  12.256  qed
  12.257  
  12.258 -text{* Lemmas @{text field_simps} multiply with denominators in in(equations)
  12.259 -if they can be proved to be non-zero (for equations) or positive/negative
  12.260 -(for inequations). Can be too aggressive and is therefore separate from the
  12.261 -more benign @{text algebra_simps}. *}
  12.262 -
  12.263 -lemmas field_simps[no_atp] = field_eq_simps
  12.264 -  (* multiply ineqn *)
  12.265 -  pos_divide_less_eq neg_divide_less_eq
  12.266 -  pos_less_divide_eq neg_less_divide_eq
  12.267 -  pos_divide_le_eq neg_divide_le_eq
  12.268 -  pos_le_divide_eq neg_le_divide_eq
  12.269 -
  12.270  text{* Lemmas @{text sign_simps} is a first attempt to automate proofs
  12.271  of positivity/negativity needed for @{text field_simps}. Have not added @{text
  12.272  sign_simps} to @{text field_simps} because the former can lead to case
  12.273  explosions. *}
  12.274  
  12.275 -lemmas sign_simps[no_atp] = group_simps
  12.276 +lemmas sign_simps [no_atp] = algebra_simps
  12.277 +  zero_less_mult_iff mult_less_0_iff
  12.278 +
  12.279 +lemmas (in -) sign_simps [no_atp] = algebra_simps
  12.280    zero_less_mult_iff mult_less_0_iff
  12.281  
  12.282  (* Only works once linear arithmetic is installed:
  12.283 @@ -658,37 +643,46 @@
  12.284  
  12.285  end
  12.286  
  12.287 +class linordered_field_inverse_zero = linordered_field +
  12.288 +  assumes linordered_field_inverse_zero: "inverse 0 = 0"
  12.289 +begin
  12.290 +
  12.291 +subclass field_inverse_zero proof
  12.292 +qed (fact linordered_field_inverse_zero)
  12.293 +
  12.294 +end
  12.295 +
  12.296  lemma le_divide_eq:
  12.297    "(a \<le> b/c) = 
  12.298     (if 0 < c then a*c \<le> b
  12.299               else if c < 0 then b \<le> a*c
  12.300 -             else  a \<le> (0::'a::{linordered_field,division_by_zero}))"
  12.301 +             else  a \<le> (0::'a::{linordered_field,division_ring_inverse_zero}))"
  12.302  apply (cases "c=0", simp) 
  12.303  apply (force simp add: pos_le_divide_eq neg_le_divide_eq linorder_neq_iff) 
  12.304  done
  12.305  
  12.306  lemma inverse_positive_iff_positive [simp]:
  12.307 -  "(0 < inverse a) = (0 < (a::'a::{linordered_field,division_by_zero}))"
  12.308 +  "(0 < inverse a) = (0 < (a::'a::{linordered_field,division_ring_inverse_zero}))"
  12.309  apply (cases "a = 0", simp)
  12.310  apply (blast intro: inverse_positive_imp_positive positive_imp_inverse_positive)
  12.311  done
  12.312  
  12.313  lemma inverse_negative_iff_negative [simp]:
  12.314 -  "(inverse a < 0) = (a < (0::'a::{linordered_field,division_by_zero}))"
  12.315 +  "(inverse a < 0) = (a < (0::'a::{linordered_field,division_ring_inverse_zero}))"
  12.316  apply (cases "a = 0", simp)
  12.317  apply (blast intro: inverse_negative_imp_negative negative_imp_inverse_negative)
  12.318  done
  12.319  
  12.320  lemma inverse_nonnegative_iff_nonnegative [simp]:
  12.321 -  "(0 \<le> inverse a) = (0 \<le> (a::'a::{linordered_field,division_by_zero}))"
  12.322 +  "(0 \<le> inverse a) = (0 \<le> (a::'a::{linordered_field,division_ring_inverse_zero}))"
  12.323  by (simp add: linorder_not_less [symmetric])
  12.324  
  12.325  lemma inverse_nonpositive_iff_nonpositive [simp]:
  12.326 -  "(inverse a \<le> 0) = (a \<le> (0::'a::{linordered_field,division_by_zero}))"
  12.327 +  "(inverse a \<le> 0) = (a \<le> (0::'a::{linordered_field,division_ring_inverse_zero}))"
  12.328  by (simp add: linorder_not_less [symmetric])
  12.329  
  12.330  lemma one_less_inverse_iff:
  12.331 -  "(1 < inverse x) = (0 < x & x < (1::'a::{linordered_field,division_by_zero}))"
  12.332 +  "(1 < inverse x) = (0 < x & x < (1::'a::{linordered_field,division_ring_inverse_zero}))"
  12.333  proof cases
  12.334    assume "0 < x"
  12.335      with inverse_less_iff_less [OF zero_less_one, of x]
  12.336 @@ -706,22 +700,22 @@
  12.337  qed
  12.338  
  12.339  lemma one_le_inverse_iff:
  12.340 -  "(1 \<le> inverse x) = (0 < x & x \<le> (1::'a::{linordered_field,division_by_zero}))"
  12.341 +  "(1 \<le> inverse x) = (0 < x & x \<le> (1::'a::{linordered_field,division_ring_inverse_zero}))"
  12.342  by (force simp add: order_le_less one_less_inverse_iff)
  12.343  
  12.344  lemma inverse_less_1_iff:
  12.345 -  "(inverse x < 1) = (x \<le> 0 | 1 < (x::'a::{linordered_field,division_by_zero}))"
  12.346 +  "(inverse x < 1) = (x \<le> 0 | 1 < (x::'a::{linordered_field,division_ring_inverse_zero}))"
  12.347  by (simp add: linorder_not_le [symmetric] one_le_inverse_iff) 
  12.348  
  12.349  lemma inverse_le_1_iff:
  12.350 -  "(inverse x \<le> 1) = (x \<le> 0 | 1 \<le> (x::'a::{linordered_field,division_by_zero}))"
  12.351 +  "(inverse x \<le> 1) = (x \<le> 0 | 1 \<le> (x::'a::{linordered_field,division_ring_inverse_zero}))"
  12.352  by (simp add: linorder_not_less [symmetric] one_less_inverse_iff) 
  12.353  
  12.354  lemma divide_le_eq:
  12.355    "(b/c \<le> a) = 
  12.356     (if 0 < c then b \<le> a*c
  12.357               else if c < 0 then a*c \<le> b
  12.358 -             else 0 \<le> (a::'a::{linordered_field,division_by_zero}))"
  12.359 +             else 0 \<le> (a::'a::{linordered_field,division_ring_inverse_zero}))"
  12.360  apply (cases "c=0", simp) 
  12.361  apply (force simp add: pos_divide_le_eq neg_divide_le_eq linorder_neq_iff) 
  12.362  done
  12.363 @@ -730,7 +724,7 @@
  12.364    "(a < b/c) = 
  12.365     (if 0 < c then a*c < b
  12.366               else if c < 0 then b < a*c
  12.367 -             else  a < (0::'a::{linordered_field,division_by_zero}))"
  12.368 +             else  a < (0::'a::{linordered_field,division_ring_inverse_zero}))"
  12.369  apply (cases "c=0", simp) 
  12.370  apply (force simp add: pos_less_divide_eq neg_less_divide_eq linorder_neq_iff) 
  12.371  done
  12.372 @@ -739,7 +733,7 @@
  12.373    "(b/c < a) = 
  12.374     (if 0 < c then b < a*c
  12.375               else if c < 0 then a*c < b
  12.376 -             else 0 < (a::'a::{linordered_field,division_by_zero}))"
  12.377 +             else 0 < (a::'a::{linordered_field,division_ring_inverse_zero}))"
  12.378  apply (cases "c=0", simp) 
  12.379  apply (force simp add: pos_divide_less_eq neg_divide_less_eq linorder_neq_iff) 
  12.380  done
  12.381 @@ -747,21 +741,21 @@
  12.382  text {*Division and Signs*}
  12.383  
  12.384  lemma zero_less_divide_iff:
  12.385 -     "((0::'a::{linordered_field,division_by_zero}) < a/b) = (0 < a & 0 < b | a < 0 & b < 0)"
  12.386 +     "((0::'a::{linordered_field,division_ring_inverse_zero}) < a/b) = (0 < a & 0 < b | a < 0 & b < 0)"
  12.387  by (simp add: divide_inverse zero_less_mult_iff)
  12.388  
  12.389  lemma divide_less_0_iff:
  12.390 -     "(a/b < (0::'a::{linordered_field,division_by_zero})) = 
  12.391 +     "(a/b < (0::'a::{linordered_field,division_ring_inverse_zero})) = 
  12.392        (0 < a & b < 0 | a < 0 & 0 < b)"
  12.393  by (simp add: divide_inverse mult_less_0_iff)
  12.394  
  12.395  lemma zero_le_divide_iff:
  12.396 -     "((0::'a::{linordered_field,division_by_zero}) \<le> a/b) =
  12.397 +     "((0::'a::{linordered_field,division_ring_inverse_zero}) \<le> a/b) =
  12.398        (0 \<le> a & 0 \<le> b | a \<le> 0 & b \<le> 0)"
  12.399  by (simp add: divide_inverse zero_le_mult_iff)
  12.400  
  12.401  lemma divide_le_0_iff:
  12.402 -     "(a/b \<le> (0::'a::{linordered_field,division_by_zero})) =
  12.403 +     "(a/b \<le> (0::'a::{linordered_field,division_ring_inverse_zero})) =
  12.404        (0 \<le> a & b \<le> 0 | a \<le> 0 & 0 \<le> b)"
  12.405  by (simp add: divide_inverse mult_le_0_iff)
  12.406  
  12.407 @@ -770,13 +764,13 @@
  12.408  text{*Simplify expressions equated with 1*}
  12.409  
  12.410  lemma zero_eq_1_divide_iff [simp,no_atp]:
  12.411 -     "((0::'a::{linordered_field,division_by_zero}) = 1/a) = (a = 0)"
  12.412 +     "((0::'a::{linordered_field,division_ring_inverse_zero}) = 1/a) = (a = 0)"
  12.413  apply (cases "a=0", simp)
  12.414  apply (auto simp add: nonzero_eq_divide_eq)
  12.415  done
  12.416  
  12.417  lemma one_divide_eq_0_iff [simp,no_atp]:
  12.418 -     "(1/a = (0::'a::{linordered_field,division_by_zero})) = (a = 0)"
  12.419 +     "(1/a = (0::'a::{linordered_field,division_ring_inverse_zero})) = (a = 0)"
  12.420  apply (cases "a=0", simp)
  12.421  apply (insert zero_neq_one [THEN not_sym])
  12.422  apply (auto simp add: nonzero_divide_eq_eq)
  12.423 @@ -794,16 +788,16 @@
  12.424  declare divide_le_0_1_iff [simp,no_atp]
  12.425  
  12.426  lemma divide_right_mono:
  12.427 -     "[|a \<le> b; 0 \<le> c|] ==> a/c \<le> b/(c::'a::{linordered_field,division_by_zero})"
  12.428 +     "[|a \<le> b; 0 \<le> c|] ==> a/c \<le> b/(c::'a::{linordered_field,division_ring_inverse_zero})"
  12.429  by (force simp add: divide_strict_right_mono order_le_less)
  12.430  
  12.431 -lemma divide_right_mono_neg: "(a::'a::{linordered_field,division_by_zero}) <= b 
  12.432 +lemma divide_right_mono_neg: "(a::'a::{linordered_field,division_ring_inverse_zero}) <= b 
  12.433      ==> c <= 0 ==> b / c <= a / c"
  12.434  apply (drule divide_right_mono [of _ _ "- c"])
  12.435  apply auto
  12.436  done
  12.437  
  12.438 -lemma divide_left_mono_neg: "(a::'a::{linordered_field,division_by_zero}) <= b 
  12.439 +lemma divide_left_mono_neg: "(a::'a::{linordered_field,division_ring_inverse_zero}) <= b 
  12.440      ==> c <= 0 ==> 0 < a * b ==> c / a <= c / b"
  12.441    apply (drule divide_left_mono [of _ _ "- c"])
  12.442    apply (auto simp add: mult_commute)
  12.443 @@ -814,22 +808,22 @@
  12.444  text{*Simplify quotients that are compared with the value 1.*}
  12.445  
  12.446  lemma le_divide_eq_1 [no_atp]:
  12.447 -  fixes a :: "'a :: {linordered_field,division_by_zero}"
  12.448 +  fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}"
  12.449    shows "(1 \<le> b / a) = ((0 < a & a \<le> b) | (a < 0 & b \<le> a))"
  12.450  by (auto simp add: le_divide_eq)
  12.451  
  12.452  lemma divide_le_eq_1 [no_atp]:
  12.453 -  fixes a :: "'a :: {linordered_field,division_by_zero}"
  12.454 +  fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}"
  12.455    shows "(b / a \<le> 1) = ((0 < a & b \<le> a) | (a < 0 & a \<le> b) | a=0)"
  12.456  by (auto simp add: divide_le_eq)
  12.457  
  12.458  lemma less_divide_eq_1 [no_atp]:
  12.459 -  fixes a :: "'a :: {linordered_field,division_by_zero}"
  12.460 +  fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}"
  12.461    shows "(1 < b / a) = ((0 < a & a < b) | (a < 0 & b < a))"
  12.462  by (auto simp add: less_divide_eq)
  12.463  
  12.464  lemma divide_less_eq_1 [no_atp]:
  12.465 -  fixes a :: "'a :: {linordered_field,division_by_zero}"
  12.466 +  fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}"
  12.467    shows "(b / a < 1) = ((0 < a & b < a) | (a < 0 & a < b) | a=0)"
  12.468  by (auto simp add: divide_less_eq)
  12.469  
  12.470 @@ -837,76 +831,76 @@
  12.471  text {*Conditional Simplification Rules: No Case Splits*}
  12.472  
  12.473  lemma le_divide_eq_1_pos [simp,no_atp]:
  12.474 -  fixes a :: "'a :: {linordered_field,division_by_zero}"
  12.475 +  fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}"
  12.476    shows "0 < a \<Longrightarrow> (1 \<le> b/a) = (a \<le> b)"
  12.477  by (auto simp add: le_divide_eq)
  12.478  
  12.479  lemma le_divide_eq_1_neg [simp,no_atp]:
  12.480 -  fixes a :: "'a :: {linordered_field,division_by_zero}"
  12.481 +  fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}"
  12.482    shows "a < 0 \<Longrightarrow> (1 \<le> b/a) = (b \<le> a)"
  12.483  by (auto simp add: le_divide_eq)
  12.484  
  12.485  lemma divide_le_eq_1_pos [simp,no_atp]:
  12.486 -  fixes a :: "'a :: {linordered_field,division_by_zero}"
  12.487 +  fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}"
  12.488    shows "0 < a \<Longrightarrow> (b/a \<le> 1) = (b \<le> a)"
  12.489  by (auto simp add: divide_le_eq)
  12.490  
  12.491  lemma divide_le_eq_1_neg [simp,no_atp]:
  12.492 -  fixes a :: "'a :: {linordered_field,division_by_zero}"
  12.493 +  fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}"
  12.494    shows "a < 0 \<Longrightarrow> (b/a \<le> 1) = (a \<le> b)"
  12.495  by (auto simp add: divide_le_eq)
  12.496  
  12.497  lemma less_divide_eq_1_pos [simp,no_atp]:
  12.498 -  fixes a :: "'a :: {linordered_field,division_by_zero}"
  12.499 +  fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}"
  12.500    shows "0 < a \<Longrightarrow> (1 < b/a) = (a < b)"
  12.501  by (auto simp add: less_divide_eq)
  12.502  
  12.503  lemma less_divide_eq_1_neg [simp,no_atp]:
  12.504 -  fixes a :: "'a :: {linordered_field,division_by_zero}"
  12.505 +  fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}"
  12.506    shows "a < 0 \<Longrightarrow> (1 < b/a) = (b < a)"
  12.507  by (auto simp add: less_divide_eq)
  12.508  
  12.509  lemma divide_less_eq_1_pos [simp,no_atp]:
  12.510 -  fixes a :: "'a :: {linordered_field,division_by_zero}"
  12.511 +  fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}"
  12.512    shows "0 < a \<Longrightarrow> (b/a < 1) = (b < a)"
  12.513  by (auto simp add: divide_less_eq)
  12.514  
  12.515  lemma divide_less_eq_1_neg [simp,no_atp]:
  12.516 -  fixes a :: "'a :: {linordered_field,division_by_zero}"
  12.517 +  fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}"
  12.518    shows "a < 0 \<Longrightarrow> b/a < 1 <-> a < b"
  12.519  by (auto simp add: divide_less_eq)
  12.520  
  12.521  lemma eq_divide_eq_1 [simp,no_atp]:
  12.522 -  fixes a :: "'a :: {linordered_field,division_by_zero}"
  12.523 +  fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}"
  12.524    shows "(1 = b/a) = ((a \<noteq> 0 & a = b))"
  12.525  by (auto simp add: eq_divide_eq)
  12.526  
  12.527  lemma divide_eq_eq_1 [simp,no_atp]:
  12.528 -  fixes a :: "'a :: {linordered_field,division_by_zero}"
  12.529 +  fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}"
  12.530    shows "(b/a = 1) = ((a \<noteq> 0 & a = b))"
  12.531  by (auto simp add: divide_eq_eq)
  12.532  
  12.533  lemma abs_inverse [simp]:
  12.534 -     "\<bar>inverse (a::'a::{linordered_field,division_by_zero})\<bar> = 
  12.535 +     "\<bar>inverse (a::'a::{linordered_field,division_ring_inverse_zero})\<bar> = 
  12.536        inverse \<bar>a\<bar>"
  12.537  apply (cases "a=0", simp) 
  12.538  apply (simp add: nonzero_abs_inverse) 
  12.539  done
  12.540  
  12.541  lemma abs_divide [simp]:
  12.542 -     "\<bar>a / (b::'a::{linordered_field,division_by_zero})\<bar> = \<bar>a\<bar> / \<bar>b\<bar>"
  12.543 +     "\<bar>a / (b::'a::{linordered_field,division_ring_inverse_zero})\<bar> = \<bar>a\<bar> / \<bar>b\<bar>"
  12.544  apply (cases "b=0", simp) 
  12.545  apply (simp add: nonzero_abs_divide) 
  12.546  done
  12.547  
  12.548 -lemma abs_div_pos: "(0::'a::{linordered_field,division_by_zero}) < y ==> 
  12.549 +lemma abs_div_pos: "(0::'a::{linordered_field,division_ring_inverse_zero}) < y ==> 
  12.550      \<bar>x\<bar> / y = \<bar>x / y\<bar>"
  12.551    apply (subst abs_divide)
  12.552    apply (simp add: order_less_imp_le)
  12.553  done
  12.554  
  12.555  lemma field_le_mult_one_interval:
  12.556 -  fixes x :: "'a\<Colon>{linordered_field,division_by_zero}"
  12.557 +  fixes x :: "'a\<Colon>{linordered_field,division_ring_inverse_zero}"
  12.558    assumes *: "\<And>z. \<lbrakk> 0 < z ; z < 1 \<rbrakk> \<Longrightarrow> z * x \<le> y"
  12.559    shows "x \<le> y"
  12.560  proof (cases "0 < x")
    13.1 --- a/src/HOL/GCD.thy	Mon Apr 26 09:37:46 2010 -0700
    13.2 +++ b/src/HOL/GCD.thy	Mon Apr 26 09:45:22 2010 -0700
    13.3 @@ -1034,11 +1034,11 @@
    13.4      thus "fst (bezw m n) * int m + snd (bezw m n) * int n = int (gcd m n)"
    13.5        apply (simp add: bezw_non_0 gcd_non_0_nat)
    13.6        apply (erule subst)
    13.7 -      apply (simp add: ring_simps)
    13.8 +      apply (simp add: field_simps)
    13.9        apply (subst mod_div_equality [of m n, symmetric])
   13.10        (* applying simp here undoes the last substitution!
   13.11           what is procedure cancel_div_mod? *)
   13.12 -      apply (simp only: ring_simps zadd_int [symmetric]
   13.13 +      apply (simp only: field_simps zadd_int [symmetric]
   13.14          zmult_int [symmetric])
   13.15        done
   13.16  qed
   13.17 @@ -1389,7 +1389,7 @@
   13.18    show "lcm (lcm n m) p = lcm n (lcm m p)"
   13.19      by (rule lcm_unique_nat [THEN iffD1]) (metis dvd.order_trans lcm_unique_nat)
   13.20    show "lcm m n = lcm n m"
   13.21 -    by (simp add: lcm_nat_def gcd_commute_nat ring_simps)
   13.22 +    by (simp add: lcm_nat_def gcd_commute_nat field_simps)
   13.23  qed
   13.24  
   13.25  interpretation lcm_int!: abel_semigroup "lcm :: int \<Rightarrow> int \<Rightarrow> int"
    14.1 --- a/src/HOL/Groebner_Basis.thy	Mon Apr 26 09:37:46 2010 -0700
    14.2 +++ b/src/HOL/Groebner_Basis.thy	Mon Apr 26 09:45:22 2010 -0700
    14.3 @@ -474,20 +474,20 @@
    14.4    fieldgb "op +" "op *" "op ^" "0::'a::{field,number_ring}" "1" "op -" "uminus" "op /" "inverse" apply (unfold_locales) by (simp_all add: divide_inverse)
    14.5  
    14.6  lemma divide_Numeral1: "(x::'a::{field,number_ring}) / Numeral1 = x" by simp
    14.7 -lemma divide_Numeral0: "(x::'a::{field,number_ring, division_by_zero}) / Numeral0 = 0"
    14.8 +lemma divide_Numeral0: "(x::'a::{field,number_ring, division_ring_inverse_zero}) / Numeral0 = 0"
    14.9    by simp
   14.10 -lemma mult_frac_frac: "((x::'a::{field,division_by_zero}) / y) * (z / w) = (x*z) / (y*w)"
   14.11 +lemma mult_frac_frac: "((x::'a::{field,division_ring_inverse_zero}) / y) * (z / w) = (x*z) / (y*w)"
   14.12    by simp
   14.13 -lemma mult_frac_num: "((x::'a::{field, division_by_zero}) / y) * z  = (x*z) / y"
   14.14 +lemma mult_frac_num: "((x::'a::{field, division_ring_inverse_zero}) / y) * z  = (x*z) / y"
   14.15    by simp
   14.16 -lemma mult_num_frac: "((x::'a::{field, division_by_zero}) / y) * z  = (x*z) / y"
   14.17 +lemma mult_num_frac: "((x::'a::{field, division_ring_inverse_zero}) / y) * z  = (x*z) / y"
   14.18    by simp
   14.19  
   14.20  lemma Numeral1_eq1_nat: "(1::nat) = Numeral1" by simp
   14.21  
   14.22 -lemma add_frac_num: "y\<noteq> 0 \<Longrightarrow> (x::'a::{field, division_by_zero}) / y + z = (x + z*y) / y"
   14.23 +lemma add_frac_num: "y\<noteq> 0 \<Longrightarrow> (x::'a::{field, division_ring_inverse_zero}) / y + z = (x + z*y) / y"
   14.24    by (simp add: add_divide_distrib)
   14.25 -lemma add_num_frac: "y\<noteq> 0 \<Longrightarrow> z + (x::'a::{field, division_by_zero}) / y = (x + z*y) / y"
   14.26 +lemma add_num_frac: "y\<noteq> 0 \<Longrightarrow> z + (x::'a::{field, division_ring_inverse_zero}) / y = (x + z*y) / y"
   14.27    by (simp add: add_divide_distrib)
   14.28  
   14.29  ML {*
    15.1 --- a/src/HOL/Groups.thy	Mon Apr 26 09:37:46 2010 -0700
    15.2 +++ b/src/HOL/Groups.thy	Mon Apr 26 09:45:22 2010 -0700
    15.3 @@ -12,13 +12,13 @@
    15.4  subsection {* Fact collections *}
    15.5  
    15.6  ML {*
    15.7 -structure Algebra_Simps = Named_Thms(
    15.8 -  val name = "algebra_simps"
    15.9 -  val description = "algebra simplification rules"
   15.10 +structure Ac_Simps = Named_Thms(
   15.11 +  val name = "ac_simps"
   15.12 +  val description = "associativity and commutativity simplification rules"
   15.13  )
   15.14  *}
   15.15  
   15.16 -setup Algebra_Simps.setup
   15.17 +setup Ac_Simps.setup
   15.18  
   15.19  text{* The rewrites accumulated in @{text algebra_simps} deal with the
   15.20  classical algebraic structures of groups, rings and family. They simplify
   15.21 @@ -29,15 +29,28 @@
   15.22  Of course it also works for fields, but it knows nothing about multiplicative
   15.23  inverses or division. This is catered for by @{text field_simps}. *}
   15.24  
   15.25 -
   15.26  ML {*
   15.27 -structure Ac_Simps = Named_Thms(
   15.28 -  val name = "ac_simps"
   15.29 -  val description = "associativity and commutativity simplification rules"
   15.30 +structure Algebra_Simps = Named_Thms(
   15.31 +  val name = "algebra_simps"
   15.32 +  val description = "algebra simplification rules"
   15.33  )
   15.34  *}
   15.35  
   15.36 -setup Ac_Simps.setup
   15.37 +setup Algebra_Simps.setup
   15.38 +
   15.39 +text{* Lemmas @{text field_simps} multiply with denominators in (in)equations
   15.40 +if they can be proved to be non-zero (for equations) or positive/negative
   15.41 +(for inequations). Can be too aggressive and is therefore separate from the
   15.42 +more benign @{text algebra_simps}. *}
   15.43 +
   15.44 +ML {*
   15.45 +structure Field_Simps = Named_Thms(
   15.46 +  val name = "field_simps"
   15.47 +  val description = "algebra simplification rules for fields"
   15.48 +)
   15.49 +*}
   15.50 +
   15.51 +setup Field_Simps.setup
   15.52  
   15.53  
   15.54  subsection {* Abstract structures *}
   15.55 @@ -139,13 +152,13 @@
   15.56  subsection {* Semigroups and Monoids *}
   15.57  
   15.58  class semigroup_add = plus +
   15.59 -  assumes add_assoc [algebra_simps]: "(a + b) + c = a + (b + c)"
   15.60 +  assumes add_assoc [algebra_simps, field_simps]: "(a + b) + c = a + (b + c)"
   15.61  
   15.62  sublocale semigroup_add < add!: semigroup plus proof
   15.63  qed (fact add_assoc)
   15.64  
   15.65  class ab_semigroup_add = semigroup_add +
   15.66 -  assumes add_commute [algebra_simps]: "a + b = b + a"
   15.67 +  assumes add_commute [algebra_simps, field_simps]: "a + b = b + a"
   15.68  
   15.69  sublocale ab_semigroup_add < add!: abel_semigroup plus proof
   15.70  qed (fact add_commute)
   15.71 @@ -153,7 +166,7 @@
   15.72  context ab_semigroup_add
   15.73  begin
   15.74  
   15.75 -lemmas add_left_commute [algebra_simps] = add.left_commute
   15.76 +lemmas add_left_commute [algebra_simps, field_simps] = add.left_commute
   15.77  
   15.78  theorems add_ac = add_assoc add_commute add_left_commute
   15.79  
   15.80 @@ -162,13 +175,13 @@
   15.81  theorems add_ac = add_assoc add_commute add_left_commute
   15.82  
   15.83  class semigroup_mult = times +
   15.84 -  assumes mult_assoc [algebra_simps]: "(a * b) * c = a * (b * c)"
   15.85 +  assumes mult_assoc [algebra_simps, field_simps]: "(a * b) * c = a * (b * c)"
   15.86  
   15.87  sublocale semigroup_mult < mult!: semigroup times proof
   15.88  qed (fact mult_assoc)
   15.89  
   15.90  class ab_semigroup_mult = semigroup_mult +
   15.91 -  assumes mult_commute [algebra_simps]: "a * b = b * a"
   15.92 +  assumes mult_commute [algebra_simps, field_simps]: "a * b = b * a"
   15.93  
   15.94  sublocale ab_semigroup_mult < mult!: abel_semigroup times proof
   15.95  qed (fact mult_commute)
   15.96 @@ -176,7 +189,7 @@
   15.97  context ab_semigroup_mult
   15.98  begin
   15.99  
  15.100 -lemmas mult_left_commute [algebra_simps] = mult.left_commute
  15.101 +lemmas mult_left_commute [algebra_simps, field_simps] = mult.left_commute
  15.102  
  15.103  theorems mult_ac = mult_assoc mult_commute mult_left_commute
  15.104  
  15.105 @@ -371,7 +384,7 @@
  15.106  lemma add_diff_cancel: "a + b - b = a"
  15.107  by (simp add: diff_minus add_assoc)
  15.108  
  15.109 -declare diff_minus[symmetric, algebra_simps]
  15.110 +declare diff_minus[symmetric, algebra_simps, field_simps]
  15.111  
  15.112  lemma eq_neg_iff_add_eq_0: "a = - b \<longleftrightarrow> a + b = 0"
  15.113  proof
  15.114 @@ -402,7 +415,7 @@
  15.115    then show "b = c" by simp
  15.116  qed
  15.117  
  15.118 -lemma uminus_add_conv_diff[algebra_simps]:
  15.119 +lemma uminus_add_conv_diff[algebra_simps, field_simps]:
  15.120    "- a + b = b - a"
  15.121  by (simp add:diff_minus add_commute)
  15.122  
  15.123 @@ -414,22 +427,22 @@
  15.124    "- (a - b) = b - a"
  15.125  by (simp add: diff_minus add_commute)
  15.126  
  15.127 -lemma add_diff_eq[algebra_simps]: "a + (b - c) = (a + b) - c"
  15.128 +lemma add_diff_eq[algebra_simps, field_simps]: "a + (b - c) = (a + b) - c"
  15.129  by (simp add: diff_minus add_ac)
  15.130  
  15.131 -lemma diff_add_eq[algebra_simps]: "(a - b) + c = (a + c) - b"
  15.132 +lemma diff_add_eq[algebra_simps, field_simps]: "(a - b) + c = (a + c) - b"
  15.133  by (simp add: diff_minus add_ac)
  15.134  
  15.135 -lemma diff_eq_eq[algebra_simps]: "a - b = c \<longleftrightarrow> a = c + b"
  15.136 +lemma diff_eq_eq[algebra_simps, field_simps]: "a - b = c \<longleftrightarrow> a = c + b"
  15.137  by (auto simp add: diff_minus add_assoc)
  15.138  
  15.139 -lemma eq_diff_eq[algebra_simps]: "a = c - b \<longleftrightarrow> a + b = c"
  15.140 +lemma eq_diff_eq[algebra_simps, field_simps]: "a = c - b \<longleftrightarrow> a + b = c"
  15.141  by (auto simp add: diff_minus add_assoc)
  15.142  
  15.143 -lemma diff_diff_eq[algebra_simps]: "(a - b) - c = a - (b + c)"
  15.144 +lemma diff_diff_eq[algebra_simps, field_simps]: "(a - b) - c = a - (b + c)"
  15.145  by (simp add: diff_minus add_ac)
  15.146  
  15.147 -lemma diff_diff_eq2[algebra_simps]: "a - (b - c) = (a + c) - b"
  15.148 +lemma diff_diff_eq2[algebra_simps, field_simps]: "a - (b - c) = (a + c) - b"
  15.149  by (simp add: diff_minus add_ac)
  15.150  
  15.151  lemma eq_iff_diff_eq_0: "a = b \<longleftrightarrow> a - b = 0"
  15.152 @@ -750,35 +763,29 @@
  15.153    finally show ?thesis .
  15.154  qed
  15.155  
  15.156 -lemma diff_less_eq[algebra_simps]: "a - b < c \<longleftrightarrow> a < c + b"
  15.157 +lemma diff_less_eq[algebra_simps, field_simps]: "a - b < c \<longleftrightarrow> a < c + b"
  15.158  apply (subst less_iff_diff_less_0 [of a])
  15.159  apply (rule less_iff_diff_less_0 [of _ c, THEN ssubst])
  15.160  apply (simp add: diff_minus add_ac)
  15.161  done
  15.162  
  15.163 -lemma less_diff_eq[algebra_simps]: "a < c - b \<longleftrightarrow> a + b < c"
  15.164 +lemma less_diff_eq[algebra_simps, field_simps]: "a < c - b \<longleftrightarrow> a + b < c"
  15.165  apply (subst less_iff_diff_less_0 [of "a + b"])
  15.166  apply (subst less_iff_diff_less_0 [of a])
  15.167  apply (simp add: diff_minus add_ac)
  15.168  done
  15.169  
  15.170 -lemma diff_le_eq[algebra_simps]: "a - b \<le> c \<longleftrightarrow> a \<le> c + b"
  15.171 +lemma diff_le_eq[algebra_simps, field_simps]: "a - b \<le> c \<longleftrightarrow> a \<le> c + b"
  15.172  by (auto simp add: le_less diff_less_eq diff_add_cancel add_diff_cancel)
  15.173  
  15.174 -lemma le_diff_eq[algebra_simps]: "a \<le> c - b \<longleftrightarrow> a + b \<le> c"
  15.175 +lemma le_diff_eq[algebra_simps, field_simps]: "a \<le> c - b \<longleftrightarrow> a + b \<le> c"
  15.176  by (auto simp add: le_less less_diff_eq diff_add_cancel add_diff_cancel)
  15.177  
  15.178  lemma le_iff_diff_le_0: "a \<le> b \<longleftrightarrow> a - b \<le> 0"
  15.179  by (simp add: algebra_simps)
  15.180  
  15.181 -text{*Legacy - use @{text algebra_simps} *}
  15.182 -lemmas group_simps[no_atp] = algebra_simps
  15.183 -
  15.184  end
  15.185  
  15.186 -text{*Legacy - use @{text algebra_simps} *}
  15.187 -lemmas group_simps[no_atp] = algebra_simps
  15.188 -
  15.189  class linordered_ab_semigroup_add =
  15.190    linorder + ordered_ab_semigroup_add
  15.191  
    16.1 --- a/src/HOL/HOL.thy	Mon Apr 26 09:37:46 2010 -0700
    16.2 +++ b/src/HOL/HOL.thy	Mon Apr 26 09:45:22 2010 -0700
    16.3 @@ -1869,7 +1869,7 @@
    16.4  proof
    16.5    assume "PROP ?ofclass"
    16.6    show "PROP ?eq"
    16.7 -    by (tactic {* ALLGOALS (rtac (Drule.unconstrainTs @{thm equals_eq})) *}) 
    16.8 +    by (tactic {* ALLGOALS (rtac (Thm.unconstrain_allTs @{thm equals_eq})) *}) 
    16.9        (fact `PROP ?ofclass`)
   16.10  next
   16.11    assume "PROP ?eq"
    17.1 --- a/src/HOL/Import/HOL/real.imp	Mon Apr 26 09:37:46 2010 -0700
    17.2 +++ b/src/HOL/Import/HOL/real.imp	Mon Apr 26 09:45:22 2010 -0700
    17.3 @@ -251,7 +251,7 @@
    17.4    "REAL_INV_INV" > "Rings.inverse_inverse_eq"
    17.5    "REAL_INV_EQ_0" > "Rings.inverse_nonzero_iff_nonzero"
    17.6    "REAL_INV_1OVER" > "Rings.inverse_eq_divide"
    17.7 -  "REAL_INV_0" > "Rings.division_by_zero_class.inverse_zero"
    17.8 +  "REAL_INV_0" > "Rings.division_ring_inverse_zero_class.inverse_zero"
    17.9    "REAL_INVINV" > "Rings.nonzero_inverse_inverse_eq"
   17.10    "REAL_INV1" > "Rings.inverse_1"
   17.11    "REAL_INJ" > "RealDef.real_of_nat_inject"
    18.1 --- a/src/HOL/Import/HOL/realax.imp	Mon Apr 26 09:37:46 2010 -0700
    18.2 +++ b/src/HOL/Import/HOL/realax.imp	Mon Apr 26 09:45:22 2010 -0700
    18.3 @@ -101,7 +101,7 @@
    18.4    "REAL_LT_MUL" > "Rings.mult_pos_pos"
    18.5    "REAL_LT_IADD" > "Groups.add_strict_left_mono"
    18.6    "REAL_LDISTRIB" > "Rings.ring_eq_simps_2"
    18.7 -  "REAL_INV_0" > "Rings.division_by_zero_class.inverse_zero"
    18.8 +  "REAL_INV_0" > "Rings.division_ring_inverse_zero_class.inverse_zero"
    18.9    "REAL_ADD_SYM" > "Finite_Set.AC_add.f.AC_2"
   18.10    "REAL_ADD_LINV" > "HOL4Compat.REAL_ADD_LINV"
   18.11    "REAL_ADD_LID" > "Finite_Set.AC_add.f_e.left_ident"
    19.1 --- a/src/HOL/Int.thy	Mon Apr 26 09:37:46 2010 -0700
    19.2 +++ b/src/HOL/Int.thy	Mon Apr 26 09:45:22 2010 -0700
    19.3 @@ -1995,15 +1995,15 @@
    19.4  text{*Division By @{text "-1"}*}
    19.5  
    19.6  lemma divide_minus1 [simp]:
    19.7 -     "x/-1 = -(x::'a::{field,division_by_zero,number_ring})"
    19.8 +     "x/-1 = -(x::'a::{field,division_ring_inverse_zero,number_ring})"
    19.9  by simp
   19.10  
   19.11  lemma minus1_divide [simp]:
   19.12 -     "-1 / (x::'a::{field,division_by_zero,number_ring}) = - (1/x)"
   19.13 +     "-1 / (x::'a::{field,division_ring_inverse_zero,number_ring}) = - (1/x)"
   19.14  by (simp add: divide_inverse)
   19.15  
   19.16  lemma half_gt_zero_iff:
   19.17 -     "(0 < r/2) = (0 < (r::'a::{linordered_field,division_by_zero,number_ring}))"
   19.18 +     "(0 < r/2) = (0 < (r::'a::{linordered_field,division_ring_inverse_zero,number_ring}))"
   19.19  by auto
   19.20  
   19.21  lemmas half_gt_zero [simp] = half_gt_zero_iff [THEN iffD2, standard]
    20.1 --- a/src/HOL/Lattices.thy	Mon Apr 26 09:37:46 2010 -0700
    20.2 +++ b/src/HOL/Lattices.thy	Mon Apr 26 09:45:22 2010 -0700
    20.3 @@ -365,13 +365,9 @@
    20.4  
    20.5  subsection {* Bounded lattices and boolean algebras *}
    20.6  
    20.7 -class bounded_lattice = lattice + top + bot
    20.8 +class bounded_lattice_bot = lattice + bot
    20.9  begin
   20.10  
   20.11 -lemma dual_bounded_lattice:
   20.12 -  "bounded_lattice (op \<ge>) (op >) (op \<squnion>) (op \<sqinter>) \<top> \<bottom>"
   20.13 -  by unfold_locales (auto simp add: less_le_not_le)
   20.14 -
   20.15  lemma inf_bot_left [simp]:
   20.16    "\<bottom> \<sqinter> x = \<bottom>"
   20.17    by (rule inf_absorb1) simp
   20.18 @@ -380,6 +376,23 @@
   20.19    "x \<sqinter> \<bottom> = \<bottom>"
   20.20    by (rule inf_absorb2) simp
   20.21  
   20.22 +lemma sup_bot_left [simp]:
   20.23 +  "\<bottom> \<squnion> x = x"
   20.24 +  by (rule sup_absorb2) simp
   20.25 +
   20.26 +lemma sup_bot_right [simp]:
   20.27 +  "x \<squnion> \<bottom> = x"
   20.28 +  by (rule sup_absorb1) simp
   20.29 +
   20.30 +lemma sup_eq_bot_iff [simp]:
   20.31 +  "x \<squnion> y = \<bottom> \<longleftrightarrow> x = \<bottom> \<and> y = \<bottom>"
   20.32 +  by (simp add: eq_iff)
   20.33 +
   20.34 +end
   20.35 +
   20.36 +class bounded_lattice_top = lattice + top
   20.37 +begin
   20.38 +
   20.39  lemma sup_top_left [simp]:
   20.40    "\<top> \<squnion> x = \<top>"
   20.41    by (rule sup_absorb1) simp
   20.42 @@ -396,21 +409,18 @@
   20.43    "x \<sqinter> \<top> = x"
   20.44    by (rule inf_absorb1) simp
   20.45  
   20.46 -lemma sup_bot_left [simp]:
   20.47 -  "\<bottom> \<squnion> x = x"
   20.48 -  by (rule sup_absorb2) simp
   20.49 -
   20.50 -lemma sup_bot_right [simp]:
   20.51 -  "x \<squnion> \<bottom> = x"
   20.52 -  by (rule sup_absorb1) simp
   20.53 -
   20.54  lemma inf_eq_top_iff [simp]:
   20.55    "x \<sqinter> y = \<top> \<longleftrightarrow> x = \<top> \<and> y = \<top>"
   20.56    by (simp add: eq_iff)
   20.57  
   20.58 -lemma sup_eq_bot_iff [simp]:
   20.59 -  "x \<squnion> y = \<bottom> \<longleftrightarrow> x = \<bottom> \<and> y = \<bottom>"
   20.60 -  by (simp add: eq_iff)
   20.61 +end
   20.62 +
   20.63 +class bounded_lattice = bounded_lattice_bot + bounded_lattice_top
   20.64 +begin
   20.65 +
   20.66 +lemma dual_bounded_lattice:
   20.67 +  "bounded_lattice (op \<ge>) (op >) (op \<squnion>) (op \<sqinter>) \<top> \<bottom>"
   20.68 +  by unfold_locales (auto simp add: less_le_not_le)
   20.69  
   20.70  end
   20.71  
    21.1 --- a/src/HOL/Library/Abstract_Rat.thy	Mon Apr 26 09:37:46 2010 -0700
    21.2 +++ b/src/HOL/Library/Abstract_Rat.thy	Mon Apr 26 09:45:22 2010 -0700
    21.3 @@ -184,7 +184,7 @@
    21.4  
    21.5  lemma isnormNum_unique[simp]: 
    21.6    assumes na: "isnormNum x" and nb: "isnormNum y" 
    21.7 -  shows "((INum x ::'a::{ring_char_0,field, division_by_zero}) = INum y) = (x = y)" (is "?lhs = ?rhs")
    21.8 +  shows "((INum x ::'a::{ring_char_0,field, division_ring_inverse_zero}) = INum y) = (x = y)" (is "?lhs = ?rhs")
    21.9  proof
   21.10    have "\<exists> a b a' b'. x = (a,b) \<and> y = (a',b')" by auto
   21.11    then obtain a b a' b' where xy[simp]: "x = (a,b)" "y=(a',b')" by blast
   21.12 @@ -217,7 +217,7 @@
   21.13  qed
   21.14  
   21.15  
   21.16 -lemma isnormNum0[simp]: "isnormNum x \<Longrightarrow> (INum x = (0::'a::{ring_char_0, field,division_by_zero})) = (x = 0\<^sub>N)"
   21.17 +lemma isnormNum0[simp]: "isnormNum x \<Longrightarrow> (INum x = (0::'a::{ring_char_0, field,division_ring_inverse_zero})) = (x = 0\<^sub>N)"
   21.18    unfolding INum_int(2)[symmetric]
   21.19    by (rule isnormNum_unique, simp_all)
   21.20  
   21.21 @@ -245,7 +245,7 @@
   21.22  done
   21.23  
   21.24  
   21.25 -lemma normNum[simp]: "INum (normNum x) = (INum x :: 'a::{ring_char_0,field, division_by_zero})"
   21.26 +lemma normNum[simp]: "INum (normNum x) = (INum x :: 'a::{ring_char_0,field, division_ring_inverse_zero})"
   21.27  proof-
   21.28    have "\<exists> a b. x = (a,b)" by auto
   21.29    then obtain a b where x[simp]: "x = (a,b)" by blast
   21.30 @@ -260,7 +260,7 @@
   21.31    ultimately show ?thesis by blast
   21.32  qed
   21.33  
   21.34 -lemma INum_normNum_iff: "(INum x ::'a::{field, division_by_zero, ring_char_0}) = INum y \<longleftrightarrow> normNum x = normNum y" (is "?lhs = ?rhs")
   21.35 +lemma INum_normNum_iff: "(INum x ::'a::{field, division_ring_inverse_zero, ring_char_0}) = INum y \<longleftrightarrow> normNum x = normNum y" (is "?lhs = ?rhs")
   21.36  proof -
   21.37    have "normNum x = normNum y \<longleftrightarrow> (INum (normNum x) :: 'a) = INum (normNum y)"
   21.38      by (simp del: normNum)
   21.39 @@ -268,7 +268,7 @@
   21.40    finally show ?thesis by simp
   21.41  qed
   21.42  
   21.43 -lemma Nadd[simp]: "INum (x +\<^sub>N y) = INum x + (INum y :: 'a :: {ring_char_0,division_by_zero,field})"
   21.44 +lemma Nadd[simp]: "INum (x +\<^sub>N y) = INum x + (INum y :: 'a :: {ring_char_0,division_ring_inverse_zero,field})"
   21.45  proof-
   21.46  let ?z = "0:: 'a"
   21.47    have " \<exists> a b. x = (a,b)" " \<exists> a' b'. y = (a',b')" by auto
   21.48 @@ -300,7 +300,7 @@
   21.49    ultimately show ?thesis by blast
   21.50  qed
   21.51  
   21.52 -lemma Nmul[simp]: "INum (x *\<^sub>N y) = INum x * (INum y:: 'a :: {ring_char_0,division_by_zero,field}) "
   21.53 +lemma Nmul[simp]: "INum (x *\<^sub>N y) = INum x * (INum y:: 'a :: {ring_char_0,division_ring_inverse_zero,field}) "
   21.54  proof-
   21.55    let ?z = "0::'a"
   21.56    have " \<exists> a b. x = (a,b)" " \<exists> a' b'. y = (a',b')" by auto
   21.57 @@ -323,16 +323,16 @@
   21.58  lemma Nneg[simp]: "INum (~\<^sub>N x) = - (INum x ::'a:: field)"
   21.59    by (simp add: Nneg_def split_def INum_def)
   21.60  
   21.61 -lemma Nsub[simp]: shows "INum (x -\<^sub>N y) = INum x - (INum y:: 'a :: {ring_char_0,division_by_zero,field})"
   21.62 +lemma Nsub[simp]: shows "INum (x -\<^sub>N y) = INum x - (INum y:: 'a :: {ring_char_0,division_ring_inverse_zero,field})"
   21.63  by (simp add: Nsub_def split_def)
   21.64  
   21.65 -lemma Ninv[simp]: "INum (Ninv x) = (1::'a :: {division_by_zero,field}) / (INum x)"
   21.66 +lemma Ninv[simp]: "INum (Ninv x) = (1::'a :: {division_ring_inverse_zero,field}) / (INum x)"
   21.67    by (simp add: Ninv_def INum_def split_def)
   21.68  
   21.69 -lemma Ndiv[simp]: "INum (x \<div>\<^sub>N y) = INum x / (INum y ::'a :: {ring_char_0, division_by_zero,field})" by (simp add: Ndiv_def)
   21.70 +lemma Ndiv[simp]: "INum (x \<div>\<^sub>N y) = INum x / (INum y ::'a :: {ring_char_0, division_ring_inverse_zero,field})" by (simp add: Ndiv_def)
   21.71  
   21.72  lemma Nlt0_iff[simp]: assumes nx: "isnormNum x" 
   21.73 -  shows "((INum x :: 'a :: {ring_char_0,division_by_zero,linordered_field})< 0) = 0>\<^sub>N x "
   21.74 +  shows "((INum x :: 'a :: {ring_char_0,division_ring_inverse_zero,linordered_field})< 0) = 0>\<^sub>N x "
   21.75  proof-
   21.76    have " \<exists> a b. x = (a,b)" by simp
   21.77    then obtain a b where x[simp]:"x = (a,b)" by blast
   21.78 @@ -345,7 +345,7 @@
   21.79  qed
   21.80  
   21.81  lemma Nle0_iff[simp]:assumes nx: "isnormNum x" 
   21.82 -  shows "((INum x :: 'a :: {ring_char_0,division_by_zero,linordered_field}) \<le> 0) = 0\<ge>\<^sub>N x"
   21.83 +  shows "((INum x :: 'a :: {ring_char_0,division_ring_inverse_zero,linordered_field}) \<le> 0) = 0\<ge>\<^sub>N x"
   21.84  proof-
   21.85    have " \<exists> a b. x = (a,b)" by simp
   21.86    then obtain a b where x[simp]:"x = (a,b)" by blast
   21.87 @@ -357,7 +357,7 @@
   21.88    ultimately show ?thesis by blast
   21.89  qed
   21.90  
   21.91 -lemma Ngt0_iff[simp]:assumes nx: "isnormNum x" shows "((INum x :: 'a :: {ring_char_0,division_by_zero,linordered_field})> 0) = 0<\<^sub>N x"
   21.92 +lemma Ngt0_iff[simp]:assumes nx: "isnormNum x" shows "((INum x :: 'a :: {ring_char_0,division_ring_inverse_zero,linordered_field})> 0) = 0<\<^sub>N x"
   21.93  proof-
   21.94    have " \<exists> a b. x = (a,b)" by simp
   21.95    then obtain a b where x[simp]:"x = (a,b)" by blast
   21.96 @@ -369,7 +369,7 @@
   21.97    ultimately show ?thesis by blast
   21.98  qed
   21.99  lemma Nge0_iff[simp]:assumes nx: "isnormNum x" 
  21.100 -  shows "((INum x :: 'a :: {ring_char_0,division_by_zero,linordered_field}) \<ge> 0) = 0\<le>\<^sub>N x"
  21.101 +  shows "((INum x :: 'a :: {ring_char_0,division_ring_inverse_zero,linordered_field}) \<ge> 0) = 0\<le>\<^sub>N x"
  21.102  proof-
  21.103    have " \<exists> a b. x = (a,b)" by simp
  21.104    then obtain a b where x[simp]:"x = (a,b)" by blast
  21.105 @@ -382,7 +382,7 @@
  21.106  qed
  21.107  
  21.108  lemma Nlt_iff[simp]: assumes nx: "isnormNum x" and ny: "isnormNum y"
  21.109 -  shows "((INum x :: 'a :: {ring_char_0,division_by_zero,linordered_field}) < INum y) = (x <\<^sub>N y)"
  21.110 +  shows "((INum x :: 'a :: {ring_char_0,division_ring_inverse_zero,linordered_field}) < INum y) = (x <\<^sub>N y)"
  21.111  proof-
  21.112    let ?z = "0::'a"
  21.113    have "((INum x ::'a) < INum y) = (INum (x -\<^sub>N y) < ?z)" using nx ny by simp
  21.114 @@ -391,7 +391,7 @@
  21.115  qed
  21.116  
  21.117  lemma Nle_iff[simp]: assumes nx: "isnormNum x" and ny: "isnormNum y"
  21.118 -  shows "((INum x :: 'a :: {ring_char_0,division_by_zero,linordered_field})\<le> INum y) = (x \<le>\<^sub>N y)"
  21.119 +  shows "((INum x :: 'a :: {ring_char_0,division_ring_inverse_zero,linordered_field})\<le> INum y) = (x \<le>\<^sub>N y)"
  21.120  proof-
  21.121    have "((INum x ::'a) \<le> INum y) = (INum (x -\<^sub>N y) \<le> (0::'a))" using nx ny by simp
  21.122    also have "\<dots> = (0\<ge>\<^sub>N (x -\<^sub>N y))" using Nle0_iff[OF Nsub_normN[OF ny]] by simp
  21.123 @@ -399,7 +399,7 @@
  21.124  qed
  21.125  
  21.126  lemma Nadd_commute:
  21.127 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  21.128 +  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero,field})"
  21.129    shows "x +\<^sub>N y = y +\<^sub>N x"
  21.130  proof-
  21.131    have n: "isnormNum (x +\<^sub>N y)" "isnormNum (y +\<^sub>N x)" by simp_all
  21.132 @@ -408,7 +408,7 @@
  21.133  qed
  21.134  
  21.135  lemma [simp]:
  21.136 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  21.137 +  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero,field})"
  21.138    shows "(0, b) +\<^sub>N y = normNum y"
  21.139      and "(a, 0) +\<^sub>N y = normNum y" 
  21.140      and "x +\<^sub>N (0, b) = normNum x"
  21.141 @@ -420,7 +420,7 @@
  21.142    done
  21.143  
  21.144  lemma normNum_nilpotent_aux[simp]:
  21.145 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  21.146 +  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero,field})"
  21.147    assumes nx: "isnormNum x" 
  21.148    shows "normNum x = x"
  21.149  proof-
  21.150 @@ -432,7 +432,7 @@
  21.151  qed
  21.152  
  21.153  lemma normNum_nilpotent[simp]:
  21.154 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  21.155 +  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero,field})"
  21.156    shows "normNum (normNum x) = normNum x"
  21.157    by simp
  21.158  
  21.159 @@ -440,11 +440,11 @@
  21.160    by (simp_all add: normNum_def)
  21.161  
  21.162  lemma normNum_Nadd:
  21.163 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  21.164 +  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero,field})"
  21.165    shows "normNum (x +\<^sub>N y) = x +\<^sub>N y" by simp
  21.166  
  21.167  lemma Nadd_normNum1[simp]:
  21.168 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  21.169 +  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero,field})"
  21.170    shows "normNum x +\<^sub>N y = x +\<^sub>N y"
  21.171  proof-
  21.172    have n: "isnormNum (normNum x +\<^sub>N y)" "isnormNum (x +\<^sub>N y)" by simp_all
  21.173 @@ -454,7 +454,7 @@
  21.174  qed
  21.175  
  21.176  lemma Nadd_normNum2[simp]:
  21.177 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  21.178 +  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero,field})"
  21.179    shows "x +\<^sub>N normNum y = x +\<^sub>N y"
  21.180  proof-
  21.181    have n: "isnormNum (x +\<^sub>N normNum y)" "isnormNum (x +\<^sub>N y)" by simp_all
  21.182 @@ -464,7 +464,7 @@
  21.183  qed
  21.184  
  21.185  lemma Nadd_assoc:
  21.186 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  21.187 +  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero,field})"
  21.188    shows "x +\<^sub>N y +\<^sub>N z = x +\<^sub>N (y +\<^sub>N z)"
  21.189  proof-
  21.190    have n: "isnormNum (x +\<^sub>N y +\<^sub>N z)" "isnormNum (x +\<^sub>N (y +\<^sub>N z))" by simp_all
  21.191 @@ -476,7 +476,7 @@
  21.192    by (simp add: Nmul_def split_def Let_def gcd_commute_int mult_commute)
  21.193  
  21.194  lemma Nmul_assoc:
  21.195 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  21.196 +  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero,field})"
  21.197    assumes nx: "isnormNum x" and ny:"isnormNum y" and nz:"isnormNum z"
  21.198    shows "x *\<^sub>N y *\<^sub>N z = x *\<^sub>N (y *\<^sub>N z)"
  21.199  proof-
  21.200 @@ -487,7 +487,7 @@
  21.201  qed
  21.202  
  21.203  lemma Nsub0:
  21.204 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  21.205 +  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero,field})"
  21.206    assumes x: "isnormNum x" and y:"isnormNum y" shows "(x -\<^sub>N y = 0\<^sub>N) = (x = y)"
  21.207  proof-
  21.208    { fix h :: 'a
  21.209 @@ -502,7 +502,7 @@
  21.210    by (simp_all add: Nmul_def Let_def split_def)
  21.211  
  21.212  lemma Nmul_eq0[simp]:
  21.213 -  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_by_zero,field})"
  21.214 +  assumes "SORT_CONSTRAINT('a::{ring_char_0,division_ring_inverse_zero,field})"
  21.215    assumes nx:"isnormNum x" and ny: "isnormNum y"
  21.216    shows "(x*\<^sub>N y = 0\<^sub>N) = (x = 0\<^sub>N \<or> y = 0\<^sub>N)"
  21.217  proof-
    22.1 --- a/src/HOL/Library/Binomial.thy	Mon Apr 26 09:37:46 2010 -0700
    22.2 +++ b/src/HOL/Library/Binomial.thy	Mon Apr 26 09:45:22 2010 -0700
    22.3 @@ -236,10 +236,10 @@
    22.4      have th1: "(\<Prod>n\<in>{1\<Colon>nat..n}. a + of_nat n) =
    22.5        (\<Prod>n\<in>{0\<Colon>nat..n - 1}. a + 1 + of_nat n)"
    22.6        apply (rule setprod_reindex_cong[where f = "Suc"])
    22.7 -      using n0 by (auto simp add: expand_fun_eq ring_simps)
    22.8 +      using n0 by (auto simp add: expand_fun_eq field_simps)
    22.9      have ?thesis apply (simp add: pochhammer_def)
   22.10      unfolding setprod_insert[OF th0, unfolded eq]
   22.11 -    using th1 by (simp add: ring_simps)}
   22.12 +    using th1 by (simp add: field_simps)}
   22.13  ultimately show ?thesis by blast
   22.14  qed
   22.15  
   22.16 @@ -378,10 +378,10 @@
   22.17        by simp
   22.18      from n h th0 
   22.19      have "fact k * fact (n - k) * (n choose k) = k * (fact h * fact (m - h) * (m choose h)) +  (m - h) * (fact k * fact (m - k) * (m choose k))"
   22.20 -      by (simp add: ring_simps)
   22.21 +      by (simp add: field_simps)
   22.22      also have "\<dots> = (k + (m - h)) * fact m"
   22.23        using H[rule_format, OF mn hm'] H[rule_format, OF mn km]
   22.24 -      by (simp add: ring_simps)
   22.25 +      by (simp add: field_simps)
   22.26      finally have ?ths using h n km by simp}
   22.27    moreover have "n=0 \<or> k = 0 \<or> k = n \<or> (EX m h. n=Suc m \<and> k = Suc h \<and> h < m)" using kn by presburger
   22.28    ultimately show ?ths by blast
   22.29 @@ -391,13 +391,13 @@
   22.30    assumes kn: "k \<le> n" 
   22.31    shows "(of_nat (n choose k) :: 'a::field_char_0) = of_nat (fact n) / (of_nat (fact k) * of_nat (fact (n - k)))"
   22.32    using binomial_fact_lemma[OF kn]
   22.33 -  by (simp add: field_eq_simps of_nat_mult [symmetric])
   22.34 +  by (simp add: field_simps of_nat_mult [symmetric])
   22.35  
   22.36  lemma binomial_gbinomial: "of_nat (n choose k) = of_nat n gchoose k"
   22.37  proof-
   22.38    {assume kn: "k > n" 
   22.39      from kn binomial_eq_0[OF kn] have ?thesis 
   22.40 -      by (simp add: gbinomial_pochhammer field_eq_simps
   22.41 +      by (simp add: gbinomial_pochhammer field_simps
   22.42          pochhammer_of_nat_eq_0_iff)}
   22.43    moreover
   22.44    {assume "k=0" then have ?thesis by simp}
   22.45 @@ -414,13 +414,13 @@
   22.46        apply clarsimp
   22.47        apply (presburger)
   22.48        apply presburger
   22.49 -      by (simp add: expand_fun_eq ring_simps of_nat_add[symmetric] del: of_nat_add)
   22.50 +      by (simp add: expand_fun_eq field_simps of_nat_add[symmetric] del: of_nat_add)
   22.51      have th0: "finite {1..n - Suc h}" "finite {n - h .. n}" 
   22.52  "{1..n - Suc h} \<inter> {n - h .. n} = {}" and eq3: "{1..n - Suc h} \<union> {n - h .. n} = {1..n}" using h kn by auto
   22.53      from eq[symmetric]
   22.54      have ?thesis using kn
   22.55        apply (simp add: binomial_fact[OF kn, where ?'a = 'a] 
   22.56 -        gbinomial_pochhammer field_eq_simps pochhammer_Suc_setprod)
   22.57 +        gbinomial_pochhammer field_simps pochhammer_Suc_setprod)
   22.58        apply (simp add: pochhammer_Suc_setprod fact_altdef_nat h of_nat_setprod setprod_timesf[symmetric] eq' del: One_nat_def power_Suc)
   22.59        unfolding setprod_Un_disjoint[OF th0, unfolded eq3, of "of_nat:: nat \<Rightarrow> 'a"] eq[unfolded h]
   22.60        unfolding mult_assoc[symmetric] 
   22.61 @@ -449,9 +449,9 @@
   22.62    have "?r = ((- 1) ^n * pochhammer (- a) n / of_nat (fact n)) * (of_nat n - (- a + of_nat n))"
   22.63      unfolding gbinomial_pochhammer
   22.64      pochhammer_Suc fact_Suc of_nat_mult right_diff_distrib power_Suc
   22.65 -    by (simp add:  field_eq_simps del: of_nat_Suc)
   22.66 +    by (simp add:  field_simps del: of_nat_Suc)
   22.67    also have "\<dots> = ?l" unfolding gbinomial_pochhammer
   22.68 -    by (simp add: ring_simps)
   22.69 +    by (simp add: field_simps)
   22.70    finally show ?thesis ..
   22.71  qed
   22.72  
   22.73 @@ -482,17 +482,17 @@
   22.74  
   22.75      have "of_nat (fact (Suc k)) * (a gchoose k + (a gchoose (Suc k))) = ((a gchoose Suc h) * of_nat (fact (Suc h)) * of_nat (Suc k)) + (\<Prod>i\<in>{0\<Colon>nat..Suc h}. a - of_nat i)" 
   22.76        unfolding h
   22.77 -      apply (simp add: ring_simps del: fact_Suc)
   22.78 +      apply (simp add: field_simps del: fact_Suc)
   22.79        unfolding gbinomial_mult_fact'
   22.80        apply (subst fact_Suc)
   22.81        unfolding of_nat_mult 
   22.82        apply (subst mult_commute)
   22.83        unfolding mult_assoc
   22.84        unfolding gbinomial_mult_fact
   22.85 -      by (simp add: ring_simps)
   22.86 +      by (simp add: field_simps)
   22.87      also have "\<dots> = (\<Prod>i\<in>{0..h}. a - of_nat i) * (a + 1)"
   22.88        unfolding gbinomial_mult_fact' setprod_nat_ivl_Suc
   22.89 -      by (simp add: ring_simps h)
   22.90 +      by (simp add: field_simps h)
   22.91      also have "\<dots> = (\<Prod>i\<in>{0..k}. (a + 1) - of_nat i)"
   22.92        using eq0
   22.93        unfolding h  setprod_nat_ivl_1_Suc
    23.1 --- a/src/HOL/Library/Bit.thy	Mon Apr 26 09:37:46 2010 -0700
    23.2 +++ b/src/HOL/Library/Bit.thy	Mon Apr 26 09:45:22 2010 -0700
    23.3 @@ -49,7 +49,7 @@
    23.4  
    23.5  subsection {* Type @{typ bit} forms a field *}
    23.6  
    23.7 -instantiation bit :: "{field, division_by_zero}"
    23.8 +instantiation bit :: "{field, division_ring_inverse_zero}"
    23.9  begin
   23.10  
   23.11  definition plus_bit_def:
    24.1 --- a/src/HOL/Library/Formal_Power_Series.thy	Mon Apr 26 09:37:46 2010 -0700
    24.2 +++ b/src/HOL/Library/Formal_Power_Series.thy	Mon Apr 26 09:45:22 2010 -0700
    24.3 @@ -588,7 +588,7 @@
    24.4    from k have "real k > - log y x" by simp
    24.5    then have "ln y * real k > - ln x" unfolding log_def
    24.6      using ln_gt_zero_iff[OF yp] y1
    24.7 -    by (simp add: minus_divide_left field_simps field_eq_simps del:minus_divide_left[symmetric])
    24.8 +    by (simp add: minus_divide_left field_simps del:minus_divide_left[symmetric])
    24.9    then have "ln y * real k + ln x > 0" by simp
   24.10    then have "exp (real k * ln y + ln x) > exp 0"
   24.11      by (simp add: mult_ac)
   24.12 @@ -596,7 +596,7 @@
   24.13      unfolding exp_zero exp_add exp_real_of_nat_mult
   24.14      exp_ln[OF xp] exp_ln[OF yp] by simp
   24.15    then have "x > (1/y)^k" using yp 
   24.16 -    by (simp add: field_simps field_eq_simps nonzero_power_divide)
   24.17 +    by (simp add: field_simps nonzero_power_divide)
   24.18    then show ?thesis using kp by blast
   24.19  qed
   24.20  lemma X_nth[simp]: "X$n = (if n = 1 then 1 else 0)" by (simp add: X_def)
   24.21 @@ -693,7 +693,7 @@
   24.22      from th0[symmetric, unfolded nonzero_divide_eq_eq[OF f0]]
   24.23      have th1: "setsum (\<lambda>i. f$i * natfun_inverse f (n - i)) {1..n} =
   24.24        - (f$0) * (inverse f)$n"
   24.25 -      by (simp add: ring_simps)
   24.26 +      by (simp add: field_simps)
   24.27      have "(f * inverse f) $ n = (\<Sum>i = 0..n. f $i * natfun_inverse f (n - i))"
   24.28        unfolding fps_mult_nth ifn ..
   24.29      also have "\<dots> = f$0 * natfun_inverse f n
   24.30 @@ -766,7 +766,7 @@
   24.31  lemma fps_deriv_nth[simp]: "fps_deriv f $ n = of_nat (n +1) * f $ (n+1)" by (simp add: fps_deriv_def)
   24.32  
   24.33  lemma fps_deriv_linear[simp]: "fps_deriv (fps_const (a::'a::comm_semiring_1) * f + fps_const b * g) = fps_const a * fps_deriv f + fps_const b * fps_deriv g"
   24.34 -  unfolding fps_eq_iff fps_add_nth  fps_const_mult_left fps_deriv_nth by (simp add: ring_simps)
   24.35 +  unfolding fps_eq_iff fps_add_nth  fps_const_mult_left fps_deriv_nth by (simp add: field_simps)
   24.36  
   24.37  lemma fps_deriv_mult[simp]:
   24.38    fixes f :: "('a :: comm_ring_1) fps"
   24.39 @@ -817,7 +817,7 @@
   24.40        unfolding s0 s1
   24.41        unfolding setsum_addf[symmetric] setsum_right_distrib
   24.42        apply (rule setsum_cong2)
   24.43 -      by (auto simp add: of_nat_diff ring_simps)
   24.44 +      by (auto simp add: of_nat_diff field_simps)
   24.45      finally have "(f * ?D g + ?D f * g) $ n = ?D (f*g) $ n" .}
   24.46    then show ?thesis unfolding fps_eq_iff by auto
   24.47  qed
   24.48 @@ -878,7 +878,7 @@
   24.49  proof-
   24.50    have "fps_deriv f = fps_deriv g \<longleftrightarrow> fps_deriv (f - g) = 0" by simp
   24.51    also have "\<dots> \<longleftrightarrow> f - g = fps_const ((f-g)$0)" unfolding fps_deriv_eq_0_iff ..
   24.52 -  finally show ?thesis by (simp add: ring_simps)
   24.53 +  finally show ?thesis by (simp add: field_simps)
   24.54  qed
   24.55  
   24.56  lemma fps_deriv_eq_iff_ex: "(fps_deriv f = fps_deriv g) \<longleftrightarrow> (\<exists>(c::'a::{idom,semiring_char_0}). f = fps_const c + g)"
   24.57 @@ -929,7 +929,7 @@
   24.58  qed
   24.59  
   24.60  lemma fps_deriv_maclauren_0: "(fps_nth_deriv k (f:: ('a::comm_semiring_1) fps)) $ 0 = of_nat (fact k) * f$(k)"
   24.61 -  by (induct k arbitrary: f) (auto simp add: ring_simps of_nat_mult)
   24.62 +  by (induct k arbitrary: f) (auto simp add: field_simps of_nat_mult)
   24.63  
   24.64  subsection {* Powers*}
   24.65  
   24.66 @@ -943,7 +943,7 @@
   24.67    case (Suc n)
   24.68    note h = Suc.hyps[OF `a$0 = 1`]
   24.69    show ?case unfolding power_Suc fps_mult_nth
   24.70 -    using h `a$0 = 1`  fps_power_zeroth_eq_one[OF `a$0=1`] by (simp add: ring_simps)
   24.71 +    using h `a$0 = 1`  fps_power_zeroth_eq_one[OF `a$0=1`] by (simp add: field_simps)
   24.72  qed
   24.73  
   24.74  lemma startsby_one_power:"a $ 0 = (1::'a::comm_ring_1) \<Longrightarrow> a^n $ 0 = 1"
   24.75 @@ -1005,7 +1005,7 @@
   24.76    case 0 thus ?case by (simp add: power_0)
   24.77  next
   24.78    case (Suc n)
   24.79 -  have "a ^ Suc n $ (Suc n) = (a^n * a)$(Suc n)" by (simp add: ring_simps power_Suc)
   24.80 +  have "a ^ Suc n $ (Suc n) = (a^n * a)$(Suc n)" by (simp add: field_simps power_Suc)
   24.81    also have "\<dots> = setsum (\<lambda>i. a^n$i * a $ (Suc n - i)) {0.. Suc n}" by (simp add: fps_mult_nth)
   24.82    also have "\<dots> = setsum (\<lambda>i. a^n$i * a $ (Suc n - i)) {n .. Suc n}"
   24.83      apply (rule setsum_mono_zero_right)
   24.84 @@ -1045,8 +1045,8 @@
   24.85  qed
   24.86  
   24.87  lemma fps_deriv_power: "fps_deriv (a ^ n) = fps_const (of_nat n :: 'a:: comm_ring_1) * fps_deriv a * a ^ (n - 1)"
   24.88 -  apply (induct n, auto simp add: power_Suc ring_simps fps_const_add[symmetric] simp del: fps_const_add)
   24.89 -  by (case_tac n, auto simp add: power_Suc ring_simps)
   24.90 +  apply (induct n, auto simp add: power_Suc field_simps fps_const_add[symmetric] simp del: fps_const_add)
   24.91 +  by (case_tac n, auto simp add: power_Suc field_simps)
   24.92  
   24.93  lemma fps_inverse_deriv:
   24.94    fixes a:: "('a :: field) fps"
   24.95 @@ -1060,11 +1060,11 @@
   24.96    with inverse_mult_eq_1[OF a0]
   24.97    have "inverse a ^ 2 * fps_deriv a + fps_deriv (inverse a) = 0"
   24.98      unfolding power2_eq_square
   24.99 -    apply (simp add: ring_simps)
  24.100 +    apply (simp add: field_simps)
  24.101      by (simp add: mult_assoc[symmetric])
  24.102    hence "inverse a ^ 2 * fps_deriv a + fps_deriv (inverse a) - fps_deriv a * inverse a ^ 2 = 0 - fps_deriv a * inverse a ^ 2"
  24.103      by simp
  24.104 -  then show "fps_deriv (inverse a) = - fps_deriv a * inverse a ^ 2" by (simp add: ring_simps)
  24.105 +  then show "fps_deriv (inverse a) = - fps_deriv a * inverse a ^ 2" by (simp add: field_simps)
  24.106  qed
  24.107  
  24.108  lemma fps_inverse_mult:
  24.109 @@ -1084,7 +1084,7 @@
  24.110      from inverse_mult_eq_1[OF ab0]
  24.111      have "inverse (a*b) * (a*b) * inverse a * inverse b = 1 * inverse a * inverse b" by simp
  24.112      then have "inverse (a*b) * (inverse a * a) * (inverse b * b) = inverse a * inverse b"
  24.113 -      by (simp add: ring_simps)
  24.114 +      by (simp add: field_simps)
  24.115      then have ?thesis using inverse_mult_eq_1[OF a0] inverse_mult_eq_1[OF b0] by simp}
  24.116  ultimately show ?thesis by blast
  24.117  qed
  24.118 @@ -1105,7 +1105,7 @@
  24.119    assumes a0: "b$0 \<noteq> 0"
  24.120    shows "fps_deriv (a / b) = (fps_deriv a * b - a * fps_deriv b) / b ^ 2"
  24.121    using fps_inverse_deriv[OF a0]
  24.122 -  by (simp add: fps_divide_def ring_simps power2_eq_square fps_inverse_mult inverse_mult_eq_1'[OF a0])
  24.123 +  by (simp add: fps_divide_def field_simps power2_eq_square fps_inverse_mult inverse_mult_eq_1'[OF a0])
  24.124  
  24.125  
  24.126  lemma fps_inverse_gp': "inverse (Abs_fps(\<lambda>n. (1::'a::field)))
  24.127 @@ -1121,7 +1121,7 @@
  24.128  proof-
  24.129    have eq: "(1 + X) * ?r = 1"
  24.130      unfolding minus_one_power_iff
  24.131 -    by (auto simp add: ring_simps fps_eq_iff)
  24.132 +    by (auto simp add: field_simps fps_eq_iff)
  24.133    show ?thesis by (auto simp add: eq intro: fps_inverse_unique)
  24.134  qed
  24.135  
  24.136 @@ -1185,7 +1185,7 @@
  24.137      next
  24.138        case (Suc k)
  24.139        note th = Suc.hyps[symmetric]
  24.140 -      have "(Abs_fps a - setsum (\<lambda>i. fps_const (a i :: 'a) * X^i) {0 .. Suc k})$n = (Abs_fps a - setsum (\<lambda>i. fps_const (a i :: 'a) * X^i) {0 .. k} - fps_const (a (Suc k)) * X^ Suc k) $ n" by (simp add: ring_simps)
  24.141 +      have "(Abs_fps a - setsum (\<lambda>i. fps_const (a i :: 'a) * X^i) {0 .. Suc k})$n = (Abs_fps a - setsum (\<lambda>i. fps_const (a i :: 'a) * X^i) {0 .. k} - fps_const (a (Suc k)) * X^ Suc k) $ n" by (simp add: field_simps)
  24.142        also  have "\<dots> = (if n < Suc k then 0 else a n) - (fps_const (a (Suc k)) * X^ Suc k)$n"
  24.143          using th
  24.144          unfolding fps_sub_nth by simp
  24.145 @@ -1209,10 +1209,10 @@
  24.146  definition "XD = op * X o fps_deriv"
  24.147  
  24.148  lemma XD_add[simp]:"XD (a + b) = XD a + XD (b :: ('a::comm_ring_1) fps)"
  24.149 -  by (simp add: XD_def ring_simps)
  24.150 +  by (simp add: XD_def field_simps)
  24.151  
  24.152  lemma XD_mult_const[simp]:"XD (fps_const (c::'a::comm_ring_1) * a) = fps_const c * XD a"
  24.153 -  by (simp add: XD_def ring_simps)
  24.154 +  by (simp add: XD_def field_simps)
  24.155  
  24.156  lemma XD_linear[simp]: "XD (fps_const c * a + fps_const d * b) = fps_const c * XD a + fps_const d * XD (b :: ('a::comm_ring_1) fps)"
  24.157    by simp
  24.158 @@ -1226,7 +1226,7 @@
  24.159  
  24.160  lemma fps_mult_XD_shift:
  24.161    "(XD ^^ k) (a:: ('a::{comm_ring_1}) fps) = Abs_fps (\<lambda>n. (of_nat n ^ k) * a$n)"
  24.162 -  by (induct k arbitrary: a) (simp_all add: power_Suc XD_def fps_eq_iff ring_simps del: One_nat_def)
  24.163 +  by (induct k arbitrary: a) (simp_all add: power_Suc XD_def fps_eq_iff field_simps del: One_nat_def)
  24.164  
  24.165  subsubsection{* Rule 3 is trivial and is given by @{text fps_times_def}*}
  24.166  subsubsection{* Rule 5 --- summation and "division" by (1 - X)*}
  24.167 @@ -1688,7 +1688,7 @@
  24.168          then have "setsum ?f ?Pnkn = of_nat (k+1) * ?r $ n * r (Suc k) (a $ 0) ^ k"
  24.169            by (simp add: natpermute_max_card[OF nz, simplified])
  24.170          also have "\<dots> = a$n - setsum ?f ?Pnknn"
  24.171 -          unfolding n1 using r00 a0 by (simp add: field_eq_simps fps_radical_def del: of_nat_Suc)
  24.172 +          unfolding n1 using r00 a0 by (simp add: field_simps fps_radical_def del: of_nat_Suc)
  24.173          finally have fn: "setsum ?f ?Pnkn = a$n - setsum ?f ?Pnknn" .
  24.174          have "(?r ^ Suc k)$n = setsum ?f ?Pnkn + setsum ?f ?Pnknn"
  24.175            unfolding fps_power_nth_Suc setsum_Un_disjoint[OF f d, unfolded eq] ..
  24.176 @@ -1764,7 +1764,7 @@
  24.177    shows "a = b / c"
  24.178  proof-
  24.179    from eq have "a * c * inverse c = b * inverse c" by simp
  24.180 -  hence "a * (inverse c * c) = b/c" by (simp only: field_eq_simps divide_inverse)
  24.181 +  hence "a * (inverse c * c) = b/c" by (simp only: field_simps divide_inverse)
  24.182    then show "a = b/c" unfolding  field_inverse[OF c0] by simp
  24.183  qed
  24.184  
  24.185 @@ -1837,7 +1837,7 @@
  24.186            show "a$(xs !i) = ?r$(xs!i)" .
  24.187          qed
  24.188          have th00: "\<And>(x::'a). of_nat (Suc k) * (x * inverse (of_nat (Suc k))) = x"
  24.189 -          by (simp add: field_eq_simps del: of_nat_Suc)
  24.190 +          by (simp add: field_simps del: of_nat_Suc)
  24.191          from H have "b$n = a^Suc k $ n" by (simp add: fps_eq_iff)
  24.192          also have "a ^ Suc k$n = setsum ?g ?Pnkn + setsum ?g ?Pnknn"
  24.193            unfolding fps_power_nth_Suc
  24.194 @@ -1854,7 +1854,7 @@
  24.195          then have "a$n = ?r $n"
  24.196            apply (simp del: of_nat_Suc)
  24.197            unfolding fps_radical_def n1
  24.198 -          by (simp add: field_eq_simps n1 th00 del: of_nat_Suc)}
  24.199 +          by (simp add: field_simps n1 th00 del: of_nat_Suc)}
  24.200          ultimately show "a$n = ?r $ n" by (cases n, auto)
  24.201        qed}
  24.202      then have "a = ?r" by (simp add: fps_eq_iff)}
  24.203 @@ -2018,11 +2018,11 @@
  24.204  proof-
  24.205    {fix n
  24.206      have "(fps_deriv (a oo b))$n = setsum (\<lambda>i. a $ i * (fps_deriv (b^i))$n) {0.. Suc n}"
  24.207 -      by (simp add: fps_compose_def ring_simps setsum_right_distrib del: of_nat_Suc)
  24.208 +      by (simp add: fps_compose_def field_simps setsum_right_distrib del: of_nat_Suc)
  24.209      also have "\<dots> = setsum (\<lambda>i. a$i * ((fps_const (of_nat i)) * (fps_deriv b * (b^(i - 1))))$n) {0.. Suc n}"
  24.210 -      by (simp add: ring_simps fps_deriv_power del: fps_mult_left_const_nth of_nat_Suc)
  24.211 +      by (simp add: field_simps fps_deriv_power del: fps_mult_left_const_nth of_nat_Suc)
  24.212    also have "\<dots> = setsum (\<lambda>i. of_nat i * a$i * (((b^(i - 1)) * fps_deriv b))$n) {0.. Suc n}"
  24.213 -    unfolding fps_mult_left_const_nth  by (simp add: ring_simps)
  24.214 +    unfolding fps_mult_left_const_nth  by (simp add: field_simps)
  24.215    also have "\<dots> = setsum (\<lambda>i. of_nat i * a$i * (setsum (\<lambda>j. (b^ (i - 1))$j * (fps_deriv b)$(n - j)) {0..n})) {0.. Suc n}"
  24.216      unfolding fps_mult_nth ..
  24.217    also have "\<dots> = setsum (\<lambda>i. of_nat i * a$i * (setsum (\<lambda>j. (b^ (i - 1))$j * (fps_deriv b)$(n - j)) {0..n})) {1.. Suc n}"
  24.218 @@ -2170,7 +2170,7 @@
  24.219    by (auto simp add: fps_eq_iff fps_compose_nth power_0_left setsum_0')
  24.220  
  24.221  lemma fps_compose_add_distrib: "(a + b) oo c = (a oo c) + (b oo c)"
  24.222 -  by (simp add: fps_eq_iff fps_compose_nth ring_simps setsum_addf)
  24.223 +  by (simp add: fps_eq_iff fps_compose_nth field_simps setsum_addf)
  24.224  
  24.225  lemma fps_compose_setsum_distrib: "(setsum f S) oo a = setsum (\<lambda>i. f i oo a) S"
  24.226  proof-
  24.227 @@ -2212,7 +2212,7 @@
  24.228      apply (simp add: fps_mult_nth setsum_right_distrib)
  24.229      apply (subst setsum_commute)
  24.230      apply (rule setsum_cong2)
  24.231 -    by (auto simp add: ring_simps)
  24.232 +    by (auto simp add: field_simps)
  24.233    also have "\<dots> = ?l"
  24.234      apply (simp add: fps_mult_nth fps_compose_nth setsum_product)
  24.235      apply (rule setsum_cong2)
  24.236 @@ -2312,7 +2312,7 @@
  24.237  qed
  24.238  
  24.239  lemma fps_compose_uminus: "- (a::'a::ring_1 fps) oo c = - (a oo c)"
  24.240 -  by (simp add: fps_eq_iff fps_compose_nth ring_simps setsum_negf[symmetric])
  24.241 +  by (simp add: fps_eq_iff fps_compose_nth field_simps setsum_negf[symmetric])
  24.242  
  24.243  lemma fps_compose_sub_distrib:
  24.244    shows "(a - b) oo (c::'a::ring_1 fps) = (a oo c) - (b oo c)"
  24.245 @@ -2469,7 +2469,7 @@
  24.246  proof-
  24.247    let ?r = "fps_inv"
  24.248    have ra0: "?r a $ 0 = 0" by (simp add: fps_inv_def)
  24.249 -  from a1 have ra1: "?r a $ 1 \<noteq> 0" by (simp add: fps_inv_def field_eq_simps)
  24.250 +  from a1 have ra1: "?r a $ 1 \<noteq> 0" by (simp add: fps_inv_def field_simps)
  24.251    have X0: "X$0 = 0" by simp
  24.252    from fps_inv[OF ra0 ra1] have "?r (?r a) oo ?r a = X" .
  24.253    then have "?r (?r a) oo ?r a oo a = X oo a" by simp
  24.254 @@ -2486,7 +2486,7 @@
  24.255  proof-
  24.256    let ?r = "fps_ginv"
  24.257    from c0 have rca0: "?r c a $0 = 0" by (simp add: fps_ginv_def)
  24.258 -  from a1 c1 have rca1: "?r c a $ 1 \<noteq> 0" by (simp add: fps_ginv_def field_eq_simps)
  24.259 +  from a1 c1 have rca1: "?r c a $ 1 \<noteq> 0" by (simp add: fps_ginv_def field_simps)
  24.260    from fps_ginv[OF rca0 rca1] 
  24.261    have "?r b (?r c a) oo ?r c a = b" .
  24.262    then have "?r b (?r c a) oo ?r c a oo a = b oo a" by simp
  24.263 @@ -2534,8 +2534,8 @@
  24.264  proof-
  24.265    {fix n
  24.266      have "?l$n = ?r $ n"
  24.267 -  apply (auto simp add: E_def field_eq_simps power_Suc[symmetric]simp del: fact_Suc of_nat_Suc power_Suc)
  24.268 -  by (simp add: of_nat_mult ring_simps)}
  24.269 +  apply (auto simp add: E_def field_simps power_Suc[symmetric]simp del: fact_Suc of_nat_Suc power_Suc)
  24.270 +  by (simp add: of_nat_mult field_simps)}
  24.271  then show ?thesis by (simp add: fps_eq_iff)
  24.272  qed
  24.273  
  24.274 @@ -2545,15 +2545,15 @@
  24.275  proof-
  24.276    {assume d: ?lhs
  24.277    from d have th: "\<And>n. a $ Suc n = c * a$n / of_nat (Suc n)"
  24.278 -    by (simp add: fps_deriv_def fps_eq_iff field_eq_simps del: of_nat_Suc)
  24.279 +    by (simp add: fps_deriv_def fps_eq_iff field_simps del: of_nat_Suc)
  24.280    {fix n have "a$n = a$0 * c ^ n/ (of_nat (fact n))"
  24.281        apply (induct n)
  24.282        apply simp
  24.283        unfolding th
  24.284        using fact_gt_zero_nat
  24.285 -      apply (simp add: field_eq_simps del: of_nat_Suc fact_Suc)
  24.286 +      apply (simp add: field_simps del: of_nat_Suc fact_Suc)
  24.287        apply (drule sym)
  24.288 -      by (simp add: ring_simps of_nat_mult power_Suc)}
  24.289 +      by (simp add: field_simps of_nat_mult power_Suc)}
  24.290    note th' = this
  24.291    have ?rhs
  24.292      by (auto simp add: fps_eq_iff fps_const_mult_left E_def intro : th')}
  24.293 @@ -2570,7 +2570,7 @@
  24.294  lemma E_add_mult: "E (a + b) = E (a::'a::field_char_0) * E b" (is "?l = ?r")
  24.295  proof-
  24.296    have "fps_deriv (?r) = fps_const (a+b) * ?r"
  24.297 -    by (simp add: fps_const_add[symmetric] ring_simps del: fps_const_add)
  24.298 +    by (simp add: fps_const_add[symmetric] field_simps del: fps_const_add)
  24.299    then have "?r = ?l" apply (simp only: E_unique_ODE)
  24.300      by (simp add: fps_mult_nth E_def)
  24.301    then show ?thesis ..
  24.302 @@ -2618,13 +2618,13 @@
  24.303    (is "inverse ?l = ?r")
  24.304  proof-
  24.305    have th: "?l * ?r = 1"
  24.306 -    by (auto simp add: ring_simps fps_eq_iff minus_one_power_iff)
  24.307 +    by (auto simp add: field_simps fps_eq_iff minus_one_power_iff)
  24.308    have th': "?l $ 0 \<noteq> 0" by (simp add: )
  24.309    from fps_inverse_unique[OF th' th] show ?thesis .
  24.310  qed
  24.311  
  24.312  lemma E_power_mult: "(E (c::'a::field_char_0))^n = E (of_nat n * c)"
  24.313 -  by (induct n, auto simp add: ring_simps E_add_mult power_Suc)
  24.314 +  by (induct n, auto simp add: field_simps E_add_mult power_Suc)
  24.315  
  24.316  lemma radical_E:
  24.317    assumes r: "r (Suc k) 1 = 1" 
  24.318 @@ -2649,18 +2649,18 @@
  24.319  text{* The generalized binomial theorem as a  consequence of @{thm E_add_mult} *}
  24.320  
  24.321  lemma gbinomial_theorem: 
  24.322 -  "((a::'a::{field_char_0, division_by_zero})+b) ^ n = (\<Sum>k=0..n. of_nat (n choose k) * a^k * b^(n-k))"
  24.323 +  "((a::'a::{field_char_0, division_ring_inverse_zero})+b) ^ n = (\<Sum>k=0..n. of_nat (n choose k) * a^k * b^(n-k))"
  24.324  proof-
  24.325    from E_add_mult[of a b] 
  24.326    have "(E (a + b)) $ n = (E a * E b)$n" by simp
  24.327    then have "(a + b) ^ n = (\<Sum>i\<Colon>nat = 0\<Colon>nat..n. a ^ i * b ^ (n - i)  * (of_nat (fact n) / of_nat (fact i * fact (n - i))))"
  24.328 -    by (simp add: field_eq_simps fps_mult_nth of_nat_mult[symmetric] setsum_right_distrib)
  24.329 +    by (simp add: field_simps fps_mult_nth of_nat_mult[symmetric] setsum_right_distrib)
  24.330    then show ?thesis 
  24.331      apply simp
  24.332      apply (rule setsum_cong2)
  24.333      apply simp
  24.334      apply (frule binomial_fact[where ?'a = 'a, symmetric])
  24.335 -    by (simp add: field_eq_simps of_nat_mult)
  24.336 +    by (simp add: field_simps of_nat_mult)
  24.337  qed
  24.338  
  24.339  text{* And the nat-form -- also available from Binomial.thy *}
  24.340 @@ -2683,7 +2683,7 @@
  24.341    by (simp add: L_def fps_eq_iff del: of_nat_Suc)
  24.342  
  24.343  lemma L_nth: "L c $ n = (if n=0 then 0 else 1/c * ((- 1) ^ (n - 1) / of_nat n))"
  24.344 -  by (simp add: L_def field_eq_simps)
  24.345 +  by (simp add: L_def field_simps)
  24.346  
  24.347  lemma L_0[simp]: "L c $ 0 = 0" by (simp add: L_def)
  24.348  lemma L_E_inv:
  24.349 @@ -2694,9 +2694,9 @@
  24.350    have b0: "?b $ 0 = 0" by simp
  24.351    have b1: "?b $ 1 \<noteq> 0" by (simp add: a)
  24.352    have "fps_deriv (E a - 1) oo fps_inv (E a - 1) = (fps_const a * (E a - 1) + fps_const a) oo fps_inv (E a - 1)"
  24.353 -    by (simp add: ring_simps)
  24.354 +    by (simp add: field_simps)
  24.355    also have "\<dots> = fps_const a * (X + 1)" apply (simp add: fps_compose_add_distrib fps_const_mult_apply_left[symmetric] fps_inv_right[OF b0 b1])
  24.356 -    by (simp add: ring_simps)
  24.357 +    by (simp add: field_simps)
  24.358    finally have eq: "fps_deriv (E a - 1) oo fps_inv (E a - 1) = fps_const a * (X + 1)" .
  24.359    from fps_inv_deriv[OF b0 b1, unfolded eq]
  24.360    have "fps_deriv (fps_inv ?b) = fps_const (inverse a) / (X + 1)"
  24.361 @@ -2713,7 +2713,7 @@
  24.362    shows "L c + L d = fps_const (c+d) * L (c*d)"
  24.363    (is "?r = ?l")
  24.364  proof-
  24.365 -  from c0 d0 have eq: "1/c + 1/d = (c+d)/(c*d)" by (simp add: field_eq_simps)
  24.366 +  from c0 d0 have eq: "1/c + 1/d = (c+d)/(c*d)" by (simp add: field_simps)
  24.367    have "fps_deriv ?r = fps_const (1/c + 1/d) * inverse (1 + X)"
  24.368      by (simp add: fps_deriv_L fps_const_add[symmetric] algebra_simps del: fps_const_add)
  24.369    also have "\<dots> = fps_deriv ?l"
  24.370 @@ -2743,7 +2743,7 @@
  24.371    have "?l = ?r \<longleftrightarrow> inverse ?x1 * ?l = inverse ?x1 * ?r" by simp
  24.372    also have "\<dots> \<longleftrightarrow> ?da = (fps_const c * a) / ?x1"
  24.373      apply (simp only: fps_divide_def  mult_assoc[symmetric] inverse_mult_eq_1[OF x10])
  24.374 -    by (simp add: ring_simps)
  24.375 +    by (simp add: field_simps)
  24.376    finally have eq: "?l = ?r \<longleftrightarrow> ?lhs" by simp
  24.377    moreover
  24.378    {assume h: "?l = ?r" 
  24.379 @@ -2752,8 +2752,8 @@
  24.380        
  24.381        from lrn 
  24.382        have "a$ Suc n = ((c - of_nat n) / of_nat (Suc n)) * a $n" 
  24.383 -        apply (simp add: ring_simps del: of_nat_Suc)
  24.384 -        by (cases n, simp_all add: field_eq_simps del: of_nat_Suc)
  24.385 +        apply (simp add: field_simps del: of_nat_Suc)
  24.386 +        by (cases n, simp_all add: field_simps del: of_nat_Suc)
  24.387      }
  24.388      note th0 = this
  24.389      {fix n have "a$n = (c gchoose n) * a$0"
  24.390 @@ -2762,24 +2762,24 @@
  24.391        next
  24.392          case (Suc m)
  24.393          thus ?case unfolding th0
  24.394 -          apply (simp add: field_eq_simps del: of_nat_Suc)
  24.395 +          apply (simp add: field_simps del: of_nat_Suc)
  24.396            unfolding mult_assoc[symmetric] gbinomial_mult_1
  24.397 -          by (simp add: ring_simps)
  24.398 +          by (simp add: field_simps)
  24.399        qed}
  24.400      note th1 = this
  24.401      have ?rhs
  24.402        apply (simp add: fps_eq_iff)
  24.403        apply (subst th1)
  24.404 -      by (simp add: ring_simps)}
  24.405 +      by (simp add: field_simps)}
  24.406    moreover
  24.407    {assume h: ?rhs
  24.408    have th00:"\<And>x y. x * (a$0 * y) = a$0 * (x*y)" by (simp add: mult_commute)
  24.409      have "?l = ?r" 
  24.410        apply (subst h)
  24.411        apply (subst (2) h)
  24.412 -      apply (clarsimp simp add: fps_eq_iff ring_simps)
  24.413 +      apply (clarsimp simp add: fps_eq_iff field_simps)
  24.414        unfolding mult_assoc[symmetric] th00 gbinomial_mult_1
  24.415 -      by (simp add: ring_simps gbinomial_mult_1)}
  24.416 +      by (simp add: field_simps gbinomial_mult_1)}
  24.417    ultimately show ?thesis by blast
  24.418  qed
  24.419  
  24.420 @@ -2798,9 +2798,9 @@
  24.421    have "fps_deriv ?P = ?db c * ?b d + ?b c * ?db d - ?db (c + d)"  by simp
  24.422    also have "\<dots> = inverse (1 + X) * (fps_const c * ?b c * ?b d + fps_const d * ?b c * ?b d - fps_const (c+d) * ?b (c + d))"
  24.423      unfolding fps_binomial_deriv
  24.424 -    by (simp add: fps_divide_def ring_simps)
  24.425 +    by (simp add: fps_divide_def field_simps)
  24.426    also have "\<dots> = (fps_const (c + d)/ (1 + X)) * ?P"
  24.427 -    by (simp add: ring_simps fps_divide_def fps_const_add[symmetric] del: fps_const_add)
  24.428 +    by (simp add: field_simps fps_divide_def fps_const_add[symmetric] del: fps_const_add)
  24.429    finally have th0: "fps_deriv ?P = fps_const (c+d) * ?P / (1 + X)"
  24.430      by (simp add: fps_divide_def)
  24.431    have "?P = fps_const (?P$0) * ?b (c + d)"
  24.432 @@ -2880,7 +2880,7 @@
  24.433            using kn pochhammer_minus'[where k=k and n=n and b=b]
  24.434            apply (simp add:  pochhammer_same)
  24.435            using bn0
  24.436 -          by (simp add: field_eq_simps power_add[symmetric])}
  24.437 +          by (simp add: field_simps power_add[symmetric])}
  24.438        moreover
  24.439        {assume nk: "k \<noteq> n"
  24.440          have m1nk: "?m1 n = setprod (%i. - 1) {0..m}" 
  24.441 @@ -2905,7 +2905,7 @@
  24.442            unfolding m1nk 
  24.443            
  24.444            unfolding m h pochhammer_Suc_setprod
  24.445 -          apply (simp add: field_eq_simps del: fact_Suc id_def)
  24.446 +          apply (simp add: field_simps del: fact_Suc id_def)
  24.447            unfolding fact_altdef_nat id_def
  24.448            unfolding of_nat_setprod
  24.449            unfolding setprod_timesf[symmetric]
  24.450 @@ -2942,10 +2942,10 @@
  24.451            apply auto
  24.452            done
  24.453          then have th2: "(?m1 n * ?p b n)/pochhammer (b - of_nat n + 1) k = setprod (%i. b - of_nat i) {0.. n - k - 1}" 
  24.454 -          using nz' by (simp add: field_eq_simps)
  24.455 +          using nz' by (simp add: field_simps)
  24.456          have "(?m1 n * ?p b n * ?m1 k * ?p (of_nat n) k) / (?f n * pochhammer (b - of_nat n + 1) k) = ((?m1 k * ?p (of_nat n) k) / ?f n) * ((?m1 n * ?p b n)/pochhammer (b - of_nat n + 1) k)"
  24.457            using bnz0
  24.458 -          by (simp add: field_eq_simps)
  24.459 +          by (simp add: field_simps)
  24.460          also have "\<dots> = b gchoose (n - k)" 
  24.461            unfolding th1 th2
  24.462            using kn' by (simp add: gbinomial_def)
  24.463 @@ -2959,15 +2959,15 @@
  24.464    note th00 = this
  24.465    have "?r = ((a + b) gchoose n) * (of_nat (fact n)/ (?m1 n * pochhammer (- b) n))"
  24.466      unfolding gbinomial_pochhammer 
  24.467 -    using bn0 by (auto simp add: field_eq_simps)
  24.468 +    using bn0 by (auto simp add: field_simps)
  24.469    also have "\<dots> = ?l"
  24.470      unfolding gbinomial_Vandermonde[symmetric]
  24.471      apply (simp add: th00)
  24.472      unfolding gbinomial_pochhammer
  24.473 -    using bn0 apply (simp add: setsum_left_distrib setsum_right_distrib field_eq_simps)
  24.474 +    using bn0 apply (simp add: setsum_left_distrib setsum_right_distrib field_simps)
  24.475      apply (rule setsum_cong2)
  24.476      apply (drule th00(2))
  24.477 -    by (simp add: field_eq_simps power_add[symmetric])
  24.478 +    by (simp add: field_simps power_add[symmetric])
  24.479    finally show ?thesis by simp
  24.480  qed 
  24.481  
  24.482 @@ -2992,7 +2992,7 @@
  24.483    have nz: "pochhammer c n \<noteq> 0" using c
  24.484      by (simp add: pochhammer_eq_0_iff)
  24.485    from Vandermonde_pochhammer_lemma[where a = "?a" and b="?b" and n=n, OF h, unfolded th0 th1]
  24.486 -  show ?thesis using nz by (simp add: field_eq_simps setsum_right_distrib)
  24.487 +  show ?thesis using nz by (simp add: field_simps setsum_right_distrib)
  24.488  qed
  24.489  
  24.490  subsubsection{* Formal trigonometric functions  *}
  24.491 @@ -3014,11 +3014,11 @@
  24.492          using en by (simp add: fps_sin_def)
  24.493        also have "\<dots> = (- 1)^(n div 2) * c^Suc n * (of_nat (n+1) / (of_nat (Suc n) * of_nat (fact n)))"
  24.494          unfolding fact_Suc of_nat_mult
  24.495 -        by (simp add: field_eq_simps del: of_nat_add of_nat_Suc)
  24.496 +        by (simp add: field_simps del: of_nat_add of_nat_Suc)
  24.497        also have "\<dots> = (- 1)^(n div 2) *c^Suc n / of_nat (fact n)"
  24.498 -        by (simp add: field_eq_simps del: of_nat_add of_nat_Suc)
  24.499 +        by (simp add: field_simps del: of_nat_add of_nat_Suc)
  24.500        finally have "?lhs $n = ?rhs$n" using en
  24.501 -        by (simp add: fps_cos_def ring_simps power_Suc )}
  24.502 +        by (simp add: fps_cos_def field_simps power_Suc )}
  24.503      then show "?lhs $ n = ?rhs $ n"
  24.504        by (cases "even n", simp_all add: fps_deriv_def fps_sin_def fps_cos_def)
  24.505  qed
  24.506 @@ -3038,13 +3038,13 @@
  24.507          using en by (simp add: fps_cos_def)
  24.508        also have "\<dots> = (- 1)^((n + 1) div 2)*c^Suc n * (of_nat (n+1) / (of_nat (Suc n) * of_nat (fact n)))"
  24.509          unfolding fact_Suc of_nat_mult
  24.510 -        by (simp add: field_eq_simps del: of_nat_add of_nat_Suc)
  24.511 +        by (simp add: field_simps del: of_nat_add of_nat_Suc)
  24.512        also have "\<dots> = (- 1)^((n + 1) div 2) * c^Suc n / of_nat (fact n)"
  24.513 -        by (simp add: field_eq_simps del: of_nat_add of_nat_Suc)
  24.514 +        by (simp add: field_simps del: of_nat_add of_nat_Suc)
  24.515        also have "\<dots> = (- ((- 1)^((n - 1) div 2))) * c^Suc n / of_nat (fact n)"
  24.516          unfolding th0 unfolding th1[OF en] by simp
  24.517        finally have "?lhs $n = ?rhs$n" using en
  24.518 -        by (simp add: fps_sin_def ring_simps power_Suc)}
  24.519 +        by (simp add: fps_sin_def field_simps power_Suc)}
  24.520      then show "?lhs $ n = ?rhs $ n"
  24.521        by (cases "even n", simp_all add: fps_deriv_def fps_sin_def
  24.522          fps_cos_def)
  24.523 @@ -3055,7 +3055,7 @@
  24.524  proof-
  24.525    have "fps_deriv ?lhs = 0"
  24.526      apply (simp add:  fps_deriv_power fps_sin_deriv fps_cos_deriv power_Suc)
  24.527 -    by (simp add: ring_simps fps_const_neg[symmetric] del: fps_const_neg)
  24.528 +    by (simp add: field_simps fps_const_neg[symmetric] del: fps_const_neg)
  24.529    then have "?lhs = fps_const (?lhs $ 0)"
  24.530      unfolding fps_deriv_eq_0_iff .
  24.531    also have "\<dots> = 1"
  24.532 @@ -3177,7 +3177,7 @@
  24.533    have th0: "fps_cos c $ 0 \<noteq> 0" by (simp add: fps_cos_def)
  24.534    show ?thesis
  24.535      using fps_sin_cos_sum_of_squares[of c]
  24.536 -    apply (simp add: fps_tan_def fps_divide_deriv[OF th0] fps_sin_deriv fps_cos_deriv add: fps_const_neg[symmetric] ring_simps power2_eq_square del: fps_const_neg)
  24.537 +    apply (simp add: fps_tan_def fps_divide_deriv[OF th0] fps_sin_deriv fps_cos_deriv add: fps_const_neg[symmetric] field_simps power2_eq_square del: fps_const_neg)
  24.538      unfolding right_distrib[symmetric]
  24.539      by simp
  24.540  qed
  24.541 @@ -3252,7 +3252,7 @@
  24.542  subsection {* Hypergeometric series *}
  24.543  
  24.544  
  24.545 -definition "F as bs (c::'a::{field_char_0, division_by_zero}) = Abs_fps (%n. (foldl (%r a. r* pochhammer a n) 1 as * c^n)/ (foldl (%r b. r * pochhammer b n) 1 bs * of_nat (fact n)))"
  24.546 +definition "F as bs (c::'a::{field_char_0, division_ring_inverse_zero}) = Abs_fps (%n. (foldl (%r a. r* pochhammer a n) 1 as * c^n)/ (foldl (%r b. r * pochhammer b n) 1 bs * of_nat (fact n)))"
  24.547  
  24.548  lemma F_nth[simp]: "F as bs c $ n =  (foldl (%r a. r* pochhammer a n) 1 as * c^n)/ (foldl (%r b. r * pochhammer b n) 1 bs * of_nat (fact n))"
  24.549    by (simp add: F_def)
  24.550 @@ -3321,9 +3321,9 @@
  24.551    by (simp add: fps_eq_iff fps_integral_def)
  24.552  
  24.553  lemma F_minus_nat: 
  24.554 -  "F [- of_nat n] [- of_nat (n + m)] (c::'a::{field_char_0, division_by_zero}) $ k = (if k <= n then pochhammer (- of_nat n) k * c ^ k /
  24.555 +  "F [- of_nat n] [- of_nat (n + m)] (c::'a::{field_char_0, division_ring_inverse_zero}) $ k = (if k <= n then pochhammer (- of_nat n) k * c ^ k /
  24.556      (pochhammer (- of_nat (n + m)) k * of_nat (fact k)) else 0)"
  24.557 -  "F [- of_nat m] [- of_nat (m + n)] (c::'a::{field_char_0, division_by_zero}) $ k = (if k <= m then pochhammer (- of_nat m) k * c ^ k /
  24.558 +  "F [- of_nat m] [- of_nat (m + n)] (c::'a::{field_char_0, division_ring_inverse_zero}) $ k = (if k <= m then pochhammer (- of_nat m) k * c ^ k /
  24.559      (pochhammer (- of_nat (m + n)) k * of_nat (fact k)) else 0)"
  24.560    by (auto simp add: pochhammer_eq_0_iff)
  24.561  
    25.1 --- a/src/HOL/Library/Fraction_Field.thy	Mon Apr 26 09:37:46 2010 -0700
    25.2 +++ b/src/HOL/Library/Fraction_Field.thy	Mon Apr 26 09:45:22 2010 -0700
    25.3 @@ -267,7 +267,7 @@
    25.4  
    25.5  end
    25.6  
    25.7 -instance fract :: (idom) division_by_zero
    25.8 +instance fract :: (idom) division_ring_inverse_zero
    25.9  proof
   25.10    show "inverse 0 = (0:: 'a fract)" by (simp add: fract_expand)
   25.11      (simp add: fract_collapse)
   25.12 @@ -450,7 +450,7 @@
   25.13          by simp
   25.14        with F have "(a * d) * (b * d) * ?F * ?F \<le> (c * b) * (b * d) * ?F * ?F"
   25.15          by (simp add: mult_le_cancel_right)
   25.16 -      with neq show ?thesis by (simp add: ring_simps)
   25.17 +      with neq show ?thesis by (simp add: field_simps)
   25.18      qed
   25.19    qed
   25.20    show "q < r ==> 0 < s ==> s * q < s * r"
    26.1 --- a/src/HOL/Library/Numeral_Type.thy	Mon Apr 26 09:37:46 2010 -0700
    26.2 +++ b/src/HOL/Library/Numeral_Type.thy	Mon Apr 26 09:45:22 2010 -0700
    26.3 @@ -213,7 +213,7 @@
    26.4  
    26.5  lemma comm_ring_1: "OFCLASS('a, comm_ring_1_class)"
    26.6  apply (intro_classes, unfold definitions)
    26.7 -apply (simp_all add: Rep_simps zmod_simps ring_simps)
    26.8 +apply (simp_all add: Rep_simps zmod_simps field_simps)
    26.9  done
   26.10  
   26.11  end
    27.1 --- a/src/HOL/Library/Polynomial.thy	Mon Apr 26 09:37:46 2010 -0700
    27.2 +++ b/src/HOL/Library/Polynomial.thy	Mon Apr 26 09:45:22 2010 -0700
    27.3 @@ -1093,10 +1093,10 @@
    27.4  apply (cases "r = 0")
    27.5  apply (cases "r' = 0")
    27.6  apply (simp add: pdivmod_rel_def)
    27.7 -apply (simp add: pdivmod_rel_def ring_simps degree_mult_eq)
    27.8 +apply (simp add: pdivmod_rel_def field_simps degree_mult_eq)
    27.9  apply (cases "r' = 0")
   27.10  apply (simp add: pdivmod_rel_def degree_mult_eq)
   27.11 -apply (simp add: pdivmod_rel_def ring_simps)
   27.12 +apply (simp add: pdivmod_rel_def field_simps)
   27.13  apply (simp add: degree_mult_eq degree_add_less)
   27.14  done
   27.15  
    28.1 --- a/src/HOL/Library/Sum_Of_Squares/sum_of_squares.ML	Mon Apr 26 09:37:46 2010 -0700
    28.2 +++ b/src/HOL/Library/Sum_Of_Squares/sum_of_squares.ML	Mon Apr 26 09:45:22 2010 -0700
    28.3 @@ -1282,9 +1282,9 @@
    28.4    fun simple_cterm_ord t u = Term_Ord.fast_term_ord (term_of t, term_of u) = LESS
    28.5   val concl = Thm.dest_arg o cprop_of
    28.6   val shuffle1 =
    28.7 -   fconv_rule (rewr_conv @{lemma "(a + x == y) == (x == y - (a::real))" by (atomize (full)) (simp add: ring_simps) })
    28.8 +   fconv_rule (rewr_conv @{lemma "(a + x == y) == (x == y - (a::real))" by (atomize (full)) (simp add: field_simps) })
    28.9   val shuffle2 =
   28.10 -    fconv_rule (rewr_conv @{lemma "(x + a == y) ==  (x == y - (a::real))" by (atomize (full)) (simp add: ring_simps)})
   28.11 +    fconv_rule (rewr_conv @{lemma "(x + a == y) ==  (x == y - (a::real))" by (atomize (full)) (simp add: field_simps)})
   28.12   fun substitutable_monomial fvs tm = case term_of tm of
   28.13      Free(_,@{typ real}) => if not (member (op aconvc) fvs tm) then (Rat.one,tm)
   28.14                             else raise Failure "substitutable_monomial"
    29.1 --- a/src/HOL/Multivariate_Analysis/Brouwer_Fixpoint.thy	Mon Apr 26 09:37:46 2010 -0700
    29.2 +++ b/src/HOL/Multivariate_Analysis/Brouwer_Fixpoint.thy	Mon Apr 26 09:45:22 2010 -0700
    29.3 @@ -1381,7 +1381,7 @@
    29.4      apply(rule_tac x=x in bexI) apply assumption+ apply(rule continuous_on_intros)+
    29.5      unfolding frontier_cball subset_eq Ball_def image_iff apply(rule,rule,erule bexE)
    29.6      unfolding vector_dist_norm apply(simp add: * norm_minus_commute) . note x = this
    29.7 -  hence "scaleR 2 a = scaleR 1 x + scaleR 1 x" by(auto simp add:group_simps)
    29.8 +  hence "scaleR 2 a = scaleR 1 x + scaleR 1 x" by(auto simp add:algebra_simps)
    29.9    hence "a = x" unfolding scaleR_left_distrib[THEN sym] by auto 
   29.10    thus False using x using assms by auto qed
   29.11  
   29.12 @@ -1394,7 +1394,7 @@
   29.13   "interval_bij (a,b) (u,v) = (\<lambda>x. (\<chi> i. (v$i - u$i) / (b$i - a$i) * x$i) +
   29.14              (\<chi> i. u$i - (v$i - u$i) / (b$i - a$i) * a$i))"
   29.15    apply rule unfolding Cart_eq interval_bij_def vector_component_simps
   29.16 -  by(auto simp add:group_simps field_simps add_divide_distrib[THEN sym]) 
   29.17 +  by(auto simp add: field_simps add_divide_distrib[THEN sym]) 
   29.18  
   29.19  lemma continuous_interval_bij:
   29.20    "continuous (at x) (interval_bij (a,b::real^'n) (u,v))" 
    30.1 --- a/src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy	Mon Apr 26 09:37:46 2010 -0700
    30.2 +++ b/src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy	Mon Apr 26 09:45:22 2010 -0700
    30.3 @@ -645,7 +645,7 @@
    30.4        using assms(1)[unfolded convex_on_def, THEN bspec[where x=x], THEN bspec[where x=y], THEN spec[where x=u]]
    30.5        using assms(2)[unfolded convex_on_def, THEN bspec[where x=x], THEN bspec[where x=y], THEN spec[where x=u]]
    30.6        apply - apply(rule add_mono) by auto
    30.7 -    hence "f (u *\<^sub>R x + v *\<^sub>R y) + g (u *\<^sub>R x + v *\<^sub>R y) \<le> u * (f x + g x) + v * (f y + g y)" by (simp add: ring_simps)  }
    30.8 +    hence "f (u *\<^sub>R x + v *\<^sub>R y) + g (u *\<^sub>R x + v *\<^sub>R y) \<le> u * (f x + g x) + v * (f y + g y)" by (simp add: field_simps)  }
    30.9    thus ?thesis unfolding convex_on_def by auto 
   30.10  qed
   30.11  
   30.12 @@ -653,7 +653,7 @@
   30.13    assumes "0 \<le> (c::real)" "convex_on s f"
   30.14    shows "convex_on s (\<lambda>x. c * f x)"
   30.15  proof-
   30.16 -  have *:"\<And>u c fx v fy ::real. u * (c * fx) + v * (c * fy) = c * (u * fx + v * fy)" by (simp add: ring_simps)
   30.17 +  have *:"\<And>u c fx v fy ::real. u * (c * fx) + v * (c * fy) = c * (u * fx + v * fy)" by (simp add: field_simps)
   30.18    show ?thesis using assms(2) and mult_mono1[OF _ assms(1)] unfolding convex_on_def and * by auto
   30.19  qed
   30.20  
   30.21 @@ -1059,7 +1059,7 @@
   30.22  proof-
   30.23    have fin:"finite {a,b,c}" "finite {b,c}" "finite {c}" by auto
   30.24    have *:"\<And>x y z ::real. x + y + z = 1 \<longleftrightarrow> x = 1 - y - z"
   30.25 -         "\<And>x y z ::real^_. x + y + z = 1 \<longleftrightarrow> x = 1 - y - z" by (auto simp add: ring_simps)
   30.26 +         "\<And>x y z ::real^_. x + y + z = 1 \<longleftrightarrow> x = 1 - y - z" by (auto simp add: field_simps)
   30.27    show ?thesis unfolding convex_hull_finite[OF fin(1)] and Collect_def and convex_hull_finite_step[OF fin(2)] and *
   30.28      unfolding convex_hull_finite_step[OF fin(3)] apply(rule ext) apply simp apply auto
   30.29      apply(rule_tac x=va in exI) apply (rule_tac x="u c" in exI) apply simp
   30.30 @@ -2309,7 +2309,7 @@
   30.31    } moreover
   30.32    { fix a b assume "\<not> u * a + v * b \<le> a"
   30.33      hence "v * b > (1 - u) * a" unfolding not_le using as(4) by(auto simp add: field_simps)
   30.34 -    hence "a < b" unfolding * using as(4) apply(rule_tac mult_left_less_imp_less) by(auto simp add: ring_simps)
   30.35 +    hence "a < b" unfolding * using as(4) apply(rule_tac mult_left_less_imp_less) by(auto simp add: field_simps)
   30.36      hence "u * a + v * b \<le> b" unfolding ** using **(2) as(3) by(auto simp add: field_simps intro!:mult_right_mono) }
   30.37    ultimately show "u *\<^sub>R x + v *\<^sub>R y \<in> s" apply- apply(rule assms[unfolded is_interval_def, rule_format, OF as(1,2)])
   30.38      using as(3-) dimindex_ge_1 by auto qed
    31.1 --- a/src/HOL/Multivariate_Analysis/Derivative.thy	Mon Apr 26 09:37:46 2010 -0700
    31.2 +++ b/src/HOL/Multivariate_Analysis/Derivative.thy	Mon Apr 26 09:45:22 2010 -0700
    31.3 @@ -1,11 +1,12 @@
    31.4 -(*  Title:      HOL/Library/Convex_Euclidean_Space.thy
    31.5 -    Author:                     John Harrison
    31.6 -    Translation from HOL light: Robert Himmelmann, TU Muenchen *)
    31.7 +(*  Title:                       HOL/Multivariate_Analysis/Derivative.thy
    31.8 +    Author:                      John Harrison
    31.9 +    Translation from HOL Light:  Robert Himmelmann, TU Muenchen
   31.10 +*)
   31.11  
   31.12  header {* Multivariate calculus in Euclidean space. *}
   31.13  
   31.14  theory Derivative
   31.15 -  imports Brouwer_Fixpoint RealVector
   31.16 +imports Brouwer_Fixpoint RealVector
   31.17  begin
   31.18  
   31.19  
   31.20 @@ -40,7 +41,7 @@
   31.21    show ?l unfolding deriv_def LIM_def apply safe apply(drule as,safe)
   31.22      apply(rule_tac x=d in exI,safe) apply(erule_tac x="xa + x" in allE)
   31.23      unfolding vector_dist_norm diff_0_right norm_scaleR
   31.24 -    unfolding vector_dist_norm netlimit_at[of x] by(auto simp add:group_simps *) qed
   31.25 +    unfolding vector_dist_norm netlimit_at[of x] by(auto simp add:algebra_simps *) qed
   31.26  
   31.27  lemma FDERIV_conv_has_derivative:"FDERIV f (x::'a::{real_normed_vector,perfect_space}) :> f' = (f has_derivative f') (at x)" (is "?l = ?r") proof 
   31.28    assume ?l note as = this[unfolded fderiv_def]
   31.29 @@ -50,14 +51,14 @@
   31.30      thus "\<exists>d>0. \<forall>xa. 0 < dist xa x \<and> dist xa x < d \<longrightarrow>
   31.31        dist ((1 / norm (xa - netlimit (at x))) *\<^sub>R (f xa - (f (netlimit (at x)) + f' (xa - netlimit (at x))))) (0) < e"
   31.32        apply(rule_tac x=d in exI) apply(erule conjE,rule,assumption) apply rule apply(erule_tac x="xa - x" in allE)
   31.33 -      unfolding vector_dist_norm netlimit_at[of x] by(auto simp add:group_simps) qed next
   31.34 +      unfolding vector_dist_norm netlimit_at[of x] by (auto simp add: diff_diff_eq) qed next
   31.35    assume ?r note as = this[unfolded has_derivative_def]
   31.36    show ?l unfolding fderiv_def LIM_def apply-apply(rule,rule as[THEN conjunct1]) proof(rule,rule)
   31.37      fix e::real assume "e>0"
   31.38      guess d using as[THEN conjunct2,unfolded Lim_at,rule_format,OF`e>0`] ..
   31.39      thus "\<exists>s>0. \<forall>xa. xa \<noteq> 0 \<and> dist xa 0 < s \<longrightarrow> dist (norm (f (x + xa) - f x - f' xa) / norm xa) 0 < e" apply-
   31.40        apply(rule_tac x=d in exI) apply(erule conjE,rule,assumption) apply rule apply(erule_tac x="xa + x" in allE)
   31.41 -      unfolding vector_dist_norm netlimit_at[of x] by(auto simp add:group_simps) qed qed
   31.42 +      unfolding vector_dist_norm netlimit_at[of x] by (auto simp add: diff_diff_eq add.commute) qed qed
   31.43  
   31.44  subsection {* These are the only cases we'll care about, probably. *}
   31.45  
   31.46 @@ -76,7 +77,7 @@
   31.47          (\<forall>e>0. \<exists>d>0. \<forall>x'\<in>s. 0 < norm(x' - x) \<and> norm(x' - x) < d
   31.48          \<longrightarrow> norm(f x' - f x - f'(x' - x)) / norm(x' - x) < e)"
   31.49    unfolding has_derivative_within Lim_within vector_dist_norm
   31.50 -  unfolding diff_0_right norm_mul by(simp add: group_simps)
   31.51 +  unfolding diff_0_right norm_mul by (simp add: diff_diff_eq)
   31.52  
   31.53  lemma has_derivative_at':
   31.54   "(f has_derivative f') (at x) \<longleftrightarrow> bounded_linear f' \<and>
   31.55 @@ -186,14 +187,14 @@
   31.56    note as = assms[unfolded has_derivative_def]
   31.57    show ?thesis unfolding has_derivative_def apply(rule,rule bounded_linear_add)
   31.58      using Lim_add[OF as(1)[THEN conjunct2] as(2)[THEN conjunct2]] and as
   31.59 -    by(auto simp add:group_simps scaleR_right_diff_distrib scaleR_right_distrib) qed
   31.60 +    by (auto simp add:algebra_simps scaleR_right_diff_distrib scaleR_right_distrib) qed
   31.61  
   31.62  lemma has_derivative_add_const:"(f has_derivative f') net \<Longrightarrow> ((\<lambda>x. f x + c) has_derivative f') net"
   31.63    apply(drule has_derivative_add) apply(rule has_derivative_const) by auto
   31.64  
   31.65  lemma has_derivative_sub:
   31.66   "(f has_derivative f') net \<Longrightarrow> (g has_derivative g') net \<Longrightarrow> ((\<lambda>x. f(x) - g(x)) has_derivative (\<lambda>h. f'(h) - g'(h))) net"
   31.67 -  apply(drule has_derivative_add) apply(drule has_derivative_neg,assumption) by(simp add:group_simps)
   31.68 +  apply(drule has_derivative_add) apply(drule has_derivative_neg,assumption) by(simp add:algebra_simps)
   31.69  
   31.70  lemma has_derivative_setsum: assumes "finite s" "\<forall>a\<in>s. ((f a) has_derivative (f' a)) net"
   31.71    shows "((\<lambda>x. setsum (\<lambda>a. f a x) s) has_derivative (\<lambda>h. setsum (\<lambda>a. f' a h) s)) net"
   31.72 @@ -393,8 +394,8 @@
   31.73        case False hence "norm (f y - (f x + f' (y - x))) < e * norm (y - x)" using as(4)[rule_format, OF `y\<in>s`]
   31.74  	unfolding vector_dist_norm diff_0_right norm_mul using as(3)
   31.75  	using pos_divide_less_eq[OF False[unfolded dist_nz], unfolded vector_dist_norm]
   31.76 -	by(auto simp add:linear_0 linear_sub group_simps)
   31.77 -      thus ?thesis by(auto simp add:group_simps) qed qed next
   31.78 +	by (auto simp add: linear_0 linear_sub)
   31.79 +      thus ?thesis by(auto simp add:algebra_simps) qed qed next
   31.80    assume ?rhs thus ?lhs unfolding has_derivative_within Lim_within apply-apply(erule conjE,rule,assumption)
   31.81      apply(rule,erule_tac x="e/2" in allE,rule,erule impE) defer apply(erule exE,rule_tac x=d in exI)
   31.82      apply(erule conjE,rule,assumption,rule,rule) unfolding vector_dist_norm diff_0_right norm_scaleR
   31.83 @@ -402,7 +403,7 @@
   31.84      fix e d y assume "bounded_linear f'" "0 < e" "0 < d" "y \<in> s" "0 < norm (y - x) \<and> norm (y - x) < d"
   31.85          "norm (f y - f x - f' (y - x)) \<le> e / 2 * norm (y - x)"
   31.86      thus "\<bar>1 / norm (y - x)\<bar> * norm (f y - (f x + f' (y - x))) < e"
   31.87 -      apply(rule_tac le_less_trans[of _ "e/2"]) by(auto intro!:mult_imp_div_pos_le simp add:group_simps) qed auto qed
   31.88 +      apply(rule_tac le_less_trans[of _ "e/2"]) by(auto intro!:mult_imp_div_pos_le simp add:algebra_simps) qed auto qed
   31.89  
   31.90  lemma has_derivative_at_alt:
   31.91    "(f has_derivative f') (at x) \<longleftrightarrow> bounded_linear f' \<and>
   31.92 @@ -437,8 +438,8 @@
   31.93      hence 1:"norm (f y - f x - f' (y - x)) \<le> min (norm (y - x)) (e / 2 / B2 * norm (y - x))" using d1 d2 d by auto
   31.94  
   31.95      have "norm (f y - f x) \<le> norm (f y - f x - f' (y - x)) + norm (f' (y - x))"
   31.96 -      using norm_triangle_sub[of "f y - f x" "f' (y - x)"] by(auto simp add:group_simps)
   31.97 -    also have "\<dots> \<le> norm (f y - f x - f' (y - x)) + B1 * norm (y - x)" apply(rule add_left_mono) using B1 by(auto simp add:group_simps)
   31.98 +      using norm_triangle_sub[of "f y - f x" "f' (y - x)"] by(auto simp add:algebra_simps)
   31.99 +    also have "\<dots> \<le> norm (f y - f x - f' (y - x)) + B1 * norm (y - x)" apply(rule add_left_mono) using B1 by(auto simp add:algebra_simps)
  31.100      also have "\<dots> \<le> min (norm (y - x)) (e / 2 / B2 * norm (y - x)) + B1 * norm (y - x)" apply(rule add_right_mono) using d1 d2 d as by auto
  31.101      also have "\<dots> \<le> norm (y - x) + B1 * norm (y - x)" by auto
  31.102      also have "\<dots> = norm (y - x) * (1 + B1)" by(auto simp add:field_simps)
  31.103 @@ -455,8 +456,8 @@
  31.104      interpret g': bounded_linear g' using assms(2) by auto
  31.105      interpret f': bounded_linear f' using assms(1) by auto
  31.106      have "norm (- g' (f' (y - x)) + g' (f y - f x)) = norm (g' (f y - f x - f' (y - x)))"
  31.107 -      by(auto simp add:group_simps f'.diff g'.diff g'.add)
  31.108 -    also have "\<dots> \<le> B2 * norm (f y - f x - f' (y - x))" using B2 by(auto simp add:group_simps)
  31.109 +      by(auto simp add:algebra_simps f'.diff g'.diff g'.add)
  31.110 +    also have "\<dots> \<le> B2 * norm (f y - f x - f' (y - x))" using B2 by(auto simp add:algebra_simps)
  31.111      also have "\<dots> \<le> B2 * (e / 2 / B2 * norm (y - x))" apply(rule mult_left_mono) using as d1 d2 d B2 by auto 
  31.112      also have "\<dots> \<le> e / 2 * norm (y - x)" using B2 by auto
  31.113      finally have 5:"norm (- g' (f' (y - x)) + g' (f y - f x)) \<le> e / 2 * norm (y - x)" by auto
  31.114 @@ -537,7 +538,7 @@
  31.115        unfolding scaleR_right_distrib by auto
  31.116      also have "\<dots> = norm ((1 / abs c) *\<^sub>R (c *\<^sub>R (- (f' (basis i)) + f'' (basis i))))"  
  31.117        unfolding f'.scaleR f''.scaleR unfolding scaleR_right_distrib scaleR_minus_right by auto
  31.118 -    also have "\<dots> = e" unfolding e_def norm_mul using c[THEN conjunct1] using norm_minus_cancel[of "f' (basis i) - f'' (basis i)"] by(auto simp add:group_simps)
  31.119 +    also have "\<dots> = e" unfolding e_def norm_mul using c[THEN conjunct1] using norm_minus_cancel[of "f' (basis i) - f'' (basis i)"] by (auto simp add: add.commute ab_diff_minus)
  31.120      finally show False using c using d[THEN conjunct2,rule_format,of "x + c *\<^sub>R basis i"] using norm_basis[of i] unfolding vector_dist_norm 
  31.121        unfolding f'.scaleR f''.scaleR f'.add f''.add f'.diff f''.diff scaleR_scaleR scaleR_right_diff_distrib scaleR_right_distrib by auto qed qed
  31.122  
  31.123 @@ -625,7 +626,7 @@
  31.124    have ***:"\<And>y y1 y2 d dx::real. (y1\<le>y\<and>y2\<le>y) \<or> (y\<le>y1\<and>y\<le>y2) \<Longrightarrow> d < abs dx \<Longrightarrow> abs(y1 - y - - dx) \<le> d \<Longrightarrow> (abs (y2 - y - dx) \<le> d) \<Longrightarrow> False" by arith
  31.125    show False apply(rule ***[OF **, where dx="d * D $ k $ j" and d="\<bar>D $ k $ j\<bar> / 2 * \<bar>d\<bar>"]) 
  31.126      using *[of "-d"] and *[of d] and d[THEN conjunct1] and j unfolding mult_minus_left
  31.127 -    unfolding abs_mult diff_minus_eq_add scaleR.minus_left unfolding group_simps by (auto intro: mult_pos_pos)
  31.128 +    unfolding abs_mult diff_minus_eq_add scaleR.minus_left unfolding algebra_simps by (auto intro: mult_pos_pos)
  31.129  qed
  31.130  
  31.131  subsection {* In particular if we have a mapping into @{typ "real^1"}. *}
  31.132 @@ -729,7 +730,7 @@
  31.133    shows "norm(f x - f y) \<le> B * norm(x - y)" proof-
  31.134    let ?p = "\<lambda>u. x + u *\<^sub>R (y - x)"
  31.135    have *:"\<And>u. u\<in>{0..1} \<Longrightarrow> x + u *\<^sub>R (y - x) \<in> s"
  31.136 -    using assms(1)[unfolded convex_alt,rule_format,OF x y] unfolding scaleR_left_diff_distrib scaleR_right_diff_distrib by(auto simp add:group_simps)
  31.137 +    using assms(1)[unfolded convex_alt,rule_format,OF x y] unfolding scaleR_left_diff_distrib scaleR_right_diff_distrib by(auto simp add:algebra_simps)
  31.138    hence 1:"continuous_on {0..1} (f \<circ> ?p)" apply- apply(rule continuous_on_intros continuous_on_vmul)+
  31.139      unfolding continuous_on_eq_continuous_within apply(rule,rule differentiable_imp_continuous_within)
  31.140      unfolding differentiable_def apply(rule_tac x="f' xa" in exI)
  31.141 @@ -864,7 +865,7 @@
  31.142    assumes "compact t" "convex t"  "t \<noteq> {}" "continuous_on t f"
  31.143    "\<forall>x\<in>s. \<forall>y\<in>t. x + (y - f y) \<in> t" "x\<in>s"
  31.144    shows "\<exists>y\<in>t. f y = x" proof-
  31.145 -  have *:"\<And>x y. f y = x \<longleftrightarrow> x + (y - f y) = y" by(auto simp add:group_simps)
  31.146 +  have *:"\<And>x y. f y = x \<longleftrightarrow> x + (y - f y) = y" by(auto simp add:algebra_simps)
  31.147    show ?thesis  unfolding * apply(rule brouwer[OF assms(1-3), of "\<lambda>y. x + (y - f y)"])
  31.148      apply(rule continuous_on_intros assms)+ using assms(4-6) by auto qed
  31.149  
  31.150 @@ -909,8 +910,8 @@
  31.151      finally have *:"norm (x + g' (z - f x) - x) < e0" by auto
  31.152      have **:"f x + f' (x + g' (z - f x) - x) = z" using assms(6)[unfolded o_def id_def,THEN cong] by auto
  31.153      have "norm (f x - (y + (z - f (x + g' (z - f x))))) \<le> norm (f (x + g' (z - f x)) - z) + norm (f x - y)"
  31.154 -      using norm_triangle_ineq[of "f (x + g'(z - f x)) - z" "f x - y"] by(auto simp add:group_simps)
  31.155 -    also have "\<dots> \<le> 1 / (B * 2) * norm (g' (z - f x)) + norm (f x - y)" using e0[THEN conjunct2,rule_format,OF *] unfolding group_simps ** by auto 
  31.156 +      using norm_triangle_ineq[of "f (x + g'(z - f x)) - z" "f x - y"] by(auto simp add:algebra_simps)
  31.157 +    also have "\<dots> \<le> 1 / (B * 2) * norm (g' (z - f x)) + norm (f x - y)" using e0[THEN conjunct2,rule_format,OF *] unfolding algebra_simps ** by auto 
  31.158      also have "\<dots> \<le> 1 / (B * 2) * norm (g' (z - f x)) + e/2" using as(1)[unfolded mem_cball vector_dist_norm] by auto
  31.159      also have "\<dots> \<le> 1 / (B * 2) * B * norm (z - f x) + e/2" using * and B by(auto simp add:field_simps)
  31.160      also have "\<dots> \<le> 1 / 2 * norm (z - f x) + e/2" by auto
  31.161 @@ -985,7 +986,7 @@
  31.162  (* we know for some other reason that the inverse function exists, it's OK. *}
  31.163  
  31.164  lemma bounded_linear_sub: "bounded_linear f \<Longrightarrow> bounded_linear g ==> bounded_linear (\<lambda>x. f x - g x)"
  31.165 -  using bounded_linear_add[of f "\<lambda>x. - g x"] bounded_linear_minus[of g] by(auto simp add:group_simps)
  31.166 +  using bounded_linear_add[of f "\<lambda>x. - g x"] bounded_linear_minus[of g] by(auto simp add:algebra_simps)
  31.167  
  31.168  lemma has_derivative_locally_injective: fixes f::"real^'n \<Rightarrow> real^'m"
  31.169    assumes "a \<in> s" "open s" "bounded_linear g'" "g' o f'(a) = id"
  31.170 @@ -1006,7 +1007,7 @@
  31.171      show "\<forall>x\<in>ball a d. \<forall>x'\<in>ball a d. f x' = f x \<longrightarrow> x' = x" proof(intro strip)
  31.172        fix x y assume as:"x\<in>ball a d" "y\<in>ball a d" "f x = f y"
  31.173        def ph \<equiv> "\<lambda>w. w - g'(f w - f x)" have ph':"ph = g' \<circ> (\<lambda>w. f' a w - (f w - f x))"
  31.174 -	unfolding ph_def o_def unfolding diff using f'g' by(auto simp add:group_simps)
  31.175 +	unfolding ph_def o_def unfolding diff using f'g' by(auto simp add:algebra_simps)
  31.176        have "norm (ph x - ph y) \<le> (1/2) * norm (x - y)"
  31.177  	apply(rule differentiable_bound[OF convex_ball _ _ as(1-2), where f'="\<lambda>x v. v - g'(f' x v)"])
  31.178  	apply(rule_tac[!] ballI) proof- fix u assume u:"u \<in> ball a d" hence "u\<in>s" using d d2 by auto
  31.179 @@ -1022,7 +1023,7 @@
  31.180  	  unfolding linear_conv_bounded_linear by(rule assms(3) **)+ 
  31.181  	also have "\<dots> \<le> onorm g' * k" apply(rule mult_left_mono) 
  31.182  	  using d1[THEN conjunct2,rule_format,of u] using onorm_neg[OF **(1)[unfolded linear_linear]]
  31.183 -	  using d and u and onorm_pos_le[OF assms(3)[unfolded linear_linear]] by(auto simp add:group_simps) 
  31.184 +	  using d and u and onorm_pos_le[OF assms(3)[unfolded linear_linear]] by(auto simp add:algebra_simps) 
  31.185  	also have "\<dots> \<le> 1/2" unfolding k_def by auto
  31.186  	finally show "onorm (\<lambda>v. v - g' (f' u v)) \<le> 1 / 2" by assumption qed
  31.187        moreover have "norm (ph y - ph x) = norm (y - x)" apply(rule arg_cong[where f=norm])
  31.188 @@ -1041,7 +1042,7 @@
  31.189      fix x assume "x\<in>s" show "((\<lambda>a. f m a - f n a) has_derivative (\<lambda>h. f' m x h - f' n x h)) (at x within s)"
  31.190        by(rule has_derivative_intros assms(2)[rule_format] `x\<in>s`)+
  31.191      { fix h have "norm (f' m x h - f' n x h) \<le> norm (f' m x h - g' x h) + norm (f' n x h - g' x h)"
  31.192 -	using norm_triangle_ineq[of "f' m x h - g' x h" "- f' n x h + g' x h"] unfolding norm_minus_commute by(auto simp add:group_simps) 
  31.193 +	using norm_triangle_ineq[of "f' m x h - g' x h" "- f' n x h + g' x h"] unfolding norm_minus_commute by(auto simp add:algebra_simps) 
  31.194        also have "\<dots> \<le> e * norm h+ e * norm h"  using assms(3)[rule_format,OF `N\<le>m` `x\<in>s`, of h] assms(3)[rule_format,OF `N\<le>n` `x\<in>s`, of h]
  31.195  	by(auto simp add:field_simps)
  31.196        finally have "norm (f' m x h - f' n x h) \<le> 2 * e * norm h" by auto }
  31.197 @@ -1085,7 +1086,7 @@
  31.198        have "eventually (\<lambda>xa. norm (f n x - f n y - (f xa x - f xa y)) \<le> e * norm (x - y)) sequentially" 
  31.199  	unfolding eventually_sequentially apply(rule_tac x=N in exI) proof(rule,rule)
  31.200  	fix m assume "N\<le>m" thus "norm (f n x - f n y - (f m x - f m y)) \<le> e * norm (x - y)"
  31.201 -	  using N[rule_format, of n m x y] and as by(auto simp add:group_simps) qed
  31.202 +	  using N[rule_format, of n m x y] and as by(auto simp add:algebra_simps) qed
  31.203        thus "norm (f n x - f n y - (g x - g y)) \<le> e * norm (x - y)" apply-
  31.204  	apply(rule Lim_norm_ubound[OF trivial_limit_sequentially, where f="\<lambda>m. (f n x - f n y) - (f m x - f m y)"])
  31.205  	apply(rule Lim_sub Lim_const g[rule_format] as)+ by assumption qed qed
  31.206 @@ -1122,10 +1123,10 @@
  31.207  	have "norm (f ?N y - f ?N x - f' ?N x (y - x)) \<le> e / 3 * norm (y - x)" using d1 and as by auto ultimately
  31.208  	have "norm (g y - g x - f' ?N x (y - x)) \<le> 2 * e / 3 * norm (y - x)" 
  31.209  	  using norm_triangle_le[of "g y - g x - (f ?N y - f ?N x)" "f ?N y - f ?N x - f' ?N x (y - x)" "2 * e / 3 * norm (y - x)"] 
  31.210 -	  by (auto simp add:group_simps) moreover
  31.211 +	  by (auto simp add:algebra_simps) moreover
  31.212  	have " norm (f' ?N x (y - x) - g' x (y - x)) \<le> e / 3 * norm (y - x)" using N1 `x\<in>s` by auto
  31.213  	ultimately show "norm (g y - g x - g' x (y - x)) \<le> e * norm (y - x)"
  31.214 -	  using norm_triangle_le[of "g y - g x - f' (max N1 N2) x (y - x)" "f' (max N1 N2) x (y - x) - g' x (y - x)"] by(auto simp add:group_simps)
  31.215 +	  using norm_triangle_le[of "g y - g x - f' (max N1 N2) x (y - x)" "f' (max N1 N2) x (y - x) - g' x (y - x)"] by(auto simp add:algebra_simps)
  31.216  	qed qed qed qed
  31.217  
  31.218  subsection {* Can choose to line up antiderivatives if we want. *}
  31.219 @@ -1276,7 +1277,7 @@
  31.220    unfolding has_vector_derivative_def using has_derivative_id by auto
  31.221  
  31.222  lemma has_vector_derivative_cmul:  "(f has_vector_derivative f') net \<Longrightarrow> ((\<lambda>x. c *\<^sub>R f x) has_vector_derivative (c *\<^sub>R f')) net"
  31.223 -  unfolding has_vector_derivative_def apply(drule has_derivative_cmul) by(auto simp add:group_simps)
  31.224 +  unfolding has_vector_derivative_def apply(drule has_derivative_cmul) by(auto simp add:algebra_simps)
  31.225  
  31.226  lemma has_vector_derivative_cmul_eq: assumes "c \<noteq> 0"
  31.227    shows "(((\<lambda>x. c *\<^sub>R f x) has_vector_derivative (c *\<^sub>R f')) net \<longleftrightarrow> (f has_vector_derivative f') net)"
    32.1 --- a/src/HOL/Multivariate_Analysis/Determinants.thy	Mon Apr 26 09:37:46 2010 -0700
    32.2 +++ b/src/HOL/Multivariate_Analysis/Determinants.thy	Mon Apr 26 09:45:22 2010 -0700
    32.3 @@ -55,7 +55,7 @@
    32.4  done
    32.5  
    32.6    (* FIXME: In Finite_Set there is a useless further assumption *)
    32.7 -lemma setprod_inversef: "finite A ==> setprod (inverse \<circ> f) A = (inverse (setprod f A) :: 'a:: {division_by_zero, field})"
    32.8 +lemma setprod_inversef: "finite A ==> setprod (inverse \<circ> f) A = (inverse (setprod f A) :: 'a:: {division_ring_inverse_zero, field})"
    32.9    apply (erule finite_induct)
   32.10    apply (simp)
   32.11    apply simp
   32.12 @@ -352,13 +352,13 @@
   32.13      apply (rule setprod_insert)
   32.14      apply simp
   32.15      by blast
   32.16 -  also have "\<dots> = (a k $ p k * setprod (\<lambda>i. ?f i $ p i) ?Uk) + (b k$ p k * setprod (\<lambda>i. ?f i $ p i) ?Uk)" by (simp add: ring_simps)
   32.17 +  also have "\<dots> = (a k $ p k * setprod (\<lambda>i. ?f i $ p i) ?Uk) + (b k$ p k * setprod (\<lambda>i. ?f i $ p i) ?Uk)" by (simp add: field_simps)
   32.18    also have "\<dots> = (a k $ p k * setprod (\<lambda>i. ?g i $ p i) ?Uk) + (b k$ p k * setprod (\<lambda>i. ?h i $ p i) ?Uk)" by (metis th1 th2)
   32.19    also have "\<dots> = setprod (\<lambda>i. ?g i $ p i) (insert k ?Uk) + setprod (\<lambda>i. ?h i $ p i) (insert k ?Uk)"
   32.20      unfolding  setprod_insert[OF th3] by simp
   32.21    finally have "setprod (\<lambda>i. ?f i $ p i) ?U = setprod (\<lambda>i. ?g i $ p i) ?U + setprod (\<lambda>i. ?h i $ p i) ?U" unfolding kU[symmetric] .
   32.22    then show "of_int (sign p) * setprod (\<lambda>i. ?f i $ p i) ?U = of_int (sign p) * setprod (\<lambda>i. ?g i $ p i) ?U + of_int (sign p) * setprod (\<lambda>i. ?h i $ p i) ?U"
   32.23 -    by (simp add: ring_simps)
   32.24 +    by (simp add: field_simps)
   32.25  qed
   32.26  
   32.27  lemma det_row_mul:
   32.28 @@ -389,14 +389,14 @@
   32.29      apply (rule setprod_insert)
   32.30      apply simp
   32.31      by blast
   32.32 -  also have "\<dots> = (c*s a k) $ p k * setprod (\<lambda>i. ?f i $ p i) ?Uk" by (simp add: ring_simps)
   32.33 +  also have "\<dots> = (c*s a k) $ p k * setprod (\<lambda>i. ?f i $ p i) ?Uk" by (simp add: field_simps)
   32.34    also have "\<dots> = c* (a k $ p k * setprod (\<lambda>i. ?g i $ p i) ?Uk)"
   32.35      unfolding th1 by (simp add: mult_ac)
   32.36    also have "\<dots> = c* (setprod (\<lambda>i. ?g i $ p i) (insert k ?Uk))"
   32.37      unfolding  setprod_insert[OF th3] by simp
   32.38    finally have "setprod (\<lambda>i. ?f i $ p i) ?U = c* (setprod (\<lambda>i. ?g i $ p i) ?U)" unfolding kU[symmetric] .
   32.39    then show "of_int (sign p) * setprod (\<lambda>i. ?f i $ p i) ?U = c * (of_int (sign p) * setprod (\<lambda>i. ?g i $ p i) ?U)"
   32.40 -    by (simp add: ring_simps)
   32.41 +    by (simp add: field_simps)
   32.42  qed
   32.43  
   32.44  lemma det_row_0:
   32.45 @@ -604,7 +604,7 @@
   32.46    have "setprod (\<lambda>i. c i * a i $ p i) ?U = setprod c ?U * setprod (\<lambda>i. a i $ p i) ?U"
   32.47      unfolding setprod_timesf ..
   32.48    then show "?s * (\<Prod>xa\<in>?U. c xa * a xa $ p xa) =
   32.49 -        setprod c ?U * (?s* (\<Prod>xa\<in>?U. a xa $ p xa))" by (simp add: ring_simps)
   32.50 +        setprod c ?U * (?s* (\<Prod>xa\<in>?U. a xa $ p xa))" by (simp add: field_simps)
   32.51  qed
   32.52  
   32.53  lemma det_mul:
   32.54 @@ -681,7 +681,7 @@
   32.55          using permutes_in_image[OF q] by vector
   32.56        show "?s q * setprod (\<lambda>i. (((\<chi> i. A$i$p i *s B$p i) :: 'a^'n^'n)$i$q i)) ?U = ?s p * (setprod (\<lambda>i. A$i$p i) ?U) * (?s (q o inv p) * setprod (\<lambda>i. B$i$(q o inv p) i) ?U)"
   32.57          using ths thp pp pq permutation_inverse[OF pp] sign_inverse[OF pp]
   32.58 -        by (simp add: sign_nz th00 ring_simps sign_idempotent sign_compose)
   32.59 +        by (simp add: sign_nz th00 field_simps sign_idempotent sign_compose)
   32.60      qed
   32.61    }
   32.62    then have th2: "setsum (\<lambda>f. det (\<chi> i. A$i$f i *s B$f i)) ?PU = det A * det B"
   32.63 @@ -772,7 +772,7 @@
   32.64    have fUk: "finite ?Uk" by simp
   32.65    have kUk: "k \<notin> ?Uk" by simp
   32.66    have th00: "\<And>k s. x$k *s row k A + s = (x$k - 1) *s row k A + row k A + s"
   32.67 -    by (vector ring_simps)
   32.68 +    by (vector field_simps)
   32.69    have th001: "\<And>f k . (\<lambda>x. if x = k then f k else f x) = f" by (auto intro: ext)
   32.70    have "(\<chi> i. row i A) = A" by (vector row_def)
   32.71    then have thd1: "det (\<chi> i. row i A) = det A"  by simp
   32.72 @@ -793,7 +793,7 @@
   32.73      unfolding thd0
   32.74      unfolding det_row_mul
   32.75      unfolding th001[of k "\<lambda>i. row i A"]
   32.76 -    unfolding thd1  by (simp add: ring_simps)
   32.77 +    unfolding thd1  by (simp add: field_simps)
   32.78  qed
   32.79  
   32.80  lemma cramer_lemma:
   32.81 @@ -901,7 +901,7 @@
   32.82    have th: "\<And>x::'a. x = 1 \<or> x = - 1 \<longleftrightarrow> x*x = 1" (is "\<And>x::'a. ?ths x")
   32.83    proof-
   32.84      fix x:: 'a
   32.85 -    have th0: "x*x - 1 = (x - 1)*(x + 1)" by (simp add: ring_simps)
   32.86 +    have th0: "x*x - 1 = (x - 1)*(x + 1)" by (simp add: field_simps)
   32.87      have th1: "\<And>(x::'a) y. x = - y \<longleftrightarrow> x + y = 0"
   32.88        apply (subst eq_iff_diff_eq_0) by simp
   32.89      have "x*x = 1 \<longleftrightarrow> x*x - 1 = 0" by simp
   32.90 @@ -929,7 +929,7 @@
   32.91        unfolding dot_norm_neg dist_norm[symmetric]
   32.92        unfolding th0 fd[rule_format] by (simp add: power2_eq_square field_simps)}
   32.93    note fc = this
   32.94 -  show ?thesis unfolding linear_def vector_eq smult_conv_scaleR by (simp add: inner_simps fc ring_simps)
   32.95 +  show ?thesis unfolding linear_def vector_eq smult_conv_scaleR by (simp add: inner_simps fc field_simps)
   32.96  qed
   32.97  
   32.98  lemma isometry_linear:
   32.99 @@ -980,7 +980,7 @@
  32.100        using H(5-9)
  32.101        apply (simp add: norm_eq norm_eq_1)
  32.102        apply (simp add: inner_simps smult_conv_scaleR) unfolding *
  32.103 -      by (simp add: ring_simps) }
  32.104 +      by (simp add: field_simps) }
  32.105    note th0 = this
  32.106    let ?g = "\<lambda>x. if x = 0 then 0 else norm x *s f (inverse (norm x) *s x)"
  32.107    {fix x:: "real ^'n" assume nx: "norm x = 1"
  32.108 @@ -1079,7 +1079,7 @@
  32.109    unfolding permutes_sing
  32.110    apply (simp add: sign_swap_id permutation_swap_id sign_compose sign_id swap_id_eq)
  32.111    apply (simp add: arith_simps(31)[symmetric] del: arith_simps(31))
  32.112 -  by (simp add: ring_simps)
  32.113 +  by (simp add: field_simps)
  32.114  qed
  32.115  
  32.116  end
    33.1 --- a/src/HOL/Multivariate_Analysis/Euclidean_Space.thy	Mon Apr 26 09:37:46 2010 -0700
    33.2 +++ b/src/HOL/Multivariate_Analysis/Euclidean_Space.thy	Mon Apr 26 09:45:22 2010 -0700
    33.3 @@ -257,14 +257,14 @@
    33.4    | "vector_power x (Suc n) = x * vector_power x n"
    33.5  
    33.6  instance cart :: (semiring,finite) semiring
    33.7 -  apply (intro_classes) by (vector ring_simps)+
    33.8 +  apply (intro_classes) by (vector field_simps)+
    33.9  
   33.10  instance cart :: (semiring_0,finite) semiring_0
   33.11 -  apply (intro_classes) by (vector ring_simps)+
   33.12 +  apply (intro_classes) by (vector field_simps)+
   33.13  instance cart :: (semiring_1,finite) semiring_1
   33.14    apply (intro_classes) by vector
   33.15  instance cart :: (comm_semiring,finite) comm_semiring
   33.16 -  apply (intro_classes) by (vector ring_simps)+
   33.17 +  apply (intro_classes) by (vector field_simps)+
   33.18  
   33.19  instance cart :: (comm_semiring_0,finite) comm_semiring_0 by (intro_classes)
   33.20  instance cart :: (cancel_comm_monoid_add, finite) cancel_comm_monoid_add ..
   33.21 @@ -278,7 +278,7 @@
   33.22  
   33.23  instance cart :: (real_algebra,finite) real_algebra
   33.24    apply intro_classes
   33.25 -  apply (simp_all add: vector_scaleR_def ring_simps)
   33.26 +  apply (simp_all add: vector_scaleR_def field_simps)
   33.27    apply vector
   33.28    apply vector
   33.29    done
   33.30 @@ -318,19 +318,19 @@
   33.31  lemma vector_smult_assoc: "a *s (b *s x) = ((a::'a::semigroup_mult) * b) *s x"
   33.32    by (vector mult_assoc)
   33.33  lemma vector_sadd_rdistrib: "((a::'a::semiring) + b) *s x = a *s x + b *s x"
   33.34 -  by (vector ring_simps)
   33.35 +  by (vector field_simps)
   33.36  lemma vector_add_ldistrib: "(c::'a::semiring) *s (x + y) = c *s x + c *s y"
   33.37 -  by (vector ring_simps)
   33.38 +  by (vector field_simps)
   33.39  lemma vector_smult_lzero[simp]: "(0::'a::mult_zero) *s x = 0" by vector
   33.40  lemma vector_smult_lid[simp]: "(1::'a::monoid_mult) *s x = x" by vector
   33.41  lemma vector_ssub_ldistrib: "(c::'a::ring) *s (x - y) = c *s x - c *s y"
   33.42 -  by (vector ring_simps)
   33.43 +  by (vector field_simps)
   33.44  lemma vector_smult_rneg: "(c::'a::ring) *s -x = -(c *s x)" by vector
   33.45  lemma vector_smult_lneg: "- (c::'a::ring) *s x = -(c *s x)" by vector
   33.46  lemma vector_sneg_minus1: "-x = (- (1::'a::ring_1)) *s x" by vector
   33.47  lemma vector_smult_rzero[simp]: "c *s 0 = (0::'a::mult_zero ^ 'n)" by vector
   33.48  lemma vector_sub_rdistrib: "((a::'a::ring) - b) *s x = a *s x - b *s x"
   33.49 -  by (vector ring_simps)
   33.50 +  by (vector field_simps)
   33.51  
   33.52  lemma vec_eq[simp]: "(vec m = vec n) \<longleftrightarrow> (m = n)"
   33.53    by (simp add: Cart_eq)
   33.54 @@ -752,7 +752,7 @@
   33.55  lemma square_bound_lemma: "(x::real) < (1 + x) * (1 + x)"
   33.56  proof-
   33.57    have "(x + 1/2)^2 + 3/4 > 0" using zero_le_power2[of "x+1/2"] by arith
   33.58 -  thus ?thesis by (simp add: ring_simps power2_eq_square)
   33.59 +  thus ?thesis by (simp add: field_simps power2_eq_square)
   33.60  qed
   33.61  
   33.62  lemma square_continuous: "0 < (e::real) ==> \<exists>d. 0 < d \<and> (\<forall>y. abs(y - x) < d \<longrightarrow> abs(y * y - x * x) < e)"
   33.63 @@ -827,7 +827,7 @@
   33.64  lemma norm_triangle_sub:
   33.65    fixes x y :: "'a::real_normed_vector"
   33.66    shows "norm x \<le> norm y  + norm (x - y)"
   33.67 -  using norm_triangle_ineq[of "y" "x - y"] by (simp add: ring_simps)
   33.68 +  using norm_triangle_ineq[of "y" "x - y"] by (simp add: field_simps)
   33.69  
   33.70  lemma component_le_norm: "\<bar>x$i\<bar> <= norm x"
   33.71    apply (simp add: norm_vector_def)
   33.72 @@ -901,7 +901,7 @@
   33.73    unfolding power2_norm_eq_inner inner_simps inner_commute by auto 
   33.74  
   33.75  lemma dot_norm_neg: "x \<bullet> y = ((norm x ^ 2 + norm y ^ 2) - norm(x - y) ^ 2) / 2"
   33.76 -  unfolding power2_norm_eq_inner inner_simps inner_commute by(auto simp add:group_simps)
   33.77 +  unfolding power2_norm_eq_inner inner_simps inner_commute by(auto simp add:algebra_simps)
   33.78  
   33.79  text{* Equality of vectors in terms of @{term "op \<bullet>"} products.    *}
   33.80  
   33.81 @@ -912,7 +912,7 @@
   33.82    assume ?rhs
   33.83    then have "x \<bullet> x - x \<bullet> y = 0 \<and> x \<bullet> y - y \<bullet> y = 0" by simp
   33.84    hence "x \<bullet> (x - y) = 0 \<and> y \<bullet> (x - y) = 0" by (simp add: inner_simps inner_commute)
   33.85 -  then have "(x - y) \<bullet> (x - y) = 0" by (simp add: ring_simps inner_simps inner_commute)
   33.86 +  then have "(x - y) \<bullet> (x - y) = 0" by (simp add: field_simps inner_simps inner_commute)
   33.87    then show "x = y" by (simp)
   33.88  qed
   33.89  
   33.90 @@ -933,7 +933,7 @@
   33.91    by (rule order_trans [OF norm_triangle_ineq add_mono])
   33.92  
   33.93  lemma ge_iff_diff_ge_0: "(a::'a::linordered_ring) \<ge> b == a - b \<ge> 0"
   33.94 -  by (simp add: ring_simps)
   33.95 +  by (simp add: field_simps)
   33.96  
   33.97  lemma pth_1:
   33.98    fixes x :: "'a::real_normed_vector"
   33.99 @@ -1433,15 +1433,15 @@
  33.100    shows "linear f" using assms unfolding linear_def by auto
  33.101  
  33.102  lemma linear_compose_cmul: "linear f ==> linear (\<lambda>x. (c::'a::comm_semiring) *s f x)"
  33.103 -  by (vector linear_def Cart_eq ring_simps)
  33.104 +  by (vector linear_def Cart_eq field_simps)
  33.105  
  33.106  lemma linear_compose_neg: "linear (f :: 'a ^'n \<Rightarrow> 'a::comm_ring ^'m) ==> linear (\<lambda>x. -(f(x)))" by (vector linear_def Cart_eq)
  33.107  
  33.108  lemma linear_compose_add: "linear (f :: 'a ^'n \<Rightarrow> 'a::semiring_1 ^'m) \<Longrightarrow> linear g ==> linear (\<lambda>x. f(x) + g(x))"
  33.109 -  by (vector linear_def Cart_eq ring_simps)
  33.110 +  by (vector linear_def Cart_eq field_simps)
  33.111  
  33.112  lemma linear_compose_sub: "linear (f :: 'a ^'n \<Rightarrow> 'a::ring_1 ^'m) \<Longrightarrow> linear g ==> linear (\<lambda>x. f x - g x)"
  33.113 -  by (vector linear_def Cart_eq ring_simps)
  33.114 +  by (vector linear_def Cart_eq field_simps)
  33.115  
  33.116  lemma linear_compose: "linear f \<Longrightarrow> linear g ==> linear (g o f)"
  33.117    by (simp add: linear_def)
  33.118 @@ -1463,7 +1463,7 @@
  33.119    shows "linear (\<lambda>x. f x $ k *s v)"
  33.120    using lf
  33.121    apply (auto simp add: linear_def )
  33.122 -  by (vector ring_simps)+
  33.123 +  by (vector field_simps)+
  33.124  
  33.125  lemma linear_0: "linear f ==> f 0 = (0::'a::semiring_1 ^'n)"
  33.126    unfolding linear_def
  33.127 @@ -1539,7 +1539,7 @@
  33.128        unfolding norm_mul
  33.129        apply (simp only: mult_commute)
  33.130        apply (rule mult_mono)
  33.131 -      by (auto simp add: ring_simps) }
  33.132 +      by (auto simp add: field_simps) }
  33.133      then have th: "\<forall>i\<in> ?S. norm ((x$i) *s f (basis i :: real ^'m)) \<le> norm (f (basis i)) * norm x" by metis
  33.134      from real_setsum_norm_le[OF fS, of "\<lambda>i. (x$i) *s (f (basis i))", OF th]
  33.135      have "norm (f x) \<le> ?B * norm x" unfolding th0 setsum_left_distrib by metis}
  33.136 @@ -1565,7 +1565,7 @@
  33.137      {fix x::"real ^ 'n"
  33.138        have "norm (f x) \<le> ?K *  norm x"
  33.139        using B[rule_format, of x] norm_ge_zero[of x] norm_ge_zero[of "f x"] Bp
  33.140 -      apply (auto simp add: ring_simps split add: abs_split)
  33.141 +      apply (auto simp add: field_simps split add: abs_split)
  33.142        apply (erule order_trans, simp)
  33.143        done
  33.144    }
  33.145 @@ -1634,12 +1634,12 @@
  33.146  lemma bilinear_lzero:
  33.147    fixes h :: "'a::ring^'n \<Rightarrow> _" assumes bh: "bilinear h" shows "h 0 x = 0"
  33.148    using bilinear_ladd[OF bh, of 0 0 x]
  33.149 -    by (simp add: eq_add_iff ring_simps)
  33.150 +    by (simp add: eq_add_iff field_simps)
  33.151  
  33.152  lemma bilinear_rzero:
  33.153    fixes h :: "'a::ring^_ \<Rightarrow> _" assumes bh: "bilinear h" shows "h x 0 = 0"
  33.154    using bilinear_radd[OF bh, of x 0 0 ]
  33.155 -    by (simp add: eq_add_iff ring_simps)
  33.156 +    by (simp add: eq_add_iff field_simps)
  33.157  
  33.158  lemma bilinear_lsub: "bilinear h ==> h (x - (y:: 'a::ring_1 ^ _)) z = h x z - h y z"
  33.159    by (simp  add: diff_def bilinear_ladd bilinear_lneg)
  33.160 @@ -1680,7 +1680,7 @@
  33.161        apply (rule real_setsum_norm_le)
  33.162        using fN fM
  33.163        apply simp
  33.164 -      apply (auto simp add: bilinear_rmul[OF bh] bilinear_lmul[OF bh] ring_simps)
  33.165 +      apply (auto simp add: bilinear_rmul[OF bh] bilinear_lmul[OF bh] field_simps)
  33.166        apply (rule mult_mono)
  33.167        apply (auto simp add: zero_le_mult_iff component_le_norm)
  33.168        apply (rule mult_mono)
  33.169 @@ -1770,7 +1770,7 @@
  33.170          by (simp add: linear_cmul[OF lf])
  33.171        finally have "f x \<bullet> y = x \<bullet> ?w"
  33.172          apply (simp only: )
  33.173 -        apply (simp add: inner_vector_def setsum_left_distrib setsum_right_distrib setsum_commute[of _ ?M ?N] ring_simps)
  33.174 +        apply (simp add: inner_vector_def setsum_left_distrib setsum_right_distrib setsum_commute[of _ ?M ?N] field_simps)
  33.175          done}
  33.176    }
  33.177    then show ?thesis unfolding adjoint_def
  33.178 @@ -1835,7 +1835,7 @@
  33.179  
  33.180  lemma mat_0[simp]: "mat 0 = 0" by (vector mat_def)
  33.181  lemma matrix_add_ldistrib: "(A ** (B + C)) = (A ** B) + (A ** C)"
  33.182 -  by (vector matrix_matrix_mult_def setsum_addf[symmetric] ring_simps)
  33.183 +  by (vector matrix_matrix_mult_def setsum_addf[symmetric] field_simps)
  33.184  
  33.185  lemma matrix_mul_lid:
  33.186    fixes A :: "'a::semiring_1 ^ 'm ^ 'n"
  33.187 @@ -1954,7 +1954,7 @@
  33.188  where "matrix f = (\<chi> i j. (f(basis j))$i)"
  33.189  
  33.190  lemma matrix_vector_mul_linear: "linear(\<lambda>x. A *v (x::'a::comm_semiring_1 ^ _))"
  33.191 -  by (simp add: linear_def matrix_vector_mult_def Cart_eq ring_simps setsum_right_distrib setsum_addf)
  33.192 +  by (simp add: linear_def matrix_vector_mult_def Cart_eq field_simps setsum_right_distrib setsum_addf)
  33.193  
  33.194  lemma matrix_works: assumes lf: "linear f" shows "matrix f *v x = f (x::'a::comm_ring_1 ^ 'n)"
  33.195  apply (simp add: matrix_def matrix_vector_mult_def Cart_eq mult_commute)
  33.196 @@ -2008,7 +2008,7 @@
  33.197  proof-
  33.198    have uv': "u = 0 \<longrightarrow> v \<noteq> 0" using u v uv by arith
  33.199    have "a = a * (u + v)" unfolding uv  by simp
  33.200 -  hence th: "u * a + v * a = a" by (simp add: ring_simps)
  33.201 +  hence th: "u * a + v * a = a" by (simp add: field_simps)
  33.202    from xa u have "u \<noteq> 0 \<Longrightarrow> u*x < u*a" by (simp add: mult_strict_left_mono)
  33.203    from ya v have "v \<noteq> 0 \<Longrightarrow> v * y < v * a" by (simp add: mult_strict_left_mono)
  33.204    from xa ya u v have "u * x + v * y < u * a + v * a"
  33.205 @@ -2031,7 +2031,7 @@
  33.206    shows "u * x + v * y \<le> a"
  33.207  proof-
  33.208    from xa ya u v have "u * x + v * y \<le> u * a + v * a" by (simp add: add_mono mult_left_mono)
  33.209 -  also have "\<dots> \<le> (u + v) * a" by (simp add: ring_simps)
  33.210 +  also have "\<dots> \<le> (u + v) * a" by (simp add: field_simps)
  33.211    finally show ?thesis unfolding uv by simp
  33.212  qed
  33.213  
  33.214 @@ -2052,7 +2052,7 @@
  33.215    shows "x <= y + z"
  33.216  proof-
  33.217    have "y^2 + z^2 \<le> y^2 + 2*y*z + z^2" using z y by (simp add: mult_nonneg_nonneg)
  33.218 -  with xy have th: "x ^2 \<le> (y+z)^2" by (simp add: power2_eq_square ring_simps)
  33.219 +  with xy have th: "x ^2 \<le> (y+z)^2" by (simp add: power2_eq_square field_simps)
  33.220    from y z have yz: "y + z \<ge> 0" by arith
  33.221    from power2_le_imp_le[OF th yz] show ?thesis .
  33.222  qed
  33.223 @@ -2543,9 +2543,9 @@
  33.224    from h have p: "1 \<le> (1 + x) ^ n" using Suc.prems by simp
  33.225    from h have "1 + real n * x + x \<le> (1 + x) ^ n + x" by simp
  33.226    also have "\<dots> \<le> (1 + x) ^ Suc n" apply (subst diff_le_0_iff_le[symmetric])
  33.227 -    apply (simp add: ring_simps)
  33.228 +    apply (simp add: field_simps)
  33.229      using mult_left_mono[OF p Suc.prems] by simp
  33.230 -  finally show ?case  by (simp add: real_of_nat_Suc ring_simps)
  33.231 +  finally show ?case  by (simp add: real_of_nat_Suc field_simps)
  33.232  qed
  33.233  
  33.234  lemma real_arch_pow: assumes x: "1 < (x::real)" shows "\<exists>n. y < x^n"
  33.235 @@ -2611,10 +2611,10 @@
  33.236      from geometric_sum[OF x1, of "Suc n", unfolded x1']
  33.237      have "(- (1 - x)) * setsum (\<lambda>i. x^i) {0 .. n} = - (1 - x^(Suc n))"
  33.238        unfolding atLeastLessThanSuc_atLeastAtMost
  33.239 -      using x1' apply (auto simp only: field_eq_simps)
  33.240 -      apply (simp add: ring_simps)
  33.241 +      using x1' apply (auto simp only: field_simps)
  33.242 +      apply (simp add: field_simps)
  33.243        done
  33.244 -    then have ?thesis by (simp add: ring_simps) }
  33.245 +    then have ?thesis by (simp add: field_simps) }
  33.246    ultimately show ?thesis by metis
  33.247  qed
  33.248  
  33.249 @@ -2633,7 +2633,7 @@
  33.250    from setsum_reindex[OF i, of "op ^ x", unfolded f th setsum_right_distrib[symmetric]]
  33.251    have "?lhs = x^m * ((1 - x) * setsum (op ^ x) {0..n - m})" by simp
  33.252    then show ?thesis unfolding sum_gp_basic using mn
  33.253 -    by (simp add: ring_simps power_add[symmetric])
  33.254 +    by (simp add: field_simps power_add[symmetric])
  33.255  qed
  33.256  
  33.257  lemma sum_gp: "setsum (op ^ (x::'a::{field})) {m .. n} =
  33.258 @@ -2646,7 +2646,7 @@
  33.259      {assume x: "x = 1"  hence ?thesis by simp}
  33.260      moreover
  33.261      {assume x: "x \<noteq> 1" hence nz: "1 - x \<noteq> 0" by simp
  33.262 -      from sum_gp_multiplied[OF nm, of x] nz have ?thesis by (simp add: field_eq_simps)}
  33.263 +      from sum_gp_multiplied[OF nm, of x] nz have ?thesis by (simp add: field_simps)}
  33.264      ultimately have ?thesis by metis
  33.265    }
  33.266    ultimately show ?thesis by metis
  33.267 @@ -2655,7 +2655,7 @@
  33.268  lemma sum_gp_offset: "setsum (op ^ (x::'a::{field})) {m .. m+n} =
  33.269    (if x = 1 then of_nat n + 1 else x^m * (1 - x^Suc n) / (1 - x))"
  33.270    unfolding sum_gp[of x m "m + n"] power_Suc
  33.271 -  by (simp add: ring_simps power_add)
  33.272 +  by (simp add: field_simps power_add)
  33.273  
  33.274  
  33.275  subsection{* A bit of linear algebra. *}
  33.276 @@ -2929,14 +2929,14 @@
  33.277      apply (simp only: )
  33.278      apply (rule span_add[unfolded mem_def])
  33.279      apply assumption+
  33.280 -    apply (vector ring_simps)
  33.281 +    apply (vector field_simps)
  33.282      apply (clarsimp simp add: mem_def)
  33.283      apply (rule_tac x= "c*k" in exI)
  33.284      apply (subgoal_tac "c *s x - (c * k) *s b = c*s (x - k*s b)")
  33.285      apply (simp only: )
  33.286      apply (rule span_mul[unfolded mem_def])
  33.287      apply assumption
  33.288 -    by (vector ring_simps)
  33.289 +    by (vector field_simps)
  33.290    ultimately show "?P a" using aS span_induct[where S=S and P= "?P"] by metis
  33.291  qed
  33.292  
  33.293 @@ -3082,7 +3082,7 @@
  33.294            setsum_clauses(2)[OF fS] cong del: if_weak_cong)
  33.295        also have "\<dots> = (\<Sum>v\<in>S. u v *s v) + c *s x"
  33.296          apply (simp add: setsum_Un_disjoint[OF Sss, unfolded S1[symmetric]])
  33.297 -        by (vector ring_simps)
  33.298 +        by (vector field_simps)
  33.299        also have "\<dots> = c*s x + y"
  33.300          by (simp add: add_commute u)
  33.301        finally have "setsum (\<lambda>v. ?u v *s v) ?S = c*s x + y" .
  33.302 @@ -3119,7 +3119,7 @@
  33.303      from fS SP aP have th0: "finite ?S" "?S \<subseteq> P" "?v \<in> ?S" "?u ?v \<noteq> 0" by auto
  33.304      have s0: "setsum (\<lambda>v. ?u v *s v) ?S = 0"
  33.305        using fS aS
  33.306 -      apply (simp add: vector_smult_lneg setsum_clauses ring_simps)
  33.307 +      apply (simp add: vector_smult_lneg setsum_clauses field_simps)
  33.308        apply (subst (2) ua[symmetric])
  33.309        apply (rule setsum_cong2)
  33.310        by auto
  33.311 @@ -3652,7 +3652,7 @@
  33.312    from C(1) have fC: "finite ?C" by simp
  33.313    from fB aB C(1,2) have cC: "card ?C \<le> card (insert a B)" by (simp add: card_insert_if)
  33.314    {fix x k
  33.315 -    have th0: "\<And>(a::'b::comm_ring) b c. a - (b - c) = c + (a - b)" by (simp add: ring_simps)
  33.316 +    have th0: "\<And>(a::'b::comm_ring) b c. a - (b - c) = c + (a - b)" by (simp add: field_simps)
  33.317      have "x - k *s (a - (\<Sum>x\<in>C. (x \<bullet> a / (x \<bullet> x)) *s x)) \<in> span C \<longleftrightarrow> x - k *s a \<in> span C"
  33.318        apply (simp only: vector_ssub_ldistrib th0)
  33.319        apply (rule span_add_eq)
  33.320 @@ -3872,7 +3872,7 @@
  33.321        using z .
  33.322      {fix k assume k: "z - k *s a \<in> span b"
  33.323        have eq: "z - ?h z *s a - (z - k*s a) = (k - ?h z) *s a"
  33.324 -        by (simp add: ring_simps vector_sadd_rdistrib[symmetric])
  33.325 +        by (simp add: field_simps vector_sadd_rdistrib[symmetric])
  33.326        from span_sub[OF th0 k]
  33.327        have khz: "(k - ?h z) *s a \<in> span b" by (simp add: eq)
  33.328        {assume "k \<noteq> ?h z" hence k0: "k - ?h z \<noteq> 0" by simp
  33.329 @@ -3886,7 +3886,7 @@
  33.330    let ?g = "\<lambda>z. ?h z *s f a + g (z - ?h z *s a)"
  33.331    {fix x y assume x: "x \<in> span (insert a b)" and y: "y \<in> span (insert a b)"
  33.332      have tha: "\<And>(x::'a^'n) y a k l. (x + y) - (k + l) *s a = (x - k *s a) + (y - l *s a)"
  33.333 -      by (vector ring_simps)
  33.334 +      by (vector field_simps)
  33.335      have addh: "?h (x + y) = ?h x + ?h y"
  33.336        apply (rule conjunct2[OF h, rule_format, symmetric])
  33.337        apply (rule span_add[OF x y])
  33.338 @@ -3899,14 +3899,14 @@
  33.339    moreover
  33.340    {fix x:: "'a^'n" and c:: 'a  assume x: "x \<in> span (insert a b)"
  33.341      have tha: "\<And>(x::'a^'n) c k a. c *s x - (c * k) *s a = c *s (x - k *s a)"
  33.342 -      by (vector ring_simps)
  33.343 +      by (vector field_simps)
  33.344      have hc: "?h (c *s x) = c * ?h x"
  33.345        apply (rule conjunct2[OF h, rule_format, symmetric])
  33.346        apply (metis span_mul x)
  33.347        by (metis tha span_mul x conjunct1[OF h])
  33.348      have "?g (c *s x) = c*s ?g x"
  33.349        unfolding hc tha g(2)[rule_format, OF conjunct1[OF h, OF x]]
  33.350 -      by (vector ring_simps)}
  33.351 +      by (vector field_simps)}
  33.352    moreover
  33.353    {fix x assume x: "x \<in> (insert a b)"
  33.354      {assume xa: "x = a"
  33.355 @@ -4284,7 +4284,7 @@
  33.356              fix j
  33.357              have th: "\<forall>xa \<in> ?U. (if xa = i then (c + (x$i)) * ((column xa A)$j)
  33.358             else (x$xa) * ((column xa A$j))) = (if xa = i then c * ((column i A)$j) else 0) + ((x$xa) * ((column xa A)$j))" using i(1)
  33.359 -              by (simp add: ring_simps)
  33.360 +              by (simp add: field_simps)
  33.361              have "setsum (\<lambda>xa. if xa = i then (c + (x$i)) * ((column xa A)$j)
  33.362             else (x$xa) * ((column xa A$j))) ?U = setsum (\<lambda>xa. (if xa = i then c * ((column i A)$j) else 0) + ((x$xa) * ((column xa A)$j))) ?U"
  33.363                apply (rule setsum_cong[OF refl])
  33.364 @@ -4627,7 +4627,7 @@
  33.365    from infnorm_triangle[of "x - y" " y"] infnorm_triangle[of "x - y" "-x"]
  33.366    have ths: "infnorm x \<le> infnorm (x - y) + infnorm y"
  33.367      "infnorm y \<le> infnorm (x - y) + infnorm x"
  33.368 -    by (simp_all add: ring_simps infnorm_neg diff_def[symmetric])
  33.369 +    by (simp_all add: field_simps infnorm_neg diff_def[symmetric])
  33.370    from th[OF ths]  show ?thesis .
  33.371  qed
  33.372  
  33.373 @@ -4726,9 +4726,9 @@
  33.374        using x y
  33.375        unfolding inner_simps smult_conv_scaleR
  33.376        unfolding power2_norm_eq_inner[symmetric] power2_eq_square diff_eq_0_iff_eq apply (simp add: inner_commute)
  33.377 -      apply (simp add: ring_simps) by metis
  33.378 +      apply (simp add: field_simps) by metis
  33.379      also have "\<dots> \<longleftrightarrow> (2 * norm x * norm y * (norm x * norm y - x \<bullet> y) = 0)" using x y
  33.380 -      by (simp add: ring_simps inner_commute)
  33.381 +      by (simp add: field_simps inner_commute)
  33.382      also have "\<dots> \<longleftrightarrow> ?lhs" using x y
  33.383        apply simp
  33.384        by metis
  33.385 @@ -4774,7 +4774,7 @@
  33.386      also have "\<dots> \<longleftrightarrow> norm x *s y = norm y *s x"
  33.387        unfolding norm_cauchy_schwarz_eq[symmetric]
  33.388        unfolding power2_norm_eq_inner inner_simps
  33.389 -      by (simp add: power2_norm_eq_inner[symmetric] power2_eq_square inner_commute ring_simps)
  33.390 +      by (simp add: power2_norm_eq_inner[symmetric] power2_eq_square inner_commute field_simps)
  33.391      finally have ?thesis .}
  33.392    ultimately show ?thesis by blast
  33.393  qed
  33.394 @@ -4860,10 +4860,10 @@
  33.395  unfolding vector_smult_assoc
  33.396  unfolding norm_mul
  33.397  apply (subgoal_tac "norm x * c = \<bar>c\<bar> * norm x \<or> norm x * c = - \<bar>c\<bar> * norm x")
  33.398 -apply (case_tac "c <= 0", simp add: ring_simps)
  33.399 -apply (simp add: ring_simps)
  33.400 -apply (case_tac "c <= 0", simp add: ring_simps)
  33.401 -apply (simp add: ring_simps)
  33.402 +apply (case_tac "c <= 0", simp add: field_simps)
  33.403 +apply (simp add: field_simps)
  33.404 +apply (case_tac "c <= 0", simp add: field_simps)
  33.405 +apply (simp add: field_simps)
  33.406  apply simp
  33.407  apply simp
  33.408  done
    34.1 --- a/src/HOL/Multivariate_Analysis/Integration.thy	Mon Apr 26 09:37:46 2010 -0700
    34.2 +++ b/src/HOL/Multivariate_Analysis/Integration.thy	Mon Apr 26 09:45:22 2010 -0700
    34.3 @@ -1131,7 +1131,7 @@
    34.4      guess d2 by(rule has_integralD[OF goal1(2) e]) note d2=this
    34.5      guess p by(rule fine_division_exists[OF gauge_inter[OF d1(1) d2(1)],of a b]) note p=this
    34.6      let ?c = "(\<Sum>(x, k)\<in>p. content k *\<^sub>R f x)" have "norm (k1 - k2) \<le> norm (?c - k2) + norm (?c - k1)"
    34.7 -      using norm_triangle_ineq4[of "k1 - ?c" "k2 - ?c"] by(auto simp add:group_simps norm_minus_commute)
    34.8 +      using norm_triangle_ineq4[of "k1 - ?c" "k2 - ?c"] by(auto simp add:algebra_simps norm_minus_commute)
    34.9      also have "\<dots> < norm (k1 - k2) / 2 + norm (k1 - k2) / 2"
   34.10        apply(rule add_strict_mono) apply(rule_tac[!] d2(2) d1(2)) using p unfolding fine_def by auto
   34.11      finally show False by auto
   34.12 @@ -1244,7 +1244,7 @@
   34.13            unfolding scaleR_right_distrib setsum_addf[of "\<lambda>(x,k). content k *\<^sub>R f x" "\<lambda>(x,k). content k *\<^sub>R g x" p,THEN sym]
   34.14            by(rule setsum_cong2,auto)
   34.15          have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R (f x + g x)) - (k + l)) = norm (((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - k) + ((\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) - l))"
   34.16 -          unfolding * by(auto simp add:group_simps) also let ?res = "\<dots>"
   34.17 +          unfolding * by(auto simp add:algebra_simps) also let ?res = "\<dots>"
   34.18          from as have *:"d1 fine p" "d2 fine p" unfolding fine_inter by auto
   34.19          have "?res < e/2 + e/2" apply(rule le_less_trans[OF norm_triangle_ineq])
   34.20            apply(rule add_strict_mono) using d1(2)[OF as(1) *(1)] and d2(2)[OF as(1) *(2)] by auto
   34.21 @@ -1268,7 +1268,7 @@
   34.22  
   34.23  lemma has_integral_sub:
   34.24    shows "(f has_integral k) s \<Longrightarrow> (g has_integral l) s \<Longrightarrow> ((\<lambda>x. f(x) - g(x)) has_integral (k - l)) s"
   34.25 -  using has_integral_add[OF _ has_integral_neg,of f k s g l] unfolding group_simps by auto
   34.26 +  using has_integral_add[OF _ has_integral_neg,of f k s g l] unfolding algebra_simps by auto
   34.27  
   34.28  lemma integral_0: "integral s (\<lambda>x::real^'n. 0::real^'m) = 0"
   34.29    by(rule integral_unique has_integral_0)+
   34.30 @@ -1703,7 +1703,7 @@
   34.31        proof- guess p using fine_division_exists[OF d(1), of a' b] . note p=this
   34.32          show ?thesis using norm_triangle_half_l[OF d(2)[of p1 p] d(2)[of p2 p]]
   34.33            using as unfolding interval_split b'_def[symmetric] a'_def[symmetric]
   34.34 -          using p using assms by(auto simp add:group_simps)
   34.35 +          using p using assms by(auto simp add:algebra_simps)
   34.36        qed qed  
   34.37      show "?P {x. x $ k \<ge> c}" apply(rule_tac x=d in exI) apply(rule,rule d) apply(rule,rule,rule)
   34.38      proof- fix p1 p2 assume as:"p1 tagged_division_of {a..b} \<inter> {x. x $ k \<ge> c} \<and> d fine p1 \<and> p2 tagged_division_of {a..b} \<inter> {x. x $ k \<ge> c} \<and> d fine p2"
   34.39 @@ -1711,7 +1711,7 @@
   34.40        proof- guess p using fine_division_exists[OF d(1), of a b'] . note p=this
   34.41          show ?thesis using norm_triangle_half_l[OF d(2)[of p p1] d(2)[of p p2]]
   34.42            using as unfolding interval_split b'_def[symmetric] a'_def[symmetric]
   34.43 -          using p using assms by(auto simp add:group_simps) qed qed qed qed
   34.44 +          using p using assms by(auto simp add:algebra_simps) qed qed qed qed
   34.45  
   34.46  subsection {* Generalized notion of additivity. *}
   34.47  
   34.48 @@ -1847,7 +1847,7 @@
   34.49  
   34.50  lemma monoidal_monoid[intro]:
   34.51    shows "monoidal ((op +)::('a::comm_monoid_add) \<Rightarrow> 'a \<Rightarrow> 'a)"
   34.52 -  unfolding monoidal_def neutral_monoid by(auto simp add: group_simps) 
   34.53 +  unfolding monoidal_def neutral_monoid by(auto simp add: algebra_simps) 
   34.54  
   34.55  lemma operative_integral: fixes f::"real^'n \<Rightarrow> 'a::banach"
   34.56    shows "operative (lifted(op +)) (\<lambda>i. if f integrable_on i then Some(integral i f) else None)"
   34.57 @@ -2380,8 +2380,8 @@
   34.58        have lem2:"\<And>s1 s2 i1 i2. norm(s2 - s1) \<le> e/2 \<Longrightarrow> norm(s1 - i1) < e / 4 \<Longrightarrow> norm(s2 - i2) < e / 4 \<Longrightarrow>norm(i1 - i2) < e"
   34.59        proof- case goal1 have "norm (i1 - i2) \<le> norm (i1 - s1) + norm (s1 - s2) + norm (s2 - i2)"
   34.60            using norm_triangle_ineq[of "i1 - s1" "s1 - i2"]
   34.61 -          using norm_triangle_ineq[of "s1 - s2" "s2 - i2"] by(auto simp add:group_simps)
   34.62 -        also have "\<dots> < e" using goal1 unfolding norm_minus_commute by(auto simp add:group_simps)
   34.63 +          using norm_triangle_ineq[of "s1 - s2" "s2 - i2"] by(auto simp add:algebra_simps)
   34.64 +        also have "\<dots> < e" using goal1 unfolding norm_minus_commute by(auto simp add:algebra_simps)
   34.65          finally show ?case .
   34.66        qed
   34.67        show ?case unfolding vector_dist_norm apply(rule lem2) defer
   34.68 @@ -2398,7 +2398,7 @@
   34.69          also have "\<dots> = 2 / real M" unfolding real_divide_def by auto
   34.70          finally show "norm (g n x - g m x) \<le> 2 / real M"
   34.71            using norm_triangle_le[of "g n x - f x" "f x - g m x" "2 / real M"]
   34.72 -          by(auto simp add:group_simps simp add:norm_minus_commute)
   34.73 +          by(auto simp add:algebra_simps simp add:norm_minus_commute)
   34.74        qed qed qed
   34.75    from this[unfolded convergent_eq_cauchy[THEN sym]] guess s .. note s=this
   34.76  
   34.77 @@ -2412,8 +2412,8 @@
   34.78      have lem:"\<And>sf sg i. norm(sf - sg) \<le> e / 3 \<Longrightarrow> norm(i - s) < e / 3 \<Longrightarrow> norm(sg - i) < e / 3 \<Longrightarrow> norm(sf - s) < e"
   34.79      proof- case goal1 have "norm (sf - s) \<le> norm (sf - sg) + norm (sg - i) + norm (i - s)"
   34.80          using norm_triangle_ineq[of "sf - sg" "sg - s"]
   34.81 -        using norm_triangle_ineq[of "sg -  i" " i - s"] by(auto simp add:group_simps)
   34.82 -      also have "\<dots> < e" using goal1 unfolding norm_minus_commute by(auto simp add:group_simps)
   34.83 +        using norm_triangle_ineq[of "sg -  i" " i - s"] by(auto simp add:algebra_simps)
   34.84 +      also have "\<dots> < e" using goal1 unfolding norm_minus_commute by(auto simp add:algebra_simps)
   34.85        finally show ?case .
   34.86      qed
   34.87      show ?case apply(rule_tac x=g' in exI) apply(rule,rule g')
   34.88 @@ -2955,7 +2955,7 @@
   34.89        have ball:"\<forall>xa\<in>k. xa \<in> ball x (d (dest_vec1 x))" using as(2)[unfolded fine_def,rule_format,OF `(x,k)\<in>p`,unfolded split_conv subset_eq] .
   34.90        have "norm ((v$1 - u$1) *\<^sub>R f' x - (f v - f u)) \<le> norm (f u - f x - (u$1 - x$1) *\<^sub>R f' x) + norm (f v - f x - (v$1 - x$1) *\<^sub>R f' x)"
   34.91          apply(rule order_trans[OF _ norm_triangle_ineq4]) apply(rule eq_refl) apply(rule arg_cong[where f=norm])
   34.92 -        unfolding scaleR.diff_left by(auto simp add:group_simps)
   34.93 +        unfolding scaleR.diff_left by(auto simp add:algebra_simps)
   34.94        also have "... \<le> e * norm (dest_vec1 u - dest_vec1 x) + e * norm (dest_vec1 v - dest_vec1 x)"
   34.95          apply(rule add_mono) apply(rule d(2)[of "x$1" "u$1",unfolded o_def vec1_dest_vec1]) prefer 4
   34.96          apply(rule d(2)[of "x$1" "v$1",unfolded o_def vec1_dest_vec1])
   34.97 @@ -3097,7 +3097,7 @@
   34.98    proof(rule,rule,rule d,safe) case goal1 show ?case proof(cases "y < x")
   34.99        case False have "f \<circ> dest_vec1 integrable_on {vec1 a..vec1 y}" apply(rule integrable_subinterval,rule integrable_continuous)
  34.100          apply(rule continuous_on_o_dest_vec1 assms)+  unfolding not_less using assms(2) goal1 by auto
  34.101 -      hence *:"?I a y - ?I a x = ?I x y" unfolding group_simps apply(subst eq_commute) apply(rule integral_combine)
  34.102 +      hence *:"?I a y - ?I a x = ?I x y" unfolding algebra_simps apply(subst eq_commute) apply(rule integral_combine)
  34.103          using False unfolding not_less using assms(2) goal1 by auto
  34.104        have **:"norm (y - x) = content {vec1 x..vec1 y}" apply(subst content_1) using False unfolding not_less by auto
  34.105        show ?thesis unfolding ** apply(rule has_integral_bound[where f="(\<lambda>u. f u - f x) o dest_vec1"]) unfolding * unfolding o_def
  34.106 @@ -3111,7 +3111,7 @@
  34.107        qed(insert e,auto)
  34.108      next case True have "f \<circ> dest_vec1 integrable_on {vec1 a..vec1 x}" apply(rule integrable_subinterval,rule integrable_continuous)
  34.109          apply(rule continuous_on_o_dest_vec1 assms)+  unfolding not_less using assms(2) goal1 by auto
  34.110 -      hence *:"?I a x - ?I a y = ?I y x" unfolding group_simps apply(subst eq_commute) apply(rule integral_combine)
  34.111 +      hence *:"?I a x - ?I a y = ?I y x" unfolding algebra_simps apply(subst eq_commute) apply(rule integral_combine)
  34.112          using True using assms(2) goal1 by auto
  34.113        have **:"norm (y - x) = content {vec1 y..vec1 x}" apply(subst content_1) using True unfolding not_less by auto
  34.114        have ***:"\<And>fy fx c::'a. fx - fy - (y - x) *\<^sub>R c = -(fy - fx - (x - y) *\<^sub>R c)" unfolding scaleR_left.diff by auto 
  34.115 @@ -3193,7 +3193,7 @@
  34.116            apply(rule_tac X="g ` X" in UnionI) defer apply(rule_tac x="h x" in image_eqI)
  34.117            using X(2) assms(3)[rule_format,of x] by auto
  34.118        qed note ** = d(2)[OF this] have *:"inj_on (\<lambda>(x, k). (g x, g ` k)) p" using inj(1) unfolding inj_on_def by fastsimp
  34.119 -       have "(\<Sum>(x, k)\<in>(\<lambda>(x, k). (g x, g ` k)) ` p. content k *\<^sub>R f x) - i = r *\<^sub>R (\<Sum>(x, k)\<in>p. content k *\<^sub>R f (g x)) - i" (is "?l = _") unfolding group_simps add_left_cancel
  34.120 +       have "(\<Sum>(x, k)\<in>(\<lambda>(x, k). (g x, g ` k)) ` p. content k *\<^sub>R f x) - i = r *\<^sub>R (\<Sum>(x, k)\<in>p. content k *\<^sub>R f (g x)) - i" (is "?l = _") unfolding algebra_simps add_left_cancel
  34.121          unfolding setsum_reindex[OF *] apply(subst scaleR_right.setsum) defer apply(rule setsum_cong2) unfolding o_def split_paired_all split_conv
  34.122          apply(drule p(4)) apply safe unfolding assms(7)[rule_format] using p by auto
  34.123        also have "... = r *\<^sub>R ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f (g x)) - (1 / r) *\<^sub>R i)" (is "_ = ?r") unfolding scaleR.diff_right scaleR.scaleR_left[THEN sym]
  34.124 @@ -3331,7 +3331,7 @@
  34.125  
  34.126  lemma norm_triangle_le_sub: "norm x + norm y \<le> e \<Longrightarrow> norm (x - y) \<le> e"
  34.127    apply(subst(asm)(2) norm_minus_cancel[THEN sym])
  34.128 -  apply(drule norm_triangle_le) by(auto simp add:group_simps)
  34.129 +  apply(drule norm_triangle_le) by(auto simp add:algebra_simps)
  34.130  
  34.131  lemma fundamental_theorem_of_calculus_interior:
  34.132    assumes"a \<le> b" "continuous_on {a..b} f" "\<forall>x\<in>{a<..<b}. (f has_vector_derivative f'(x)) (at x)"
  34.133 @@ -3640,11 +3640,11 @@
  34.134    proof safe show "0 < ?d" using d(1) assms(3) unfolding Cart_simps by auto
  34.135      fix t::"_^1" assume as:"c \<le> t" "t$1 < c$1 + ?d"
  34.136      have *:"integral{a..c} f = integral{a..b} f - integral{c..b} f"
  34.137 -      "integral{a..t} f = integral{a..b} f - integral{t..b} f" unfolding group_simps
  34.138 +      "integral{a..t} f = integral{a..b} f - integral{t..b} f" unfolding algebra_simps
  34.139        apply(rule_tac[!] integral_combine) using assms as unfolding Cart_simps by auto
  34.140      have "(- c)$1 - d < (- t)$1 \<and> - t \<le> - c" using as by auto note d(2)[rule_format,OF this]
  34.141      thus "norm (integral {a..c} f - integral {a..t} f) < e" unfolding * 
  34.142 -      unfolding integral_reflect apply-apply(subst norm_minus_commute) by(auto simp add:group_simps) qed qed
  34.143 +      unfolding integral_reflect apply-apply(subst norm_minus_commute) by(auto simp add:algebra_simps) qed qed
  34.144  
  34.145  declare dest_vec1_eq[simp del] not_less[simp] not_le[simp]
  34.146  
  34.147 @@ -3714,7 +3714,7 @@
  34.148      apply safe apply(rule conv) using assms(4,7) by auto
  34.149    have *:"\<And>t xa. (1 - t) *\<^sub>R c + t *\<^sub>R x = (1 - xa) *\<^sub>R c + xa *\<^sub>R x \<Longrightarrow> t = xa"
  34.150    proof- case goal1 hence "(t - xa) *\<^sub>R x = (t - xa) *\<^sub>R c" 
  34.151 -      unfolding scaleR_simps by(auto simp add:group_simps)
  34.152 +      unfolding scaleR_simps by(auto simp add:algebra_simps)
  34.153      thus ?case using `x\<noteq>c` by auto qed
  34.154    have as2:"finite {t. ((1 - t) *\<^sub>R c + t *\<^sub>R x) \<in> k}" using assms(2) 
  34.155      apply(rule finite_surj[where f="\<lambda>z. SOME t. (1-t) *\<^sub>R c + t *\<^sub>R x = z"])
  34.156 @@ -4389,7 +4389,7 @@
  34.157    have *:"\<And>ir ip i cr cp. norm((cp + cr) - i) < e \<Longrightarrow> norm(cr - ir) < k \<Longrightarrow> 
  34.158      ip + ir = i \<Longrightarrow> norm(cp - ip) \<le> e + k" 
  34.159    proof- case goal1 thus ?case  using norm_triangle_le[of "cp + cr - i" "- (cr - ir)"]  
  34.160 -      unfolding goal1(3)[THEN sym] norm_minus_cancel by(auto simp add:group_simps) qed
  34.161 +      unfolding goal1(3)[THEN sym] norm_minus_cancel by(auto simp add:algebra_simps) qed
  34.162    
  34.163    have "?x =  norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - (\<Sum>(x, k)\<in>p. integral k f))"
  34.164      unfolding split_def setsum_subtractf ..
  34.165 @@ -4500,7 +4500,7 @@
  34.166              norm(c - d) < e / 4 \<longrightarrow> norm(a - d) < e" 
  34.167        proof safe case goal1 thus ?case using norm_triangle_lt[of "a - b" "b - c" "3* e/4"]
  34.168            norm_triangle_lt[of "a - b + (b - c)" "c - d" e] unfolding norm_minus_cancel
  34.169 -          by(auto simp add:group_simps) qed
  34.170 +          by(auto simp add:algebra_simps) qed
  34.171        show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) - i) < e" apply(rule *[rule_format,where
  34.172            b="\<Sum>(x, k)\<in>p. content k *\<^sub>R f (m x) x" and c="\<Sum>(x, k)\<in>p. integral k (f (m x))"])
  34.173        proof safe case goal1
  34.174 @@ -5151,7 +5151,7 @@
  34.175    assumes "f absolutely_integrable_on s" "g absolutely_integrable_on s"
  34.176    shows "(\<lambda>x. f(x) - g(x)) absolutely_integrable_on s"
  34.177    using absolutely_integrable_add[OF assms(1) absolutely_integrable_neg[OF assms(2)]]
  34.178 -  unfolding group_simps .
  34.179 +  unfolding algebra_simps .
  34.180  
  34.181  lemma absolutely_integrable_linear: fixes f::"real^'m \<Rightarrow> real^'n" and h::"real^'n \<Rightarrow> real^'p"
  34.182    assumes "f absolutely_integrable_on s" "bounded_linear h"
    35.1 --- a/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy	Mon Apr 26 09:37:46 2010 -0700
    35.2 +++ b/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy	Mon Apr 26 09:45:22 2010 -0700
    35.3 @@ -4499,7 +4499,7 @@
    35.4    let ?D = "{norm (x - y) |x y. x \<in> s \<and> y \<in> s}"
    35.5    obtain a where a:"\<forall>x\<in>s. norm x \<le> a" using assms[unfolded bounded_iff] by auto
    35.6    { fix x y assume "x \<in> s" "y \<in> s"
    35.7 -    hence "norm (x - y) \<le> 2 * a" using norm_triangle_ineq[of x "-y", unfolded norm_minus_cancel] a[THEN bspec[where x=x]] a[THEN bspec[where x=y]] by (auto simp add: ring_simps)  }
    35.8 +    hence "norm (x - y) \<le> 2 * a" using norm_triangle_ineq[of x "-y", unfolded norm_minus_cancel] a[THEN bspec[where x=x]] a[THEN bspec[where x=y]] by (auto simp add: field_simps)  }
    35.9    note * = this
   35.10    { fix x y assume "x\<in>s" "y\<in>s"  hence "s \<noteq> {}" by auto
   35.11      have "norm(x - y) \<le> diameter s" unfolding diameter_def using `s\<noteq>{}` *[OF `x\<in>s` `y\<in>s`] `x\<in>s` `y\<in>s`
   35.12 @@ -5811,7 +5811,7 @@
   35.13    shows "m *s x + c = y \<longleftrightarrow> x = inverse m *s y + -(inverse m *s c)"
   35.14  proof
   35.15    assume h: "m *s x + c = y"
   35.16 -  hence "m *s x = y - c" by (simp add: ring_simps)
   35.17 +  hence "m *s x = y - c" by (simp add: field_simps)
   35.18    hence "inverse m *s (m *s x) = inverse m *s (y - c)" by simp
   35.19    then show "x = inverse m *s y + - (inverse m *s c)"
   35.20      using m0 by (simp add: vector_smult_assoc vector_ssub_ldistrib)
   35.21 @@ -5913,11 +5913,11 @@
   35.22        also have "\<dots> \<le> (1 - c) * (dist (z m) (z (m + k)) + c ^ (m + k) * d)"
   35.23          using cf_z[of "m + k"] and c by auto
   35.24        also have "\<dots> \<le> c ^ m * d * (1 - c ^ k) + (1 - c) * c ^ (m + k) * d"
   35.25 -        using Suc by (auto simp add: ring_simps)
   35.26 +        using Suc by (auto simp add: field_simps)
   35.27        also have "\<dots> = (c ^ m) * (d * (1 - c ^ k) + (1 - c) * c ^ k * d)"
   35.28 -        unfolding power_add by (auto simp add: ring_simps)
   35.29 +        unfolding power_add by (auto simp add: field_simps)
   35.30        also have "\<dots> \<le> (c ^ m) * d * (1 - c ^ Suc k)"
   35.31 -        using c by (auto simp add: ring_simps)
   35.32 +        using c by (auto simp add: field_simps)
   35.33        finally show ?case by auto
   35.34      qed
   35.35    } note cf_z2 = this
   35.36 @@ -6074,7 +6074,7 @@
   35.37          apply(erule_tac x="Na+Nb+n" in allE) apply simp
   35.38          using dist_triangle_add_half[of a "f (r (Na + Nb + n)) x" "dist a b - dist (f n x) (f n y)"
   35.39            "-b"  "- f (r (Na + Nb + n)) y"]
   35.40 -        unfolding ** unfolding group_simps(12) by (auto simp add: dist_commute)
   35.41 +        unfolding ** by (auto simp add: algebra_simps dist_commute)
   35.42        moreover
   35.43        have "dist (f (r (Na + Nb + n)) x - f (r (Na + Nb + n)) y) (a - b) \<ge> dist a b - dist (f n x) (f n y)"
   35.44          using distf[of n "r (Na+Nb+n)", OF _ `x\<in>s` `y\<in>s`]
    36.1 --- a/src/HOL/NSA/HyperDef.thy	Mon Apr 26 09:37:46 2010 -0700
    36.2 +++ b/src/HOL/NSA/HyperDef.thy	Mon Apr 26 09:45:22 2010 -0700
    36.3 @@ -140,12 +140,12 @@
    36.4  
    36.5  lemma of_hypreal_inverse [simp]:
    36.6    "\<And>x. of_hypreal (inverse x) =
    36.7 -   inverse (of_hypreal x :: 'a::{real_div_algebra,division_by_zero} star)"
    36.8 +   inverse (of_hypreal x :: 'a::{real_div_algebra,division_ring_inverse_zero} star)"
    36.9  by transfer (rule of_real_inverse)
   36.10  
   36.11  lemma of_hypreal_divide [simp]:
   36.12    "\<And>x y. of_hypreal (x / y) =
   36.13 -   (of_hypreal x / of_hypreal y :: 'a::{real_field,division_by_zero} star)"
   36.14 +   (of_hypreal x / of_hypreal y :: 'a::{real_field,division_ring_inverse_zero} star)"
   36.15  by transfer (rule of_real_divide)
   36.16  
   36.17  lemma of_hypreal_eq_iff [simp]:
   36.18 @@ -454,7 +454,7 @@
   36.19  by transfer (rule field_power_not_zero)
   36.20  
   36.21  lemma hyperpow_inverse:
   36.22 -  "\<And>r n. r \<noteq> (0::'a::{division_by_zero,field} star)
   36.23 +  "\<And>r n. r \<noteq> (0::'a::{division_ring_inverse_zero,field} star)
   36.24     \<Longrightarrow> inverse (r pow n) = (inverse r) pow n"
   36.25  by transfer (rule power_inverse)
   36.26    
    37.1 --- a/src/HOL/NSA/NSA.thy	Mon Apr 26 09:37:46 2010 -0700
    37.2 +++ b/src/HOL/NSA/NSA.thy	Mon Apr 26 09:45:22 2010 -0700
    37.3 @@ -145,12 +145,12 @@
    37.4  by transfer (rule nonzero_norm_inverse)
    37.5  
    37.6  lemma hnorm_inverse:
    37.7 -  "\<And>a::'a::{real_normed_div_algebra,division_by_zero} star.
    37.8 +  "\<And>a::'a::{real_normed_div_algebra,division_ring_inverse_zero} star.
    37.9     hnorm (inverse a) = inverse (hnorm a)"
   37.10  by transfer (rule norm_inverse)
   37.11  
   37.12  lemma hnorm_divide:
   37.13 -  "\<And>a b::'a::{real_normed_field,division_by_zero} star.
   37.14 +  "\<And>a b::'a::{real_normed_field,division_ring_inverse_zero} star.
   37.15     hnorm (a / b) = hnorm a / hnorm b"
   37.16  by transfer (rule norm_divide)
   37.17  
    38.1 --- a/src/HOL/NSA/StarDef.thy	Mon Apr 26 09:37:46 2010 -0700
    38.2 +++ b/src/HOL/NSA/StarDef.thy	Mon Apr 26 09:45:22 2010 -0700
    38.3 @@ -902,7 +902,7 @@
    38.4  apply (transfer, rule divide_inverse)
    38.5  done
    38.6  
    38.7 -instance star :: (division_by_zero) division_by_zero
    38.8 +instance star :: (division_ring_inverse_zero) division_ring_inverse_zero
    38.9  by (intro_classes, transfer, rule inverse_zero)
   38.10  
   38.11  instance star :: (ordered_semiring) ordered_semiring
    39.1 --- a/src/HOL/Nominal/nominal_inductive.ML	Mon Apr 26 09:37:46 2010 -0700
    39.2 +++ b/src/HOL/Nominal/nominal_inductive.ML	Mon Apr 26 09:45:22 2010 -0700
    39.3 @@ -543,7 +543,7 @@
    39.4  
    39.5    in
    39.6      ctxt'' |>
    39.7 -    Proof.theorem_i NONE (fn thss => fn ctxt =>
    39.8 +    Proof.theorem NONE (fn thss => fn ctxt =>
    39.9        let
   39.10          val rec_name = space_implode "_" (map Long_Name.base_name names);
   39.11          val rec_qualified = Binding.qualify false rec_name;
    40.1 --- a/src/HOL/Nominal/nominal_inductive2.ML	Mon Apr 26 09:37:46 2010 -0700
    40.2 +++ b/src/HOL/Nominal/nominal_inductive2.ML	Mon Apr 26 09:45:22 2010 -0700
    40.3 @@ -445,7 +445,7 @@
    40.4  
    40.5    in
    40.6      ctxt'' |>
    40.7 -    Proof.theorem_i NONE (fn thss => fn ctxt =>
    40.8 +    Proof.theorem NONE (fn thss => fn ctxt =>
    40.9        let
   40.10          val rec_name = space_implode "_" (map Long_Name.base_name names);
   40.11          val rec_qualified = Binding.qualify false rec_name;
    41.1 --- a/src/HOL/Nominal/nominal_primrec.ML	Mon Apr 26 09:37:46 2010 -0700
    41.2 +++ b/src/HOL/Nominal/nominal_primrec.ML	Mon Apr 26 09:45:22 2010 -0700
    41.3 @@ -363,7 +363,7 @@
    41.4    in
    41.5      lthy' |>
    41.6      Variable.add_fixes (map fst lsrs) |> snd |>
    41.7 -    Proof.theorem_i NONE
    41.8 +    Proof.theorem NONE
    41.9        (fn thss => fn goal_ctxt =>
   41.10           let
   41.11             val simps = ProofContext.export goal_ctxt lthy' (flat thss);
    42.1 --- a/src/HOL/Number_Theory/Binomial.thy	Mon Apr 26 09:37:46 2010 -0700
    42.2 +++ b/src/HOL/Number_Theory/Binomial.thy	Mon Apr 26 09:45:22 2010 -0700
    42.3 @@ -208,7 +208,7 @@
    42.4    have "fact (k + 1) * fact (n - k) * (n + 1 choose (k + 1)) =
    42.5        fact (k + 1) * fact (n - k) * (n choose (k + 1)) + 
    42.6        fact (k + 1) * fact (n - k) * (n choose k)" 
    42.7 -    by (subst choose_reduce_nat, auto simp add: ring_simps)
    42.8 +    by (subst choose_reduce_nat, auto simp add: field_simps)
    42.9    also note one
   42.10    also note two
   42.11    also with less have "(n - k) * fact n + (k + 1) * fact n= fact (n + 1)" 
   42.12 @@ -279,7 +279,7 @@
   42.13    also have "... = (SUM k=0..n. of_nat (n choose k) * a^k * b^(n+1-k)) +
   42.14                    (SUM k=1..n+1. of_nat (n choose (k - 1)) * a^k * b^(n+1-k))"
   42.15      by (simp add:setsum_shift_bounds_cl_Suc_ivl Suc_diff_le 
   42.16 -             power_Suc ring_simps One_nat_def del:setsum_cl_ivl_Suc)
   42.17 +             power_Suc field_simps One_nat_def del:setsum_cl_ivl_Suc)
   42.18    also have "... = a^(n+1) + b^(n+1) +
   42.19                    (SUM k=1..n. of_nat (n choose (k - 1)) * a^k * b^(n+1-k)) +
   42.20                    (SUM k=1..n. of_nat (n choose k) * a^k * b^(n+1-k))"
   42.21 @@ -287,10 +287,10 @@
   42.22    also have
   42.23        "... = a^(n+1) + b^(n+1) + 
   42.24           (SUM k=1..n. of_nat(n+1 choose k) * a^k * b^(n+1-k))"
   42.25 -    by (auto simp add: ring_simps setsum_addf [symmetric]
   42.26 +    by (auto simp add: field_simps setsum_addf [symmetric]
   42.27        choose_reduce_nat)
   42.28    also have "... = (SUM k=0..n+1. of_nat (n+1 choose k) * a^k * b^(n+1-k))"
   42.29 -    using decomp by (simp add: ring_simps)
   42.30 +    using decomp by (simp add: field_simps)
   42.31    finally show "?P (n + 1)" by simp
   42.32  qed
   42.33  
    43.1 --- a/src/HOL/Number_Theory/Cong.thy	Mon Apr 26 09:37:46 2010 -0700
    43.2 +++ b/src/HOL/Number_Theory/Cong.thy	Mon Apr 26 09:45:22 2010 -0700
    43.3 @@ -350,7 +350,7 @@
    43.4    apply (subst prime_dvd_mult_eq_int [symmetric], assumption)
    43.5    (* any way around this? *)
    43.6    apply (subgoal_tac "a * a - 1 = (a - 1) * (a - -1)")
    43.7 -  apply (auto simp add: ring_simps)
    43.8 +  apply (auto simp add: field_simps)
    43.9  done
   43.10  
   43.11  lemma cong_mult_rcancel_int:
   43.12 @@ -416,7 +416,7 @@
   43.13  done
   43.14  
   43.15  lemma cong_iff_lin_int: "([(a::int) = b] (mod m)) = (\<exists>k. b = a + m * k)"
   43.16 -  apply (auto simp add: cong_altdef_int dvd_def ring_simps)
   43.17 +  apply (auto simp add: cong_altdef_int dvd_def field_simps)
   43.18    apply (rule_tac [!] x = "-k" in exI, auto)
   43.19  done
   43.20  
   43.21 @@ -428,14 +428,14 @@
   43.22    apply (unfold dvd_def, auto)
   43.23    apply (rule_tac x = k in exI)
   43.24    apply (rule_tac x = 0 in exI)
   43.25 -  apply (auto simp add: ring_simps)
   43.26 +  apply (auto simp add: field_simps)
   43.27    apply (subst (asm) cong_sym_eq_nat)
   43.28    apply (subst (asm) cong_altdef_nat)
   43.29    apply force
   43.30    apply (unfold dvd_def, auto)
   43.31    apply (rule_tac x = 0 in exI)
   43.32    apply (rule_tac x = k in exI)
   43.33 -  apply (auto simp add: ring_simps)
   43.34 +  apply (auto simp add: field_simps)
   43.35    apply (unfold cong_nat_def)
   43.36    apply (subgoal_tac "a mod m = (a + k2 * m) mod m")
   43.37    apply (erule ssubst)back
   43.38 @@ -533,7 +533,7 @@
   43.39    apply (auto simp add: cong_iff_lin_nat dvd_def)
   43.40    apply (rule_tac x="k1 * k" in exI)
   43.41    apply (rule_tac x="k2 * k" in exI)
   43.42 -  apply (simp add: ring_simps)
   43.43 +  apply (simp add: field_simps)
   43.44  done
   43.45  
   43.46  lemma cong_dvd_modulus_int: "[(x::int) = y] (mod m) \<Longrightarrow> n dvd m \<Longrightarrow> 
   43.47 @@ -559,7 +559,7 @@
   43.48  lemma neg_cong_int: "([(a::int) = b] (mod m)) = ([-a = -b] (mod m))"
   43.49    apply (simp add: cong_altdef_int)
   43.50    apply (subst dvd_minus_iff [symmetric])
   43.51 -  apply (simp add: ring_simps)
   43.52 +  apply (simp add: field_simps)
   43.53  done
   43.54  
   43.55  lemma cong_modulus_neg_int: "([(a::int) = b] (mod m)) = ([a = b] (mod -m))"
   43.56 @@ -603,7 +603,7 @@
   43.57    apply (unfold dvd_def)
   43.58    apply auto [1]
   43.59    apply (rule_tac x = k in exI)
   43.60 -  apply (auto simp add: ring_simps) [1]
   43.61 +  apply (auto simp add: field_simps) [1]
   43.62    apply (subst cong_altdef_nat)
   43.63    apply (auto simp add: dvd_def)
   43.64  done
   43.65 @@ -611,7 +611,7 @@
   43.66  lemma cong_le_nat: "(y::nat) <= x \<Longrightarrow> [x = y] (mod n) \<longleftrightarrow> (\<exists>q. x = q * n + y)"
   43.67    apply (subst cong_altdef_nat)
   43.68    apply assumption
   43.69 -  apply (unfold dvd_def, auto simp add: ring_simps)
   43.70 +  apply (unfold dvd_def, auto simp add: field_simps)
   43.71    apply (rule_tac x = k in exI)
   43.72    apply auto
   43.73  done
    44.1 --- a/src/HOL/Number_Theory/Fib.thy	Mon Apr 26 09:37:46 2010 -0700
    44.2 +++ b/src/HOL/Number_Theory/Fib.thy	Mon Apr 26 09:45:22 2010 -0700
    44.3 @@ -143,9 +143,9 @@
    44.4    apply (induct n rule: fib_induct_nat)
    44.5    apply auto
    44.6    apply (subst fib_reduce_nat)
    44.7 -  apply (auto simp add: ring_simps)
    44.8 +  apply (auto simp add: field_simps)
    44.9    apply (subst (1 3 5) fib_reduce_nat)
   44.10 -  apply (auto simp add: ring_simps Suc_eq_plus1)
   44.11 +  apply (auto simp add: field_simps Suc_eq_plus1)
   44.12  (* hmmm. Why doesn't "n + (1 + (1 + k))" simplify to "n + k + 2"? *)
   44.13    apply (subgoal_tac "n + (k + 2) = n + (1 + (1 + k))")
   44.14    apply (erule ssubst) back back
   44.15 @@ -184,7 +184,7 @@
   44.16  lemma fib_Cassini_aux_int: "fib (int n + 2) * fib (int n) - 
   44.17      (fib (int n + 1))^2 = (-1)^(n + 1)"
   44.18    apply (induct n)
   44.19 -  apply (auto simp add: ring_simps power2_eq_square fib_reduce_int
   44.20 +  apply (auto simp add: field_simps power2_eq_square fib_reduce_int
   44.21        power_add)
   44.22  done
   44.23  
   44.24 @@ -222,7 +222,7 @@
   44.25    apply (subst (2) fib_reduce_nat)
   44.26    apply (auto simp add: Suc_eq_plus1) (* again, natdiff_cancel *)
   44.27    apply (subst add_commute, auto)
   44.28 -  apply (subst gcd_commute_nat, auto simp add: ring_simps)
   44.29 +  apply (subst gcd_commute_nat, auto simp add: field_simps)
   44.30  done
   44.31  
   44.32  lemma coprime_fib_Suc_nat: "coprime (fib n) (fib (Suc n))"
   44.33 @@ -305,7 +305,7 @@
   44.34  theorem fib_mult_eq_setsum_nat:
   44.35      "fib ((n::nat) + 1) * fib n = (\<Sum>k \<in> {..n}. fib k * fib k)"
   44.36    apply (induct n)
   44.37 -  apply (auto simp add: atMost_plus_one_nat fib_plus_2_nat ring_simps)
   44.38 +  apply (auto simp add: atMost_plus_one_nat fib_plus_2_nat field_simps)
   44.39  done
   44.40  
   44.41  theorem fib_mult_eq_setsum'_nat:
    45.1 --- a/src/HOL/Number_Theory/Residues.thy	Mon Apr 26 09:37:46 2010 -0700
    45.2 +++ b/src/HOL/Number_Theory/Residues.thy	Mon Apr 26 09:45:22 2010 -0700
    45.3 @@ -69,7 +69,7 @@
    45.4    apply (subst mod_add_eq [symmetric])
    45.5    apply (subst mult_commute)
    45.6    apply (subst zmod_zmult1_eq [symmetric])
    45.7 -  apply (simp add: ring_simps)
    45.8 +  apply (simp add: field_simps)
    45.9  done
   45.10  
   45.11  end
    46.1 --- a/src/HOL/Power.thy	Mon Apr 26 09:37:46 2010 -0700
    46.2 +++ b/src/HOL/Power.thy	Mon Apr 26 09:45:22 2010 -0700
    46.3 @@ -400,7 +400,7 @@
    46.4  
    46.5  text{*Perhaps these should be simprules.*}
    46.6  lemma power_inverse:
    46.7 -  fixes a :: "'a::{division_ring,division_by_zero,power}"
    46.8 +  fixes a :: "'a::{division_ring,division_ring_inverse_zero,power}"
    46.9    shows "inverse (a ^ n) = (inverse a) ^ n"
   46.10  apply (cases "a = 0")
   46.11  apply (simp add: power_0_left)
   46.12 @@ -408,11 +408,11 @@
   46.13  done (* TODO: reorient or rename to inverse_power *)
   46.14  
   46.15  lemma power_one_over:
   46.16 -  "1 / (a::'a::{field,division_by_zero, power}) ^ n =  (1 / a) ^ n"
   46.17 +  "1 / (a::'a::{field,division_ring_inverse_zero, power}) ^ n =  (1 / a) ^ n"
   46.18    by (simp add: divide_inverse) (rule power_inverse)
   46.19  
   46.20  lemma power_divide:
   46.21 -  "(a / b) ^ n = (a::'a::{field,division_by_zero}) ^ n / b ^ n"
   46.22 +  "(a / b) ^ n = (a::'a::{field,division_ring_inverse_zero}) ^ n / b ^ n"
   46.23  apply (cases "b = 0")
   46.24  apply (simp add: power_0_left)
   46.25  apply (rule nonzero_power_divide)
    47.1 --- a/src/HOL/Quotient_Examples/FSet.thy	Mon Apr 26 09:37:46 2010 -0700
    47.2 +++ b/src/HOL/Quotient_Examples/FSet.thy	Mon Apr 26 09:45:22 2010 -0700
    47.3 @@ -387,7 +387,7 @@
    47.4    apply (simp add: memb_def[symmetric] memb_finter_raw)
    47.5    by (auto simp add: memb_def)
    47.6  
    47.7 -instantiation fset :: (type) "{bot,distrib_lattice}"
    47.8 +instantiation fset :: (type) "{bounded_lattice_bot,distrib_lattice}"
    47.9  begin
   47.10  
   47.11  quotient_definition
   47.12 @@ -922,14 +922,13 @@
   47.13  
   47.14  text {* funion *}
   47.15  
   47.16 -lemma funion_simps[simp]:
   47.17 -  shows "{||} |\<union>| S = S"
   47.18 -  and   "finsert x S |\<union>| T = finsert x (S |\<union>| T)"
   47.19 -  by (lifting append.simps)
   47.20 +lemmas [simp] =
   47.21 +  sup_bot_left[where 'a="'a fset"]
   47.22 +  sup_bot_right[where 'a="'a fset"]
   47.23  
   47.24 -lemma funion_empty[simp]:
   47.25 -  shows "S |\<union>| {||} = S"
   47.26 -  by (lifting append_Nil2)
   47.27 +lemma funion_finsert[simp]:
   47.28 +  shows "finsert x S |\<union>| T = finsert x (S |\<union>| T)"
   47.29 +  by (lifting append.simps(2))
   47.30  
   47.31  lemma singleton_union_left:
   47.32    "{|a|} |\<union>| S = finsert a S"
    48.1 --- a/src/HOL/Rat.thy	Mon Apr 26 09:37:46 2010 -0700
    48.2 +++ b/src/HOL/Rat.thy	Mon Apr 26 09:45:22 2010 -0700
    48.3 @@ -444,7 +444,7 @@
    48.4  
    48.5  end
    48.6  
    48.7 -instance rat :: division_by_zero proof
    48.8 +instance rat :: division_ring_inverse_zero proof
    48.9  qed (simp add: rat_number_expand, simp add: rat_number_collapse)
   48.10  
   48.11  
   48.12 @@ -818,7 +818,7 @@
   48.13  done
   48.14  
   48.15  lemma of_rat_inverse:
   48.16 -  "(of_rat (inverse a)::'a::{field_char_0,division_by_zero}) =
   48.17 +  "(of_rat (inverse a)::'a::{field_char_0,division_ring_inverse_zero}) =
   48.18     inverse (of_rat a)"
   48.19  by (cases "a = 0", simp_all add: nonzero_of_rat_inverse)
   48.20  
   48.21 @@ -827,7 +827,7 @@
   48.22  by (simp add: divide_inverse of_rat_mult nonzero_of_rat_inverse)
   48.23  
   48.24  lemma of_rat_divide:
   48.25 -  "(of_rat (a / b)::'a::{field_char_0,division_by_zero})
   48.26 +  "(of_rat (a / b)::'a::{field_char_0,division_ring_inverse_zero})
   48.27     = of_rat a / of_rat b"
   48.28  by (cases "b = 0") (simp_all add: nonzero_of_rat_divide)
   48.29  
   48.30 @@ -968,7 +968,7 @@
   48.31  done
   48.32  
   48.33  lemma Rats_inverse [simp]:
   48.34 -  fixes a :: "'a::{field_char_0,division_by_zero}"
   48.35 +  fixes a :: "'a::{field_char_0,division_ring_inverse_zero}"
   48.36    shows "a \<in> Rats \<Longrightarrow> inverse a \<in> Rats"
   48.37  apply (auto simp add: Rats_def)
   48.38  apply (rule range_eqI)
   48.39 @@ -984,7 +984,7 @@
   48.40  done
   48.41  
   48.42  lemma Rats_divide [simp]:
   48.43 -  fixes a b :: "'a::{field_char_0,division_by_zero}"
   48.44 +  fixes a b :: "'a::{field_char_0,division_ring_inverse_zero}"
   48.45    shows "\<lbrakk>a \<in> Rats; b \<in> Rats\<rbrakk> \<Longrightarrow> a / b \<in> Rats"
   48.46  apply (auto simp add: Rats_def)
   48.47  apply (rule range_eqI)
    49.1 --- a/src/HOL/RealDef.thy	Mon Apr 26 09:37:46 2010 -0700
    49.2 +++ b/src/HOL/RealDef.thy	Mon Apr 26 09:45:22 2010 -0700
    49.3 @@ -279,7 +279,7 @@
    49.4  lemma INVERSE_ZERO: "inverse 0 = (0::real)"
    49.5  by (simp add: real_inverse_def)
    49.6  
    49.7 -instance real :: division_by_zero
    49.8 +instance real :: division_ring_inverse_zero
    49.9  proof
   49.10    show "inverse 0 = (0::real)" by (rule INVERSE_ZERO)
   49.11  qed
    50.1 --- a/src/HOL/RealVector.thy	Mon Apr 26 09:37:46 2010 -0700
    50.2 +++ b/src/HOL/RealVector.thy	Mon Apr 26 09:45:22 2010 -0700
    50.3 @@ -207,7 +207,7 @@
    50.4  by (rule inverse_unique, simp)
    50.5  
    50.6  lemma inverse_scaleR_distrib:
    50.7 -  fixes x :: "'a::{real_div_algebra,division_by_zero}"
    50.8 +  fixes x :: "'a::{real_div_algebra,division_ring_inverse_zero}"
    50.9    shows "inverse (scaleR a x) = scaleR (inverse a) (inverse x)"
   50.10  apply (case_tac "a = 0", simp)
   50.11  apply (case_tac "x = 0", simp)
   50.12 @@ -250,7 +250,7 @@
   50.13  
   50.14  lemma of_real_inverse [simp]:
   50.15    "of_real (inverse x) =
   50.16 -   inverse (of_real x :: 'a::{real_div_algebra,division_by_zero})"
   50.17 +   inverse (of_real x :: 'a::{real_div_algebra,division_ring_inverse_zero})"
   50.18  by (simp add: of_real_def inverse_scaleR_distrib)
   50.19  
   50.20  lemma nonzero_of_real_divide:
   50.21 @@ -260,7 +260,7 @@
   50.22  
   50.23  lemma of_real_divide [simp]:
   50.24    "of_real (x / y) =
   50.25 -   (of_real x / of_real y :: 'a::{real_field,division_by_zero})"
   50.26 +   (of_real x / of_real y :: 'a::{real_field,division_ring_inverse_zero})"
   50.27  by (simp add: divide_inverse)
   50.28  
   50.29  lemma of_real_power [simp]:
   50.30 @@ -370,7 +370,7 @@
   50.31  done
   50.32  
   50.33  lemma Reals_inverse [simp]:
   50.34 -  fixes a :: "'a::{real_div_algebra,division_by_zero}"
   50.35 +  fixes a :: "'a::{real_div_algebra,division_ring_inverse_zero}"
   50.36    shows "a \<in> Reals \<Longrightarrow> inverse a \<in> Reals"
   50.37  apply (auto simp add: Reals_def)
   50.38  apply (rule range_eqI)
   50.39 @@ -386,7 +386,7 @@
   50.40  done
   50.41  
   50.42  lemma Reals_divide [simp]:
   50.43 -  fixes a b :: "'a::{real_field,division_by_zero}"
   50.44 +  fixes a b :: "'a::{real_field,division_ring_inverse_zero}"
   50.45    shows "\<lbrakk>a \<in> Reals; b \<in> Reals\<rbrakk> \<Longrightarrow> a / b \<in> Reals"
   50.46  apply (auto simp add: Reals_def)
   50.47  apply (rule range_eqI)
   50.48 @@ -726,7 +726,7 @@
   50.49  done
   50.50  
   50.51  lemma norm_inverse:
   50.52 -  fixes a :: "'a::{real_normed_div_algebra,division_by_zero}"
   50.53 +  fixes a :: "'a::{real_normed_div_algebra,division_ring_inverse_zero}"
   50.54    shows "norm (inverse a) = inverse (norm a)"
   50.55  apply (case_tac "a = 0", simp)
   50.56  apply (erule nonzero_norm_inverse)
   50.57 @@ -738,7 +738,7 @@
   50.58  by (simp add: divide_inverse norm_mult nonzero_norm_inverse)
   50.59  
   50.60  lemma norm_divide:
   50.61 -  fixes a b :: "'a::{real_normed_field,division_by_zero}"
   50.62 +  fixes a b :: "'a::{real_normed_field,division_ring_inverse_zero}"
   50.63    shows "norm (a / b) = norm a / norm b"
   50.64  by (simp add: divide_inverse norm_mult norm_inverse)
   50.65  
    51.1 --- a/src/HOL/Rings.thy	Mon Apr 26 09:37:46 2010 -0700
    51.2 +++ b/src/HOL/Rings.thy	Mon Apr 26 09:45:22 2010 -0700
    51.3 @@ -14,8 +14,8 @@
    51.4  begin
    51.5  
    51.6  class semiring = ab_semigroup_add + semigroup_mult +
    51.7 -  assumes left_distrib[algebra_simps]: "(a + b) * c = a * c + b * c"
    51.8 -  assumes right_distrib[algebra_simps]: "a * (b + c) = a * b + a * c"
    51.9 +  assumes left_distrib[algebra_simps, field_simps]: "(a + b) * c = a * c + b * c"
   51.10 +  assumes right_distrib[algebra_simps, field_simps]: "a * (b + c) = a * b + a * c"
   51.11  begin
   51.12  
   51.13  text{*For the @{text combine_numerals} simproc*}
   51.14 @@ -230,18 +230,15 @@
   51.15  lemma minus_mult_commute: "- a * b = a * - b"
   51.16  by simp
   51.17  
   51.18 -lemma right_diff_distrib[algebra_simps]: "a * (b - c) = a * b - a * c"
   51.19 +lemma right_diff_distrib[algebra_simps, field_simps]: "a * (b - c) = a * b - a * c"
   51.20  by (simp add: right_distrib diff_minus)
   51.21  
   51.22 -lemma left_diff_distrib[algebra_simps]: "(a - b) * c = a * c - b * c"
   51.23 +lemma left_diff_distrib[algebra_simps, field_simps]: "(a - b) * c = a * c - b * c"
   51.24  by (simp add: left_distrib diff_minus)
   51.25  
   51.26  lemmas ring_distribs[no_atp] =
   51.27    right_distrib left_distrib left_diff_distrib right_diff_distrib
   51.28  
   51.29 -text{*Legacy - use @{text algebra_simps} *}
   51.30 -lemmas ring_simps[no_atp] = algebra_simps
   51.31 -
   51.32  lemma eq_add_iff1:
   51.33    "a * e + c = b * e + d \<longleftrightarrow> (a - b) * e + c = d"
   51.34  by (simp add: algebra_simps)
   51.35 @@ -536,7 +533,7 @@
   51.36  lemma diff_divide_distrib: "(a - b) / c = a / c - b / c"
   51.37    by (simp add: diff_minus add_divide_distrib)
   51.38  
   51.39 -lemma nonzero_eq_divide_eq: "c \<noteq> 0 \<Longrightarrow> a = b / c \<longleftrightarrow> a * c = b"
   51.40 +lemma nonzero_eq_divide_eq [field_simps]: "c \<noteq> 0 \<Longrightarrow> a = b / c \<longleftrightarrow> a * c = b"
   51.41  proof -
   51.42    assume [simp]: "c \<noteq> 0"
   51.43    have "a = b / c \<longleftrightarrow> a * c = (b / c) * c" by simp
   51.44 @@ -544,7 +541,7 @@
   51.45    finally show ?thesis .
   51.46  qed
   51.47  
   51.48 -lemma nonzero_divide_eq_eq: "c \<noteq> 0 \<Longrightarrow> b / c = a \<longleftrightarrow> b = a * c"
   51.49 +lemma nonzero_divide_eq_eq [field_simps]: "c \<noteq> 0 \<Longrightarrow> b / c = a \<longleftrightarrow> b = a * c"
   51.50  proof -
   51.51    assume [simp]: "c \<noteq> 0"
   51.52    have "b / c = a \<longleftrightarrow> (b / c) * c = a * c" by simp
   51.53 @@ -560,7 +557,7 @@
   51.54  
   51.55  end
   51.56  
   51.57 -class division_by_zero = division_ring +
   51.58 +class division_ring_inverse_zero = division_ring +
   51.59    assumes inverse_zero [simp]: "inverse 0 = 0"
   51.60  begin
   51.61  
   51.62 @@ -861,9 +858,6 @@
   51.63  
   51.64  subclass ordered_ab_group_add ..
   51.65  
   51.66 -text{*Legacy - use @{text algebra_simps} *}
   51.67 -lemmas ring_simps[no_atp] = algebra_simps
   51.68 -
   51.69  lemma less_add_iff1:
   51.70    "a * e + c < b * e + d \<longleftrightarrow> (a - b) * e + c < d"
   51.71  by (simp add: algebra_simps)
   51.72 @@ -1068,9 +1062,6 @@
   51.73  
   51.74  end
   51.75  
   51.76 -text{*Legacy - use @{text algebra_simps} *}
   51.77 -lemmas ring_simps[no_atp] = algebra_simps
   51.78 -
   51.79  lemmas mult_sign_intros =
   51.80    mult_nonneg_nonneg mult_nonneg_nonpos
   51.81    mult_nonpos_nonneg mult_nonpos_nonpos
    52.1 --- a/src/HOL/SMT/Tools/z3_proof_rules.ML	Mon Apr 26 09:37:46 2010 -0700
    52.2 +++ b/src/HOL/SMT/Tools/z3_proof_rules.ML	Mon Apr 26 09:45:22 2010 -0700
    52.3 @@ -1137,7 +1137,8 @@
    52.4    handle THM _ => NONE
    52.5  in
    52.6  val z3_simpset = HOL_ss addsimps @{thms array_rules}
    52.7 -  addsimps @{thms ring_distribs} addsimps @{thms field_eq_simps}
    52.8 +  addsimps @{thms ring_distribs} addsimps @{thms field_simps}
    52.9 +  addsimps [@{thm times_divide_eq_right}, @{thm times_divide_eq_left}]
   52.10    addsimps @{thms arith_special} addsimps @{thms less_bin_simps}
   52.11    addsimps @{thms le_bin_simps} addsimps @{thms eq_bin_simps}
   52.12    addsimps @{thms add_bin_simps} addsimps @{thms succ_bin_simps}
    53.1 --- a/src/HOL/SMT/Z3.thy	Mon Apr 26 09:37:46 2010 -0700
    53.2 +++ b/src/HOL/SMT/Z3.thy	Mon Apr 26 09:45:22 2010 -0700
    53.3 @@ -19,7 +19,7 @@
    53.4  
    53.5  lemmas [z3_rewrite] =
    53.6    refl eq_commute conj_commute disj_commute simp_thms nnf_simps
    53.7 -  ring_distribs field_eq_simps if_True if_False
    53.8 +  ring_distribs field_simps times_divide_eq_right times_divide_eq_left if_True if_False
    53.9  
   53.10  lemma [z3_rewrite]: "(P \<noteq> Q) = (Q = (\<not>P))" by fast
   53.11  
    54.1 --- a/src/HOL/Series.thy	Mon Apr 26 09:37:46 2010 -0700
    54.2 +++ b/src/HOL/Series.thy	Mon Apr 26 09:45:22 2010 -0700
    54.3 @@ -381,7 +381,7 @@
    54.4    shows "norm x < 1 \<Longrightarrow> summable (\<lambda>n. x ^ n)"
    54.5  by (rule geometric_sums [THEN sums_summable])
    54.6  
    54.7 -lemma half: "0 < 1 / (2::'a::{number_ring,division_by_zero,linordered_field})"
    54.8 +lemma half: "0 < 1 / (2::'a::{number_ring,division_ring_inverse_zero,linordered_field})"
    54.9    by arith 
   54.10  
   54.11  lemma power_half_series: "(\<lambda>n. (1/2::real)^Suc n) sums 1"
    55.1 --- a/src/HOL/SetInterval.thy	Mon Apr 26 09:37:46 2010 -0700
    55.2 +++ b/src/HOL/SetInterval.thy	Mon Apr 26 09:45:22 2010 -0700
    55.3 @@ -1095,7 +1095,7 @@
    55.4    next
    55.5      case (Suc n)
    55.6      moreover with `y \<noteq> 0` have "(1 + y) ^ n = (y * inverse y) * (1 + y) ^ n" by simp 
    55.7 -    ultimately show ?case by (simp add: field_eq_simps divide_inverse)
    55.8 +    ultimately show ?case by (simp add: field_simps divide_inverse)
    55.9    qed
   55.10    ultimately show ?thesis by simp
   55.11  qed
    56.1 --- a/src/HOL/Tools/Datatype/datatype_data.ML	Mon Apr 26 09:37:46 2010 -0700
    56.2 +++ b/src/HOL/Tools/Datatype/datatype_data.ML	Mon Apr 26 09:45:22 2010 -0700
    56.3 @@ -436,7 +436,7 @@
    56.4    in
    56.5      thy
    56.6      |> ProofContext.init
    56.7 -    |> Proof.theorem_i NONE after_qed' ((map o map) (rpair []) (flat rules))
    56.8 +    |> Proof.theorem NONE after_qed' ((map o map) (rpair []) (flat rules))
    56.9    end;
   56.10  
   56.11  val rep_datatype = gen_rep_datatype Sign.cert_term;
    57.1 --- a/src/HOL/Tools/Function/function.ML	Mon Apr 26 09:37:46 2010 -0700
    57.2 +++ b/src/HOL/Tools/Function/function.ML	Mon Apr 26 09:45:22 2010 -0700
    57.3 @@ -120,7 +120,7 @@
    57.4        end
    57.5    in
    57.6      lthy
    57.7 -    |> Proof.theorem_i NONE afterqed [[(Logic.unprotect (concl_of goalstate), [])]]
    57.8 +    |> Proof.theorem NONE afterqed [[(Logic.unprotect (concl_of goalstate), [])]]
    57.9      |> Proof.refine (Method.primitive_text (fn _ => goalstate)) |> Seq.hd
   57.10    end
   57.11  
   57.12 @@ -177,7 +177,7 @@
   57.13      |> ProofContext.note_thmss ""
   57.14         [((Binding.name "termination", [Context_Rules.intro_bang (SOME 0)]),
   57.15           [([Goal.norm_result termination], [])])] |> snd
   57.16 -    |> Proof.theorem_i NONE afterqed [[(goal, [])]]
   57.17 +    |> Proof.theorem NONE afterqed [[(goal, [])]]
   57.18    end
   57.19  
   57.20  val termination_proof = gen_termination_proof Syntax.check_term
    58.1 --- a/src/HOL/Tools/Predicate_Compile/predicate_compile_core.ML	Mon Apr 26 09:37:46 2010 -0700
    58.2 +++ b/src/HOL/Tools/Predicate_Compile/predicate_compile_core.ML	Mon Apr 26 09:45:22 2010 -0700
    58.3 @@ -3059,7 +3059,7 @@
    58.4             ) options [const]))
    58.5        end
    58.6    in
    58.7 -    Proof.theorem_i NONE after_qed (map (single o (rpair [])) cases_rules) lthy''
    58.8 +    Proof.theorem NONE after_qed (map (single o (rpair [])) cases_rules) lthy''
    58.9    end;
   58.10  
   58.11  val code_pred = generic_code_pred (K I);
    59.1 --- a/src/HOL/Tools/Quotient/quotient_typ.ML	Mon Apr 26 09:37:46 2010 -0700
    59.2 +++ b/src/HOL/Tools/Quotient/quotient_typ.ML	Mon Apr 26 09:45:22 2010 -0700
    59.3 @@ -45,7 +45,7 @@
    59.4    val goals' = map (rpair []) goals
    59.5    fun after_qed' thms = after_qed (the_single thms)
    59.6  in
    59.7 -  Proof.theorem_i NONE after_qed' [goals'] ctxt
    59.8 +  Proof.theorem NONE after_qed' [goals'] ctxt
    59.9  end
   59.10  
   59.11  
    60.1 --- a/src/HOL/Tools/choice_specification.ML	Mon Apr 26 09:37:46 2010 -0700
    60.2 +++ b/src/HOL/Tools/choice_specification.ML	Mon Apr 26 09:45:22 2010 -0700
    60.3 @@ -226,7 +226,7 @@
    60.4      in
    60.5        thy
    60.6        |> ProofContext.init
    60.7 -      |> Proof.theorem_i NONE after_qed [[(HOLogic.mk_Trueprop ex_prop, [])]]
    60.8 +      |> Proof.theorem NONE after_qed [[(HOLogic.mk_Trueprop ex_prop, [])]]
    60.9      end;
   60.10  
   60.11  
    61.1 --- a/src/HOL/Tools/numeral_simprocs.ML	Mon Apr 26 09:37:46 2010 -0700
    61.2 +++ b/src/HOL/Tools/numeral_simprocs.ML	Mon Apr 26 09:45:22 2010 -0700
    61.3 @@ -332,8 +332,8 @@
    61.4  val field_combine_numerals =
    61.5    Arith_Data.prep_simproc @{theory}
    61.6      ("field_combine_numerals", 
    61.7 -     ["(i::'a::{number_ring,field,division_by_zero}) + j",
    61.8 -      "(i::'a::{number_ring,field,division_by_zero}) - j"], 
    61.9 +     ["(i::'a::{number_ring,field,division_ring_inverse_zero}) + j",
   61.10 +      "(i::'a::{number_ring,field,division_ring_inverse_zero}) - j"], 
   61.11       K FieldCombineNumerals.proc);
   61.12  
   61.13  (** Constant folding for multiplication in semirings **)
   61.14 @@ -442,9 +442,9 @@
   61.15        "(l::'a::{semiring_div,number_ring}) div (m * n)"],
   61.16       K DivCancelNumeralFactor.proc),
   61.17      ("divide_cancel_numeral_factor",
   61.18 -     ["((l::'a::{division_by_zero,field,number_ring}) * m) / n",
   61.19 -      "(l::'a::{division_by_zero,field,number_ring}) / (m * n)",
   61.20 -      "((number_of v)::'a::{division_by_zero,field,number_ring}) / (number_of w)"],
   61.21 +     ["((l::'a::{division_ring_inverse_zero,field,number_ring}) * m) / n",
   61.22 +      "(l::'a::{division_ring_inverse_zero,field,number_ring}) / (m * n)",
   61.23 +      "((number_of v)::'a::{division_ring_inverse_zero,field,number_ring}) / (number_of w)"],
   61.24       K DivideCancelNumeralFactor.proc)];
   61.25  
   61.26  val field_cancel_numeral_factors =
   61.27 @@ -454,9 +454,9 @@
   61.28        "(l::'a::{field,number_ring}) = m * n"],
   61.29       K EqCancelNumeralFactor.proc),
   61.30      ("field_cancel_numeral_factor",
   61.31 -     ["((l::'a::{division_by_zero,field,number_ring}) * m) / n",
   61.32 -      "(l::'a::{division_by_zero,field,number_ring}) / (m * n)",
   61.33 -      "((number_of v)::'a::{division_by_zero,field,number_ring}) / (number_of w)"],
   61.34 +     ["((l::'a::{division_ring_inverse_zero,field,number_ring}) * m) / n",
   61.35 +      "(l::'a::{division_ring_inverse_zero,field,number_ring}) / (m * n)",
   61.36 +      "((number_of v)::'a::{division_ring_inverse_zero,field,number_ring}) / (number_of w)"],
   61.37       K DivideCancelNumeralFactor.proc)]
   61.38  
   61.39  
   61.40 @@ -598,8 +598,8 @@
   61.41       ["((l::'a::idom) * m) dvd n", "(l::'a::idom) dvd (m * n)"],
   61.42       K DvdCancelFactor.proc),
   61.43      ("divide_cancel_factor",
   61.44 -     ["((l::'a::{division_by_zero,field}) * m) / n",
   61.45 -      "(l::'a::{division_by_zero,field}) / (m * n)"],
   61.46 +     ["((l::'a::{division_ring_inverse_zero,field}) * m) / n",
   61.47 +      "(l::'a::{division_ring_inverse_zero,field}) / (m * n)"],
   61.48       K DivideCancelFactor.proc)];
   61.49  
   61.50  end;
    62.1 --- a/src/HOL/Tools/typedef.ML	Mon Apr 26 09:37:46 2010 -0700
    62.2 +++ b/src/HOL/Tools/typedef.ML	Mon Apr 26 09:45:22 2010 -0700
    62.3 @@ -282,7 +282,7 @@
    62.4      val ((goal, goal_pat, typedef_result), lthy') =
    62.5        prepare_typedef prep_term def name (b, args, mx) set opt_morphs lthy;
    62.6      fun after_qed [[th]] = snd o typedef_result th;
    62.7 -  in Proof.theorem_i NONE after_qed [[(goal, [goal_pat])]] lthy' end;
    62.8 +  in Proof.theorem NONE after_qed [[(goal, [goal_pat])]] lthy' end;
    62.9  
   62.10  in
   62.11  
    63.1 --- a/src/HOL/ex/Lagrange.thy	Mon Apr 26 09:37:46 2010 -0700
    63.2 +++ b/src/HOL/ex/Lagrange.thy	Mon Apr 26 09:45:22 2010 -0700
    63.3 @@ -34,7 +34,7 @@
    63.4     sq (x1*y2 + x2*y1 + x3*y4 - x4*y3)  +
    63.5     sq (x1*y3 - x2*y4 + x3*y1 + x4*y2)  +
    63.6     sq (x1*y4 + x2*y3 - x3*y2 + x4*y1)"
    63.7 -by (simp only: sq_def ring_simps)
    63.8 +by (simp only: sq_def field_simps)
    63.9  
   63.10  
   63.11  text {* A challenge by John Harrison. Takes about 12s on a 1.6GHz machine. *}
   63.12 @@ -50,6 +50,6 @@
   63.13        sq (p1*u2 + q1*t2 - r1*w2 + s1*v2 - t1*q2 + u1*p2 - v1*s2 + w1*r2) +
   63.14        sq (p1*v2 + q1*w2 + r1*t2 - s1*u2 - t1*r2 + u1*s2 + v1*p2 - w1*q2) +
   63.15        sq (p1*w2 - q1*v2 + r1*u2 + s1*t2 - t1*s2 - u1*r2 + v1*q2 + w1*p2)"
   63.16 -by (simp only: sq_def ring_simps)
   63.17 +by (simp only: sq_def field_simps)
   63.18  
   63.19  end
    64.1 --- a/src/HOLCF/Tools/pcpodef.ML	Mon Apr 26 09:37:46 2010 -0700
    64.2 +++ b/src/HOLCF/Tools/pcpodef.ML	Mon Apr 26 09:45:22 2010 -0700
    64.3 @@ -328,7 +328,7 @@
    64.4        prepare_cpodef prep_term def name (b, args, mx) set opt_morphs thy;
    64.5      fun after_qed [[th1, th2]] = ProofContext.theory (snd o make_result th1 th2)
    64.6        | after_qed _ = raise Fail "cpodef_proof";
    64.7 -  in Proof.theorem_i NONE after_qed [[(goal1, []), (goal2, [])]] ctxt end;
    64.8 +  in Proof.theorem NONE after_qed [[(goal1, []), (goal2, [])]] ctxt end;
    64.9  
   64.10  fun gen_pcpodef_proof prep_term prep_constraint
   64.11      ((def, name), (b, raw_args, mx), set, opt_morphs) thy =
   64.12 @@ -339,7 +339,7 @@
   64.13        prepare_pcpodef prep_term def name (b, args, mx) set opt_morphs thy;
   64.14      fun after_qed [[th1, th2]] = ProofContext.theory (snd o make_result th1 th2)
   64.15        | after_qed _ = raise Fail "pcpodef_proof";
   64.16 -  in Proof.theorem_i NONE after_qed [[(goal1, []), (goal2, [])]] ctxt end;
   64.17 +  in Proof.theorem NONE after_qed [[(goal1, []), (goal2, [])]] ctxt end;
   64.18  
   64.19  in
   64.20  
    65.1 --- a/src/Pure/Isar/calculation.ML	Mon Apr 26 09:37:46 2010 -0700
    65.2 +++ b/src/Pure/Isar/calculation.ML	Mon Apr 26 09:45:22 2010 -0700
    65.3 @@ -13,11 +13,11 @@
    65.4    val sym_add: attribute
    65.5    val sym_del: attribute
    65.6    val symmetric: attribute
    65.7 -  val also: (Facts.ref * Attrib.src list) list option -> bool -> Proof.state -> Proof.state Seq.seq
    65.8 -  val also_i: thm list option -> bool -> Proof.state -> Proof.state Seq.seq
    65.9 -  val finally: (Facts.ref * Attrib.src list) list option -> bool ->
   65.10 +  val also: thm list option -> bool -> Proof.state -> Proof.state Seq.seq
   65.11 +  val also_cmd: (Facts.ref * Attrib.src list) list option -> bool -> Proof.state -> Proof.state Seq.seq
   65.12 +  val finally: thm list option -> bool -> Proof.state -> Proof.state Seq.seq
   65.13 +  val finally_cmd: (Facts.ref * Attrib.src list) list option -> bool ->
   65.14      Proof.state -> Proof.state Seq.seq
   65.15 -  val finally_i: thm list option -> bool -> Proof.state -> Proof.state Seq.seq
   65.16    val moreover: bool -> Proof.state -> Proof.state
   65.17    val ultimately: bool -> Proof.state -> Proof.state
   65.18  end;
   65.19 @@ -148,10 +148,10 @@
   65.20          state |> maintain_calculation final calc))
   65.21    end;
   65.22  
   65.23 -val also = calculate Proof.get_thmss false;
   65.24 -val also_i = calculate (K I) false;
   65.25 -val finally = calculate Proof.get_thmss true;
   65.26 -val finally_i = calculate (K I) true;
   65.27 +val also = calculate (K I) false;
   65.28 +val also_cmd = calculate Proof.get_thmss_cmd false;
   65.29 +val finally = calculate (K I) true;
   65.30 +val finally_cmd = calculate Proof.get_thmss_cmd true;
   65.31  
   65.32  
   65.33  (* moreover and ultimately *)
    66.1 --- a/src/Pure/Isar/class_target.ML	Mon Apr 26 09:37:46 2010 -0700
    66.2 +++ b/src/Pure/Isar/class_target.ML	Mon Apr 26 09:45:22 2010 -0700
    66.3 @@ -163,7 +163,7 @@
    66.4        Symtab.empty
    66.5        |> Symtab.fold (fn (tyco, arities) => fold (fn (class, _) =>
    66.6             Symtab.map_default (class, []) (insert (op =) tyco)) arities)
    66.7 -             ((#arities o Sorts.rep_algebra) algebra);
    66.8 +             (Sorts.arities_of algebra);
    66.9      val the_arities = these o Symtab.lookup arities;
   66.10      fun mk_arity class tyco =
   66.11        let
   66.12 @@ -370,7 +370,7 @@
   66.13    in
   66.14      thy
   66.15      |> ProofContext.init
   66.16 -    |> Proof.theorem_i NONE after_qed [[(mk_prop thy classrel, [])]]
   66.17 +    |> Proof.theorem NONE after_qed [[(mk_prop thy classrel, [])]]
   66.18    end;
   66.19  
   66.20  in
   66.21 @@ -539,7 +539,7 @@
   66.22    end;
   66.23  
   66.24  val instantiation_instance = gen_instantiation_instance (fn after_qed => fn ts =>
   66.25 -  Proof.theorem_i NONE (after_qed o map the_single) (map (fn t => [(t, [])]) ts));
   66.26 +  Proof.theorem NONE (after_qed o map the_single) (map (fn t => [(t, [])]) ts));
   66.27  
   66.28  fun prove_instantiation_instance tac = gen_instantiation_instance (fn after_qed =>
   66.29    fn ts => fn lthy => after_qed (map (fn t => Goal.prove lthy [] [] t
   66.30 @@ -595,7 +595,7 @@
   66.31    in
   66.32      thy
   66.33      |> ProofContext.init
   66.34 -    |> Proof.theorem_i NONE after_qed (map (fn t => [(t, [])]) arities)
   66.35 +    |> Proof.theorem NONE after_qed (map (fn t => [(t, [])]) arities)
   66.36    end;
   66.37  
   66.38  
    67.1 --- a/src/Pure/Isar/element.ML	Mon Apr 26 09:37:46 2010 -0700
    67.2 +++ b/src/Pure/Isar/element.ML	Mon Apr 26 09:45:22 2010 -0700
    67.3 @@ -283,10 +283,10 @@
    67.4  in
    67.5  
    67.6  fun witness_proof after_qed wit_propss =
    67.7 -  gen_witness_proof (Proof.theorem_i NONE) (fn wits => fn _ => after_qed wits)
    67.8 +  gen_witness_proof (Proof.theorem NONE) (fn wits => fn _ => after_qed wits)
    67.9      wit_propss [];
   67.10  
   67.11 -val witness_proof_eqs = gen_witness_proof (Proof.theorem_i NONE);
   67.12 +val witness_proof_eqs = gen_witness_proof (Proof.theorem NONE);
   67.13  
   67.14  fun witness_local_proof after_qed cmd wit_propss goal_ctxt int =
   67.15    gen_witness_proof (fn after_qed' => fn propss =>
    68.1 --- a/src/Pure/Isar/isar_cmd.ML	Mon Apr 26 09:37:46 2010 -0700
    68.2 +++ b/src/Pure/Isar/isar_cmd.ML	Mon Apr 26 09:45:22 2010 -0700
    68.3 @@ -219,10 +219,10 @@
    68.4  fun goal opt_chain goal stmt int =
    68.5    opt_chain #> goal NONE (K I) stmt int;
    68.6  
    68.7 -val have = goal I Proof.have;
    68.8 -val hence = goal Proof.chain Proof.have;
    68.9 -val show = goal I Proof.show;
   68.10 -val thus = goal Proof.chain Proof.show;
   68.11 +val have = goal I Proof.have_cmd;
   68.12 +val hence = goal Proof.chain Proof.have_cmd;
   68.13 +val show = goal I Proof.show_cmd;
   68.14 +val thus = goal Proof.chain Proof.show_cmd;
   68.15  
   68.16  
   68.17  (* local endings *)
   68.18 @@ -393,7 +393,7 @@
   68.19    let
   68.20      val thy = Toplevel.theory_of state;
   68.21      val {classes = (space, algebra), ...} = Type.rep_tsig (Sign.tsig_of thy);
   68.22 -    val {classes, ...} = Sorts.rep_algebra algebra;
   68.23 +    val classes = Sorts.classes_of algebra;
   68.24      fun entry (c, (i, (_, cs))) =
   68.25        (i, {name = Name_Space.extern space c, ID = c, parents = cs,
   68.26              dir = "", unfold = true, path = ""});
   68.27 @@ -403,7 +403,7 @@
   68.28    in Present.display_graph gr end);
   68.29  
   68.30  fun thm_deps args = Toplevel.unknown_theory o Toplevel.keep (fn state =>
   68.31 -  Thm_Deps.thm_deps (Proof.get_thmss (Toplevel.enter_proof_body state) args));
   68.32 +  Thm_Deps.thm_deps (Proof.get_thmss_cmd (Toplevel.enter_proof_body state) args));
   68.33  
   68.34  
   68.35  (* find unused theorems *)
   68.36 @@ -437,12 +437,12 @@
   68.37  local
   68.38  
   68.39  fun string_of_stmts state args =
   68.40 -  Proof.get_thmss state args
   68.41 +  Proof.get_thmss_cmd state args
   68.42    |> map (Element.pretty_statement (Proof.context_of state) Thm.theoremK)
   68.43    |> Pretty.chunks2 |> Pretty.string_of;
   68.44  
   68.45  fun string_of_thms state args =
   68.46 -  Pretty.string_of (Display.pretty_thms (Proof.context_of state) (Proof.get_thmss state args));
   68.47 +  Pretty.string_of (Display.pretty_thms (Proof.context_of state) (Proof.get_thmss_cmd state args));
   68.48  
   68.49  fun string_of_prfs full state arg =
   68.50    Pretty.string_of
   68.51 @@ -460,7 +460,7 @@
   68.52          end
   68.53      | SOME args => Pretty.chunks
   68.54          (map (Proof_Syntax.pretty_proof_of (Proof.context_of state) full)
   68.55 -          (Proof.get_thmss state args)));
   68.56 +          (Proof.get_thmss_cmd state args)));
   68.57  
   68.58  fun string_of_prop state s =
   68.59    let
    69.1 --- a/src/Pure/Isar/isar_syn.ML	Mon Apr 26 09:37:46 2010 -0700
    69.2 +++ b/src/Pure/Isar/isar_syn.ML	Mon Apr 26 09:45:22 2010 -0700
    69.3 @@ -542,27 +542,27 @@
    69.4  val _ =
    69.5    OuterSyntax.command "from" "forward chaining from given facts"
    69.6      (K.tag_proof K.prf_chain)
    69.7 -    (facts >> (Toplevel.print oo (Toplevel.proof o Proof.from_thmss)));
    69.8 +    (facts >> (Toplevel.print oo (Toplevel.proof o Proof.from_thmss_cmd)));
    69.9  
   69.10  val _ =
   69.11    OuterSyntax.command "with" "forward chaining from given and current facts"
   69.12      (K.tag_proof K.prf_chain)
   69.13 -    (facts >> (Toplevel.print oo (Toplevel.proof o Proof.with_thmss)));
   69.14 +    (facts >> (Toplevel.print oo (Toplevel.proof o Proof.with_thmss_cmd)));
   69.15  
   69.16  val _ =
   69.17    OuterSyntax.command "note" "define facts"
   69.18      (K.tag_proof K.prf_decl)
   69.19 -    (SpecParse.name_facts >> (Toplevel.print oo (Toplevel.proof o Proof.note_thmss)));
   69.20 +    (SpecParse.name_facts >> (Toplevel.print oo (Toplevel.proof o Proof.note_thmss_cmd)));
   69.21  
   69.22  val _ =
   69.23    OuterSyntax.command "using" "augment goal facts"
   69.24      (K.tag_proof K.prf_decl)
   69.25 -    (facts >> (Toplevel.print oo (Toplevel.proof o Proof.using)));
   69.26 +    (facts >> (Toplevel.print oo (Toplevel.proof o Proof.using_cmd)));
   69.27  
   69.28  val _ =
   69.29    OuterSyntax.command "unfolding" "unfold definitions in goal and facts"
   69.30      (K.tag_proof K.prf_decl)
   69.31 -    (facts >> (Toplevel.print oo (Toplevel.proof o Proof.unfolding)));
   69.32 +    (facts >> (Toplevel.print oo (Toplevel.proof o Proof.unfolding_cmd)));
   69.33  
   69.34  
   69.35  (* proof context *)
   69.36 @@ -570,17 +570,17 @@
   69.37  val _ =
   69.38    OuterSyntax.command "fix" "fix local variables (Skolem constants)"
   69.39      (K.tag_proof K.prf_asm)
   69.40 -    (P.fixes >> (Toplevel.print oo (Toplevel.proof o Proof.fix)));
   69.41 +    (P.fixes >> (Toplevel.print oo (Toplevel.proof o Proof.fix_cmd)));
   69.42  
   69.43  val _ =
   69.44    OuterSyntax.command "assume" "assume propositions"
   69.45      (K.tag_proof K.prf_asm)
   69.46 -    (SpecParse.statement >> (Toplevel.print oo (Toplevel.proof o Proof.assume)));
   69.47 +    (SpecParse.statement >> (Toplevel.print oo (Toplevel.proof o Proof.assume_cmd)));
   69.48  
   69.49  val _ =
   69.50    OuterSyntax.command "presume" "assume propositions, to be established later"
   69.51      (K.tag_proof K.prf_asm)
   69.52 -    (SpecParse.statement >> (Toplevel.print oo (Toplevel.proof o Proof.presume)));
   69.53 +    (SpecParse.statement >> (Toplevel.print oo (Toplevel.proof o Proof.presume_cmd)));
   69.54  
   69.55  val _ =
   69.56    OuterSyntax.command "def" "local definition"
   69.57 @@ -588,24 +588,24 @@
   69.58      (P.and_list1
   69.59        (SpecParse.opt_thm_name ":" --
   69.60          ((P.binding -- P.opt_mixfix) -- ((P.$$$ "\\<equiv>" || P.$$$ "==") |-- P.!!! P.termp)))
   69.61 -    >> (Toplevel.print oo (Toplevel.proof o Proof.def)));
   69.62 +    >> (Toplevel.print oo (Toplevel.proof o Proof.def_cmd)));
   69.63  
   69.64  val _ =
   69.65    OuterSyntax.command "obtain" "generalized existence"
   69.66      (K.tag_proof K.prf_asm_goal)
   69.67      (P.parname -- Scan.optional (P.fixes --| P.where_) [] -- SpecParse.statement
   69.68 -      >> (fn ((x, y), z) => Toplevel.print o Toplevel.proof' (Obtain.obtain x y z)));
   69.69 +      >> (fn ((x, y), z) => Toplevel.print o Toplevel.proof' (Obtain.obtain_cmd x y z)));
   69.70  
   69.71  val _ =
   69.72    OuterSyntax.command "guess" "wild guessing (unstructured)"
   69.73      (K.tag_proof K.prf_asm_goal)
   69.74 -    (Scan.optional P.fixes [] >> (Toplevel.print oo (Toplevel.proof' o Obtain.guess)));
   69.75 +    (Scan.optional P.fixes [] >> (Toplevel.print oo (Toplevel.proof' o Obtain.guess_cmd)));
   69.76  
   69.77  val _ =
   69.78    OuterSyntax.command "let" "bind text variables"
   69.79      (K.tag_proof K.prf_decl)
   69.80      (P.and_list1 (P.and_list1 P.term -- (P.$$$ "=" |-- P.term))
   69.81 -      >> (Toplevel.print oo (Toplevel.proof o Proof.let_bind)));
   69.82 +      >> (Toplevel.print oo (Toplevel.proof o Proof.let_bind_cmd)));
   69.83  
   69.84  val case_spec =
   69.85    (P.$$$ "(" |-- P.!!! (P.xname -- Scan.repeat1 (P.maybe P.name) --| P.$$$ ")") ||
   69.86 @@ -614,7 +614,7 @@
   69.87  val _ =
   69.88    OuterSyntax.command "case" "invoke local context"
   69.89      (K.tag_proof K.prf_asm)
   69.90 -    (case_spec >> (Toplevel.print oo (Toplevel.proof o Proof.invoke_case)));
   69.91 +    (case_spec >> (Toplevel.print oo (Toplevel.proof o Proof.invoke_case_cmd)));
   69.92  
   69.93  
   69.94  (* proof structure *)
   69.95 @@ -711,12 +711,12 @@
   69.96  val _ =
   69.97    OuterSyntax.command "also" "combine calculation and current facts"
   69.98      (K.tag_proof K.prf_decl)
   69.99 -    (calc_args >> (Toplevel.proofs' o Calculation.also));
  69.100 +    (calc_args >> (Toplevel.proofs' o Calculation.also_cmd));
  69.101  
  69.102  val _ =
  69.103    OuterSyntax.command "finally" "combine calculation and current facts, exhibit result"
  69.104      (K.tag_proof K.prf_chain)
  69.105 -    (calc_args >> (Toplevel.proofs' o Calculation.finally));
  69.106 +    (calc_args >> (Toplevel.proofs' o Calculation.finally_cmd));
  69.107  
  69.108  val _ =
  69.109    OuterSyntax.command "moreover" "augment calculation by current facts"
    70.1 --- a/src/Pure/Isar/obtain.ML	Mon Apr 26 09:37:46 2010 -0700
    70.2 +++ b/src/Pure/Isar/obtain.ML	Mon Apr 26 09:45:22 2010 -0700
    70.3 @@ -39,14 +39,14 @@
    70.4  signature OBTAIN =
    70.5  sig
    70.6    val thatN: string
    70.7 -  val obtain: string -> (binding * string option * mixfix) list ->
    70.8 +  val obtain: string -> (binding * typ option * mixfix) list ->
    70.9 +    (Thm.binding * (term * term list) list) list -> bool -> Proof.state -> Proof.state
   70.10 +  val obtain_cmd: string -> (binding * string option * mixfix) list ->
   70.11      (Attrib.binding * (string * string list) list) list -> bool -> Proof.state -> Proof.state
   70.12 -  val obtain_i: string -> (binding * typ option * mixfix) list ->
   70.13 -    (Thm.binding * (term * term list) list) list -> bool -> Proof.state -> Proof.state
   70.14    val result: (Proof.context -> tactic) -> thm list -> Proof.context ->
   70.15      ((string * cterm) list * thm list) * Proof.context
   70.16 -  val guess: (binding * string option * mixfix) list -> bool -> Proof.state -> Proof.state
   70.17 -  val guess_i: (binding * typ option * mixfix) list -> bool -> Proof.state -> Proof.state
   70.18 +  val guess: (binding * typ option * mixfix) list -> bool -> Proof.state -> Proof.state
   70.19 +  val guess_cmd: (binding * string option * mixfix) list -> bool -> Proof.state -> Proof.state
   70.20  end;
   70.21  
   70.22  structure Obtain: OBTAIN =
   70.23 @@ -148,26 +148,26 @@
   70.24      fun after_qed _ =
   70.25        Proof.local_qed (NONE, false)
   70.26        #> `Proof.the_fact #-> (fn rule =>
   70.27 -        Proof.fix_i vars
   70.28 -        #> Proof.assm_i (obtain_export fix_ctxt rule (map (cert o Free) parms)) asms);
   70.29 +        Proof.fix vars
   70.30 +        #> Proof.assm (obtain_export fix_ctxt rule (map (cert o Free) parms)) asms);
   70.31    in
   70.32      state
   70.33      |> Proof.enter_forward
   70.34 -    |> Proof.have_i NONE (K I) [(Thm.empty_binding, [(obtain_prop, [])])] int
   70.35 +    |> Proof.have NONE (K I) [(Thm.empty_binding, [(obtain_prop, [])])] int
   70.36      |> Proof.proof (SOME Method.succeed_text) |> Seq.hd
   70.37 -    |> Proof.fix_i [(Binding.name thesisN, NONE, NoSyn)]
   70.38 -    |> Proof.assume_i
   70.39 +    |> Proof.fix [(Binding.name thesisN, NONE, NoSyn)]
   70.40 +    |> Proof.assume
   70.41        [((Binding.name that_name, [Context_Rules.intro_query NONE]), [(that_prop, [])])]
   70.42      |> `Proof.the_facts
   70.43      ||> Proof.chain_facts chain_facts
   70.44 -    ||> Proof.show_i NONE after_qed [(Thm.empty_binding, [(thesis, [])])] false
   70.45 +    ||> Proof.show NONE after_qed [(Thm.empty_binding, [(thesis, [])])] false
   70.46      |-> Proof.refine_insert
   70.47    end;
   70.48  
   70.49  in
   70.50  
   70.51 -val obtain = gen_obtain Attrib.attribute ProofContext.read_vars ProofContext.read_propp;
   70.52 -val obtain_i = gen_obtain (K I) ProofContext.cert_vars ProofContext.cert_propp;
   70.53 +val obtain = gen_obtain (K I) ProofContext.cert_vars ProofContext.cert_propp;
   70.54 +val obtain_cmd = gen_obtain Attrib.attribute ProofContext.read_vars ProofContext.read_propp;
   70.55  
   70.56  end;
   70.57  
   70.58 @@ -290,8 +290,8 @@
   70.59        in
   70.60          state'
   70.61          |> Proof.map_context (K ctxt')
   70.62 -        |> Proof.fix_i (map (fn ((x, T), mx) => (Binding.name x, SOME T, mx)) parms)
   70.63 -        |> `Proof.context_of |-> (fn fix_ctxt => Proof.assm_i
   70.64 +        |> Proof.fix (map (fn ((x, T), mx) => (Binding.name x, SOME T, mx)) parms)
   70.65 +        |> `Proof.context_of |-> (fn fix_ctxt => Proof.assm
   70.66            (obtain_export fix_ctxt rule (map cert ts)) [(Thm.empty_binding, asms)])
   70.67          |> Proof.bind_terms Auto_Bind.no_facts
   70.68        end;
   70.69 @@ -307,7 +307,7 @@
   70.70      state
   70.71      |> Proof.enter_forward
   70.72      |> Proof.begin_block
   70.73 -    |> Proof.fix_i [(Binding.name Auto_Bind.thesisN, NONE, NoSyn)]
   70.74 +    |> Proof.fix [(Binding.name Auto_Bind.thesisN, NONE, NoSyn)]
   70.75      |> Proof.chain_facts chain_facts
   70.76      |> Proof.local_goal print_result (K I) (apsnd (rpair I))
   70.77        "guess" before_qed after_qed [(Thm.empty_binding, [Logic.mk_term goal, goal])]
   70.78 @@ -316,8 +316,8 @@
   70.79  
   70.80  in
   70.81  
   70.82 -val guess = gen_guess ProofContext.read_vars;
   70.83 -val guess_i = gen_guess ProofContext.cert_vars;
   70.84 +val guess = gen_guess ProofContext.cert_vars;
   70.85 +val guess_cmd = gen_guess ProofContext.read_vars;
   70.86  
   70.87  end;
   70.88  
    71.1 --- a/src/Pure/Isar/proof.ML	Mon Apr 26 09:37:46 2010 -0700
    71.2 +++ b/src/Pure/Isar/proof.ML	Mon Apr 26 09:45:22 2010 -0700
    71.3 @@ -41,37 +41,35 @@
    71.4    val raw_goal: state -> {context: context, facts: thm list, goal: thm}
    71.5    val goal: state -> {context: context, facts: thm list, goal: thm}
    71.6    val simple_goal: state -> {context: context, goal: thm}
    71.7 -  val match_bind: (string list * string) list -> state -> state
    71.8 -  val match_bind_i: (term list * term) list -> state -> state
    71.9 -  val let_bind: (string list * string) list -> state -> state
   71.10 -  val let_bind_i: (term list * term) list -> state -> state
   71.11 -  val fix: (binding * string option * mixfix) list -> state -> state
   71.12 -  val fix_i: (binding * typ option * mixfix) list -> state -> state
   71.13 +  val let_bind: (term list * term) list -> state -> state
   71.14 +  val let_bind_cmd: (string list * string) list -> state -> state
   71.15 +  val fix: (binding * typ option * mixfix) list -> state -> state
   71.16 +  val fix_cmd: (binding * string option * mixfix) list -> state -> state
   71.17    val assm: Assumption.export ->
   71.18 +    (Thm.binding * (term * term list) list) list -> state -> state
   71.19 +  val assm_cmd: Assumption.export ->
   71.20      (Attrib.binding * (string * string list) list) list -> state -> state
   71.21 -  val assm_i: Assumption.export ->
   71.22 -    (Thm.binding * (term * term list) list) list -> state -> state
   71.23 -  val assume: (Attrib.binding * (string * string list) list) list -> state -> state
   71.24 -  val assume_i: (Thm.binding * (term * term list) list) list -> state -> state
   71.25 -  val presume: (Attrib.binding * (string * string list) list) list -> state -> state
   71.26 -  val presume_i: (Thm.binding * (term * term list) list) list -> state -> state
   71.27 -  val def: (Attrib.binding * ((binding * mixfix) * (string * string list))) list -> state -> state
   71.28 -  val def_i: (Thm.binding * ((binding * mixfix) * (term * term list))) list -> state -> state
   71.29 +  val assume: (Thm.binding * (term * term list) list) list -> state -> state
   71.30 +  val assume_cmd: (Attrib.binding * (string * string list) list) list -> state -> state
   71.31 +  val presume: (Thm.binding * (term * term list) list) list -> state -> state
   71.32 +  val presume_cmd: (Attrib.binding * (string * string list) list) list -> state -> state
   71.33 +  val def: (Thm.binding * ((binding * mixfix) * (term * term list))) list -> state -> state
   71.34 +  val def_cmd: (Attrib.binding * ((binding * mixfix) * (string * string list))) list -> state -> state
   71.35    val chain: state -> state
   71.36    val chain_facts: thm list -> state -> state
   71.37 -  val get_thmss: state -> (Facts.ref * Attrib.src list) list -> thm list
   71.38 -  val note_thmss: (Attrib.binding * (Facts.ref * Attrib.src list) list) list -> state -> state
   71.39 -  val note_thmss_i: (Thm.binding * (thm list * attribute list) list) list -> state -> state
   71.40 -  val from_thmss: ((Facts.ref * Attrib.src list) list) list -> state -> state
   71.41 -  val from_thmss_i: ((thm list * attribute list) list) list -> state -> state
   71.42 -  val with_thmss: ((Facts.ref * Attrib.src list) list) list -> state -> state
   71.43 -  val with_thmss_i: ((thm list * attribute list) list) list -> state -> state
   71.44 -  val using: ((Facts.ref * Attrib.src list) list) list -> state -> state
   71.45 -  val using_i: ((thm list * attribute list) list) list -> state -> state
   71.46 -  val unfolding: ((Facts.ref * Attrib.src list) list) list -> state -> state
   71.47 -  val unfolding_i: ((thm list * attribute list) list) list -> state -> state
   71.48 -  val invoke_case: string * string option list * Attrib.src list -> state -> state
   71.49 -  val invoke_case_i: string * string option list * attribute list -> state -> state
   71.50 +  val get_thmss_cmd: state -> (Facts.ref * Attrib.src list) list -> thm list
   71.51 +  val note_thmss: (Thm.binding * (thm list * attribute list) list) list -> state -> state
   71.52 +  val note_thmss_cmd: (Attrib.binding * (Facts.ref * Attrib.src list) list) list -> state -> state
   71.53 +  val from_thmss: ((thm list * attribute list) list) list -> state -> state
   71.54 +  val from_thmss_cmd: ((Facts.ref * Attrib.src list) list) list -> state -> state
   71.55 +  val with_thmss: ((thm list * attribute list) list) list -> state -> state
   71.56 +  val with_thmss_cmd: ((Facts.ref * Attrib.src list) list) list -> state -> state
   71.57 +  val using: ((thm list * attribute list) list) list -> state -> state
   71.58 +  val using_cmd: ((Facts.ref * Attrib.src list) list) list -> state -> state
   71.59 +  val unfolding: ((thm list * attribute list) list) list -> state -> state
   71.60 +  val unfolding_cmd: ((Facts.ref * Attrib.src list) list) list -> state -> state
   71.61 +  val invoke_case: string * string option list * attribute list -> state -> state
   71.62 +  val invoke_case_cmd: string * string option list * Attrib.src list -> state -> state
   71.63    val begin_block: state -> state
   71.64    val next_block: state -> state
   71.65    val end_block: state -> state
   71.66 @@ -87,9 +85,9 @@
   71.67      ((binding * 'a list) * 'b) list -> state -> state
   71.68    val local_qed: Method.text option * bool -> state -> state
   71.69    val theorem: Method.text option -> (thm list list -> context -> context) ->
   71.70 +    (term * term list) list list -> context -> state
   71.71 +  val theorem_cmd: Method.text option -> (thm list list -> context -> context) ->
   71.72      (string * string list) list list -> context -> state
   71.73 -  val theorem_i: Method.text option -> (thm list list -> context -> context) ->
   71.74 -    (term * term list) list list -> context -> state
   71.75    val global_qed: Method.text option * bool -> state -> context
   71.76    val local_terminal_proof: Method.text * Method.text option -> state -> state
   71.77    val local_default_proof: state -> state
   71.78 @@ -102,13 +100,13 @@
   71.79    val global_skip_proof: bool -> state -> context
   71.80    val global_done_proof: state -> context
   71.81    val have: Method.text option -> (thm list list -> state -> state) ->
   71.82 +    (Thm.binding * (term * term list) list) list -> bool -> state -> state
   71.83 +  val have_cmd: Method.text option -> (thm list list -> state -> state) ->
   71.84      (Attrib.binding * (string * string list) list) list -> bool -> state -> state
   71.85 -  val have_i: Method.text option -> (thm list list -> state -> state) ->
   71.86 -    (Thm.binding * (term * term list) list) list -> bool -> state -> state
   71.87    val show: Method.text option -> (thm list list -> state -> state) ->
   71.88 +    (Thm.binding * (term * term list) list) list -> bool -> state -> state
   71.89 +  val show_cmd: Method.text option -> (thm list list -> state -> state) ->
   71.90      (Attrib.binding * (string * string list) list) list -> bool -> state -> state
   71.91 -  val show_i: Method.text option -> (thm list list -> state -> state) ->
   71.92 -    (Thm.binding * (term * term list) list) list -> bool -> state -> state
   71.93    val schematic_goal: state -> bool
   71.94    val is_relevant: state -> bool
   71.95    val local_future_proof: (state -> ('a * state) Future.future) ->
   71.96 @@ -523,22 +521,20 @@
   71.97  
   71.98  (** context elements **)
   71.99  
  71.100 -(* bindings *)
  71.101 +(* let bindings *)
  71.102  
  71.103  local
  71.104  
  71.105  fun gen_bind bind args state =
  71.106    state
  71.107    |> assert_forward
  71.108 -  |> map_context (bind args #> snd)
  71.109 +  |> map_context (bind true args #> snd)
  71.110    |> put_facts NONE;
  71.111  
  71.112  in
  71.113  
  71.114 -val match_bind = gen_bind (ProofContext.match_bind false);
  71.115 -val match_bind_i = gen_bind (ProofContext.match_bind_i false);
  71.116 -val let_bind = gen_bind (ProofContext.match_bind true);
  71.117 -val let_bind_i = gen_bind (ProofContext.match_bind_i true);
  71.118 +val let_bind = gen_bind ProofContext.match_bind_i;
  71.119 +val let_bind_cmd = gen_bind ProofContext.match_bind;
  71.120  
  71.121  end;
  71.122  
  71.123 @@ -554,8 +550,8 @@
  71.124  
  71.125  in
  71.126  
  71.127 -val fix = gen_fix (fn ctxt => fn args => fst (ProofContext.read_vars args ctxt));
  71.128 -val fix_i = gen_fix (K I);
  71.129 +val fix = gen_fix (K I);
  71.130 +val fix_cmd = gen_fix (fn ctxt => fn args => fst (ProofContext.read_vars args ctxt));
  71.131  
  71.132  end;
  71.133  
  71.134 @@ -572,12 +568,12 @@
  71.135  
  71.136  in
  71.137  
  71.138 -val assm      = gen_assume ProofContext.add_assms Attrib.attribute;
  71.139 -val assm_i    = gen_assume ProofContext.add_assms_i (K I);
  71.140 -val assume    = assm Assumption.assume_export;
  71.141 -val assume_i  = assm_i Assumption.assume_export;
  71.142 -val presume   = assm Assumption.presume_export;
  71.143 -val presume_i = assm_i Assumption.presume_export;
  71.144 +val assm = gen_assume ProofContext.add_assms_i (K I);
  71.145 +val assm_cmd = gen_assume ProofContext.add_assms Attrib.attribute;
  71.146 +val assume = assm Assumption.assume_export;
  71.147 +val assume_cmd = assm_cmd Assumption.assume_export;
  71.148 +val presume = assm Assumption.presume_export;
  71.149 +val presume_cmd = assm_cmd Assumption.presume_export;
  71.150  
  71.151  end;
  71.152  
  71.153 @@ -605,8 +601,8 @@
  71.154  
  71.155  in
  71.156  
  71.157 -val def = gen_def Attrib.attribute ProofContext.read_vars ProofContext.match_bind;
  71.158 -val def_i = gen_def (K I) ProofContext.cert_vars ProofContext.match_bind_i;
  71.159 +val def = gen_def (K I) ProofContext.cert_vars ProofContext.match_bind_i;
  71.160 +val def_cmd = gen_def Attrib.attribute ProofContext.read_vars ProofContext.match_bind;
  71.161  
  71.162  end;
  71.163  
  71.164 @@ -646,18 +642,18 @@
  71.165  
  71.166  in
  71.167  
  71.168 -val note_thmss = gen_thmss (K []) I #2 Attrib.attribute ProofContext.get_fact;
  71.169 -val note_thmss_i = gen_thmss (K []) I #2 (K I) (K I);
  71.170 +val note_thmss = gen_thmss (K []) I #2 (K I) (K I);
  71.171 +val note_thmss_cmd = gen_thmss (K []) I #2 Attrib.attribute ProofContext.get_fact;
  71.172  
  71.173 -val from_thmss = gen_thmss (K []) chain #2 Attrib.attribute ProofContext.get_fact o no_binding;
  71.174 -val from_thmss_i = gen_thmss (K []) chain #2 (K I) (K I) o no_binding;
  71.175 +val from_thmss = gen_thmss (K []) chain #2 (K I) (K I) o no_binding;
  71.176 +val from_thmss_cmd = gen_thmss (K []) chain #2 Attrib.attribute ProofContext.get_fact o no_binding;
  71.177  
  71.178 -val with_thmss = gen_thmss the_facts chain #2 Attrib.attribute ProofContext.get_fact o no_binding;
  71.179 -val with_thmss_i = gen_thmss the_facts chain #2 (K I) (K I) o no_binding;
  71.180 +val with_thmss = gen_thmss the_facts chain #2 (K I) (K I) o no_binding;
  71.181 +val with_thmss_cmd = gen_thmss the_facts chain #2 Attrib.attribute ProofContext.get_fact o no_binding;
  71.182  
  71.183  val local_results = gen_thmss (K []) I I (K I) (K I) o map (apsnd Thm.simple_fact);
  71.184  
  71.185 -fun get_thmss state srcs = the_facts (note_thmss [((Binding.empty, []), srcs)] state);
  71.186 +fun get_thmss_cmd state srcs = the_facts (note_thmss_cmd [((Binding.empty, []), srcs)] state);
  71.187  
  71.188  end;
  71.189  
  71.190 @@ -686,10 +682,10 @@
  71.191  
  71.192  in
  71.193  
  71.194 -val using = gen_using append_using (K (K I)) Attrib.attribute ProofContext.get_fact;
  71.195 -val using_i = gen_using append_using (K (K I)) (K I) (K I);
  71.196 -val unfolding = gen_using unfold_using unfold_goals Attrib.attribute ProofContext.get_fact;
  71.197 -val unfolding_i = gen_using unfold_using unfold_goals (K I) (K I);
  71.198 +val using = gen_using append_using (K (K I)) (K I) (K I);
  71.199 +val using_cmd = gen_using append_using (K (K I)) Attrib.attribute ProofContext.get_fact;
  71.200 +val unfolding = gen_using unfold_using unfold_goals (K I) (K I);
  71.201 +val unfolding_cmd = gen_using unfold_using unfold_goals Attrib.attribute ProofContext.get_fact;
  71.202  
  71.203  end;
  71.204  
  71.205 @@ -709,15 +705,15 @@
  71.206      val assumptions = asms |> map (fn (a, ts) => ((qualified_binding a, atts), map (rpair []) ts));
  71.207    in
  71.208      state'
  71.209 -    |> assume_i assumptions
  71.210 +    |> assume assumptions
  71.211      |> bind_terms Auto_Bind.no_facts
  71.212 -    |> `the_facts |-> (fn thms => note_thmss_i [((Binding.name name, []), [(thms, [])])])
  71.213 +    |> `the_facts |-> (fn thms => note_thmss [((Binding.name name, []), [(thms, [])])])
  71.214    end;
  71.215  
  71.216  in
  71.217  
  71.218 -val invoke_case = gen_invoke_case Attrib.attribute;
  71.219 -val invoke_case_i = gen_invoke_case (K I);
  71.220 +val invoke_case = gen_invoke_case (K I);
  71.221 +val invoke_case_cmd = gen_invoke_case Attrib.attribute;
  71.222  
  71.223  end;
  71.224  
  71.225 @@ -790,15 +786,16 @@
  71.226  
  71.227  local
  71.228  
  71.229 -fun implicit_vars dest add props =
  71.230 +val is_var =
  71.231 +  can (dest_TVar o Logic.dest_type o Logic.dest_term) orf
  71.232 +  can (dest_Var o Logic.dest_term);
  71.233 +
  71.234 +fun implicit_vars props =
  71.235    let
  71.236 -    val (explicit_vars, props') = take_prefix (can dest) props |>> map dest;
  71.237 -    val vars = rev (subtract (op =) explicit_vars (fold add props []));
  71.238 -    val _ =
  71.239 -      if null vars then ()
  71.240 -      else warning ("Goal statement contains unbound schematic variable(s): " ^
  71.241 -        commas_quote (map (Term.string_of_vname o fst) vars));
  71.242 -  in (rev vars, props') end;
  71.243 +    val (var_props, props') = take_prefix is_var props;
  71.244 +    val explicit_vars = fold Term.add_vars var_props [];
  71.245 +    val vars = filter_out (member (op =) explicit_vars) (fold Term.add_vars props []);
  71.246 +  in map (Logic.mk_term o Var) vars end;
  71.247  
  71.248  fun refine_terms n =
  71.249    refine (Method.Basic (K (RAW_METHOD
  71.250 @@ -823,11 +820,8 @@
  71.251        |> map_context_result (fn ctxt => swap (prepp (ctxt, raw_propp)));
  71.252      val props = flat propss;
  71.253  
  71.254 -    val (_, props') =
  71.255 -      implicit_vars (dest_TVar o Logic.dest_type o Logic.dest_term) Term.add_tvars props;
  71.256 -    val (vars, _) = implicit_vars (dest_Var o Logic.dest_term) Term.add_vars props';
  71.257 -
  71.258 -    val propss' = map (Logic.mk_term o Var) vars :: propss;
  71.259 +    val vars = implicit_vars props;
  71.260 +    val propss' = vars :: propss;
  71.261      val goal_propss = filter_out null propss';
  71.262      val goal =
  71.263        cert (Logic.mk_conjunction_balanced (map Logic.mk_conjunction_balanced goal_propss))
  71.264 @@ -903,8 +897,8 @@
  71.265    init ctxt
  71.266    |> generic_goal (prepp #> ProofContext.auto_fixes) "" before_qed (K I, after_qed) propp;
  71.267  
  71.268 -val theorem = global_goal ProofContext.bind_propp_schematic;
  71.269 -val theorem_i = global_goal ProofContext.bind_propp_schematic_i;
  71.270 +val theorem = global_goal ProofContext.bind_propp_schematic_i;
  71.271 +val theorem_cmd = global_goal ProofContext.bind_propp_schematic;
  71.272  
  71.273  fun global_qeds txt =
  71.274    end_proof true txt
  71.275 @@ -976,10 +970,10 @@
  71.276  
  71.277  in
  71.278  
  71.279 -val have = gen_have Attrib.attribute ProofContext.bind_propp;
  71.280 -val have_i = gen_have (K I) ProofContext.bind_propp_i;
  71.281 -val show = gen_show Attrib.attribute ProofContext.bind_propp;
  71.282 -val show_i = gen_show (K I) ProofContext.bind_propp_i;
  71.283 +val have = gen_have (K I) ProofContext.bind_propp_i;
  71.284 +val have_cmd = gen_have Attrib.attribute ProofContext.bind_propp;
  71.285 +val show = gen_show (K I) ProofContext.bind_propp_i;
  71.286 +val show_cmd = gen_show Attrib.attribute ProofContext.bind_propp;
  71.287  
  71.288  end;
  71.289  
    72.1 --- a/src/Pure/Isar/specification.ML	Mon Apr 26 09:37:46 2010 -0700
    72.2 +++ b/src/Pure/Isar/specification.ML	Mon Apr 26 09:45:22 2010 -0700
    72.3 @@ -403,7 +403,7 @@
    72.4      goal_ctxt
    72.5      |> ProofContext.note_thmss "" [((Binding.name Auto_Bind.assmsN, []), [(prems, [])])]
    72.6      |> snd
    72.7 -    |> Proof.theorem_i before_qed after_qed' (map snd stmt)
    72.8 +    |> Proof.theorem before_qed after_qed' (map snd stmt)
    72.9      |> (case facts of NONE => I | SOME ths => Proof.refine_insert ths)
   72.10      |> tap (fn state => not schematic andalso Proof.schematic_goal state andalso
   72.11          error "Illegal schematic goal statement")
    73.1 --- a/src/Pure/ML/ml_thms.ML	Mon Apr 26 09:37:46 2010 -0700
    73.2 +++ b/src/Pure/ML/ml_thms.ML	Mon Apr 26 09:45:22 2010 -0700
    73.3 @@ -64,7 +64,7 @@
    73.4          fun after_qed res goal_ctxt =
    73.5            put_thms (i, map prep_result (ProofContext.export goal_ctxt ctxt (flat res))) goal_ctxt;
    73.6          val ctxt' = ctxt
    73.7 -          |> Proof.theorem_i NONE after_qed propss
    73.8 +          |> Proof.theorem NONE after_qed propss
    73.9            |> Proof.global_terminal_proof methods;
   73.10          val (a, background') = background
   73.11            |> ML_Antiquote.variant "lemma" ||> put_thms (i, the_thms ctxt' i);
    74.1 --- a/src/Pure/Thy/thy_output.ML	Mon Apr 26 09:37:46 2010 -0700
    74.2 +++ b/src/Pure/Thy/thy_output.ML	Mon Apr 26 09:45:22 2010 -0700
    74.3 @@ -574,7 +574,7 @@
    74.4        val prop_src =
    74.5          (case Args.dest_src source of ((a, arg :: _), pos) => Args.src ((a, [arg]), pos));
    74.6        val _ = context
    74.7 -        |> Proof.theorem_i NONE (K I) [[(prop, [])]]
    74.8 +        |> Proof.theorem NONE (K I) [[(prop, [])]]
    74.9          |> Proof.global_terminal_proof methods;
   74.10      in output (maybe_pretty_source (pretty_term context) prop_src [prop]) end);
   74.11  
    75.1 --- a/src/Pure/axclass.ML	Mon Apr 26 09:37:46 2010 -0700
    75.2 +++ b/src/Pure/axclass.ML	Mon Apr 26 09:45:22 2010 -0700
    75.3 @@ -13,9 +13,8 @@
    75.4    val add_arity: thm -> theory -> theory
    75.5    val prove_classrel: class * class -> tactic -> theory -> theory
    75.6    val prove_arity: string * sort list * sort -> tactic -> theory -> theory
    75.7 -  val get_info: theory -> class ->
    75.8 -    {def: thm, intro: thm, axioms: thm list, params: (string * typ) list}
    75.9 -  val class_intros: theory -> thm list
   75.10 +  type info = {def: thm, intro: thm, axioms: thm list, params: (string * typ) list}
   75.11 +  val get_info: theory -> class -> info
   75.12    val class_of_param: theory -> string -> class option
   75.13    val cert_classrel: theory -> class * class -> class * class
   75.14    val read_classrel: theory -> xstring * xstring -> class * class
   75.15 @@ -37,8 +36,6 @@
   75.16    val param_of_inst: theory -> string * string -> string
   75.17    val inst_of_param: theory -> string -> (string * string) option
   75.18    val thynames_of_arity: theory -> class * string -> string list
   75.19 -  val introN: string
   75.20 -  val axiomsN: string
   75.21  end;
   75.22  
   75.23  structure AxClass: AX_CLASS =
   75.24 @@ -46,6 +43,18 @@
   75.25  
   75.26  (** theory data **)
   75.27  
   75.28 +(* axclass info *)
   75.29 +
   75.30 +type info =
   75.31 + {def: thm,
   75.32 +  intro: thm,
   75.33 +  axioms: thm list,
   75.34 +  params: (string * typ) list};
   75.35 +
   75.36 +fun make_axclass (def, intro, axioms, params): info =
   75.37 +  {def = def, intro = intro, axioms = axioms, params = params};
   75.38 +
   75.39 +
   75.40  (* class parameters (canonical order) *)
   75.41  
   75.42  type param = string * class;
   75.43 @@ -57,188 +66,256 @@
   75.44        " for " ^ Pretty.string_of_sort pp [c] ^
   75.45        (if c = c' then "" else " and " ^ Pretty.string_of_sort pp [c'])));
   75.46  
   75.47 -fun merge_params _ ([], qs) = qs
   75.48 -  | merge_params pp (ps, qs) =
   75.49 -      fold_rev (fn q => if member (op =) ps q then I else add_param pp q) qs ps;
   75.50 +
   75.51 +(* setup data *)
   75.52 +
   75.53 +datatype data = Data of
   75.54 + {axclasses: info Symtab.table,
   75.55 +  params: param list,
   75.56 +  proven_classrels: (thm * proof) Symreltab.table,
   75.57 +  proven_arities: ((class * sort list) * ((thm * string) * proof)) list Symtab.table,
   75.58 +    (*arity theorems with theory name*)
   75.59 +  inst_params:
   75.60 +    (string * thm) Symtab.table Symtab.table *
   75.61 +      (*constant name ~> type constructor ~> (constant name, equation)*)
   75.62 +    (string * string) Symtab.table (*constant name ~> (constant name, type constructor)*),
   75.63 +  diff_merge_classrels: (class * class) list};
   75.64 +
   75.65 +fun make_data
   75.66 +    (axclasses, params, proven_classrels, proven_arities, inst_params, diff_merge_classrels) =
   75.67 +  Data {axclasses = axclasses, params = params, proven_classrels = proven_classrels,
   75.68 +    proven_arities = proven_arities, inst_params = inst_params,
   75.69 +    diff_merge_classrels = diff_merge_classrels};
   75.70 +
   75.71 +structure Data = Theory_Data_PP
   75.72 +(
   75.73 +  type T = data;
   75.74 +  val empty =
   75.75 +    make_data (Symtab.empty, [], Symreltab.empty, Symtab.empty, (Symtab.empty, Symtab.empty), []);
   75.76 +  val extend = I;
   75.77 +  fun merge pp
   75.78 +      (Data {axclasses = axclasses1, params = params1, proven_classrels = proven_classrels1,
   75.79 +        proven_arities = proven_arities1, inst_params = inst_params1,
   75.80 +        diff_merge_classrels = diff_merge_classrels1},
   75.81 +       Data {axclasses = axclasses2, params = params2, proven_classrels = proven_classrels2,
   75.82 +        proven_arities = proven_arities2, inst_params = inst_params2,
   75.83 +        diff_merge_classrels = diff_merge_classrels2}) =
   75.84 +    let
   75.85 +      val axclasses' = Symtab.merge (K true) (axclasses1, axclasses2);
   75.86 +      val params' =
   75.87 +        if null params1 then params2
   75.88 +        else fold_rev (fn q => if member (op =) params1 q then I else add_param pp q) params2 params1;
   75.89 +
   75.90 +      (*transitive closure of classrels and arity completion is done in Theory.at_begin hook*)
   75.91 +      val proven_classrels' = Symreltab.join (K #1) (proven_classrels1, proven_classrels2);
   75.92 +      val proven_arities' =
   75.93 +        Symtab.join (K (Library.merge (eq_fst op =))) (proven_arities1, proven_arities2);
   75.94 +
   75.95 +      val classrels1 = Symreltab.keys proven_classrels1;
   75.96 +      val classrels2 = Symreltab.keys proven_classrels2;
   75.97 +      val diff_merge_classrels' =
   75.98 +        subtract (op =) classrels1 classrels2 @
   75.99 +        subtract (op =) classrels2 classrels1 @
  75.100 +        diff_merge_classrels1 @ diff_merge_classrels2;
  75.101 +
  75.102 +      val inst_params' =
  75.103 +        (Symtab.join (K (Symtab.merge (K true))) (#1 inst_params1, #1 inst_params2),
  75.104 +          Symtab.merge (K true) (#2 inst_params1, #2 inst_params2));
  75.105 +    in
  75.106 +      make_data (axclasses', params', proven_classrels', proven_arities', inst_params',
  75.107 +        diff_merge_classrels')
  75.108 +    end;
  75.109 +);
  75.110 +
  75.111 +fun map_data f =
  75.112 +  Data.map (fn Data {axclasses, params, proven_classrels, proven_arities, inst_params, diff_merge_classrels} =>
  75.113 +    make_data (f (axclasses, params, proven_classrels, proven_arities, inst_params, diff_merge_classrels)));
  75.114 +
  75.115 +fun map_axclasses f =
  75.116 +  map_data (fn (axclasses, params, proven_classrels, proven_arities, inst_params, diff_merge_classrels) =>
  75.117 +    (f axclasses, params, proven_classrels, proven_arities, inst_params, diff_merge_classrels));
  75.118 +
  75.119 +fun map_params f =
  75.120 +  map_data (fn (axclasses, params, proven_classrels, proven_arities, inst_params, diff_merge_classrels) =>
  75.121 +    (axclasses, f params, proven_classrels, proven_arities, inst_params, diff_merge_classrels));
  75.122 +
  75.123 +fun map_proven_classrels f =
  75.124 +  map_data (fn (axclasses, params, proven_classrels, proven_arities, inst_params, diff_merge_classrels) =>
  75.125 +    (axclasses, params, f proven_classrels, proven_arities, inst_params, diff_merge_classrels));
  75.126 +
  75.127 +fun map_proven_arities f =
  75.128 +  map_data (fn (axclasses, params, proven_classrels, proven_arities, inst_params, diff_merge_classrels) =>
  75.129 +    (axclasses, params, proven_classrels, f proven_arities, inst_params, diff_merge_classrels));
  75.130 +
  75.131 +fun map_inst_params f =
  75.132 +  map_data (fn (axclasses, params, proven_classrels, proven_arities, inst_params, diff_merge_classrels) =>
  75.133 +    (axclasses, params, proven_classrels, proven_arities, f inst_params, diff_merge_classrels));
  75.134 +
  75.135 +val clear_diff_merge_classrels =
  75.136 +  map_data (fn (axclasses, params, proven_classrels, proven_arities, inst_params, _) =>
  75.137 +    (axclasses, params, proven_classrels, proven_arities, inst_params, []));
  75.138 +
  75.139 +val rep_data = Data.get #> (fn Data args => args);
  75.140 +
  75.141 +val axclasses_of = #axclasses o rep_data;
  75.142 +val params_of = #params o rep_data;
  75.143 +val proven_classrels_of = #proven_classrels o rep_data;
  75.144 +val proven_arities_of = #proven_arities o rep_data;
  75.145 +val inst_params_of = #inst_params o rep_data;
  75.146 +val diff_merge_classrels_of = #diff_merge_classrels o rep_data;
  75.147  
  75.148  
  75.149 -(* axclasses *)
  75.150 -
  75.151 -val introN = "intro";
  75.152 -val superN = "super";
  75.153 -val axiomsN = "axioms";
  75.154 +(* axclasses with parameters *)
  75.155  
  75.156 -datatype axclass = AxClass of
  75.157 - {def: thm,
  75.158 -  intro: thm,
  75.159 -  axioms: thm list,
  75.160 -  params: (string * typ) list};
  75.161 +fun get_info thy c =
  75.162 +  (case Symtab.lookup (axclasses_of thy) c of
  75.163 +    SOME info => info
  75.164 +  | NONE => error ("No such axclass: " ^ quote c));
  75.165  
  75.166 -type axclasses = axclass Symtab.table * param list;
  75.167 +fun all_params_of thy S =
  75.168 +  let val params = params_of thy;
  75.169 +  in fold (fn (x, c) => if Sign.subsort thy (S, [c]) then cons x else I) params [] end;
  75.170  
  75.171 -fun make_axclass ((def, intro, axioms), params) = AxClass
  75.172 -  {def = def, intro = intro, axioms = axioms, params = params};
  75.173 -
  75.174 -fun merge_axclasses pp ((tab1, params1), (tab2, params2)) : axclasses =
  75.175 -  (Symtab.merge (K true) (tab1, tab2), merge_params pp (params1, params2));
  75.176 +fun class_of_param thy = AList.lookup (op =) (params_of thy);
  75.177  
  75.178  
  75.179 -(* instances *)
  75.180 +(* maintain instances *)
  75.181  
  75.182  val classrel_prefix = "classrel_";
  75.183  val arity_prefix = "arity_";
  75.184  
  75.185 -type instances =
  75.186 -  ((class * class) * thm) list *  (*classrel theorems*)
  75.187 -  ((class * sort list) * (thm * string)) list Symtab.table;  (*arity theorems with theory name*)
  75.188 -
  75.189 -fun merge_instances ((classrel1, arities1): instances, (classrel2, arities2)) =
  75.190 - (merge (eq_fst op =) (classrel1, classrel2),
  75.191 -  Symtab.join (K (merge (eq_fst op =))) (arities1, arities2));
  75.192 -
  75.193 -
  75.194 -(* instance parameters *)
  75.195 -
  75.196 -type inst_params =
  75.197 -  (string * thm) Symtab.table Symtab.table
  75.198 -    (*constant name ~> type constructor ~> (constant name, equation)*)
  75.199 -  * (string * string) Symtab.table; (*constant name ~> (constant name, type constructor)*)
  75.200 -
  75.201 -fun merge_inst_params ((const_param1, param_const1), (const_param2, param_const2)) =
  75.202 -  (Symtab.join  (K (Symtab.merge (K true))) (const_param1, const_param2),
  75.203 -    Symtab.merge (K true) (param_const1, param_const2));
  75.204 -
  75.205 -
  75.206 -(* setup data *)
  75.207 -
  75.208 -structure AxClassData = Theory_Data_PP
  75.209 -(
  75.210 -  type T = axclasses * (instances * inst_params);
  75.211 -  val empty = ((Symtab.empty, []), (([], Symtab.empty), (Symtab.empty, Symtab.empty)));
  75.212 -  val extend = I;
  75.213 -  fun merge pp ((axclasses1, (instances1, inst_params1)), (axclasses2, (instances2, inst_params2))) =
  75.214 -    (merge_axclasses pp (axclasses1, axclasses2),
  75.215 -      (merge_instances (instances1, instances2), merge_inst_params (inst_params1, inst_params2)));
  75.216 -);
  75.217 -
  75.218 -
  75.219 -(* maintain axclasses *)
  75.220 -
  75.221 -val get_axclasses = #1 o AxClassData.get;
  75.222 -val map_axclasses = AxClassData.map o apfst;
  75.223 -
  75.224 -val lookup_def = Symtab.lookup o #1 o get_axclasses;
  75.225 -
  75.226 -fun get_info thy c =
  75.227 -  (case lookup_def thy c of
  75.228 -    SOME (AxClass info) => info
  75.229 -  | NONE => error ("No such axclass: " ^ quote c));
  75.230 -
  75.231 -fun class_intros thy =
  75.232 -  let
  75.233 -    fun add_intro c =
  75.234 -      (case lookup_def thy c of SOME (AxClass {intro, ...}) => cons intro | _ => I);
  75.235 -    val classes = Sign.all_classes thy;
  75.236 -  in map (Thm.class_triv thy) classes @ fold add_intro classes [] end;
  75.237 -
  75.238 -
  75.239 -fun get_params thy pred =
  75.240 -  let val params = #2 (get_axclasses thy);
  75.241 -  in fold (fn (x, c) => if pred c then cons x else I) params [] end;
  75.242 -
  75.243 -fun all_params_of thy S = get_params thy (fn c => Sign.subsort thy (S, [c]));
  75.244 -
  75.245 -fun class_of_param thy = AList.lookup (op =) (#2 (get_axclasses thy));
  75.246 -
  75.247 -
  75.248 -(* maintain instances *)
  75.249 -
  75.250  fun instance_name (a, c) = Long_Name.base_name c ^ "_" ^ Long_Name.base_name a;
  75.251  
  75.252 -val get_instances = #1 o #2 o AxClassData.get;
  75.253 -val map_instances = AxClassData.map o apsnd o apfst;
  75.254 -
  75.255  
  75.256  fun the_classrel thy (c1, c2) =
  75.257 -  (case AList.lookup (op =) (#1 (get_instances thy)) (c1, c2) of
  75.258 -    SOME th => Thm.transfer thy th
  75.259 +  (case Symreltab.lookup (proven_classrels_of thy) (c1, c2) of
  75.260 +    SOME classrel => classrel
  75.261    | NONE => error ("Unproven class relation " ^
  75.262        Syntax.string_of_classrel (ProofContext.init thy) [c1, c2]));
  75.263  
  75.264 -fun put_classrel arg = map_instances (fn (classrel, arities) =>
  75.265 -  (insert (eq_fst op =) arg classrel, arities));
  75.266 +fun the_classrel_thm thy = Thm.transfer thy o #1 o the_classrel thy;
  75.267 +fun the_classrel_prf thy = #2 o the_classrel thy;
  75.268 +
  75.269 +fun put_trancl_classrel ((c1, c2), th) thy =
  75.270 +  let
  75.271 +    val cert = Thm.cterm_of thy;
  75.272 +    val certT = Thm.ctyp_of thy;
  75.273 +
  75.274 +    val classes = Sorts.classes_of (Sign.classes_of thy);
  75.275 +    val classrels = proven_classrels_of thy;
  75.276 +
  75.277 +    fun reflcl_classrel (c1', c2') =
  75.278 +      if c1' = c2'
  75.279 +      then Thm.trivial (cert (Logic.mk_of_class (TVar ((Name.aT, 0), []), c1')))
  75.280 +      else the_classrel_thm thy (c1', c2');
  75.281 +    fun gen_classrel (c1_pred, c2_succ) =
  75.282 +      let
  75.283 +        val th' = ((reflcl_classrel (c1_pred, c1) RS th) RS reflcl_classrel (c2, c2_succ))
  75.284 +          |> Drule.instantiate' [SOME (certT (TVar ((Name.aT, 0), [])))] []
  75.285 +          |> Thm.close_derivation;
  75.286 +        val prf' = Thm.proof_of th';
  75.287 +      in ((c1_pred, c2_succ), (th', prf')) end;
  75.288 +
  75.289 +    val new_classrels =
  75.290 +      Library.map_product pair (c1 :: Graph.imm_preds classes c1) (c2 :: Graph.imm_succs classes c2)
  75.291 +      |> filter_out (Symreltab.defined classrels)
  75.292 +      |> map gen_classrel;
  75.293 +    val needed = not (null new_classrels);
  75.294 +  in
  75.295 +    (needed,
  75.296 +      if needed then map_proven_classrels (fold Symreltab.update new_classrels) thy
  75.297 +      else thy)
  75.298 +  end;
  75.299 +
  75.300 +fun complete_classrels thy =
  75.301 +  let
  75.302 +    val classrels = proven_classrels_of thy;
  75.303 +    val diff_merge_classrels = diff_merge_classrels_of thy;
  75.304 +    val (needed, thy') = (false, thy) |>
  75.305 +      fold (fn c12 => fn (needed, thy) =>
  75.306 +          put_trancl_classrel (c12, Symreltab.lookup classrels c12 |> the |> #1) thy
  75.307 +          |>> (fn b => needed orelse b))
  75.308 +        diff_merge_classrels;
  75.309 +  in
  75.310 +    if null diff_merge_classrels then NONE
  75.311 +    else SOME (clear_diff_merge_classrels thy')
  75.312 +  end;
  75.313  
  75.314  
  75.315  fun the_arity thy a (c, Ss) =
  75.316 -  (case AList.lookup (op =) (Symtab.lookup_list (#2 (get_instances thy)) a) (c, Ss) of
  75.317 -    SOME (th, _) => Thm.transfer thy th
  75.318 +  (case AList.lookup (op =) (Symtab.lookup_list (proven_arities_of thy) a) (c, Ss) of
  75.319 +    SOME arity => arity
  75.320    | NONE => error ("Unproven type arity " ^
  75.321        Syntax.string_of_arity (ProofContext.init thy) (a, Ss, [c])));
  75.322  
  75.323 +fun the_arity_thm thy a c_Ss = the_arity thy a c_Ss |> #1 |> #1 |> Thm.transfer thy;
  75.324 +fun the_arity_prf thy a c_Ss = the_arity thy a c_Ss |> #2;
  75.325 +
  75.326  fun thynames_of_arity thy (c, a) =
  75.327 -  Symtab.lookup_list (#2 (get_instances thy)) a
  75.328 -  |> map_filter (fn ((c', _), (_, name)) => if c = c' then SOME name else NONE)
  75.329 +  Symtab.lookup_list (proven_arities_of thy) a
  75.330 +  |> map_filter (fn ((c', _), ((_, name),_)) => if c = c' then SOME name else NONE)
  75.331    |> rev;
  75.332  
  75.333 -fun insert_arity_completions thy (t, ((c, Ss), (th, thy_name))) arities =
  75.334 +fun insert_arity_completions thy (t, ((c, Ss), ((th, thy_name), _))) arities =
  75.335    let
  75.336      val algebra = Sign.classes_of thy;
  75.337      val super_class_completions =
  75.338        Sign.super_classes thy c
  75.339        |> filter_out (fn c1 => exists (fn ((c2, Ss2), _) => c1 = c2
  75.340            andalso Sorts.sorts_le algebra (Ss2, Ss)) (Symtab.lookup_list arities t));
  75.341 -    val completions = map (fn c1 => (Sorts.classrel_derivation algebra
  75.342 -      (fn (th, c2) => fn c3 => th RS the_classrel thy (c2, c3)) (th, c) c1
  75.343 -        |> Thm.close_derivation, c1)) super_class_completions;
  75.344 -    val arities' = fold (fn (th1, c1) => Symtab.cons_list (t, ((c1, Ss), (th1, thy_name))))
  75.345 +    val names_and_Ss = Name.names Name.context Name.aT (map (K []) Ss);
  75.346 +    val completions = super_class_completions |> map (fn c1 =>
  75.347 +      let
  75.348 +        val th1 = (th RS the_classrel_thm thy (c, c1))
  75.349 +          |> Drule.instantiate' (map (SOME o ctyp_of thy o TVar o apfst (rpair 0)) names_and_Ss) []
  75.350 +          |> Thm.close_derivation;
  75.351 +        val prf1 = Thm.proof_of th1;
  75.352 +      in (((th1, thy_name), prf1), c1) end);
  75.353 +    val arities' = fold (fn (th_thy_prf1, c1) => Symtab.cons_list (t, ((c1, Ss), th_thy_prf1)))
  75.354        completions arities;
  75.355    in (null completions, arities') end;
  75.356  
  75.357  fun put_arity ((t, Ss, c), th) thy =
  75.358    let
  75.359 -    val arity' = (t, ((c, Ss), (th, Context.theory_name thy)));
  75.360 +    val arity' = (t, ((c, Ss), ((th, Context.theory_name thy), Thm.proof_of th)));
  75.361    in
  75.362      thy
  75.363 -    |> map_instances (fn (classrel, arities) => (classrel,
  75.364 -      arities
  75.365 -      |> Symtab.insert_list (eq_fst op =) arity'
  75.366 -      |> insert_arity_completions thy arity'
  75.367 -      |> snd))
  75.368 +    |> map_proven_arities
  75.369 +      (Symtab.insert_list (eq_fst op =) arity' #>
  75.370 +        insert_arity_completions thy arity' #> snd)
  75.371    end;
  75.372  
  75.373  fun complete_arities thy =
  75.374    let
  75.375 -    val arities = snd (get_instances thy);
  75.376 +    val arities = proven_arities_of thy;
  75.377      val (finished, arities') = arities
  75.378        |> fold_map (insert_arity_completions thy) (Symtab.dest_list arities);
  75.379    in
  75.380 -    if forall I finished then NONE
  75.381 -    else SOME (thy |> map_instances (fn (classrel, _) => (classrel, arities')))
  75.382 +    if forall I finished
  75.383 +    then NONE
  75.384 +    else SOME (map_proven_arities (K arities') thy)
  75.385    end;
  75.386  
  75.387 -val _ = Context.>> (Context.map_theory (Theory.at_begin complete_arities));
  75.388 +val _ = Context.>> (Context.map_theory
  75.389 +  (Theory.at_begin complete_classrels #> Theory.at_begin complete_arities));
  75.390  
  75.391  
  75.392  (* maintain instance parameters *)
  75.393  
  75.394 -val get_inst_params = #2 o #2 o AxClassData.get;
  75.395 -val map_inst_params = AxClassData.map o apsnd o apsnd;
  75.396 +fun get_inst_param thy (c, tyco) =
  75.397 +  (case Symtab.lookup (the_default Symtab.empty (Symtab.lookup (#1 (inst_params_of thy)) c)) tyco of
  75.398 +    SOME c' => c'
  75.399 +  | NONE => error ("No instance parameter for constant " ^ quote c ^ " on type " ^ quote tyco));
  75.400  
  75.401 -fun get_inst_param thy (c, tyco) =
  75.402 -  case Symtab.lookup ((the_default Symtab.empty o Symtab.lookup (fst (get_inst_params thy))) c) tyco
  75.403 -   of SOME c' => c'
  75.404 -    | NONE => error ("No instance parameter for constant " ^ quote c
  75.405 -        ^ " on type constructor " ^ quote tyco);
  75.406 -
  75.407 -fun add_inst_param (c, tyco) inst = (map_inst_params o apfst
  75.408 -      o Symtab.map_default (c, Symtab.empty)) (Symtab.update_new (tyco, inst))
  75.409 +fun add_inst_param (c, tyco) inst =
  75.410 +  (map_inst_params o apfst o Symtab.map_default (c, Symtab.empty)) (Symtab.update_new (tyco, inst))
  75.411    #> (map_inst_params o apsnd) (Symtab.update_new (fst inst, (c, tyco)));
  75.412  
  75.413 -val inst_of_param = Symtab.lookup o snd o get_inst_params;
  75.414 +val inst_of_param = Symtab.lookup o #2 o inst_params_of;
  75.415  val param_of_inst = fst oo get_inst_param;
  75.416  
  75.417 -fun inst_thms thy = (Symtab.fold (Symtab.fold (cons o snd o snd) o snd) o fst)
  75.418 -  (get_inst_params thy) [];
  75.419 +fun inst_thms thy =
  75.420 +  Symtab.fold (Symtab.fold (cons o #2 o #2) o #2) (#1 (inst_params_of thy)) [];
  75.421  
  75.422  fun get_inst_tyco consts = try (fst o dest_Type o the_single o Consts.typargs consts);
  75.423  
  75.424 @@ -248,18 +325,20 @@
  75.425  fun unoverload_conv thy = MetaSimplifier.rewrite true (inst_thms thy);
  75.426  fun overload_conv thy = MetaSimplifier.rewrite true (map Thm.symmetric (inst_thms thy));
  75.427  
  75.428 -fun lookup_inst_param consts params (c, T) = case get_inst_tyco consts (c, T)
  75.429 - of SOME tyco => AList.lookup (op =) params (c, tyco)
  75.430 -  | NONE => NONE;
  75.431 +fun lookup_inst_param consts params (c, T) =
  75.432 +  (case get_inst_tyco consts (c, T) of
  75.433 +    SOME tyco => AList.lookup (op =) params (c, tyco)
  75.434 +  | NONE => NONE);
  75.435  
  75.436  fun unoverload_const thy (c_ty as (c, _)) =
  75.437 -  if is_some (class_of_param thy c)
  75.438 -  then case get_inst_tyco (Sign.consts_of thy) c_ty
  75.439 -   of SOME tyco => try (param_of_inst thy) (c, tyco) |> the_default c
  75.440 -    | NONE => c
  75.441 +  if is_some (class_of_param thy c) then
  75.442 +    (case get_inst_tyco (Sign.consts_of thy) c_ty of
  75.443 +      SOME tyco => try (param_of_inst thy) (c, tyco) |> the_default c
  75.444 +    | NONE => c)
  75.445    else c;
  75.446  
  75.447  
  75.448 +
  75.449  (** instances **)
  75.450  
  75.451  (* class relations *)
  75.452 @@ -331,6 +410,8 @@
  75.453  
  75.454  (* primitive rules *)
  75.455  
  75.456 +val shyps_topped = forall null o #shyps o Thm.rep_thm;
  75.457 +
  75.458  fun add_classrel raw_th thy =
  75.459    let
  75.460      val th = Thm.strip_shyps (Thm.transfer thy raw_th);
  75.461 @@ -338,10 +419,14 @@
  75.462      fun err () = raise THM ("add_classrel: malformed class relation", 0, [th]);
  75.463      val rel = Logic.dest_classrel prop handle TERM _ => err ();
  75.464      val (c1, c2) = cert_classrel thy rel handle TYPE _ => err ();
  75.465 +    val th' = th
  75.466 +      |> Drule.instantiate' [SOME (ctyp_of thy (TVar ((Name.aT, 0), [c1])))] []
  75.467 +      |> Thm.unconstrain_allTs;
  75.468 +    val _ = shyps_topped th' orelse raise Fail "add_classrel: nontop shyps after unconstrain";
  75.469    in
  75.470      thy
  75.471      |> Sign.primitive_classrel (c1, c2)
  75.472 -    |> put_classrel ((c1, c2), Thm.close_derivation (Drule.unconstrainTs th))
  75.473 +    |> (snd oo put_trancl_classrel) ((c1, c2), th')
  75.474      |> perhaps complete_arities
  75.475    end;
  75.476  
  75.477 @@ -351,17 +436,22 @@
  75.478      val prop = Thm.plain_prop_of th;
  75.479      fun err () = raise THM ("add_arity: malformed type arity", 0, [th]);
  75.480      val (t, Ss, c) = Logic.dest_arity prop handle TERM _ => err ();
  75.481 -    val T = Type (t, map TFree (Name.names Name.context Name.aT Ss));
  75.482 +    val names = Name.names Name.context Name.aT Ss;
  75.483 +    val T = Type (t, map TFree names);
  75.484      val missing_params = Sign.complete_sort thy [c]
  75.485        |> maps (these o Option.map #params o try (get_info thy))
  75.486        |> filter_out (fn (const, _) => can (get_inst_param thy) (const, t))
  75.487        |> (map o apsnd o map_atyps) (K T);
  75.488      val _ = map (Sign.certify_sort thy) Ss = Ss orelse err ();
  75.489 +    val th' = th
  75.490 +      |> Drule.instantiate' (map (SOME o ctyp_of thy o TVar o apfst (rpair 0)) names) []
  75.491 +      |> Thm.unconstrain_allTs;
  75.492 +    val _ = shyps_topped th' orelse raise Fail "add_arity: nontop shyps after unconstrain";
  75.493    in
  75.494      thy
  75.495      |> fold (snd oo declare_overloaded) missing_params
  75.496      |> Sign.primitive_arity (t, Ss, [c])
  75.497 -    |> put_arity ((t, Ss, c), Thm.close_derivation (Drule.unconstrainTs th))
  75.498 +    |> put_arity ((t, Ss, c), th')
  75.499    end;
  75.500  
  75.501  
  75.502 @@ -483,25 +573,24 @@
  75.503        def_thy
  75.504        |> Sign.qualified_path true bconst
  75.505        |> PureThy.note_thmss ""
  75.506 -        [((Binding.name introN, []), [([Drule.export_without_context raw_intro], [])]),
  75.507 -         ((Binding.name superN, []), [(map Drule.export_without_context raw_classrel, [])]),
  75.508 -         ((Binding.name axiomsN, []),
  75.509 +        [((Binding.name "intro", []), [([Drule.export_without_context raw_intro], [])]),
  75.510 +         ((Binding.name "super", []), [(map Drule.export_without_context raw_classrel, [])]),
  75.511 +         ((Binding.name "axioms", []),
  75.512             [(map (fn th => Drule.export_without_context (class_triv RS th)) raw_axioms, [])])]
  75.513        ||> Sign.restore_naming def_thy;
  75.514  
  75.515  
  75.516      (* result *)
  75.517  
  75.518 -    val axclass = make_axclass ((def, intro, axioms), params);
  75.519 +    val axclass = make_axclass (def, intro, axioms, params);
  75.520      val result_thy =
  75.521        facts_thy
  75.522 -      |> fold put_classrel (map (pair class) super ~~ classrel)
  75.523 +      |> fold (snd oo put_trancl_classrel) (map (pair class) super ~~ classrel)
  75.524        |> Sign.qualified_path false bconst
  75.525        |> PureThy.note_thmss "" (name_atts ~~ map Thm.simple_fact (unflat axiomss axioms)) |> snd
  75.526        |> Sign.restore_naming facts_thy
  75.527 -      |> map_axclasses (fn (axclasses, parameters) =>
  75.528 -        (Symtab.update (class, axclass) axclasses,
  75.529 -          fold (fn (x, _) => add_param pp (x, class)) params parameters));
  75.530 +      |> map_axclasses (Symtab.update (class, axclass))
  75.531 +      |> map_params (fold (fn (x, _) => add_param pp (x, class)) params);
  75.532  
  75.533    in (class, result_thy) end;
  75.534  
    76.1 --- a/src/Pure/display.ML	Mon Apr 26 09:37:46 2010 -0700
    76.2 +++ b/src/Pure/display.ML	Mon Apr 26 09:45:22 2010 -0700
    76.3 @@ -182,7 +182,8 @@
    76.4      val extern_const = Name_Space.extern (#1 constants);
    76.5      val {classes, default, types, ...} = Type.rep_tsig tsig;
    76.6      val (class_space, class_algebra) = classes;
    76.7 -    val {classes, arities} = Sorts.rep_algebra class_algebra;
    76.8 +    val classes = Sorts.classes_of class_algebra;
    76.9 +    val arities = Sorts.arities_of class_algebra;
   76.10  
   76.11      val clsses = Name_Space.dest_table (class_space, Symtab.make (Graph.dest classes));
   76.12      val tdecls = Name_Space.dest_table types;
    77.1 --- a/src/Pure/drule.ML	Mon Apr 26 09:37:46 2010 -0700
    77.2 +++ b/src/Pure/drule.ML	Mon Apr 26 09:45:22 2010 -0700
    77.3 @@ -106,7 +106,6 @@
    77.4    val dummy_thm: thm
    77.5    val sort_constraintI: thm
    77.6    val sort_constraint_eq: thm
    77.7 -  val unconstrainTs: thm -> thm
    77.8    val with_subgoal: int -> (thm -> thm) -> thm -> thm
    77.9    val comp_no_flatten: thm * int -> int -> thm -> thm
   77.10    val rename_bvars: (string * string) list -> thm -> thm
   77.11 @@ -204,12 +203,6 @@
   77.12  
   77.13  (** Standardization of rules **)
   77.14  
   77.15 -(* type classes and sorts *)
   77.16 -
   77.17 -fun unconstrainTs th =
   77.18 -  fold (Thm.unconstrainT o Thm.ctyp_of (Thm.theory_of_thm th) o TVar)
   77.19 -    (Thm.fold_terms Term.add_tvars th []) th;
   77.20 -
   77.21  (*Generalization over a list of variables*)
   77.22  val forall_intr_list = fold_rev forall_intr;
   77.23  
    78.1 --- a/src/Pure/sorts.ML	Mon Apr 26 09:37:46 2010 -0700
    78.2 +++ b/src/Pure/sorts.ML	Mon Apr 26 09:45:22 2010 -0700
    78.3 @@ -25,9 +25,8 @@
    78.4    val insert_term: term -> sort OrdList.T -> sort OrdList.T
    78.5    val insert_terms: term list -> sort OrdList.T -> sort OrdList.T
    78.6    type algebra
    78.7 -  val rep_algebra: algebra ->
    78.8 -   {classes: serial Graph.T,
    78.9 -    arities: (class * (class * sort list)) list Symtab.table}
   78.10 +  val classes_of: algebra -> serial Graph.T
   78.11 +  val arities_of: algebra -> (class * (class * sort list)) list Symtab.table
   78.12    val all_classes: algebra -> class list
   78.13    val super_classes: algebra -> class -> class list
   78.14    val class_less: algebra -> class * class -> bool
   78.15 @@ -116,10 +115,8 @@
   78.16   {classes: serial Graph.T,
   78.17    arities: (class * (class * sort list)) list Symtab.table};
   78.18  
   78.19 -fun rep_algebra (Algebra args) = args;
   78.20 -
   78.21 -val classes_of = #classes o rep_algebra;
   78.22 -val arities_of = #arities o rep_algebra;
   78.23 +fun classes_of (Algebra {classes, ...}) = classes;
   78.24 +fun arities_of (Algebra {arities, ...}) = arities;
   78.25  
   78.26  fun make_algebra (classes, arities) =
   78.27    Algebra {classes = classes, arities = arities};
    79.1 --- a/src/Pure/thm.ML	Mon Apr 26 09:37:46 2010 -0700
    79.2 +++ b/src/Pure/thm.ML	Mon Apr 26 09:45:22 2010 -0700
    79.3 @@ -92,8 +92,6 @@
    79.4    val instantiate: (ctyp * ctyp) list * (cterm * cterm) list -> thm -> thm
    79.5    val instantiate_cterm: (ctyp * ctyp) list * (cterm * cterm) list -> cterm -> cterm
    79.6    val trivial: cterm -> thm
    79.7 -  val of_class: ctyp * class -> thm
    79.8 -  val unconstrainT: ctyp -> thm -> thm
    79.9    val dest_state: thm * int -> (term * term) list * term list * term * term
   79.10    val lift_rule: cterm -> thm -> thm
   79.11    val incr_indexes: int -> thm -> thm
   79.12 @@ -139,6 +137,9 @@
   79.13    val adjust_maxidx_thm: int -> thm -> thm
   79.14    val varifyT_global: thm -> thm
   79.15    val varifyT_global': (string * sort) list -> thm -> ((string * sort) * indexname) list * thm
   79.16 +  val of_class: ctyp * class -> thm
   79.17 +  val unconstrainT: ctyp -> thm -> thm
   79.18 +  val unconstrain_allTs: thm -> thm
   79.19    val freezeT: thm -> thm
   79.20    val assumption: int -> thm -> thm Seq.seq
   79.21    val eq_assumption: int -> thm -> thm
   79.22 @@ -1240,6 +1241,11 @@
   79.23        prop = Logic.list_implies (constraints, unconstrain prop)})
   79.24    end;
   79.25  
   79.26 +fun unconstrain_allTs th =
   79.27 +  fold (unconstrainT o ctyp_of (theory_of_thm th) o TVar)
   79.28 +    (fold_terms Term.add_tvars th []) th;
   79.29 +
   79.30 +
   79.31  (* Replace all TFrees not fixed or in the hyps by new TVars *)
   79.32  fun varifyT_global' fixed (Thm (der, {thy_ref, maxidx, shyps, hyps, tpairs, prop, ...})) =
   79.33    let