Replaced group_ and ring_simps by algebra_simps;
authornipkow
Wed Jan 28 16:29:16 2009 +0100 (2009-01-28)
changeset 2966753103fc8ffa3
parent 29549 7187373c6cb1
child 29668 33ba3faeaa0e
Replaced group_ and ring_simps by algebra_simps;
removed compare_rls - use algebra_simps now
src/HOL/Algebra/abstract/Ring2.thy
src/HOL/Algebra/poly/UnivPoly2.thy
src/HOL/Complex.thy
src/HOL/Dense_Linear_Order.thy
src/HOL/Deriv.thy
src/HOL/Divides.thy
src/HOL/Finite_Set.thy
src/HOL/Fundamental_Theorem_Algebra.thy
src/HOL/Groebner_Basis.thy
src/HOL/Int.thy
src/HOL/IntDiv.thy
src/HOL/Library/Abstract_Rat.thy
src/HOL/Library/BigO.thy
src/HOL/Library/Commutative_Ring.thy
src/HOL/Library/Float.thy
src/HOL/Library/Nat_Infinity.thy
src/HOL/Library/Pocklington.thy
src/HOL/Library/Primes.thy
src/HOL/Library/SetsAndFunctions.thy
src/HOL/Library/Univ_Poly.thy
src/HOL/Lim.thy
src/HOL/Ln.thy
src/HOL/Matrix/LP.thy
src/HOL/Matrix/Matrix.thy
src/HOL/Matrix/SparseMatrix.thy
src/HOL/Matrix/cplex/Cplex.thy
src/HOL/MetisExamples/BigO.thy
src/HOL/Nat.thy
src/HOL/NumberTheory/IntPrimes.thy
src/HOL/OrderedGroup.thy
src/HOL/PReal.thy
src/HOL/Polynomial.thy
src/HOL/Presburger.thy
src/HOL/RComplete.thy
src/HOL/Rational.thy
src/HOL/RealDef.thy
src/HOL/RealPow.thy
src/HOL/Ring_and_Field.thy
src/HOL/SEQ.thy
src/HOL/SetInterval.thy
src/HOL/Tools/ComputeNumeral.thy
src/HOL/Transcendental.thy
src/HOL/Word/BinBoolList.thy
src/HOL/Word/WordArith.thy
src/HOL/ZF/LProd.thy
src/HOL/ex/Lagrange.thy
src/HOL/ex/MIR.thy
src/HOL/ex/Numeral.thy
src/HOL/ex/ReflectedFerrack.thy
src/HOL/ex/Reflected_Presburger.thy
src/HOL/ex/ReflectionEx.thy
     1.1 --- a/src/HOL/Algebra/abstract/Ring2.thy	Sun Jan 18 13:58:17 2009 +0100
     1.2 +++ b/src/HOL/Algebra/abstract/Ring2.thy	Wed Jan 28 16:29:16 2009 +0100
     1.3 @@ -224,10 +224,6 @@
     1.4    {* Method.no_args (Method.SIMPLE_METHOD' (full_simp_tac ring_ss)) *}
     1.5    {* computes distributive normal form in rings *}
     1.6  
     1.7 -lemmas ring_simps =
     1.8 -  l_zero r_zero l_neg r_neg minus_minus minus0
     1.9 -  l_one r_one l_null r_null l_minus r_minus
    1.10 -
    1.11  
    1.12  subsection {* Rings and the summation operator *}
    1.13  
     2.1 --- a/src/HOL/Algebra/poly/UnivPoly2.thy	Sun Jan 18 13:58:17 2009 +0100
     2.2 +++ b/src/HOL/Algebra/poly/UnivPoly2.thy	Wed Jan 28 16:29:16 2009 +0100
     2.3 @@ -189,7 +189,7 @@
     2.4  lemma coeff_smult [simp]: "coeff (a *s p) n = (a::'a::ring) * coeff p n"
     2.5  proof -
     2.6    have "!!f. f : UP ==> (%n. a * f n) : UP"
     2.7 -    by (unfold UP_def) (force simp add: ring_simps)
     2.8 +    by (unfold UP_def) (force simp add: algebra_simps)
     2.9  *)      (* this force step is slow *)
    2.10  (*  then show ?thesis
    2.11      apply (simp add: coeff_def smult_def Abs_UP_inverse Rep_UP)
    2.12 @@ -198,7 +198,7 @@
    2.13  lemma coeff_smult [simp]: "coeff (a *s p) n = (a::'a::ring) * coeff p n"
    2.14  proof -
    2.15    have "Rep_UP p : UP ==> (%n. a * Rep_UP p n) : UP"
    2.16 -    by (unfold UP_def) (force simp add: ring_simps)
    2.17 +    by (unfold UP_def) (force simp add: algebra_simps)
    2.18        (* this force step is slow *)
    2.19    then show ?thesis
    2.20      by (simp add: coeff_def smult_def Abs_UP_inverse Rep_UP)
    2.21 @@ -220,7 +220,7 @@
    2.22  	fix i
    2.23  	assume "max n m < i"
    2.24  	with boundn and boundm show "f i + g i = 0"
    2.25 -          by (fastsimp simp add: ring_simps)
    2.26 +          by (fastsimp simp add: algebra_simps)
    2.27        qed
    2.28        then show "(%i. (f i + g i)) : UP"
    2.29  	by (unfold UP_def) fast
    2.30 @@ -251,15 +251,15 @@
    2.31  	  have "f i * g (k-i) = 0"
    2.32  	  proof cases
    2.33  	    assume "n < i"
    2.34 -	    with `bound n f` show ?thesis by (auto simp add: ring_simps)
    2.35 +	    with `bound n f` show ?thesis by (auto simp add: algebra_simps)
    2.36  	  next
    2.37  	    assume "~ (n < i)"
    2.38  	    with bound have "m < k-i" by arith
    2.39 -	    with `bound m g` show ?thesis by (auto simp add: ring_simps)
    2.40 +	    with `bound m g` show ?thesis by (auto simp add: algebra_simps)
    2.41  	  qed
    2.42  	}
    2.43  	then show "setsum (%i. f i * g (k-i)) {..k} = 0"
    2.44 -	  by (simp add: ring_simps)
    2.45 +	  by (simp add: algebra_simps)
    2.46        qed
    2.47        then show "(%n. setsum (%i. f i * g (n-i)) {..n}) : UP"
    2.48  	by (unfold UP_def) fast
    2.49 @@ -270,7 +270,7 @@
    2.50  qed
    2.51  
    2.52  lemma coeff_uminus [simp]: "coeff (-p) n = (-coeff p n::'a::ring)"
    2.53 -by (unfold up_uminus_def) (simp add: ring_simps)
    2.54 +by (unfold up_uminus_def) (simp add: algebra_simps)
    2.55  
    2.56  (* Other lemmas *)
    2.57  
    2.58 @@ -388,7 +388,7 @@
    2.59    proof (cases k)
    2.60      case 0 then show ?thesis by simp ring
    2.61    next
    2.62 -    case Suc then show ?thesis by (simp add: ring_simps) ring
    2.63 +    case Suc then show ?thesis by (simp add: algebra_simps) ring
    2.64    qed
    2.65    then show "coeff (monom a 0 * p) k = coeff (a *s p) k" by ring
    2.66  qed
     3.1 --- a/src/HOL/Complex.thy	Sun Jan 18 13:58:17 2009 +0100
     3.2 +++ b/src/HOL/Complex.thy	Wed Jan 28 16:29:16 2009 +0100
     3.3 @@ -237,9 +237,9 @@
     3.4    show "scaleR 1 x = x"
     3.5      by (simp add: expand_complex_eq)
     3.6    show "scaleR a x * y = scaleR a (x * y)"
     3.7 -    by (simp add: expand_complex_eq ring_simps)
     3.8 +    by (simp add: expand_complex_eq algebra_simps)
     3.9    show "x * scaleR a y = scaleR a (x * y)"
    3.10 -    by (simp add: expand_complex_eq ring_simps)
    3.11 +    by (simp add: expand_complex_eq algebra_simps)
    3.12  qed
    3.13  
    3.14  end
    3.15 @@ -312,7 +312,7 @@
    3.16         (simp add: power_mult_distrib right_distrib [symmetric] real_sqrt_mult)
    3.17    show "norm (x * y) = norm x * norm y"
    3.18      by (induct x, induct y)
    3.19 -       (simp add: real_sqrt_mult [symmetric] power2_eq_square ring_simps)
    3.20 +       (simp add: real_sqrt_mult [symmetric] power2_eq_square algebra_simps)
    3.21    show "sgn x = x /\<^sub>R cmod x" by(simp add: complex_sgn_def)
    3.22  qed
    3.23  
     4.1 --- a/src/HOL/Dense_Linear_Order.thy	Sun Jan 18 13:58:17 2009 +0100
     4.2 +++ b/src/HOL/Dense_Linear_Order.thy	Wed Jan 28 16:29:16 2009 +0100
     4.3 @@ -552,7 +552,7 @@
     4.4  lemma neg_prod_lt:"(c\<Colon>'a\<Colon>ordered_field) < 0 \<Longrightarrow> ((c*x < 0) == (x > 0))"
     4.5  proof-
     4.6    assume H: "c < 0"
     4.7 -  have "c*x < 0 = (0/c < x)" by (simp only: neg_divide_less_eq[OF H] ring_simps)
     4.8 +  have "c*x < 0 = (0/c < x)" by (simp only: neg_divide_less_eq[OF H] algebra_simps)
     4.9    also have "\<dots> = (0 < x)" by simp
    4.10    finally show  "(c*x < 0) == (x > 0)" by simp
    4.11  qed
    4.12 @@ -560,7 +560,7 @@
    4.13  lemma pos_prod_lt:"(c\<Colon>'a\<Colon>ordered_field) > 0 \<Longrightarrow> ((c*x < 0) == (x < 0))"
    4.14  proof-
    4.15    assume H: "c > 0"
    4.16 -  hence "c*x < 0 = (0/c > x)" by (simp only: pos_less_divide_eq[OF H] ring_simps)
    4.17 +  hence "c*x < 0 = (0/c > x)" by (simp only: pos_less_divide_eq[OF H] algebra_simps)
    4.18    also have "\<dots> = (0 > x)" by simp
    4.19    finally show  "(c*x < 0) == (x < 0)" by simp
    4.20  qed
    4.21 @@ -569,7 +569,7 @@
    4.22  proof-
    4.23    assume H: "c < 0"
    4.24    have "c*x + t< 0 = (c*x < -t)" by (subst less_iff_diff_less_0 [of "c*x" "-t"], simp)
    4.25 -  also have "\<dots> = (-t/c < x)" by (simp only: neg_divide_less_eq[OF H] ring_simps)
    4.26 +  also have "\<dots> = (-t/c < x)" by (simp only: neg_divide_less_eq[OF H] algebra_simps)
    4.27    also have "\<dots> = ((- 1/c)*t < x)" by simp
    4.28    finally show  "(c*x + t < 0) == (x > (- 1/c)*t)" by simp
    4.29  qed
    4.30 @@ -578,7 +578,7 @@
    4.31  proof-
    4.32    assume H: "c > 0"
    4.33    have "c*x + t< 0 = (c*x < -t)"  by (subst less_iff_diff_less_0 [of "c*x" "-t"], simp)
    4.34 -  also have "\<dots> = (-t/c > x)" by (simp only: pos_less_divide_eq[OF H] ring_simps)
    4.35 +  also have "\<dots> = (-t/c > x)" by (simp only: pos_less_divide_eq[OF H] algebra_simps)
    4.36    also have "\<dots> = ((- 1/c)*t > x)" by simp
    4.37    finally show  "(c*x + t < 0) == (x < (- 1/c)*t)" by simp
    4.38  qed
    4.39 @@ -589,7 +589,7 @@
    4.40  lemma neg_prod_le:"(c\<Colon>'a\<Colon>ordered_field) < 0 \<Longrightarrow> ((c*x <= 0) == (x >= 0))"
    4.41  proof-
    4.42    assume H: "c < 0"
    4.43 -  have "c*x <= 0 = (0/c <= x)" by (simp only: neg_divide_le_eq[OF H] ring_simps)
    4.44 +  have "c*x <= 0 = (0/c <= x)" by (simp only: neg_divide_le_eq[OF H] algebra_simps)
    4.45    also have "\<dots> = (0 <= x)" by simp
    4.46    finally show  "(c*x <= 0) == (x >= 0)" by simp
    4.47  qed
    4.48 @@ -597,7 +597,7 @@
    4.49  lemma pos_prod_le:"(c\<Colon>'a\<Colon>ordered_field) > 0 \<Longrightarrow> ((c*x <= 0) == (x <= 0))"
    4.50  proof-
    4.51    assume H: "c > 0"
    4.52 -  hence "c*x <= 0 = (0/c >= x)" by (simp only: pos_le_divide_eq[OF H] ring_simps)
    4.53 +  hence "c*x <= 0 = (0/c >= x)" by (simp only: pos_le_divide_eq[OF H] algebra_simps)
    4.54    also have "\<dots> = (0 >= x)" by simp
    4.55    finally show  "(c*x <= 0) == (x <= 0)" by simp
    4.56  qed
    4.57 @@ -606,7 +606,7 @@
    4.58  proof-
    4.59    assume H: "c < 0"
    4.60    have "c*x + t <= 0 = (c*x <= -t)"  by (subst le_iff_diff_le_0 [of "c*x" "-t"], simp)
    4.61 -  also have "\<dots> = (-t/c <= x)" by (simp only: neg_divide_le_eq[OF H] ring_simps)
    4.62 +  also have "\<dots> = (-t/c <= x)" by (simp only: neg_divide_le_eq[OF H] algebra_simps)
    4.63    also have "\<dots> = ((- 1/c)*t <= x)" by simp
    4.64    finally show  "(c*x + t <= 0) == (x >= (- 1/c)*t)" by simp
    4.65  qed
    4.66 @@ -615,7 +615,7 @@
    4.67  proof-
    4.68    assume H: "c > 0"
    4.69    have "c*x + t <= 0 = (c*x <= -t)" by (subst le_iff_diff_le_0 [of "c*x" "-t"], simp)
    4.70 -  also have "\<dots> = (-t/c >= x)" by (simp only: pos_le_divide_eq[OF H] ring_simps)
    4.71 +  also have "\<dots> = (-t/c >= x)" by (simp only: pos_le_divide_eq[OF H] algebra_simps)
    4.72    also have "\<dots> = ((- 1/c)*t >= x)" by simp
    4.73    finally show  "(c*x + t <= 0) == (x <= (- 1/c)*t)" by simp
    4.74  qed
    4.75 @@ -628,7 +628,7 @@
    4.76  proof-
    4.77    assume H: "c \<noteq> 0"
    4.78    have "c*x + t = 0 = (c*x = -t)" by (subst eq_iff_diff_eq_0 [of "c*x" "-t"], simp)
    4.79 -  also have "\<dots> = (x = -t/c)" by (simp only: nonzero_eq_divide_eq[OF H] ring_simps)
    4.80 +  also have "\<dots> = (x = -t/c)" by (simp only: nonzero_eq_divide_eq[OF H] algebra_simps)
    4.81    finally show  "(c*x + t = 0) == (x = (- 1/c)*t)" by simp
    4.82  qed
    4.83  lemma sum_eq:"((x::'a::pordered_ab_group_add) + t = 0) == (x = - t)"
     5.1 --- a/src/HOL/Deriv.thy	Sun Jan 18 13:58:17 2009 +0100
     5.2 +++ b/src/HOL/Deriv.thy	Wed Jan 28 16:29:16 2009 +0100
     5.3 @@ -141,7 +141,7 @@
     5.4  lemma inverse_diff_inverse:
     5.5    "\<lbrakk>(a::'a::division_ring) \<noteq> 0; b \<noteq> 0\<rbrakk>
     5.6     \<Longrightarrow> inverse a - inverse b = - (inverse a * (a - b) * inverse b)"
     5.7 -by (simp add: ring_simps)
     5.8 +by (simp add: algebra_simps)
     5.9  
    5.10  lemma DERIV_inverse_lemma:
    5.11    "\<lbrakk>a \<noteq> 0; b \<noteq> (0::'a::real_normed_field)\<rbrakk>
    5.12 @@ -206,7 +206,7 @@
    5.13  case (Suc k)
    5.14    from DERIV_mult' [OF f Suc] show ?case
    5.15      apply (simp only: of_nat_Suc ring_distribs mult_1_left)
    5.16 -    apply (simp only: power_Suc right_distrib mult_ac add_ac)
    5.17 +    apply (simp only: power_Suc algebra_simps)
    5.18      done
    5.19  qed
    5.20  
    5.21 @@ -724,7 +724,7 @@
    5.22        from isCont_bounded [OF le this]
    5.23        obtain k where k: "!!x. a \<le> x & x \<le> b --> inverse (M - f x) \<le> k" by auto
    5.24        have Minv: "!!x. a \<le> x & x \<le> b --> 0 < inverse (M - f (x))"
    5.25 -        by (simp add: M3 compare_rls)
    5.26 +        by (simp add: M3 algebra_simps)
    5.27        have "!!x. a \<le> x & x \<le> b --> inverse (M - f x) < k+1" using k
    5.28          by (auto intro: order_le_less_trans [of _ k])
    5.29        with Minv
    5.30 @@ -1398,7 +1398,7 @@
    5.31      have "?h b - ?h a =
    5.32           ((f b)*(g b) - (f a)*(g b) - (g b)*(f b) + (g a)*(f b)) -
    5.33            ((f b)*(g a) - (f a)*(g a) - (g b)*(f a) + (g a)*(f a))"
    5.34 -      by (simp add: mult_ac add_ac right_diff_distrib)
    5.35 +      by (simp add: algebra_simps)
    5.36      hence "?h b - ?h a = 0" by auto
    5.37    }
    5.38    ultimately have "(b - a) * (g'c * (f b - f a) - f'c * (g b - g a)) = 0" by auto
    5.39 @@ -1427,7 +1427,7 @@
    5.40  
    5.41  lemma coeff_pderiv: "coeff (pderiv p) n = of_nat (Suc n) * coeff p (Suc n)"
    5.42    apply (induct p arbitrary: n, simp)
    5.43 -  apply (simp add: pderiv_pCons coeff_pCons ring_simps split: nat.split)
    5.44 +  apply (simp add: pderiv_pCons coeff_pCons algebra_simps split: nat.split)
    5.45    done
    5.46  
    5.47  lemma pderiv_eq_0_iff: "pderiv p = 0 \<longleftrightarrow> degree p = 0"
    5.48 @@ -1451,21 +1451,21 @@
    5.49  by (simp add: pderiv_pCons)
    5.50  
    5.51  lemma pderiv_add: "pderiv (p + q) = pderiv p + pderiv q"
    5.52 -by (rule poly_ext, simp add: coeff_pderiv ring_simps)
    5.53 +by (rule poly_ext, simp add: coeff_pderiv algebra_simps)
    5.54  
    5.55  lemma pderiv_minus: "pderiv (- p) = - pderiv p"
    5.56  by (rule poly_ext, simp add: coeff_pderiv)
    5.57  
    5.58  lemma pderiv_diff: "pderiv (p - q) = pderiv p - pderiv q"
    5.59 -by (rule poly_ext, simp add: coeff_pderiv ring_simps)
    5.60 +by (rule poly_ext, simp add: coeff_pderiv algebra_simps)
    5.61  
    5.62  lemma pderiv_smult: "pderiv (smult a p) = smult a (pderiv p)"
    5.63 -by (rule poly_ext, simp add: coeff_pderiv ring_simps)
    5.64 +by (rule poly_ext, simp add: coeff_pderiv algebra_simps)
    5.65  
    5.66  lemma pderiv_mult: "pderiv (p * q) = p * pderiv q + q * pderiv p"
    5.67  apply (induct p)
    5.68  apply simp
    5.69 -apply (simp add: pderiv_add pderiv_smult pderiv_pCons ring_simps)
    5.70 +apply (simp add: pderiv_add pderiv_smult pderiv_pCons algebra_simps)
    5.71  done
    5.72  
    5.73  lemma pderiv_power_Suc:
    5.74 @@ -1475,7 +1475,7 @@
    5.75  apply (subst power_Suc)
    5.76  apply (subst pderiv_mult)
    5.77  apply (erule ssubst)
    5.78 -apply (simp add: smult_add_left ring_simps)
    5.79 +apply (simp add: smult_add_left algebra_simps)
    5.80  done
    5.81  
    5.82  lemma DERIV_cmult2: "DERIV f x :> D ==> DERIV (%x. (f x) * c :: real) x :> D * c"
     6.1 --- a/src/HOL/Divides.thy	Sun Jan 18 13:58:17 2009 +0100
     6.2 +++ b/src/HOL/Divides.thy	Wed Jan 28 16:29:16 2009 +0100
     6.3 @@ -38,10 +38,10 @@
     6.4    by (simp only: add_ac)
     6.5  
     6.6  lemma div_mod_equality: "((a div b) * b + a mod b) + c = a + c"
     6.7 -  by (simp add: mod_div_equality)
     6.8 +by (simp add: mod_div_equality)
     6.9  
    6.10  lemma div_mod_equality2: "(b * (a div b) + a mod b) + c = a + c"
    6.11 -  by (simp add: mod_div_equality2)
    6.12 +by (simp add: mod_div_equality2)
    6.13  
    6.14  lemma mod_by_0 [simp]: "a mod 0 = a"
    6.15    using mod_div_equality [of a zero] by simp
    6.16 @@ -63,7 +63,7 @@
    6.17      by (simp add: mod_div_equality)
    6.18    also from False div_mult_self1 [of b a c] have
    6.19      "\<dots> = (c + a div b) * b + (a + c * b) mod b"
    6.20 -      by (simp add: left_distrib add_ac)
    6.21 +      by (simp add: algebra_simps)
    6.22    finally have "a = a div b * b + (a + c * b) mod b"
    6.23      by (simp add: add_commute [of a] add_assoc left_distrib)
    6.24    then have "a div b * b + (a + c * b) mod b = a div b * b + a mod b"
    6.25 @@ -72,7 +72,7 @@
    6.26  qed
    6.27  
    6.28  lemma mod_mult_self2 [simp]: "(a + b * c) mod b = a mod b"
    6.29 -  by (simp add: mult_commute [of b])
    6.30 +by (simp add: mult_commute [of b])
    6.31  
    6.32  lemma div_mult_self1_is_id [simp]: "b \<noteq> 0 \<Longrightarrow> b * a div b = a"
    6.33    using div_mult_self2 [of b 0 a] by simp
    6.34 @@ -217,7 +217,7 @@
    6.35    have "(a * b) mod c = ((a div c * c + a mod c) * b) mod c"
    6.36      by (simp only: mod_div_equality)
    6.37    also have "\<dots> = (a mod c * b + a div c * b * c) mod c"
    6.38 -    by (simp only: left_distrib right_distrib add_ac mult_ac)
    6.39 +    by (simp only: algebra_simps)
    6.40    also have "\<dots> = (a mod c * b) mod c"
    6.41      by (rule mod_mult_self1)
    6.42    finally show ?thesis .
    6.43 @@ -228,7 +228,7 @@
    6.44    have "(a * b) mod c = (a * (b div c * c + b mod c)) mod c"
    6.45      by (simp only: mod_div_equality)
    6.46    also have "\<dots> = (a * (b mod c) + a * (b div c) * c) mod c"
    6.47 -    by (simp only: left_distrib right_distrib add_ac mult_ac)
    6.48 +    by (simp only: algebra_simps)
    6.49    also have "\<dots> = (a * (b mod c)) mod c"
    6.50      by (rule mod_mult_self1)
    6.51    finally show ?thesis .
    6.52 @@ -552,7 +552,7 @@
    6.53  
    6.54  lemma divmod_if [code]: "divmod m n = (if n = 0 \<or> m < n then (0, m) else
    6.55    let (q, r) = divmod (m - n) n in (Suc q, r))"
    6.56 -  by (simp add: divmod_zero divmod_base divmod_step)
    6.57 +by (simp add: divmod_zero divmod_base divmod_step)
    6.58      (simp add: divmod_div_mod)
    6.59  
    6.60  code_modulename SML
    6.61 @@ -568,16 +568,16 @@
    6.62  subsubsection {* Quotient *}
    6.63  
    6.64  lemma div_geq: "0 < n \<Longrightarrow>  \<not> m < n \<Longrightarrow> m div n = Suc ((m - n) div n)"
    6.65 -  by (simp add: le_div_geq linorder_not_less)
    6.66 +by (simp add: le_div_geq linorder_not_less)
    6.67  
    6.68  lemma div_if: "0 < n \<Longrightarrow> m div n = (if m < n then 0 else Suc ((m - n) div n))"
    6.69 -  by (simp add: div_geq)
    6.70 +by (simp add: div_geq)
    6.71  
    6.72  lemma div_mult_self_is_m [simp]: "0<n ==> (m*n) div n = (m::nat)"
    6.73 -  by simp
    6.74 +by simp
    6.75  
    6.76  lemma div_mult_self1_is_m [simp]: "0<n ==> (n*m) div n = (m::nat)"
    6.77 -  by simp
    6.78 +by simp
    6.79  
    6.80  
    6.81  subsubsection {* Remainder *}
    6.82 @@ -597,13 +597,13 @@
    6.83  qed
    6.84  
    6.85  lemma mod_geq: "\<not> m < (n\<Colon>nat) \<Longrightarrow> m mod n = (m - n) mod n"
    6.86 -  by (simp add: le_mod_geq linorder_not_less)
    6.87 +by (simp add: le_mod_geq linorder_not_less)
    6.88  
    6.89  lemma mod_if: "m mod (n\<Colon>nat) = (if m < n then m else (m - n) mod n)"
    6.90 -  by (simp add: le_mod_geq)
    6.91 +by (simp add: le_mod_geq)
    6.92  
    6.93  lemma mod_1 [simp]: "m mod Suc 0 = 0"
    6.94 -  by (induct m) (simp_all add: mod_geq)
    6.95 +by (induct m) (simp_all add: mod_geq)
    6.96  
    6.97  lemma mod_mult_distrib: "(m mod n) * (k\<Colon>nat) = (m * k) mod (n * k)"
    6.98    apply (cases "n = 0", simp)
    6.99 @@ -614,11 +614,11 @@
   6.100    done
   6.101  
   6.102  lemma mod_mult_distrib2: "(k::nat) * (m mod n) = (k*m) mod (k*n)"
   6.103 -  by (simp add: mult_commute [of k] mod_mult_distrib)
   6.104 +by (simp add: mult_commute [of k] mod_mult_distrib)
   6.105  
   6.106  (* a simple rearrangement of mod_div_equality: *)
   6.107  lemma mult_div_cancel: "(n::nat) * (m div n) = m - (m mod n)"
   6.108 -  by (cut_tac a = m and b = n in mod_div_equality2, arith)
   6.109 +by (cut_tac a = m and b = n in mod_div_equality2, arith)
   6.110  
   6.111  lemma mod_le_divisor[simp]: "0 < n \<Longrightarrow> m mod n \<le> (n::nat)"
   6.112    apply (drule mod_less_divisor [where m = m])
   6.113 @@ -630,7 +630,7 @@
   6.114  lemma divmod_rel_mult1_eq:
   6.115    "[| divmod_rel b c q r; c > 0 |]
   6.116     ==> divmod_rel (a*b) c (a*q + a*r div c) (a*r mod c)"
   6.117 -by (auto simp add: split_ifs mult_ac divmod_rel_def add_mult_distrib2)
   6.118 +by (auto simp add: split_ifs divmod_rel_def algebra_simps)
   6.119  
   6.120  lemma div_mult1_eq: "(a*b) div c = a*(b div c) + a*(b mod c) div (c::nat)"
   6.121  apply (cases "c = 0", simp)
   6.122 @@ -638,19 +638,19 @@
   6.123  done
   6.124  
   6.125  lemma mod_mult1_eq: "(a*b) mod c = a*(b mod c) mod (c::nat)"
   6.126 -  by (rule mod_mult_right_eq)
   6.127 +by (rule mod_mult_right_eq)
   6.128  
   6.129  lemma mod_mult1_eq': "(a*b) mod (c::nat) = ((a mod c) * b) mod c"
   6.130 -  by (rule mod_mult_left_eq)
   6.131 +by (rule mod_mult_left_eq)
   6.132  
   6.133  lemma mod_mult_distrib_mod:
   6.134    "(a*b) mod (c::nat) = ((a mod c) * (b mod c)) mod c"
   6.135 -  by (rule mod_mult_eq)
   6.136 +by (rule mod_mult_eq)
   6.137  
   6.138  lemma divmod_rel_add1_eq:
   6.139    "[| divmod_rel a c aq ar; divmod_rel b c bq br;  c > 0 |]
   6.140     ==> divmod_rel (a + b) c (aq + bq + (ar+br) div c) ((ar + br) mod c)"
   6.141 -by (auto simp add: split_ifs mult_ac divmod_rel_def add_mult_distrib2)
   6.142 +by (auto simp add: split_ifs divmod_rel_def algebra_simps)
   6.143  
   6.144  (*NOT suitable for rewriting: the RHS has an instance of the LHS*)
   6.145  lemma div_add1_eq:
   6.146 @@ -660,7 +660,7 @@
   6.147  done
   6.148  
   6.149  lemma mod_add1_eq: "(a+b) mod (c::nat) = (a mod c + b mod c) mod c"
   6.150 -  by (rule mod_add_eq)
   6.151 +by (rule mod_add_eq)
   6.152  
   6.153  lemma mod_lemma: "[| (0::nat) < c; r < b |] ==> b * (q mod c) + r < b * c"
   6.154    apply (cut_tac m = q and n = c in mod_less_divisor)
   6.155 @@ -671,7 +671,7 @@
   6.156  
   6.157  lemma divmod_rel_mult2_eq: "[| divmod_rel a b q r;  0 < b;  0 < c |]
   6.158        ==> divmod_rel a (b*c) (q div c) (b*(q mod c) + r)"
   6.159 -  by (auto simp add: mult_ac divmod_rel_def add_mult_distrib2 [symmetric] mod_lemma)
   6.160 +by (auto simp add: mult_ac divmod_rel_def add_mult_distrib2 [symmetric] mod_lemma)
   6.161  
   6.162  lemma div_mult2_eq: "a div (b*c) = (a div b) div (c::nat)"
   6.163    apply (cases "b = 0", simp)
   6.164 @@ -690,7 +690,7 @@
   6.165  
   6.166  lemma div_mult_mult_lemma:
   6.167      "[| (0::nat) < b;  0 < c |] ==> (c*a) div (c*b) = a div b"
   6.168 -  by (auto simp add: div_mult2_eq)
   6.169 +by (auto simp add: div_mult2_eq)
   6.170  
   6.171  lemma div_mult_mult1 [simp]: "(0::nat) < c ==> (c*a) div (c*b) = a div b"
   6.172    apply (cases "b = 0")
   6.173 @@ -706,7 +706,7 @@
   6.174  subsubsection{*Further Facts about Quotient and Remainder*}
   6.175  
   6.176  lemma div_1 [simp]: "m div Suc 0 = m"
   6.177 -  by (induct m) (simp_all add: div_geq)
   6.178 +by (induct m) (simp_all add: div_geq)
   6.179  
   6.180  
   6.181  (* Monotonicity of div in first argument *)
   6.182 @@ -780,10 +780,10 @@
   6.183  done
   6.184  
   6.185  lemma nat_mod_div_trivial: "m mod n div n = (0 :: nat)"
   6.186 -  by simp
   6.187 +by simp
   6.188  
   6.189  lemma nat_mod_mod_trivial: "m mod n mod n = (m mod n :: nat)"
   6.190 -  by simp
   6.191 +by simp
   6.192  
   6.193  
   6.194  subsubsection {* The Divides Relation *}
   6.195 @@ -792,7 +792,7 @@
   6.196    unfolding dvd_def by simp
   6.197  
   6.198  lemma dvd_1_iff_1 [simp]: "(m dvd Suc 0) = (m = Suc 0)"
   6.199 -  by (simp add: dvd_def)
   6.200 +by (simp add: dvd_def)
   6.201  
   6.202  lemma dvd_anti_sym: "[| m dvd n; n dvd m |] ==> m = (n::nat)"
   6.203    unfolding dvd_def
   6.204 @@ -813,7 +813,7 @@
   6.205    done
   6.206  
   6.207  lemma dvd_diffD1: "[| k dvd m-n; k dvd m; n\<le>m |] ==> k dvd (n::nat)"
   6.208 -  by (drule_tac m = m in dvd_diff, auto)
   6.209 +by (drule_tac m = m in dvd_diff, auto)
   6.210  
   6.211  lemma dvd_reduce: "(k dvd n + k) = (k dvd (n::nat))"
   6.212    apply (rule iffI)
   6.213 @@ -839,7 +839,7 @@
   6.214    done
   6.215  
   6.216  lemma dvd_mod_iff: "k dvd n ==> ((k::nat) dvd m mod n) = (k dvd m)"
   6.217 -  by (blast intro: dvd_mod_imp_dvd dvd_mod)
   6.218 +by (blast intro: dvd_mod_imp_dvd dvd_mod)
   6.219  
   6.220  lemma dvd_mult_cancel: "!!k::nat. [| k*m dvd k*n; 0<k |] ==> m dvd n"
   6.221    unfolding dvd_def
   6.222 @@ -894,7 +894,7 @@
   6.223    done
   6.224  
   6.225  lemma mod_eq_0_iff: "(m mod d = 0) = (\<exists>q::nat. m = d*q)"
   6.226 -  by (auto simp add: dvd_eq_mod_eq_0 [symmetric] dvd_def)
   6.227 +by (auto simp add: dvd_eq_mod_eq_0 [symmetric] dvd_def)
   6.228  
   6.229  lemmas mod_eq_0D [dest!] = mod_eq_0_iff [THEN iffD1]
   6.230  
     7.1 --- a/src/HOL/Finite_Set.thy	Sun Jan 18 13:58:17 2009 +0100
     7.2 +++ b/src/HOL/Finite_Set.thy	Wed Jan 28 16:29:16 2009 +0100
     7.3 @@ -1033,12 +1033,12 @@
     7.4  lemma setsum_Un_nat: "finite A ==> finite B ==>
     7.5    (setsum f (A Un B) :: nat) = setsum f A + setsum f B - setsum f (A Int B)"
     7.6    -- {* For the natural numbers, we have subtraction. *}
     7.7 -by (subst setsum_Un_Int [symmetric], auto simp add: ring_simps)
     7.8 +by (subst setsum_Un_Int [symmetric], auto simp add: algebra_simps)
     7.9  
    7.10  lemma setsum_Un: "finite A ==> finite B ==>
    7.11    (setsum f (A Un B) :: 'a :: ab_group_add) =
    7.12     setsum f A + setsum f B - setsum f (A Int B)"
    7.13 -by (subst setsum_Un_Int [symmetric], auto simp add: ring_simps)
    7.14 +by (subst setsum_Un_Int [symmetric], auto simp add: algebra_simps)
    7.15  
    7.16  lemma setsum_diff1_nat: "(setsum f (A - {a}) :: nat) =
    7.17    (if a:A then setsum f A - f a else setsum f A)"
    7.18 @@ -1711,7 +1711,7 @@
    7.19  lemma setsum_constant [simp]: "(\<Sum>x \<in> A. y) = of_nat(card A) * y"
    7.20  apply (cases "finite A")
    7.21  apply (erule finite_induct)
    7.22 -apply (auto simp add: ring_simps)
    7.23 +apply (auto simp add: algebra_simps)
    7.24  done
    7.25  
    7.26  lemma setprod_constant: "finite A ==> (\<Prod>x\<in> A. (y::'a::{recpower, comm_monoid_mult})) = y^(card A)"
    7.27 @@ -2220,16 +2220,16 @@
    7.28      thus ?case
    7.29      proof
    7.30        assume "a = x" thus ?thesis using insert
    7.31 -        by (simp add: mult_ac_idem)
    7.32 +        by (simp add: mult_ac)
    7.33      next
    7.34        assume "a \<in> F"
    7.35        hence bel: "fold1 inf F \<le> a" by (rule insert)
    7.36        have "inf (fold1 inf (insert x F)) a = inf x (inf (fold1 inf F) a)"
    7.37 -        using insert by (simp add: mult_ac_idem)
    7.38 +        using insert by (simp add: mult_ac)
    7.39        also have "inf (fold1 inf F) a = fold1 inf F"
    7.40          using bel by (auto intro: antisym)
    7.41        also have "inf x \<dots> = fold1 inf (insert x F)"
    7.42 -        using insert by (simp add: mult_ac_idem)
    7.43 +        using insert by (simp add: mult_ac)
    7.44        finally have aux: "inf (fold1 inf (insert x F)) a = fold1 inf (insert x F)" .
    7.45        moreover have "inf (fold1 inf (insert x F)) a \<le> a" by simp
    7.46        ultimately show ?thesis by simp
     8.1 --- a/src/HOL/Fundamental_Theorem_Algebra.thy	Sun Jan 18 13:58:17 2009 +0100
     8.2 +++ b/src/HOL/Fundamental_Theorem_Algebra.thy	Wed Jan 28 16:29:16 2009 +0100
     8.3 @@ -45,7 +45,7 @@
     8.4      have th2: "2 *(y * sqrt ((sqrt (x * x + y * y) - x) * (sqrt (x * x + y * y) + x) / 4)) / \<bar>y\<bar> = y"
     8.5        using iffD2[OF real_sqrt_pow2_iff sum_power2_ge_zero[of x y]] y0
     8.6        unfolding power2_eq_square 
     8.7 -      by (simp add: ring_simps real_sqrt_divide sqrt4)
     8.8 +      by (simp add: algebra_simps real_sqrt_divide sqrt4)
     8.9       from y0 xy have ?thesis  apply (simp add: csqrt_def power2_eq_square)
    8.10         apply (simp add: real_sqrt_sum_squares_mult_ge_zero[of x y] real_sqrt_pow2[OF th(1)[of x y], unfolded power2_eq_square] real_sqrt_pow2[OF th(2)[of x y], unfolded power2_eq_square] real_sqrt_mult[symmetric])
    8.11        using th1 th2  ..}
    8.12 @@ -109,7 +109,7 @@
    8.13  lemma poly_offset_poly: "poly (offset_poly p h) x = poly p (h + x)"
    8.14  apply (induct p)
    8.15  apply (simp add: offset_poly_0)
    8.16 -apply (simp add: offset_poly_pCons ring_simps)
    8.17 +apply (simp add: offset_poly_pCons algebra_simps)
    8.18  done
    8.19  
    8.20  lemma offset_poly_eq_0_lemma: "smult c p + pCons a p = 0 \<Longrightarrow> p = 0"
    8.21 @@ -350,7 +350,7 @@
    8.22    from md z have xy: "x^2 + y^2 = 1" by (simp add: cmod_def)
    8.23    {assume C: "cmod (z + 1) \<ge> 1" "cmod (z - 1) \<ge> 1" "cmod (z + ii) \<ge> 1" "cmod (z - ii) \<ge> 1"
    8.24      from C z xy have "2*x \<le> 1" "2*x \<ge> -1" "2*y \<le> 1" "2*y \<ge> -1"
    8.25 -      by (simp_all add: cmod_def power2_eq_square ring_simps)
    8.26 +      by (simp_all add: cmod_def power2_eq_square algebra_simps)
    8.27      hence "abs (2*x) \<le> 1" "abs (2*y) \<le> 1" by simp_all
    8.28      hence "(abs (2 * x))^2 <= 1^2" "(abs (2 * y)) ^2 <= 1^2"
    8.29        by - (rule power_mono, simp, simp)+
    8.30 @@ -391,9 +391,9 @@
    8.31      1" 
    8.32        apply (simp add: power2_eq_square norm_mult[symmetric] norm_inverse[symmetric])
    8.33        using right_inverse[OF b']
    8.34 -      by (simp add: power2_eq_square[symmetric] power_inverse[symmetric] ring_simps)
    8.35 +      by (simp add: power2_eq_square[symmetric] power_inverse[symmetric] algebra_simps)
    8.36      have th0: "cmod (complex_of_real (cmod b) / b) = 1"
    8.37 -      apply (simp add: complex_Re_mult cmod_def power2_eq_square Re_complex_of_real Im_complex_of_real divide_inverse ring_simps )
    8.38 +      apply (simp add: complex_Re_mult cmod_def power2_eq_square Re_complex_of_real Im_complex_of_real divide_inverse algebra_simps )
    8.39        by (simp add: real_sqrt_mult[symmetric] th0)        
    8.40      from o have "\<exists>m. n = Suc (2*m)" by presburger+
    8.41      then obtain m where m: "n = Suc (2*m)" by blast
    8.42 @@ -667,10 +667,10 @@
    8.43        from h have z1: "cmod z \<ge> 1" by arith
    8.44        from order_trans[OF th0 mult_right_mono[OF z1 norm_ge_zero[of "poly (pCons c cs) z"]]]
    8.45        have th1: "d \<le> cmod(z * poly (pCons c cs) z) - cmod a"
    8.46 -	unfolding norm_mult by (simp add: ring_simps)
    8.47 +	unfolding norm_mult by (simp add: algebra_simps)
    8.48        from complex_mod_triangle_sub[of "z * poly (pCons c cs) z" a]
    8.49        have th2: "cmod(z * poly (pCons c cs) z) - cmod a \<le> cmod (poly (pCons a (pCons c cs)) z)" 
    8.50 -	by (simp add: diff_le_eq ring_simps) 
    8.51 +	by (simp add: diff_le_eq algebra_simps) 
    8.52        from th1 th2 have "d \<le> cmod (poly (pCons a (pCons c cs)) z)"  by arith}
    8.53      hence ?case by blast}
    8.54    moreover
    8.55 @@ -685,7 +685,7 @@
    8.56        have ath: "\<And>mzh mazh ma. mzh <= mazh + ma ==> abs(d) + ma <= mzh ==> d <= mazh" by arith
    8.57        from complex_mod_triangle_sub[of "z*c" a ]
    8.58        have th1: "cmod (z * c) \<le> cmod (a + z * c) + cmod a"
    8.59 -	by (simp add: ring_simps)
    8.60 +	by (simp add: algebra_simps)
    8.61        from ath[OF th1 th0] have "d \<le> cmod (poly (pCons a (pCons c cs)) z)" 
    8.62          using cs0' by simp}
    8.63      then have ?case  by blast}
    8.64 @@ -850,7 +850,7 @@
    8.65        with kas(3) lgqr[symmetric] q(1) n[symmetric] have s0:"s=0" by auto
    8.66        {fix w
    8.67  	have "cmod (poly ?r w) = cmod (1 + a * w ^ k)" 
    8.68 -	  using kas(4)[rule_format, of w] s0 r01 by (simp add: ring_simps)}
    8.69 +	  using kas(4)[rule_format, of w] s0 r01 by (simp add: algebra_simps)}
    8.70        note hth = this [symmetric]
    8.71  	from reduce_poly_simple[OF kas(1,2)] 
    8.72        have "\<exists>w. cmod (poly ?r w) < 1" unfolding hth by blast}
    8.73 @@ -866,7 +866,7 @@
    8.74        from H[rule_format, OF k1n th01 th02]
    8.75        obtain w where w: "1 + w^k * a = 0"
    8.76  	unfolding poly_pCons poly_monom
    8.77 -	using kas(2) by (cases k, auto simp add: ring_simps)
    8.78 +	using kas(2) by (cases k, auto simp add: algebra_simps)
    8.79        from poly_bound_exists[of "cmod w" s] obtain m where 
    8.80  	m: "m > 0" "\<forall>z. cmod z \<le> cmod w \<longrightarrow> cmod (poly s z) \<le> m" by blast
    8.81        have w0: "w\<noteq>0" using kas(2) w by (auto simp add: power_0_left)
    8.82 @@ -879,7 +879,7 @@
    8.83  	t: "t > 0" "t < 1" "t < inverse (cmod w ^ (k + 1) * m)" by blast
    8.84        let ?ct = "complex_of_real t"
    8.85        let ?w = "?ct * w"
    8.86 -      have "1 + ?w^k * (a + ?w * poly s ?w) = 1 + ?ct^k * (w^k * a) + ?w^k * ?w * poly s ?w" using kas(1) by (simp add: ring_simps power_mult_distrib)
    8.87 +      have "1 + ?w^k * (a + ?w * poly s ?w) = 1 + ?ct^k * (w^k * a) + ?w^k * ?w * poly s ?w" using kas(1) by (simp add: algebra_simps power_mult_distrib)
    8.88        also have "\<dots> = complex_of_real (1 - t^k) + ?w^k * ?w * poly s ?w"
    8.89  	unfolding wm1 by (simp)
    8.90        finally have "cmod (1 + ?w^k * (a + ?w * poly s ?w)) = cmod (complex_of_real (1 - t^k) + ?w^k * ?w * poly s ?w)" 
    8.91 @@ -898,7 +898,7 @@
    8.92        have th30: "t^k * (t* (cmod w ^ (k + 1) * m)) < t^k * 1" 
    8.93  	apply - apply (rule mult_strict_left_mono) by simp_all
    8.94        have "cmod (?w^k * ?w * poly s ?w) = t^k * (t* (cmod w ^ (k+1) * cmod (poly s ?w)))"  using w0 t(1)
    8.95 -	by (simp add: ring_simps power_mult_distrib norm_of_real norm_power norm_mult)
    8.96 +	by (simp add: algebra_simps power_mult_distrib norm_of_real norm_power norm_mult)
    8.97        then have "cmod (?w^k * ?w * poly s ?w) \<le> t^k * (t* (cmod w ^ (k + 1) * m))"
    8.98  	using t(1,2) m(2)[rule_format, OF tw] w0
    8.99  	apply (simp only: )
   8.100 @@ -1308,14 +1308,14 @@
   8.101    {assume l: ?lhs
   8.102      then obtain u where u: "q = p * u" ..
   8.103       have "r = p * (smult a u - t)"
   8.104 -       using u qrp' [symmetric] t by (simp add: ring_simps mult_smult_right)
   8.105 +       using u qrp' [symmetric] t by (simp add: algebra_simps mult_smult_right)
   8.106       then have ?rhs ..}
   8.107    moreover
   8.108    {assume r: ?rhs
   8.109      then obtain u where u: "r = p * u" ..
   8.110      from u [symmetric] t qrp' [symmetric] a0
   8.111      have "q = p * smult (1/a) (u + t)"
   8.112 -      by (simp add: ring_simps mult_smult_right smult_smult)
   8.113 +      by (simp add: algebra_simps mult_smult_right smult_smult)
   8.114      hence ?lhs ..}
   8.115    ultimately have "?lhs = ?rhs" by blast }
   8.116  thus "?lhs \<equiv> ?rhs"  by - (atomize(full), blast) 
     9.1 --- a/src/HOL/Groebner_Basis.thy	Sun Jan 18 13:58:17 2009 +0100
     9.2 +++ b/src/HOL/Groebner_Basis.thy	Wed Jan 28 16:29:16 2009 +0100
     9.3 @@ -165,7 +165,7 @@
     9.4  
     9.5  interpretation class_semiring!: gb_semiring
     9.6      "op +" "op *" "op ^" "0::'a::{comm_semiring_1, recpower}" "1"
     9.7 -  proof qed (auto simp add: ring_simps power_Suc)
     9.8 +  proof qed (auto simp add: algebra_simps power_Suc)
     9.9  
    9.10  lemmas nat_arith =
    9.11    add_nat_number_of
    9.12 @@ -345,13 +345,13 @@
    9.13  
    9.14  interpretation class_ringb!: ringb
    9.15    "op +" "op *" "op ^" "0::'a::{idom,recpower,number_ring}" "1" "op -" "uminus"
    9.16 -proof(unfold_locales, simp add: ring_simps power_Suc, auto)
    9.17 +proof(unfold_locales, simp add: algebra_simps power_Suc, auto)
    9.18    fix w x y z ::"'a::{idom,recpower,number_ring}"
    9.19    assume p: "w * y + x * z = w * z + x * y" and ynz: "y \<noteq> z"
    9.20    hence ynz': "y - z \<noteq> 0" by simp
    9.21    from p have "w * y + x* z - w*z - x*y = 0" by simp
    9.22 -  hence "w* (y - z) - x * (y - z) = 0" by (simp add: ring_simps)
    9.23 -  hence "(y - z) * (w - x) = 0" by (simp add: ring_simps)
    9.24 +  hence "w* (y - z) - x * (y - z) = 0" by (simp add: algebra_simps)
    9.25 +  hence "(y - z) * (w - x) = 0" by (simp add: algebra_simps)
    9.26    with  no_zero_divirors_neq0 [OF ynz']
    9.27    have "w - x = 0" by blast
    9.28    thus "w = x"  by simp
    9.29 @@ -361,20 +361,20 @@
    9.30  
    9.31  interpretation natgb!: semiringb
    9.32    "op +" "op *" "op ^" "0::nat" "1"
    9.33 -proof (unfold_locales, simp add: ring_simps power_Suc)
    9.34 +proof (unfold_locales, simp add: algebra_simps power_Suc)
    9.35    fix w x y z ::"nat"
    9.36    { assume p: "w * y + x * z = w * z + x * y" and ynz: "y \<noteq> z"
    9.37      hence "y < z \<or> y > z" by arith
    9.38      moreover {
    9.39        assume lt:"y <z" hence "\<exists>k. z = y + k \<and> k > 0" by (rule_tac x="z - y" in exI, auto)
    9.40        then obtain k where kp: "k>0" and yz:"z = y + k" by blast
    9.41 -      from p have "(w * y + x *y) + x*k = (w * y + x*y) + w*k" by (simp add: yz ring_simps)
    9.42 +      from p have "(w * y + x *y) + x*k = (w * y + x*y) + w*k" by (simp add: yz algebra_simps)
    9.43        hence "x*k = w*k" by simp
    9.44        hence "w = x" using kp by (simp add: mult_cancel2) }
    9.45      moreover {
    9.46        assume lt: "y >z" hence "\<exists>k. y = z + k \<and> k>0" by (rule_tac x="y - z" in exI, auto)
    9.47        then obtain k where kp: "k>0" and yz:"y = z + k" by blast
    9.48 -      from p have "(w * z + x *z) + w*k = (w * z + x*z) + x*k" by (simp add: yz ring_simps)
    9.49 +      from p have "(w * z + x *z) + w*k = (w * z + x*z) + x*k" by (simp add: yz algebra_simps)
    9.50        hence "w*k = x*k" by simp
    9.51        hence "w = x" using kp by (simp add: mult_cancel2)}
    9.52      ultimately have "w=x" by blast }
    10.1 --- a/src/HOL/Int.thy	Sun Jan 18 13:58:17 2009 +0100
    10.2 +++ b/src/HOL/Int.thy	Wed Jan 28 16:29:16 2009 +0100
    10.3 @@ -157,13 +157,13 @@
    10.4    show "i - j = i + - j"
    10.5      by (simp add: diff_int_def)
    10.6    show "(i * j) * k = i * (j * k)"
    10.7 -    by (cases i, cases j, cases k) (simp add: mult ring_simps)
    10.8 +    by (cases i, cases j, cases k) (simp add: mult algebra_simps)
    10.9    show "i * j = j * i"
   10.10 -    by (cases i, cases j) (simp add: mult ring_simps)
   10.11 +    by (cases i, cases j) (simp add: mult algebra_simps)
   10.12    show "1 * i = i"
   10.13      by (cases i) (simp add: One_int_def mult)
   10.14    show "(i + j) * k = i * k + j * k"
   10.15 -    by (cases i, cases j, cases k) (simp add: add mult ring_simps)
   10.16 +    by (cases i, cases j, cases k) (simp add: add mult algebra_simps)
   10.17    show "0 \<noteq> (1::int)"
   10.18      by (simp add: Zero_int_def One_int_def)
   10.19  qed
   10.20 @@ -301,36 +301,35 @@
   10.21  lemma of_int: "of_int (Abs_Integ (intrel `` {(i,j)})) = of_nat i - of_nat j"
   10.22  proof -
   10.23    have "(\<lambda>(i,j). { of_nat i - (of_nat j :: 'a) }) respects intrel"
   10.24 -    by (simp add: congruent_def compare_rls of_nat_add [symmetric]
   10.25 +    by (simp add: congruent_def algebra_simps of_nat_add [symmetric]
   10.26              del: of_nat_add) 
   10.27    thus ?thesis
   10.28      by (simp add: of_int_def UN_equiv_class [OF equiv_intrel])
   10.29  qed
   10.30  
   10.31  lemma of_int_0 [simp]: "of_int 0 = 0"
   10.32 -  by (simp add: of_int Zero_int_def)
   10.33 +by (simp add: of_int Zero_int_def)
   10.34  
   10.35  lemma of_int_1 [simp]: "of_int 1 = 1"
   10.36 -  by (simp add: of_int One_int_def)
   10.37 +by (simp add: of_int One_int_def)
   10.38  
   10.39  lemma of_int_add [simp]: "of_int (w+z) = of_int w + of_int z"
   10.40 -  by (cases w, cases z, simp add: compare_rls of_int OrderedGroup.compare_rls add)
   10.41 +by (cases w, cases z, simp add: algebra_simps of_int add)
   10.42  
   10.43  lemma of_int_minus [simp]: "of_int (-z) = - (of_int z)"
   10.44 -  by (cases z, simp add: compare_rls of_int minus)
   10.45 +by (cases z, simp add: algebra_simps of_int minus)
   10.46  
   10.47  lemma of_int_diff [simp]: "of_int (w - z) = of_int w - of_int z"
   10.48 -  by (simp add: OrderedGroup.diff_minus diff_minus)
   10.49 +by (simp add: OrderedGroup.diff_minus diff_minus)
   10.50  
   10.51  lemma of_int_mult [simp]: "of_int (w*z) = of_int w * of_int z"
   10.52  apply (cases w, cases z)
   10.53 -apply (simp add: compare_rls of_int left_diff_distrib right_diff_distrib
   10.54 -                 mult add_ac of_nat_mult)
   10.55 +apply (simp add: algebra_simps of_int mult of_nat_mult)
   10.56  done
   10.57  
   10.58  text{*Collapse nested embeddings*}
   10.59  lemma of_int_of_nat_eq [simp]: "of_int (of_nat n) = of_nat n"
   10.60 -  by (induct n) auto
   10.61 +by (induct n) auto
   10.62  
   10.63  end
   10.64  
   10.65 @@ -339,7 +338,7 @@
   10.66  
   10.67  lemma of_int_le_iff [simp]:
   10.68    "of_int w \<le> of_int z \<longleftrightarrow> w \<le> z"
   10.69 -  by (cases w, cases z, simp add: of_int le minus compare_rls of_nat_add [symmetric] del: of_nat_add)
   10.70 +by (cases w, cases z, simp add: of_int le minus algebra_simps of_nat_add [symmetric] del: of_nat_add)
   10.71  
   10.72  text{*Special cases where either operand is zero*}
   10.73  lemmas of_int_0_le_iff [simp] = of_int_le_iff [of 0, simplified]
   10.74 @@ -511,7 +510,7 @@
   10.75    also have "\<dots> = (\<exists>n. z - w = of_nat n)"
   10.76      by (auto elim: zero_le_imp_eq_int)
   10.77    also have "\<dots> = (\<exists>n. z = w + of_nat n)"
   10.78 -    by (simp only: group_simps)
   10.79 +    by (simp only: algebra_simps)
   10.80    finally show ?thesis .
   10.81  qed
   10.82  
   10.83 @@ -829,7 +828,7 @@
   10.84  next
   10.85    case (neg n)
   10.86    thus ?thesis by (simp del: of_nat_Suc of_nat_add
   10.87 -    add: compare_rls of_nat_1 [symmetric] of_nat_add [symmetric])
   10.88 +    add: algebra_simps of_nat_1 [symmetric] of_nat_add [symmetric])
   10.89  qed
   10.90  
   10.91  lemma bin_less_0_simps:
   10.92 @@ -1067,16 +1066,16 @@
   10.93  lemma eq_number_of_eq:
   10.94    "((number_of x::'a::number_ring) = number_of y) =
   10.95     iszero (number_of (x + uminus y) :: 'a)"
   10.96 -  unfolding iszero_def number_of_add number_of_minus
   10.97 -  by (simp add: compare_rls)
   10.98 +unfolding iszero_def number_of_add number_of_minus
   10.99 +by (simp add: algebra_simps)
  10.100  
  10.101  lemma iszero_number_of_Pls:
  10.102    "iszero ((number_of Pls)::'a::number_ring)"
  10.103 -  unfolding iszero_def numeral_0_eq_0 ..
  10.104 +unfolding iszero_def numeral_0_eq_0 ..
  10.105  
  10.106  lemma nonzero_number_of_Min:
  10.107    "~ iszero ((number_of Min)::'a::number_ring)"
  10.108 -  unfolding iszero_def numeral_m1_eq_minus_1 by simp
  10.109 +unfolding iszero_def numeral_m1_eq_minus_1 by simp
  10.110  
  10.111  
  10.112  subsubsection {* Comparisons, for Ordered Rings *}
  10.113 @@ -1162,7 +1161,7 @@
  10.114  next
  10.115    case (neg n)
  10.116    thus ?thesis by (simp del: of_nat_Suc of_nat_add
  10.117 -    add: compare_rls of_nat_1 [symmetric] of_nat_add [symmetric])
  10.118 +    add: algebra_simps of_nat_1 [symmetric] of_nat_add [symmetric])
  10.119  qed
  10.120  
  10.121  text {* Less-Than or Equals *}
  10.122 @@ -1249,9 +1248,7 @@
  10.123  lemma add_number_of_diff2 [simp]:
  10.124    "number_of v + (c - number_of w) =
  10.125     number_of (v + uminus w) + (c::'a::number_ring)"
  10.126 -apply (subst diff_number_of_eq [symmetric])
  10.127 -apply (simp only: compare_rls)
  10.128 -done
  10.129 +by (simp add: algebra_simps diff_number_of_eq [symmetric])
  10.130  
  10.131  
  10.132  subsection {* The Set of Integers *}
    11.1 --- a/src/HOL/IntDiv.thy	Sun Jan 18 13:58:17 2009 +0100
    11.2 +++ b/src/HOL/IntDiv.thy	Wed Jan 28 16:29:16 2009 +0100
    11.3 @@ -831,12 +831,13 @@
    11.4  
    11.5  lemma zmult2_lemma_aux1: "[| (0::int) < c;  b < r;  r \<le> 0 |] ==> b*c < b*(q mod c) + r"
    11.6  apply (subgoal_tac "b * (c - q mod c) < r * 1")
    11.7 -apply (simp add: right_diff_distrib)
    11.8 + apply (simp add: algebra_simps)
    11.9  apply (rule order_le_less_trans)
   11.10 -apply (erule_tac [2] mult_strict_right_mono)
   11.11 -apply (rule mult_left_mono_neg)
   11.12 -apply (auto simp add: compare_rls add_commute [of 1]
   11.13 -                      add1_zle_eq pos_mod_bound)
   11.14 + apply (erule_tac [2] mult_strict_right_mono)
   11.15 + apply (rule mult_left_mono_neg)
   11.16 +  using add1_zle_eq[of "q mod c"]apply(simp add: algebra_simps pos_mod_bound)
   11.17 + apply (simp)
   11.18 +apply (simp)
   11.19  done
   11.20  
   11.21  lemma zmult2_lemma_aux2:
   11.22 @@ -854,12 +855,13 @@
   11.23  
   11.24  lemma zmult2_lemma_aux4: "[| (0::int) < c; 0 \<le> r; r < b |] ==> b * (q mod c) + r < b * c"
   11.25  apply (subgoal_tac "r * 1 < b * (c - q mod c) ")
   11.26 -apply (simp add: right_diff_distrib)
   11.27 + apply (simp add: right_diff_distrib)
   11.28  apply (rule order_less_le_trans)
   11.29 -apply (erule mult_strict_right_mono)
   11.30 -apply (rule_tac [2] mult_left_mono)
   11.31 -apply (auto simp add: compare_rls add_commute [of 1]
   11.32 -                      add1_zle_eq pos_mod_bound)
   11.33 + apply (erule mult_strict_right_mono)
   11.34 + apply (rule_tac [2] mult_left_mono)
   11.35 +  apply simp
   11.36 + using add1_zle_eq[of "q mod c"] apply (simp add: algebra_simps pos_mod_bound)
   11.37 +apply simp
   11.38  done
   11.39  
   11.40  lemma zmult2_lemma: "[| quorem ((a,b), (q,r));  b \<noteq> 0;  0 < c |]  
   11.41 @@ -1251,7 +1253,7 @@
   11.42  
   11.43  lemma zmult_div_cancel: "(n::int) * (m div n) = m - (m mod n)"
   11.44    using zmod_zdiv_equality[where a="m" and b="n"]
   11.45 -  by (simp add: ring_simps)
   11.46 +  by (simp add: algebra_simps)
   11.47  
   11.48  lemma zdvd_mult_div_cancel:"(n::int) dvd m \<Longrightarrow> n * (m div n) = m"
   11.49  apply (subgoal_tac "m mod n = 0")
    12.1 --- a/src/HOL/Library/Abstract_Rat.thy	Sun Jan 18 13:58:17 2009 +0100
    12.2 +++ b/src/HOL/Library/Abstract_Rat.thy	Wed Jan 28 16:29:16 2009 +0100
    12.3 @@ -240,7 +240,7 @@
    12.4      by (simp only: of_int_mult[symmetric] of_int_add [symmetric])
    12.5    then have "of_int x / of_int d = ?t / of_int d" 
    12.6      using cong[OF refl[of ?f] eq] by simp
    12.7 -  then show ?thesis by (simp add: add_divide_distrib ring_simps prems)
    12.8 +  then show ?thesis by (simp add: add_divide_distrib algebra_simps prems)
    12.9  qed
   12.10  
   12.11  lemma of_int_div: "(d::int) ~= 0 ==> d dvd n ==>
    13.1 --- a/src/HOL/Library/BigO.thy	Sun Jan 18 13:58:17 2009 +0100
    13.2 +++ b/src/HOL/Library/BigO.thy	Wed Jan 28 16:29:16 2009 +0100
    13.3 @@ -349,7 +349,7 @@
    13.4    apply (drule set_plus_imp_minus)
    13.5    apply (rule set_minus_imp_plus)
    13.6    apply (drule bigo_mult3 [where g = g and j = g])
    13.7 -  apply (auto simp add: ring_simps)
    13.8 +  apply (auto simp add: algebra_simps)
    13.9    done
   13.10  
   13.11  lemma bigo_mult5: "ALL x. f x ~= 0 ==>
   13.12 @@ -799,14 +799,14 @@
   13.13    apply simp
   13.14    apply (subst abs_of_nonneg)
   13.15    apply (drule_tac x = x in spec) back
   13.16 -  apply (simp add: compare_rls)
   13.17 +  apply (simp add: algebra_simps)
   13.18    apply (subst diff_minus)+
   13.19    apply (rule add_right_mono)
   13.20    apply (erule spec)
   13.21    apply (rule order_trans) 
   13.22    prefer 2
   13.23    apply (rule abs_ge_zero)
   13.24 -  apply (simp add: compare_rls)
   13.25 +  apply (simp add: algebra_simps)
   13.26    done
   13.27  
   13.28  lemma bigo_lesso3: "f =o g +o O(h) ==>
   13.29 @@ -823,7 +823,7 @@
   13.30    apply simp
   13.31    apply (subst abs_of_nonneg)
   13.32    apply (drule_tac x = x in spec) back
   13.33 -  apply (simp add: compare_rls)
   13.34 +  apply (simp add: algebra_simps)
   13.35    apply (subst diff_minus)+
   13.36    apply (rule add_left_mono)
   13.37    apply (rule le_imp_neg_le)
   13.38 @@ -831,7 +831,7 @@
   13.39    apply (rule order_trans) 
   13.40    prefer 2
   13.41    apply (rule abs_ge_zero)
   13.42 -  apply (simp add: compare_rls)
   13.43 +  apply (simp add: algebra_simps)
   13.44    done
   13.45  
   13.46  lemma bigo_lesso4: "f <o g =o O(k::'a=>'b::ordered_field) ==>
   13.47 @@ -844,7 +844,7 @@
   13.48    apply assumption
   13.49    apply (erule bigo_lesseq2) back
   13.50    apply (rule allI)
   13.51 -  apply (auto simp add: func_plus fun_diff_def compare_rls 
   13.52 +  apply (auto simp add: func_plus fun_diff_def algebra_simps
   13.53      split: split_max abs_split)
   13.54    done
   13.55  
   13.56 @@ -856,7 +856,7 @@
   13.57    apply (rule allI)
   13.58    apply (drule_tac x = x in spec)
   13.59    apply (subgoal_tac "abs(max (f x - g x) 0) = max (f x - g x) 0")
   13.60 -  apply (clarsimp simp add: compare_rls add_ac) 
   13.61 +  apply (clarsimp simp add: algebra_simps) 
   13.62    apply (rule abs_of_nonneg)
   13.63    apply (rule le_maxI2)
   13.64    done
    14.1 --- a/src/HOL/Library/Commutative_Ring.thy	Sun Jan 18 13:58:17 2009 +0100
    14.2 +++ b/src/HOL/Library/Commutative_Ring.thy	Wed Jan 28 16:29:16 2009 +0100
    14.3 @@ -173,11 +173,11 @@
    14.4  
    14.5  text {* mkPinj preserve semantics *}
    14.6  lemma mkPinj_ci: "Ipol l (mkPinj a B) = Ipol l (Pinj a B)"
    14.7 -  by (induct B) (auto simp add: mkPinj_def ring_simps)
    14.8 +  by (induct B) (auto simp add: mkPinj_def algebra_simps)
    14.9  
   14.10  text {* mkPX preserves semantics *}
   14.11  lemma mkPX_ci: "Ipol l (mkPX A b C) = Ipol l (PX A b C)"
   14.12 -  by (cases A) (auto simp add: mkPX_def mkPinj_ci power_add ring_simps)
   14.13 +  by (cases A) (auto simp add: mkPX_def mkPinj_ci power_add algebra_simps)
   14.14  
   14.15  text {* Correctness theorems for the implemented operations *}
   14.16  
   14.17 @@ -192,13 +192,13 @@
   14.18    show ?case
   14.19    proof (rule linorder_cases)
   14.20      assume "x < y"
   14.21 -    with 6 show ?case by (simp add: mkPinj_ci ring_simps)
   14.22 +    with 6 show ?case by (simp add: mkPinj_ci algebra_simps)
   14.23    next
   14.24      assume "x = y"
   14.25      with 6 show ?case by (simp add: mkPinj_ci)
   14.26    next
   14.27      assume "x > y"
   14.28 -    with 6 show ?case by (simp add: mkPinj_ci ring_simps)
   14.29 +    with 6 show ?case by (simp add: mkPinj_ci algebra_simps)
   14.30    qed
   14.31  next
   14.32    case (7 x P Q y R)
   14.33 @@ -206,7 +206,7 @@
   14.34    moreover
   14.35    { assume "x = 0" with 7 have ?case by simp }
   14.36    moreover
   14.37 -  { assume "x = 1" with 7 have ?case by (simp add: ring_simps) }
   14.38 +  { assume "x = 1" with 7 have ?case by (simp add: algebra_simps) }
   14.39    moreover
   14.40    { assume "x > 1" from 7 have ?case by (cases x) simp_all }
   14.41    ultimately show ?case by blast
   14.42 @@ -225,20 +225,20 @@
   14.43    show ?case
   14.44    proof (rule linorder_cases)
   14.45      assume a: "x < y" hence "EX d. d + x = y" by arith
   14.46 -    with 9 a show ?case by (auto simp add: mkPX_ci power_add ring_simps)
   14.47 +    with 9 a show ?case by (auto simp add: mkPX_ci power_add algebra_simps)
   14.48    next
   14.49      assume a: "y < x" hence "EX d. d + y = x" by arith
   14.50 -    with 9 a show ?case by (auto simp add: power_add mkPX_ci ring_simps)
   14.51 +    with 9 a show ?case by (auto simp add: power_add mkPX_ci algebra_simps)
   14.52    next
   14.53      assume "x = y"
   14.54 -    with 9 show ?case by (simp add: mkPX_ci ring_simps)
   14.55 +    with 9 show ?case by (simp add: mkPX_ci algebra_simps)
   14.56    qed
   14.57 -qed (auto simp add: ring_simps)
   14.58 +qed (auto simp add: algebra_simps)
   14.59  
   14.60  text {* Multiplication *}
   14.61  lemma mul_ci: "Ipol l (P \<otimes> Q) = Ipol l P * Ipol l Q"
   14.62    by (induct P Q arbitrary: l rule: mul.induct)
   14.63 -    (simp_all add: mkPX_ci mkPinj_ci ring_simps add_ci power_add)
   14.64 +    (simp_all add: mkPX_ci mkPinj_ci algebra_simps add_ci power_add)
   14.65  
   14.66  text {* Substraction *}
   14.67  lemma sub_ci: "Ipol l (P \<ominus> Q) = Ipol l P - Ipol l Q"
   14.68 @@ -247,7 +247,7 @@
   14.69  text {* Square *}
   14.70  lemma sqr_ci: "Ipol ls (sqr P) = Ipol ls P * Ipol ls P"
   14.71    by (induct P arbitrary: ls)
   14.72 -    (simp_all add: add_ci mkPinj_ci mkPX_ci mul_ci ring_simps power_add)
   14.73 +    (simp_all add: add_ci mkPinj_ci mkPX_ci mul_ci algebra_simps power_add)
   14.74  
   14.75  text {* Power *}
   14.76  lemma even_pow:"even n \<Longrightarrow> pow n P = pow (n div 2) (sqr P)"
    15.1 --- a/src/HOL/Library/Float.thy	Sun Jan 18 13:58:17 2009 +0100
    15.2 +++ b/src/HOL/Library/Float.thy	Wed Jan 28 16:29:16 2009 +0100
    15.3 @@ -38,7 +38,7 @@
    15.4    show ?thesis
    15.5    proof (induct a)
    15.6      case (1 n)
    15.7 -    from pos show ?case by (simp add: ring_simps)
    15.8 +    from pos show ?case by (simp add: algebra_simps)
    15.9    next
   15.10      case (2 n)
   15.11      show ?case
   15.12 @@ -59,7 +59,7 @@
   15.13      show ?case by simp
   15.14    next
   15.15      case (Suc m)
   15.16 -    show ?case by (auto simp add: ring_simps pow2_add1 prems)
   15.17 +    show ?case by (auto simp add: algebra_simps pow2_add1 prems)
   15.18    qed
   15.19  next
   15.20    case (2 n)
   15.21 @@ -72,7 +72,7 @@
   15.22        apply (subst pow2_neg[of "-1"])
   15.23        apply (simp)
   15.24        apply (insert pow2_add1[of "-a"])
   15.25 -      apply (simp add: ring_simps)
   15.26 +      apply (simp add: algebra_simps)
   15.27        apply (subst pow2_neg[of "-a"])
   15.28        apply (simp)
   15.29        done
   15.30 @@ -83,7 +83,7 @@
   15.31        apply (auto)
   15.32        apply (subst pow2_neg[of "a + (-2 - int m)"])
   15.33        apply (subst pow2_neg[of "-2 - int m"])
   15.34 -      apply (auto simp add: ring_simps)
   15.35 +      apply (auto simp add: algebra_simps)
   15.36        apply (subst a)
   15.37        apply (subst b)
   15.38        apply (simp only: pow2_add1)
   15.39 @@ -91,13 +91,13 @@
   15.40        apply (subst pow2_neg[of "int m + 1"])
   15.41        apply auto
   15.42        apply (insert prems)
   15.43 -      apply (auto simp add: ring_simps)
   15.44 +      apply (auto simp add: algebra_simps)
   15.45        done
   15.46    qed
   15.47  qed
   15.48  
   15.49  lemma "float (a, e) + float (b, e) = float (a + b, e)"
   15.50 -by (simp add: float_def ring_simps)
   15.51 +by (simp add: float_def algebra_simps)
   15.52  
   15.53  definition
   15.54    int_of_real :: "real \<Rightarrow> int" where
   15.55 @@ -254,7 +254,7 @@
   15.56  
   15.57  lemma float_transfer_even: "even a \<Longrightarrow> float (a, b) = float (a div 2, b+1)"
   15.58    apply (subst float_transfer[where a="a" and b="b" and c="-1", simplified])
   15.59 -  apply (simp_all add: pow2_def even_def real_is_int_def ring_simps)
   15.60 +  apply (simp_all add: pow2_def even_def real_is_int_def algebra_simps)
   15.61    apply (auto)
   15.62  proof -
   15.63    fix q::int
   15.64 @@ -319,7 +319,7 @@
   15.65    "float (a1, e1) + float (a2, e2) =
   15.66    (if e1<=e2 then float (a1+a2*2^(nat(e2-e1)), e1)
   15.67    else float (a1*2^(nat (e1-e2))+a2, e2))"
   15.68 -  apply (simp add: float_def ring_simps)
   15.69 +  apply (simp add: float_def algebra_simps)
   15.70    apply (auto simp add: pow2_int[symmetric] pow2_add[symmetric])
   15.71    done
   15.72  
    16.1 --- a/src/HOL/Library/Nat_Infinity.thy	Sun Jan 18 13:58:17 2009 +0100
    16.2 +++ b/src/HOL/Library/Nat_Infinity.thy	Wed Jan 28 16:29:16 2009 +0100
    16.3 @@ -223,10 +223,10 @@
    16.4  end
    16.5  
    16.6  lemma mult_iSuc: "iSuc m * n = n + m * n"
    16.7 -  unfolding iSuc_plus_1 by (simp add: ring_simps)
    16.8 +  unfolding iSuc_plus_1 by (simp add: algebra_simps)
    16.9  
   16.10  lemma mult_iSuc_right: "m * iSuc n = m + m * n"
   16.11 -  unfolding iSuc_plus_1 by (simp add: ring_simps)
   16.12 +  unfolding iSuc_plus_1 by (simp add: algebra_simps)
   16.13  
   16.14  lemma of_nat_eq_Fin: "of_nat n = Fin n"
   16.15    apply (induct n)
    17.1 --- a/src/HOL/Library/Pocklington.thy	Sun Jan 18 13:58:17 2009 +0100
    17.2 +++ b/src/HOL/Library/Pocklington.thy	Wed Jan 28 16:29:16 2009 +0100
    17.3 @@ -254,7 +254,7 @@
    17.4    apply (simp add: nat_mod)
    17.5    apply (rule_tac x="q" in exI)
    17.6    apply (rule_tac x="q + q" in exI)
    17.7 -  by (auto simp: ring_simps)
    17.8 +  by (auto simp: algebra_simps)
    17.9  
   17.10  lemma cong_to_1: "[a = 1] (mod n) \<longleftrightarrow> a = 0 \<and> n = 1 \<or> (\<exists>m. a = 1 + m * n)"
   17.11  proof-
   17.12 @@ -780,7 +780,7 @@
   17.13  	of "(n - 1) div m * m"]
   17.14        have yn: "coprime ?y n" by (simp add: coprime_commute) 
   17.15        have "?y mod n = (a^m)^((n - 1) div m) mod n" 
   17.16 -	by (simp add: ring_simps power_mult)
   17.17 +	by (simp add: algebra_simps power_mult)
   17.18        also have "\<dots> = (a^m mod n)^((n - 1) div m) mod n" 
   17.19  	using power_mod[of "a^m" n "(n - 1) div m"] by simp
   17.20        also have "\<dots> = 1" using m(3)[unfolded modeq_def onen] onen 
   17.21 @@ -1239,7 +1239,7 @@
   17.22    from bqn psp qrn
   17.23    have bqn: "a ^ (n - 1) mod n = 1"
   17.24      and psp: "list_all (\<lambda>p. prime p \<and> coprime (a^(r *(q div p)) mod n - 1) n) ps"  unfolding arnb[symmetric] power_mod 
   17.25 -    by (simp_all add: power_mult[symmetric] ring_simps)
   17.26 +    by (simp_all add: power_mult[symmetric] algebra_simps)
   17.27    from n  have n0: "n > 0" by arith
   17.28    from mod_div_equality[of "a^(n - 1)" n]
   17.29      mod_less_divisor[OF n0, of "a^(n - 1)"]
   17.30 @@ -1248,7 +1248,7 @@
   17.31      apply -
   17.32      apply (rule exI[where x="0"])
   17.33      apply (rule exI[where x="a^(n - 1) div n"])
   17.34 -    by (simp add: ring_simps)
   17.35 +    by (simp add: algebra_simps)
   17.36    {fix p assume p: "prime p" "p dvd q"
   17.37      from psp psq have pfpsq: "primefact ps q"
   17.38        by (auto simp add: primefact_variant list_all_iff)
    18.1 --- a/src/HOL/Library/Primes.thy	Sun Jan 18 13:58:17 2009 +0100
    18.2 +++ b/src/HOL/Library/Primes.thy	Wed Jan 28 16:29:16 2009 +0100
    18.3 @@ -204,7 +204,7 @@
    18.4      from z have z': "?g > 0" by simp
    18.5      from bezout_gcd_strong[OF az, of b] 
    18.6      obtain x y where xy: "a*x = b*y + ?g" by blast
    18.7 -    from xy a b have "?g * a'*x = ?g * (b'*y + 1)" by (simp add: ring_simps)
    18.8 +    from xy a b have "?g * a'*x = ?g * (b'*y + 1)" by (simp add: algebra_simps)
    18.9      hence "?g * (a'*x) = ?g * (b'*y + 1)" by (simp add: mult_assoc)
   18.10      hence "a'*x = (b'*y + 1)"
   18.11        by (simp only: nat_mult_eq_cancel1[OF z']) 
    19.1 --- a/src/HOL/Library/SetsAndFunctions.thy	Sun Jan 18 13:58:17 2009 +0100
    19.2 +++ b/src/HOL/Library/SetsAndFunctions.thy	Wed Jan 28 16:29:16 2009 +0100
    19.3 @@ -101,8 +101,8 @@
    19.4  
    19.5  instance "fun" :: (type,comm_ring_1)comm_ring_1
    19.6    apply default
    19.7 -   apply (auto simp add: func_plus func_times fun_Compl_def fun_diff_def ext
    19.8 -     func_one func_zero ring_simps)
    19.9 +   apply (auto simp add: func_plus func_times fun_Compl_def fun_diff_def
   19.10 +     func_one func_zero algebra_simps)
   19.11    apply (drule fun_cong)
   19.12    apply simp
   19.13    done
    20.1 --- a/src/HOL/Library/Univ_Poly.thy	Sun Jan 18 13:58:17 2009 +0100
    20.2 +++ b/src/HOL/Library/Univ_Poly.thy	Wed Jan 28 16:29:16 2009 +0100
    20.3 @@ -217,7 +217,7 @@
    20.4      from Cons.hyps[rule_format, of x] 
    20.5      obtain q r where qr: "x#xs = [r] +++ [- a, 1] *** q" by blast
    20.6      have "h#x#xs = [a*r + h] +++ [-a, 1] *** (r#q)" 
    20.7 -      using qr by(cases q, simp_all add: ring_simps diff_def[symmetric] 
    20.8 +      using qr by(cases q, simp_all add: algebra_simps diff_def[symmetric] 
    20.9  	minus_mult_left[symmetric] right_minus)
   20.10      hence "\<exists>q r. h#x#xs = [r] +++ [-a, 1] *** q" by blast}
   20.11    thus ?case by blast
   20.12 @@ -303,7 +303,7 @@
   20.13      from C[of ?i] obtain y where y: "poly p y = 0" "\<forall>m\<le> Suc n. y \<noteq> ?i m" 
   20.14        by blast
   20.15      from y have "y = a \<or> poly q y = 0" 
   20.16 -      by (simp only: q poly_mult_eq_zero_disj poly_add) (simp add: ring_simps)
   20.17 +      by (simp only: q poly_mult_eq_zero_disj poly_add) (simp add: algebra_simps)
   20.18      with i[rule_format, of y] y(1) y(2) have False apply auto 
   20.19        apply (erule_tac x="m" in allE)
   20.20        apply auto
   20.21 @@ -414,8 +414,8 @@
   20.22  
   20.23  lemma (in idom_char_0) poly_entire: 
   20.24    "poly (p *** q) = poly [] \<longleftrightarrow> poly p = poly [] \<or> poly q = poly []"
   20.25 -using poly_entire_lemma2[of p q] 
   20.26 -by auto (rule ext, simp add: poly_mult)+
   20.27 +using poly_entire_lemma2[of p q]
   20.28 +by (auto simp add: expand_fun_eq poly_mult)
   20.29  
   20.30  lemma (in idom_char_0) poly_entire_neg: "(poly (p *** q) \<noteq> poly []) = ((poly p \<noteq> poly []) & (poly q \<noteq> poly []))"
   20.31  by (simp add: poly_entire)
   20.32 @@ -424,7 +424,7 @@
   20.33  by (auto intro!: ext)
   20.34  
   20.35  lemma (in comm_ring_1) poly_add_minus_zero_iff: "(poly (p +++ -- q) = poly []) = (poly p = poly q)"
   20.36 -by (auto simp add: ring_simps poly_add poly_minus_def fun_eq poly_cmult minus_mult_left[symmetric])
   20.37 +by (auto simp add: algebra_simps poly_add poly_minus_def fun_eq poly_cmult minus_mult_left[symmetric])
   20.38  
   20.39  lemma (in comm_ring_1) poly_add_minus_mult_eq: "poly (p *** q +++ --(p *** r)) = poly (p *** (q +++ -- r))"
   20.40  by (auto simp add: poly_add poly_minus_def fun_eq poly_mult poly_cmult right_distrib minus_mult_left[symmetric] minus_mult_right[symmetric])
   20.41 @@ -550,7 +550,7 @@
   20.42     "[| p divides q; p divides (q +++ r) |] ==> p divides r"
   20.43  apply (simp add: divides_def, auto)
   20.44  apply (rule_tac x = "padd qaa (poly_minus qa)" in exI)
   20.45 -apply (auto simp add: poly_add fun_eq poly_mult poly_minus right_diff_distrib compare_rls add_ac)
   20.46 +apply (auto simp add: poly_add fun_eq poly_mult poly_minus algebra_simps)
   20.47  done
   20.48  
   20.49  lemma (in comm_ring_1) poly_divides_diff2: "[| p divides r; p divides (q +++ r) |] ==> p divides q"
   20.50 @@ -892,15 +892,15 @@
   20.51  proof
   20.52    assume eq: ?lhs
   20.53    hence "\<And>x. poly ((c#cs) +++ -- (d#ds)) x = 0"
   20.54 -    by (simp only: poly_minus poly_add ring_simps) simp
   20.55 -  hence "poly ((c#cs) +++ -- (d#ds)) = poly []" by - (rule ext, simp) 
   20.56 +    by (simp only: poly_minus poly_add algebra_simps) simp
   20.57 +  hence "poly ((c#cs) +++ -- (d#ds)) = poly []" by(simp add:expand_fun_eq)
   20.58    hence "c = d \<and> list_all (\<lambda>x. x=0) ((cs +++ -- ds))"
   20.59 -    unfolding poly_zero by (simp add: poly_minus_def ring_simps minus_mult_left[symmetric])
   20.60 +    unfolding poly_zero by (simp add: poly_minus_def algebra_simps)
   20.61    hence "c = d \<and> (\<forall>x. poly (cs +++ -- ds) x = 0)"
   20.62      unfolding poly_zero[symmetric] by simp 
   20.63 -  thus ?rhs  apply (simp add: poly_minus poly_add ring_simps) apply (rule ext, simp) done
   20.64 +  thus ?rhs  by (simp add: poly_minus poly_add algebra_simps expand_fun_eq)
   20.65  next
   20.66 -  assume ?rhs then show ?lhs  by -  (rule ext,simp)
   20.67 +  assume ?rhs then show ?lhs by(simp add:expand_fun_eq)
   20.68  qed
   20.69    
   20.70  lemma (in idom_char_0) pnormalize_unique: "poly p = poly q \<Longrightarrow> pnormalize p = pnormalize q"
   20.71 @@ -1008,7 +1008,7 @@
   20.72      from p have ap: "poly ([a,1] *** p) \<noteq> poly []"
   20.73        using poly_mult_not_eq_poly_Nil unfolding poly_entire by auto 
   20.74      have eq: "poly ([a,1] %^(Suc n) *** p) = poly ([a,1]%^n *** ([a,1] *** p))"
   20.75 -     by (rule ext, simp add: poly_mult poly_add poly_exp poly_cmult mult_ac add_ac right_distrib)
   20.76 +     by (rule ext, simp add: poly_mult poly_add poly_exp poly_cmult algebra_simps)
   20.77     from ap have ap': "(poly ([a,1] *** p) = poly []) = False" by blast
   20.78     have  th0: "degree ([a,1]%^n *** ([a,1] *** p)) = degree ([a,1] *** p) + n"
   20.79       apply (simp only: Suc.hyps[of a "pmult [a,one] p"] ap')
    21.1 --- a/src/HOL/Lim.thy	Sun Jan 18 13:58:17 2009 +0100
    21.2 +++ b/src/HOL/Lim.thy	Wed Jan 28 16:29:16 2009 +0100
    21.3 @@ -52,7 +52,7 @@
    21.4  apply (drule_tac r="r" in LIM_D, safe)
    21.5  apply (rule_tac x="s" in exI, safe)
    21.6  apply (drule_tac x="x + k" in spec)
    21.7 -apply (simp add: compare_rls)
    21.8 +apply (simp add: algebra_simps)
    21.9  done
   21.10  
   21.11  lemma LIM_offset_zero: "f -- a --> L \<Longrightarrow> (\<lambda>h. f (a + h)) -- 0 --> L"
    22.1 --- a/src/HOL/Ln.thy	Sun Jan 18 13:58:17 2009 +0100
    22.2 +++ b/src/HOL/Ln.thy	Wed Jan 28 16:29:16 2009 +0100
    22.3 @@ -187,7 +187,7 @@
    22.4  proof -
    22.5    assume a: "0 <= (x::real)" and b: "x < 1"
    22.6    have "(1 - x) * (1 + x + x^2) = (1 - x^3)"
    22.7 -    by (simp add: ring_simps power2_eq_square power3_eq_cube)
    22.8 +    by (simp add: algebra_simps power2_eq_square power3_eq_cube)
    22.9    also have "... <= 1"
   22.10      by (auto simp add: a)
   22.11    finally have "(1 - x) * (1 + x + x ^ 2) <= 1" .
   22.12 @@ -325,10 +325,10 @@
   22.13      done
   22.14    also have "... <= 2 * x^2"
   22.15      apply (subgoal_tac "- (-x) - 2 * (-x)^2 <= ln (1 - (-x))")
   22.16 -    apply (simp add: compare_rls)
   22.17 +    apply (simp add: algebra_simps)
   22.18      apply (rule ln_one_minus_pos_lower_bound)
   22.19      apply (insert prems, auto)
   22.20 -    done 
   22.21 +    done
   22.22    finally show ?thesis .
   22.23  qed
   22.24  
   22.25 @@ -375,7 +375,7 @@
   22.26    apply simp
   22.27    apply (subst ln_div [THEN sym])
   22.28    apply arith
   22.29 -  apply (auto simp add: ring_simps add_frac_eq frac_eq_eq 
   22.30 +  apply (auto simp add: algebra_simps add_frac_eq frac_eq_eq 
   22.31      add_divide_distrib power2_eq_square)
   22.32    apply (rule mult_pos_pos, assumption)+
   22.33    apply assumption
   22.34 @@ -394,7 +394,7 @@
   22.35      apply auto
   22.36      done
   22.37    have "x * ln y - x * ln x = x * (ln y - ln x)"
   22.38 -    by (simp add: ring_simps)
   22.39 +    by (simp add: algebra_simps)
   22.40    also have "... = x * ln(y / x)"
   22.41      apply (subst ln_div)
   22.42      apply (rule b, rule a, rule refl)
    23.1 --- a/src/HOL/Matrix/LP.thy	Sun Jan 18 13:58:17 2009 +0100
    23.2 +++ b/src/HOL/Matrix/LP.thy	Wed Jan 28 16:29:16 2009 +0100
    23.3 @@ -20,7 +20,7 @@
    23.4  proof -
    23.5    from prems have 1: "y * b <= y * b'" by (simp add: mult_left_mono)
    23.6    from prems have 2: "y * (A * x) <= y * b" by (simp add: mult_left_mono) 
    23.7 -  have 3: "y * (A * x) = c * x + (y * (A - A') + (y * A' - c') + (c'-c)) * x" by (simp add: ring_simps)  
    23.8 +  have 3: "y * (A * x) = c * x + (y * (A - A') + (y * A' - c') + (c'-c)) * x" by (simp add: algebra_simps)  
    23.9    from 1 2 3 have 4: "c * x + (y * (A - A') + (y * A' - c') + (c'-c)) * x <= y * b'" by simp
   23.10    have 5: "c * x <= y * b' + abs((y * (A - A') + (y * A' - c') + (c'-c)) * x)"
   23.11      by (simp only: 4 estimate_by_abs)  
   23.12 @@ -32,7 +32,7 @@
   23.13      by (simp add: abs_triangle_ineq mult_right_mono)    
   23.14    have 9: "(abs (y * (A-A')) + abs (y*A'-c') + abs(c'-c)) * abs x <= (abs y * abs (A-A') + abs (y*A'-c') + abs (c'-c)) * abs x"
   23.15      by (simp add: abs_le_mult mult_right_mono)  
   23.16 -  have 10: "c'-c = -(c-c')" by (simp add: ring_simps)
   23.17 +  have 10: "c'-c = -(c-c')" by (simp add: algebra_simps)
   23.18    have 11: "abs (c'-c) = abs (c-c')" 
   23.19      by (subst 10, subst abs_minus_cancel, simp)
   23.20    have 12: "(abs y * abs (A-A') + abs (y*A'-c') + abs (c'-c)) * abs x <= (abs y * abs (A-A') + abs (y*A'-c') + \<delta>c) * abs x"
   23.21 @@ -85,7 +85,7 @@
   23.22      apply simp
   23.23      done
   23.24    then have "a * b = pprt a * pprt b + pprt a * nprt b + nprt a * pprt b + nprt a * nprt b"
   23.25 -    by (simp add: ring_simps)
   23.26 +    by (simp add: algebra_simps)
   23.27    moreover have "pprt a * pprt b <= pprt a2 * pprt b2"
   23.28      by (simp_all add: prems mult_mono)
   23.29    moreover have "pprt a * nprt b <= pprt a1 * nprt b2"
   23.30 @@ -134,10 +134,10 @@
   23.31    (is "_ <= _ + ?C")
   23.32  proof -
   23.33    from prems have "y * (A * x) <= y * b" by (simp add: mult_left_mono) 
   23.34 -  moreover have "y * (A * x) = c * x + (y * A - c) * x" by (simp add: ring_simps)  
   23.35 +  moreover have "y * (A * x) = c * x + (y * A - c) * x" by (simp add: algebra_simps)  
   23.36    ultimately have "c * x + (y * A - c) * x <= y * b" by simp
   23.37    then have "c * x <= y * b - (y * A - c) * x" by (simp add: le_diff_eq)
   23.38 -  then have cx: "c * x <= y * b + (c - y * A) * x" by (simp add: ring_simps)
   23.39 +  then have cx: "c * x <= y * b + (c - y * A) * x" by (simp add: algebra_simps)
   23.40    have s2: "c - y * A <= c2 - y * A1"
   23.41      by (simp add: diff_def prems add_mono mult_left_mono)
   23.42    have s1: "c1 - y * A2 <= c - y * A"
    24.1 --- a/src/HOL/Matrix/Matrix.thy	Sun Jan 18 13:58:17 2009 +0100
    24.2 +++ b/src/HOL/Matrix/Matrix.thy	Wed Jan 28 16:29:16 2009 +0100
    24.3 @@ -1573,17 +1573,17 @@
    24.4    show "A * B * C = A * (B * C)"
    24.5      apply (simp add: times_matrix_def)
    24.6      apply (rule mult_matrix_assoc)
    24.7 -    apply (simp_all add: associative_def ring_simps)
    24.8 +    apply (simp_all add: associative_def algebra_simps)
    24.9      done
   24.10    show "(A + B) * C = A * C + B * C"
   24.11      apply (simp add: times_matrix_def plus_matrix_def)
   24.12      apply (rule l_distributive_matrix[simplified l_distributive_def, THEN spec, THEN spec, THEN spec])
   24.13 -    apply (simp_all add: associative_def commutative_def ring_simps)
   24.14 +    apply (simp_all add: associative_def commutative_def algebra_simps)
   24.15      done
   24.16    show "A * (B + C) = A * B + A * C"
   24.17      apply (simp add: times_matrix_def plus_matrix_def)
   24.18      apply (rule r_distributive_matrix[simplified r_distributive_def, THEN spec, THEN spec, THEN spec])
   24.19 -    apply (simp_all add: associative_def commutative_def ring_simps)
   24.20 +    apply (simp_all add: associative_def commutative_def algebra_simps)
   24.21      done
   24.22  qed  
   24.23  
   24.24 @@ -1793,7 +1793,7 @@
   24.25  by (simp add: scalar_mult_def)
   24.26  
   24.27  lemma scalar_mult_add: "scalar_mult y (a+b) = (scalar_mult y a) + (scalar_mult y b)"
   24.28 -by (simp add: scalar_mult_def apply_matrix_add ring_simps)
   24.29 +by (simp add: scalar_mult_def apply_matrix_add algebra_simps)
   24.30  
   24.31  lemma Rep_scalar_mult[simp]: "Rep_matrix (scalar_mult y a) j i = y * (Rep_matrix a j i)" 
   24.32  by (simp add: scalar_mult_def)
    25.1 --- a/src/HOL/Matrix/SparseMatrix.thy	Sun Jan 18 13:58:17 2009 +0100
    25.2 +++ b/src/HOL/Matrix/SparseMatrix.thy	Wed Jan 28 16:29:16 2009 +0100
    25.3 @@ -274,7 +274,7 @@
    25.4      apply (rule conjI)
    25.5      apply (intro strip)
    25.6      apply (frule_tac as=brr in sorted_spvec_cons1)
    25.7 -    apply (simp add: ring_simps sparse_row_matrix_cons)
    25.8 +    apply (simp add: algebra_simps sparse_row_matrix_cons)
    25.9      apply (simplesubst Rep_matrix_zero_imp_mult_zero) 
   25.10      apply (simp)
   25.11      apply (intro strip)
   25.12 @@ -296,7 +296,7 @@
   25.13      
   25.14      apply (intro strip | rule conjI)+
   25.15      apply (frule_tac as=arr in sorted_spvec_cons1)
   25.16 -    apply (simp add: ring_simps)
   25.17 +    apply (simp add: algebra_simps)
   25.18      apply (subst Rep_matrix_zero_imp_mult_zero)
   25.19      apply (simp)
   25.20      apply (rule disjI2)
   25.21 @@ -310,7 +310,7 @@
   25.22      apply (simp_all)
   25.23      apply (frule_tac as=arr in sorted_spvec_cons1)
   25.24      apply (frule_tac as=brr in sorted_spvec_cons1)
   25.25 -    apply (simp add: sparse_row_matrix_cons ring_simps sparse_row_vector_addmult_spvec)
   25.26 +    apply (simp add: sparse_row_matrix_cons algebra_simps sparse_row_vector_addmult_spvec)
   25.27      apply (rule_tac B1 = "sparse_row_matrix brr" in ssubst[OF Rep_matrix_zero_imp_mult_zero])
   25.28      apply (auto)
   25.29      apply (rule sorted_sparse_row_matrix_zero)
   25.30 @@ -360,7 +360,7 @@
   25.31  lemma sparse_row_mult_spmat[rule_format]: 
   25.32    "sorted_spmat A \<longrightarrow> sorted_spvec B \<longrightarrow> sparse_row_matrix (mult_spmat A B) = (sparse_row_matrix A) * (sparse_row_matrix B)"
   25.33    apply (induct A)
   25.34 -  apply (auto simp add: sparse_row_matrix_cons sparse_row_mult_spvec_spmat ring_simps move_matrix_mult)
   25.35 +  apply (auto simp add: sparse_row_matrix_cons sparse_row_mult_spvec_spmat algebra_simps move_matrix_mult)
   25.36    done
   25.37  
   25.38  lemma sorted_spvec_mult_spmat[rule_format]:
    26.1 --- a/src/HOL/Matrix/cplex/Cplex.thy	Sun Jan 18 13:58:17 2009 +0100
    26.2 +++ b/src/HOL/Matrix/cplex/Cplex.thy	Wed Jan 28 16:29:16 2009 +0100
    26.3 @@ -34,8 +34,8 @@
    26.4    add_spmat (mult_spmat (nprt_spmat s2) (pprt_spmat r1), mult_spmat (nprt_spmat s1) (nprt_spmat r1)))))))"
    26.5    apply (simp add: Let_def)
    26.6    apply (insert assms)
    26.7 -  apply (simp add: sparse_row_matrix_op_simps ring_simps)  
    26.8 -  apply (rule mult_le_dual_prts[where A=A, simplified Let_def ring_simps])
    26.9 +  apply (simp add: sparse_row_matrix_op_simps algebra_simps)  
   26.10 +  apply (rule mult_le_dual_prts[where A=A, simplified Let_def algebra_simps])
   26.11    apply (auto)
   26.12    done
   26.13  
    27.1 --- a/src/HOL/MetisExamples/BigO.thy	Sun Jan 18 13:58:17 2009 +0100
    27.2 +++ b/src/HOL/MetisExamples/BigO.thy	Wed Jan 28 16:29:16 2009 +0100
    27.3 @@ -486,7 +486,7 @@
    27.4  have 2: "\<And>X3. (0\<Colon>'b) + X3 = X3"
    27.5    by (metis diff_eq_eq right_minus_eq)
    27.6  have 3: "\<not> (0\<Colon>'b) \<le> f x - lb x"
    27.7 -  by (metis 1 compare_rls(1))
    27.8 +  by (metis 1 diff_minus)
    27.9  have 4: "\<not> (0\<Colon>'b) + lb x \<le> f x"
   27.10    by (metis 3 le_diff_eq)
   27.11  show "False"
   27.12 @@ -1197,7 +1197,7 @@
   27.13  apply (erule thin_rl) 
   27.14  (*sledgehammer*); 
   27.15    apply (case_tac "0 <= f x - k x")
   27.16 -  apply (simp del: compare_rls diff_minus);
   27.17 +  apply (simp)
   27.18    apply (subst abs_of_nonneg)
   27.19    apply (drule_tac x = x in spec) back
   27.20  ML_command{*AtpWrapper.problem_name := "BigO__bigo_lesso3_simpler"*}
   27.21 @@ -1216,7 +1216,7 @@
   27.22    apply assumption
   27.23    apply (erule bigo_lesseq2) back
   27.24    apply (rule allI)
   27.25 -  apply (auto simp add: func_plus fun_diff_def compare_rls 
   27.26 +  apply (auto simp add: func_plus fun_diff_def algebra_simps
   27.27      split: split_max abs_split)
   27.28  done
   27.29  
    28.1 --- a/src/HOL/Nat.thy	Sun Jan 18 13:58:17 2009 +0100
    28.2 +++ b/src/HOL/Nat.thy	Wed Jan 28 16:29:16 2009 +0100
    28.3 @@ -1254,7 +1254,7 @@
    28.4  begin
    28.5  
    28.6  lemma of_nat_diff: "n \<le> m \<Longrightarrow> of_nat (m - n) = of_nat m - of_nat n"
    28.7 -  by (simp add: compare_rls of_nat_add [symmetric])
    28.8 +by (simp add: algebra_simps of_nat_add [symmetric])
    28.9  
   28.10  end
   28.11  
    29.1 --- a/src/HOL/NumberTheory/IntPrimes.thy	Sun Jan 18 13:58:17 2009 +0100
    29.2 +++ b/src/HOL/NumberTheory/IntPrimes.thy	Wed Jan 28 16:29:16 2009 +0100
    29.3 @@ -146,7 +146,7 @@
    29.4  lemma zcong_trans:
    29.5      "[a = b] (mod m) ==> [b = c] (mod m) ==> [a = c] (mod m)"
    29.6    unfolding zcong_def
    29.7 -  apply (auto elim!: dvdE simp add: ring_simps)
    29.8 +  apply (auto elim!: dvdE simp add: algebra_simps)
    29.9    unfolding left_distrib [symmetric]
   29.10    apply (rule dvd_mult dvd_refl)+
   29.11    done
   29.12 @@ -255,7 +255,7 @@
   29.13  
   29.14  lemma zcong_iff_lin: "([a = b] (mod m)) = (\<exists>k. b = a + m * k)"
   29.15    unfolding zcong_def
   29.16 -  apply (auto elim!: dvdE simp add: ring_simps)
   29.17 +  apply (auto elim!: dvdE simp add: algebra_simps)
   29.18    apply (rule_tac x = "-k" in exI) apply simp
   29.19    done
   29.20  
    30.1 --- a/src/HOL/OrderedGroup.thy	Sun Jan 18 13:58:17 2009 +0100
    30.2 +++ b/src/HOL/OrderedGroup.thy	Wed Jan 28 16:29:16 2009 +0100
    30.3 @@ -22,17 +22,34 @@
    30.4    \end{itemize}
    30.5  *}
    30.6  
    30.7 +ML{*
    30.8 +structure AlgebraSimps =
    30.9 +  NamedThmsFun(val name = "algebra_simps"
   30.10 +               val description = "algebra simplification rules");
   30.11 +*}
   30.12 +
   30.13 +setup AlgebraSimps.setup
   30.14 +
   30.15 +text{* The rewrites accumulated in @{text algebra_simps} deal with the
   30.16 +classical algebraic structures of groups, rings and family. They simplify
   30.17 +terms by multiplying everything out (in case of a ring) and bringing sums and
   30.18 +products into a canonical form (by ordered rewriting). As a result it decides
   30.19 +group and ring equalities but also helps with inequalities.
   30.20 +
   30.21 +Of course it also works for fields, but it knows nothing about multiplicative
   30.22 +inverses or division. This is catered for by @{text field_simps}. *}
   30.23 +
   30.24  subsection {* Semigroups and Monoids *}
   30.25  
   30.26  class semigroup_add = plus +
   30.27 -  assumes add_assoc: "(a + b) + c = a + (b + c)"
   30.28 +  assumes add_assoc[algebra_simps]: "(a + b) + c = a + (b + c)"
   30.29  
   30.30  class ab_semigroup_add = semigroup_add +
   30.31 -  assumes add_commute: "a + b = b + a"
   30.32 +  assumes add_commute[algebra_simps]: "a + b = b + a"
   30.33  begin
   30.34  
   30.35 -lemma add_left_commute: "a + (b + c) = b + (a + c)"
   30.36 -  by (rule mk_left_commute [of "plus", OF add_assoc add_commute])
   30.37 +lemma add_left_commute[algebra_simps]: "a + (b + c) = b + (a + c)"
   30.38 +by (rule mk_left_commute [of "plus", OF add_assoc add_commute])
   30.39  
   30.40  theorems add_ac = add_assoc add_commute add_left_commute
   30.41  
   30.42 @@ -41,14 +58,14 @@
   30.43  theorems add_ac = add_assoc add_commute add_left_commute
   30.44  
   30.45  class semigroup_mult = times +
   30.46 -  assumes mult_assoc: "(a * b) * c = a * (b * c)"
   30.47 +  assumes mult_assoc[algebra_simps]: "(a * b) * c = a * (b * c)"
   30.48  
   30.49  class ab_semigroup_mult = semigroup_mult +
   30.50 -  assumes mult_commute: "a * b = b * a"
   30.51 +  assumes mult_commute[algebra_simps]: "a * b = b * a"
   30.52  begin
   30.53  
   30.54 -lemma mult_left_commute: "a * (b * c) = b * (a * c)"
   30.55 -  by (rule mk_left_commute [of "times", OF mult_assoc mult_commute])
   30.56 +lemma mult_left_commute[algebra_simps]: "a * (b * c) = b * (a * c)"
   30.57 +by (rule mk_left_commute [of "times", OF mult_assoc mult_commute])
   30.58  
   30.59  theorems mult_ac = mult_assoc mult_commute mult_left_commute
   30.60  
   30.61 @@ -57,24 +74,20 @@
   30.62  theorems mult_ac = mult_assoc mult_commute mult_left_commute
   30.63  
   30.64  class ab_semigroup_idem_mult = ab_semigroup_mult +
   30.65 -  assumes mult_idem: "x * x = x"
   30.66 +  assumes mult_idem[simp]: "x * x = x"
   30.67  begin
   30.68  
   30.69 -lemma mult_left_idem: "x * (x * y) = x * y"
   30.70 +lemma mult_left_idem[simp]: "x * (x * y) = x * y"
   30.71    unfolding mult_assoc [symmetric, of x] mult_idem ..
   30.72  
   30.73 -lemmas mult_ac_idem = mult_ac mult_idem mult_left_idem
   30.74 -
   30.75  end
   30.76  
   30.77 -lemmas mult_ac_idem = mult_ac mult_idem mult_left_idem
   30.78 -
   30.79  class monoid_add = zero + semigroup_add +
   30.80    assumes add_0_left [simp]: "0 + a = a"
   30.81      and add_0_right [simp]: "a + 0 = a"
   30.82  
   30.83  lemma zero_reorient: "0 = x \<longleftrightarrow> x = 0"
   30.84 -  by (rule eq_commute)
   30.85 +by (rule eq_commute)
   30.86  
   30.87  class comm_monoid_add = zero + ab_semigroup_add +
   30.88    assumes add_0: "0 + a = a"
   30.89 @@ -90,7 +103,7 @@
   30.90    assumes mult_1_right [simp]: "a * 1 = a"
   30.91  
   30.92  lemma one_reorient: "1 = x \<longleftrightarrow> x = 1"
   30.93 -  by (rule eq_commute)
   30.94 +by (rule eq_commute)
   30.95  
   30.96  class comm_monoid_mult = one + ab_semigroup_mult +
   30.97    assumes mult_1: "1 * a = a"
   30.98 @@ -108,11 +121,11 @@
   30.99  
  30.100  lemma add_left_cancel [simp]:
  30.101    "a + b = a + c \<longleftrightarrow> b = c"
  30.102 -  by (blast dest: add_left_imp_eq)
  30.103 +by (blast dest: add_left_imp_eq)
  30.104  
  30.105  lemma add_right_cancel [simp]:
  30.106    "b + a = c + a \<longleftrightarrow> b = c"
  30.107 -  by (blast dest: add_right_imp_eq)
  30.108 +by (blast dest: add_right_imp_eq)
  30.109  
  30.110  end
  30.111  
  30.112 @@ -142,7 +155,7 @@
  30.113  begin
  30.114  
  30.115  lemma minus_add_cancel: "- a + (a + b) = b"
  30.116 -  by (simp add: add_assoc[symmetric])
  30.117 +by (simp add: add_assoc[symmetric])
  30.118  
  30.119  lemma minus_zero [simp]: "- 0 = 0"
  30.120  proof -
  30.121 @@ -176,8 +189,7 @@
  30.122  qed
  30.123  
  30.124  lemma equals_zero_I:
  30.125 -  assumes "a + b = 0"
  30.126 -  shows "- a = b"
  30.127 +  assumes "a + b = 0" shows "- a = b"
  30.128  proof -
  30.129    have "- a = - a + (a + b)" using assms by simp
  30.130    also have "\<dots> = b" by (simp add: add_assoc[symmetric])
  30.131 @@ -185,23 +197,22 @@
  30.132  qed
  30.133  
  30.134  lemma diff_self [simp]: "a - a = 0"
  30.135 -  by (simp add: diff_minus)
  30.136 +by (simp add: diff_minus)
  30.137  
  30.138  lemma diff_0 [simp]: "0 - a = - a"
  30.139 -  by (simp add: diff_minus)
  30.140 +by (simp add: diff_minus)
  30.141  
  30.142  lemma diff_0_right [simp]: "a - 0 = a" 
  30.143 -  by (simp add: diff_minus)
  30.144 +by (simp add: diff_minus)
  30.145  
  30.146  lemma diff_minus_eq_add [simp]: "a - - b = a + b"
  30.147 -  by (simp add: diff_minus)
  30.148 +by (simp add: diff_minus)
  30.149  
  30.150  lemma neg_equal_iff_equal [simp]:
  30.151    "- a = - b \<longleftrightarrow> a = b" 
  30.152  proof 
  30.153    assume "- a = - b"
  30.154 -  hence "- (- a) = - (- b)"
  30.155 -    by simp
  30.156 +  hence "- (- a) = - (- b)" by simp
  30.157    thus "a = b" by simp
  30.158  next
  30.159    assume "a = b"
  30.160 @@ -210,11 +221,11 @@
  30.161  
  30.162  lemma neg_equal_0_iff_equal [simp]:
  30.163    "- a = 0 \<longleftrightarrow> a = 0"
  30.164 -  by (subst neg_equal_iff_equal [symmetric], simp)
  30.165 +by (subst neg_equal_iff_equal [symmetric], simp)
  30.166  
  30.167  lemma neg_0_equal_iff_equal [simp]:
  30.168    "0 = - a \<longleftrightarrow> 0 = a"
  30.169 -  by (subst neg_equal_iff_equal [symmetric], simp)
  30.170 +by (subst neg_equal_iff_equal [symmetric], simp)
  30.171  
  30.172  text{*The next two equations can make the simplifier loop!*}
  30.173  
  30.174 @@ -233,10 +244,12 @@
  30.175  qed
  30.176  
  30.177  lemma diff_add_cancel: "a - b + b = a"
  30.178 -  by (simp add: diff_minus add_assoc)
  30.179 +by (simp add: diff_minus add_assoc)
  30.180  
  30.181  lemma add_diff_cancel: "a + b - b = a"
  30.182 -  by (simp add: diff_minus add_assoc)
  30.183 +by (simp add: diff_minus add_assoc)
  30.184 +
  30.185 +declare diff_minus[symmetric, algebra_simps]
  30.186  
  30.187  end
  30.188  
  30.189 @@ -257,43 +270,38 @@
  30.190    then show "b = c" by simp
  30.191  qed
  30.192  
  30.193 -lemma uminus_add_conv_diff:
  30.194 +lemma uminus_add_conv_diff[algebra_simps]:
  30.195    "- a + b = b - a"
  30.196 -  by (simp add:diff_minus add_commute)
  30.197 +by (simp add:diff_minus add_commute)
  30.198  
  30.199  lemma minus_add_distrib [simp]:
  30.200    "- (a + b) = - a + - b"
  30.201 -  by (rule equals_zero_I) (simp add: add_ac)
  30.202 +by (rule equals_zero_I) (simp add: add_ac)
  30.203  
  30.204  lemma minus_diff_eq [simp]:
  30.205    "- (a - b) = b - a"
  30.206 -  by (simp add: diff_minus add_commute)
  30.207 -
  30.208 -lemma add_diff_eq: "a + (b - c) = (a + b) - c"
  30.209 -  by (simp add: diff_minus add_ac)
  30.210 +by (simp add: diff_minus add_commute)
  30.211  
  30.212 -lemma diff_add_eq: "(a - b) + c = (a + c) - b"
  30.213 -  by (simp add: diff_minus add_ac)
  30.214 +lemma add_diff_eq[algebra_simps]: "a + (b - c) = (a + b) - c"
  30.215 +by (simp add: diff_minus add_ac)
  30.216  
  30.217 -lemma diff_eq_eq: "a - b = c \<longleftrightarrow> a = c + b"
  30.218 -  by (auto simp add: diff_minus add_assoc)
  30.219 +lemma diff_add_eq[algebra_simps]: "(a - b) + c = (a + c) - b"
  30.220 +by (simp add: diff_minus add_ac)
  30.221  
  30.222 -lemma eq_diff_eq: "a = c - b \<longleftrightarrow> a + b = c"
  30.223 -  by (auto simp add: diff_minus add_assoc)
  30.224 +lemma diff_eq_eq[algebra_simps]: "a - b = c \<longleftrightarrow> a = c + b"
  30.225 +by (auto simp add: diff_minus add_assoc)
  30.226  
  30.227 -lemma diff_diff_eq: "(a - b) - c = a - (b + c)"
  30.228 -  by (simp add: diff_minus add_ac)
  30.229 +lemma eq_diff_eq[algebra_simps]: "a = c - b \<longleftrightarrow> a + b = c"
  30.230 +by (auto simp add: diff_minus add_assoc)
  30.231  
  30.232 -lemma diff_diff_eq2: "a - (b - c) = (a + c) - b"
  30.233 -  by (simp add: diff_minus add_ac)
  30.234 +lemma diff_diff_eq[algebra_simps]: "(a - b) - c = a - (b + c)"
  30.235 +by (simp add: diff_minus add_ac)
  30.236  
  30.237 -lemmas compare_rls =
  30.238 -       diff_minus [symmetric]
  30.239 -       add_diff_eq diff_add_eq diff_diff_eq diff_diff_eq2
  30.240 -       diff_eq_eq eq_diff_eq
  30.241 +lemma diff_diff_eq2[algebra_simps]: "a - (b - c) = (a + c) - b"
  30.242 +by (simp add: diff_minus add_ac)
  30.243  
  30.244  lemma eq_iff_diff_eq_0: "a = b \<longleftrightarrow> a - b = 0"
  30.245 -  by (simp add: compare_rls)
  30.246 +by (simp add: algebra_simps)
  30.247  
  30.248  end
  30.249  
  30.250 @@ -305,7 +313,7 @@
  30.251  
  30.252  lemma add_right_mono:
  30.253    "a \<le> b \<Longrightarrow> a + c \<le> b + c"
  30.254 -  by (simp add: add_commute [of _ c] add_left_mono)
  30.255 +by (simp add: add_commute [of _ c] add_left_mono)
  30.256  
  30.257  text {* non-strict, in both arguments *}
  30.258  lemma add_mono:
  30.259 @@ -322,11 +330,11 @@
  30.260  
  30.261  lemma add_strict_left_mono:
  30.262    "a < b \<Longrightarrow> c + a < c + b"
  30.263 -  by (auto simp add: less_le add_left_mono)
  30.264 +by (auto simp add: less_le add_left_mono)
  30.265  
  30.266  lemma add_strict_right_mono:
  30.267    "a < b \<Longrightarrow> a + c < b + c"
  30.268 -  by (simp add: add_commute [of _ c] add_strict_left_mono)
  30.269 +by (simp add: add_commute [of _ c] add_strict_left_mono)
  30.270  
  30.271  text{*Strict monotonicity in both arguments*}
  30.272  lemma add_strict_mono:
  30.273 @@ -355,8 +363,7 @@
  30.274  begin
  30.275  
  30.276  lemma add_less_imp_less_left:
  30.277 -   assumes less: "c + a < c + b"
  30.278 -   shows "a < b"
  30.279 +  assumes less: "c + a < c + b" shows "a < b"
  30.280  proof -
  30.281    from less have le: "c + a <= c + b" by (simp add: order_le_less)
  30.282    have "a <= b" 
  30.283 @@ -381,23 +388,23 @@
  30.284  
  30.285  lemma add_less_cancel_left [simp]:
  30.286    "c + a < c + b \<longleftrightarrow> a < b"
  30.287 -  by (blast intro: add_less_imp_less_left add_strict_left_mono) 
  30.288 +by (blast intro: add_less_imp_less_left add_strict_left_mono) 
  30.289  
  30.290  lemma add_less_cancel_right [simp]:
  30.291    "a + c < b + c \<longleftrightarrow> a < b"
  30.292 -  by (blast intro: add_less_imp_less_right add_strict_right_mono)
  30.293 +by (blast intro: add_less_imp_less_right add_strict_right_mono)
  30.294  
  30.295  lemma add_le_cancel_left [simp]:
  30.296    "c + a \<le> c + b \<longleftrightarrow> a \<le> b"
  30.297 -  by (auto, drule add_le_imp_le_left, simp_all add: add_left_mono) 
  30.298 +by (auto, drule add_le_imp_le_left, simp_all add: add_left_mono) 
  30.299  
  30.300  lemma add_le_cancel_right [simp]:
  30.301    "a + c \<le> b + c \<longleftrightarrow> a \<le> b"
  30.302 -  by (simp add: add_commute [of a c] add_commute [of b c])
  30.303 +by (simp add: add_commute [of a c] add_commute [of b c])
  30.304  
  30.305  lemma add_le_imp_le_right:
  30.306    "a + c \<le> b + c \<Longrightarrow> a \<le> b"
  30.307 -  by simp
  30.308 +by simp
  30.309  
  30.310  lemma max_add_distrib_left:
  30.311    "max x y + z = max (x + z) (y + z)"
  30.312 @@ -416,8 +423,7 @@
  30.313  begin
  30.314  
  30.315  lemma add_pos_nonneg:
  30.316 -  assumes "0 < a" and "0 \<le> b"
  30.317 -    shows "0 < a + b"
  30.318 +  assumes "0 < a" and "0 \<le> b" shows "0 < a + b"
  30.319  proof -
  30.320    have "0 + 0 < a + b" 
  30.321      using assms by (rule add_less_le_mono)
  30.322 @@ -425,13 +431,11 @@
  30.323  qed
  30.324  
  30.325  lemma add_pos_pos:
  30.326 -  assumes "0 < a" and "0 < b"
  30.327 -    shows "0 < a + b"
  30.328 -  by (rule add_pos_nonneg) (insert assms, auto)
  30.329 +  assumes "0 < a" and "0 < b" shows "0 < a + b"
  30.330 +by (rule add_pos_nonneg) (insert assms, auto)
  30.331  
  30.332  lemma add_nonneg_pos:
  30.333 -  assumes "0 \<le> a" and "0 < b"
  30.334 -    shows "0 < a + b"
  30.335 +  assumes "0 \<le> a" and "0 < b" shows "0 < a + b"
  30.336  proof -
  30.337    have "0 + 0 < a + b" 
  30.338      using assms by (rule add_le_less_mono)
  30.339 @@ -439,8 +443,7 @@
  30.340  qed
  30.341  
  30.342  lemma add_nonneg_nonneg:
  30.343 -  assumes "0 \<le> a" and "0 \<le> b"
  30.344 -    shows "0 \<le> a + b"
  30.345 +  assumes "0 \<le> a" and "0 \<le> b" shows "0 \<le> a + b"
  30.346  proof -
  30.347    have "0 + 0 \<le> a + b" 
  30.348      using assms by (rule add_mono)
  30.349 @@ -448,8 +451,7 @@
  30.350  qed
  30.351  
  30.352  lemma add_neg_nonpos: 
  30.353 -  assumes "a < 0" and "b \<le> 0"
  30.354 -  shows "a + b < 0"
  30.355 +  assumes "a < 0" and "b \<le> 0" shows "a + b < 0"
  30.356  proof -
  30.357    have "a + b < 0 + 0"
  30.358      using assms by (rule add_less_le_mono)
  30.359 @@ -457,13 +459,11 @@
  30.360  qed
  30.361  
  30.362  lemma add_neg_neg: 
  30.363 -  assumes "a < 0" and "b < 0"
  30.364 -  shows "a + b < 0"
  30.365 -  by (rule add_neg_nonpos) (insert assms, auto)
  30.366 +  assumes "a < 0" and "b < 0" shows "a + b < 0"
  30.367 +by (rule add_neg_nonpos) (insert assms, auto)
  30.368  
  30.369  lemma add_nonpos_neg:
  30.370 -  assumes "a \<le> 0" and "b < 0"
  30.371 -  shows "a + b < 0"
  30.372 +  assumes "a \<le> 0" and "b < 0" shows "a + b < 0"
  30.373  proof -
  30.374    have "a + b < 0 + 0"
  30.375      using assms by (rule add_le_less_mono)
  30.376 @@ -471,8 +471,7 @@
  30.377  qed
  30.378  
  30.379  lemma add_nonpos_nonpos:
  30.380 -  assumes "a \<le> 0" and "b \<le> 0"
  30.381 -  shows "a + b \<le> 0"
  30.382 +  assumes "a \<le> 0" and "b \<le> 0" shows "a + b \<le> 0"
  30.383  proof -
  30.384    have "a + b \<le> 0 + 0"
  30.385      using assms by (rule add_mono)
  30.386 @@ -500,31 +499,25 @@
  30.387  
  30.388  lemma max_diff_distrib_left:
  30.389    shows "max x y - z = max (x - z) (y - z)"
  30.390 -  by (simp add: diff_minus, rule max_add_distrib_left) 
  30.391 +by (simp add: diff_minus, rule max_add_distrib_left) 
  30.392  
  30.393  lemma min_diff_distrib_left:
  30.394    shows "min x y - z = min (x - z) (y - z)"
  30.395 -  by (simp add: diff_minus, rule min_add_distrib_left) 
  30.396 +by (simp add: diff_minus, rule min_add_distrib_left) 
  30.397  
  30.398  lemma le_imp_neg_le:
  30.399 -  assumes "a \<le> b"
  30.400 -  shows "-b \<le> -a"
  30.401 +  assumes "a \<le> b" shows "-b \<le> -a"
  30.402  proof -
  30.403 -  have "-a+a \<le> -a+b"
  30.404 -    using `a \<le> b` by (rule add_left_mono) 
  30.405 -  hence "0 \<le> -a+b"
  30.406 -    by simp
  30.407 -  hence "0 + (-b) \<le> (-a + b) + (-b)"
  30.408 -    by (rule add_right_mono) 
  30.409 -  thus ?thesis
  30.410 -    by (simp add: add_assoc)
  30.411 +  have "-a+a \<le> -a+b" using `a \<le> b` by (rule add_left_mono) 
  30.412 +  hence "0 \<le> -a+b" by simp
  30.413 +  hence "0 + (-b) \<le> (-a + b) + (-b)" by (rule add_right_mono) 
  30.414 +  thus ?thesis by (simp add: add_assoc)
  30.415  qed
  30.416  
  30.417  lemma neg_le_iff_le [simp]: "- b \<le> - a \<longleftrightarrow> a \<le> b"
  30.418  proof 
  30.419    assume "- b \<le> - a"
  30.420 -  hence "- (- a) \<le> - (- b)"
  30.421 -    by (rule le_imp_neg_le)
  30.422 +  hence "- (- a) \<le> - (- b)" by (rule le_imp_neg_le)
  30.423    thus "a\<le>b" by simp
  30.424  next
  30.425    assume "a\<le>b"
  30.426 @@ -532,19 +525,19 @@
  30.427  qed
  30.428  
  30.429  lemma neg_le_0_iff_le [simp]: "- a \<le> 0 \<longleftrightarrow> 0 \<le> a"
  30.430 -  by (subst neg_le_iff_le [symmetric], simp)
  30.431 +by (subst neg_le_iff_le [symmetric], simp)
  30.432  
  30.433  lemma neg_0_le_iff_le [simp]: "0 \<le> - a \<longleftrightarrow> a \<le> 0"
  30.434 -  by (subst neg_le_iff_le [symmetric], simp)
  30.435 +by (subst neg_le_iff_le [symmetric], simp)
  30.436  
  30.437  lemma neg_less_iff_less [simp]: "- b < - a \<longleftrightarrow> a < b"
  30.438 -  by (force simp add: less_le) 
  30.439 +by (force simp add: less_le) 
  30.440  
  30.441  lemma neg_less_0_iff_less [simp]: "- a < 0 \<longleftrightarrow> 0 < a"
  30.442 -  by (subst neg_less_iff_less [symmetric], simp)
  30.443 +by (subst neg_less_iff_less [symmetric], simp)
  30.444  
  30.445  lemma neg_0_less_iff_less [simp]: "0 < - a \<longleftrightarrow> a < 0"
  30.446 -  by (subst neg_less_iff_less [symmetric], simp)
  30.447 +by (subst neg_less_iff_less [symmetric], simp)
  30.448  
  30.449  text{*The next several equations can make the simplifier loop!*}
  30.450  
  30.451 @@ -573,7 +566,7 @@
  30.452  qed
  30.453  
  30.454  lemma minus_le_iff: "- a \<le> b \<longleftrightarrow> - b \<le> a"
  30.455 -  by (auto simp add: le_less minus_less_iff)
  30.456 +by (auto simp add: le_less minus_less_iff)
  30.457  
  30.458  lemma less_iff_diff_less_0: "a < b \<longleftrightarrow> a - b < 0"
  30.459  proof -
  30.460 @@ -583,56 +576,34 @@
  30.461    finally show ?thesis .
  30.462  qed
  30.463  
  30.464 -lemma diff_less_eq: "a - b < c \<longleftrightarrow> a < c + b"
  30.465 +lemma diff_less_eq[algebra_simps]: "a - b < c \<longleftrightarrow> a < c + b"
  30.466  apply (subst less_iff_diff_less_0 [of a])
  30.467  apply (rule less_iff_diff_less_0 [of _ c, THEN ssubst])
  30.468  apply (simp add: diff_minus add_ac)
  30.469  done
  30.470  
  30.471 -lemma less_diff_eq: "a < c - b \<longleftrightarrow> a + b < c"
  30.472 +lemma less_diff_eq[algebra_simps]: "a < c - b \<longleftrightarrow> a + b < c"
  30.473  apply (subst less_iff_diff_less_0 [of "plus a b"])
  30.474  apply (subst less_iff_diff_less_0 [of a])
  30.475  apply (simp add: diff_minus add_ac)
  30.476  done
  30.477  
  30.478 -lemma diff_le_eq: "a - b \<le> c \<longleftrightarrow> a \<le> c + b"
  30.479 -  by (auto simp add: le_less diff_less_eq diff_add_cancel add_diff_cancel)
  30.480 -
  30.481 -lemma le_diff_eq: "a \<le> c - b \<longleftrightarrow> a + b \<le> c"
  30.482 -  by (auto simp add: le_less less_diff_eq diff_add_cancel add_diff_cancel)
  30.483 +lemma diff_le_eq[algebra_simps]: "a - b \<le> c \<longleftrightarrow> a \<le> c + b"
  30.484 +by (auto simp add: le_less diff_less_eq diff_add_cancel add_diff_cancel)
  30.485  
  30.486 -lemmas compare_rls =
  30.487 -       diff_minus [symmetric]
  30.488 -       add_diff_eq diff_add_eq diff_diff_eq diff_diff_eq2
  30.489 -       diff_less_eq less_diff_eq diff_le_eq le_diff_eq
  30.490 -       diff_eq_eq eq_diff_eq
  30.491 -
  30.492 -text{*This list of rewrites simplifies (in)equalities by bringing subtractions
  30.493 -  to the top and then moving negative terms to the other side.
  30.494 -  Use with @{text add_ac}*}
  30.495 -lemmas (in -) compare_rls =
  30.496 -       diff_minus [symmetric]
  30.497 -       add_diff_eq diff_add_eq diff_diff_eq diff_diff_eq2
  30.498 -       diff_less_eq less_diff_eq diff_le_eq le_diff_eq
  30.499 -       diff_eq_eq eq_diff_eq
  30.500 +lemma le_diff_eq[algebra_simps]: "a \<le> c - b \<longleftrightarrow> a + b \<le> c"
  30.501 +by (auto simp add: le_less less_diff_eq diff_add_cancel add_diff_cancel)
  30.502  
  30.503  lemma le_iff_diff_le_0: "a \<le> b \<longleftrightarrow> a - b \<le> 0"
  30.504 -  by (simp add: compare_rls)
  30.505 +by (simp add: algebra_simps)
  30.506  
  30.507 -lemmas group_simps =
  30.508 -  add_ac
  30.509 -  add_diff_eq diff_add_eq diff_diff_eq diff_diff_eq2
  30.510 -  diff_eq_eq eq_diff_eq diff_minus [symmetric] uminus_add_conv_diff
  30.511 -  diff_less_eq less_diff_eq diff_le_eq le_diff_eq
  30.512 +text{*Legacy - use @{text algebra_simps} *}
  30.513 +lemmas group_simps = algebra_simps
  30.514  
  30.515  end
  30.516  
  30.517 -lemmas group_simps =
  30.518 -  mult_ac
  30.519 -  add_ac
  30.520 -  add_diff_eq diff_add_eq diff_diff_eq diff_diff_eq2
  30.521 -  diff_eq_eq eq_diff_eq diff_minus [symmetric] uminus_add_conv_diff
  30.522 -  diff_less_eq less_diff_eq diff_le_eq le_diff_eq
  30.523 +text{*Legacy - use @{text algebra_simps} *}
  30.524 +lemmas group_simps = algebra_simps
  30.525  
  30.526  class ordered_ab_semigroup_add =
  30.527    linorder + pordered_ab_semigroup_add
  30.528 @@ -766,8 +737,7 @@
  30.529    unfolding neg_le_0_iff_le by simp
  30.530  
  30.531  lemma abs_of_nonneg [simp]:
  30.532 -  assumes nonneg: "0 \<le> a"
  30.533 -  shows "\<bar>a\<bar> = a"
  30.534 +  assumes nonneg: "0 \<le> a" shows "\<bar>a\<bar> = a"
  30.535  proof (rule antisym)
  30.536    from nonneg le_imp_neg_le have "- a \<le> 0" by simp
  30.537    from this nonneg have "- a \<le> a" by (rule order_trans)
  30.538 @@ -775,8 +745,8 @@
  30.539  qed (rule abs_ge_self)
  30.540  
  30.541  lemma abs_idempotent [simp]: "\<bar>\<bar>a\<bar>\<bar> = \<bar>a\<bar>"
  30.542 -  by (rule antisym)
  30.543 -    (auto intro!: abs_ge_self abs_leI order_trans [of "uminus (abs a)" zero "abs a"])
  30.544 +by (rule antisym)
  30.545 +   (auto intro!: abs_ge_self abs_leI order_trans [of "uminus (abs a)" zero "abs a"])
  30.546  
  30.547  lemma abs_eq_0 [simp]: "\<bar>a\<bar> = 0 \<longleftrightarrow> a = 0"
  30.548  proof -
  30.549 @@ -792,7 +762,7 @@
  30.550  qed
  30.551  
  30.552  lemma abs_zero [simp]: "\<bar>0\<bar> = 0"
  30.553 -  by simp
  30.554 +by simp
  30.555  
  30.556  lemma abs_0_eq [simp, noatp]: "0 = \<bar>a\<bar> \<longleftrightarrow> a = 0"
  30.557  proof -
  30.558 @@ -811,7 +781,7 @@
  30.559  qed
  30.560  
  30.561  lemma zero_less_abs_iff [simp]: "0 < \<bar>a\<bar> \<longleftrightarrow> a \<noteq> 0"
  30.562 -  by (simp add: less_le)
  30.563 +by (simp add: less_le)
  30.564  
  30.565  lemma abs_not_less_zero [simp]: "\<not> \<bar>a\<bar> < 0"
  30.566  proof -
  30.567 @@ -834,11 +804,10 @@
  30.568  qed
  30.569  
  30.570  lemma abs_of_pos: "0 < a \<Longrightarrow> \<bar>a\<bar> = a"
  30.571 -  by (rule abs_of_nonneg, rule less_imp_le)
  30.572 +by (rule abs_of_nonneg, rule less_imp_le)
  30.573  
  30.574  lemma abs_of_nonpos [simp]:
  30.575 -  assumes "a \<le> 0"
  30.576 -  shows "\<bar>a\<bar> = - a"
  30.577 +  assumes "a \<le> 0" shows "\<bar>a\<bar> = - a"
  30.578  proof -
  30.579    let ?b = "- a"
  30.580    have "- ?b \<le> 0 \<Longrightarrow> \<bar>- ?b\<bar> = - (- ?b)"
  30.581 @@ -849,24 +818,24 @@
  30.582  qed
  30.583    
  30.584  lemma abs_of_neg: "a < 0 \<Longrightarrow> \<bar>a\<bar> = - a"
  30.585 -  by (rule abs_of_nonpos, rule less_imp_le)
  30.586 +by (rule abs_of_nonpos, rule less_imp_le)
  30.587  
  30.588  lemma abs_le_D1: "\<bar>a\<bar> \<le> b \<Longrightarrow> a \<le> b"
  30.589 -  by (insert abs_ge_self, blast intro: order_trans)
  30.590 +by (insert abs_ge_self, blast intro: order_trans)
  30.591  
  30.592  lemma abs_le_D2: "\<bar>a\<bar> \<le> b \<Longrightarrow> - a \<le> b"
  30.593 -  by (insert abs_le_D1 [of "uminus a"], simp)
  30.594 +by (insert abs_le_D1 [of "uminus a"], simp)
  30.595  
  30.596  lemma abs_le_iff: "\<bar>a\<bar> \<le> b \<longleftrightarrow> a \<le> b \<and> - a \<le> b"
  30.597 -  by (blast intro: abs_leI dest: abs_le_D1 abs_le_D2)
  30.598 +by (blast intro: abs_leI dest: abs_le_D1 abs_le_D2)
  30.599  
  30.600  lemma abs_triangle_ineq2: "\<bar>a\<bar> - \<bar>b\<bar> \<le> \<bar>a - b\<bar>"
  30.601 -  apply (simp add: compare_rls)
  30.602 -  apply (subgoal_tac "abs a = abs (plus (minus a b) b)")
  30.603 +  apply (simp add: algebra_simps)
  30.604 +  apply (subgoal_tac "abs a = abs (plus b (minus a b))")
  30.605    apply (erule ssubst)
  30.606    apply (rule abs_triangle_ineq)
  30.607 -  apply (rule arg_cong) back
  30.608 -  apply (simp add: compare_rls)
  30.609 +  apply (rule arg_cong[of _ _ abs])
  30.610 +  apply (simp add: algebra_simps)
  30.611  done
  30.612  
  30.613  lemma abs_triangle_ineq3: "\<bar>\<bar>a\<bar> - \<bar>b\<bar>\<bar> \<le> \<bar>a - b\<bar>"
  30.614 @@ -879,12 +848,9 @@
  30.615  
  30.616  lemma abs_triangle_ineq4: "\<bar>a - b\<bar> \<le> \<bar>a\<bar> + \<bar>b\<bar>"
  30.617  proof -
  30.618 -  have "abs(a - b) = abs(a + - b)"
  30.619 -    by (subst diff_minus, rule refl)
  30.620 -  also have "... <= abs a + abs (- b)"
  30.621 -    by (rule abs_triangle_ineq)
  30.622 -  finally show ?thesis
  30.623 -    by simp
  30.624 +  have "abs(a - b) = abs(a + - b)" by (subst diff_minus, rule refl)
  30.625 +  also have "... <= abs a + abs (- b)" by (rule abs_triangle_ineq)
  30.626 +  finally show ?thesis by simp
  30.627  qed
  30.628  
  30.629  lemma abs_diff_triangle_ineq: "\<bar>a + b - (c + d)\<bar> \<le> \<bar>a - c\<bar> + \<bar>b - d\<bar>"
  30.630 @@ -999,23 +965,19 @@
  30.631  qed
  30.632  
  30.633  lemma neg_inf_eq_sup: "- inf a b = sup (-a) (-b)"
  30.634 -  by (simp add: inf_eq_neg_sup)
  30.635 +by (simp add: inf_eq_neg_sup)
  30.636  
  30.637  lemma neg_sup_eq_inf: "- sup a b = inf (-a) (-b)"
  30.638 -  by (simp add: sup_eq_neg_inf)
  30.639 +by (simp add: sup_eq_neg_inf)
  30.640  
  30.641  lemma add_eq_inf_sup: "a + b = sup a b + inf a b"
  30.642  proof -
  30.643    have "0 = - inf 0 (a-b) + inf (a-b) 0" by (simp add: inf_commute)
  30.644    hence "0 = sup 0 (b-a) + inf (a-b) 0" by (simp add: inf_eq_neg_sup)
  30.645    hence "0 = (-a + sup a b) + (inf a b + (-b))"
  30.646 -    apply (simp add: add_sup_distrib_left add_inf_distrib_right)
  30.647 -    by (simp add: diff_minus add_commute)
  30.648 -  thus ?thesis
  30.649 -    apply (simp add: compare_rls)
  30.650 -    apply (subst add_left_cancel [symmetric, of "plus a b" "plus (sup a b) (inf a b)" "uminus a"])
  30.651 -    apply (simp only: add_assoc, simp add: add_assoc[symmetric])
  30.652 -    done
  30.653 +    by (simp add: add_sup_distrib_left add_inf_distrib_right)
  30.654 +       (simp add: algebra_simps)
  30.655 +  thus ?thesis by (simp add: algebra_simps)
  30.656  qed
  30.657  
  30.658  subsection {* Positive Part, Negative Part, Absolute Value *}
  30.659 @@ -1044,13 +1006,13 @@
  30.660  qed
  30.661  
  30.662  lemma prts: "a = pprt a + nprt a"
  30.663 -  by (simp add: pprt_def nprt_def add_eq_inf_sup[symmetric])
  30.664 +by (simp add: pprt_def nprt_def add_eq_inf_sup[symmetric])
  30.665  
  30.666  lemma zero_le_pprt[simp]: "0 \<le> pprt a"
  30.667 -  by (simp add: pprt_def)
  30.668 +by (simp add: pprt_def)
  30.669  
  30.670  lemma nprt_le_zero[simp]: "nprt a \<le> 0"
  30.671 -  by (simp add: nprt_def)
  30.672 +by (simp add: nprt_def)
  30.673  
  30.674  lemma le_eq_neg: "a \<le> - b \<longleftrightarrow> a + b \<le> 0" (is "?l = ?r")
  30.675  proof -
  30.676 @@ -1071,16 +1033,16 @@
  30.677  lemma nprt_0[simp]: "nprt 0 = 0" by (simp add: nprt_def)
  30.678  
  30.679  lemma pprt_eq_id [simp, noatp]: "0 \<le> x \<Longrightarrow> pprt x = x"
  30.680 -  by (simp add: pprt_def le_iff_sup sup_ACI)
  30.681 +by (simp add: pprt_def le_iff_sup sup_ACI)
  30.682  
  30.683  lemma nprt_eq_id [simp, noatp]: "x \<le> 0 \<Longrightarrow> nprt x = x"
  30.684 -  by (simp add: nprt_def le_iff_inf inf_ACI)
  30.685 +by (simp add: nprt_def le_iff_inf inf_ACI)
  30.686  
  30.687  lemma pprt_eq_0 [simp, noatp]: "x \<le> 0 \<Longrightarrow> pprt x = 0"
  30.688 -  by (simp add: pprt_def le_iff_sup sup_ACI)
  30.689 +by (simp add: pprt_def le_iff_sup sup_ACI)
  30.690  
  30.691  lemma nprt_eq_0 [simp, noatp]: "0 \<le> x \<Longrightarrow> nprt x = 0"
  30.692 -  by (simp add: nprt_def le_iff_inf inf_ACI)
  30.693 +by (simp add: nprt_def le_iff_inf inf_ACI)
  30.694  
  30.695  lemma sup_0_imp_0: "sup a (- a) = 0 \<Longrightarrow> a = 0"
  30.696  proof -
  30.697 @@ -1105,10 +1067,10 @@
  30.698  done
  30.699  
  30.700  lemma inf_0_eq_0 [simp, noatp]: "inf a (- a) = 0 \<longleftrightarrow> a = 0"
  30.701 -  by (rule, erule inf_0_imp_0) simp
  30.702 +by (rule, erule inf_0_imp_0) simp
  30.703  
  30.704  lemma sup_0_eq_0 [simp, noatp]: "sup a (- a) = 0 \<longleftrightarrow> a = 0"
  30.705 -  by (rule, erule sup_0_imp_0) simp
  30.706 +by (rule, erule sup_0_imp_0) simp
  30.707  
  30.708  lemma zero_le_double_add_iff_zero_le_single_add [simp]:
  30.709    "0 \<le> a + a \<longleftrightarrow> 0 \<le> a"
  30.710 @@ -1190,22 +1152,22 @@
  30.711  qed
  30.712  
  30.713  lemma zero_le_iff_zero_nprt: "0 \<le> a \<longleftrightarrow> nprt a = 0"
  30.714 -  by (simp add: le_iff_inf nprt_def inf_commute)
  30.715 +by (simp add: le_iff_inf nprt_def inf_commute)
  30.716  
  30.717  lemma le_zero_iff_zero_pprt: "a \<le> 0 \<longleftrightarrow> pprt a = 0"
  30.718 -  by (simp add: le_iff_sup pprt_def sup_commute)
  30.719 +by (simp add: le_iff_sup pprt_def sup_commute)
  30.720  
  30.721  lemma le_zero_iff_pprt_id: "0 \<le> a \<longleftrightarrow> pprt a = a"
  30.722 -  by (simp add: le_iff_sup pprt_def sup_commute)
  30.723 +by (simp add: le_iff_sup pprt_def sup_commute)
  30.724  
  30.725  lemma zero_le_iff_nprt_id: "a \<le> 0 \<longleftrightarrow> nprt a = a"
  30.726 -  by (simp add: le_iff_inf nprt_def inf_commute)
  30.727 +by (simp add: le_iff_inf nprt_def inf_commute)
  30.728  
  30.729  lemma pprt_mono [simp, noatp]: "a \<le> b \<Longrightarrow> pprt a \<le> pprt b"
  30.730 -  by (simp add: le_iff_sup pprt_def sup_ACI sup_assoc [symmetric, of a])
  30.731 +by (simp add: le_iff_sup pprt_def sup_ACI sup_assoc [symmetric, of a])
  30.732  
  30.733  lemma nprt_mono [simp, noatp]: "a \<le> b \<Longrightarrow> nprt a \<le> nprt b"
  30.734 -  by (simp add: le_iff_inf nprt_def inf_ACI inf_assoc [symmetric, of a])
  30.735 +by (simp add: le_iff_inf nprt_def inf_ACI inf_assoc [symmetric, of a])
  30.736  
  30.737  end
  30.738  
  30.739 @@ -1246,12 +1208,10 @@
  30.740      show "0 \<le> \<bar>a\<bar>" by simp
  30.741    next
  30.742      fix a
  30.743 -    show "a \<le> \<bar>a\<bar>"
  30.744 -      by (auto simp add: abs_lattice)
  30.745 +    show "a \<le> \<bar>a\<bar>" by (auto simp add: abs_lattice)
  30.746    next
  30.747      fix a
  30.748 -    show "\<bar>-a\<bar> = \<bar>a\<bar>"
  30.749 -      by (simp add: abs_lattice sup_commute)
  30.750 +    show "\<bar>-a\<bar> = \<bar>a\<bar>" by (simp add: abs_lattice sup_commute)
  30.751    next
  30.752      fix a b
  30.753      show "a \<le> b \<Longrightarrow> - a \<le> b \<Longrightarrow> \<bar>a\<bar> \<le> b" by (erule abs_leI)
  30.754 @@ -1266,8 +1226,7 @@
  30.755        have c:"?n <= sup ?m ?n" by (simp)
  30.756        from b c have d: "-a-b <= sup ?m ?n" by(rule order_trans)
  30.757        have e:"-a-b = -(a+b)" by (simp add: diff_minus)
  30.758 -      from a d e have "abs(a+b) <= sup ?m ?n" 
  30.759 -        by (drule_tac abs_leI, auto)
  30.760 +      from a d e have "abs(a+b) <= sup ?m ?n" by (drule_tac abs_leI, auto)
  30.761        with g[symmetric] show ?thesis by simp
  30.762      qed
  30.763    qed auto
  30.764 @@ -1287,7 +1246,7 @@
  30.765  lemma abs_if_lattice:
  30.766    fixes a :: "'a\<Colon>{lordered_ab_group_add_abs, linorder}"
  30.767    shows "\<bar>a\<bar> = (if a < 0 then - a else a)"
  30.768 -  by auto
  30.769 +by auto
  30.770  
  30.771  
  30.772  text {* Needed for abelian cancellation simprocs: *}
  30.773 @@ -1333,7 +1292,7 @@
  30.774    "a + b <= (c::'a::lordered_ab_group_add_abs) \<Longrightarrow> a <= c + abs b" 
  30.775  proof -
  30.776    assume "a+b <= c"
  30.777 -  hence 2: "a <= c+(-b)" by (simp add: group_simps)
  30.778 +  hence 2: "a <= c+(-b)" by (simp add: algebra_simps)
  30.779    have 3: "(-b) <= abs b" by (rule abs_ge_minus_self)
  30.780    show ?thesis by (rule le_add_right_mono[OF 2 3])
  30.781  qed
    31.1 --- a/src/HOL/PReal.thy	Sun Jan 18 13:58:17 2009 +0100
    31.2 +++ b/src/HOL/PReal.thy	Wed Jan 28 16:29:16 2009 +0100
    31.3 @@ -718,7 +718,7 @@
    31.4      case (Suc k)
    31.5        from this obtain b where "b \<in> A" "b + of_nat k * u \<in> A" ..
    31.6        hence "b + of_int (int k)*u + u \<in> A" by (simp add: prems)
    31.7 -      thus ?case by (force simp add: left_distrib add_ac prems) 
    31.8 +      thus ?case by (force simp add: algebra_simps prems) 
    31.9    qed
   31.10  next
   31.11    case (neg n)
   31.12 @@ -815,7 +815,7 @@
   31.13      proof -
   31.14        have "r + ?d < r + (r * ?d)/y" by (simp add: dless)
   31.15        also with ypos have "... = (r/y) * (y + ?d)"
   31.16 -	by (simp only: right_distrib divide_inverse mult_ac, simp)
   31.17 +	by (simp only: algebra_simps divide_inverse, simp)
   31.18        also have "... = r*x" using ypos
   31.19  	by (simp add: times_divide_eq_left) 
   31.20        finally show "r + ?d < r*x" .
    32.1 --- a/src/HOL/Polynomial.thy	Sun Jan 18 13:58:17 2009 +0100
    32.2 +++ b/src/HOL/Polynomial.thy	Wed Jan 28 16:29:16 2009 +0100
    32.3 @@ -442,11 +442,11 @@
    32.4  
    32.5  lemma smult_add_right:
    32.6    "smult a (p + q) = smult a p + smult a q"
    32.7 -  by (rule poly_ext, simp add: ring_simps)
    32.8 +  by (rule poly_ext, simp add: algebra_simps)
    32.9  
   32.10  lemma smult_add_left:
   32.11    "smult (a + b) p = smult a p + smult b p"
   32.12 -  by (rule poly_ext, simp add: ring_simps)
   32.13 +  by (rule poly_ext, simp add: algebra_simps)
   32.14  
   32.15  lemma smult_minus_right [simp]:
   32.16    "smult (a::'a::comm_ring) (- p) = - smult a p"
   32.17 @@ -458,11 +458,11 @@
   32.18  
   32.19  lemma smult_diff_right:
   32.20    "smult (a::'a::comm_ring) (p - q) = smult a p - smult a q"
   32.21 -  by (rule poly_ext, simp add: ring_simps)
   32.22 +  by (rule poly_ext, simp add: algebra_simps)
   32.23  
   32.24  lemma smult_diff_left:
   32.25    "smult (a - b::'a::comm_ring) p = smult a p - smult b p"
   32.26 -  by (rule poly_ext, simp add: ring_simps)
   32.27 +  by (rule poly_ext, simp add: algebra_simps)
   32.28  
   32.29  lemmas smult_distribs =
   32.30    smult_add_left smult_add_right
   32.31 @@ -517,7 +517,7 @@
   32.32  
   32.33  lemma mult_pCons_right [simp]:
   32.34    "p * pCons a q = smult a p + pCons 0 (p * q)"
   32.35 -  by (induct p, simp add: mult_poly_0_left, simp add: ring_simps)
   32.36 +  by (induct p, simp add: mult_poly_0_left, simp add: algebra_simps)
   32.37  
   32.38  lemmas mult_poly_0 = mult_poly_0_left mult_poly_0_right
   32.39  
   32.40 @@ -531,7 +531,7 @@
   32.41    fixes p q r :: "'a poly"
   32.42    shows "(p + q) * r = p * r + q * r"
   32.43    by (induct r, simp add: mult_poly_0,
   32.44 -                simp add: smult_distribs group_simps)
   32.45 +                simp add: smult_distribs algebra_simps)
   32.46  
   32.47  instance proof
   32.48    fix p q r :: "'a poly"
   32.49 @@ -758,7 +758,7 @@
   32.50    from 2 have q2: "x = q2 * y + r2" and r2: "r2 = 0 \<or> degree r2 < degree y"
   32.51      unfolding pdivmod_rel_def by simp_all
   32.52    from q1 q2 have q3: "(q1 - q2) * y = r2 - r1"
   32.53 -    by (simp add: ring_simps)
   32.54 +    by (simp add: algebra_simps)
   32.55    from r1 r2 have r3: "(r2 - r1) = 0 \<or> degree (r2 - r1) < degree y"
   32.56      by (auto intro: degree_diff_less)
   32.57  
   32.58 @@ -894,7 +894,7 @@
   32.59  
   32.60  lemma poly_add [simp]: "poly (p + q) x = poly p x + poly q x"
   32.61    apply (induct p arbitrary: q, simp)
   32.62 -  apply (case_tac q, simp, simp add: ring_simps)
   32.63 +  apply (case_tac q, simp, simp add: algebra_simps)
   32.64    done
   32.65  
   32.66  lemma poly_minus [simp]:
   32.67 @@ -911,10 +911,10 @@
   32.68    by (cases "finite A", induct set: finite, simp_all)
   32.69  
   32.70  lemma poly_smult [simp]: "poly (smult a p) x = a * poly p x"
   32.71 -  by (induct p, simp, simp add: ring_simps)
   32.72 +  by (induct p, simp, simp add: algebra_simps)
   32.73  
   32.74  lemma poly_mult [simp]: "poly (p * q) x = poly p x * poly q x"
   32.75 -  by (induct p, simp_all, simp add: ring_simps)
   32.76 +  by (induct p, simp_all, simp add: algebra_simps)
   32.77  
   32.78  lemma poly_power [simp]:
   32.79    fixes p :: "'a::{comm_semiring_1,recpower} poly"
   32.80 @@ -983,7 +983,7 @@
   32.81    fixes c :: "'a::comm_ring_1"
   32.82    shows "[:-c, 1:] * synthetic_div p c + [:poly p c:] = p"
   32.83    using synthetic_div_correct [of p c]
   32.84 -  by (simp add: group_simps)
   32.85 +  by (simp add: algebra_simps)
   32.86  
   32.87  lemma poly_eq_0_iff_dvd:
   32.88    fixes c :: "'a::idom"
    33.1 --- a/src/HOL/Presburger.thy	Sun Jan 18 13:58:17 2009 +0100
    33.2 +++ b/src/HOL/Presburger.thy	Wed Jan 28 16:29:16 2009 +0100
    33.3 @@ -59,7 +59,7 @@
    33.4    "(d::'a::{comm_ring,Ring_and_Field.dvd}) dvd D \<Longrightarrow> \<forall>x k. (d dvd x + t) = (d dvd (x - k*D) + t)"
    33.5    "(d::'a::{comm_ring,Ring_and_Field.dvd}) dvd D \<Longrightarrow> \<forall>x k. (\<not>d dvd x + t) = (\<not>d dvd (x - k*D) + t)"
    33.6    "\<forall>x k. F = F"
    33.7 -apply (auto elim!: dvdE simp add: ring_simps)
    33.8 +apply (auto elim!: dvdE simp add: algebra_simps)
    33.9  unfolding mult_assoc [symmetric] left_distrib [symmetric] left_diff_distrib [symmetric]
   33.10  unfolding dvd_def mult_commute [of d] 
   33.11  by auto
   33.12 @@ -101,7 +101,7 @@
   33.13    {fix x assume nob: "\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j" and g: "x > t" and ng: "\<not> (x - D) > t"
   33.14      hence "x -t \<le> D" and "1 \<le> x - t" by simp+
   33.15        hence "\<exists>j \<in> {1 .. D}. x - t = j" by auto
   33.16 -      hence "\<exists>j \<in> {1 .. D}. x = t + j" by (simp add: ring_simps)
   33.17 +      hence "\<exists>j \<in> {1 .. D}. x = t + j" by (simp add: algebra_simps)
   33.18        with nob tB have "False" by simp}
   33.19    thus "\<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j)\<longrightarrow> (x > t) \<longrightarrow> (x - D > t)" by blast
   33.20  next
   33.21 @@ -109,7 +109,7 @@
   33.22    {fix x assume nob: "\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j" and g: "x \<ge> t" and ng: "\<not> (x - D) \<ge> t"
   33.23      hence "x - (t - 1) \<le> D" and "1 \<le> x - (t - 1)" by simp+
   33.24        hence "\<exists>j \<in> {1 .. D}. x - (t - 1) = j" by auto
   33.25 -      hence "\<exists>j \<in> {1 .. D}. x = (t - 1) + j" by (simp add: ring_simps)
   33.26 +      hence "\<exists>j \<in> {1 .. D}. x = (t - 1) + j" by (simp add: algebra_simps)
   33.27        with nob tB have "False" by simp}
   33.28    thus "\<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j)\<longrightarrow> (x \<ge> t) \<longrightarrow> (x - D \<ge> t)" by blast
   33.29  next
   33.30 @@ -119,7 +119,7 @@
   33.31  next
   33.32    assume d: "d dvd D"
   33.33    {fix x assume H: "\<not>(d dvd x + t)" with d have "\<not> d dvd (x - D) + t"
   33.34 -      by (clarsimp simp add: dvd_def,erule_tac x= "ka + k" in allE,simp add: ring_simps)}
   33.35 +      by (clarsimp simp add: dvd_def,erule_tac x= "ka + k" in allE,simp add: algebra_simps)}
   33.36    thus "\<forall>(x::int).(\<forall>j\<in>{1 .. D}. \<forall>b\<in>B. x \<noteq> b + j)\<longrightarrow> (\<not>d dvd x+t) \<longrightarrow> (\<not>d dvd (x - D) + t)" by auto
   33.37  qed blast
   33.38  
   33.39 @@ -158,26 +158,26 @@
   33.40    {fix x assume nob: "\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j" and g: "x < t" and ng: "\<not> (x + D) < t"
   33.41      hence "t - x \<le> D" and "1 \<le> t - x" by simp+
   33.42        hence "\<exists>j \<in> {1 .. D}. t - x = j" by auto
   33.43 -      hence "\<exists>j \<in> {1 .. D}. x = t - j" by (auto simp add: ring_simps) 
   33.44 +      hence "\<exists>j \<in> {1 .. D}. x = t - j" by (auto simp add: algebra_simps) 
   33.45        with nob tA have "False" by simp}
   33.46    thus "\<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j)\<longrightarrow> (x < t) \<longrightarrow> (x + D < t)" by blast
   33.47  next
   33.48    assume dp: "D > 0" and tA:"t + 1\<in> A"
   33.49    {fix x assume nob: "\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j" and g: "x \<le> t" and ng: "\<not> (x + D) \<le> t"
   33.50 -    hence "(t + 1) - x \<le> D" and "1 \<le> (t + 1) - x" by (simp_all add: ring_simps)
   33.51 +    hence "(t + 1) - x \<le> D" and "1 \<le> (t + 1) - x" by (simp_all add: algebra_simps)
   33.52        hence "\<exists>j \<in> {1 .. D}. (t + 1) - x = j" by auto
   33.53 -      hence "\<exists>j \<in> {1 .. D}. x = (t + 1) - j" by (auto simp add: ring_simps)
   33.54 +      hence "\<exists>j \<in> {1 .. D}. x = (t + 1) - j" by (auto simp add: algebra_simps)
   33.55        with nob tA have "False" by simp}
   33.56    thus "\<forall>x.(\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j)\<longrightarrow> (x \<le> t) \<longrightarrow> (x + D \<le> t)" by blast
   33.57  next
   33.58    assume d: "d dvd D"
   33.59    {fix x assume H: "d dvd x + t" with d have "d dvd (x + D) + t"
   33.60 -      by (clarsimp simp add: dvd_def,rule_tac x= "ka + k" in exI,simp add: ring_simps)}
   33.61 +      by (clarsimp simp add: dvd_def,rule_tac x= "ka + k" in exI,simp add: algebra_simps)}
   33.62    thus "\<forall>(x::int).(\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j)\<longrightarrow> (d dvd x+t) \<longrightarrow> (d dvd (x + D) + t)" by simp
   33.63  next
   33.64    assume d: "d dvd D"
   33.65    {fix x assume H: "\<not>(d dvd x + t)" with d have "\<not>d dvd (x + D) + t"
   33.66 -      by (clarsimp simp add: dvd_def,erule_tac x= "ka - k" in allE,simp add: ring_simps)}
   33.67 +      by (clarsimp simp add: dvd_def,erule_tac x= "ka - k" in allE,simp add: algebra_simps)}
   33.68    thus "\<forall>(x::int).(\<forall>j\<in>{1 .. D}. \<forall>b\<in>A. x \<noteq> b - j)\<longrightarrow> (\<not>d dvd x+t) \<longrightarrow> (\<not>d dvd (x + D) + t)" by auto
   33.69  qed blast
   33.70  
   33.71 @@ -304,7 +304,7 @@
   33.72    from ePeqP1 obtain z where P1eqP: "\<forall>x>z. P x = P' x" ..
   33.73    let ?w' = "x + (abs(x-z)+1) * d"
   33.74    let ?w = "x - (-(abs(x-z) + 1))*d"
   33.75 -  have ww'[simp]: "?w = ?w'" by (simp add: ring_simps)
   33.76 +  have ww'[simp]: "?w = ?w'" by (simp add: algebra_simps)
   33.77    from dpos have w: "?w > z" by(simp only: ww' incr_lemma)
   33.78    hence "P' x = P' ?w" using P1eqP1 by blast
   33.79    also have "\<dots> = P(?w)" using w P1eqP by blast
    34.1 --- a/src/HOL/RComplete.thy	Sun Jan 18 13:58:17 2009 +0100
    34.2 +++ b/src/HOL/RComplete.thy	Wed Jan 28 16:29:16 2009 +0100
    34.3 @@ -376,7 +376,7 @@
    34.4    hence "real (Suc n) * (inverse (real (Suc n)) * x) < real (Suc n) * 1"
    34.5      by (rule mult_strict_left_mono) simp
    34.6    hence "x < real (Suc n)"
    34.7 -    by (simp add: ring_simps)
    34.8 +    by (simp add: algebra_simps)
    34.9    thus "\<exists>(n::nat). x < real n" ..
   34.10  qed
   34.11  
   34.12 @@ -391,9 +391,9 @@
   34.13    hence "y * inverse x * x < real n * x"
   34.14      using x_greater_zero by (simp add: mult_strict_right_mono)
   34.15    hence "x * inverse x * y < x * real n"
   34.16 -    by (simp add: ring_simps)
   34.17 +    by (simp add: algebra_simps)
   34.18    hence "y < real (n::nat) * x"
   34.19 -    using x_not_zero by (simp add: ring_simps)
   34.20 +    using x_not_zero by (simp add: algebra_simps)
   34.21    thus "\<exists>(n::nat). y < real n * x" ..
   34.22  qed
   34.23  
   34.24 @@ -1084,9 +1084,7 @@
   34.25  done
   34.26  
   34.27  lemma real_natfloor_gt_diff_one: "x - 1 < real(natfloor x)"
   34.28 -  apply (simp add: compare_rls)
   34.29 -  apply (rule real_natfloor_add_one_gt)
   34.30 -done
   34.31 +using real_natfloor_add_one_gt by (simp add: algebra_simps)
   34.32  
   34.33  lemma ge_natfloor_plus_one_imp_gt: "natfloor z + 1 <= n ==> z < real n"
   34.34    apply (subgoal_tac "z < real(natfloor z) + 1")
   34.35 @@ -1279,7 +1277,7 @@
   34.36      by simp
   34.37    also have "... = real((natfloor x) div y) + real((natfloor x) mod y) /
   34.38      real y + (x - real(natfloor x)) / real y"
   34.39 -    by (auto simp add: ring_simps add_divide_distrib
   34.40 +    by (auto simp add: algebra_simps add_divide_distrib
   34.41        diff_divide_distrib prems)
   34.42    finally have "natfloor (x / real y) = natfloor(...)" by simp
   34.43    also have "... = natfloor(real((natfloor x) mod y) /
   34.44 @@ -1293,7 +1291,7 @@
   34.45      apply simp
   34.46      apply (simp add: prems)
   34.47      apply (rule divide_nonneg_pos)
   34.48 -    apply (simp add: compare_rls)
   34.49 +    apply (simp add: algebra_simps)
   34.50      apply (rule real_natfloor_le)
   34.51      apply (insert prems, auto)
   34.52      done
   34.53 @@ -1306,7 +1304,7 @@
   34.54      apply force
   34.55      apply (force simp add: prems)
   34.56      apply (rule divide_nonneg_pos)
   34.57 -    apply (simp add: compare_rls)
   34.58 +    apply (simp add: algebra_simps)
   34.59      apply (rule real_natfloor_le)
   34.60      apply (auto simp add: prems)
   34.61      apply (insert prems, arith)
   34.62 @@ -1314,8 +1312,8 @@
   34.63      apply (subgoal_tac "real y = real y - 1 + 1")
   34.64      apply (erule ssubst)
   34.65      apply (rule add_le_less_mono)
   34.66 -    apply (simp add: compare_rls)
   34.67 -    apply (subgoal_tac "real(natfloor x mod y) + 1 =
   34.68 +    apply (simp add: algebra_simps)
   34.69 +    apply (subgoal_tac "1 + real(natfloor x mod y) =
   34.70        real(natfloor x mod y + 1)")
   34.71      apply (erule ssubst)
   34.72      apply (subst real_of_nat_le_iff)
   34.73 @@ -1323,9 +1321,8 @@
   34.74      apply arith
   34.75      apply (rule mod_less_divisor)
   34.76      apply auto
   34.77 -    apply (simp add: compare_rls)
   34.78 -    apply (subst add_commute)
   34.79 -    apply (rule real_natfloor_add_one_gt)
   34.80 +    using real_natfloor_add_one_gt
   34.81 +    apply (simp add: algebra_simps)
   34.82      done
   34.83    finally show ?thesis by simp
   34.84  qed
    35.1 --- a/src/HOL/Rational.thy	Sun Jan 18 13:58:17 2009 +0100
    35.2 +++ b/src/HOL/Rational.thy	Wed Jan 28 16:29:16 2009 +0100
    35.3 @@ -172,7 +172,7 @@
    35.4      by (cases q) (simp add: One_rat_def eq_rat)
    35.5  next
    35.6    fix q r s :: rat show "(q + r) + s = q + (r + s)"
    35.7 -    by (cases q, cases r, cases s) (simp add: eq_rat ring_simps)
    35.8 +    by (cases q, cases r, cases s) (simp add: eq_rat algebra_simps)
    35.9  next
   35.10    fix q r :: rat show "q + r = r + q"
   35.11      by (cases q, cases r) (simp add: eq_rat)
   35.12 @@ -187,7 +187,7 @@
   35.13      by (cases q, cases r) (simp add: eq_rat)
   35.14  next
   35.15    fix q r s :: rat show "(q + r) * s = q * s + r * s"
   35.16 -    by (cases q, cases r, cases s) (simp add: eq_rat ring_simps)
   35.17 +    by (cases q, cases r, cases s) (simp add: eq_rat algebra_simps)
   35.18  next
   35.19    show "(0::rat) \<noteq> 1" by (simp add: Zero_rat_def One_rat_def eq_rat)
   35.20  next
    36.1 --- a/src/HOL/RealDef.thy	Sun Jan 18 13:58:17 2009 +0100
    36.2 +++ b/src/HOL/RealDef.thy	Wed Jan 28 16:29:16 2009 +0100
    36.3 @@ -202,18 +202,17 @@
    36.4  
    36.5  lemma real_mult_assoc: "((z1::real) * z2) * z3 = z1 * (z2 * z3)"
    36.6  apply (cases z1, cases z2, cases z3)
    36.7 -apply (simp add: real_mult right_distrib add_ac mult_ac)
    36.8 +apply (simp add: real_mult algebra_simps)
    36.9  done
   36.10  
   36.11  lemma real_mult_1: "(1::real) * z = z"
   36.12  apply (cases z)
   36.13 -apply (simp add: real_mult real_one_def right_distrib
   36.14 -                  mult_1_right mult_ac add_ac)
   36.15 +apply (simp add: real_mult real_one_def algebra_simps)
   36.16  done
   36.17  
   36.18  lemma real_add_mult_distrib: "((z1::real) + z2) * w = (z1 * w) + (z2 * w)"
   36.19  apply (cases z1, cases z2, cases w)
   36.20 -apply (simp add: real_add real_mult right_distrib add_ac mult_ac)
   36.21 +apply (simp add: real_add real_mult algebra_simps)
   36.22  done
   36.23  
   36.24  text{*one and zero are distinct*}
   36.25 @@ -253,7 +252,7 @@
   36.26  apply (rule_tac [2]
   36.27          x = "Abs_Real (realrel``{(inverse (D) + 1, 1)})" 
   36.28         in exI)
   36.29 -apply (auto simp add: real_mult preal_mult_inverse_right ring_simps)
   36.30 +apply (auto simp add: real_mult preal_mult_inverse_right algebra_simps)
   36.31  done
   36.32  
   36.33  lemma real_mult_inverse_left: "x \<noteq> 0 ==> inverse(x)*x = (1::real)"
   36.34 @@ -373,7 +372,7 @@
   36.35    assumes le: "x \<le> y" shows "z + x \<le> z + (y::real)"
   36.36  proof -
   36.37    have "z + x - (z + y) = (z + -z) + (x - y)" 
   36.38 -    by (simp add: diff_minus add_ac) 
   36.39 +    by (simp add: algebra_simps) 
   36.40    with le show ?thesis 
   36.41      by (simp add: real_le_eq_diff[of x] real_le_eq_diff[of "z+x"] diff_minus)
   36.42  qed
   36.43 @@ -391,8 +390,7 @@
   36.44                    real_zero_def real_le real_mult)
   36.45    --{*Reduce to the (simpler) @{text "\<le>"} relation *}
   36.46  apply (auto dest!: less_add_left_Ex
   36.47 -     simp add: add_ac mult_ac
   36.48 -          right_distrib preal_self_less_add_left)
   36.49 +     simp add: algebra_simps preal_self_less_add_left)
   36.50  done
   36.51  
   36.52  lemma real_mult_less_mono2: "[| (0::real) < z; x < y |] ==> z * x < z * y"
   36.53 @@ -437,11 +435,11 @@
   36.54  
   36.55  lemma real_of_preal_add:
   36.56       "real_of_preal ((x::preal) + y) = real_of_preal x + real_of_preal y"
   36.57 -by (simp add: real_of_preal_def real_add left_distrib add_ac)
   36.58 +by (simp add: real_of_preal_def real_add algebra_simps)
   36.59  
   36.60  lemma real_of_preal_mult:
   36.61       "real_of_preal ((x::preal) * y) = real_of_preal x* real_of_preal y"
   36.62 -by (simp add: real_of_preal_def real_mult right_distrib add_ac mult_ac)
   36.63 +by (simp add: real_of_preal_def real_mult algebra_simps)
   36.64  
   36.65  
   36.66  text{*Gleason prop 9-4.4 p 127*}
   36.67 @@ -650,7 +648,7 @@
   36.68    then have "real x / real d = ... / real d"
   36.69      by simp
   36.70    then show ?thesis
   36.71 -    by (auto simp add: add_divide_distrib ring_simps prems)
   36.72 +    by (auto simp add: add_divide_distrib algebra_simps prems)
   36.73  qed
   36.74  
   36.75  lemma real_of_int_div: "(d::int) ~= 0 ==> d dvd n ==>
   36.76 @@ -665,13 +663,13 @@
   36.77    apply (case_tac "x = 0")
   36.78    apply simp
   36.79    apply (case_tac "0 < x")
   36.80 -  apply (simp add: compare_rls)
   36.81 +  apply (simp add: algebra_simps)
   36.82    apply (subst real_of_int_div_aux)
   36.83    apply simp
   36.84    apply simp
   36.85    apply (subst zero_le_divide_iff)
   36.86    apply auto
   36.87 -  apply (simp add: compare_rls)
   36.88 +  apply (simp add: algebra_simps)
   36.89    apply (subst real_of_int_div_aux)
   36.90    apply simp
   36.91    apply simp
   36.92 @@ -683,7 +681,7 @@
   36.93    "real (n::int) / real (x) - real (n div x) <= 1"
   36.94    apply(case_tac "x = 0")
   36.95    apply simp
   36.96 -  apply (simp add: compare_rls)
   36.97 +  apply (simp add: algebra_simps)
   36.98    apply (subst real_of_int_div_aux)
   36.99    apply assumption
  36.100    apply simp
  36.101 @@ -795,7 +793,7 @@
  36.102    then have "real x / real d = \<dots> / real d"
  36.103      by simp
  36.104    then show ?thesis
  36.105 -    by (auto simp add: add_divide_distrib ring_simps prems)
  36.106 +    by (auto simp add: add_divide_distrib algebra_simps prems)
  36.107  qed
  36.108  
  36.109  lemma real_of_nat_div: "0 < (d::nat) ==> d dvd n ==>
  36.110 @@ -810,7 +808,7 @@
  36.111    "0 <= real (n::nat) / real (x) - real (n div x)"
  36.112  apply(case_tac "x = 0")
  36.113   apply (simp)
  36.114 -apply (simp add: compare_rls)
  36.115 +apply (simp add: algebra_simps)
  36.116  apply (subst real_of_nat_div_aux)
  36.117   apply simp
  36.118  apply simp
  36.119 @@ -822,14 +820,14 @@
  36.120    "real (n::nat) / real (x) - real (n div x) <= 1"
  36.121  apply(case_tac "x = 0")
  36.122  apply (simp)
  36.123 -apply (simp add: compare_rls)
  36.124 +apply (simp add: algebra_simps)
  36.125  apply (subst real_of_nat_div_aux)
  36.126   apply simp
  36.127  apply simp
  36.128  done
  36.129  
  36.130  lemma real_of_nat_div4: "real (n div x) <= real (n::nat) / real x" 
  36.131 -  by (insert real_of_nat_div2 [of n x], simp)
  36.132 +by (insert real_of_nat_div2 [of n x], simp)
  36.133  
  36.134  lemma real_of_int_real_of_nat: "real (int n) = real n"
  36.135  by (simp add: real_of_nat_def real_of_int_def int_eq_of_nat)
    37.1 --- a/src/HOL/RealPow.thy	Sun Jan 18 13:58:17 2009 +0100
    37.2 +++ b/src/HOL/RealPow.thy	Wed Jan 28 16:29:16 2009 +0100
    37.3 @@ -58,7 +58,7 @@
    37.4  lemma realpow_two_diff:
    37.5       "(x::real)^Suc (Suc 0) - y^Suc (Suc 0) = (x - y) * (x + y)"
    37.6  apply (unfold real_diff_def)
    37.7 -apply (simp add: ring_simps)
    37.8 +apply (simp add: algebra_simps)
    37.9  done
   37.10  
   37.11  lemma realpow_two_disj:
    38.1 --- a/src/HOL/Ring_and_Field.thy	Sun Jan 18 13:58:17 2009 +0100
    38.2 +++ b/src/HOL/Ring_and_Field.thy	Wed Jan 28 16:29:16 2009 +0100
    38.3 @@ -24,14 +24,14 @@
    38.4  *}
    38.5  
    38.6  class semiring = ab_semigroup_add + semigroup_mult +
    38.7 -  assumes left_distrib: "(a + b) * c = a * c + b * c"
    38.8 -  assumes right_distrib: "a * (b + c) = a * b + a * c"
    38.9 +  assumes left_distrib[algebra_simps]: "(a + b) * c = a * c + b * c"
   38.10 +  assumes right_distrib[algebra_simps]: "a * (b + c) = a * b + a * c"
   38.11  begin
   38.12  
   38.13  text{*For the @{text combine_numerals} simproc*}
   38.14  lemma combine_common_factor:
   38.15    "a * e + (b * e + c) = (a + b) * e + c"
   38.16 -  by (simp add: left_distrib add_ac)
   38.17 +by (simp add: left_distrib add_ac)
   38.18  
   38.19  end
   38.20  
   38.21 @@ -47,16 +47,12 @@
   38.22  subclass semiring_0
   38.23  proof
   38.24    fix a :: 'a
   38.25 -  have "0 * a + 0 * a = 0 * a + 0"
   38.26 -    by (simp add: left_distrib [symmetric])
   38.27 -  thus "0 * a = 0"
   38.28 -    by (simp only: add_left_cancel)
   38.29 +  have "0 * a + 0 * a = 0 * a + 0" by (simp add: left_distrib [symmetric])
   38.30 +  thus "0 * a = 0" by (simp only: add_left_cancel)
   38.31  next
   38.32    fix a :: 'a
   38.33 -  have "a * 0 + a * 0 = a * 0 + 0"
   38.34 -    by (simp add: right_distrib [symmetric])
   38.35 -  thus "a * 0 = 0"
   38.36 -    by (simp only: add_left_cancel)
   38.37 +  have "a * 0 + a * 0 = a * 0 + 0" by (simp add: right_distrib [symmetric])
   38.38 +  thus "a * 0 = 0" by (simp only: add_left_cancel)
   38.39  qed
   38.40  
   38.41  end
   38.42 @@ -98,7 +94,7 @@
   38.43  begin
   38.44  
   38.45  lemma one_neq_zero [simp]: "1 \<noteq> 0"
   38.46 -  by (rule not_sym) (rule zero_neq_one)
   38.47 +by (rule not_sym) (rule zero_neq_one)
   38.48  
   38.49  end
   38.50  
   38.51 @@ -142,7 +138,7 @@
   38.52  qed
   38.53  
   38.54  lemma dvd_0_left_iff [noatp, simp]: "0 dvd a \<longleftrightarrow> a = 0"
   38.55 -  by (auto intro: dvd_refl elim!: dvdE)
   38.56 +by (auto intro: dvd_refl elim!: dvdE)
   38.57  
   38.58  lemma dvd_0_right [iff]: "a dvd 0"
   38.59  proof
   38.60 @@ -150,10 +146,10 @@
   38.61  qed
   38.62  
   38.63  lemma one_dvd [simp]: "1 dvd a"
   38.64 -  by (auto intro!: dvdI)
   38.65 +by (auto intro!: dvdI)
   38.66  
   38.67  lemma dvd_mult: "a dvd c \<Longrightarrow> a dvd (b * c)"
   38.68 -  by (auto intro!: mult_left_commute dvdI elim!: dvdE)
   38.69 +by (auto intro!: mult_left_commute dvdI elim!: dvdE)
   38.70  
   38.71  lemma dvd_mult2: "a dvd b \<Longrightarrow> a dvd (b * c)"
   38.72    apply (subst mult_commute)
   38.73 @@ -161,10 +157,10 @@
   38.74    done
   38.75  
   38.76  lemma dvd_triv_right [simp]: "a dvd b * a"
   38.77 -  by (rule dvd_mult) (rule dvd_refl)
   38.78 +by (rule dvd_mult) (rule dvd_refl)
   38.79  
   38.80  lemma dvd_triv_left [simp]: "a dvd a * b"
   38.81 -  by (rule dvd_mult2) (rule dvd_refl)
   38.82 +by (rule dvd_mult2) (rule dvd_refl)
   38.83  
   38.84  lemma mult_dvd_mono:
   38.85    assumes ab: "a dvd b"
   38.86 @@ -178,13 +174,13 @@
   38.87  qed
   38.88  
   38.89  lemma dvd_mult_left: "a * b dvd c \<Longrightarrow> a dvd c"
   38.90 -  by (simp add: dvd_def mult_assoc, blast)
   38.91 +by (simp add: dvd_def mult_assoc, blast)
   38.92  
   38.93  lemma dvd_mult_right: "a * b dvd c \<Longrightarrow> b dvd c"
   38.94    unfolding mult_ac [of a] by (rule dvd_mult_left)
   38.95  
   38.96  lemma dvd_0_left: "0 dvd a \<Longrightarrow> a = 0"
   38.97 -  by simp
   38.98 +by simp
   38.99  
  38.100  lemma dvd_add:
  38.101    assumes ab: "a dvd b"
  38.102 @@ -230,43 +226,40 @@
  38.103  text {* Distribution rules *}
  38.104  
  38.105  lemma minus_mult_left: "- (a * b) = - a * b"
  38.106 -  by (rule equals_zero_I) (simp add: left_distrib [symmetric]) 
  38.107 +by (rule equals_zero_I) (simp add: left_distrib [symmetric]) 
  38.108  
  38.109  lemma minus_mult_right: "- (a * b) = a * - b"
  38.110 -  by (rule equals_zero_I) (simp add: right_distrib [symmetric]) 
  38.111 +by (rule equals_zero_I) (simp add: right_distrib [symmetric]) 
  38.112  
  38.113  text{*Extract signs from products*}
  38.114  lemmas mult_minus_left [simp] = minus_mult_left [symmetric]
  38.115  lemmas mult_minus_right [simp] = minus_mult_right [symmetric]
  38.116  
  38.117  lemma minus_mult_minus [simp]: "- a * - b = a * b"
  38.118 -  by simp
  38.119 +by simp
  38.120  
  38.121  lemma minus_mult_commute: "- a * b = a * - b"
  38.122 -  by simp
  38.123 -
  38.124 -lemma right_diff_distrib: "a * (b - c) = a * b - a * c"
  38.125 -  by (simp add: right_distrib diff_minus)
  38.126 -
  38.127 -lemma left_diff_distrib: "(a - b) * c = a * c - b * c"
  38.128 -  by (simp add: left_distrib diff_minus)
  38.129 +by simp
  38.130 +
  38.131 +lemma right_diff_distrib[algebra_simps]: "a * (b - c) = a * b - a * c"
  38.132 +by (simp add: right_distrib diff_minus)
  38.133 +
  38.134 +lemma left_diff_distrib[algebra_simps]: "(a - b) * c = a * c - b * c"
  38.135 +by (simp add: left_distrib diff_minus)
  38.136  
  38.137  lemmas ring_distribs =
  38.138    right_distrib left_distrib left_diff_distrib right_diff_distrib
  38.139  
  38.140 -lemmas ring_simps =
  38.141 -  add_ac
  38.142 -  add_diff_eq diff_add_eq diff_diff_eq diff_diff_eq2
  38.143 -  diff_eq_eq eq_diff_eq diff_minus [symmetric] uminus_add_conv_diff
  38.144 -  ring_distribs
  38.145 +text{*Legacy - use @{text algebra_simps} *}
  38.146 +lemmas ring_simps = algebra_simps
  38.147  
  38.148  lemma eq_add_iff1:
  38.149    "a * e + c = b * e + d \<longleftrightarrow> (a - b) * e + c = d"
  38.150 -  by (simp add: ring_simps)
  38.151 +by (simp add: algebra_simps)
  38.152  
  38.153  lemma eq_add_iff2:
  38.154    "a * e + c = b * e + d \<longleftrightarrow> c = (b - a) * e + d"
  38.155 -  by (simp add: ring_simps)
  38.156 +by (simp add: algebra_simps)
  38.157  
  38.158  end
  38.159  
  38.160 @@ -320,7 +313,7 @@
  38.161  qed
  38.162  
  38.163  lemma dvd_diff: "x dvd y \<Longrightarrow> x dvd z \<Longrightarrow> x dvd (y - z)"
  38.164 -  by (simp add: diff_minus dvd_add dvd_minus_iff)
  38.165 +by (simp add: diff_minus dvd_add dvd_minus_iff)
  38.166  
  38.167  end
  38.168  
  38.169 @@ -341,18 +334,16 @@
  38.170    "a * c = b * c \<longleftrightarrow> c = 0 \<or> a = b"
  38.171  proof -
  38.172    have "(a * c = b * c) = ((a - b) * c = 0)"
  38.173 -    by (simp add: ring_distribs right_minus_eq)
  38.174 -  thus ?thesis
  38.175 -    by (simp add: disj_commute right_minus_eq)
  38.176 +    by (simp add: algebra_simps right_minus_eq)
  38.177 +  thus ?thesis by (simp add: disj_commute right_minus_eq)
  38.178  qed
  38.179  
  38.180  lemma mult_cancel_left [simp, noatp]:
  38.181    "c * a = c * b \<longleftrightarrow> c = 0 \<or> a = b"
  38.182  proof -
  38.183    have "(c * a = c * b) = (c * (a - b) = 0)"
  38.184 -    by (simp add: ring_distribs right_minus_eq)
  38.185 -  thus ?thesis
  38.186 -    by (simp add: right_minus_eq)
  38.187 +    by (simp add: algebra_simps right_minus_eq)
  38.188 +  thus ?thesis by (simp add: right_minus_eq)
  38.189  qed
  38.190  
  38.191  end
  38.192 @@ -362,19 +353,19 @@
  38.193  
  38.194  lemma mult_cancel_right1 [simp]:
  38.195    "c = b * c \<longleftrightarrow> c = 0 \<or> b = 1"
  38.196 -  by (insert mult_cancel_right [of 1 c b], force)
  38.197 +by (insert mult_cancel_right [of 1 c b], force)
  38.198  
  38.199  lemma mult_cancel_right2 [simp]:
  38.200    "a * c = c \<longleftrightarrow> c = 0 \<or> a = 1"
  38.201 -  by (insert mult_cancel_right [of a c 1], simp)
  38.202 +by (insert mult_cancel_right [of a c 1], simp)
  38.203   
  38.204  lemma mult_cancel_left1 [simp]:
  38.205    "c = c * b \<longleftrightarrow> c = 0 \<or> b = 1"
  38.206 -  by (insert mult_cancel_left [of c 1 b], force)
  38.207 +by (insert mult_cancel_left [of c 1 b], force)
  38.208  
  38.209  lemma mult_cancel_left2 [simp]:
  38.210    "c * a = c \<longleftrightarrow> c = 0 \<or> a = 1"
  38.211 -  by (insert mult_cancel_left [of c a 1], simp)
  38.212 +by (insert mult_cancel_left [of c a 1], simp)
  38.213  
  38.214  end
  38.215  
  38.216 @@ -397,14 +388,11 @@
  38.217    show "a * b \<noteq> 0"
  38.218    proof
  38.219      assume ab: "a * b = 0"
  38.220 -    hence "0 = inverse a * (a * b) * inverse b"
  38.221 -      by simp
  38.222 +    hence "0 = inverse a * (a * b) * inverse b" by simp
  38.223      also have "\<dots> = (inverse a * a) * (b * inverse b)"
  38.224        by (simp only: mult_assoc)
  38.225 -    also have "\<dots> = 1"
  38.226 -      using a b by simp
  38.227 -    finally show False
  38.228 -      by simp
  38.229 +    also have "\<dots> = 1" using a b by simp
  38.230 +    finally show False by simp
  38.231    qed
  38.232  qed
  38.233  
  38.234 @@ -437,45 +425,41 @@
  38.235  
  38.236  lemma nonzero_inverse_minus_eq:
  38.237    "a \<noteq> 0 \<Longrightarrow> inverse (- a) = - inverse a"
  38.238 -  by (rule inverse_unique) simp
  38.239 +by (rule inverse_unique) simp
  38.240  
  38.241  lemma nonzero_inverse_inverse_eq:
  38.242    "a \<noteq> 0 \<Longrightarrow> inverse (inverse a) = a"
  38.243 -  by (rule inverse_unique) simp
  38.244 +by (rule inverse_unique) simp
  38.245  
  38.246  lemma nonzero_inverse_eq_imp_eq:
  38.247    assumes "inverse a = inverse b" and "a \<noteq> 0" and "b \<noteq> 0"
  38.248    shows "a = b"
  38.249  proof -
  38.250    from `inverse a = inverse b`
  38.251 -  have "inverse (inverse a) = inverse (inverse b)"
  38.252 -    by (rule arg_cong)
  38.253 +  have "inverse (inverse a) = inverse (inverse b)" by (rule arg_cong)
  38.254    with `a \<noteq> 0` and `b \<noteq> 0` show "a = b"
  38.255      by (simp add: nonzero_inverse_inverse_eq)
  38.256  qed
  38.257  
  38.258  lemma inverse_1 [simp]: "inverse 1 = 1"
  38.259 -  by (rule inverse_unique) simp
  38.260 +by (rule inverse_unique) simp
  38.261  
  38.262  lemma nonzero_inverse_mult_distrib: 
  38.263    assumes "a \<noteq> 0" and "b \<noteq> 0"
  38.264    shows "inverse (a * b) = inverse b * inverse a"
  38.265  proof -
  38.266 -  have "a * (b * inverse b) * inverse a = 1"
  38.267 -    using assms by simp
  38.268 -  hence "a * b * (inverse b * inverse a) = 1"
  38.269 -    by (simp only: mult_assoc)
  38.270 -  thus ?thesis
  38.271 -    by (rule inverse_unique)
  38.272 +  have "a * (b * inverse b) * inverse a = 1" using assms by simp
  38.273 +  hence "a * b * (inverse b * inverse a) = 1" by (simp only: mult_assoc)
  38.274 +  thus ?thesis by (rule inverse_unique)
  38.275  qed
  38.276  
  38.277  lemma division_ring_inverse_add:
  38.278    "a \<noteq> 0 \<Longrightarrow> b \<noteq> 0 \<Longrightarrow> inverse a + inverse b = inverse a * (a + b) * inverse b"
  38.279 -  by (simp add: ring_simps mult_assoc)
  38.280 +by (simp add: algebra_simps)
  38.281  
  38.282  lemma division_ring_inverse_diff:
  38.283    "a \<noteq> 0 \<Longrightarrow> b \<noteq> 0 \<Longrightarrow> inverse a - inverse b = inverse a * (b - a) * inverse b"
  38.284 -  by (simp add: ring_simps mult_assoc)
  38.285 +by (simp add: algebra_simps)
  38.286  
  38.287  end
  38.288  
  38.289 @@ -508,19 +492,19 @@
  38.290  qed
  38.291  
  38.292  lemma nonzero_inverse_eq_divide: "a \<noteq> 0 \<Longrightarrow> inverse a = 1 / a"
  38.293 -  by (simp add: divide_inverse)
  38.294 +by (simp add: divide_inverse)
  38.295  
  38.296  lemma divide_self [simp]: "a \<noteq> 0 \<Longrightarrow> a / a = 1"
  38.297 -  by (simp add: divide_inverse)
  38.298 +by (simp add: divide_inverse)
  38.299  
  38.300  lemma divide_zero_left [simp]: "0 / a = 0"
  38.301 -  by (simp add: divide_inverse)
  38.302 +by (simp add: divide_inverse)
  38.303  
  38.304  lemma inverse_eq_divide: "inverse a = 1 / a"
  38.305 -  by (simp add: divide_inverse)
  38.306 +by (simp add: divide_inverse)
  38.307  
  38.308  lemma add_divide_distrib: "(a+b) / c = a/c + b/c"
  38.309 -  by (simp add: divide_inverse ring_distribs) 
  38.310 +by (simp add: divide_inverse algebra_simps) 
  38.311  
  38.312  end
  38.313  
  38.314 @@ -529,11 +513,11 @@
  38.315  
  38.316  lemma divide_zero [simp]:
  38.317    "a / 0 = (0::'a::{field,division_by_zero})"
  38.318 -  by (simp add: divide_inverse)
  38.319 +by (simp add: divide_inverse)
  38.320  
  38.321  lemma divide_self_if [simp]:
  38.322    "a / (a::'a::{field,division_by_zero}) = (if a=0 then 0 else 1)"
  38.323 -  by simp
  38.324 +by simp
  38.325  
  38.326  class mult_mono = times + zero + ord +
  38.327    assumes mult_left_mono: "a \<le> b \<Longrightarrow> 0 \<le> c \<Longrightarrow> c * a \<le> c * b"
  38.328 @@ -566,16 +550,16 @@
  38.329  subclass pordered_semiring ..
  38.330  
  38.331  lemma mult_nonneg_nonneg: "0 \<le> a \<Longrightarrow> 0 \<le> b \<Longrightarrow> 0 \<le> a * b"
  38.332 -  by (drule mult_left_mono [of zero b], auto)
  38.333 +by (drule mult_left_mono [of zero b], auto)
  38.334  
  38.335  lemma mult_nonneg_nonpos: "0 \<le> a \<Longrightarrow> b \<le> 0 \<Longrightarrow> a * b \<le> 0"
  38.336 -  by (drule mult_left_mono [of b zero], auto)
  38.337 +by (drule mult_left_mono [of b zero], auto)
  38.338  
  38.339  lemma mult_nonneg_nonpos2: "0 \<le> a \<Longrightarrow> b \<le> 0 \<Longrightarrow> b * a \<le> 0" 
  38.340 -  by (drule mult_right_mono [of b zero], auto)
  38.341 +by (drule mult_right_mono [of b zero], auto)
  38.342  
  38.343  lemma split_mult_neg_le: "(0 \<le> a & b \<le> 0) | (a \<le> 0 & 0 \<le> b) \<Longrightarrow> a * b \<le> 0" 
  38.344 -  by (auto simp add: mult_nonneg_nonpos mult_nonneg_nonpos2)
  38.345 +by (auto simp add: mult_nonneg_nonpos mult_nonneg_nonpos2)
  38.346  
  38.347  end
  38.348  
  38.349 @@ -588,11 +572,11 @@
  38.350  
  38.351  lemma mult_left_less_imp_less:
  38.352    "c * a < c * b \<Longrightarrow> 0 \<le> c \<Longrightarrow> a < b"
  38.353 -  by (force simp add: mult_left_mono not_le [symmetric])
  38.354 +by (force simp add: mult_left_mono not_le [symmetric])
  38.355   
  38.356  lemma mult_right_less_imp_less:
  38.357    "a * c < b * c \<Longrightarrow> 0 \<le> c \<Longrightarrow> a < b"
  38.358 -  by (force simp add: mult_right_mono not_le [symmetric])
  38.359 +by (force simp add: mult_right_mono not_le [symmetric])
  38.360  
  38.361  end
  38.362  
  38.363 @@ -617,23 +601,23 @@
  38.364  
  38.365  lemma mult_left_le_imp_le:
  38.366    "c * a \<le> c * b \<Longrightarrow> 0 < c \<Longrightarrow> a \<le> b"
  38.367 -  by (force simp add: mult_strict_left_mono _not_less [symmetric])
  38.368 +by (force simp add: mult_strict_left_mono _not_less [symmetric])
  38.369   
  38.370  lemma mult_right_le_imp_le:
  38.371    "a * c \<le> b * c \<Longrightarrow> 0 < c \<Longrightarrow> a \<le> b"
  38.372 -  by (force simp add: mult_strict_right_mono not_less [symmetric])
  38.373 +by (force simp add: mult_strict_right_mono not_less [symmetric])
  38.374  
  38.375  lemma mult_pos_pos:
  38.376    "0 < a \<Longrightarrow> 0 < b \<Longrightarrow> 0 < a * b"
  38.377 -  by (drule mult_strict_left_mono [of zero b], auto)
  38.378 +by (drule mult_strict_left_mono [of zero b], auto)
  38.379  
  38.380  lemma mult_pos_neg:
  38.381    "0 < a \<Longrightarrow> b < 0 \<Longrightarrow> a * b < 0"
  38.382 -  by (drule mult_strict_left_mono [of b zero], auto)
  38.383 +by (drule mult_strict_left_mono [of b zero], auto)
  38.384  
  38.385  lemma mult_pos_neg2:
  38.386    "0 < a \<Longrightarrow> b < 0 \<Longrightarrow> b * a < 0" 
  38.387 -  by (drule mult_strict_right_mono [of b zero], auto)
  38.388 +by (drule mult_strict_right_mono [of b zero], auto)
  38.389  
  38.390  lemma zero_less_mult_pos:
  38.391    "0 < a * b \<Longrightarrow> 0 < a \<Longrightarrow> 0 < b"
  38.392 @@ -666,7 +650,7 @@
  38.393  lemma mult_strict_mono':
  38.394    assumes "a < b" and "c < d" and "0 \<le> a" and "0 \<le> c"
  38.395    shows "a * c < b * d"
  38.396 -  by (rule mult_strict_mono) (insert assms, auto)
  38.397 +by (rule mult_strict_mono) (insert assms, auto)
  38.398  
  38.399  lemma mult_less_le_imp_less:
  38.400    assumes "a < b" and "c \<le> d" and "0 \<le> a" and "0 < c"
  38.401 @@ -697,8 +681,7 @@
  38.402    assume "\<not>  a < b"
  38.403    hence "b \<le> a" by (simp add: linorder_not_less)
  38.404    hence "c * b \<le> c * a" using nonneg by (rule mult_left_mono)
  38.405 -  with this and less show False 
  38.406 -    by (simp add: not_less [symmetric])
  38.407 +  with this and less show False by (simp add: not_less [symmetric])
  38.408  qed
  38.409  
  38.410  lemma mult_less_imp_less_right:
  38.411 @@ -708,8 +691,7 @@
  38.412    assume "\<not> a < b"
  38.413    hence "b \<le> a" by (simp add: linorder_not_less)
  38.414    hence "b * c \<le> a * c" using nonneg by (rule mult_right_mono)
  38.415 -  with this and less show False 
  38.416 -    by (simp add: not_less [symmetric])
  38.417 +  with this and less show False by (simp add: not_less [symmetric])
  38.418  qed  
  38.419  
  38.420  end
  38.421 @@ -768,23 +750,24 @@
  38.422  
  38.423  subclass pordered_ab_group_add ..
  38.424  
  38.425 -lemmas ring_simps = ring_simps group_simps
  38.426 +text{*Legacy - use @{text algebra_simps} *}
  38.427 +lemmas ring_simps = algebra_simps
  38.428  
  38.429  lemma less_add_iff1:
  38.430    "a * e + c < b * e + d \<longleftrightarrow> (a - b) * e + c < d"
  38.431 -  by (simp add: ring_simps)
  38.432 +by (simp add: algebra_simps)
  38.433  
  38.434  lemma less_add_iff2:
  38.435    "a * e + c < b * e + d \<longleftrightarrow> c < (b - a) * e + d"
  38.436 -  by (simp add: ring_simps)
  38.437 +by (simp add: algebra_simps)
  38.438  
  38.439  lemma le_add_iff1:
  38.440    "a * e + c \<le> b * e + d \<longleftrightarrow> (a - b) * e + c \<le> d"
  38.441 -  by (simp add: ring_simps)
  38.442 +by (simp add: algebra_simps)
  38.443  
  38.444  lemma le_add_iff2:
  38.445    "a * e + c \<le> b * e + d \<longleftrightarrow> c \<le> (b - a) * e + d"
  38.446 -  by (simp add: ring_simps)
  38.447 +by (simp add: algebra_simps)
  38.448  
  38.449  lemma mult_left_mono_neg:
  38.450    "b \<le> a \<Longrightarrow> c \<le> 0 \<Longrightarrow> c * a \<le> c * b"
  38.451 @@ -800,11 +783,11 @@
  38.452  
  38.453  lemma mult_nonpos_nonpos:
  38.454    "a \<le> 0 \<Longrightarrow> b \<le> 0 \<Longrightarrow> 0 \<le> a * b"
  38.455 -  by (drule mult_right_mono_neg [of a zero b]) auto
  38.456 +by (drule mult_right_mono_neg [of a zero b]) auto
  38.457  
  38.458  lemma split_mult_pos_le:
  38.459    "(0 \<le> a \<and> 0 \<le> b) \<or> (a \<le> 0 \<and> b \<le> 0) \<Longrightarrow> 0 \<le> a * b"
  38.460 -  by (auto simp add: mult_nonneg_nonneg mult_nonpos_nonpos)
  38.461 +by (auto simp add: mult_nonneg_nonneg mult_nonpos_nonpos)
  38.462  
  38.463  end
  38.464  
  38.465 @@ -827,7 +810,7 @@
  38.466  proof
  38.467    fix a b
  38.468    show "\<bar>a + b\<bar> \<le> \<bar>a\<bar> + \<bar>b\<bar>"
  38.469 -  by (auto simp add: abs_if not_less neg_less_eq_nonneg less_eq_neg_nonpos)
  38.470 +by (auto simp add: abs_if not_less neg_less_eq_nonneg less_eq_neg_nonpos)
  38.471     (auto simp del: minus_add_distrib simp add: minus_add_distrib [symmetric]
  38.472       neg_less_eq_nonneg less_eq_neg_nonpos, auto intro: add_nonneg_nonneg,
  38.473        auto intro!: less_imp_le add_neg_neg)
  38.474 @@ -858,7 +841,7 @@
  38.475  
  38.476  lemma mult_neg_neg:
  38.477    "a < 0 \<Longrightarrow> b < 0 \<Longrightarrow> 0 < a * b"
  38.478 -  by (drule mult_strict_right_mono_neg, auto)
  38.479 +by (drule mult_strict_right_mono_neg, auto)
  38.480  
  38.481  subclass ring_no_zero_divisors
  38.482  proof
  38.483 @@ -903,7 +886,7 @@
  38.484  
  38.485  lemma zero_le_mult_iff:
  38.486    "0 \<le> a * b \<longleftrightarrow> 0 \<le> a \<and> 0 \<le> b \<or> a \<le> 0 \<and> b \<le> 0"
  38.487 -  by (auto simp add: eq_commute [of 0] le_less not_less zero_less_mult_iff)
  38.488 +by (auto simp add: eq_commute [of 0] le_less not_less zero_less_mult_iff)
  38.489  
  38.490  lemma mult_less_0_iff:
  38.491    "a * b < 0 \<longleftrightarrow> 0 < a \<and> b < 0 \<or> a < 0 \<and> 0 < b"
  38.492 @@ -918,10 +901,10 @@
  38.493    done
  38.494  
  38.495  lemma zero_le_square [simp]: "0 \<le> a * a"
  38.496 -  by (simp add: zero_le_mult_iff linear)
  38.497 +by (simp add: zero_le_mult_iff linear)
  38.498  
  38.499  lemma not_square_less_zero [simp]: "\<not> (a * a < 0)"
  38.500 -  by (simp add: not_less)
  38.501 +by (simp add: not_less)
  38.502  
  38.503  text{*Cancellation laws for @{term "c*a < c*b"} and @{term "a*c < b*c"},
  38.504     also with the relations @{text "\<le>"} and equality.*}
  38.505 @@ -968,19 +951,16 @@
  38.506  
  38.507  lemma mult_le_cancel_right:
  38.508     "a * c \<le> b * c \<longleftrightarrow> (0 < c \<longrightarrow> a \<le> b) \<and> (c < 0 \<longrightarrow> b \<le> a)"
  38.509 -  by (simp add: not_less [symmetric] mult_less_cancel_right_disj)
  38.510 +by (simp add: not_less [symmetric] mult_less_cancel_right_disj)
  38.511  
  38.512  lemma mult_le_cancel_left:
  38.513    "c * a \<le> c * b \<longleftrightarrow> (0 < c \<longrightarrow> a \<le> b) \<and> (c < 0 \<longrightarrow> b \<le> a)"
  38.514 -  by (simp add: not_less [symmetric] mult_less_cancel_left_disj)
  38.515 +by (simp add: not_less [symmetric] mult_less_cancel_left_disj)
  38.516  
  38.517  end
  38.518  
  38.519 -text{*This list of rewrites simplifies ring terms by multiplying
  38.520 -everything out and bringing sums and products into a canonical form
  38.521 -(by ordered rewriting). As a result it decides ring equalities but
  38.522 -also helps with inequalities. *}
  38.523 -lemmas ring_simps = group_simps ring_distribs
  38.524 +text{*Legacy - use @{text algebra_simps} *}
  38.525 +lemmas ring_simps = algebra_simps
  38.526  
  38.527  
  38.528  class pordered_comm_ring = comm_ring + pordered_comm_semiring
  38.529 @@ -1001,13 +981,13 @@
  38.530    using add_strict_mono [of zero a b c] by simp
  38.531  
  38.532  lemma zero_le_one [simp]: "0 \<le> 1"
  38.533 -  by (rule zero_less_one [THEN less_imp_le]) 
  38.534 +by (rule zero_less_one [THEN less_imp_le]) 
  38.535  
  38.536  lemma not_one_le_zero [simp]: "\<not> 1 \<le> 0"
  38.537 -  by (simp add: not_le) 
  38.538 +by (simp add: not_le) 
  38.539  
  38.540  lemma not_one_less_zero [simp]: "\<not> 1 < 0"
  38.541 -  by (simp add: not_less) 
  38.542 +by (simp add: not_less) 
  38.543  
  38.544  lemma less_1_mult:
  38.545    assumes "1 < m" and "1 < n"
  38.546 @@ -1041,35 +1021,35 @@
  38.547  
  38.548  lemma mult_le_cancel_right1:
  38.549    "c \<le> b * c \<longleftrightarrow> (0 < c \<longrightarrow> 1 \<le> b) \<and> (c < 0 \<longrightarrow> b \<le> 1)"
  38.550 -  by (insert mult_le_cancel_right [of 1 c b], simp)
  38.551 +by (insert mult_le_cancel_right [of 1 c b], simp)
  38.552  
  38.553  lemma mult_le_cancel_right2:
  38.554    "a * c \<le> c \<longleftrightarrow> (0 < c \<longrightarrow> a \<le> 1) \<and> (c < 0 \<longrightarrow> 1 \<le> a)"
  38.555 -  by (insert mult_le_cancel_right [of a c 1], simp)
  38.556 +by (insert mult_le_cancel_right [of a c 1], simp)
  38.557  
  38.558  lemma mult_le_cancel_left1:
  38.559    "c \<le> c * b \<longleftrightarrow> (0 < c \<longrightarrow> 1 \<le> b) \<and> (c < 0 \<longrightarrow> b \<le> 1)"
  38.560 -  by (insert mult_le_cancel_left [of c 1 b], simp)
  38.561 +by (insert mult_le_cancel_left [of c 1 b], simp)
  38.562  
  38.563  lemma mult_le_cancel_left2:
  38.564    "c * a \<le> c \<longleftrightarrow> (0 < c \<longrightarrow> a \<le> 1) \<and> (c < 0 \<longrightarrow> 1 \<le> a)"
  38.565 -  by (insert mult_le_cancel_left [of c a 1], simp)
  38.566 +by (insert mult_le_cancel_left [of c a 1], simp)
  38.567  
  38.568  lemma mult_less_cancel_right1:
  38.569    "c < b * c \<longleftrightarrow> (0 \<le> c \<longrightarrow> 1 < b) \<and> (c \<le> 0 \<longrightarrow> b < 1)"
  38.570 -  by (insert mult_less_cancel_right [of 1 c b], simp)
  38.571 +by (insert mult_less_cancel_right [of 1 c b], simp)
  38.572  
  38.573  lemma mult_less_cancel_right2:
  38.574    "a * c < c \<longleftrightarrow> (0 \<le> c \<longrightarrow> a < 1) \<and> (c \<le> 0 \<longrightarrow> 1 < a)"
  38.575 -  by (insert mult_less_cancel_right [of a c 1], simp)
  38.576 +by (insert mult_less_cancel_right [of a c 1], simp)
  38.577  
  38.578  lemma mult_less_cancel_left1:
  38.579    "c < c * b \<longleftrightarrow> (0 \<le> c \<longrightarrow> 1 < b) \<and> (c \<le> 0 \<longrightarrow> b < 1)"
  38.580 -  by (insert mult_less_cancel_left [of c 1 b], simp)
  38.581 +by (insert mult_less_cancel_left [of c 1 b], simp)
  38.582  
  38.583  lemma mult_less_cancel_left2:
  38.584    "c * a < c \<longleftrightarrow> (0 \<le> c \<longrightarrow> a < 1) \<and> (c \<le> 0 \<longrightarrow> 1 < a)"
  38.585 -  by (insert mult_less_cancel_left [of c a 1], simp)
  38.586 +by (insert mult_less_cancel_left [of c a 1], simp)
  38.587  
  38.588  lemma sgn_sgn [simp]:
  38.589    "sgn (sgn a) = sgn a"
  38.590 @@ -1089,7 +1069,7 @@
  38.591  
  38.592  lemma sgn_times:
  38.593    "sgn (a * b) = sgn a * sgn b"
  38.594 -  by (auto simp add: sgn_if zero_less_mult_iff)
  38.595 +by (auto simp add: sgn_if zero_less_mult_iff)
  38.596  
  38.597  end
  38.598  
  38.599 @@ -1150,12 +1130,10 @@
  38.600       "inverse(a*b) = inverse(a) * inverse(b::'a::{field,division_by_zero})"
  38.601    proof cases
  38.602      assume "a \<noteq> 0 & b \<noteq> 0" 
  38.603 -    thus ?thesis
  38.604 -      by (simp add: nonzero_inverse_mult_distrib mult_commute)
  38.605 +    thus ?thesis by (simp add: nonzero_inverse_mult_distrib mult_commute)
  38.606    next
  38.607      assume "~ (a \<noteq> 0 & b \<noteq> 0)" 
  38.608 -    thus ?thesis
  38.609 -      by force
  38.610 +    thus ?thesis by force
  38.611    qed
  38.612  
  38.613  text{*There is no slick version using division by zero.*}
  38.614 @@ -1182,10 +1160,8 @@
  38.615      by (simp add: divide_inverse nonzero_inverse_mult_distrib)
  38.616    also have "... =  a * inverse b * (inverse c * c)"
  38.617      by (simp only: mult_ac)
  38.618 -  also have "... =  a * inverse b"
  38.619 -    by simp
  38.620 -    finally show ?thesis 
  38.621 -    by (simp add: divide_inverse)
  38.622 +  also have "... =  a * inverse b" by simp
  38.623 +    finally show ?thesis by (simp add: divide_inverse)
  38.624  qed
  38.625  
  38.626  lemma mult_divide_mult_cancel_left:
  38.627 @@ -1346,14 +1322,14 @@
  38.628  
  38.629  lemma divide_eq_imp: "(c::'a::{division_by_zero,field}) ~= 0 ==>
  38.630      b = a * c ==> b / c = a"
  38.631 -  by (subst divide_eq_eq, simp)
  38.632 +by (subst divide_eq_eq, simp)
  38.633  
  38.634  lemma eq_divide_imp: "(c::'a::{division_by_zero,field}) ~= 0 ==>
  38.635      a * c = b ==> a = b / c"
  38.636 -  by (subst eq_divide_eq, simp)
  38.637 -
  38.638 -
  38.639 -lemmas field_eq_simps = ring_simps
  38.640 +by (subst eq_divide_eq, simp)
  38.641 +
  38.642 +
  38.643 +lemmas field_eq_simps = algebra_simps
  38.644    (* pull / out*)
  38.645    add_divide_eq_iff divide_add_eq_iff
  38.646    diff_divide_eq_iff divide_diff_eq_iff
  38.647 @@ -1475,12 +1451,10 @@
  38.648  shows "inverse b < inverse (a::'a::ordered_field)"
  38.649  proof (rule ccontr)
  38.650    assume "~ inverse b < inverse a"
  38.651 -  hence "inverse a \<le> inverse b"
  38.652 -    by (simp add: linorder_not_less)
  38.653 +  hence "inverse a \<le> inverse b" by (simp add: linorder_not_less)
  38.654    hence "~ (a < b)"
  38.655      by (simp add: linorder_not_less inverse_le_imp_le [OF _ apos])
  38.656 -  thus False
  38.657 -    by (rule notE [OF _ less])
  38.658 +  thus False by (rule notE [OF _ less])
  38.659  qed
  38.660  
  38.661  lemma inverse_less_imp_less:
  38.662 @@ -1711,9 +1685,10 @@
  38.663  
  38.664  subsection{*Field simplification*}
  38.665  
  38.666 -text{* Lemmas @{text field_simps} multiply with denominators in
  38.667 -in(equations) if they can be proved to be non-zero (for equations) or
  38.668 -positive/negative (for inequations). *}
  38.669 +text{* Lemmas @{text field_simps} multiply with denominators in in(equations)
  38.670 +if they can be proved to be non-zero (for equations) or positive/negative
  38.671 +(for inequations). Can be too aggressive and is therefore separate from the
  38.672 +more benign @{text algebra_simps}. *}
  38.673  
  38.674  lemmas field_simps = field_eq_simps
  38.675    (* multiply ineqn *)
  38.676 @@ -1981,15 +1956,15 @@
  38.677  
  38.678  lemma mult_right_le_one_le: "0 <= (x::'a::ordered_idom) ==> 0 <= y ==> y <= 1
  38.679      ==> x * y <= x"
  38.680 -  by (auto simp add: mult_compare_simps);
  38.681 +by (auto simp add: mult_compare_simps);
  38.682  
  38.683  lemma mult_left_le_one_le: "0 <= (x::'a::ordered_idom) ==> 0 <= y ==> y <= 1
  38.684      ==> y * x <= x"
  38.685 -  by (auto simp add: mult_compare_simps);
  38.686 +by (auto simp add: mult_compare_simps);
  38.687  
  38.688  lemma mult_imp_div_pos_le: "0 < (y::'a::ordered_field) ==> x <= z * y ==>
  38.689      x / y <= z";
  38.690 -  by (subst pos_divide_le_eq, assumption+);
  38.691 +by (subst pos_divide_le_eq, assumption+);
  38.692  
  38.693  lemma mult_imp_le_div_pos: "0 < (y::'a::ordered_field) ==> z * y <= x ==>
  38.694      z <= x / y"
  38.695 @@ -2054,7 +2029,7 @@
  38.696  qed
  38.697  
  38.698  lemma zero_less_two: "0 < 1 + 1"
  38.699 -  by (blast intro: less_trans zero_less_one less_add_one)
  38.700 +by (blast intro: less_trans zero_less_one less_add_one)
  38.701  
  38.702  end
  38.703  
  38.704 @@ -2086,7 +2061,7 @@
  38.705  end
  38.706  
  38.707  lemma abs_one [simp]: "abs 1 = (1::'a::ordered_idom)"
  38.708 -  by (simp add: abs_if zero_less_one [THEN order_less_not_sym])
  38.709 +by (simp add: abs_if zero_less_one [THEN order_less_not_sym])
  38.710  
  38.711  class pordered_ring_abs = pordered_ring + pordered_ab_group_add_abs +
  38.712    assumes abs_eq_mult:
  38.713 @@ -2106,14 +2081,14 @@
  38.714    let ?x = "pprt a * pprt b - pprt a * nprt b - nprt a * pprt b + nprt a * nprt b"
  38.715    let ?y = "pprt a * pprt b + pprt a * nprt b + nprt a * pprt b + nprt a * nprt b"
  38.716    have a: "(abs a) * (abs b) = ?x"
  38.717 -    by (simp only: abs_prts[of a] abs_prts[of b] ring_simps)
  38.718 +    by (simp only: abs_prts[of a] abs_prts[of b] algebra_simps)
  38.719    {
  38.720      fix u v :: 'a
  38.721      have bh: "\<lbrakk>u = a; v = b\<rbrakk> \<Longrightarrow> 
  38.722                u * v = pprt a * pprt b + pprt a * nprt b + 
  38.723                        nprt a * pprt b + nprt a * nprt b"
  38.724        apply (subst prts[of u], subst prts[of v])
  38.725 -      apply (simp add: ring_simps) 
  38.726 +      apply (simp add: algebra_simps) 
  38.727        done
  38.728    }
  38.729    note b = this[OF refl[of a] refl[of b]]
  38.730 @@ -2166,7 +2141,7 @@
  38.731        apply (simp_all add: mulprts abs_prts)
  38.732        apply (insert prems)
  38.733        apply (auto simp add: 
  38.734 -	ring_simps 
  38.735 +	algebra_simps 
  38.736  	iffD1[OF zero_le_iff_zero_nprt] iffD1[OF le_zero_iff_zero_pprt]
  38.737  	iffD1[OF le_zero_iff_pprt_id] iffD1[OF zero_le_iff_nprt_id])
  38.738  	apply(drule (1) mult_nonneg_nonpos[of a b], simp)
  38.739 @@ -2178,7 +2153,7 @@
  38.740      then show ?thesis
  38.741        apply (simp_all add: mulprts abs_prts)
  38.742        apply (insert prems)
  38.743 -      apply (auto simp add: ring_simps)
  38.744 +      apply (auto simp add: algebra_simps)
  38.745        apply(drule (1) mult_nonneg_nonneg[of a b],simp)
  38.746        apply(drule (1) mult_nonpos_nonpos[of a b],simp)
  38.747        done
  38.748 @@ -2191,10 +2166,10 @@
  38.749    equal_neg_zero neg_equal_zero mult_less_0_iff)
  38.750  
  38.751  lemma abs_mult: "abs (a * b) = abs a * abs (b::'a::ordered_idom)" 
  38.752 -  by (simp add: abs_eq_mult linorder_linear)
  38.753 +by (simp add: abs_eq_mult linorder_linear)
  38.754  
  38.755  lemma abs_mult_self: "abs a * abs a = a * (a::'a::ordered_idom)"
  38.756 -  by (simp add: abs_if) 
  38.757 +by (simp add: abs_if) 
  38.758  
  38.759  lemma nonzero_abs_inverse:
  38.760       "a \<noteq> 0 ==> abs (inverse (a::'a::ordered_field)) = inverse (abs a)"
  38.761 @@ -2268,7 +2243,7 @@
  38.762      apply simp
  38.763      done
  38.764    then have "a * b = pprt a * pprt b + pprt a * nprt b + nprt a * pprt b + nprt a * nprt b"
  38.765 -    by (simp add: ring_simps)
  38.766 +    by (simp add: algebra_simps)
  38.767    moreover have "pprt a * pprt b <= pprt a2 * pprt b2"
  38.768      by (simp_all add: prems mult_mono)
  38.769    moreover have "pprt a * nprt b <= pprt a1 * nprt b2"
    39.1 --- a/src/HOL/SEQ.thy	Sun Jan 18 13:58:17 2009 +0100
    39.2 +++ b/src/HOL/SEQ.thy	Wed Jan 28 16:29:16 2009 +0100
    39.3 @@ -388,7 +388,7 @@
    39.4  lemma inverse_diff_inverse:
    39.5    "\<lbrakk>(a::'a::division_ring) \<noteq> 0; b \<noteq> 0\<rbrakk>
    39.6     \<Longrightarrow> inverse a - inverse b = - (inverse a * (a - b) * inverse b)"
    39.7 -by (simp add: ring_simps)
    39.8 +by (simp add: algebra_simps)
    39.9  
   39.10  lemma Bseq_inverse_lemma:
   39.11    fixes x :: "'a::real_normed_div_algebra"
    40.1 --- a/src/HOL/SetInterval.thy	Sun Jan 18 13:58:17 2009 +0100
    40.2 +++ b/src/HOL/SetInterval.thy	Wed Jan 28 16:29:16 2009 +0100
    40.3 @@ -532,15 +532,15 @@
    40.4    done
    40.5  
    40.6  lemma card_atLeastAtMost_int [simp]: "card {l..u} = nat (u - l + 1)"
    40.7 -  apply (subst atLeastLessThanPlusOne_atLeastAtMost_int [THEN sym])
    40.8 -  apply (auto simp add: compare_rls)
    40.9 -  done
   40.10 +apply (subst atLeastLessThanPlusOne_atLeastAtMost_int [THEN sym])
   40.11 +apply (auto simp add: algebra_simps)
   40.12 +done
   40.13  
   40.14  lemma card_greaterThanAtMost_int [simp]: "card {l<..u} = nat (u - l)"
   40.15 -  by (subst atLeastPlusOneAtMost_greaterThanAtMost_int [THEN sym], simp)
   40.16 +by (subst atLeastPlusOneAtMost_greaterThanAtMost_int [THEN sym], simp)
   40.17  
   40.18  lemma card_greaterThanLessThan_int [simp]: "card {l<..<u} = nat (u - (l + 1))"
   40.19 -  by (subst atLeastPlusOneLessThan_greaterThanLessThan_int [THEN sym], simp)
   40.20 +by (subst atLeastPlusOneLessThan_greaterThanLessThan_int [THEN sym], simp)
   40.21  
   40.22  lemma finite_M_bounded_by_nat: "finite {k. P k \<and> k < (i::nat)}"
   40.23  proof -
   40.24 @@ -806,7 +806,7 @@
   40.25  lemma setsum_head_upt_Suc:
   40.26    "m < n \<Longrightarrow> setsum f {m..<n} = f m + setsum f {Suc m..<n}"
   40.27  apply(insert setsum_head_Suc[of m "n - 1" f])
   40.28 -apply (simp add: atLeastLessThanSuc_atLeastAtMost[symmetric] ring_simps)
   40.29 +apply (simp add: atLeastLessThanSuc_atLeastAtMost[symmetric] algebra_simps)
   40.30  done
   40.31  
   40.32  
   40.33 @@ -870,7 +870,7 @@
   40.34    show ?case by simp
   40.35  next
   40.36    case (Suc n)
   40.37 -  then show ?case by (simp add: ring_simps)
   40.38 +  then show ?case by (simp add: algebra_simps)
   40.39  qed
   40.40  
   40.41  theorem arith_series_general:
   40.42 @@ -894,11 +894,11 @@
   40.43    have "(1+1)*?n*a + d*(1+1)*(\<Sum>i\<in>{1..n - 1}. ?I i) = ((1+1)*?n*a + d*?I (n - 1)*?I n)"
   40.44      by (simp only: mult_ac gauss_sum [of "n - 1"])
   40.45         (simp add:  mult_ac trans [OF add_commute of_nat_Suc [symmetric]])
   40.46 -  finally show ?thesis by (simp add: mult_ac add_ac right_distrib)
   40.47 +  finally show ?thesis by (simp add: algebra_simps)
   40.48  next
   40.49    assume "\<not>(n > 1)"
   40.50    hence "n = 1 \<or> n = 0" by auto
   40.51 -  thus ?thesis by (auto simp: mult_ac right_distrib)
   40.52 +  thus ?thesis by (auto simp: algebra_simps)
   40.53  qed
   40.54  
   40.55  lemma arith_series_nat:
    41.1 --- a/src/HOL/Tools/ComputeNumeral.thy	Sun Jan 18 13:58:17 2009 +0100
    41.2 +++ b/src/HOL/Tools/ComputeNumeral.thy	Wed Jan 28 16:29:16 2009 +0100
    41.3 @@ -55,7 +55,7 @@
    41.4  lemma multb0x: "(Int.Bit0 x) * y = Int.Bit0 (x * y)" by (rule mult_Bit0)
    41.5  lemma multxb0: "x * (Int.Bit0 y) = Int.Bit0 (x * y)" unfolding Bit0_def by simp
    41.6  lemma multb1: "(Int.Bit1 x) * (Int.Bit1 y) = Int.Bit1 (Int.Bit0 (x * y) + x + y)"
    41.7 -  unfolding Bit0_def Bit1_def by (simp add: ring_simps)
    41.8 +  unfolding Bit0_def Bit1_def by (simp add: algebra_simps)
    41.9  lemmas bitmul = mult_Pls mult_Min mult_Pls_right mult_Min_right multb0x multxb0 multb1
   41.10  
   41.11  lemmas bitarith = bitnorm bitiszero bitneg bitlezero biteq bitless bitle bitsucc bitpred bituminus bitadd bitmul 
   41.12 @@ -193,6 +193,3 @@
   41.13                           compute_natarith compute_numberarith max_def min_def compute_num_conversions zpowerarith compute_div_mod compute_even
   41.14  
   41.15  end
   41.16 -
   41.17 -
   41.18 -
    42.1 --- a/src/HOL/Transcendental.thy	Sun Jan 18 13:58:17 2009 +0100
    42.2 +++ b/src/HOL/Transcendental.thy	Wed Jan 28 16:29:16 2009 +0100
    42.3 @@ -40,7 +40,7 @@
    42.4  apply (simp add: right_distrib del: setsum_op_ivl_Suc)
    42.5  apply (subst mult_left_commute [where a="x - y"])
    42.6  apply (erule subst)
    42.7 -apply (simp add: power_Suc ring_simps)
    42.8 +apply (simp add: power_Suc algebra_simps)
    42.9  done
   42.10  
   42.11  lemma lemma_realpow_rev_sumr:
   42.12 @@ -146,8 +146,7 @@
   42.13    fixes z :: "'a :: {recpower,comm_ring}" shows
   42.14    "(\<Sum>p=0..<m. (((z + h) ^ (m - p)) * (z ^ p)) - (z ^ m)) =  
   42.15     (\<Sum>p=0..<m. (z ^ p) * (((z + h) ^ (m - p)) - (z ^ (m - p))))"
   42.16 -by (auto simp add: right_distrib diff_minus power_add [symmetric] mult_ac
   42.17 -  cong: strong_setsum_cong)
   42.18 +by(auto simp add: algebra_simps power_add [symmetric] cong: strong_setsum_cong)
   42.19  
   42.20  lemma sumr_diff_mult_const2:
   42.21    "setsum f {0..<n} - of_nat n * (r::'a::ring_1) = (\<Sum>i = 0..<n. f i - r)"
   42.22 @@ -406,7 +405,7 @@
   42.23        apply (rule summable_diff [OF B A])
   42.24        apply (rule sums_summable [OF diffs_equiv [OF C]])
   42.25        apply (rule arg_cong [where f="suminf"], rule ext)
   42.26 -      apply (simp add: ring_simps)
   42.27 +      apply (simp add: algebra_simps)
   42.28        done
   42.29    next
   42.30      show "(\<lambda>h. \<Sum>n. c n * (((x + h) ^ n - x ^ n) / h -
   42.31 @@ -1122,7 +1121,7 @@
   42.32  apply (safe, rule lemma_DERIV_subst)
   42.33  apply (best intro!: DERIV_intros intro: DERIV_chain2) 
   42.34    --{*replaces the old @{text DERIV_tac}*}
   42.35 -apply (auto simp add: diff_minus left_distrib right_distrib mult_ac add_ac)
   42.36 +apply (auto simp add: algebra_simps)
   42.37  done
   42.38  
   42.39  lemma sin_cos_add [simp]:
   42.40 @@ -1146,8 +1145,8 @@
   42.41  lemma lemma_DERIV_sin_cos_minus:
   42.42      "\<forall>x. DERIV (%x. (sin(-x) + (sin x)) ^ 2 + (cos(-x) - (cos x)) ^ 2) x :> 0"
   42.43  apply (safe, rule lemma_DERIV_subst)
   42.44 -apply (best intro!: DERIV_intros intro: DERIV_chain2) 
   42.45 -apply (auto simp add: diff_minus left_distrib right_distrib mult_ac add_ac)
   42.46 +apply (best intro!: DERIV_intros intro: DERIV_chain2)
   42.47 +apply (simp add: algebra_simps)
   42.48  done
   42.49  
   42.50  lemma sin_cos_minus: 
   42.51 @@ -1520,9 +1519,8 @@
   42.52  apply (drule pi_gt_zero [THEN reals_Archimedean4], safe)
   42.53  apply (subgoal_tac "0 \<le> x - real n * pi & 
   42.54                      (x - real n * pi) \<le> pi & (cos (x - real n * pi) = 0) ")
   42.55 -apply (auto simp add: compare_rls) 
   42.56 -  prefer 3 apply (simp add: cos_diff) 
   42.57 - prefer 2 apply (simp add: real_of_nat_Suc left_distrib) 
   42.58 +apply (auto simp add: algebra_simps real_of_nat_Suc)
   42.59 + prefer 2 apply (simp add: cos_diff)
   42.60  apply (simp add: cos_diff)
   42.61  apply (subgoal_tac "EX! x. 0 \<le> x & x \<le> pi & cos x = 0")
   42.62  apply (rule_tac [2] cos_total, safe)
   42.63 @@ -1530,7 +1528,7 @@
   42.64  apply (drule_tac x = "pi/2" in spec)
   42.65  apply (simp add: cos_diff)
   42.66  apply (rule_tac x = "Suc (2 * n)" in exI)
   42.67 -apply (simp add: real_of_nat_Suc left_distrib, auto)
   42.68 +apply (simp add: real_of_nat_Suc algebra_simps, auto)
   42.69  done
   42.70  
   42.71  lemma sin_zero_lemma:
   42.72 @@ -1601,7 +1599,7 @@
   42.73  apply (rule_tac c1 = "cos x * cos y" in real_mult_right_cancel [THEN subst])
   42.74  apply (auto simp del: inverse_mult_distrib 
   42.75              simp add: mult_assoc left_diff_distrib cos_add)
   42.76 -done  
   42.77 +done
   42.78  
   42.79  lemma add_tan_eq: 
   42.80        "[| cos x \<noteq> 0; cos y \<noteq> 0 |]  
   42.81 @@ -1982,7 +1980,7 @@
   42.82    also have "\<dots> = (?c * ?c - ?s * ?s) * ?c - (?s * ?c + ?c * ?s) * ?s"
   42.83      by (simp only: cos_add sin_add)
   42.84    also have "\<dots> = ?c * (?c\<twosuperior> - 3 * ?s\<twosuperior>)"
   42.85 -    by (simp add: ring_simps power2_eq_square)
   42.86 +    by (simp add: algebra_simps power2_eq_square)
   42.87    finally have "?c\<twosuperior> = (sqrt 3 / 2)\<twosuperior>"
   42.88      using pos_c by (simp add: sin_squared_eq power_divide)
   42.89    thus ?thesis
   42.90 @@ -2051,7 +2049,7 @@
   42.91  lemma sin_cos_npi [simp]: "sin (real (Suc (2 * n)) * pi / 2) = (-1) ^ n"
   42.92  proof -
   42.93    have "sin ((real n + 1/2) * pi) = cos (real n * pi)"
   42.94 -    by (auto simp add: right_distrib sin_add left_distrib mult_ac)
   42.95 +    by (auto simp add: algebra_simps sin_add)
   42.96    thus ?thesis
   42.97      by (simp add: real_of_nat_Suc left_distrib add_divide_distrib 
   42.98                    mult_commute [of pi])
    43.1 --- a/src/HOL/Word/BinBoolList.thy	Sun Jan 18 13:58:17 2009 +0100
    43.2 +++ b/src/HOL/Word/BinBoolList.thy	Wed Jan 28 16:29:16 2009 +0100
    43.3 @@ -281,7 +281,7 @@
    43.4    apply clarsimp
    43.5    apply safe
    43.6    apply (erule allE, erule xtr8 [rotated],
    43.7 -         simp add: numeral_simps ring_simps cong add : number_of_False_cong)+
    43.8 +         simp add: numeral_simps algebra_simps cong add : number_of_False_cong)+
    43.9    done
   43.10  
   43.11  lemma bl_to_bin_lt2p: "bl_to_bin bs < (2 ^ length bs)"
   43.12 @@ -299,7 +299,7 @@
   43.13    apply clarsimp
   43.14    apply safe
   43.15     apply (erule allE, erule preorder_class.order_trans [rotated],
   43.16 -          simp add: numeral_simps ring_simps cong add : number_of_False_cong)+
   43.17 +          simp add: numeral_simps algebra_simps cong add : number_of_False_cong)+
   43.18    done
   43.19  
   43.20  lemma bl_to_bin_ge0: "bl_to_bin bs >= 0"
   43.21 @@ -1138,4 +1138,3 @@
   43.22    done
   43.23  
   43.24  end
   43.25 -
    44.1 --- a/src/HOL/Word/WordArith.thy	Sun Jan 18 13:58:17 2009 +0100
    44.2 +++ b/src/HOL/Word/WordArith.thy	Wed Jan 28 16:29:16 2009 +0100
    44.3 @@ -1002,7 +1002,7 @@
    44.4    apply (auto simp add: unat_def uint_sub_if')
    44.5     apply (rule nat_diff_distrib)
    44.6      prefer 3
    44.7 -    apply (simp add: group_simps)
    44.8 +    apply (simp add: algebra_simps)
    44.9      apply (rule nat_diff_distrib [THEN trans])
   44.10        prefer 3
   44.11        apply (subst nat_add_distrib)
    45.1 --- a/src/HOL/ZF/LProd.thy	Sun Jan 18 13:58:17 2009 +0100
    45.2 +++ b/src/HOL/ZF/LProd.thy	Wed Jan 28 16:29:16 2009 +0100
    45.3 @@ -45,9 +45,9 @@
    45.4    case (lprod_list ah at bh bt a b)
    45.5    from prems have transR: "trans R" by auto
    45.6    have as: "multiset_of (ah @ a # at) = multiset_of (ah @ at) + {#a#}" (is "_ = ?ma + _")
    45.7 -    by (simp add: ring_simps)
    45.8 +    by (simp add: algebra_simps)
    45.9    have bs: "multiset_of (bh @ b # bt) = multiset_of (bh @ bt) + {#b#}" (is "_ = ?mb + _")
   45.10 -    by (simp add: ring_simps)
   45.11 +    by (simp add: algebra_simps)
   45.12    from prems have "(?ma, ?mb) \<in> mult R"
   45.13      by auto
   45.14    with mult_implies_one_step[OF transR] have 
   45.15 @@ -66,7 +66,7 @@
   45.16      then show ?thesis
   45.17        apply (simp only: as bs)
   45.18        apply (simp only: decomposed True)
   45.19 -      apply (simp add: ring_simps)
   45.20 +      apply (simp add: algebra_simps)
   45.21        done
   45.22    next
   45.23      case False
   45.24 @@ -78,7 +78,7 @@
   45.25      then show ?thesis
   45.26        apply (simp only: as bs)
   45.27        apply (simp only: decomposed)
   45.28 -      apply (simp add: ring_simps)
   45.29 +      apply (simp add: algebra_simps)
   45.30        done
   45.31    qed
   45.32  qed
    46.1 --- a/src/HOL/ex/Lagrange.thy	Sun Jan 18 13:58:17 2009 +0100
    46.2 +++ b/src/HOL/ex/Lagrange.thy	Wed Jan 28 16:29:16 2009 +0100
    46.3 @@ -35,7 +35,7 @@
    46.4     sq (x1*y2 + x2*y1 + x3*y4 - x4*y3)  +
    46.5     sq (x1*y3 - x2*y4 + x3*y1 + x4*y2)  +
    46.6     sq (x1*y4 + x2*y3 - x3*y2 + x4*y1)"
    46.7 -by (simp add: sq_def ring_simps)
    46.8 +by (simp add: sq_def algebra_simps)
    46.9  
   46.10  
   46.11  text {* A challenge by John Harrison. Takes about 12s on a 1.6GHz machine. *}
   46.12 @@ -51,6 +51,6 @@
   46.13        sq (p1*u2 + q1*t2 - r1*w2 + s1*v2 - t1*q2 + u1*p2 - v1*s2 + w1*r2) +
   46.14        sq (p1*v2 + q1*w2 + r1*t2 - s1*u2 - t1*r2 + u1*s2 + v1*p2 - w1*q2) +
   46.15        sq (p1*w2 - q1*v2 + r1*u2 + s1*t2 - t1*s2 - u1*r2 + v1*q2 + w1*p2)"
   46.16 -by (simp add: sq_def ring_simps)
   46.17 +by (simp add: sq_def algebra_simps)
   46.18  
   46.19  end
    47.1 --- a/src/HOL/ex/MIR.thy	Sun Jan 18 13:58:17 2009 +0100
    47.2 +++ b/src/HOL/ex/MIR.thy	Wed Jan 28 16:29:16 2009 +0100
    47.3 @@ -709,11 +709,11 @@
    47.4  next
    47.5    case (2 n c t)  hence gd: "g dvd c" by simp
    47.6    from gp have gnz: "g \<noteq> 0" by simp
    47.7 -  from prems show ?case by (simp add: real_of_int_div[OF gnz gd] ring_simps)
    47.8 +  from prems show ?case by (simp add: real_of_int_div[OF gnz gd] algebra_simps)
    47.9  next
   47.10    case (3 c s t)  hence gd: "g dvd c" by simp
   47.11    from gp have gnz: "g \<noteq> 0" by simp
   47.12 -  from prems show ?case by (simp add: real_of_int_div[OF gnz gd] ring_simps) 
   47.13 +  from prems show ?case by (simp add: real_of_int_div[OF gnz gd] algebra_simps) 
   47.14  qed (auto simp add: numgcd_def gp)
   47.15  consts ismaxcoeff:: "num \<Rightarrow> int \<Rightarrow> bool"
   47.16  recdef ismaxcoeff "measure size"
   47.17 @@ -850,12 +850,12 @@
   47.18  lemma numadd[simp]: "Inum bs (numadd (t,s)) = Inum bs (Add t s)"
   47.19  apply (induct t s rule: numadd.induct, simp_all add: Let_def)
   47.20   apply (case_tac "c1+c2 = 0",case_tac "n1 \<le> n2", simp_all)
   47.21 -  apply (case_tac "n1 = n2", simp_all add: ring_simps)
   47.22 +  apply (case_tac "n1 = n2", simp_all add: algebra_simps)
   47.23    apply (simp only: left_distrib[symmetric])
   47.24   apply simp
   47.25  apply (case_tac "lex_bnd t1 t2", simp_all)
   47.26   apply (case_tac "c1+c2 = 0")
   47.27 -  by (case_tac "t1 = t2", simp_all add: ring_simps left_distrib[symmetric] real_of_int_mult[symmetric] real_of_int_add[symmetric]del: real_of_int_mult real_of_int_add left_distrib)
   47.28 +  by (case_tac "t1 = t2", simp_all add: algebra_simps left_distrib[symmetric] real_of_int_mult[symmetric] real_of_int_add[symmetric]del: real_of_int_mult real_of_int_add left_distrib)
   47.29  
   47.30  lemma numadd_nb[simp]: "\<lbrakk> numbound0 t ; numbound0 s\<rbrakk> \<Longrightarrow> numbound0 (numadd (t,s))"
   47.31  by (induct t s rule: numadd.induct, auto simp add: Let_def)
   47.32 @@ -868,7 +868,7 @@
   47.33    "nummul t = (\<lambda> i. Mul i t)"
   47.34  
   47.35  lemma nummul[simp]: "\<And> i. Inum bs (nummul t i) = Inum bs (Mul i t)"
   47.36 -by (induct t rule: nummul.induct, auto simp add: ring_simps)
   47.37 +by (induct t rule: nummul.induct, auto simp add: algebra_simps)
   47.38  
   47.39  lemma nummul_nb[simp]: "\<And> i. numbound0 t \<Longrightarrow> numbound0 (nummul t i)"
   47.40  by (induct t rule: nummul.induct, auto)
   47.41 @@ -928,7 +928,7 @@
   47.42    with prems(1) have b:"Inum bs (Add ?bv ?bi) = Inum bs b" and bii: "isint ?bi bs" by blast+
   47.43    from prems(2) have tibi: "ti = CF c a ?bi" by (simp add: Let_def split_def)
   47.44    from prems(2) b[symmetric] bii show ?case by (auto simp add: Let_def split_def isint_Floor isint_add isint_Mul isint_CF)
   47.45 -qed (auto simp add: Let_def isint_iff isint_Floor isint_add isint_Mul split_def ring_simps)
   47.46 +qed (auto simp add: Let_def isint_iff isint_Floor isint_add isint_Mul split_def algebra_simps)
   47.47  
   47.48  lemma split_int_nb: "numbound0 t \<Longrightarrow> numbound0 (fst (split_int t)) \<and> numbound0 (snd (split_int t)) "
   47.49  by (induct t rule: split_int.induct, auto simp add: Let_def split_def)
   47.50 @@ -1768,7 +1768,7 @@
   47.51    have th: "(real a + b >0) = (real (-a) + (-b)< 0)" by arith
   47.52    show ?thesis using myless[rule_format, where b="real (floor b)"] 
   47.53      by (simp only:th split_int_less_real'[where a="-a" and b="-b"]) 
   47.54 -    (simp add: ring_simps diff_def[symmetric],arith)
   47.55 +    (simp add: algebra_simps diff_def[symmetric],arith)
   47.56  qed
   47.57  
   47.58  lemma split_int_le_real: 
   47.59 @@ -1795,7 +1795,7 @@
   47.60  proof- 
   47.61    have th: "(real a + b \<ge>0) = (real (-a) + (-b) \<le> 0)" by arith
   47.62    show ?thesis by (simp only: th split_int_le_real'[where a="-a" and b="-b"])
   47.63 -    (simp add: ring_simps diff_def[symmetric],arith)
   47.64 +    (simp add: algebra_simps diff_def[symmetric],arith)
   47.65  qed
   47.66  
   47.67  lemma split_int_eq_real: "(real (a::int) = b) = ( a = floor b \<and> b = real (floor b))" (is "?l = ?r")
   47.68 @@ -2281,9 +2281,9 @@
   47.69        (is "?ri rdvd ?rc*?rx - ?rc*(?rk*?rd) + ?I x e" is "?ri rdvd ?rt")
   47.70        hence "\<exists> (l::int). ?rt = ?ri * (real l)" by (simp add: rdvd_def)
   47.71        hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri*(real l)+?rc*(?rk * (real i) * (real di))" 
   47.72 -	by (simp add: ring_simps di_def)
   47.73 +	by (simp add: algebra_simps di_def)
   47.74        hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri*(real (l + c*k*di))"
   47.75 -	by (simp add: ring_simps)
   47.76 +	by (simp add: algebra_simps)
   47.77        hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri* (real l)" by blast
   47.78        thus "real i rdvd real c * real x + Inum (real x # bs) e" using rdvd_def by simp
   47.79      next
   47.80 @@ -2292,7 +2292,7 @@
   47.81        hence "\<exists> (l::int). ?rc*?rx+?e = ?ri * (real l)" by (simp add: rdvd_def)
   47.82        hence "\<exists> (l::int). ?rc*?rx - real c * (real k * real d) +?e = ?ri * (real l) - real c * (real k * real d)" by simp
   47.83        hence "\<exists> (l::int). ?rc*?rx - real c * (real k * real d) +?e = ?ri * (real l) - real c * (real k * real i * real di)" by (simp add: di_def)
   47.84 -      hence "\<exists> (l::int). ?rc*?rx - real c * (real k * real d) +?e = ?ri * (real (l - c*k*di))" by (simp add: ring_simps)
   47.85 +      hence "\<exists> (l::int). ?rc*?rx - real c * (real k * real d) +?e = ?ri * (real (l - c*k*di))" by (simp add: algebra_simps)
   47.86        hence "\<exists> (l::int). ?rc*?rx - real c * (real k * real d) +?e = ?ri * (real l)"
   47.87  	by blast
   47.88        thus "real i rdvd real c * real x - real c * (real k * real d) + Inum (real x # bs) e" using rdvd_def by simp
   47.89 @@ -2308,9 +2308,9 @@
   47.90        (is "?ri rdvd ?rc*?rx - ?rc*(?rk*?rd) + ?I x e" is "?ri rdvd ?rt")
   47.91        hence "\<exists> (l::int). ?rt = ?ri * (real l)" by (simp add: rdvd_def)
   47.92        hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri*(real l)+?rc*(?rk * (real i) * (real di))" 
   47.93 -	by (simp add: ring_simps di_def)
   47.94 +	by (simp add: algebra_simps di_def)
   47.95        hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri*(real (l + c*k*di))"
   47.96 -	by (simp add: ring_simps)
   47.97 +	by (simp add: algebra_simps)
   47.98        hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri* (real l)" by blast
   47.99        thus "real i rdvd real c * real x + Inum (real x # bs) e" using rdvd_def by simp
  47.100      next
  47.101 @@ -2319,7 +2319,7 @@
  47.102        hence "\<exists> (l::int). ?rc*?rx+?e = ?ri * (real l)" by (simp add: rdvd_def)
  47.103        hence "\<exists> (l::int). ?rc*?rx - real c * (real k * real d) +?e = ?ri * (real l) - real c * (real k * real d)" by simp
  47.104        hence "\<exists> (l::int). ?rc*?rx - real c * (real k * real d) +?e = ?ri * (real l) - real c * (real k * real i * real di)" by (simp add: di_def)
  47.105 -      hence "\<exists> (l::int). ?rc*?rx - real c * (real k * real d) +?e = ?ri * (real (l - c*k*di))" by (simp add: ring_simps)
  47.106 +      hence "\<exists> (l::int). ?rc*?rx - real c * (real k * real d) +?e = ?ri * (real (l - c*k*di))" by (simp add: algebra_simps)
  47.107        hence "\<exists> (l::int). ?rc*?rx - real c * (real k * real d) +?e = ?ri * (real l)"
  47.108  	by blast
  47.109        thus "real i rdvd real c * real x - real c * (real k * real d) + Inum (real x # bs) e" using rdvd_def by simp
  47.110 @@ -2450,16 +2450,16 @@
  47.111    have th: "(real j rdvd real c * real x - Inum (real x # bs) e) =
  47.112         (real j rdvd - (real c * real x - Inum (real x # bs) e))"
  47.113      by (simp only: rdvd_minus[symmetric])
  47.114 -  from prems show  ?case
  47.115 -    by (simp add: ring_simps th[simplified ring_simps]
  47.116 +  from prems th show  ?case
  47.117 +    by (simp add: algebra_simps
  47.118        numbound0_I[where bs="bs" and b'="real x" and b="- real x"])
  47.119  next
  47.120      case (10 j c e)
  47.121    have th: "(real j rdvd real c * real x - Inum (real x # bs) e) =
  47.122         (real j rdvd - (real c * real x - Inum (real x # bs) e))"
  47.123      by (simp only: rdvd_minus[symmetric])
  47.124 -  from prems show  ?case
  47.125 -    by (simp add: ring_simps th[simplified ring_simps]
  47.126 +  from prems th show  ?case
  47.127 +    by (simp add: algebra_simps
  47.128        numbound0_I[where bs="bs" and b'="real x" and b="- real x"])
  47.129  qed (auto simp add: numbound0_I[where bs="bs" and b="real x" and b'="- real x"] nth_pos2)
  47.130  
  47.131 @@ -2541,7 +2541,7 @@
  47.132      hence "(real l * real x + real (l div c) * Inum (real x # bs) e < (0\<Colon>real)) =
  47.133            (real (c * (l div c)) * real x + real (l div c) * Inum (real x # bs) e < 0)"
  47.134        by simp
  47.135 -    also have "\<dots> = (real (l div c) * (real c * real x + Inum (real x # bs) e) < (real (l div c)) * 0)" by (simp add: ring_simps)
  47.136 +    also have "\<dots> = (real (l div c) * (real c * real x + Inum (real x # bs) e) < (real (l div c)) * 0)" by (simp add: algebra_simps)
  47.137      also have "\<dots> = (real c * real x + Inum (real x # bs) e < 0)"
  47.138      using mult_less_0_iff [where a="real (l div c)" and b="real c * real x + Inum (real x # bs) e"] ldcp by simp
  47.139    finally show ?case using numbound0_I[OF be,where b="real (l * x)" and b'="real x" and bs="bs"] be  isint_Mul[OF ei] by simp
  47.140 @@ -2559,7 +2559,7 @@
  47.141      hence "(real l * real x + real (l div c) * Inum (real x # bs) e \<le> (0\<Colon>real)) =
  47.142            (real (c * (l div c)) * real x + real (l div c) * Inum (real x # bs) e \<le> 0)"
  47.143        by simp
  47.144 -    also have "\<dots> = (real (l div c) * (real c * real x + Inum (real x # bs) e) \<le> (real (l div c)) * 0)" by (simp add: ring_simps)
  47.145 +    also have "\<dots> = (real (l div c) * (real c * real x + Inum (real x # bs) e) \<le> (real (l div c)) * 0)" by (simp add: algebra_simps)
  47.146      also have "\<dots> = (real c * real x + Inum (real x # bs) e \<le> 0)"
  47.147      using mult_le_0_iff [where a="real (l div c)" and b="real c * real x + Inum (real x # bs) e"] ldcp by simp
  47.148    finally show ?case using numbound0_I[OF be,where b="real (l * x)" and b'="real x" and bs="bs"]  be  isint_Mul[OF ei] by simp
  47.149 @@ -2577,7 +2577,7 @@
  47.150      hence "(real l * real x + real (l div c) * Inum (real x # bs) e > (0\<Colon>real)) =
  47.151            (real (c * (l div c)) * real x + real (l div c) * Inum (real x # bs) e > 0)"
  47.152        by simp
  47.153 -    also have "\<dots> = (real (l div c) * (real c * real x + Inum (real x # bs) e) > (real (l div c)) * 0)" by (simp add: ring_simps)
  47.154 +    also have "\<dots> = (real (l div c) * (real c * real x + Inum (real x # bs) e) > (real (l div c)) * 0)" by (simp add: algebra_simps)
  47.155      also have "\<dots> = (real c * real x + Inum (real x # bs) e > 0)"
  47.156      using zero_less_mult_iff [where a="real (l div c)" and b="real c * real x + Inum (real x # bs) e"] ldcp by simp
  47.157    finally show ?case using numbound0_I[OF be,where b="real (l * x)" and b'="real x" and bs="bs"]  be  isint_Mul[OF ei] by simp
  47.158 @@ -2595,7 +2595,7 @@
  47.159      hence "(real l * real x + real (l div c) * Inum (real x # bs) e \<ge> (0\<Colon>real)) =
  47.160            (real (c * (l div c)) * real x + real (l div c) * Inum (real x # bs) e \<ge> 0)"
  47.161        by simp
  47.162 -    also have "\<dots> = (real (l div c) * (real c * real x + Inum (real x # bs) e) \<ge> (real (l div c)) * 0)" by (simp add: ring_simps)
  47.163 +    also have "\<dots> = (real (l div c) * (real c * real x + Inum (real x # bs) e) \<ge> (real (l div c)) * 0)" by (simp add: algebra_simps)
  47.164      also have "\<dots> = (real c * real x + Inum (real x # bs) e \<ge> 0)"
  47.165      using zero_le_mult_iff [where a="real (l div c)" and b="real c * real x + Inum (real x # bs) e"] ldcp by simp
  47.166    finally show ?case using numbound0_I[OF be,where b="real (l * x)" and b'="real x" and bs="bs"]  be  isint_Mul[OF ei] by simp
  47.167 @@ -2613,7 +2613,7 @@
  47.168      hence "(real l * real x + real (l div c) * Inum (real x # bs) e = (0\<Colon>real)) =
  47.169            (real (c * (l div c)) * real x + real (l div c) * Inum (real x # bs) e = 0)"
  47.170        by simp
  47.171 -    also have "\<dots> = (real (l div c) * (real c * real x + Inum (real x # bs) e) = (real (l div c)) * 0)" by (simp add: ring_simps)
  47.172 +    also have "\<dots> = (real (l div c) * (real c * real x + Inum (real x # bs) e) = (real (l div c)) * 0)" by (simp add: algebra_simps)
  47.173      also have "\<dots> = (real c * real x + Inum (real x # bs) e = 0)"
  47.174      using mult_eq_0_iff [where a="real (l div c)" and b="real c * real x + Inum (real x # bs) e"] ldcp by simp
  47.175    finally show ?case using numbound0_I[OF be,where b="real (l * x)" and b'="real x" and bs="bs"]  be  isint_Mul[OF ei] by simp
  47.176 @@ -2631,7 +2631,7 @@
  47.177      hence "(real l * real x + real (l div c) * Inum (real x # bs) e \<noteq> (0\<Colon>real)) =
  47.178            (real (c * (l div c)) * real x + real (l div c) * Inum (real x # bs) e \<noteq> 0)"
  47.179        by simp
  47.180 -    also have "\<dots> = (real (l div c) * (real c * real x + Inum (real x # bs) e) \<noteq> (real (l div c)) * 0)" by (simp add: ring_simps)
  47.181 +    also have "\<dots> = (real (l div c) * (real c * real x + Inum (real x # bs) e) \<noteq> (real (l div c)) * 0)" by (simp add: algebra_simps)
  47.182      also have "\<dots> = (real c * real x + Inum (real x # bs) e \<noteq> 0)"
  47.183      using zero_le_mult_iff [where a="real (l div c)" and b="real c * real x + Inum (real x # bs) e"] ldcp by simp
  47.184    finally show ?case using numbound0_I[OF be,where b="real (l * x)" and b'="real x" and bs="bs"]  be  isint_Mul[OF ei] by simp
  47.185 @@ -2647,7 +2647,7 @@
  47.186      hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric] 
  47.187        by simp
  47.188      hence "(\<exists> (k::int). real l * real x + real (l div c) * Inum (real x # bs) e = (real (l div c) * real j) * real k) = (\<exists> (k::int). real (c * (l div c)) * real x + real (l div c) * Inum (real x # bs) e = (real (l div c) * real j) * real k)"  by simp
  47.189 -    also have "\<dots> = (\<exists> (k::int). real (l div c) * (real c * real x + Inum (real x # bs) e - real j * real k) = real (l div c)*0)" by (simp add: ring_simps)
  47.190 +    also have "\<dots> = (\<exists> (k::int). real (l div c) * (real c * real x + Inum (real x # bs) e - real j * real k) = real (l div c)*0)" by (simp add: algebra_simps)
  47.191      also fix k have "\<dots> = (\<exists> (k::int). real c * real x + Inum (real x # bs) e - real j * real k = 0)"
  47.192      using zero_le_mult_iff [where a="real (l div c)" and b="real c * real x + Inum (real x # bs) e - real j * real k"] ldcp by simp
  47.193    also have "\<dots> = (\<exists> (k::int). real c * real x + Inum (real x # bs) e = real j * real k)" by simp
  47.194 @@ -2664,7 +2664,7 @@
  47.195      hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric] 
  47.196        by simp
  47.197      hence "(\<exists> (k::int). real l * real x + real (l div c) * Inum (real x # bs) e = (real (l div c) * real j) * real k) = (\<exists> (k::int). real (c * (l div c)) * real x + real (l div c) * Inum (real x # bs) e = (real (l div c) * real j) * real k)"  by simp
  47.198 -    also have "\<dots> = (\<exists> (k::int). real (l div c) * (real c * real x + Inum (real x # bs) e - real j * real k) = real (l div c)*0)" by (simp add: ring_simps)
  47.199 +    also have "\<dots> = (\<exists> (k::int). real (l div c) * (real c * real x + Inum (real x # bs) e - real j * real k) = real (l div c)*0)" by (simp add: algebra_simps)
  47.200      also fix k have "\<dots> = (\<exists> (k::int). real c * real x + Inum (real x # bs) e - real j * real k = 0)"
  47.201      using zero_le_mult_iff [where a="real (l div c)" and b="real c * real x + Inum (real x # bs) e - real j * real k"] ldcp by simp
  47.202    also have "\<dots> = (\<exists> (k::int). real c * real x + Inum (real x # bs) e = real j * real k)" by simp
  47.203 @@ -2719,7 +2719,7 @@
  47.204        hence "x + floor ?e \<ge> 1 \<and> x + floor ?e \<le> d"  by simp
  47.205        hence "\<exists> (j::int) \<in> {1 .. d}. j = x + floor ?e" by simp
  47.206        hence "\<exists> (j::int) \<in> {1 .. d}. real x = real (- floor ?e + j)" 
  47.207 -	by (simp only: real_of_int_inject) (simp add: ring_simps)
  47.208 +	by (simp only: real_of_int_inject) (simp add: algebra_simps)
  47.209        hence "\<exists> (j::int) \<in> {1 .. d}. real x = - ?e + real j" 
  47.210  	by (simp add: ie[simplified isint_iff])
  47.211        with nob have ?case by auto}
  47.212 @@ -2744,7 +2744,7 @@
  47.213  	using ie by simp
  47.214        hence "x + floor ?e +1 \<ge> 1 \<and> x + floor ?e + 1 \<le> d"  by simp
  47.215        hence "\<exists> (j::int) \<in> {1 .. d}. j = x + floor ?e + 1" by simp
  47.216 -      hence "\<exists> (j::int) \<in> {1 .. d}. x= - floor ?e - 1 + j" by (simp add: ring_simps)
  47.217 +      hence "\<exists> (j::int) \<in> {1 .. d}. x= - floor ?e - 1 + j" by (simp add: algebra_simps)
  47.218        hence "\<exists> (j::int) \<in> {1 .. d}. real x= real (- floor ?e - 1 + j)" 
  47.219  	by (simp only: real_of_int_inject)
  47.220        hence "\<exists> (j::int) \<in> {1 .. d}. real x= - ?e - 1 + real j" 
  47.221 @@ -2759,7 +2759,7 @@
  47.222      have vb: "?v \<in> set (\<beta> (Eq (CN 0 c e)))" by simp
  47.223      from p have "real x= - ?e" by (simp add: c1) with prems(11) show ?case using dp
  47.224        by simp (erule ballE[where x="1"],
  47.225 -	simp_all add:ring_simps numbound0_I[OF bn,where b="real x"and b'="a"and bs="bs"])
  47.226 +	simp_all add:algebra_simps numbound0_I[OF bn,where b="real x"and b'="a"and bs="bs"])
  47.227  next
  47.228    case (4 c e)hence p: "Ifm (real x #bs) (NEq (CN 0 c e))" (is "?p x") and c1: "c=1" 
  47.229      and bn:"numbound0 e" and ie1: "isint e (a #bs)" using dvd1_eq1[where x="c"] by simp+
  47.230 @@ -2983,7 +2983,7 @@
  47.231        from prems have "?I (real x) (?s (Eq (CN 0 c e))) = ((real c * (?N (real x) t / real k) + ?N (real x) e)* real k = 0)"
  47.232  	using real_of_int_div[OF knz kdt]
  47.233  	  numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  47.234 -	  numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"] by (simp add: ti ring_simps)
  47.235 +	  numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"] by (simp add: ti algebra_simps)
  47.236        also have "\<dots> = (?I ?tk (Eq (CN 0 c e)))" using nonzero_eq_divide_eq[OF knz', where a="real c * (?N (real x) t / real k) + ?N (real x) e" and b="0", symmetric] real_of_int_div[OF knz kdt] numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  47.237  	  numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"]
  47.238  	by (simp add: ti)
  47.239 @@ -3005,7 +3005,7 @@
  47.240        from prems have "?I (real x) (?s (NEq (CN 0 c e))) = ((real c * (?N (real x) t / real k) + ?N (real x) e)* real k \<noteq> 0)"
  47.241  	using real_of_int_div[OF knz kdt]
  47.242  	  numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  47.243 -	  numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"] by (simp add: ti ring_simps)
  47.244 +	  numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"] by (simp add: ti algebra_simps)
  47.245        also have "\<dots> = (?I ?tk (NEq (CN 0 c e)))" using nonzero_eq_divide_eq[OF knz', where a="real c * (?N (real x) t / real k) + ?N (real x) e" and b="0", symmetric] real_of_int_div[OF knz kdt] numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  47.246  	  numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"]
  47.247  	by (simp add: ti)
  47.248 @@ -3027,7 +3027,7 @@
  47.249        from prems have "?I (real x) (?s (Lt (CN 0 c e))) = ((real c * (?N (real x) t / real k) + ?N (real x) e)* real k < 0)"
  47.250  	using real_of_int_div[OF knz kdt]
  47.251  	  numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  47.252 -	  numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"] by (simp add: ti ring_simps)
  47.253 +	  numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"] by (simp add: ti algebra_simps)
  47.254        also have "\<dots> = (?I ?tk (Lt (CN 0 c e)))" using pos_less_divide_eq[OF kpos, where a="real c * (?N (real x) t / real k) + ?N (real x) e" and b="0", symmetric] real_of_int_div[OF knz kdt] numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  47.255  	  numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"]
  47.256  	by (simp add: ti)
  47.257 @@ -3049,7 +3049,7 @@
  47.258        from prems have "?I (real x) (?s (Le (CN 0 c e))) = ((real c * (?N (real x) t / real k) + ?N (real x) e)* real k \<le> 0)"
  47.259  	using real_of_int_div[OF knz kdt]
  47.260  	  numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  47.261 -	  numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"] by (simp add: ti ring_simps)
  47.262 +	  numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"] by (simp add: ti algebra_simps)
  47.263        also have "\<dots> = (?I ?tk (Le (CN 0 c e)))" using pos_le_divide_eq[OF kpos, where a="real c * (?N (real x) t / real k) + ?N (real x) e" and b="0", symmetric] real_of_int_div[OF knz kdt] numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  47.264  	  numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"]
  47.265  	by (simp add: ti)
  47.266 @@ -3071,7 +3071,7 @@
  47.267        from prems have "?I (real x) (?s (Gt (CN 0 c e))) = ((real c * (?N (real x) t / real k) + ?N (real x) e)* real k > 0)"
  47.268  	using real_of_int_div[OF knz kdt]
  47.269  	  numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  47.270 -	  numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"] by (simp add: ti ring_simps)
  47.271 +	  numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"] by (simp add: ti algebra_simps)
  47.272        also have "\<dots> = (?I ?tk (Gt (CN 0 c e)))" using pos_divide_less_eq[OF kpos, where a="real c * (?N (real x) t / real k) + ?N (real x) e" and b="0", symmetric] real_of_int_div[OF knz kdt] numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  47.273  	  numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"]
  47.274  	by (simp add: ti)
  47.275 @@ -3093,7 +3093,7 @@
  47.276        from prems have "?I (real x) (?s (Ge (CN 0 c e))) = ((real c * (?N (real x) t / real k) + ?N (real x) e)* real k \<ge> 0)"
  47.277  	using real_of_int_div[OF knz kdt]
  47.278  	  numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  47.279 -	  numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"] by (simp add: ti ring_simps)
  47.280 +	  numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"] by (simp add: ti algebra_simps)
  47.281        also have "\<dots> = (?I ?tk (Ge (CN 0 c e)))" using pos_divide_le_eq[OF kpos, where a="real c * (?N (real x) t / real k) + ?N (real x) e" and b="0", symmetric] real_of_int_div[OF knz kdt] numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  47.282  	  numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"]
  47.283  	by (simp add: ti)
  47.284 @@ -3114,7 +3114,7 @@
  47.285        from prems have "?I (real x) (?s (Dvd i (CN 0 c e))) = (real i * real k rdvd (real c * (?N (real x) t / real k) + ?N (real x) e)* real k)"
  47.286  	using real_of_int_div[OF knz kdt]
  47.287  	  numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  47.288 -	  numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"] by (simp add: ti ring_simps)
  47.289 +	  numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"] by (simp add: ti algebra_simps)
  47.290        also have "\<dots> = (?I ?tk (Dvd i (CN 0 c e)))" using rdvd_mult[OF knz, where n="i"] real_of_int_div[OF knz kdt] numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  47.291  	  numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"]
  47.292  	by (simp add: ti)
  47.293 @@ -3135,7 +3135,7 @@
  47.294        from prems have "?I (real x) (?s (NDvd i (CN 0 c e))) = (\<not> (real i * real k rdvd (real c * (?N (real x) t / real k) + ?N (real x) e)* real k))"
  47.295  	using real_of_int_div[OF knz kdt]
  47.296  	  numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  47.297 -	  numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"] by (simp add: ti ring_simps)
  47.298 +	  numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"] by (simp add: ti algebra_simps)
  47.299        also have "\<dots> = (?I ?tk (NDvd i (CN 0 c e)))" using rdvd_mult[OF knz, where n="i"] real_of_int_div[OF knz kdt] numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  47.300  	  numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"]
  47.301  	by (simp add: ti)
  47.302 @@ -3154,7 +3154,7 @@
  47.303    from kp have knz: "k\<noteq>0" by simp hence knz': "real k \<noteq> 0" by simp
  47.304      {assume kdc: "k dvd c" from prems have  ?case using real_of_int_div[OF knz kdc] by simp } 
  47.305      moreover 
  47.306 -    {assume nkdc: "\<not> k dvd c" hence ?case using numbound0_I[OF nb, where bs="bs" and b="real (x*k)" and b'="real x"] nonzero_eq_divide_eq[OF knz', where b="0" and a="real c * real x + Inum (real x # bs) e", symmetric] by (simp add: ring_simps)}
  47.307 +    {assume nkdc: "\<not> k dvd c" hence ?case using numbound0_I[OF nb, where bs="bs" and b="real (x*k)" and b'="real x"] nonzero_eq_divide_eq[OF knz', where b="0" and a="real c * real x + Inum (real x # bs) e", symmetric] by (simp add: algebra_simps)}
  47.308      ultimately show ?case by blast 
  47.309  next
  47.310    case (4 c e)   
  47.311 @@ -3162,7 +3162,7 @@
  47.312    from kp have knz: "k\<noteq>0" by simp hence knz': "real k \<noteq> 0" by simp
  47.313      {assume kdc: "k dvd c" from prems have  ?case using real_of_int_div[OF knz kdc] by simp } 
  47.314      moreover 
  47.315 -    {assume nkdc: "\<not> k dvd c" hence ?case using numbound0_I[OF nb, where bs="bs" and b="real (x*k)" and b'="real x"] nonzero_eq_divide_eq[OF knz', where b="0" and a="real c * real x + Inum (real x # bs) e", symmetric] by (simp add: ring_simps)}
  47.316 +    {assume nkdc: "\<not> k dvd c" hence ?case using numbound0_I[OF nb, where bs="bs" and b="real (x*k)" and b'="real x"] nonzero_eq_divide_eq[OF knz', where b="0" and a="real c * real x + Inum (real x # bs) e", symmetric] by (simp add: algebra_simps)}
  47.317      ultimately show ?case by blast 
  47.318  next
  47.319    case (5 c e)   
  47.320 @@ -3170,7 +3170,7 @@
  47.321    from kp have knz: "k\<noteq>0" by simp hence knz': "real k \<noteq> 0" by simp
  47.322      {assume kdc: "k dvd c" from prems have  ?case using real_of_int_div[OF knz kdc] by simp } 
  47.323      moreover 
  47.324 -    {assume nkdc: "\<not> k dvd c" hence ?case using numbound0_I[OF nb, where bs="bs" and b="real (x*k)" and b'="real x"] pos_less_divide_eq[OF kp, where b="0" and a="real c * real x + Inum (real x # bs) e", symmetric] by (simp add: ring_simps)}
  47.325 +    {assume nkdc: "\<not> k dvd c" hence ?case using numbound0_I[OF nb, where bs="bs" and b="real (x*k)" and b'="real x"] pos_less_divide_eq[OF kp, where b="0" and a="real c * real x + Inum (real x # bs) e", symmetric] by (simp add: algebra_simps)}
  47.326      ultimately show ?case by blast 
  47.327  next
  47.328    case (6 c e)    
  47.329 @@ -3178,7 +3178,7 @@
  47.330    from kp have knz: "k\<noteq>0" by simp hence knz': "real k \<noteq> 0" by simp
  47.331      {assume kdc: "k dvd c" from prems have  ?case using real_of_int_div[OF knz kdc] by simp } 
  47.332      moreover 
  47.333 -    {assume nkdc: "\<not> k dvd c" hence ?case using numbound0_I[OF nb, where bs="bs" and b="real (x*k)" and b'="real x"] pos_le_divide_eq[OF kp, where b="0" and a="real c * real x + Inum (real x # bs) e", symmetric] by (simp add: ring_simps)}
  47.334 +    {assume nkdc: "\<not> k dvd c" hence ?case using numbound0_I[OF nb, where bs="bs" and b="real (x*k)" and b'="real x"] pos_le_divide_eq[OF kp, where b="0" and a="real c * real x + Inum (real x # bs) e", symmetric] by (simp add: algebra_simps)}
  47.335      ultimately show ?case by blast 
  47.336  next
  47.337    case (7 c e)    
  47.338 @@ -3186,7 +3186,7 @@
  47.339    from kp have knz: "k\<noteq>0" by simp hence knz': "real k \<noteq> 0" by simp
  47.340      {assume kdc: "k dvd c" from prems have  ?case using real_of_int_div[OF knz kdc] by simp } 
  47.341      moreover 
  47.342 -    {assume nkdc: "\<not> k dvd c" hence ?case using numbound0_I[OF nb, where bs="bs" and b="real (x*k)" and b'="real x"] pos_divide_less_eq[OF kp, where b="0" and a="real c * real x + Inum (real x # bs) e", symmetric] by (simp add: ring_simps)}
  47.343 +    {assume nkdc: "\<not> k dvd c" hence ?case using numbound0_I[OF nb, where bs="bs" and b="real (x*k)" and b'="real x"] pos_divide_less_eq[OF kp, where b="0" and a="real c * real x + Inum (real x # bs) e", symmetric] by (simp add: algebra_simps)}
  47.344      ultimately show ?case by blast 
  47.345  next
  47.346    case (8 c e)    
  47.347 @@ -3194,7 +3194,7 @@
  47.348    from kp have knz: "k\<noteq>0" by simp hence knz': "real k \<noteq> 0" by simp
  47.349      {assume kdc: "k dvd c" from prems have  ?case using real_of_int_div[OF knz kdc] by simp } 
  47.350      moreover 
  47.351 -    {assume nkdc: "\<not> k dvd c" hence ?case using numbound0_I[OF nb, where bs="bs" and b="real (x*k)" and b'="real x"] pos_divide_le_eq[OF kp, where b="0" and a="real c * real x + Inum (real x # bs) e", symmetric] by (simp add: ring_simps)}
  47.352 +    {assume nkdc: "\<not> k dvd c" hence ?case using numbound0_I[OF nb, where bs="bs" and b="real (x*k)" and b'="real x"] pos_divide_le_eq[OF kp, where b="0" and a="real c * real x + Inum (real x # bs) e", symmetric] by (simp add: algebra_simps)}
  47.353      ultimately show ?case by blast 
  47.354  next
  47.355    case (9 i c e)
  47.356 @@ -3206,7 +3206,7 @@
  47.357      hence "Ifm (real (x*k)#bs) (a\<rho> (Dvd i (CN 0 c e)) k) = 
  47.358        (real i * real k rdvd (real c * real x + Inum (real x#bs) e) * real k)" 
  47.359        using numbound0_I[OF nb, where bs="bs" and b="real (x*k)" and b'="real x"] 
  47.360 -      by (simp add: ring_simps)
  47.361 +      by (simp add: algebra_simps)
  47.362      also have "\<dots> = (Ifm (real x#bs) (Dvd i (CN 0 c e)))" by (simp add: rdvd_mult[OF knz, where n="i"])
  47.363      finally have ?case . }
  47.364    ultimately show ?case by blast 
  47.365 @@ -3220,7 +3220,7 @@
  47.366      hence "Ifm (real (x*k)#bs) (a\<rho> (NDvd i (CN 0 c e)) k) = 
  47.367        (\<not> (real i * real k rdvd (real c * real x + Inum (real x#bs) e) * real k))" 
  47.368        using numbound0_I[OF nb, where bs="bs" and b="real (x*k)" and b'="real x"] 
  47.369 -      by (simp add: ring_simps)
  47.370 +      by (simp add: algebra_simps)
  47.371      also have "\<dots> = (Ifm (real x#bs) (NDvd i (CN 0 c e)))" by (simp add: rdvd_mult[OF knz, where n="i"])
  47.372      finally have ?case . }
  47.373    ultimately show ?case by blast 
  47.374 @@ -3233,7 +3233,7 @@
  47.375  proof-
  47.376    have "(\<exists> x. ?D x \<and> ?P' x) = (\<exists> x. k dvd x \<and> ?P' x)" using int_rdvd_iff by simp
  47.377    also have "\<dots> = (\<exists>x. ?P' (x*k))" using unity_coeff_ex[where P="?P'" and l="k", simplified]
  47.378 -    by (simp add: ring_simps)
  47.379 +    by (simp add: algebra_simps)
  47.380    also have "\<dots> = (\<exists> x. ?P x)" using a\<rho> iszlfm_gen[OF lp] kp by auto
  47.381    finally show ?thesis .
  47.382  qed
  47.383 @@ -3297,7 +3297,7 @@
  47.384      by simp+
  47.385    {assume "real (c*i) \<noteq> - ?N i e + real (c*d)"
  47.386      with numbound0_I[OF nb, where bs="bs" and b="real i - real d" and b'="real i"]
  47.387 -    have ?case by (simp add: ring_simps)}
  47.388 +    have ?case by (simp add: algebra_simps)}
  47.389    moreover
  47.390    {assume pi: "real (c*i) = - ?N i e + real (c*d)"
  47.391      from mult_strict_left_mono[OF dp cp] have d: "(c*d) \<in> {1 .. c*d}" by simp
  47.392 @@ -3309,27 +3309,27 @@
  47.393      real_of_int_mult]
  47.394    show ?case using prems dp 
  47.395      by (simp add: add: numbound0_I[where bs="bs" and b="real i - real d" and b'="real i"] 
  47.396 -      ring_simps)
  47.397 +      algebra_simps)
  47.398  next
  47.399    case (6 c e)  hence cp: "c > 0" by simp
  47.400    from prems mult_strict_left_mono[OF dp cp, simplified real_of_int_less_iff[symmetric] 
  47.401      real_of_int_mult]
  47.402    show ?case using prems dp 
  47.403      by (simp add: add: numbound0_I[where bs="bs" and b="real i - real d" and b'="real i"] 
  47.404 -      ring_simps)
  47.405 +      algebra_simps)
  47.406  next
  47.407    case (7 c e) hence cp: "c >0" and nb: "numbound0 e" and ei: "isint e (real i#bs)"
  47.408      and nob: "\<forall> j\<in> {1 .. c*d}. real (c*i) \<noteq> - ?N i e + real j"
  47.409      and pi: "real (c*i) + ?N i e > 0" and cp': "real c >0"
  47.410      by simp+
  47.411    let ?fe = "floor (?N i e)"
  47.412 -  from pi cp have th:"(real i +?N i e / real c)*real c > 0" by (simp add: ring_simps)
  47.413 +  from pi cp have th:"(real i +?N i e / real c)*real c > 0" by (simp add: algebra_simps)
  47.414    from pi ei[simplified isint_iff] have "real (c*i + ?fe) > real (0::int)" by simp
  47.415    hence pi': "c*i + ?fe > 0" by (simp only: real_of_int_less_iff[symmetric])
  47.416    have "real (c*i) + ?N i e > real (c*d) \<or> real (c*i) + ?N i e \<le> real (c*d)" by auto
  47.417    moreover
  47.418    {assume "real (c*i) + ?N i e > real (c*d)" hence ?case
  47.419 -      by (simp add: ring_simps 
  47.420 +      by (simp add: algebra_simps 
  47.421  	numbound0_I[OF nb,where bs="bs" and b="real i - real d" and b'="real i"])} 
  47.422    moreover 
  47.423    {assume H:"real (c*i) + ?N i e \<le> real (c*d)"
  47.424 @@ -3337,7 +3337,7 @@
  47.425      hence pid: "c*i + ?fe \<le> c*d" by (simp only: real_of_int_le_iff)
  47.426      with pi' have "\<exists> j1\<in> {1 .. c*d}. c*i + ?fe = j1" by auto
  47.427      hence "\<exists> j1\<in> {1 .. c*d}. real (c*i) = - ?N i e + real j1" 
  47.428 -      by (simp only: diff_def[symmetric] real_of_int_mult real_of_int_add real_of_int_inject[symmetric] ei[simplified isint_iff] ring_simps)
  47.429 +      by (simp only: diff_def[symmetric] real_of_int_mult real_of_int_add real_of_int_inject[symmetric] ei[simplified isint_iff] algebra_simps)
  47.430      with nob  have ?case by blast }
  47.431    ultimately show ?case by blast
  47.432  next
  47.433 @@ -3346,13 +3346,13 @@
  47.434      and pi: "real (c*i) + ?N i e \<ge> 0" and cp': "real c >0"
  47.435      by simp+
  47.436    let ?fe = "floor (?N i e)"
  47.437 -  from pi cp have th:"(real i +?N i e / real c)*real c \<ge> 0" by (simp add: ring_simps)
  47.438 +  from pi cp have th:"(real i +?N i e / real c)*real c \<ge> 0" by (simp add: algebra_simps)
  47.439    from pi ei[simplified isint_iff] have "real (c*i + ?fe) \<ge> real (0::int)" by simp
  47.440    hence pi': "c*i + 1 + ?fe \<ge> 1" by (simp only: real_of_int_le_iff[symmetric])
  47.441    have "real (c*i) + ?N i e \<ge> real (c*d) \<or> real (c*i) + ?N i e < real (c*d)" by auto
  47.442    moreover
  47.443    {assume "real (c*i) + ?N i e \<ge> real (c*d)" hence ?case
  47.444 -      by (simp add: ring_simps 
  47.445 +      by (simp add: algebra_simps 
  47.446  	numbound0_I[OF nb,where bs="bs" and b="real i - real d" and b'="real i"])} 
  47.447    moreover 
  47.448    {assume H:"real (c*i) + ?N i e < real (c*d)"
  47.449 @@ -3360,9 +3360,9 @@
  47.450      hence pid: "c*i + 1 + ?fe \<le> c*d" by (simp only: real_of_int_le_iff)
  47.451      with pi' have "\<exists> j1\<in> {1 .. c*d}. c*i + 1+ ?fe = j1" by auto
  47.452      hence "\<exists> j1\<in> {1 .. c*d}. real (c*i) + 1= - ?N i e + real j1"
  47.453 -      by (simp only: diff_def[symmetric] real_of_int_mult real_of_int_add real_of_int_inject[symmetric] ei[simplified isint_iff] ring_simps real_of_one) 
  47.454 +      by (simp only: diff_def[symmetric] real_of_int_mult real_of_int_add real_of_int_inject[symmetric] ei[simplified isint_iff] algebra_simps real_of_one) 
  47.455      hence "\<exists> j1\<in> {1 .. c*d}. real (c*i) = (- ?N i e + real j1) - 1"
  47.456 -      by (simp only: ring_simps diff_def[symmetric])
  47.457 +      by (simp only: algebra_simps diff_def[symmetric])
  47.458          hence "\<exists> j1\<in> {1 .. c*d}. real (c*i) = - 1 - ?N i e + real j1"
  47.459  	  by (simp only: add_ac diff_def)
  47.460      with nob  have ?case by blast }
  47.461 @@ -3383,10 +3383,10 @@
  47.462        using int_rdvd_iff[where i="j" and t="(c*i - c*d + floor ?e)",symmetric, simplified]
  47.463        ie by simp
  47.464      also have "\<dots> = (real j rdvd real (c*(i - d)) + ?e)" 
  47.465 -      using ie by (simp add:ring_simps)
  47.466 +      using ie by (simp add:algebra_simps)
  47.467      finally show ?case 
  47.468        using numbound0_I[OF bn,where b="real i - real d" and b'="real i" and bs="bs"] p 
  47.469 -      by (simp add: ring_simps)
  47.470 +      by (simp add: algebra_simps)
  47.471  next
  47.472    case (10 j c e)   hence p: "\<not> (real j rdvd real (c*i) + ?N i e)" (is "?p x") and cp: "c > 0" and bn:"numbound0 e"  by simp+
  47.473      let ?e = "Inum (real i # bs) e"
  47.474 @@ -3403,10 +3403,10 @@
  47.475        using int_rdvd_iff[where i="j" and t="(c*i - c*d + floor ?e)",symmetric, simplified]
  47.476        ie by simp
  47.477      also have "\<dots> = Not (real j rdvd real (c*(i - d)) + ?e)" 
  47.478 -      using ie by (simp add:ring_simps)
  47.479 +      using ie by (simp add:algebra_simps)
  47.480      finally show ?case 
  47.481        using numbound0_I[OF bn,where b="real i - real d" and b'="real i" and bs="bs"] p 
  47.482 -      by (simp add: ring_simps)
  47.483 +      by (simp add: algebra_simps)
  47.484  qed(auto simp add: numbound0_I[where bs="bs" and b="real i - real d" and b'="real i"] nth_pos2)
  47.485  
  47.486  lemma \<sigma>_nb: assumes lp: "iszlfm p (a#bs)" and nb: "numbound0 t"
  47.487 @@ -3649,7 +3649,7 @@
  47.488  	from H 
  47.489  	have "?I (?p (p',n',s') j) \<longrightarrow> 
  47.490  	  (((?N ?nxs \<ge> real ?l) \<and> (?N ?nxs < real (?l + 1))) \<and> (?N a = ?N ?nxs ))" 
  47.491 -	  by (simp add: fp_def np ring_simps numsub numadd numfloor)
  47.492 +	  by (simp add: fp_def np algebra_simps numsub numadd numfloor)
  47.493  	also have "\<dots> \<longrightarrow> ((floor (?N ?nxs) = ?l) \<and> (?N a = ?N ?nxs ))"
  47.494  	  using floor_int_eq[where x="?N ?nxs" and n="?l"] by simp
  47.495  	moreover
  47.496 @@ -3675,7 +3675,7 @@
  47.497  	from H 
  47.498  	have "?I (?p (p',n',s') j) \<longrightarrow> 
  47.499  	  (((?N ?nxs \<ge> real ?l) \<and> (?N ?nxs < real (?l + 1))) \<and> (?N a = ?N ?nxs ))" 
  47.500 -	  by (simp add: np fp_def ring_simps numneg numfloor numadd numsub)
  47.501 +	  by (simp add: np fp_def algebra_simps numneg numfloor numadd numsub)
  47.502  	also have "\<dots> \<longrightarrow> ((floor (?N ?nxs) = ?l) \<and> (?N a = ?N ?nxs ))"
  47.503  	  using floor_int_eq[where x="?N ?nxs" and n="?l"] by simp
  47.504  	moreover
  47.505 @@ -3691,7 +3691,7 @@
  47.506    apply (erule_tac x = "(aa, aaa, ba)" in ballE) apply simp_all
  47.507    apply (erule_tac x = "(ab, ac, baa)" in ballE) apply simp_all
  47.508    done
  47.509 -qed (auto simp add: Let_def split_def ring_simps conj_rl)
  47.510 +qed (auto simp add: Let_def split_def algebra_simps conj_rl)
  47.511  
  47.512  lemma real_in_int_intervals: 
  47.513    assumes xb: "real m \<le> x \<and> x < real ((n::int) + 1)"
  47.514 @@ -3795,7 +3795,7 @@
  47.515      hence "\<exists> j\<in> {0 .. n}. 0 \<le> real n *x + ?N s - ?N (Floor s) - real j \<and> real n *x + ?N s - ?N (Floor s) - real (j+1) < 0"
  47.516        by(simp only: myl[rule_format, where b="real n * x + Inum (x # bs) s - Inum (x # bs) (Floor s)"] less_iff_diff_less_0[where a="real n *x + ?N s - ?N (Floor s)"]) 
  47.517      hence "\<exists> j\<in> {0.. n}. ?I (?p (p,n,s) j)"
  47.518 -      using pns by (simp add: fp_def np ring_simps numsub numadd)
  47.519 +      using pns by (simp add: fp_def np algebra_simps numsub numadd)
  47.520      then obtain "j" where j_def: "j\<in> {0 .. n} \<and> ?I (?p (p,n,s) j)" by blast
  47.521      hence "\<exists>x \<in> {?p (p,n,s) j |j. 0\<le> j \<and> j \<le> n }. ?I x" by auto
  47.522      hence ?case using pns 
  47.523 @@ -3813,7 +3813,7 @@
  47.524        have "real n *x + ?N s \<ge> real n + ?N s" by simp 
  47.525        moreover from real_of_int_floor_le[where r="?N s"]  have "real n + ?N s \<ge> real n + ?N (Floor s)" by simp
  47.526        ultimately have "real n *x + ?N s \<ge> ?N (Floor s) + real n" 
  47.527 -	by (simp only: ring_simps)}
  47.528 +	by (simp only: algebra_simps)}
  47.529      ultimately have "?N (Floor s) + real n \<le> real n *x + ?N s\<and> real n *x + ?N s < ?N (Floor s) + real (1::int)" by simp
  47.530      hence th: "real n \<le> real n *x + ?N s - ?N (Floor s) \<and> real n *x + ?N s - ?N (Floor s) < real (1::int)" by simp
  47.531      have th1: "\<forall> (a::real). (- a > 0) = (a < 0)" by auto
  47.532 @@ -3919,7 +3919,7 @@
  47.533    fix a n s
  47.534    assume H: "?N a = ?N (CN 0 n s)"
  47.535    show "?I (lt n s) = ?I (Lt a)" using H by (cases "n=0", (simp add: lt_def))
  47.536 -  (cases "n > 0", simp_all add: lt_def ring_simps myless[rule_format, where b="0"])
  47.537 +  (cases "n > 0", simp_all add: lt_def algebra_simps myless[rule_format, where b="0"])
  47.538  qed
  47.539  
  47.540  lemma lt_l: "isrlfm (rsplit lt a)"
  47.541 @@ -3931,7 +3931,7 @@
  47.542    fix a n s
  47.543    assume H: "?N a = ?N (CN 0 n s)"
  47.544    show "?I (le n s) = ?I (Le a)" using H by (cases "n=0", (simp add: le_def))
  47.545 -  (cases "n > 0", simp_all add: le_def ring_simps myl[rule_format, where b="0"])
  47.546 +  (cases "n > 0", simp_all add: le_def algebra_simps myl[rule_format, where b="0"])
  47.547  qed
  47.548  
  47.549  lemma le_l: "isrlfm (rsplit le a)"
  47.550 @@ -3943,7 +3943,7 @@
  47.551    fix a n s
  47.552    assume H: "?N a = ?N (CN 0 n s)"
  47.553    show "?I (gt n s) = ?I (Gt a)" using H by (cases "n=0", (simp add: gt_def))
  47.554 -  (cases "n > 0", simp_all add: gt_def ring_simps myless[rule_format, where b="0"])
  47.555 +  (cases "n > 0", simp_all add: gt_def algebra_simps myless[rule_format, where b="0"])
  47.556  qed
  47.557  lemma gt_l: "isrlfm (rsplit gt a)"
  47.558    by (rule rsplit_l[where f="gt" and a="a"], auto simp add: gt_def) 
  47.559 @@ -3954,7 +3954,7 @@
  47.560    fix a n s 
  47.561    assume H: "?N a = ?N (CN 0 n s)"
  47.562    show "?I (ge n s) = ?I (Ge a)" using H by (cases "n=0", (simp add: ge_def))
  47.563 -  (cases "n > 0", simp_all add: ge_def ring_simps myl[rule_format, where b="0"])
  47.564 +  (cases "n > 0", simp_all add: ge_def algebra_simps myl[rule_format, where b="0"])
  47.565  qed
  47.566  lemma ge_l: "isrlfm (rsplit ge a)"
  47.567    by (rule rsplit_l[where f="ge" and a="a"], auto simp add: ge_def) 
  47.568 @@ -3964,7 +3964,7 @@
  47.569  proof(clarify)
  47.570    fix a n s 
  47.571    assume H: "?N a = ?N (CN 0 n s)"
  47.572 -  show "?I (eq n s) = ?I (Eq a)" using H by (auto simp add: eq_def ring_simps)
  47.573 +  show "?I (eq n s) = ?I (Eq a)" using H by (auto simp add: eq_def algebra_simps)
  47.574  qed
  47.575  lemma eq_l: "isrlfm (rsplit eq a)"
  47.576    by (rule rsplit_l[where f="eq" and a="a"], auto simp add: eq_def) 
  47.577 @@ -3974,7 +3974,7 @@
  47.578  proof(clarify)
  47.579    fix a n s bs
  47.580    assume H: "?N a = ?N (CN 0 n s)"
  47.581 -  show "?I (neq n s) = ?I (NEq a)" using H by (auto simp add: neq_def ring_simps)
  47.582 +  show "?I (neq n s) = ?I (NEq a)" using H by (auto simp add: neq_def algebra_simps)
  47.583  qed
  47.584  
  47.585  lemma neq_l: "isrlfm (rsplit neq a)"
  47.586 @@ -4012,10 +4012,10 @@
  47.587    also have "\<dots> = (?DE \<and> ?a \<ge> 0 \<and> ?a < n)" by(simp only: small_le[OF ss0 ss1] small_lt[OF ss0 ss1])
  47.588    also have "\<dots> = (?DE \<and> (\<exists> j\<in> {0 .. (n - 1)}. ?a = j))" by simp
  47.589    also have "\<dots> = (?DE \<and> (\<exists> j\<in> {0 .. (n - 1)}. real (\<lfloor>real n * u - s\<rfloor>) = real j - real \<lfloor>s\<rfloor> ))"
  47.590 -    by (simp only: ring_simps real_of_int_diff[symmetric] real_of_int_inject del: real_of_int_diff)
  47.591 +    by (simp only: algebra_simps real_of_int_diff[symmetric] real_of_int_inject del: real_of_int_diff)
  47.592    also have "\<dots> = ((\<exists> j\<in> {0 .. (n - 1)}. real n * u - s = real j - real \<lfloor>s\<rfloor> \<and> real i rdvd real n * u - s))" using int_rdvd_iff[where i="i" and t="\<lfloor>real n * u - s\<rfloor>"]
  47.593      by (auto cong: conj_cong)
  47.594 -  also have "\<dots> = ?rhs" by(simp cong: conj_cong) (simp add: ring_simps )
  47.595 +  also have "\<dots> = ?rhs" by(simp cong: conj_cong) (simp add: algebra_simps )
  47.596    finally show ?thesis .
  47.597  qed
  47.598  
  47.599 @@ -4038,7 +4038,7 @@
  47.600    from foldr_disj_map[where xs="iupt(0,n - 1)" and bs="x#bs" and f="?f"]
  47.601    have "Ifm (x#bs) (DVDJ i n s) = (\<exists> j\<in> {0 .. (n - 1)}. Ifm (x#bs) (?f j))" 
  47.602      by (simp add: iupt_set np DVDJ_def del: iupt.simps)
  47.603 -  also have "\<dots> = (\<exists> j\<in> {0 .. (n - 1)}. real n * x = (- ?s) - real (floor (- ?s)) + real j \<and> real i rdvd real (j - floor (- ?s)))" by (simp add: ring_simps diff_def[symmetric])
  47.604 +  also have "\<dots> = (\<exists> j\<in> {0 .. (n - 1)}. real n * x = (- ?s) - real (floor (- ?s)) + real j \<and> real i rdvd real (j - floor (- ?s)))" by (simp add: algebra_simps diff_def[symmetric])
  47.605    also from rdvd01_cs[OF xp x1 np, where i="i" and s="-?s"] 
  47.606    have "\<dots> = (real i rdvd real n * x - (-?s))" by simp
  47.607    finally show ?thesis by simp
  47.608 @@ -4053,7 +4053,7 @@
  47.609    from foldr_conj_map[where xs="iupt(0,n - 1)" and bs="x#bs" and f="?f"]
  47.610    have "Ifm (x#bs) (NDVDJ i n s) = (\<forall> j\<in> {0 .. (n - 1)}. Ifm (x#bs) (?f j))" 
  47.611      by (simp add: iupt_set np NDVDJ_def del: iupt.simps)
  47.612 -  also have "\<dots> = (\<not> (\<exists> j\<in> {0 .. (n - 1)}. real n * x = (- ?s) - real (floor (- ?s)) + real j \<and> real i rdvd real (j - floor (- ?s))))" by (simp add: ring_simps diff_def[symmetric])
  47.613 +  also have "\<dots> = (\<not> (\<exists> j\<in> {0 .. (n - 1)}. real n * x = (- ?s) - real (floor (- ?s)) + real j \<and> real i rdvd real (j - floor (- ?s))))" by (simp add: algebra_simps diff_def[symmetric])
  47.614    also from rdvd01_cs[OF xp x1 np, where i="i" and s="-?s"] 
  47.615    have "\<dots> = (\<not> (real i rdvd real n * x - (-?s)))" by simp
  47.616    finally show ?thesis by simp
  47.617 @@ -4652,40 +4652,40 @@
  47.618      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
  47.619    also have "\<dots> = (?n*(real c *(?t/?n)) + ?n*(?N x e) < 0)"
  47.620      by (simp only: pos_less_divide_eq[OF np, where a="real c *(?t/?n) + (?N x e)" 
  47.621 -      and b="0", simplified divide_zero_left]) (simp only: ring_simps)
  47.622 +      and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
  47.623    also have "\<dots> = (real c *?t + ?n* (?N x e) < 0)"
  47.624      using np by simp 
  47.625 -  finally show ?case using nbt nb by (simp add: ring_simps)
  47.626 +  finally show ?case using nbt nb by (simp add: algebra_simps)
  47.627  next
  47.628    case (6 c e) from prems have cp: "c >0" and nb: "numbound0 e" by simp+
  47.629    have "?I ?u (Le (CN 0 c e)) = (real c *(?t/?n) + (?N x e) \<le> 0)"
  47.630      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
  47.631    also have "\<dots> = (?n*(real c *(?t/?n)) + ?n*(?N x e) \<le> 0)"
  47.632      by (simp only: pos_le_divide_eq[OF np, where a="real c *(?t/?n) + (?N x e)" 
  47.633 -      and b="0", simplified divide_zero_left]) (simp only: ring_simps)
  47.634 +      and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
  47.635    also have "\<dots> = (real c *?t + ?n* (?N x e) \<le> 0)"
  47.636      using np by simp 
  47.637 -  finally show ?case using nbt nb by (simp add: ring_simps)
  47.638 +  finally show ?case using nbt nb by (simp add: algebra_simps)
  47.639  next
  47.640    case (7 c e) from prems have cp: "c >0" and nb: "numbound0 e" by simp+
  47.641    have "?I ?u (Gt (CN 0 c e)) = (real c *(?t/?n) + (?N x e) > 0)"
  47.642      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
  47.643    also have "\<dots> = (?n*(real c *(?t/?n)) + ?n*(?N x e) > 0)"
  47.644      by (simp only: pos_divide_less_eq[OF np, where a="real c *(?t/?n) + (?N x e)" 
  47.645 -      and b="0", simplified divide_zero_left]) (simp only: ring_simps)
  47.646 +      and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
  47.647    also have "\<dots> = (real c *?t + ?n* (?N x e) > 0)"
  47.648      using np by simp 
  47.649 -  finally show ?case using nbt nb by (simp add: ring_simps)
  47.650 +  finally show ?case using nbt nb by (simp add: algebra_simps)
  47.651  next
  47.652    case (8 c e) from prems have cp: "c >0" and nb: "numbound0 e" by simp+
  47.653    have "?I ?u (Ge (CN 0 c e)) = (real c *(?t/?n) + (?N x e) \<ge> 0)"
  47.654      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
  47.655    also have "\<dots> = (?n*(real c *(?t/?n)) + ?n*(?N x e) \<ge> 0)"
  47.656      by (simp only: pos_divide_le_eq[OF np, where a="real c *(?t/?n) + (?N x e)" 
  47.657 -      and b="0", simplified divide_zero_left]) (simp only: ring_simps)
  47.658 +      and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
  47.659    also have "\<dots> = (real c *?t + ?n* (?N x e) \<ge> 0)"
  47.660      using np by simp 
  47.661 -  finally show ?case using nbt nb by (simp add: ring_simps)
  47.662 +  finally show ?case using nbt nb by (simp add: algebra_simps)
  47.663  next
  47.664    case (3 c e) from prems have cp: "c >0" and nb: "numbound0 e" by simp+
  47.665    from np have np: "real n \<noteq> 0" by simp
  47.666 @@ -4693,10 +4693,10 @@
  47.667      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
  47.668    also have "\<dots> = (?n*(real c *(?t/?n)) + ?n*(?N x e) = 0)"
  47.669      by (simp only: nonzero_eq_divide_eq[OF np, where a="real c *(?t/?n) + (?N x e)" 
  47.670 -      and b="0", simplified divide_zero_left]) (simp only: ring_simps)
  47.671 +      and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
  47.672    also have "\<dots> = (real c *?t + ?n* (?N x e) = 0)"
  47.673      using np by simp 
  47.674 -  finally show ?case using nbt nb by (simp add: ring_simps)
  47.675 +  finally show ?case using nbt nb by (simp add: algebra_simps)
  47.676  next
  47.677    case (4 c e) from prems have cp: "c >0" and nb: "numbound0 e" by simp+
  47.678    from np have np: "real n \<noteq> 0" by simp
  47.679 @@ -4704,10 +4704,10 @@
  47.680      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
  47.681    also have "\<dots> = (?n*(real c *(?t/?n)) + ?n*(?N x e) \<noteq> 0)"
  47.682      by (simp only: nonzero_eq_divide_eq[OF np, where a="real c *(?t/?n) + (?N x e)" 
  47.683 -      and b="0", simplified divide_zero_left]) (simp only: ring_simps)
  47.684 +      and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
  47.685    also have "\<dots> = (real c *?t + ?n* (?N x e) \<noteq> 0)"
  47.686      using np by simp 
  47.687 -  finally show ?case using nbt nb by (simp add: ring_simps)
  47.688 +  finally show ?case using nbt nb by (simp add: algebra_simps)
  47.689  qed(simp_all add: nbt numbound0_I[where bs ="bs" and b="(Inum (x#bs) t)/ real n" and b'="x"] nth_pos2)
  47.690  
  47.691  lemma \<Upsilon>_l:
  47.692 @@ -4758,7 +4758,7 @@
  47.693  using lp px noS
  47.694  proof (induct p rule: isrlfm.induct)
  47.695    case (5 c e) hence cp: "real c > 0" and nb: "numbound0 e" by simp+
  47.696 -    from prems have "x * real c + ?N x e < 0" by (simp add: ring_simps)
  47.697 +    from prems have "x * real c + ?N x e < 0" by (simp add: algebra_simps)
  47.698      hence pxc: "x < (- ?N x e) / real c" 
  47.699        by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="-?N x e"])
  47.700      from prems have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real c" by auto
  47.701 @@ -4767,7 +4767,7 @@
  47.702      moreover {assume y: "y < (-?N x e)/ real c"
  47.703        hence "y * real c < - ?N x e"
  47.704  	by (simp add: pos_less_divide_eq[OF cp, where a="y" and b="-?N x e", symmetric])
  47.705 -      hence "real c * y + ?N x e < 0" by (simp add: ring_simps)
  47.706 +      hence "real c * y + ?N x e < 0" by (simp add: algebra_simps)
  47.707        hence ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] by simp}
  47.708      moreover {assume y: "y > (- ?N x e) / real c" 
  47.709        with yu have eu: "u > (- ?N x e) / real c" by auto
  47.710 @@ -4777,7 +4777,7 @@
  47.711      ultimately show ?case by blast
  47.712  next
  47.713    case (6 c e) hence cp: "real c > 0" and nb: "numbound0 e" by simp +
  47.714 -    from prems have "x * real c + ?N x e \<le> 0" by (simp add: ring_simps)
  47.715 +    from prems have "x * real c + ?N x e \<le> 0" by (simp add: algebra_simps)
  47.716      hence pxc: "x \<le> (- ?N x e) / real c" 
  47.717        by (simp only: pos_le_divide_eq[OF cp, where a="x" and b="-?N x e"])
  47.718      from prems have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real c" by auto
  47.719 @@ -4786,7 +4786,7 @@
  47.720      moreover {assume y: "y < (-?N x e)/ real c"
  47.721        hence "y * real c < - ?N x e"
  47.722  	by (simp add: pos_less_divide_eq[OF cp, where a="y" and b="-?N x e", symmetric])
  47.723 -      hence "real c * y + ?N x e < 0" by (simp add: ring_simps)
  47.724 +      hence "real c * y + ?N x e < 0" by (simp add: algebra_simps)
  47.725        hence ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] by simp}
  47.726      moreover {assume y: "y > (- ?N x e) / real c" 
  47.727        with yu have eu: "u > (- ?N x e) / real c" by auto
  47.728 @@ -4796,7 +4796,7 @@
  47.729      ultimately show ?case by blast
  47.730  next
  47.731    case (7 c e) hence cp: "real c > 0" and nb: "numbound0 e" by simp+
  47.732 -    from prems have "x * real c + ?N x e > 0" by (simp add: ring_simps)
  47.733 +    from prems have "x * real c + ?N x e > 0" by (simp add: algebra_simps)
  47.734      hence pxc: "x > (- ?N x e) / real c" 
  47.735        by (simp only: pos_divide_less_eq[OF cp, where a="x" and b="-?N x e"])
  47.736      from prems have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real c" by auto
  47.737 @@ -4805,7 +4805,7 @@
  47.738      moreover {assume y: "y > (-?N x e)/ real c"
  47.739        hence "y * real c > - ?N x e"
  47.740  	by (simp add: pos_divide_less_eq[OF cp, where a="y" and b="-?N x e", symmetric])
  47.741 -      hence "real c * y + ?N x e > 0" by (simp add: ring_simps)
  47.742 +      hence "real c * y + ?N x e > 0" by (simp add: algebra_simps)
  47.743        hence ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] by simp}
  47.744      moreover {assume y: "y < (- ?N x e) / real c" 
  47.745        with ly have eu: "l < (- ?N x e) / real c" by auto
  47.746 @@ -4815,7 +4815,7 @@
  47.747      ultimately show ?case by blast
  47.748  next
  47.749    case (8 c e) hence cp: "real c > 0" and nb: "numbound0 e" by simp+
  47.750 -    from prems have "x * real c + ?N x e \<ge> 0" by (simp add: ring_simps)
  47.751 +    from prems have "x * real c + ?N x e \<ge> 0" by (simp add: algebra_simps)
  47.752      hence pxc: "x \<ge> (- ?N x e) / real c" 
  47.753        by (simp only: pos_divide_le_eq[OF cp, where a="x" and b="-?N x e"])
  47.754      from prems have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real c" by auto
  47.755 @@ -4824,7 +4824,7 @@
  47.756      moreover {assume y: "y > (-?N x e)/ real c"
  47.757        hence "y * real c > - ?N x e"
  47.758  	by (simp add: pos_divide_less_eq[OF cp, where a="y" and b="-?N x e", symmetric])
  47.759 -      hence "real c * y + ?N x e > 0" by (simp add: ring_simps)
  47.760 +      hence "real c * y + ?N x e > 0" by (simp add: algebra_simps)
  47.761        hence ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] by simp}
  47.762      moreover {assume y: "y < (- ?N x e) / real c" 
  47.763        with ly have eu: "l < (- ?N x e) / real c" by auto
  47.764 @@ -4835,7 +4835,7 @@
  47.765  next
  47.766    case (3 c e) hence cp: "real c > 0" and nb: "numbound0 e" by simp+
  47.767      from cp have cnz: "real c \<noteq> 0" by simp
  47.768 -    from prems have "x * real c + ?N x e = 0" by (simp add: ring_simps)
  47.769 +    from prems have "x * real c + ?N x e = 0" by (simp add: algebra_simps)
  47.770      hence pxc: "x = (- ?N x e) / real c" 
  47.771        by (simp only: nonzero_eq_divide_eq[OF cnz, where a="x" and b="-?N x e"])
  47.772      from prems have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real c" by auto
  47.773 @@ -4848,9 +4848,9 @@
  47.774      with ly yu have yne: "y \<noteq> - ?N x e / real c" by auto
  47.775      hence "y* real c \<noteq> -?N x e"      
  47.776        by (simp only: nonzero_eq_divide_eq[OF cnz, where a="y" and b="-?N x e"]) simp
  47.777 -    hence "y* real c + ?N x e \<noteq> 0" by (simp add: ring_simps)
  47.778 +    hence "y* real c + ?N x e \<noteq> 0" by (simp add: algebra_simps)
  47.779      thus ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] 
  47.780 -      by (simp add: ring_simps)
  47.781 +      by (simp add: algebra_simps)
  47.782  qed (auto simp add: nth_pos2 numbound0_I[where bs="bs" and b="y" and b'="x"])
  47.783  
  47.784  lemma finite_set_intervals:
  47.785 @@ -5013,7 +5013,7 @@
  47.786  	by (simp add: mult_commute)
  47.787        from tnb snb have st_nb: "numbound0 ?st" by simp
  47.788        have st: "(?N t / real n + ?N s / real m)/2 = ?N ?st / real (2*n*m)"
  47.789 -	using mnp mp np by (simp add: ring_simps add_divide_distrib)
  47.790 +	using mnp mp np by (simp add: algebra_simps add_divide_distrib)
  47.791        from \<upsilon>_I[OF lp mnp st_nb, where x="x" and bs="bs"] 
  47.792        have "?I x (\<upsilon> p (?st,2*n*m)) = ?I ((?N t / real n + ?N s / real m) /2) p" by (simp only: st[symmetric])}
  47.793      with rinf_\<Upsilon>[OF lp nmi npi px] have "?F" by blast hence "?D" by blast}
  47.794 @@ -5082,7 +5082,7 @@
  47.795  
  47.796  lemma exsplitnum: 
  47.797    "Inum (x#y#bs) (exsplitnum t) = Inum ((x+y) #bs) t"
  47.798 -  by(induct t rule: exsplitnum.induct) (simp_all add: ring_simps)
  47.799 +  by(induct t rule: exsplitnum.induct) (simp_all add: algebra_simps)
  47.800  
  47.801  lemma exsplit: 
  47.802    assumes qfp: "qfree p"
  47.803 @@ -5173,14 +5173,14 @@
  47.804    from Ul th have mnz: "m \<noteq> 0" by auto
  47.805    from Ul th have  nnz: "n \<noteq> 0" by auto  
  47.806    have st: "(?N t / real n + ?N s / real m)/2 = ?N ?st / real (2*n*m)"
  47.807 -   using mnz nnz by (simp add: ring_simps add_divide_distrib)
  47.808 +   using mnz nnz by (simp add: algebra_simps add_divide_distrib)
  47.809   
  47.810    thus "(real m *  Inum (x # bs) t + real n * Inum (x # bs) s) /
  47.811         (2 * real n * real m)
  47.812         \<in> (\<lambda>((t, n), s, m).
  47.813               (Inum (x # bs) t / real n + Inum (x # bs) s / real m) / 2) `
  47.814           (set U \<times> set U)"using mnz nnz th  
  47.815 -    apply (auto simp add: th add_divide_distrib ring_simps split_def image_def)
  47.816 +    apply (auto simp add: th add_divide_distrib algebra_simps split_def image_def)
  47.817      by (rule_tac x="(s,m)" in bexI,simp_all) 
  47.818    (rule_tac x="(t,n)" in bexI,simp_all)
  47.819  next
  47.820 @@ -5191,7 +5191,7 @@
  47.821    from Ul smU have mnz: "m \<noteq> 0" by auto
  47.822    from Ul tnU have  nnz: "n \<noteq> 0" by auto  
  47.823    have st: "(?N t / real n + ?N s / real m)/2 = ?N ?st / real (2*n*m)"
  47.824 -   using mnz nnz by (simp add: ring_simps add_divide_distrib)
  47.825 +   using mnz nnz by (simp add: algebra_simps add_divide_distrib)
  47.826   let ?P = "\<lambda> (t',n') (s',m'). (Inum (x # bs) t / real n + Inum (x # bs) s / real m)/2 = (Inum (x # bs) t' / real n' + Inum (x # bs) s' / real m')/2"
  47.827   have Pc:"\<forall> a b. ?P a b = ?P b a"
  47.828     by auto
  47.829 @@ -5204,7 +5204,7 @@
  47.830   from ts'_U Up have mnz': "m' \<noteq> 0" and nnz': "n'\<noteq> 0" by auto
  47.831   let ?st' = "Add (Mul m' t') (Mul n' s')"
  47.832     have st': "(?N t' / real n' + ?N s' / real m')/2 = ?N ?st' / real (2*n'*m')"
  47.833 -   using mnz' nnz' by (simp add: ring_simps add_divide_distrib)
  47.834 +   using mnz' nnz' by (simp add: algebra_simps add_divide_distrib)
  47.835   from Pts' have 
  47.836     "(Inum (x # bs) t / real n + Inum (x # bs) s / real m)/2 = (Inum (x # bs) t' / real n' + Inum (x # bs) s' / real m')/2" by simp
  47.837   also have "\<dots> = ((\<lambda>(t, n). Inum (x # bs) t / real n) ((\<lambda>((t, n), s, m). (Add (Mul m t) (Mul n s), 2 * n * m)) ((t',n'),(s',m'))))" by (simp add: st')
  47.838 @@ -5234,7 +5234,7 @@
  47.839        by (simp add: mult_commute real_of_int_mult[symmetric] del: real_of_int_mult)
  47.840      from tnb snb have stnb: "numbound0 ?st" by simp
  47.841    have st: "(?N t / real n + ?N s / real m)/2 = ?N ?st / real (2*n*m)"
  47.842 -   using mp np by (simp add: ring_simps add_divide_distrib)
  47.843 +   using mp np by (simp add: algebra_simps add_divide_distrib)
  47.844    from tnU smU UU' have "?g ((t,n),(s,m)) \<in> ?f ` U'" by blast
  47.845    hence "\<exists> (t',n') \<in> U'. ?g ((t,n),(s,m)) = ?f (t',n')"
  47.846      by auto (rule_tac x="(a,b)" in bexI, auto)
  47.847 @@ -5262,7 +5262,7 @@
  47.848        by (simp add: mult_commute real_of_int_mult[symmetric] del: real_of_int_mult)
  47.849      from tnb snb have stnb: "numbound0 ?st" by simp
  47.850    have st: "(?N t / real n + ?N s / real m)/2 = ?N ?st / real (2*n*m)"
  47.851 -   using mp np by (simp add: ring_simps add_divide_distrib)
  47.852 +   using mp np by (simp add: algebra_simps add_divide_distrib)
  47.853    from U' tnU' have tnb': "numbound0 t'" and np': "real n' > 0" by auto
  47.854    from \<upsilon>_I[OF lp np' tnb', where bs="bs" and x="x",simplified th[simplified split_def fst_conv snd_conv] st] Pt'
  47.855    have Pst2: "Ifm (Inum (x # bs) (Add (Mul m t) (Mul n s)) / real (2 * n * m) # bs) p" by simp
    48.1 --- a/src/HOL/ex/Numeral.thy	Sun Jan 18 13:58:17 2009 +0100
    48.2 +++ b/src/HOL/ex/Numeral.thy	Wed Jan 28 16:29:16 2009 +0100
    48.3 @@ -699,7 +699,7 @@
    48.4  begin
    48.5  
    48.6  subclass semiring_1_minus
    48.7 -  proof qed (simp_all add: ring_simps)
    48.8 +  proof qed (simp_all add: algebra_simps)
    48.9  
   48.10  lemma Dig_zero_minus_of_num [numeral]:
   48.11    "0 - of_num n = - of_num n"
   48.12 @@ -783,7 +783,7 @@
   48.13    "sub (Dig1 m) (Dig1 n) = dup (sub m n)"
   48.14    "sub (Dig1 m) (Dig0 n) = dup (sub m n) + 1"
   48.15    "sub (Dig0 m) (Dig1 n) = dup (sub m n) - 1"
   48.16 -  apply (simp_all add: dup_def ring_simps)
   48.17 +  apply (simp_all add: dup_def algebra_simps)
   48.18    apply (simp_all add: of_num_plus Dig_one_plus_dec)[4]
   48.19    apply (simp_all add: of_num.simps)
   48.20    done
    49.1 --- a/src/HOL/ex/ReflectedFerrack.thy	Sun Jan 18 13:58:17 2009 +0100
    49.2 +++ b/src/HOL/ex/ReflectedFerrack.thy	Wed Jan 28 16:29:16 2009 +0100
    49.3 @@ -532,7 +532,7 @@
    49.4  next
    49.5    case (2 n c t)  hence gd: "g dvd c" by simp
    49.6    from gp have gnz: "g \<noteq> 0" by simp
    49.7 -  from prems show ?case by (simp add: real_of_int_div[OF gnz gd] ring_simps)
    49.8 +  from prems show ?case by (simp add: real_of_int_div[OF gnz gd] algebra_simps)
    49.9  qed (auto simp add: numgcd_def gp)
   49.10  consts ismaxcoeff:: "num \<Rightarrow> int \<Rightarrow> bool"
   49.11  recdef ismaxcoeff "measure size"
   49.12 @@ -636,7 +636,7 @@
   49.13  lemma numadd[simp]: "Inum bs (numadd (t,s)) = Inum bs (Add t s)"
   49.14  apply (induct t s rule: numadd.induct, simp_all add: Let_def)
   49.15  apply (case_tac "c1+c2 = 0",case_tac "n1 \<le> n2", simp_all)
   49.16 -apply (case_tac "n1 = n2", simp_all add: ring_simps)
   49.17 +apply (case_tac "n1 = n2", simp_all add: algebra_simps)
   49.18  by (simp only: left_distrib[symmetric],simp)
   49.19  
   49.20  lemma numadd_nb[simp]: "\<lbrakk> numbound0 t ; numbound0 s\<rbrakk> \<Longrightarrow> numbound0 (numadd (t,s))"
   49.21 @@ -648,7 +648,7 @@
   49.22    "nummul t = (\<lambda> i. Mul i t)"
   49.23  
   49.24  lemma nummul[simp]: "\<And> i. Inum bs (nummul t i) = Inum bs (Mul i t)"
   49.25 -by (induct t rule: nummul.induct, auto simp add: ring_simps)
   49.26 +by (induct t rule: nummul.induct, auto simp add: algebra_simps)
   49.27  
   49.28  lemma nummul_nb[simp]: "\<And> i. numbound0 t \<Longrightarrow> numbound0 (nummul t i)"
   49.29  by (induct t rule: nummul.induct, auto )
   49.30 @@ -1001,10 +1001,10 @@
   49.31      by(cases "rsplit0 a",auto simp add: Let_def split_def)
   49.32    have "Inum bs ((split (CN 0)) (rsplit0 (Add a b))) = 
   49.33      Inum bs ((split (CN 0)) ?sa)+Inum bs ((split (CN 0)) ?sb)"
   49.34 -    by (simp add: Let_def split_def ring_simps)
   49.35 +    by (simp add: Let_def split_def algebra_simps)
   49.36    also have "\<dots> = Inum bs a + Inum bs b" using prems by (cases "rsplit0 a", simp_all)
   49.37    finally show ?case using nb by simp 
   49.38 -qed(auto simp add: Let_def split_def ring_simps , simp add: right_distrib[symmetric])
   49.39 +qed(auto simp add: Let_def split_def algebra_simps , simp add: right_distrib[symmetric])
   49.40  
   49.41      (* Linearize a formula*)
   49.42  definition
   49.43 @@ -1396,40 +1396,40 @@
   49.44      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
   49.45    also have "\<dots> = (?n*(real c *(?t/?n)) + ?n*(?N x e) < 0)"
   49.46      by (simp only: pos_less_divide_eq[OF np, where a="real c *(?t/?n) + (?N x e)" 
   49.47 -      and b="0", simplified divide_zero_left]) (simp only: ring_simps)
   49.48 +      and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
   49.49    also have "\<dots> = (real c *?t + ?n* (?N x e) < 0)"
   49.50      using np by simp 
   49.51 -  finally show ?case using nbt nb by (simp add: ring_simps)
   49.52 +  finally show ?case using nbt nb by (simp add: algebra_simps)
   49.53  next
   49.54    case (6 c e) from prems have cp: "c >0" and nb: "numbound0 e" by simp+
   49.55    have "?I ?u (Le (CN 0 c e)) = (real c *(?t/?n) + (?N x e) \<le> 0)"
   49.56      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
   49.57    also have "\<dots> = (?n*(real c *(?t/?n)) + ?n*(?N x e) \<le> 0)"
   49.58      by (simp only: pos_le_divide_eq[OF np, where a="real c *(?t/?n) + (?N x e)" 
   49.59 -      and b="0", simplified divide_zero_left]) (simp only: ring_simps)
   49.60 +      and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
   49.61    also have "\<dots> = (real c *?t + ?n* (?N x e) \<le> 0)"
   49.62      using np by simp 
   49.63 -  finally show ?case using nbt nb by (simp add: ring_simps)
   49.64 +  finally show ?case using nbt nb by (simp add: algebra_simps)
   49.65  next
   49.66    case (7 c e) from prems have cp: "c >0" and nb: "numbound0 e" by simp+
   49.67    have "?I ?u (Gt (CN 0 c e)) = (real c *(?t/?n) + (?N x e) > 0)"
   49.68      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
   49.69    also have "\<dots> = (?n*(real c *(?t/?n)) + ?n*(?N x e) > 0)"
   49.70      by (simp only: pos_divide_less_eq[OF np, where a="real c *(?t/?n) + (?N x e)" 
   49.71 -      and b="0", simplified divide_zero_left]) (simp only: ring_simps)
   49.72 +      and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
   49.73    also have "\<dots> = (real c *?t + ?n* (?N x e) > 0)"
   49.74      using np by simp 
   49.75 -  finally show ?case using nbt nb by (simp add: ring_simps)
   49.76 +  finally show ?case using nbt nb by (simp add: algebra_simps)
   49.77  next
   49.78    case (8 c e) from prems have cp: "c >0" and nb: "numbound0 e" by simp+
   49.79    have "?I ?u (Ge (CN 0 c e)) = (real c *(?t/?n) + (?N x e) \<ge> 0)"
   49.80      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
   49.81    also have "\<dots> = (?n*(real c *(?t/?n)) + ?n*(?N x e) \<ge> 0)"
   49.82      by (simp only: pos_divide_le_eq[OF np, where a="real c *(?t/?n) + (?N x e)" 
   49.83 -      and b="0", simplified divide_zero_left]) (simp only: ring_simps)
   49.84 +      and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
   49.85    also have "\<dots> = (real c *?t + ?n* (?N x e) \<ge> 0)"
   49.86      using np by simp 
   49.87 -  finally show ?case using nbt nb by (simp add: ring_simps)
   49.88 +  finally show ?case using nbt nb by (simp add: algebra_simps)
   49.89  next
   49.90    case (3 c e) from prems have cp: "c >0" and nb: "numbound0 e" by simp+
   49.91    from np have np: "real n \<noteq> 0" by simp
   49.92 @@ -1437,10 +1437,10 @@
   49.93      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
   49.94    also have "\<dots> = (?n*(real c *(?t/?n)) + ?n*(?N x e) = 0)"
   49.95      by (simp only: nonzero_eq_divide_eq[OF np, where a="real c *(?t/?n) + (?N x e)" 
   49.96 -      and b="0", simplified divide_zero_left]) (simp only: ring_simps)
   49.97 +      and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
   49.98    also have "\<dots> = (real c *?t + ?n* (?N x e) = 0)"
   49.99      using np by simp 
  49.100 -  finally show ?case using nbt nb by (simp add: ring_simps)
  49.101 +  finally show ?case using nbt nb by (simp add: algebra_simps)
  49.102  next
  49.103    case (4 c e) from prems have cp: "c >0" and nb: "numbound0 e" by simp+
  49.104    from np have np: "real n \<noteq> 0" by simp
  49.105 @@ -1448,10 +1448,10 @@
  49.106      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
  49.107    also have "\<dots> = (?n*(real c *(?t/?n)) + ?n*(?N x e) \<noteq> 0)"
  49.108      by (simp only: nonzero_eq_divide_eq[OF np, where a="real c *(?t/?n) + (?N x e)" 
  49.109 -      and b="0", simplified divide_zero_left]) (simp only: ring_simps)
  49.110 +      and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
  49.111    also have "\<dots> = (real c *?t + ?n* (?N x e) \<noteq> 0)"
  49.112      using np by simp 
  49.113 -  finally show ?case using nbt nb by (simp add: ring_simps)
  49.114 +  finally show ?case using nbt nb by (simp add: algebra_simps)
  49.115  qed(simp_all add: nbt numbound0_I[where bs ="bs" and b="(Inum (x#bs) t)/ real n" and b'="x"] nth_pos2)
  49.116  
  49.117  lemma uset_l:
  49.118 @@ -1502,7 +1502,7 @@
  49.119  using lp px noS
  49.120  proof (induct p rule: isrlfm.induct)
  49.121    case (5 c e) hence cp: "real c > 0" and nb: "numbound0 e" by simp+
  49.122 -    from prems have "x * real c + ?N x e < 0" by (simp add: ring_simps)
  49.123 +    from prems have "x * real c + ?N x e < 0" by (simp add: algebra_simps)
  49.124      hence pxc: "x < (- ?N x e) / real c" 
  49.125        by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="-?N x e"])
  49.126      from prems have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real c" by auto
  49.127 @@ -1511,7 +1511,7 @@
  49.128      moreover {assume y: "y < (-?N x e)/ real c"
  49.129        hence "y * real c < - ?N x e"
  49.130  	by (simp add: pos_less_divide_eq[OF cp, where a="y" and b="-?N x e", symmetric])
  49.131 -      hence "real c * y + ?N x e < 0" by (simp add: ring_simps)
  49.132 +      hence "real c * y + ?N x e < 0" by (simp add: algebra_simps)
  49.133        hence ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] by simp}
  49.134      moreover {assume y: "y > (- ?N x e) / real c" 
  49.135        with yu have eu: "u > (- ?N x e) / real c" by auto
  49.136 @@ -1521,7 +1521,7 @@
  49.137      ultimately show ?case by blast
  49.138  next
  49.139    case (6 c e) hence cp: "real c > 0" and nb: "numbound0 e" by simp +
  49.140 -    from prems have "x * real c + ?N x e \<le> 0" by (simp add: ring_simps)
  49.141 +    from prems have "x * real c + ?N x e \<le> 0" by (simp add: algebra_simps)
  49.142      hence pxc: "x \<le> (- ?N x e) / real c" 
  49.143        by (simp only: pos_le_divide_eq[OF cp, where a="x" and b="-?N x e"])
  49.144      from prems have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real c" by auto
  49.145 @@ -1530,7 +1530,7 @@
  49.146      moreover {assume y: "y < (-?N x e)/ real c"
  49.147        hence "y * real c < - ?N x e"
  49.148  	by (simp add: pos_less_divide_eq[OF cp, where a="y" and b="-?N x e", symmetric])
  49.149 -      hence "real c * y + ?N x e < 0" by (simp add: ring_simps)
  49.150 +      hence "real c * y + ?N x e < 0" by (simp add: algebra_simps)
  49.151        hence ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] by simp}
  49.152      moreover {assume y: "y > (- ?N x e) / real c" 
  49.153        with yu have eu: "u > (- ?N x e) / real c" by auto
  49.154 @@ -1540,7 +1540,7 @@
  49.155      ultimately show ?case by blast
  49.156  next
  49.157    case (7 c e) hence cp: "real c > 0" and nb: "numbound0 e" by simp+
  49.158 -    from prems have "x * real c + ?N x e > 0" by (simp add: ring_simps)
  49.159 +    from prems have "x * real c + ?N x e > 0" by (simp add: algebra_simps)
  49.160      hence pxc: "x > (- ?N x e) / real c" 
  49.161        by (simp only: pos_divide_less_eq[OF cp, where a="x" and b="-?N x e"])
  49.162      from prems have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real c" by auto
  49.163 @@ -1549,7 +1549,7 @@
  49.164      moreover {assume y: "y > (-?N x e)/ real c"
  49.165        hence "y * real c > - ?N x e"
  49.166  	by (simp add: pos_divide_less_eq[OF cp, where a="y" and b="-?N x e", symmetric])
  49.167 -      hence "real c * y + ?N x e > 0" by (simp add: ring_simps)
  49.168 +      hence "real c * y + ?N x e > 0" by (simp add: algebra_simps)
  49.169        hence ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] by simp}
  49.170      moreover {assume y: "y < (- ?N x e) / real c" 
  49.171        with ly have eu: "l < (- ?N x e) / real c" by auto
  49.172 @@ -1559,7 +1559,7 @@
  49.173      ultimately show ?case by blast
  49.174  next
  49.175    case (8 c e) hence cp: "real c > 0" and nb: "numbound0 e" by simp+
  49.176 -    from prems have "x * real c + ?N x e \<ge> 0" by (simp add: ring_simps)
  49.177 +    from prems have "x * real c + ?N x e \<ge> 0" by (simp add: algebra_simps)
  49.178      hence pxc: "x \<ge> (- ?N x e) / real c" 
  49.179        by (simp only: pos_divide_le_eq[OF cp, where a="x" and b="-?N x e"])
  49.180      from prems have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real c" by auto
  49.181 @@ -1568,7 +1568,7 @@
  49.182      moreover {assume y: "y > (-?N x e)/ real c"
  49.183        hence "y * real c > - ?N x e"
  49.184  	by (simp add: pos_divide_less_eq[OF cp, where a="y" and b="-?N x e", symmetric])
  49.185 -      hence "real c * y + ?N x e > 0" by (simp add: ring_simps)
  49.186 +      hence "real c * y + ?N x e > 0" by (simp add: algebra_simps)
  49.187        hence ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] by simp}
  49.188      moreover {assume y: "y < (- ?N x e) / real c" 
  49.189        with ly have eu: "l < (- ?N x e) / real c" by auto
  49.190 @@ -1579,7 +1579,7 @@
  49.191  next
  49.192    case (3 c e) hence cp: "real c > 0" and nb: "numbound0 e" by simp+
  49.193      from cp have cnz: "real c \<noteq> 0" by simp
  49.194 -    from prems have "x * real c + ?N x e = 0" by (simp add: ring_simps)
  49.195 +    from prems have "x * real c + ?N x e = 0" by (simp add: algebra_simps)
  49.196      hence pxc: "x = (- ?N x e) / real c" 
  49.197        by (simp only: nonzero_eq_divide_eq[OF cnz, where a="x" and b="-?N x e"])
  49.198      from prems have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real c" by auto
  49.199 @@ -1592,9 +1592,9 @@
  49.200      with ly yu have yne: "y \<noteq> - ?N x e / real c" by auto
  49.201      hence "y* real c \<noteq> -?N x e"      
  49.202        by (simp only: nonzero_eq_divide_eq[OF cnz, where a="y" and b="-?N x e"]) simp
  49.203 -    hence "y* real c + ?N x e \<noteq> 0" by (simp add: ring_simps)
  49.204 +    hence "y* real c + ?N x e \<noteq> 0" by (simp add: algebra_simps)
  49.205      thus ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] 
  49.206 -      by (simp add: ring_simps)
  49.207 +      by (simp add: algebra_simps)
  49.208  qed (auto simp add: nth_pos2 numbound0_I[where bs="bs" and b="y" and b'="x"])
  49.209  
  49.210  lemma finite_set_intervals:
  49.211 @@ -1757,7 +1757,7 @@
  49.212  	by (simp add: mult_commute)
  49.213        from tnb snb have st_nb: "numbound0 ?st" by simp
  49.214        have st: "(?N t / real n + ?N s / real m)/2 = ?N ?st / real (2*n*m)"
  49.215 -	using mnp mp np by (simp add: ring_simps add_divide_distrib)
  49.216 +	using mnp mp np by (simp add: algebra_simps add_divide_distrib)
  49.217        from usubst_I[OF lp mnp st_nb, where x="x" and bs="bs"] 
  49.218        have "?I x (usubst p (?st,2*n*m)) = ?I ((?N t / real n + ?N s / real m) /2) p" by (simp only: st[symmetric])}
  49.219      with rinf_uset[OF lp nmi npi px] have "?F" by blast hence "?D" by blast}
  49.220 @@ -1801,14 +1801,14 @@
  49.221    from Ul th have mnz: "m \<noteq> 0" by auto
  49.222    from Ul th have  nnz: "n \<noteq> 0" by auto  
  49.223    have st: "(?N t / real n + ?N s / real m)/2 = ?N ?st / real (2*n*m)"
  49.224 -   using mnz nnz by (simp add: ring_simps add_divide_distrib)
  49.225 +   using mnz nnz by (simp add: algebra_simps add_divide_distrib)
  49.226   
  49.227    thus "(real m *  Inum (x # bs) t + real n * Inum (x # bs) s) /
  49.228         (2 * real n * real m)
  49.229         \<in> (\<lambda>((t, n), s, m).
  49.230               (Inum (x # bs) t / real n + Inum (x # bs) s / real m) / 2) `
  49.231           (set U \<times> set U)"using mnz nnz th  
  49.232 -    apply (auto simp add: th add_divide_distrib ring_simps split_def image_def)
  49.233 +    apply (auto simp add: th add_divide_distrib algebra_simps split_def image_def)
  49.234      by (rule_tac x="(s,m)" in bexI,simp_all) 
  49.235    (rule_tac x="(t,n)" in bexI,simp_all)
  49.236  next
  49.237 @@ -1819,7 +1819,7 @@
  49.238    from Ul smU have mnz: "m \<noteq> 0" by auto
  49.239    from Ul tnU have  nnz: "n \<noteq> 0" by auto  
  49.240    have st: "(?N t / real n + ?N s / real m)/2 = ?N ?st / real (2*n*m)"
  49.241 -   using mnz nnz by (simp add: ring_simps add_divide_distrib)
  49.242 +   using mnz nnz by (simp add: algebra_simps add_divide_distrib)
  49.243   let ?P = "\<lambda> (t',n') (s',m'). (Inum (x # bs) t / real n + Inum (x # bs) s / real m)/2 = (Inum (x # bs) t' / real n' + Inum (x # bs) s' / real m')/2"
  49.244   have Pc:"\<forall> a b. ?P a b = ?P b a"
  49.245     by auto
  49.246 @@ -1832,7 +1832,7 @@
  49.247   from ts'_U Up have mnz': "m' \<noteq> 0" and nnz': "n'\<noteq> 0" by auto
  49.248   let ?st' = "Add (Mul m' t') (Mul n' s')"
  49.249     have st': "(?N t' / real n' + ?N s' / real m')/2 = ?N ?st' / real (2*n'*m')"
  49.250 -   using mnz' nnz' by (simp add: ring_simps add_divide_distrib)
  49.251 +   using mnz' nnz' by (simp add: algebra_simps add_divide_distrib)
  49.252   from Pts' have 
  49.253     "(Inum (x # bs) t / real n + Inum (x # bs) s / real m)/2 = (Inum (x # bs) t' / real n' + Inum (x # bs) s' / real m')/2" by simp
  49.254   also have "\<dots> = ((\<lambda>(t, n). Inum (x # bs) t / real n) ((\<lambda>((t, n), s, m). (Add (Mul m t) (Mul n s), 2 * n * m)) ((t',n'),(s',m'))))" by (simp add: st')
  49.255 @@ -1862,7 +1862,7 @@
  49.256        by (simp add: mult_commute real_of_int_mult[symmetric] del: real_of_int_mult)
  49.257      from tnb snb have stnb: "numbound0 ?st" by simp
  49.258    have st: "(?N t / real n + ?N s / real m)/2 = ?N ?st / real (2*n*m)"
  49.259 -   using mp np by (simp add: ring_simps add_divide_distrib)
  49.260 +   using mp np by (simp add: algebra_simps add_divide_distrib)
  49.261    from tnU smU UU' have "?g ((t,n),(s,m)) \<in> ?f ` U'" by blast
  49.262    hence "\<exists> (t',n') \<in> U'. ?g ((t,n),(s,m)) = ?f (t',n')"
  49.263      by auto (rule_tac x="(a,b)" in bexI, auto)
  49.264 @@ -1890,7 +1890,7 @@
  49.265        by (simp add: mult_commute real_of_int_mult[symmetric] del: real_of_int_mult)
  49.266      from tnb snb have stnb: "numbound0 ?st" by simp
  49.267    have st: "(?N t / real n + ?N s / real m)/2 = ?N ?st / real (2*n*m)"
  49.268 -   using mp np by (simp add: ring_simps add_divide_distrib)
  49.269 +   using mp np by (simp add: algebra_simps add_divide_distrib)
  49.270    from U' tnU' have tnb': "numbound0 t'" and np': "real n' > 0" by auto
  49.271    from usubst_I[OF lp np' tnb', where bs="bs" and x="x",simplified th[simplified split_def fst_conv snd_conv] st] Pt'
  49.272    have Pst2: "Ifm (Inum (x # bs) (Add (Mul m t) (Mul n s)) / real (2 * n * m) # bs) p" by simp
    50.1 --- a/src/HOL/ex/Reflected_Presburger.thy	Sun Jan 18 13:58:17 2009 +0100
    50.2 +++ b/src/HOL/ex/Reflected_Presburger.thy	Wed Jan 28 16:29:16 2009 +0100
    50.3 @@ -437,7 +437,7 @@
    50.4  apply (induct t s rule: numadd.induct, simp_all add: Let_def)
    50.5  apply (case_tac "c1+c2 = 0",case_tac "n1 \<le> n2", simp_all)
    50.6   apply (case_tac "n1 = n2")
    50.7 -  apply(simp_all add: ring_simps)
    50.8 +  apply(simp_all add: algebra_simps)
    50.9  apply(simp add: left_distrib[symmetric])
   50.10  done
   50.11  
   50.12 @@ -452,7 +452,7 @@
   50.13    | "nummul i t = Mul i t"
   50.14  
   50.15  lemma nummul: "\<And> i. Inum bs (nummul i t) = Inum bs (Mul i t)"
   50.16 -by (induct t rule: nummul.induct, auto simp add: ring_simps numadd)
   50.17 +by (induct t rule: nummul.induct, auto simp add: algebra_simps numadd)
   50.18  
   50.19  lemma nummul_nb: "\<And> i. numbound0 t \<Longrightarrow> numbound0 (nummul i t)"
   50.20  by (induct t rule: nummul.induct, auto simp add: numadd_nb)
   50.21 @@ -912,7 +912,7 @@
   50.22    have Ia:"Inum (i # bs) a = Inum (i #bs) (CN 0 ?c ?r)" and nb: "numbound0 ?r" by auto 
   50.23    let ?N = "\<lambda> t. Inum (i#bs) t"
   50.24    from prems Ia nb  show ?case 
   50.25 -    apply (auto simp add: Let_def split_def ring_simps) 
   50.26 +    apply (auto simp add: Let_def split_def algebra_simps) 
   50.27      apply (cases "?r",auto)
   50.28      apply (case_tac nat, auto)
   50.29      done
   50.30 @@ -925,7 +925,7 @@
   50.31    have Ia:"Inum (i # bs) a = Inum (i #bs) (CN 0 ?c ?r)" and nb: "numbound0 ?r" by auto 
   50.32    let ?N = "\<lambda> t. Inum (i#bs) t"
   50.33    from prems Ia nb  show ?case 
   50.34 -    apply (auto simp add: Let_def split_def ring_simps) 
   50.35 +    apply (auto simp add: Let_def split_def algebra_simps) 
   50.36      apply (cases "?r",auto)
   50.37      apply (case_tac nat, auto)
   50.38      done
   50.39 @@ -938,7 +938,7 @@
   50.40    have Ia:"Inum (i # bs) a = Inum (i #bs) (CN 0 ?c ?r)" and nb: "numbound0 ?r" by auto 
   50.41    let ?N = "\<lambda> t. Inum (i#bs) t"
   50.42    from prems Ia nb  show ?case 
   50.43 -    apply (auto simp add: Let_def split_def ring_simps) 
   50.44 +    apply (auto simp add: Let_def split_def algebra_simps) 
   50.45      apply (cases "?r",auto)
   50.46      apply (case_tac nat, auto)
   50.47      done
   50.48 @@ -951,7 +951,7 @@
   50.49    have Ia:"Inum (i # bs) a = Inum (i #bs) (CN 0 ?c ?r)" and nb: "numbound0 ?r" by auto 
   50.50    let ?N = "\<lambda> t. Inum (i#bs) t"
   50.51    from prems Ia nb  show ?case 
   50.52 -    apply (auto simp add: Let_def split_def ring_simps) 
   50.53 +    apply (auto simp add: Let_def split_def algebra_simps) 
   50.54      apply (cases "?r",auto)
   50.55      apply (case_tac nat, auto)
   50.56      done
   50.57 @@ -964,7 +964,7 @@
   50.58    have Ia:"Inum (i # bs) a = Inum (i #bs) (CN 0 ?c ?r)" and nb: "numbound0 ?r" by auto 
   50.59    let ?N = "\<lambda> t. Inum (i#bs) t"
   50.60    from prems Ia nb  show ?case 
   50.61 -    apply (auto simp add: Let_def split_def ring_simps) 
   50.62 +    apply (auto simp add: Let_def split_def algebra_simps) 
   50.63      apply (cases "?r",auto)
   50.64      apply (case_tac nat, auto)
   50.65      done
   50.66 @@ -977,7 +977,7 @@
   50.67    have Ia:"Inum (i # bs) a = Inum (i #bs) (CN 0 ?c ?r)" and nb: "numbound0 ?r" by auto 
   50.68    let ?N = "\<lambda> t. Inum (i#bs) t"
   50.69    from prems Ia nb  show ?case 
   50.70 -    apply (auto simp add: Let_def split_def ring_simps) 
   50.71 +    apply (auto simp add: Let_def split_def algebra_simps) 
   50.72      apply (cases "?r",auto)
   50.73      apply (case_tac nat, auto)
   50.74      done
   50.75 @@ -996,7 +996,7 @@
   50.76    moreover
   50.77    {assume "?c=0" and "j\<noteq>0" hence ?case 
   50.78        using zsplit0_I[OF spl, where x="i" and bs="bs"] zdvd_abs1[where i="j"]
   50.79 -    apply (auto simp add: Let_def split_def ring_simps) 
   50.80 +    apply (auto simp add: Let_def split_def algebra_simps) 
   50.81      apply (cases "?r",auto)
   50.82      apply (case_tac nat, auto)
   50.83      done}
   50.84 @@ -1027,7 +1027,7 @@
   50.85    moreover
   50.86    {assume "?c=0" and "j\<noteq>0" hence ?case 
   50.87        using zsplit0_I[OF spl, where x="i" and bs="bs"] zdvd_abs1[where i="j"]
   50.88 -    apply (auto simp add: Let_def split_def ring_simps) 
   50.89 +    apply (auto simp add: Let_def split_def algebra_simps) 
   50.90      apply (cases "?r",auto)
   50.91      apply (case_tac nat, auto)
   50.92      done}
   50.93 @@ -1301,9 +1301,9 @@
   50.94        (is "?ri dvd ?rc*?rx - ?rc*(?rk*?rd) + ?I x e" is "?ri dvd ?rt")
   50.95        hence "\<exists> (l::int). ?rt = i * l" by (simp add: dvd_def)
   50.96        hence "\<exists> (l::int). c*x+ ?I x e = i*l+c*(k * i*di)" 
   50.97 -	by (simp add: ring_simps di_def)
   50.98 +	by (simp add: algebra_simps di_def)
   50.99        hence "\<exists> (l::int). c*x+ ?I x e = i*(l + c*k*di)"
  50.100 -	by (simp add: ring_simps)
  50.101 +	by (simp add: algebra_simps)
  50.102        hence "\<exists> (l::int). c*x+ ?I x e = i*l" by blast
  50.103        thus "i dvd c*x + Inum (x # bs) e" by (simp add: dvd_def) 
  50.104      next
  50.105 @@ -1312,7 +1312,7 @@
  50.106        hence "\<exists> (l::int). c*x+?e = i*l" by (simp add: dvd_def)
  50.107        hence "\<exists> (l::int). c*x - c*(k*d) +?e = i*l - c*(k*d)" by simp
  50.108        hence "\<exists> (l::int). c*x - c*(k*d) +?e = i*l - c*(k*i*di)" by (simp add: di_def)
  50.109 -      hence "\<exists> (l::int). c*x - c*(k*d) +?e = i*((l - c*k*di))" by (simp add: ring_simps)
  50.110 +      hence "\<exists> (l::int). c*x - c*(k*d) +?e = i*((l - c*k*di))" by (simp add: algebra_simps)
  50.111        hence "\<exists> (l::int). c*x - c * (k*d) +?e = i*l"
  50.112  	by blast
  50.113        thus "i dvd c*x - c*(k*d) + Inum (x # bs) e" by (simp add: dvd_def)
  50.114 @@ -1328,9 +1328,9 @@
  50.115        (is "?ri dvd ?rc*?rx - ?rc*(?rk*?rd) + ?I x e" is "?ri dvd ?rt")
  50.116        hence "\<exists> (l::int). ?rt = i * l" by (simp add: dvd_def)
  50.117        hence "\<exists> (l::int). c*x+ ?I x e = i*l+c*(k * i*di)" 
  50.118 -	by (simp add: ring_simps di_def)
  50.119 +	by (simp add: algebra_simps di_def)
  50.120        hence "\<exists> (l::int). c*x+ ?I x e = i*(l + c*k*di)"
  50.121 -	by (simp add: ring_simps)
  50.122 +	by (simp add: algebra_simps)
  50.123        hence "\<exists> (l::int). c*x+ ?I x e = i*l" by blast
  50.124        thus "i dvd c*x + Inum (x # bs) e" by (simp add: dvd_def) 
  50.125      next
  50.126 @@ -1339,7 +1339,7 @@
  50.127        hence "\<exists> (l::int). c*x+?e = i*l" by (simp add: dvd_def)
  50.128        hence "\<exists> (l::int). c*x - c*(k*d) +?e = i*l - c*(k*d)" by simp
  50.129        hence "\<exists> (l::int). c*x - c*(k*d) +?e = i*l - c*(k*i*di)" by (simp add: di_def)
  50.130 -      hence "\<exists> (l::int). c*x - c*(k*d) +?e = i*((l - c*k*di))" by (simp add: ring_simps)
  50.131 +      hence "\<exists> (l::int). c*x - c*(k*d) +?e = i*((l - c*k*di))" by (simp add: algebra_simps)
  50.132        hence "\<exists> (l::int). c*x - c * (k*d) +?e = i*l"
  50.133  	by blast
  50.134        thus "i dvd c*x - c*(k*d) + Inum (x # bs) e" by (simp add: dvd_def)
  50.135 @@ -1363,7 +1363,7 @@
  50.136      by (simp only: zdvd_zminus_iff)
  50.137    also have "\<dots> = (j dvd (c* (- x)) + ?e)"
  50.138      apply (simp only: minus_mult_right[symmetric] minus_mult_left[symmetric] diff_def zadd_ac zminus_zadd_distrib)
  50.139 -    by (simp add: ring_simps)
  50.140 +    by (simp add: algebra_simps)
  50.141    also have "\<dots> = Ifm bbs ((- x)#bs) (Dvd j (CN 0 c e))"
  50.142      using numbound0_I[OF nb, where bs="bs" and b="x" and b'="- x"]
  50.143      by simp
  50.144 @@ -1375,7 +1375,7 @@
  50.145      by (simp only: zdvd_zminus_iff)
  50.146    also have "\<dots> = (j dvd (c* (- x)) + ?e)"
  50.147      apply (simp only: minus_mult_right[symmetric] minus_mult_left[symmetric] diff_def zadd_ac zminus_zadd_distrib)
  50.148 -    by (simp add: ring_simps)
  50.149 +    by (simp add: algebra_simps)
  50.150    also have "\<dots> = Ifm bbs ((- x)#bs) (Dvd j (CN 0 c e))"
  50.151      using numbound0_I[OF nb, where bs="bs" and b="x" and b'="- x"]
  50.152      by simp
  50.153 @@ -1443,7 +1443,7 @@
  50.154      hence "(l*x + (l div c) * Inum (x # bs) e < 0) =
  50.155            ((c * (l div c)) * x + (l div c) * Inum (x # bs) e < 0)"
  50.156        by simp
  50.157 -    also have "\<dots> = ((l div c) * (c*x + Inum (x # bs) e) < (l div c) * 0)" by (simp add: ring_simps)
  50.158 +    also have "\<dots> = ((l div c) * (c*x + Inum (x # bs) e) < (l div c) * 0)" by (simp add: algebra_simps)
  50.159      also have "\<dots> = (c*x + Inum (x # bs) e < 0)"
  50.160      using mult_less_0_iff [where a="(l div c)" and b="c*x + Inum (x # bs) e"] ldcp by simp
  50.161    finally show ?case using numbound0_I[OF be,where b="l*x" and b'="x" and bs="bs"] be  by simp
  50.162 @@ -1461,7 +1461,7 @@
  50.163      hence "(l*x + (l div c) * Inum (x# bs) e \<le> 0) =
  50.164            ((c * (l div c)) * x + (l div c) * Inum (x # bs) e \<le> 0)"
  50.165        by simp
  50.166 -    also have "\<dots> = ((l div c) * (c * x + Inum (x # bs) e) \<le> ((l div c)) * 0)" by (simp add: ring_simps)
  50.167 +    also have "\<dots> = ((l div c) * (c * x + Inum (x # bs) e) \<le> ((l div c)) * 0)" by (simp add: algebra_simps)
  50.168      also have "\<dots> = (c*x + Inum (x # bs) e \<le> 0)"
  50.169      using mult_le_0_iff [where a="(l div c)" and b="c*x + Inum (x # bs) e"] ldcp by simp
  50.170    finally show ?case using numbound0_I[OF be,where b="l*x" and b'="x" and bs="bs"]  be by simp
  50.171 @@ -1479,7 +1479,7 @@
  50.172      hence "(l*x + (l div c)* Inum (x # bs) e > 0) =
  50.173            ((c * (l div c)) * x + (l div c) * Inum (x # bs) e > 0)"
  50.174        by simp
  50.175 -    also have "\<dots> = ((l div c) * (c * x + Inum (x # bs) e) > ((l div c)) * 0)" by (simp add: ring_simps)
  50.176 +    also have "\<dots> = ((l div c) * (c * x + Inum (x # bs) e) > ((l div c)) * 0)" by (simp add: algebra_simps)
  50.177      also have "\<dots> = (c * x + Inum (x # bs) e > 0)"
  50.178      using zero_less_mult_iff [where a="(l div c)" and b="c * x + Inum (x # bs) e"] ldcp by simp
  50.179    finally show ?case using numbound0_I[OF be,where b="(l * x)" and b'="x" and bs="bs"]  be  by simp
  50.180 @@ -1498,7 +1498,7 @@
  50.181            ((c*(l div c))*x + (l div c)* Inum (x # bs) e \<ge> 0)"
  50.182        by simp
  50.183      also have "\<dots> = ((l div c)*(c*x + Inum (x # bs) e) \<ge> ((l div c)) * 0)" 
  50.184 -      by (simp add: ring_simps)
  50.185 +      by (simp add: algebra_simps)
  50.186      also have "\<dots> = (c*x + Inum (x # bs) e \<ge> 0)" using ldcp 
  50.187        zero_le_mult_iff [where a="l div c" and b="c*x + Inum (x # bs) e"] by simp
  50.188    finally show ?case using be numbound0_I[OF be,where b="l*x" and b'="x" and bs="bs"]  
  50.189 @@ -1517,7 +1517,7 @@
  50.190      hence "(l * x + (l div c) * Inum (x # bs) e = 0) =
  50.191            ((c * (l div c)) * x + (l div c) * Inum (x # bs) e = 0)"
  50.192        by simp
  50.193 -    also have "\<dots> = ((l div c) * (c * x + Inum (x # bs) e) = ((l div c)) * 0)" by (simp add: ring_simps)
  50.194 +    also have "\<dots> = ((l div c) * (c * x + Inum (x # bs) e) = ((l div c)) * 0)" by (simp add: algebra_simps)
  50.195      also have "\<dots> = (c * x + Inum (x # bs) e = 0)"
  50.196      using mult_eq_0_iff [where a="(l div c)" and b="c * x + Inum (x # bs) e"] ldcp by simp
  50.197    finally show ?case using numbound0_I[OF be,where b="(l * x)" and b'="x" and bs="bs"]  be  by simp
  50.198 @@ -1535,7 +1535,7 @@
  50.199      hence "(l * x + (l div c) * Inum (x # bs) e \<noteq> 0) =
  50.200            ((c * (l div c)) * x + (l div c) * Inum (x # bs) e \<noteq> 0)"
  50.201        by simp
  50.202 -    also have "\<dots> = ((l div c) * (c * x + Inum (x # bs) e) \<noteq> ((l div c)) * 0)" by (simp add: ring_simps)
  50.203 +    also have "\<dots> = ((l div c) * (c * x + Inum (x # bs) e) \<noteq> ((l div c)) * 0)" by (simp add: algebra_simps)
  50.204      also have "\<dots> = (c * x + Inum (x # bs) e \<noteq> 0)"
  50.205      using zero_le_mult_iff [where a="(l div c)" and b="c * x + Inum (x # bs) e"] ldcp by simp
  50.206    finally show ?case using numbound0_I[OF be,where b="(l * x)" and b'="x" and bs="bs"]  be  by simp
  50.207 @@ -1551,7 +1551,7 @@
  50.208      hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric] 
  50.209        by simp
  50.210      hence "(\<exists> (k::int). l * x + (l div c) * Inum (x # bs) e = ((l div c) * j) * k) = (\<exists> (k::int). (c * (l div c)) * x + (l div c) * Inum (x # bs) e = ((l div c) * j) * k)"  by simp
  50.211 -    also have "\<dots> = (\<exists> (k::int). (l div c) * (c * x + Inum (x # bs) e - j * k) = (l div c)*0)" by (simp add: ring_simps)
  50.212 +    also have "\<dots> = (\<exists> (k::int). (l div c) * (c * x + Inum (x # bs) e - j * k) = (l div c)*0)" by (simp add: algebra_simps)
  50.213      also fix k have "\<dots> = (\<exists> (k::int). c * x + Inum (x # bs) e - j * k = 0)"
  50.214      using zero_le_mult_iff [where a="(l div c)" and b="c * x + Inum (x # bs) e - j * k"] ldcp by simp
  50.215    also have "\<dots> = (\<exists> (k::int). c * x + Inum (x # bs) e = j * k)" by simp
  50.216 @@ -1568,7 +1568,7 @@
  50.217      hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric] 
  50.218        by simp
  50.219      hence "(\<exists> (k::int). l * x + (l div c) * Inum (x # bs) e = ((l div c) * j) * k) = (\<exists> (k::int). (c * (l div c)) * x + (l div c) * Inum (x # bs) e = ((l div c) * j) * k)"  by simp
  50.220 -    also have "\<dots> = (\<exists> (k::int). (l div c) * (c * x + Inum (x # bs) e - j * k) = (l div c)*0)" by (simp add: ring_simps)
  50.221 +    also have "\<dots> = (\<exists> (k::int). (l div c) * (c * x + Inum (x # bs) e - j * k) = (l div c)*0)" by (simp add: algebra_simps)
  50.222      also fix k have "\<dots> = (\<exists> (k::int). c * x + Inum (x # bs) e - j * k = 0)"
  50.223      using zero_le_mult_iff [where a="(l div c)" and b="c * x + Inum (x # bs) e - j * k"] ldcp by simp
  50.224    also have "\<dots> = (\<exists> (k::int). c * x + Inum (x # bs) e = j * k)" by simp
  50.225 @@ -1617,7 +1617,7 @@
  50.226        hence "x + ?e \<ge> 1 \<and> x + ?e \<le> d"  by simp
  50.227        hence "\<exists> (j::int) \<in> {1 .. d}. j = x + ?e" by simp
  50.228        hence "\<exists> (j::int) \<in> {1 .. d}. x = (- ?e + j)" 
  50.229 -	by (simp add: ring_simps)
  50.230 +	by (simp add: algebra_simps)
  50.231        with nob have ?case by auto}
  50.232      ultimately show ?case by blast
  50.233  next
  50.234 @@ -1636,7 +1636,7 @@
  50.235        from H p have "x + ?e \<ge> 0 \<and> x + ?e < d" by (simp add: c1)
  50.236        hence "x + ?e +1 \<ge> 1 \<and> x + ?e + 1 \<le> d"  by simp
  50.237        hence "\<exists> (j::int) \<in> {1 .. d}. j = x + ?e + 1" by simp
  50.238 -      hence "\<exists> (j::int) \<in> {1 .. d}. x= - ?e - 1 + j" by (simp add: ring_simps)
  50.239 +      hence "\<exists> (j::int) \<in> {1 .. d}. x= - ?e - 1 + j" by (simp add: algebra_simps)
  50.240        with nob have ?case by simp }
  50.241      ultimately show ?case by blast
  50.242  next
  50.243 @@ -1646,7 +1646,7 @@
  50.244      have vb: "?v \<in> set (\<beta> (Eq (CN 0 c e)))" by simp
  50.245      from p have "x= - ?e" by (simp add: c1) with prems(11) show ?case using dp
  50.246        by simp (erule ballE[where x="1"],
  50.247 -	simp_all add:ring_simps numbound0_I[OF bn,where b="x"and b'="a"and bs="bs"])
  50.248 +	simp_all add:algebra_simps numbound0_I[OF bn,where b="x"and b'="a"and bs="bs"])
  50.249  next
  50.250    case (4 c e)hence p: "Ifm bbs (x #bs) (NEq (CN 0 c e))" (is "?p x") and c1: "c=1" and bn:"numbound0 e" using dvd1_eq1[where x="c"] by simp+
  50.251      let ?e = "Inum (x # bs) e"
    51.1 --- a/src/HOL/ex/ReflectionEx.thy	Sun Jan 18 13:58:17 2009 +0100
    51.2 +++ b/src/HOL/ex/ReflectionEx.thy	Wed Jan 28 16:29:16 2009 +0100
    51.3 @@ -183,7 +183,7 @@
    51.4  lemma lin_add: "Inum (lin_add (t,s)) bs = Inum (Add t s) bs"
    51.5  apply (induct t s rule: lin_add.induct, simp_all add: Let_def)
    51.6  apply (case_tac "c1+c2 = 0",case_tac "n1 \<le> n2", simp_all)
    51.7 -by (case_tac "n1 = n2", simp_all add: ring_simps)
    51.8 +by (case_tac "n1 = n2", simp_all add: algebra_simps)
    51.9  
   51.10  consts lin_mul :: "num \<Rightarrow> nat \<Rightarrow> num"
   51.11  recdef lin_mul "measure size "
   51.12 @@ -192,7 +192,7 @@
   51.13    "lin_mul t = (\<lambda> i. Mul i t)"
   51.14  
   51.15  lemma lin_mul: "Inum (lin_mul t i) bs = Inum (Mul i t) bs"
   51.16 -by (induct t arbitrary: i rule: lin_mul.induct, auto simp add: ring_simps)
   51.17 +by (induct t arbitrary: i rule: lin_mul.induct, auto simp add: algebra_simps)
   51.18  
   51.19  consts linum:: "num \<Rightarrow> num"
   51.20  recdef linum "measure num_size"