Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
authorpaulson <lp15@cam.ac.uk>
Tue Nov 10 14:18:41 2015 +0000 (2015-11-10)
changeset 6160977b453bd616f
parent 61553 933eb9e6a1cc
child 61610 4f54d2759a0b
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
src/HOL/Complex.thy
src/HOL/Decision_Procs/Approximation.thy
src/HOL/Decision_Procs/Ferrack.thy
src/HOL/Decision_Procs/MIR.thy
src/HOL/Decision_Procs/approximation_generator.ML
src/HOL/Decision_Procs/ferrack_tac.ML
src/HOL/Decision_Procs/mir_tac.ML
src/HOL/Deriv.thy
src/HOL/Inequalities.thy
src/HOL/Int.thy
src/HOL/Library/Extended_Real.thy
src/HOL/Library/Float.thy
src/HOL/Library/Formal_Power_Series.thy
src/HOL/Library/positivstellensatz.ML
src/HOL/Limits.thy
src/HOL/MacLaurin.thy
src/HOL/Matrix_LP/ComputeFloat.thy
src/HOL/Matrix_LP/ComputeNumeral.thy
src/HOL/Multivariate_Analysis/Brouwer_Fixpoint.thy
src/HOL/Multivariate_Analysis/Cauchy_Integral_Thm.thy
src/HOL/Multivariate_Analysis/Complex_Analysis_Basics.thy
src/HOL/Multivariate_Analysis/Complex_Transcendental.thy
src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy
src/HOL/Multivariate_Analysis/Integration.thy
src/HOL/Multivariate_Analysis/Linear_Algebra.thy
src/HOL/Multivariate_Analysis/PolyRoots.thy
src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy
src/HOL/Multivariate_Analysis/Weierstrass.thy
src/HOL/NSA/CLim.thy
src/HOL/NSA/HSEQ.thy
src/HOL/NSA/HSeries.thy
src/HOL/NSA/HyperDef.thy
src/HOL/NSA/NSA.thy
src/HOL/NSA/NSComplex.thy
src/HOL/NSA/NatStar.thy
src/HOL/NSA/Star.thy
src/HOL/NthRoot.thy
src/HOL/Old_Number_Theory/Fib.thy
src/HOL/Old_Number_Theory/Quadratic_Reciprocity.thy
src/HOL/Probability/Binary_Product_Measure.thy
src/HOL/Probability/Bochner_Integration.thy
src/HOL/Probability/Borel_Space.thy
src/HOL/Probability/Distributions.thy
src/HOL/Probability/Giry_Monad.thy
src/HOL/Probability/Information.thy
src/HOL/Probability/Interval_Integral.thy
src/HOL/Probability/Lebesgue_Integral_Substitution.thy
src/HOL/Probability/Lebesgue_Measure.thy
src/HOL/Probability/Measure_Space.thy
src/HOL/Probability/Nonnegative_Lebesgue_Integration.thy
src/HOL/Probability/Probability_Mass_Function.thy
src/HOL/Probability/Projective_Limit.thy
src/HOL/Probability/Radon_Nikodym.thy
src/HOL/Probability/Regularity.thy
src/HOL/Probability/Sigma_Algebra.thy
src/HOL/Probability/ex/Koepf_Duermuth_Countermeasure.thy
src/HOL/Real.thy
src/HOL/Real_Vector_Spaces.thy
src/HOL/Series.thy
src/HOL/TPTP/THF_Arith.thy
src/HOL/Tools/SMT/z3_real.ML
src/HOL/Transcendental.thy
src/HOL/ex/Ballot.thy
src/HOL/ex/HarmonicSeries.thy
src/HOL/ex/Sqrt_Script.thy
src/HOL/ex/Sum_of_Powers.thy
     1.1 --- a/src/HOL/Complex.thy	Tue Nov 03 11:20:21 2015 +0100
     1.2 +++ b/src/HOL/Complex.thy	Tue Nov 10 14:18:41 2015 +0000
     1.3 @@ -166,7 +166,7 @@
     1.4  
     1.5  lemma Im_divide_numeral [simp]: "Im (z / numeral w) = Im z / numeral w"
     1.6    by (simp add: Im_divide sqr_conv_mult)
     1.7 -  
     1.8 +
     1.9  lemma Re_divide_of_nat: "Re (z / of_nat n) = Re z / of_nat n"
    1.10    by (cases n) (simp_all add: Re_divide divide_simps power2_eq_square del: of_nat_Suc)
    1.11  
    1.12 @@ -688,7 +688,7 @@
    1.13    by (simp add: complex_eq_iff cos_add sin_add)
    1.14  
    1.15  lemma DeMoivre: "(cis a) ^ n = cis (real n * a)"
    1.16 -  by (induct n, simp_all add: real_of_nat_Suc algebra_simps cis_mult)
    1.17 +  by (induct n, simp_all add: of_nat_Suc algebra_simps cis_mult)
    1.18  
    1.19  lemma cis_inverse [simp]: "inverse(cis a) = cis (-a)"
    1.20    by (simp add: complex_eq_iff)
    1.21 @@ -757,8 +757,7 @@
    1.22      have "\<i> ^ n = fact n *\<^sub>R (cos_coeff n + \<i> * sin_coeff n)"
    1.23        by (induct n)
    1.24           (simp_all add: sin_coeff_Suc cos_coeff_Suc complex_eq_iff Re_divide Im_divide field_simps
    1.25 -                        power2_eq_square real_of_nat_Suc add_nonneg_eq_0_iff
    1.26 -                        real_of_nat_def[symmetric])
    1.27 +                        power2_eq_square of_nat_Suc add_nonneg_eq_0_iff)
    1.28      then have "(\<i> * complex_of_real b) ^ n /\<^sub>R fact n =
    1.29          of_real (cos_coeff n * b^n) + \<i> * of_real (sin_coeff n * b^n)"
    1.30        by (simp add: field_simps) }
     2.1 --- a/src/HOL/Decision_Procs/Approximation.thy	Tue Nov 03 11:20:21 2015 +0100
     2.2 +++ b/src/HOL/Decision_Procs/Approximation.thy	Tue Nov 10 14:18:41 2015 +0000
     2.3 @@ -51,7 +51,7 @@
     2.4  
     2.5  lemma horner_bounds':
     2.6    fixes lb :: "nat \<Rightarrow> nat \<Rightarrow> nat \<Rightarrow> float \<Rightarrow> float" and ub :: "nat \<Rightarrow> nat \<Rightarrow> nat \<Rightarrow> float \<Rightarrow> float"
     2.7 -  assumes "0 \<le> real x" and f_Suc: "\<And>n. f (Suc n) = G ((F ^^ n) s) (f n)"
     2.8 +  assumes "0 \<le> real_of_float x" and f_Suc: "\<And>n. f (Suc n) = G ((F ^^ n) s) (f n)"
     2.9      and lb_0: "\<And> i k x. lb 0 i k x = 0"
    2.10      and lb_Suc: "\<And> n i k x. lb (Suc n) i k x = float_plus_down prec
    2.11          (lapprox_rat prec 1 k)
    2.12 @@ -69,7 +69,7 @@
    2.13  next
    2.14    case (Suc n)
    2.15    thus ?case using lapprox_rat[of prec 1 "f j'"] using rapprox_rat[of 1 "f j'" prec]
    2.16 -    Suc[where j'="Suc j'"] \<open>0 \<le> real x\<close>
    2.17 +    Suc[where j'="Suc j'"] \<open>0 \<le> real_of_float x\<close>
    2.18      by (auto intro!: add_mono mult_left_mono float_round_down_le float_round_up_le
    2.19        order_trans[OF add_mono[OF _ float_plus_down_le]]
    2.20        order_trans[OF _ add_mono[OF _ float_plus_up_le]]
    2.21 @@ -87,7 +87,7 @@
    2.22  
    2.23  lemma horner_bounds:
    2.24    fixes F :: "nat \<Rightarrow> nat" and G :: "nat \<Rightarrow> nat \<Rightarrow> nat"
    2.25 -  assumes "0 \<le> real x" and f_Suc: "\<And>n. f (Suc n) = G ((F ^^ n) s) (f n)"
    2.26 +  assumes "0 \<le> real_of_float x" and f_Suc: "\<And>n. f (Suc n) = G ((F ^^ n) s) (f n)"
    2.27      and lb_0: "\<And> i k x. lb 0 i k x = 0"
    2.28      and lb_Suc: "\<And> n i k x. lb (Suc n) i k x = float_plus_down prec
    2.29          (lapprox_rat prec 1 k)
    2.30 @@ -102,14 +102,14 @@
    2.31        (is "?ub")
    2.32  proof -
    2.33    have "?lb  \<and> ?ub"
    2.34 -    using horner_bounds'[where lb=lb, OF \<open>0 \<le> real x\<close> f_Suc lb_0 lb_Suc ub_0 ub_Suc]
    2.35 -    unfolding horner_schema[where f=f, OF f_Suc] .
    2.36 +    using horner_bounds'[where lb=lb, OF \<open>0 \<le> real_of_float x\<close> f_Suc lb_0 lb_Suc ub_0 ub_Suc]
    2.37 +    unfolding horner_schema[where f=f, OF f_Suc] by simp
    2.38    thus "?lb" and "?ub" by auto
    2.39  qed
    2.40  
    2.41  lemma horner_bounds_nonpos:
    2.42    fixes F :: "nat \<Rightarrow> nat" and G :: "nat \<Rightarrow> nat \<Rightarrow> nat"
    2.43 -  assumes "real x \<le> 0" and f_Suc: "\<And>n. f (Suc n) = G ((F ^^ n) s) (f n)"
    2.44 +  assumes "real_of_float x \<le> 0" and f_Suc: "\<And>n. f (Suc n) = G ((F ^^ n) s) (f n)"
    2.45      and lb_0: "\<And> i k x. lb 0 i k x = 0"
    2.46      and lb_Suc: "\<And> n i k x. lb (Suc n) i k x = float_plus_down prec
    2.47          (lapprox_rat prec 1 k)
    2.48 @@ -118,14 +118,14 @@
    2.49      and ub_Suc: "\<And> n i k x. ub (Suc n) i k x = float_plus_up prec
    2.50          (rapprox_rat prec 1 k)
    2.51          (float_round_up prec (x * (lb n (F i) (G i k) x)))"
    2.52 -  shows "(lb n ((F ^^ j') s) (f j') x) \<le> (\<Sum>j=0..<n. (1 / (f (j' + j))) * real x ^ j)" (is "?lb")
    2.53 -    and "(\<Sum>j=0..<n. (1 / (f (j' + j))) * real x ^ j) \<le> (ub n ((F ^^ j') s) (f j') x)" (is "?ub")
    2.54 +  shows "(lb n ((F ^^ j') s) (f j') x) \<le> (\<Sum>j=0..<n. (1 / (f (j' + j))) * real_of_float x ^ j)" (is "?lb")
    2.55 +    and "(\<Sum>j=0..<n. (1 / (f (j' + j))) * real_of_float x ^ j) \<le> (ub n ((F ^^ j') s) (f j') x)" (is "?ub")
    2.56  proof -
    2.57    have diff_mult_minus: "x - y * z = x + - y * z" for x y z :: float by simp
    2.58 -  have sum_eq: "(\<Sum>j=0..<n. (1 / (f (j' + j))) * real x ^ j) =
    2.59 -    (\<Sum>j = 0..<n. (- 1) ^ j * (1 / (f (j' + j))) * real (- x) ^ j)"
    2.60 +  have sum_eq: "(\<Sum>j=0..<n. (1 / (f (j' + j))) * real_of_float x ^ j) =
    2.61 +    (\<Sum>j = 0..<n. (- 1) ^ j * (1 / (f (j' + j))) * real_of_float (- x) ^ j)"
    2.62      by (auto simp add: field_simps power_mult_distrib[symmetric])
    2.63 -  have "0 \<le> real (-x)" using assms by auto
    2.64 +  have "0 \<le> real_of_float (-x)" using assms by auto
    2.65    from horner_bounds[where G=G and F=F and f=f and s=s and prec=prec
    2.66      and lb="\<lambda> n i k x. lb n i k (-x)" and ub="\<lambda> n i k x. ub n i k (-x)",
    2.67      unfolded lb_Suc ub_Suc diff_mult_minus,
    2.68 @@ -238,7 +238,7 @@
    2.69  qed
    2.70  
    2.71  lemma sqrt_iteration_bound:
    2.72 -  assumes "0 < real x"
    2.73 +  assumes "0 < real_of_float x"
    2.74    shows "sqrt x < sqrt_iteration prec n x"
    2.75  proof (induct n)
    2.76    case 0
    2.77 @@ -260,7 +260,7 @@
    2.78      proof (rule mult_strict_right_mono, auto)
    2.79        show "m < 2^nat (bitlen m)"
    2.80          using bitlen_bounds[OF \<open>0 < m\<close>, THEN conjunct2]
    2.81 -        unfolding real_of_int_less_iff[of m, symmetric] by auto
    2.82 +        unfolding of_int_less_iff[of m, symmetric] by auto
    2.83      qed
    2.84      finally have "sqrt x < sqrt (2 powr (e + bitlen m))"
    2.85        unfolding int_nat_bl by auto
    2.86 @@ -287,7 +287,7 @@
    2.87        have E_eq: "2 powr ?E = 2 powr (?E div 2 + ?E div 2 + ?E mod 2)"
    2.88          by auto
    2.89        have "sqrt (2 powr ?E) = sqrt (2 powr (?E div 2) * 2 powr (?E div 2) * 2 powr (?E mod 2))"
    2.90 -        unfolding E_eq unfolding powr_add[symmetric] by (simp add: int_of_reals del: real_of_ints)
    2.91 +        unfolding E_eq unfolding powr_add[symmetric] by (metis of_int_add)
    2.92        also have "\<dots> = 2 powr (?E div 2) * sqrt (2 powr (?E mod 2))"
    2.93          unfolding real_sqrt_mult[of _ "2 powr (?E mod 2)"] real_sqrt_abs2 by auto
    2.94        also have "\<dots> < 2 powr (?E div 2) * 2 powr 1"
    2.95 @@ -304,11 +304,11 @@
    2.96    case (Suc n)
    2.97    let ?b = "sqrt_iteration prec n x"
    2.98    have "0 < sqrt x"
    2.99 -    using \<open>0 < real x\<close> by auto
   2.100 -  also have "\<dots> < real ?b"
   2.101 +    using \<open>0 < real_of_float x\<close> by auto
   2.102 +  also have "\<dots> < real_of_float ?b"
   2.103      using Suc .
   2.104    finally have "sqrt x < (?b + x / ?b)/2"
   2.105 -    using sqrt_ub_pos_pos_1[OF Suc _ \<open>0 < real x\<close>] by auto
   2.106 +    using sqrt_ub_pos_pos_1[OF Suc _ \<open>0 < real_of_float x\<close>] by auto
   2.107    also have "\<dots> \<le> (?b + (float_divr prec x ?b))/2"
   2.108      by (rule divide_right_mono, auto simp add: float_divr)
   2.109    also have "\<dots> = (Float 1 (- 1)) * (?b + (float_divr prec x ?b))"
   2.110 @@ -320,8 +320,8 @@
   2.111  qed
   2.112  
   2.113  lemma sqrt_iteration_lower_bound:
   2.114 -  assumes "0 < real x"
   2.115 -  shows "0 < real (sqrt_iteration prec n x)" (is "0 < ?sqrt")
   2.116 +  assumes "0 < real_of_float x"
   2.117 +  shows "0 < real_of_float (sqrt_iteration prec n x)" (is "0 < ?sqrt")
   2.118  proof -
   2.119    have "0 < sqrt x" using assms by auto
   2.120    also have "\<dots> < ?sqrt" using sqrt_iteration_bound[OF assms] .
   2.121 @@ -329,21 +329,21 @@
   2.122  qed
   2.123  
   2.124  lemma lb_sqrt_lower_bound:
   2.125 -  assumes "0 \<le> real x"
   2.126 -  shows "0 \<le> real (lb_sqrt prec x)"
   2.127 +  assumes "0 \<le> real_of_float x"
   2.128 +  shows "0 \<le> real_of_float (lb_sqrt prec x)"
   2.129  proof (cases "0 < x")
   2.130    case True
   2.131 -  hence "0 < real x" and "0 \<le> x"
   2.132 -    using \<open>0 \<le> real x\<close> by auto
   2.133 +  hence "0 < real_of_float x" and "0 \<le> x"
   2.134 +    using \<open>0 \<le> real_of_float x\<close> by auto
   2.135    hence "0 < sqrt_iteration prec prec x"
   2.136      using sqrt_iteration_lower_bound by auto
   2.137 -  hence "0 \<le> real (float_divl prec x (sqrt_iteration prec prec x))"
   2.138 +  hence "0 \<le> real_of_float (float_divl prec x (sqrt_iteration prec prec x))"
   2.139      using float_divl_lower_bound[OF \<open>0 \<le> x\<close>] unfolding less_eq_float_def by auto
   2.140    thus ?thesis
   2.141      unfolding lb_sqrt.simps using True by auto
   2.142  next
   2.143    case False
   2.144 -  with \<open>0 \<le> real x\<close> have "real x = 0" by auto
   2.145 +  with \<open>0 \<le> real_of_float x\<close> have "real_of_float x = 0" by auto
   2.146    thus ?thesis
   2.147      unfolding lb_sqrt.simps by auto
   2.148  qed
   2.149 @@ -352,24 +352,24 @@
   2.150  proof -
   2.151    have lb: "lb_sqrt prec x \<le> sqrt x" if "0 < x" for x :: float
   2.152    proof -
   2.153 -    from that have "0 < real x" and "0 \<le> real x" by auto
   2.154 +    from that have "0 < real_of_float x" and "0 \<le> real_of_float x" by auto
   2.155      hence sqrt_gt0: "0 < sqrt x" by auto
   2.156      hence sqrt_ub: "sqrt x < sqrt_iteration prec prec x"
   2.157        using sqrt_iteration_bound by auto
   2.158      have "(float_divl prec x (sqrt_iteration prec prec x)) \<le>
   2.159            x / (sqrt_iteration prec prec x)" by (rule float_divl)
   2.160      also have "\<dots> < x / sqrt x"
   2.161 -      by (rule divide_strict_left_mono[OF sqrt_ub \<open>0 < real x\<close>
   2.162 +      by (rule divide_strict_left_mono[OF sqrt_ub \<open>0 < real_of_float x\<close>
   2.163                 mult_pos_pos[OF order_less_trans[OF sqrt_gt0 sqrt_ub] sqrt_gt0]])
   2.164      also have "\<dots> = sqrt x"
   2.165        unfolding inverse_eq_iff_eq[of _ "sqrt x", symmetric]
   2.166 -                sqrt_divide_self_eq[OF \<open>0 \<le> real x\<close>, symmetric] by auto
   2.167 +                sqrt_divide_self_eq[OF \<open>0 \<le> real_of_float x\<close>, symmetric] by auto
   2.168      finally show ?thesis
   2.169        unfolding lb_sqrt.simps if_P[OF \<open>0 < x\<close>] by auto
   2.170    qed
   2.171    have ub: "sqrt x \<le> ub_sqrt prec x" if "0 < x" for x :: float
   2.172    proof -
   2.173 -    from that have "0 < real x" by auto
   2.174 +    from that have "0 < real_of_float x" by auto
   2.175      hence "0 < sqrt x" by auto
   2.176      hence "sqrt x < sqrt_iteration prec prec x"
   2.177        using sqrt_iteration_bound by auto
   2.178 @@ -419,7 +419,7 @@
   2.179        (lapprox_rat prec 1 k) (- float_round_up prec (x * (ub_arctan_horner prec n (k + 2) x)))"
   2.180  
   2.181  lemma arctan_0_1_bounds':
   2.182 -  assumes "0 \<le> real y" "real y \<le> 1"
   2.183 +  assumes "0 \<le> real_of_float y" "real_of_float y \<le> 1"
   2.184      and "even n"
   2.185    shows "arctan (sqrt y) \<in>
   2.186        {(sqrt y * lb_arctan_horner prec n 1 y) .. (sqrt y * ub_arctan_horner prec (Suc n) 1 y)}"
   2.187 @@ -452,7 +452,7 @@
   2.188    note bounds = horner_bounds[where s=1 and f="\<lambda>i. 2 * i + 1" and j'=0
   2.189      and lb="\<lambda>n i k x. lb_arctan_horner prec n k x"
   2.190      and ub="\<lambda>n i k x. ub_arctan_horner prec n k x",
   2.191 -    OF \<open>0 \<le> real y\<close> F lb_arctan_horner.simps ub_arctan_horner.simps]
   2.192 +    OF \<open>0 \<le> real_of_float y\<close> F lb_arctan_horner.simps ub_arctan_horner.simps]
   2.193  
   2.194    have "(sqrt y * lb_arctan_horner prec n 1 y) \<le> arctan (sqrt y)"
   2.195    proof -
   2.196 @@ -479,7 +479,7 @@
   2.197  qed
   2.198  
   2.199  lemma arctan_0_1_bounds:
   2.200 -  assumes "0 \<le> real y" "real y \<le> 1"
   2.201 +  assumes "0 \<le> real_of_float y" "real_of_float y \<le> 1"
   2.202    shows "arctan (sqrt y) \<in>
   2.203      {(sqrt y * lb_arctan_horner prec (get_even n) 1 y) ..
   2.204        (sqrt y * ub_arctan_horner prec (get_odd n) 1 y)}"
   2.205 @@ -532,47 +532,37 @@
   2.206  qed
   2.207  
   2.208  lemma arctan_0_1_bounds_le:
   2.209 -  assumes "0 \<le> x" "x \<le> 1" "0 < real xl" "real xl \<le> x * x" "x * x \<le> real xu" "real xu \<le> 1"
   2.210 +  assumes "0 \<le> x" "x \<le> 1" "0 < real_of_float xl" "real_of_float xl \<le> x * x" "x * x \<le> real_of_float xu" "real_of_float xu \<le> 1"
   2.211    shows "arctan x \<in>
   2.212        {x * lb_arctan_horner p1 (get_even n) 1 xu .. x * ub_arctan_horner p2 (get_odd n) 1 xl}"
   2.213  proof -
   2.214 -  from assms have "real xl \<le> 1" "sqrt (real xl) \<le> x" "x \<le> sqrt (real xu)" "0 \<le> real xu"
   2.215 -    "0 \<le> real xl" "0 < sqrt (real xl)"
   2.216 +  from assms have "real_of_float xl \<le> 1" "sqrt (real_of_float xl) \<le> x" "x \<le> sqrt (real_of_float xu)" "0 \<le> real_of_float xu"
   2.217 +    "0 \<le> real_of_float xl" "0 < sqrt (real_of_float xl)"
   2.218      by (auto intro!: real_le_rsqrt real_le_lsqrt simp: power2_eq_square)
   2.219 -  from arctan_0_1_bounds[OF \<open>0 \<le> real xu\<close>  \<open>real xu \<le> 1\<close>]
   2.220 -  have "sqrt (real xu) * real (lb_arctan_horner p1 (get_even n) 1 xu) \<le> arctan (sqrt (real xu))"
   2.221 +  from arctan_0_1_bounds[OF \<open>0 \<le> real_of_float xu\<close>  \<open>real_of_float xu \<le> 1\<close>]
   2.222 +  have "sqrt (real_of_float xu) * real_of_float (lb_arctan_horner p1 (get_even n) 1 xu) \<le> arctan (sqrt (real_of_float xu))"
   2.223      by simp
   2.224    from arctan_mult_le[OF \<open>0 \<le> x\<close> \<open>x \<le> sqrt _\<close>  this]
   2.225 -  have "x * real (lb_arctan_horner p1 (get_even n) 1 xu) \<le> arctan x" .
   2.226 +  have "x * real_of_float (lb_arctan_horner p1 (get_even n) 1 xu) \<le> arctan x" .
   2.227    moreover
   2.228 -  from arctan_0_1_bounds[OF \<open>0 \<le> real xl\<close>  \<open>real xl \<le> 1\<close>]
   2.229 -  have "arctan (sqrt (real xl)) \<le> sqrt (real xl) * real (ub_arctan_horner p2 (get_odd n) 1 xl)"
   2.230 +  from arctan_0_1_bounds[OF \<open>0 \<le> real_of_float xl\<close>  \<open>real_of_float xl \<le> 1\<close>]
   2.231 +  have "arctan (sqrt (real_of_float xl)) \<le> sqrt (real_of_float xl) * real_of_float (ub_arctan_horner p2 (get_odd n) 1 xl)"
   2.232      by simp
   2.233    from arctan_le_mult[OF \<open>0 < sqrt xl\<close> \<open>sqrt xl \<le> x\<close> this]
   2.234 -  have "arctan x \<le> x * real (ub_arctan_horner p2 (get_odd n) 1 xl)" .
   2.235 +  have "arctan x \<le> x * real_of_float (ub_arctan_horner p2 (get_odd n) 1 xl)" .
   2.236    ultimately show ?thesis by simp
   2.237  qed
   2.238  
   2.239 -lemma mult_nonneg_le_one:
   2.240 -  fixes a :: real
   2.241 -  assumes "0 \<le> a" "0 \<le> b" "a \<le> 1" "b \<le> 1"
   2.242 -  shows "a * b \<le> 1"
   2.243 -proof -
   2.244 -  have "a * b \<le> 1 * 1"
   2.245 -    by (intro mult_mono assms) simp_all
   2.246 -  thus ?thesis by simp
   2.247 -qed
   2.248 -
   2.249  lemma arctan_0_1_bounds_round:
   2.250 -  assumes "0 \<le> real x" "real x \<le> 1"
   2.251 +  assumes "0 \<le> real_of_float x" "real_of_float x \<le> 1"
   2.252    shows "arctan x \<in>
   2.253 -      {real x * lb_arctan_horner p1 (get_even n) 1 (float_round_up (Suc p2) (x * x)) ..
   2.254 -        real x * ub_arctan_horner p3 (get_odd n) 1 (float_round_down (Suc p4) (x * x))}"
   2.255 +      {real_of_float x * lb_arctan_horner p1 (get_even n) 1 (float_round_up (Suc p2) (x * x)) ..
   2.256 +        real_of_float x * ub_arctan_horner p3 (get_odd n) 1 (float_round_down (Suc p4) (x * x))}"
   2.257    using assms
   2.258    apply (cases "x > 0")
   2.259     apply (intro arctan_0_1_bounds_le)
   2.260     apply (auto simp: float_round_down.rep_eq float_round_up.rep_eq
   2.261 -    intro!: truncate_up_le1 mult_nonneg_le_one truncate_down_le truncate_up_le truncate_down_pos
   2.262 +    intro!: truncate_up_le1 mult_le_one truncate_down_le truncate_up_le truncate_down_pos
   2.263        mult_pos_pos)
   2.264    done
   2.265  
   2.266 @@ -614,14 +604,14 @@
   2.267      let ?kl = "float_round_down (Suc prec) (?k * ?k)"
   2.268      have "1 div k = 0" using div_pos_pos_trivial[OF _ \<open>1 < k\<close>] by auto
   2.269  
   2.270 -    have "0 \<le> real ?k" by (rule order_trans[OF _ rapprox_rat]) (auto simp add: \<open>0 \<le> k\<close>)
   2.271 -    have "real ?k \<le> 1"
   2.272 +    have "0 \<le> real_of_float ?k" by (rule order_trans[OF _ rapprox_rat]) (auto simp add: \<open>0 \<le> k\<close>)
   2.273 +    have "real_of_float ?k \<le> 1"
   2.274        by (auto simp add: \<open>0 < k\<close> \<open>1 \<le> k\<close> less_imp_le
   2.275 -        intro!: mult_nonneg_le_one order_trans[OF _ rapprox_rat] rapprox_rat_le1)
   2.276 +        intro!: mult_le_one order_trans[OF _ rapprox_rat] rapprox_rat_le1)
   2.277      have "1 / k \<le> ?k" using rapprox_rat[where x=1 and y=k] by auto
   2.278      hence "arctan (1 / k) \<le> arctan ?k" by (rule arctan_monotone')
   2.279      also have "\<dots> \<le> (?k * ub_arctan_horner prec (get_odd n) 1 ?kl)"
   2.280 -      using arctan_0_1_bounds_round[OF \<open>0 \<le> real ?k\<close> \<open>real ?k \<le> 1\<close>]
   2.281 +      using arctan_0_1_bounds_round[OF \<open>0 \<le> real_of_float ?k\<close> \<open>real_of_float ?k \<le> 1\<close>]
   2.282        by auto
   2.283      finally have "arctan (1 / k) \<le> ?k * ub_arctan_horner prec (get_odd n) 1 ?kl" .
   2.284    } note ub_arctan = this
   2.285 @@ -634,16 +624,16 @@
   2.286      let ?ku = "float_round_up (Suc prec) (?k * ?k)"
   2.287      have "1 div k = 0" using div_pos_pos_trivial[OF _ \<open>1 < k\<close>] by auto
   2.288      have "1 / k \<le> 1" using \<open>1 < k\<close> by auto
   2.289 -    have "0 \<le> real ?k" using lapprox_rat_nonneg[where x=1 and y=k, OF zero_le_one \<open>0 \<le> k\<close>]
   2.290 +    have "0 \<le> real_of_float ?k" using lapprox_rat_nonneg[where x=1 and y=k, OF zero_le_one \<open>0 \<le> k\<close>]
   2.291        by (auto simp add: \<open>1 div k = 0\<close>)
   2.292 -    have "0 \<le> real (?k * ?k)" by simp
   2.293 -    have "real ?k \<le> 1" using lapprox_rat by (rule order_trans, auto simp add: \<open>1 / k \<le> 1\<close>)
   2.294 -    hence "real (?k * ?k) \<le> 1" using \<open>0 \<le> real ?k\<close> by (auto intro!: mult_nonneg_le_one)
   2.295 +    have "0 \<le> real_of_float (?k * ?k)" by simp
   2.296 +    have "real_of_float ?k \<le> 1" using lapprox_rat by (rule order_trans, auto simp add: \<open>1 / k \<le> 1\<close>)
   2.297 +    hence "real_of_float (?k * ?k) \<le> 1" using \<open>0 \<le> real_of_float ?k\<close> by (auto intro!: mult_le_one)
   2.298  
   2.299      have "?k \<le> 1 / k" using lapprox_rat[where x=1 and y=k] by auto
   2.300  
   2.301      have "?k * lb_arctan_horner prec (get_even n) 1 ?ku \<le> arctan ?k"
   2.302 -      using arctan_0_1_bounds_round[OF \<open>0 \<le> real ?k\<close> \<open>real ?k \<le> 1\<close>]
   2.303 +      using arctan_0_1_bounds_round[OF \<open>0 \<le> real_of_float ?k\<close> \<open>real_of_float ?k \<le> 1\<close>]
   2.304        by auto
   2.305      also have "\<dots> \<le> arctan (1 / k)" using \<open>?k \<le> 1 / k\<close> by (rule arctan_monotone')
   2.306      finally have "?k * lb_arctan_horner prec (get_even n) 1 ?ku \<le> arctan (1 / k)" .
   2.307 @@ -711,11 +701,11 @@
   2.308  declare lb_arctan_horner.simps[simp del]
   2.309  
   2.310  lemma lb_arctan_bound':
   2.311 -  assumes "0 \<le> real x"
   2.312 +  assumes "0 \<le> real_of_float x"
   2.313    shows "lb_arctan prec x \<le> arctan x"
   2.314  proof -
   2.315    have "\<not> x < 0" and "0 \<le> x"
   2.316 -    using \<open>0 \<le> real x\<close> by (auto intro!: truncate_up_le )
   2.317 +    using \<open>0 \<le> real_of_float x\<close> by (auto intro!: truncate_up_le )
   2.318  
   2.319    let "?ub_horner x" =
   2.320        "x * ub_arctan_horner prec (get_odd (prec div 4 + 1)) 1 (float_round_down (Suc prec) (x * x))"
   2.321 @@ -725,15 +715,15 @@
   2.322    show ?thesis
   2.323    proof (cases "x \<le> Float 1 (- 1)")
   2.324      case True
   2.325 -    hence "real x \<le> 1" by simp
   2.326 -    from arctan_0_1_bounds_round[OF \<open>0 \<le> real x\<close> \<open>real x \<le> 1\<close>]
   2.327 +    hence "real_of_float x \<le> 1" by simp
   2.328 +    from arctan_0_1_bounds_round[OF \<open>0 \<le> real_of_float x\<close> \<open>real_of_float x \<le> 1\<close>]
   2.329      show ?thesis
   2.330        unfolding lb_arctan.simps Let_def if_not_P[OF \<open>\<not> x < 0\<close>] if_P[OF True] using \<open>0 \<le> x\<close>
   2.331        by (auto intro!: float_round_down_le)
   2.332    next
   2.333      case False
   2.334 -    hence "0 < real x" by auto
   2.335 -    let ?R = "1 + sqrt (1 + real x * real x)"
   2.336 +    hence "0 < real_of_float x" by auto
   2.337 +    let ?R = "1 + sqrt (1 + real_of_float x * real_of_float x)"
   2.338      let ?sxx = "float_plus_up prec 1 (float_round_up prec (x * x))"
   2.339      let ?fR = "float_plus_up prec 1 (ub_sqrt prec ?sxx)"
   2.340      let ?DIV = "float_divl prec x ?fR"
   2.341 @@ -747,12 +737,12 @@
   2.342      finally
   2.343      have "sqrt (1 + x*x) \<le> ub_sqrt prec ?sxx" .
   2.344      hence "?R \<le> ?fR" by (auto simp: float_plus_up.rep_eq plus_up_def intro!: truncate_up_le)
   2.345 -    hence "0 < ?fR" and "0 < real ?fR" using \<open>0 < ?R\<close> by auto
   2.346 +    hence "0 < ?fR" and "0 < real_of_float ?fR" using \<open>0 < ?R\<close> by auto
   2.347  
   2.348      have monotone: "?DIV \<le> x / ?R"
   2.349      proof -
   2.350 -      have "?DIV \<le> real x / ?fR" by (rule float_divl)
   2.351 -      also have "\<dots> \<le> x / ?R" by (rule divide_left_mono[OF \<open>?R \<le> ?fR\<close> \<open>0 \<le> real x\<close> mult_pos_pos[OF order_less_le_trans[OF divisor_gt0 \<open>?R \<le> real ?fR\<close>] divisor_gt0]])
   2.352 +      have "?DIV \<le> real_of_float x / ?fR" by (rule float_divl)
   2.353 +      also have "\<dots> \<le> x / ?R" by (rule divide_left_mono[OF \<open>?R \<le> ?fR\<close> \<open>0 \<le> real_of_float x\<close> mult_pos_pos[OF order_less_le_trans[OF divisor_gt0 \<open>?R \<le> real_of_float ?fR\<close>] divisor_gt0]])
   2.354        finally show ?thesis .
   2.355      qed
   2.356  
   2.357 @@ -762,18 +752,18 @@
   2.358        have "x \<le> sqrt (1 + x * x)"
   2.359          using real_sqrt_sum_squares_ge2[where x=1, unfolded numeral_2_eq_2] by auto
   2.360        also note \<open>\<dots> \<le> (ub_sqrt prec ?sxx)\<close>
   2.361 -      finally have "real x \<le> ?fR"
   2.362 +      finally have "real_of_float x \<le> ?fR"
   2.363          by (auto simp: float_plus_up.rep_eq plus_up_def intro!: truncate_up_le)
   2.364 -      moreover have "?DIV \<le> real x / ?fR"
   2.365 +      moreover have "?DIV \<le> real_of_float x / ?fR"
   2.366          by (rule float_divl)
   2.367 -      ultimately have "real ?DIV \<le> 1"
   2.368 -        unfolding divide_le_eq_1_pos[OF \<open>0 < real ?fR\<close>, symmetric] by auto
   2.369 -
   2.370 -      have "0 \<le> real ?DIV"
   2.371 +      ultimately have "real_of_float ?DIV \<le> 1"
   2.372 +        unfolding divide_le_eq_1_pos[OF \<open>0 < real_of_float ?fR\<close>, symmetric] by auto
   2.373 +
   2.374 +      have "0 \<le> real_of_float ?DIV"
   2.375          using float_divl_lower_bound[OF \<open>0 \<le> x\<close>] \<open>0 < ?fR\<close>
   2.376          unfolding less_eq_float_def by auto
   2.377  
   2.378 -      from arctan_0_1_bounds_round[OF \<open>0 \<le> real (?DIV)\<close> \<open>real (?DIV) \<le> 1\<close>]
   2.379 +      from arctan_0_1_bounds_round[OF \<open>0 \<le> real_of_float (?DIV)\<close> \<open>real_of_float (?DIV) \<le> 1\<close>]
   2.380        have "Float 1 1 * ?lb_horner ?DIV \<le> 2 * arctan ?DIV"
   2.381          by simp
   2.382        also have "\<dots> \<le> 2 * arctan (x / ?R)"
   2.383 @@ -787,11 +777,11 @@
   2.384            intro!: order_trans[OF mult_left_mono[OF truncate_down]])
   2.385      next
   2.386        case False
   2.387 -      hence "2 < real x" by auto
   2.388 -      hence "1 \<le> real x" by auto
   2.389 +      hence "2 < real_of_float x" by auto
   2.390 +      hence "1 \<le> real_of_float x" by auto
   2.391  
   2.392        let "?invx" = "float_divr prec 1 x"
   2.393 -      have "0 \<le> arctan x" using arctan_monotone'[OF \<open>0 \<le> real x\<close>]
   2.394 +      have "0 \<le> arctan x" using arctan_monotone'[OF \<open>0 \<le> real_of_float x\<close>]
   2.395          using arctan_tan[of 0, unfolded tan_zero] by auto
   2.396  
   2.397        show ?thesis
   2.398 @@ -803,22 +793,22 @@
   2.399            using \<open>0 \<le> arctan x\<close> by auto
   2.400        next
   2.401          case False
   2.402 -        hence "real ?invx \<le> 1" by auto
   2.403 -        have "0 \<le> real ?invx"
   2.404 -          by (rule order_trans[OF _ float_divr]) (auto simp add: \<open>0 \<le> real x\<close>)
   2.405 +        hence "real_of_float ?invx \<le> 1" by auto
   2.406 +        have "0 \<le> real_of_float ?invx"
   2.407 +          by (rule order_trans[OF _ float_divr]) (auto simp add: \<open>0 \<le> real_of_float x\<close>)
   2.408  
   2.409          have "1 / x \<noteq> 0" and "0 < 1 / x"
   2.410 -          using \<open>0 < real x\<close> by auto
   2.411 +          using \<open>0 < real_of_float x\<close> by auto
   2.412  
   2.413          have "arctan (1 / x) \<le> arctan ?invx"
   2.414            unfolding one_float.rep_eq[symmetric] by (rule arctan_monotone', rule float_divr)
   2.415          also have "\<dots> \<le> ?ub_horner ?invx"
   2.416 -          using arctan_0_1_bounds_round[OF \<open>0 \<le> real ?invx\<close> \<open>real ?invx \<le> 1\<close>]
   2.417 +          using arctan_0_1_bounds_round[OF \<open>0 \<le> real_of_float ?invx\<close> \<open>real_of_float ?invx \<le> 1\<close>]
   2.418            by (auto intro!: float_round_up_le)
   2.419          also note float_round_up
   2.420          finally have "pi / 2 - float_round_up prec (?ub_horner ?invx) \<le> arctan x"
   2.421            using \<open>0 \<le> arctan x\<close> arctan_inverse[OF \<open>1 / x \<noteq> 0\<close>]
   2.422 -          unfolding real_sgn_pos[OF \<open>0 < 1 / real x\<close>] le_diff_eq by auto
   2.423 +          unfolding real_sgn_pos[OF \<open>0 < 1 / real_of_float x\<close>] le_diff_eq by auto
   2.424          moreover
   2.425          have "lb_pi prec * Float 1 (- 1) \<le> pi / 2"
   2.426            unfolding Float_num times_divide_eq_right mult_1_left using pi_boundaries by simp
   2.427 @@ -833,11 +823,11 @@
   2.428  qed
   2.429  
   2.430  lemma ub_arctan_bound':
   2.431 -  assumes "0 \<le> real x"
   2.432 +  assumes "0 \<le> real_of_float x"
   2.433    shows "arctan x \<le> ub_arctan prec x"
   2.434  proof -
   2.435    have "\<not> x < 0" and "0 \<le> x"
   2.436 -    using \<open>0 \<le> real x\<close> by auto
   2.437 +    using \<open>0 \<le> real_of_float x\<close> by auto
   2.438  
   2.439    let "?ub_horner x" =
   2.440      "float_round_up prec (x * ub_arctan_horner prec (get_odd (prec div 4 + 1)) 1 (float_round_down (Suc prec) (x * x)))"
   2.441 @@ -847,22 +837,22 @@
   2.442    show ?thesis
   2.443    proof (cases "x \<le> Float 1 (- 1)")
   2.444      case True
   2.445 -    hence "real x \<le> 1" by auto
   2.446 +    hence "real_of_float x \<le> 1" by auto
   2.447      show ?thesis
   2.448        unfolding ub_arctan.simps Let_def if_not_P[OF \<open>\<not> x < 0\<close>] if_P[OF True]
   2.449 -      using arctan_0_1_bounds_round[OF \<open>0 \<le> real x\<close> \<open>real x \<le> 1\<close>]
   2.450 +      using arctan_0_1_bounds_round[OF \<open>0 \<le> real_of_float x\<close> \<open>real_of_float x \<le> 1\<close>]
   2.451        by (auto intro!: float_round_up_le)
   2.452    next
   2.453      case False
   2.454 -    hence "0 < real x" by auto
   2.455 -    let ?R = "1 + sqrt (1 + real x * real x)"
   2.456 +    hence "0 < real_of_float x" by auto
   2.457 +    let ?R = "1 + sqrt (1 + real_of_float x * real_of_float x)"
   2.458      let ?sxx = "float_plus_down prec 1 (float_round_down prec (x * x))"
   2.459      let ?fR = "float_plus_down (Suc prec) 1 (lb_sqrt prec ?sxx)"
   2.460      let ?DIV = "float_divr prec x ?fR"
   2.461  
   2.462 -    have sqr_ge0: "0 \<le> 1 + real x * real x"
   2.463 -      using sum_power2_ge_zero[of 1 "real x", unfolded numeral_2_eq_2] by auto
   2.464 -    hence "0 \<le> real (1 + x*x)" by auto
   2.465 +    have sqr_ge0: "0 \<le> 1 + real_of_float x * real_of_float x"
   2.466 +      using sum_power2_ge_zero[of 1 "real_of_float x", unfolded numeral_2_eq_2] by auto
   2.467 +    hence "0 \<le> real_of_float (1 + x*x)" by auto
   2.468  
   2.469      hence divisor_gt0: "0 < ?R" by (auto intro: add_pos_nonneg)
   2.470  
   2.471 @@ -873,13 +863,13 @@
   2.472      finally have "lb_sqrt prec ?sxx \<le> sqrt (1 + x*x)" .
   2.473      hence "?fR \<le> ?R"
   2.474        by (auto simp: float_plus_down.rep_eq plus_down_def truncate_down_le)
   2.475 -    have "0 < real ?fR"
   2.476 +    have "0 < real_of_float ?fR"
   2.477        by (auto simp: float_plus_down.rep_eq plus_down_def float_round_down.rep_eq
   2.478          intro!: truncate_down_ge1 lb_sqrt_lower_bound order_less_le_trans[OF zero_less_one]
   2.479          truncate_down_nonneg add_nonneg_nonneg)
   2.480      have monotone: "x / ?R \<le> (float_divr prec x ?fR)"
   2.481      proof -
   2.482 -      from divide_left_mono[OF \<open>?fR \<le> ?R\<close> \<open>0 \<le> real x\<close> mult_pos_pos[OF divisor_gt0 \<open>0 < real ?fR\<close>]]
   2.483 +      from divide_left_mono[OF \<open>?fR \<le> ?R\<close> \<open>0 \<le> real_of_float x\<close> mult_pos_pos[OF divisor_gt0 \<open>0 < real_of_float ?fR\<close>]]
   2.484        have "x / ?R \<le> x / ?fR" .
   2.485        also have "\<dots> \<le> ?DIV" by (rule float_divr)
   2.486        finally show ?thesis .
   2.487 @@ -899,11 +889,11 @@
   2.488              if_not_P[OF \<open>\<not> x \<le> Float 1 (- 1)\<close>] if_P[OF \<open>x \<le> Float 1 1\<close>] if_P[OF True] .
   2.489        next
   2.490          case False
   2.491 -        hence "real ?DIV \<le> 1" by auto
   2.492 +        hence "real_of_float ?DIV \<le> 1" by auto
   2.493  
   2.494          have "0 \<le> x / ?R"
   2.495 -          using \<open>0 \<le> real x\<close> \<open>0 < ?R\<close> unfolding zero_le_divide_iff by auto
   2.496 -        hence "0 \<le> real ?DIV"
   2.497 +          using \<open>0 \<le> real_of_float x\<close> \<open>0 < ?R\<close> unfolding zero_le_divide_iff by auto
   2.498 +        hence "0 \<le> real_of_float ?DIV"
   2.499            using monotone by (rule order_trans)
   2.500  
   2.501          have "arctan x = 2 * arctan (x / ?R)"
   2.502 @@ -911,7 +901,7 @@
   2.503          also have "\<dots> \<le> 2 * arctan (?DIV)"
   2.504            using arctan_monotone'[OF monotone] by (auto intro!: mult_left_mono)
   2.505          also have "\<dots> \<le> (Float 1 1 * ?ub_horner ?DIV)" unfolding Float_num
   2.506 -          using arctan_0_1_bounds_round[OF \<open>0 \<le> real ?DIV\<close> \<open>real ?DIV \<le> 1\<close>]
   2.507 +          using arctan_0_1_bounds_round[OF \<open>0 \<le> real_of_float ?DIV\<close> \<open>real_of_float ?DIV \<le> 1\<close>]
   2.508            by (auto intro!: float_round_up_le)
   2.509          finally show ?thesis
   2.510            unfolding ub_arctan.simps Let_def if_not_P[OF \<open>\<not> x < 0\<close>]
   2.511 @@ -919,27 +909,27 @@
   2.512        qed
   2.513      next
   2.514        case False
   2.515 -      hence "2 < real x" by auto
   2.516 -      hence "1 \<le> real x" by auto
   2.517 -      hence "0 < real x" by auto
   2.518 +      hence "2 < real_of_float x" by auto
   2.519 +      hence "1 \<le> real_of_float x" by auto
   2.520 +      hence "0 < real_of_float x" by auto
   2.521        hence "0 < x" by auto
   2.522  
   2.523        let "?invx" = "float_divl prec 1 x"
   2.524        have "0 \<le> arctan x"
   2.525 -        using arctan_monotone'[OF \<open>0 \<le> real x\<close>] and arctan_tan[of 0, unfolded tan_zero] by auto
   2.526 -
   2.527 -      have "real ?invx \<le> 1"
   2.528 +        using arctan_monotone'[OF \<open>0 \<le> real_of_float x\<close>] and arctan_tan[of 0, unfolded tan_zero] by auto
   2.529 +
   2.530 +      have "real_of_float ?invx \<le> 1"
   2.531          unfolding less_float_def
   2.532          by (rule order_trans[OF float_divl])
   2.533 -          (auto simp add: \<open>1 \<le> real x\<close> divide_le_eq_1_pos[OF \<open>0 < real x\<close>])
   2.534 -      have "0 \<le> real ?invx"
   2.535 +          (auto simp add: \<open>1 \<le> real_of_float x\<close> divide_le_eq_1_pos[OF \<open>0 < real_of_float x\<close>])
   2.536 +      have "0 \<le> real_of_float ?invx"
   2.537          using \<open>0 < x\<close> by (intro float_divl_lower_bound) auto
   2.538  
   2.539        have "1 / x \<noteq> 0" and "0 < 1 / x"
   2.540 -        using \<open>0 < real x\<close> by auto
   2.541 +        using \<open>0 < real_of_float x\<close> by auto
   2.542  
   2.543        have "(?lb_horner ?invx) \<le> arctan (?invx)"
   2.544 -        using arctan_0_1_bounds_round[OF \<open>0 \<le> real ?invx\<close> \<open>real ?invx \<le> 1\<close>]
   2.545 +        using arctan_0_1_bounds_round[OF \<open>0 \<le> real_of_float ?invx\<close> \<open>real_of_float ?invx \<le> 1\<close>]
   2.546          by (auto intro!: float_round_down_le)
   2.547        also have "\<dots> \<le> arctan (1 / x)"
   2.548          unfolding one_float.rep_eq[symmetric] by (rule arctan_monotone') (rule float_divl)
   2.549 @@ -962,17 +952,17 @@
   2.550  lemma arctan_boundaries: "arctan x \<in> {(lb_arctan prec x) .. (ub_arctan prec x)}"
   2.551  proof (cases "0 \<le> x")
   2.552    case True
   2.553 -  hence "0 \<le> real x" by auto
   2.554 +  hence "0 \<le> real_of_float x" by auto
   2.555    show ?thesis
   2.556 -    using ub_arctan_bound'[OF \<open>0 \<le> real x\<close>] lb_arctan_bound'[OF \<open>0 \<le> real x\<close>]
   2.557 +    using ub_arctan_bound'[OF \<open>0 \<le> real_of_float x\<close>] lb_arctan_bound'[OF \<open>0 \<le> real_of_float x\<close>]
   2.558      unfolding atLeastAtMost_iff by auto
   2.559  next
   2.560    case False
   2.561    let ?mx = "-x"
   2.562 -  from False have "x < 0" and "0 \<le> real ?mx"
   2.563 +  from False have "x < 0" and "0 \<le> real_of_float ?mx"
   2.564      by auto
   2.565    hence bounds: "lb_arctan prec ?mx \<le> arctan ?mx \<and> arctan ?mx \<le> ub_arctan prec ?mx"
   2.566 -    using ub_arctan_bound'[OF \<open>0 \<le> real ?mx\<close>] lb_arctan_bound'[OF \<open>0 \<le> real ?mx\<close>] by auto
   2.567 +    using ub_arctan_bound'[OF \<open>0 \<le> real_of_float ?mx\<close>] lb_arctan_bound'[OF \<open>0 \<le> real_of_float ?mx\<close>] by auto
   2.568    show ?thesis
   2.569      unfolding minus_float.rep_eq arctan_minus lb_arctan.simps[where x=x]
   2.570        ub_arctan.simps[where x=x] Let_def if_P[OF \<open>x < 0\<close>]
   2.571 @@ -1027,7 +1017,7 @@
   2.572    shows "(lb_sin_cos_aux prec n 1 1 (x * x)) \<le> (\<Sum> i=0..<n. (- 1) ^ i * (1/(fact (2 * i))) * x ^(2 * i))" (is "?lb")
   2.573    and "(\<Sum> i=0..<n. (- 1) ^ i * (1/(fact (2 * i))) * x^(2 * i)) \<le> (ub_sin_cos_aux prec n 1 1 (x * x))" (is "?ub")
   2.574  proof -
   2.575 -  have "0 \<le> real (x * x)" by auto
   2.576 +  have "0 \<le> real_of_float (x * x)" by auto
   2.577    let "?f n" = "fact (2 * n) :: nat"
   2.578    have f_eq: "?f (Suc n) = ?f n * ((\<lambda>i. i + 2) ^^ n) 1 * (((\<lambda>i. i + 2) ^^ n) 1 + 1)" for n
   2.579    proof -
   2.580 @@ -1035,9 +1025,9 @@
   2.581      then show ?thesis by auto
   2.582    qed
   2.583    from horner_bounds[where lb="lb_sin_cos_aux prec" and ub="ub_sin_cos_aux prec" and j'=0,
   2.584 -    OF \<open>0 \<le> real (x * x)\<close> f_eq lb_sin_cos_aux.simps ub_sin_cos_aux.simps]
   2.585 +    OF \<open>0 \<le> real_of_float (x * x)\<close> f_eq lb_sin_cos_aux.simps ub_sin_cos_aux.simps]
   2.586    show ?lb and ?ub
   2.587 -    by (auto simp add: power_mult power2_eq_square[of "real x"])
   2.588 +    by (auto simp add: power_mult power2_eq_square[of "real_of_float x"])
   2.589  qed
   2.590  
   2.591  lemma lb_sin_cos_aux_zero_le_one: "lb_sin_cos_aux prec n i j 0 \<le> 1"
   2.592 @@ -1048,13 +1038,13 @@
   2.593    by (cases n) (auto intro!: float_plus_up_le order_trans[OF _ rapprox_rat])
   2.594  
   2.595  lemma cos_boundaries:
   2.596 -  assumes "0 \<le> real x" and "x \<le> pi / 2"
   2.597 +  assumes "0 \<le> real_of_float x" and "x \<le> pi / 2"
   2.598    shows "cos x \<in> {(lb_sin_cos_aux prec (get_even n) 1 1 (x * x)) .. (ub_sin_cos_aux prec (get_odd n) 1 1 (x * x))}"
   2.599 -proof (cases "real x = 0")
   2.600 +proof (cases "real_of_float x = 0")
   2.601    case False
   2.602 -  hence "real x \<noteq> 0" by auto
   2.603 -  hence "0 < x" and "0 < real x"
   2.604 -    using \<open>0 \<le> real x\<close> by auto
   2.605 +  hence "real_of_float x \<noteq> 0" by auto
   2.606 +  hence "0 < x" and "0 < real_of_float x"
   2.607 +    using \<open>0 \<le> real_of_float x\<close> by auto
   2.608    have "0 < x * x"
   2.609      using \<open>0 < x\<close> by simp
   2.610  
   2.611 @@ -1074,11 +1064,11 @@
   2.612  
   2.613    { fix n :: nat assume "0 < n"
   2.614      hence "0 < 2 * n" by auto
   2.615 -    obtain t where "0 < t" and "t < real x" and
   2.616 -      cos_eq: "cos x = (\<Sum> i = 0 ..< 2 * n. (if even(i) then ((- 1) ^ (i div 2))/((fact i)) else 0) * (real x) ^ i)
   2.617 -      + (cos (t + 1/2 * (2 * n) * pi) / (fact (2*n))) * (real x)^(2*n)"
   2.618 +    obtain t where "0 < t" and "t < real_of_float x" and
   2.619 +      cos_eq: "cos x = (\<Sum> i = 0 ..< 2 * n. (if even(i) then ((- 1) ^ (i div 2))/((fact i)) else 0) * (real_of_float x) ^ i)
   2.620 +      + (cos (t + 1/2 * (2 * n) * pi) / (fact (2*n))) * (real_of_float x)^(2*n)"
   2.621        (is "_ = ?SUM + ?rest / ?fact * ?pow")
   2.622 -      using Maclaurin_cos_expansion2[OF \<open>0 < real x\<close> \<open>0 < 2 * n\<close>]
   2.623 +      using Maclaurin_cos_expansion2[OF \<open>0 < real_of_float x\<close> \<open>0 < 2 * n\<close>]
   2.624        unfolding cos_coeff_def atLeast0LessThan by auto
   2.625  
   2.626      have "cos t * (- 1) ^ n = cos t * cos (n * pi) + sin t * sin (n * pi)" by auto
   2.627 @@ -1086,12 +1076,12 @@
   2.628      also have "\<dots> = ?rest" by auto
   2.629      finally have "cos t * (- 1) ^ n = ?rest" .
   2.630      moreover
   2.631 -    have "t \<le> pi / 2" using \<open>t < real x\<close> and \<open>x \<le> pi / 2\<close> by auto
   2.632 +    have "t \<le> pi / 2" using \<open>t < real_of_float x\<close> and \<open>x \<le> pi / 2\<close> by auto
   2.633      hence "0 \<le> cos t" using \<open>0 < t\<close> and cos_ge_zero by auto
   2.634      ultimately have even: "even n \<Longrightarrow> 0 \<le> ?rest" and odd: "odd n \<Longrightarrow> 0 \<le> - ?rest " by auto
   2.635  
   2.636      have "0 < ?fact" by auto
   2.637 -    have "0 < ?pow" using \<open>0 < real x\<close> by auto
   2.638 +    have "0 < ?pow" using \<open>0 < real_of_float x\<close> by auto
   2.639  
   2.640      {
   2.641        assume "even n"
   2.642 @@ -1131,7 +1121,7 @@
   2.643      case False
   2.644      hence "get_even n = 0" by auto
   2.645      have "- (pi / 2) \<le> x"
   2.646 -      by (rule order_trans[OF _ \<open>0 < real x\<close>[THEN less_imp_le]]) auto
   2.647 +      by (rule order_trans[OF _ \<open>0 < real_of_float x\<close>[THEN less_imp_le]]) auto
   2.648      with \<open>x \<le> pi / 2\<close> show ?thesis
   2.649        unfolding \<open>get_even n = 0\<close> lb_sin_cos_aux.simps minus_float.rep_eq zero_float.rep_eq
   2.650        using cos_ge_zero by auto
   2.651 @@ -1147,13 +1137,13 @@
   2.652  qed
   2.653  
   2.654  lemma sin_aux:
   2.655 -  assumes "0 \<le> real x"
   2.656 +  assumes "0 \<le> real_of_float x"
   2.657    shows "(x * lb_sin_cos_aux prec n 2 1 (x * x)) \<le>
   2.658        (\<Sum> i=0..<n. (- 1) ^ i * (1/(fact (2 * i + 1))) * x^(2 * i + 1))" (is "?lb")
   2.659      and "(\<Sum> i=0..<n. (- 1) ^ i * (1/(fact (2 * i + 1))) * x^(2 * i + 1)) \<le>
   2.660        (x * ub_sin_cos_aux prec n 2 1 (x * x))" (is "?ub")
   2.661  proof -
   2.662 -  have "0 \<le> real (x * x)" by auto
   2.663 +  have "0 \<le> real_of_float (x * x)" by auto
   2.664    let "?f n" = "fact (2 * n + 1) :: nat"
   2.665    have f_eq: "?f (Suc n) = ?f n * ((\<lambda>i. i + 2) ^^ n) 2 * (((\<lambda>i. i + 2) ^^ n) 2 + 1)" for n
   2.666    proof -
   2.667 @@ -1162,22 +1152,22 @@
   2.668        unfolding F by auto
   2.669    qed
   2.670    from horner_bounds[where lb="lb_sin_cos_aux prec" and ub="ub_sin_cos_aux prec" and j'=0,
   2.671 -    OF \<open>0 \<le> real (x * x)\<close> f_eq lb_sin_cos_aux.simps ub_sin_cos_aux.simps]
   2.672 -  show "?lb" and "?ub" using \<open>0 \<le> real x\<close>
   2.673 +    OF \<open>0 \<le> real_of_float (x * x)\<close> f_eq lb_sin_cos_aux.simps ub_sin_cos_aux.simps]
   2.674 +  show "?lb" and "?ub" using \<open>0 \<le> real_of_float x\<close>
   2.675      unfolding power_add power_one_right mult.assoc[symmetric] setsum_left_distrib[symmetric]
   2.676 -    unfolding mult.commute[where 'a=real] real_fact_nat
   2.677 -    by (auto intro!: mult_left_mono simp add: power_mult power2_eq_square[of "real x"])
   2.678 +    unfolding mult.commute[where 'a=real] of_nat_fact
   2.679 +    by (auto intro!: mult_left_mono simp add: power_mult power2_eq_square[of "real_of_float x"])
   2.680  qed
   2.681  
   2.682  lemma sin_boundaries:
   2.683 -  assumes "0 \<le> real x"
   2.684 +  assumes "0 \<le> real_of_float x"
   2.685      and "x \<le> pi / 2"
   2.686    shows "sin x \<in> {(x * lb_sin_cos_aux prec (get_even n) 2 1 (x * x)) .. (x * ub_sin_cos_aux prec (get_odd n) 2 1 (x * x))}"
   2.687 -proof (cases "real x = 0")
   2.688 +proof (cases "real_of_float x = 0")
   2.689    case False
   2.690 -  hence "real x \<noteq> 0" by auto
   2.691 -  hence "0 < x" and "0 < real x"
   2.692 -    using \<open>0 \<le> real x\<close> by auto
   2.693 +  hence "real_of_float x \<noteq> 0" by auto
   2.694 +  hence "0 < x" and "0 < real_of_float x"
   2.695 +    using \<open>0 \<le> real_of_float x\<close> by auto
   2.696    have "0 < x * x"
   2.697      using \<open>0 < x\<close> by simp
   2.698  
   2.699 @@ -1198,18 +1188,18 @@
   2.700  
   2.701    { fix n :: nat assume "0 < n"
   2.702      hence "0 < 2 * n + 1" by auto
   2.703 -    obtain t where "0 < t" and "t < real x" and
   2.704 -      sin_eq: "sin x = (\<Sum> i = 0 ..< 2 * n + 1. (if even(i) then 0 else ((- 1) ^ ((i - Suc 0) div 2))/((fact i))) * (real x) ^ i)
   2.705 -      + (sin (t + 1/2 * (2 * n + 1) * pi) / (fact (2*n + 1))) * (real x)^(2*n + 1)"
   2.706 +    obtain t where "0 < t" and "t < real_of_float x" and
   2.707 +      sin_eq: "sin x = (\<Sum> i = 0 ..< 2 * n + 1. (if even(i) then 0 else ((- 1) ^ ((i - Suc 0) div 2))/((fact i))) * (real_of_float x) ^ i)
   2.708 +      + (sin (t + 1/2 * (2 * n + 1) * pi) / (fact (2*n + 1))) * (real_of_float x)^(2*n + 1)"
   2.709        (is "_ = ?SUM + ?rest / ?fact * ?pow")
   2.710 -      using Maclaurin_sin_expansion3[OF \<open>0 < 2 * n + 1\<close> \<open>0 < real x\<close>]
   2.711 +      using Maclaurin_sin_expansion3[OF \<open>0 < 2 * n + 1\<close> \<open>0 < real_of_float x\<close>]
   2.712        unfolding sin_coeff_def atLeast0LessThan by auto
   2.713  
   2.714      have "?rest = cos t * (- 1) ^ n"
   2.715 -      unfolding sin_add cos_add real_of_nat_add distrib_right distrib_left by auto
   2.716 +      unfolding sin_add cos_add of_nat_add distrib_right distrib_left by auto
   2.717      moreover
   2.718      have "t \<le> pi / 2"
   2.719 -      using \<open>t < real x\<close> and \<open>x \<le> pi / 2\<close> by auto
   2.720 +      using \<open>t < real_of_float x\<close> and \<open>x \<le> pi / 2\<close> by auto
   2.721      hence "0 \<le> cos t"
   2.722        using \<open>0 < t\<close> and cos_ge_zero by auto
   2.723      ultimately have even: "even n \<Longrightarrow> 0 \<le> ?rest" and odd: "odd n \<Longrightarrow> 0 \<le> - ?rest"
   2.724 @@ -1218,13 +1208,13 @@
   2.725      have "0 < ?fact"
   2.726        by (simp del: fact_Suc)
   2.727      have "0 < ?pow"
   2.728 -      using \<open>0 < real x\<close> by (rule zero_less_power)
   2.729 +      using \<open>0 < real_of_float x\<close> by (rule zero_less_power)
   2.730  
   2.731      {
   2.732        assume "even n"
   2.733        have "(x * lb_sin_cos_aux prec n 2 1 (x * x)) \<le>
   2.734 -            (\<Sum> i = 0 ..< 2 * n. (if even(i) then 0 else ((- 1) ^ ((i - Suc 0) div 2))/((fact i))) * (real x) ^ i)"
   2.735 -        using sin_aux[OF \<open>0 \<le> real x\<close>] unfolding setsum_morph[symmetric] by auto
   2.736 +            (\<Sum> i = 0 ..< 2 * n. (if even(i) then 0 else ((- 1) ^ ((i - Suc 0) div 2))/((fact i))) * (real_of_float x) ^ i)"
   2.737 +        using sin_aux[OF \<open>0 \<le> real_of_float x\<close>] unfolding setsum_morph[symmetric] by auto
   2.738        also have "\<dots> \<le> ?SUM" by auto
   2.739        also have "\<dots> \<le> sin x"
   2.740        proof -
   2.741 @@ -1244,10 +1234,10 @@
   2.742            by (metis mult_nonneg_nonneg divide_nonneg_pos less_imp_le)
   2.743          thus ?thesis unfolding sin_eq by auto
   2.744        qed
   2.745 -      also have "\<dots> \<le> (\<Sum> i = 0 ..< 2 * n. (if even(i) then 0 else ((- 1) ^ ((i - Suc 0) div 2))/((fact i))) * (real x) ^ i)"
   2.746 +      also have "\<dots> \<le> (\<Sum> i = 0 ..< 2 * n. (if even(i) then 0 else ((- 1) ^ ((i - Suc 0) div 2))/((fact i))) * (real_of_float x) ^ i)"
   2.747           by auto
   2.748        also have "\<dots> \<le> (x * ub_sin_cos_aux prec n 2 1 (x * x))"
   2.749 -        using sin_aux[OF \<open>0 \<le> real x\<close>] unfolding setsum_morph[symmetric] by auto
   2.750 +        using sin_aux[OF \<open>0 \<le> real_of_float x\<close>] unfolding setsum_morph[symmetric] by auto
   2.751        finally have "sin x \<le> (x * ub_sin_cos_aux prec n 2 1 (x * x))" .
   2.752      } note ub = this and lb
   2.753    } note ub = this(1) and lb = this(2)
   2.754 @@ -1262,7 +1252,7 @@
   2.755    next
   2.756      case False
   2.757      hence "get_even n = 0" by auto
   2.758 -    with \<open>x \<le> pi / 2\<close> \<open>0 \<le> real x\<close>
   2.759 +    with \<open>x \<le> pi / 2\<close> \<open>0 \<le> real_of_float x\<close>
   2.760      show ?thesis
   2.761        unfolding \<open>get_even n = 0\<close> ub_sin_cos_aux.simps minus_float.rep_eq
   2.762        using sin_ge_zero by auto
   2.763 @@ -1275,13 +1265,13 @@
   2.764      case True
   2.765      thus ?thesis
   2.766        unfolding \<open>n = 0\<close> get_even_def get_odd_def
   2.767 -      using \<open>real x = 0\<close> lapprox_rat[where x="-1" and y=1] by auto
   2.768 +      using \<open>real_of_float x = 0\<close> lapprox_rat[where x="-1" and y=1] by auto
   2.769    next
   2.770      case False
   2.771      with not0_implies_Suc obtain m where "n = Suc m" by blast
   2.772      thus ?thesis
   2.773        unfolding \<open>n = Suc m\<close> get_even_def get_odd_def
   2.774 -      using \<open>real x = 0\<close> rapprox_rat[where x=1 and y=1] lapprox_rat[where x=1 and y=1]
   2.775 +      using \<open>real_of_float x = 0\<close> rapprox_rat[where x=1 and y=1] lapprox_rat[where x=1 and y=1]
   2.776        by (cases "even (Suc m)") auto
   2.777    qed
   2.778  qed
   2.779 @@ -1306,7 +1296,7 @@
   2.780                         else half (half (horner (x * Float 1 (- 2)))))"
   2.781  
   2.782  lemma lb_cos:
   2.783 -  assumes "0 \<le> real x" and "x \<le> pi"
   2.784 +  assumes "0 \<le> real_of_float x" and "x \<le> pi"
   2.785    shows "cos x \<in> {(lb_cos prec x) .. (ub_cos prec x)}" (is "?cos x \<in> {(?lb x) .. (?ub x) }")
   2.786  proof -
   2.787    have x_half[symmetric]: "cos x = 2 * cos (x / 2) * cos (x / 2) - 1" for x :: real
   2.788 @@ -1320,7 +1310,7 @@
   2.789      finally show ?thesis .
   2.790    qed
   2.791  
   2.792 -  have "\<not> x < 0" using \<open>0 \<le> real x\<close> by auto
   2.793 +  have "\<not> x < 0" using \<open>0 \<le> real_of_float x\<close> by auto
   2.794    let "?ub_horner x" = "ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * x)"
   2.795    let "?lb_horner x" = "lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * x)"
   2.796    let "?ub_half x" = "float_plus_up prec (Float 1 1 * x * x) (- 1)"
   2.797 @@ -1334,7 +1324,7 @@
   2.798      show ?thesis
   2.799        unfolding lb_cos_def[where x=x] ub_cos_def[where x=x]
   2.800          if_not_P[OF \<open>\<not> x < 0\<close>] if_P[OF \<open>x < Float 1 (- 1)\<close>] Let_def
   2.801 -      using cos_boundaries[OF \<open>0 \<le> real x\<close> \<open>x \<le> pi / 2\<close>] .
   2.802 +      using cos_boundaries[OF \<open>0 \<le> real_of_float x\<close> \<open>x \<le> pi / 2\<close>] .
   2.803    next
   2.804      case False
   2.805      { fix y x :: float let ?x2 = "(x * Float 1 (- 1))"
   2.806 @@ -1351,12 +1341,12 @@
   2.807            using cos_ge_minus_one unfolding if_P[OF True] by auto
   2.808        next
   2.809          case False
   2.810 -        hence "0 \<le> real y" by auto
   2.811 +        hence "0 \<le> real_of_float y" by auto
   2.812          from mult_mono[OF \<open>y \<le> cos ?x2\<close> \<open>y \<le> cos ?x2\<close> \<open>0 \<le> cos ?x2\<close> this]
   2.813 -        have "real y * real y \<le> cos ?x2 * cos ?x2" .
   2.814 -        hence "2 * real y * real y \<le> 2 * cos ?x2 * cos ?x2"
   2.815 +        have "real_of_float y * real_of_float y \<le> cos ?x2 * cos ?x2" .
   2.816 +        hence "2 * real_of_float y * real_of_float y \<le> 2 * cos ?x2 * cos ?x2"
   2.817            by auto
   2.818 -        hence "2 * real y * real y - 1 \<le> 2 * cos (x / 2) * cos (x / 2) - 1"
   2.819 +        hence "2 * real_of_float y * real_of_float y - 1 \<le> 2 * cos (x / 2) * cos (x / 2) - 1"
   2.820            unfolding Float_num by auto
   2.821          thus ?thesis
   2.822            unfolding if_not_P[OF False] x_half Float_num
   2.823 @@ -1372,13 +1362,13 @@
   2.824  
   2.825        have "cos x \<le> (?ub_half y)"
   2.826        proof -
   2.827 -        have "0 \<le> real y"
   2.828 +        have "0 \<le> real_of_float y"
   2.829            using \<open>0 \<le> cos ?x2\<close> ub by (rule order_trans)
   2.830          from mult_mono[OF ub ub this \<open>0 \<le> cos ?x2\<close>]
   2.831 -        have "cos ?x2 * cos ?x2 \<le> real y * real y" .
   2.832 -        hence "2 * cos ?x2 * cos ?x2 \<le> 2 * real y * real y"
   2.833 +        have "cos ?x2 * cos ?x2 \<le> real_of_float y * real_of_float y" .
   2.834 +        hence "2 * cos ?x2 * cos ?x2 \<le> 2 * real_of_float y * real_of_float y"
   2.835            by auto
   2.836 -        hence "2 * cos (x / 2) * cos (x / 2) - 1 \<le> 2 * real y * real y - 1"
   2.837 +        hence "2 * cos (x / 2) * cos (x / 2) - 1 \<le> 2 * real_of_float y * real_of_float y - 1"
   2.838            unfolding Float_num by auto
   2.839          thus ?thesis
   2.840            unfolding x_half Float_num
   2.841 @@ -1390,15 +1380,15 @@
   2.842      let ?x4 = "x * Float 1 (- 1) * Float 1 (- 1)"
   2.843  
   2.844      have "-pi \<le> x"
   2.845 -      using pi_ge_zero[THEN le_imp_neg_le, unfolded minus_zero] \<open>0 \<le> real x\<close>
   2.846 +      using pi_ge_zero[THEN le_imp_neg_le, unfolded minus_zero] \<open>0 \<le> real_of_float x\<close>
   2.847        by (rule order_trans)
   2.848  
   2.849      show ?thesis
   2.850      proof (cases "x < 1")
   2.851        case True
   2.852 -      hence "real x \<le> 1" by auto
   2.853 -      have "0 \<le> real ?x2" and "?x2 \<le> pi / 2"
   2.854 -        using pi_ge_two \<open>0 \<le> real x\<close> using assms by auto
   2.855 +      hence "real_of_float x \<le> 1" by auto
   2.856 +      have "0 \<le> real_of_float ?x2" and "?x2 \<le> pi / 2"
   2.857 +        using pi_ge_two \<open>0 \<le> real_of_float x\<close> using assms by auto
   2.858        from cos_boundaries[OF this]
   2.859        have lb: "(?lb_horner ?x2) \<le> ?cos ?x2" and ub: "?cos ?x2 \<le> (?ub_horner ?x2)"
   2.860          by auto
   2.861 @@ -1420,8 +1410,8 @@
   2.862        ultimately show ?thesis by auto
   2.863      next
   2.864        case False
   2.865 -      have "0 \<le> real ?x4" and "?x4 \<le> pi / 2"
   2.866 -        using pi_ge_two \<open>0 \<le> real x\<close> \<open>x \<le> pi\<close> unfolding Float_num by auto
   2.867 +      have "0 \<le> real_of_float ?x4" and "?x4 \<le> pi / 2"
   2.868 +        using pi_ge_two \<open>0 \<le> real_of_float x\<close> \<open>x \<le> pi\<close> unfolding Float_num by auto
   2.869        from cos_boundaries[OF this]
   2.870        have lb: "(?lb_horner ?x4) \<le> ?cos ?x4" and ub: "?cos ?x4 \<le> (?ub_horner ?x4)"
   2.871          by auto
   2.872 @@ -1432,7 +1422,7 @@
   2.873        have "(?lb x) \<le> ?cos x"
   2.874        proof -
   2.875          have "-pi \<le> ?x2" and "?x2 \<le> pi"
   2.876 -          using pi_ge_two \<open>0 \<le> real x\<close> \<open>x \<le> pi\<close> by auto
   2.877 +          using pi_ge_two \<open>0 \<le> real_of_float x\<close> \<open>x \<le> pi\<close> by auto
   2.878          from lb_half[OF lb_half[OF lb this] \<open>-pi \<le> x\<close> \<open>x \<le> pi\<close>, unfolded eq_4]
   2.879          show ?thesis
   2.880            unfolding lb_cos_def[where x=x] if_not_P[OF \<open>\<not> x < 0\<close>]
   2.881 @@ -1441,7 +1431,7 @@
   2.882        moreover have "?cos x \<le> (?ub x)"
   2.883        proof -
   2.884          have "-pi \<le> ?x2" and "?x2 \<le> pi"
   2.885 -          using pi_ge_two \<open>0 \<le> real x\<close> \<open> x \<le> pi\<close> by auto
   2.886 +          using pi_ge_two \<open>0 \<le> real_of_float x\<close> \<open> x \<le> pi\<close> by auto
   2.887          from ub_half[OF ub_half[OF ub this] \<open>-pi \<le> x\<close> \<open>x \<le> pi\<close>, unfolded eq_4]
   2.888          show ?thesis
   2.889            unfolding ub_cos_def[where x=x] if_not_P[OF \<open>\<not> x < 0\<close>]
   2.890 @@ -1454,11 +1444,11 @@
   2.891  
   2.892  lemma lb_cos_minus:
   2.893    assumes "-pi \<le> x"
   2.894 -    and "real x \<le> 0"
   2.895 -  shows "cos (real(-x)) \<in> {(lb_cos prec (-x)) .. (ub_cos prec (-x))}"
   2.896 +    and "real_of_float x \<le> 0"
   2.897 +  shows "cos (real_of_float(-x)) \<in> {(lb_cos prec (-x)) .. (ub_cos prec (-x))}"
   2.898  proof -
   2.899 -  have "0 \<le> real (-x)" and "(-x) \<le> pi"
   2.900 -    using \<open>-pi \<le> x\<close> \<open>real x \<le> 0\<close> by auto
   2.901 +  have "0 \<le> real_of_float (-x)" and "(-x) \<le> pi"
   2.902 +    using \<open>-pi \<le> x\<close> \<open>real_of_float x \<le> 0\<close> by auto
   2.903    from lb_cos[OF this] show ?thesis .
   2.904  qed
   2.905  
   2.906 @@ -1476,7 +1466,7 @@
   2.907    else if -2 * lpi \<le> lx \<and> ux \<le> 0 then (Float (- 1) 0, max (ub_cos prec (lx + 2 * lpi)) (ub_cos prec (-ux)))
   2.908                                   else (Float (- 1) 0, Float 1 0))"
   2.909  
   2.910 -lemma floor_int: obtains k :: int where "real k = (floor_fl f)"
   2.911 +lemma floor_int: obtains k :: int where "real_of_int k = (floor_fl f)"
   2.912    by (simp add: floor_fl_def)
   2.913  
   2.914  lemma cos_periodic_nat[simp]:
   2.915 @@ -1488,7 +1478,7 @@
   2.916  next
   2.917    case (Suc n)
   2.918    have split_pi_off: "x + (Suc n) * (2 * pi) = (x + n * (2 * pi)) + 2 * pi"
   2.919 -    unfolding Suc_eq_plus1 real_of_nat_add real_of_one distrib_right by auto
   2.920 +    unfolding Suc_eq_plus1 of_nat_add of_int_1 distrib_right by auto
   2.921    show ?case
   2.922      unfolding split_pi_off using Suc by auto
   2.923  qed
   2.924 @@ -1498,7 +1488,7 @@
   2.925    shows "cos (x + i * (2 * pi)) = cos x"
   2.926  proof (cases "0 \<le> i")
   2.927    case True
   2.928 -  hence i_nat: "real i = nat i" by auto
   2.929 +  hence i_nat: "real_of_int i = nat i" by auto
   2.930    show ?thesis
   2.931      unfolding i_nat by auto
   2.932  next
   2.933 @@ -1526,7 +1516,7 @@
   2.934    let ?lx = "float_plus_down prec lx ?lx2"
   2.935    let ?ux = "float_plus_up prec ux ?ux2"
   2.936  
   2.937 -  obtain k :: int where k: "k = real ?k"
   2.938 +  obtain k :: int where k: "k = real_of_float ?k"
   2.939      by (rule floor_int)
   2.940  
   2.941    have upi: "pi \<le> ?upi" and lpi: "?lpi \<le> pi"
   2.942 @@ -1542,18 +1532,18 @@
   2.943    hence "?lx \<le> x - k * (2 * pi) \<and> x - k * (2 * pi) \<le> ?ux"
   2.944      by (auto intro!: float_plus_down_le float_plus_up_le)
   2.945    note lx = this[THEN conjunct1] and ux = this[THEN conjunct2]
   2.946 -  hence lx_less_ux: "?lx \<le> real ?ux" by (rule order_trans)
   2.947 +  hence lx_less_ux: "?lx \<le> real_of_float ?ux" by (rule order_trans)
   2.948  
   2.949    { assume "- ?lpi \<le> ?lx" and x_le_0: "x - k * (2 * pi) \<le> 0"
   2.950      with lpi[THEN le_imp_neg_le] lx
   2.951 -    have pi_lx: "- pi \<le> ?lx" and lx_0: "real ?lx \<le> 0"
   2.952 +    have pi_lx: "- pi \<le> ?lx" and lx_0: "real_of_float ?lx \<le> 0"
   2.953        by simp_all
   2.954  
   2.955 -    have "(lb_cos prec (- ?lx)) \<le> cos (real (- ?lx))"
   2.956 +    have "(lb_cos prec (- ?lx)) \<le> cos (real_of_float (- ?lx))"
   2.957        using lb_cos_minus[OF pi_lx lx_0] by simp
   2.958      also have "\<dots> \<le> cos (x + (-k) * (2 * pi))"
   2.959        using cos_monotone_minus_pi_0'[OF pi_lx lx x_le_0]
   2.960 -      by (simp only: uminus_float.rep_eq real_of_int_minus
   2.961 +      by (simp only: uminus_float.rep_eq of_int_minus
   2.962          cos_minus mult_minus_left) simp
   2.963      finally have "(lb_cos prec (- ?lx)) \<le> cos x"
   2.964        unfolding cos_periodic_int . }
   2.965 @@ -1561,12 +1551,12 @@
   2.966  
   2.967    { assume "0 \<le> ?lx" and pi_x: "x - k * (2 * pi) \<le> pi"
   2.968      with lx
   2.969 -    have pi_lx: "?lx \<le> pi" and lx_0: "0 \<le> real ?lx"
   2.970 +    have pi_lx: "?lx \<le> pi" and lx_0: "0 \<le> real_of_float ?lx"
   2.971        by auto
   2.972  
   2.973      have "cos (x + (-k) * (2 * pi)) \<le> cos ?lx"
   2.974        using cos_monotone_0_pi_le[OF lx_0 lx pi_x]
   2.975 -      by (simp only: real_of_int_minus
   2.976 +      by (simp only: of_int_minus
   2.977          cos_minus mult_minus_left) simp
   2.978      also have "\<dots> \<le> (ub_cos prec ?lx)"
   2.979        using lb_cos[OF lx_0 pi_lx] by simp
   2.980 @@ -1576,12 +1566,12 @@
   2.981  
   2.982    { assume pi_x: "- pi \<le> x - k * (2 * pi)" and "?ux \<le> 0"
   2.983      with ux
   2.984 -    have pi_ux: "- pi \<le> ?ux" and ux_0: "real ?ux \<le> 0"
   2.985 +    have pi_ux: "- pi \<le> ?ux" and ux_0: "real_of_float ?ux \<le> 0"
   2.986        by simp_all
   2.987  
   2.988 -    have "cos (x + (-k) * (2 * pi)) \<le> cos (real (- ?ux))"
   2.989 +    have "cos (x + (-k) * (2 * pi)) \<le> cos (real_of_float (- ?ux))"
   2.990        using cos_monotone_minus_pi_0'[OF pi_x ux ux_0]
   2.991 -      by (simp only: uminus_float.rep_eq real_of_int_minus
   2.992 +      by (simp only: uminus_float.rep_eq of_int_minus
   2.993            cos_minus mult_minus_left) simp
   2.994      also have "\<dots> \<le> (ub_cos prec (- ?ux))"
   2.995        using lb_cos_minus[OF pi_ux ux_0, of prec] by simp
   2.996 @@ -1591,14 +1581,14 @@
   2.997  
   2.998    { assume "?ux \<le> ?lpi" and x_ge_0: "0 \<le> x - k * (2 * pi)"
   2.999      with lpi ux
  2.1000 -    have pi_ux: "?ux \<le> pi" and ux_0: "0 \<le> real ?ux"
  2.1001 +    have pi_ux: "?ux \<le> pi" and ux_0: "0 \<le> real_of_float ?ux"
  2.1002        by simp_all
  2.1003  
  2.1004      have "(lb_cos prec ?ux) \<le> cos ?ux"
  2.1005        using lb_cos[OF ux_0 pi_ux] by simp
  2.1006      also have "\<dots> \<le> cos (x + (-k) * (2 * pi))"
  2.1007        using cos_monotone_0_pi_le[OF x_ge_0 ux pi_ux]
  2.1008 -      by (simp only: real_of_int_minus
  2.1009 +      by (simp only: of_int_minus
  2.1010          cos_minus mult_minus_left) simp
  2.1011      finally have "(lb_cos prec ?ux) \<le> cos x"
  2.1012        unfolding cos_periodic_int . }
  2.1013 @@ -1648,7 +1638,7 @@
  2.1014              and u: "u = max (ub_cos prec ?lx) (ub_cos prec (- (?ux - 2 * ?lpi)))"
  2.1015              by (auto simp add: bnds_cos_def Let_def)
  2.1016  
  2.1017 -          have "cos x \<le> real u"
  2.1018 +          have "cos x \<le> real_of_float u"
  2.1019            proof (cases "x - k * (2 * pi) < pi")
  2.1020              case True
  2.1021              hence "x - k * (2 * pi) \<le> pi" by simp
  2.1022 @@ -1664,7 +1654,7 @@
  2.1023              hence "x - k * (2 * pi) - 2 * pi \<le> 0"
  2.1024                using ux by simp
  2.1025  
  2.1026 -            have ux_0: "real (?ux - 2 * ?lpi) \<le> 0"
  2.1027 +            have ux_0: "real_of_float (?ux - 2 * ?lpi) \<le> 0"
  2.1028                using Cond by auto
  2.1029  
  2.1030              from 2 and Cond have "\<not> ?ux \<le> ?lpi" by auto
  2.1031 @@ -1678,7 +1668,7 @@
  2.1032                unfolding cos_periodic_int ..
  2.1033              also have "\<dots> \<le> cos ((?ux - 2 * ?lpi))"
  2.1034                using cos_monotone_minus_pi_0'[OF pi_x x_le_ux ux_0]
  2.1035 -              by (simp only: minus_float.rep_eq real_of_int_minus real_of_one
  2.1036 +              by (simp only: minus_float.rep_eq of_int_minus of_int_1
  2.1037                  mult_minus_left mult_1_left) simp
  2.1038              also have "\<dots> = cos ((- (?ux - 2 * ?lpi)))"
  2.1039                unfolding uminus_float.rep_eq cos_minus ..
  2.1040 @@ -1711,7 +1701,7 @@
  2.1041  
  2.1042                hence "0 \<le> x - k * (2 * pi) + 2 * pi" using lx by simp
  2.1043  
  2.1044 -              have lx_0: "0 \<le> real (?lx + 2 * ?lpi)"
  2.1045 +              have lx_0: "0 \<le> real_of_float (?lx + 2 * ?lpi)"
  2.1046                  using Cond lpi by auto
  2.1047  
  2.1048                from 1 and Cond have "\<not> -?lpi \<le> ?lx" by auto
  2.1049 @@ -1726,7 +1716,7 @@
  2.1050                  unfolding cos_periodic_int ..
  2.1051                also have "\<dots> \<le> cos ((?lx + 2 * ?lpi))"
  2.1052                  using cos_monotone_0_pi_le[OF lx_0 lx_le_x pi_x]
  2.1053 -                by (simp only: minus_float.rep_eq real_of_int_minus real_of_one
  2.1054 +                by (simp only: minus_float.rep_eq of_int_minus of_int_1
  2.1055                    mult_minus_left mult_1_left) simp
  2.1056                also have "\<dots> \<le> (ub_cos prec (?lx + 2 * ?lpi))"
  2.1057                  using lb_cos[OF lx_0 pi_lx] by simp
  2.1058 @@ -1760,7 +1750,7 @@
  2.1059      (lapprox_rat prec 1 (int k)) (float_round_down prec (x * ub_exp_horner prec n (i + 1) (k * i) x))"
  2.1060  
  2.1061  lemma bnds_exp_horner:
  2.1062 -  assumes "real x \<le> 0"
  2.1063 +  assumes "real_of_float x \<le> 0"
  2.1064    shows "exp x \<in> {lb_exp_horner prec (get_even n) 1 1 x .. ub_exp_horner prec (get_odd n) 1 1 x}"
  2.1065  proof -
  2.1066    have f_eq: "fact (Suc n) = fact n * ((\<lambda>i::nat. i + 1) ^^ n) 1" for n
  2.1067 @@ -1776,13 +1766,13 @@
  2.1068  
  2.1069    have "lb_exp_horner prec (get_even n) 1 1 x \<le> exp x"
  2.1070    proof -
  2.1071 -    have "lb_exp_horner prec (get_even n) 1 1 x \<le> (\<Sum>j = 0..<get_even n. 1 / (fact j) * real x ^ j)"
  2.1072 +    have "lb_exp_horner prec (get_even n) 1 1 x \<le> (\<Sum>j = 0..<get_even n. 1 / (fact j) * real_of_float x ^ j)"
  2.1073        using bounds(1) by auto
  2.1074      also have "\<dots> \<le> exp x"
  2.1075      proof -
  2.1076 -      obtain t where "\<bar>t\<bar> \<le> \<bar>real x\<bar>" and "exp x = (\<Sum>m = 0..<get_even n. real x ^ m / (fact m)) + exp t / (fact (get_even n)) * (real x) ^ (get_even n)"
  2.1077 +      obtain t where "\<bar>t\<bar> \<le> \<bar>real_of_float x\<bar>" and "exp x = (\<Sum>m = 0..<get_even n. real_of_float x ^ m / (fact m)) + exp t / (fact (get_even n)) * (real_of_float x) ^ (get_even n)"
  2.1078          using Maclaurin_exp_le unfolding atLeast0LessThan by blast
  2.1079 -      moreover have "0 \<le> exp t / (fact (get_even n)) * (real x) ^ (get_even n)"
  2.1080 +      moreover have "0 \<le> exp t / (fact (get_even n)) * (real_of_float x) ^ (get_even n)"
  2.1081          by (auto simp: zero_le_even_power)
  2.1082        ultimately show ?thesis using get_odd exp_gt_zero by auto
  2.1083      qed
  2.1084 @@ -1791,21 +1781,21 @@
  2.1085    moreover
  2.1086    have "exp x \<le> ub_exp_horner prec (get_odd n) 1 1 x"
  2.1087    proof -
  2.1088 -    have x_less_zero: "real x ^ get_odd n \<le> 0"
  2.1089 -    proof (cases "real x = 0")
  2.1090 +    have x_less_zero: "real_of_float x ^ get_odd n \<le> 0"
  2.1091 +    proof (cases "real_of_float x = 0")
  2.1092        case True
  2.1093        have "(get_odd n) \<noteq> 0" using get_odd[THEN odd_pos] by auto
  2.1094        thus ?thesis unfolding True power_0_left by auto
  2.1095      next
  2.1096 -      case False hence "real x < 0" using \<open>real x \<le> 0\<close> by auto
  2.1097 -      show ?thesis by (rule less_imp_le, auto simp add: power_less_zero_eq \<open>real x < 0\<close>)
  2.1098 +      case False hence "real_of_float x < 0" using \<open>real_of_float x \<le> 0\<close> by auto
  2.1099 +      show ?thesis by (rule less_imp_le, auto simp add: power_less_zero_eq \<open>real_of_float x < 0\<close>)
  2.1100      qed
  2.1101 -    obtain t where "\<bar>t\<bar> \<le> \<bar>real x\<bar>"
  2.1102 -      and "exp x = (\<Sum>m = 0..<get_odd n. (real x) ^ m / (fact m)) + exp t / (fact (get_odd n)) * (real x) ^ (get_odd n)"
  2.1103 +    obtain t where "\<bar>t\<bar> \<le> \<bar>real_of_float x\<bar>"
  2.1104 +      and "exp x = (\<Sum>m = 0..<get_odd n. (real_of_float x) ^ m / (fact m)) + exp t / (fact (get_odd n)) * (real_of_float x) ^ (get_odd n)"
  2.1105        using Maclaurin_exp_le unfolding atLeast0LessThan by blast
  2.1106 -    moreover have "exp t / (fact (get_odd n)) * (real x) ^ (get_odd n) \<le> 0"
  2.1107 +    moreover have "exp t / (fact (get_odd n)) * (real_of_float x) ^ (get_odd n) \<le> 0"
  2.1108        by (auto intro!: mult_nonneg_nonpos divide_nonpos_pos simp add: x_less_zero)
  2.1109 -    ultimately have "exp x \<le> (\<Sum>j = 0..<get_odd n. 1 / (fact j) * real x ^ j)"
  2.1110 +    ultimately have "exp x \<le> (\<Sum>j = 0..<get_odd n. 1 / (fact j) * real_of_float x ^ j)"
  2.1111        using get_odd exp_gt_zero by auto
  2.1112      also have "\<dots> \<le> ub_exp_horner prec (get_odd n) 1 1 x"
  2.1113        using bounds(2) by auto
  2.1114 @@ -1814,8 +1804,8 @@
  2.1115    ultimately show ?thesis by auto
  2.1116  qed
  2.1117  
  2.1118 -lemma ub_exp_horner_nonneg: "real x \<le> 0 \<Longrightarrow>
  2.1119 -  0 \<le> real (ub_exp_horner prec (get_odd n) (Suc 0) (Suc 0) x)"
  2.1120 +lemma ub_exp_horner_nonneg: "real_of_float x \<le> 0 \<Longrightarrow>
  2.1121 +  0 \<le> real_of_float (ub_exp_horner prec (get_odd n) (Suc 0) (Suc 0) x)"
  2.1122    using bnds_exp_horner[of x prec n]
  2.1123    by (intro order_trans[OF exp_ge_zero]) auto
  2.1124  
  2.1125 @@ -1850,7 +1840,7 @@
  2.1126    have "1 / 4 = (Float 1 (- 2))"
  2.1127      unfolding Float_num by auto
  2.1128    also have "\<dots> \<le> lb_exp_horner 3 (get_even 3) 1 1 (- 1)"
  2.1129 -    by code_simp
  2.1130 +    by (subst less_eq_float.rep_eq [symmetric]) code_simp
  2.1131    also have "\<dots> \<le> exp (- 1 :: float)"
  2.1132      using bnds_exp_horner[where x="- 1"] by auto
  2.1133    finally show ?thesis
  2.1134 @@ -1865,9 +1855,9 @@
  2.1135    let "?horner x" = "let y = ?lb_horner x in if y \<le> 0 then Float 1 (- 2) else y"
  2.1136    have pos_horner: "0 < ?horner x" for x
  2.1137      unfolding Let_def by (cases "?lb_horner x \<le> 0") auto
  2.1138 -  moreover have "0 < real ((?horner x) ^ num)" for x :: float and num :: nat
  2.1139 +  moreover have "0 < real_of_float ((?horner x) ^ num)" for x :: float and num :: nat
  2.1140    proof -
  2.1141 -    have "0 < real (?horner x) ^ num" using \<open>0 < ?horner x\<close> by simp
  2.1142 +    have "0 < real_of_float (?horner x) ^ num" using \<open>0 < ?horner x\<close> by simp
  2.1143      also have "\<dots> = (?horner x) ^ num" by auto
  2.1144      finally show ?thesis .
  2.1145    qed
  2.1146 @@ -1884,35 +1874,35 @@
  2.1147    let "?lb_exp_horner x" = "lb_exp_horner prec (get_even (prec + 2)) 1 1 x"
  2.1148    let "?ub_exp_horner x" = "ub_exp_horner prec (get_odd (prec + 2)) 1 1 x"
  2.1149  
  2.1150 -  have "real x \<le> 0" and "\<not> x > 0"
  2.1151 +  have "real_of_float x \<le> 0" and "\<not> x > 0"
  2.1152      using \<open>x \<le> 0\<close> by auto
  2.1153    show ?thesis
  2.1154    proof (cases "x < - 1")
  2.1155      case False
  2.1156 -    hence "- 1 \<le> real x" by auto
  2.1157 +    hence "- 1 \<le> real_of_float x" by auto
  2.1158      show ?thesis
  2.1159      proof (cases "?lb_exp_horner x \<le> 0")
  2.1160        case True
  2.1161        from \<open>\<not> x < - 1\<close>
  2.1162 -      have "- 1 \<le> real x" by auto
  2.1163 +      have "- 1 \<le> real_of_float x" by auto
  2.1164        hence "exp (- 1) \<le> exp x"
  2.1165          unfolding exp_le_cancel_iff .
  2.1166        from order_trans[OF exp_m1_ge_quarter this] have "Float 1 (- 2) \<le> exp x"
  2.1167          unfolding Float_num .
  2.1168        with True show ?thesis
  2.1169 -        using bnds_exp_horner \<open>real x \<le> 0\<close> \<open>\<not> x > 0\<close> \<open>\<not> x < - 1\<close> by auto
  2.1170 +        using bnds_exp_horner \<open>real_of_float x \<le> 0\<close> \<open>\<not> x > 0\<close> \<open>\<not> x < - 1\<close> by auto
  2.1171      next
  2.1172        case False
  2.1173        thus ?thesis
  2.1174 -        using bnds_exp_horner \<open>real x \<le> 0\<close> \<open>\<not> x > 0\<close> \<open>\<not> x < - 1\<close> by (auto simp add: Let_def)
  2.1175 +        using bnds_exp_horner \<open>real_of_float x \<le> 0\<close> \<open>\<not> x > 0\<close> \<open>\<not> x < - 1\<close> by (auto simp add: Let_def)
  2.1176      qed
  2.1177    next
  2.1178      case True
  2.1179      let ?num = "nat (- int_floor_fl x)"
  2.1180  
  2.1181 -    have "real (int_floor_fl x) < - 1"
  2.1182 +    have "real_of_int (int_floor_fl x) < - 1"
  2.1183        using int_floor_fl[of x] \<open>x < - 1\<close> by simp
  2.1184 -    hence "real (int_floor_fl x) < 0" by simp
  2.1185 +    hence "real_of_int (int_floor_fl x) < 0" by simp
  2.1186      hence "int_floor_fl x < 0" by auto
  2.1187      hence "1 \<le> - int_floor_fl x" by auto
  2.1188      hence "0 < nat (- int_floor_fl x)" by auto
  2.1189 @@ -1921,19 +1911,19 @@
  2.1190      have num_eq: "real ?num = - int_floor_fl x"
  2.1191        using \<open>0 < nat (- int_floor_fl x)\<close> by auto
  2.1192      have "0 < - int_floor_fl x"
  2.1193 -      using \<open>0 < ?num\<close>[unfolded real_of_nat_less_iff[symmetric]] by simp
  2.1194 -    hence "real (int_floor_fl x) < 0"
  2.1195 +      using \<open>0 < ?num\<close>[unfolded of_nat_less_iff[symmetric]] by simp
  2.1196 +    hence "real_of_int (int_floor_fl x) < 0"
  2.1197        unfolding less_float_def by auto
  2.1198 -    have fl_eq: "real (- int_floor_fl x) = real (- floor_fl x)"
  2.1199 +    have fl_eq: "real_of_int (- int_floor_fl x) = real_of_float (- floor_fl x)"
  2.1200        by (simp add: floor_fl_def int_floor_fl_def)
  2.1201 -    from \<open>0 < - int_floor_fl x\<close> have "0 \<le> real (- floor_fl x)"
  2.1202 +    from \<open>0 < - int_floor_fl x\<close> have "0 \<le> real_of_float (- floor_fl x)"
  2.1203        by (simp add: floor_fl_def int_floor_fl_def)
  2.1204 -    from \<open>real (int_floor_fl x) < 0\<close> have "real (floor_fl x) < 0"
  2.1205 +    from \<open>real_of_int (int_floor_fl x) < 0\<close> have "real_of_float (floor_fl x) < 0"
  2.1206        by (simp add: floor_fl_def int_floor_fl_def)
  2.1207      have "exp x \<le> ub_exp prec x"
  2.1208      proof -
  2.1209 -      have div_less_zero: "real (float_divr prec x (- floor_fl x)) \<le> 0"
  2.1210 -        using float_divr_nonpos_pos_upper_bound[OF \<open>real x \<le> 0\<close> \<open>0 \<le> real (- floor_fl x)\<close>]
  2.1211 +      have div_less_zero: "real_of_float (float_divr prec x (- floor_fl x)) \<le> 0"
  2.1212 +        using float_divr_nonpos_pos_upper_bound[OF \<open>real_of_float x \<le> 0\<close> \<open>0 \<le> real_of_float (- floor_fl x)\<close>]
  2.1213          unfolding less_eq_float_def zero_float.rep_eq .
  2.1214  
  2.1215        have "exp x = exp (?num * (x / ?num))"
  2.1216 @@ -1946,7 +1936,7 @@
  2.1217        also have "\<dots> \<le> (?ub_exp_horner (float_divr prec x (- floor_fl x))) ^ ?num"
  2.1218          unfolding real_of_float_power
  2.1219          by (rule power_mono, rule bnds_exp_horner[OF div_less_zero, unfolded atLeastAtMost_iff, THEN conjunct2], auto)
  2.1220 -      also have "\<dots> \<le> real (power_up_fl prec (?ub_exp_horner (float_divr prec x (- floor_fl x))) ?num)"
  2.1221 +      also have "\<dots> \<le> real_of_float (power_up_fl prec (?ub_exp_horner (float_divr prec x (- floor_fl x))) ?num)"
  2.1222          by (auto simp add: real_power_up_fl intro!: power_up ub_exp_horner_nonneg div_less_zero)
  2.1223        finally show ?thesis
  2.1224          unfolding ub_exp.simps if_not_P[OF \<open>\<not> 0 < x\<close>] if_P[OF \<open>x < - 1\<close>] floor_fl_def Let_def .
  2.1225 @@ -1960,15 +1950,15 @@
  2.1226        show ?thesis
  2.1227        proof (cases "?horner \<le> 0")
  2.1228          case False
  2.1229 -        hence "0 \<le> real ?horner" by auto
  2.1230 -
  2.1231 -        have div_less_zero: "real (float_divl prec x (- floor_fl x)) \<le> 0"
  2.1232 -          using \<open>real (floor_fl x) < 0\<close> \<open>real x \<le> 0\<close>
  2.1233 +        hence "0 \<le> real_of_float ?horner" by auto
  2.1234 +
  2.1235 +        have div_less_zero: "real_of_float (float_divl prec x (- floor_fl x)) \<le> 0"
  2.1236 +          using \<open>real_of_float (floor_fl x) < 0\<close> \<open>real_of_float x \<le> 0\<close>
  2.1237            by (auto intro!: order_trans[OF float_divl] divide_nonpos_neg)
  2.1238  
  2.1239          have "(?lb_exp_horner (float_divl prec x (- floor_fl x))) ^ ?num \<le>
  2.1240            exp (float_divl prec x (- floor_fl x)) ^ ?num"
  2.1241 -          using \<open>0 \<le> real ?horner\<close>[unfolded floor_fl_def[symmetric]]
  2.1242 +          using \<open>0 \<le> real_of_float ?horner\<close>[unfolded floor_fl_def[symmetric]]
  2.1243              bnds_exp_horner[OF div_less_zero, unfolded atLeastAtMost_iff, THEN conjunct1]
  2.1244            by (auto intro!: power_mono)
  2.1245          also have "\<dots> \<le> exp (x / ?num) ^ ?num"
  2.1246 @@ -1988,22 +1978,22 @@
  2.1247          have "power_down_fl prec (Float 1 (- 2))  ?num \<le> (Float 1 (- 2)) ^ ?num"
  2.1248            by (metis Float_le_zero_iff less_imp_le linorder_not_less
  2.1249              not_numeral_le_zero numeral_One power_down_fl)
  2.1250 -        then have "power_down_fl prec (Float 1 (- 2))  ?num \<le> real (Float 1 (- 2)) ^ ?num"
  2.1251 +        then have "power_down_fl prec (Float 1 (- 2))  ?num \<le> real_of_float (Float 1 (- 2)) ^ ?num"
  2.1252            by simp
  2.1253          also
  2.1254 -        have "real (floor_fl x) \<noteq> 0" and "real (floor_fl x) \<le> 0"
  2.1255 -          using \<open>real (floor_fl x) < 0\<close> by auto
  2.1256 -        from divide_right_mono_neg[OF floor_fl[of x] \<open>real (floor_fl x) \<le> 0\<close>, unfolded divide_self[OF \<open>real (floor_fl x) \<noteq> 0\<close>]]
  2.1257 +        have "real_of_float (floor_fl x) \<noteq> 0" and "real_of_float (floor_fl x) \<le> 0"
  2.1258 +          using \<open>real_of_float (floor_fl x) < 0\<close> by auto
  2.1259 +        from divide_right_mono_neg[OF floor_fl[of x] \<open>real_of_float (floor_fl x) \<le> 0\<close>, unfolded divide_self[OF \<open>real_of_float (floor_fl x) \<noteq> 0\<close>]]
  2.1260          have "- 1 \<le> x / (- floor_fl x)"
  2.1261            unfolding minus_float.rep_eq by auto
  2.1262          from order_trans[OF exp_m1_ge_quarter this[unfolded exp_le_cancel_iff[where x="- 1", symmetric]]]
  2.1263          have "Float 1 (- 2) \<le> exp (x / (- floor_fl x))"
  2.1264            unfolding Float_num .
  2.1265 -        hence "real (Float 1 (- 2)) ^ ?num \<le> exp (x / (- floor_fl x)) ^ ?num"
  2.1266 +        hence "real_of_float (Float 1 (- 2)) ^ ?num \<le> exp (x / (- floor_fl x)) ^ ?num"
  2.1267            by (metis Float_num(5) power_mono zero_le_divide_1_iff zero_le_numeral)
  2.1268          also have "\<dots> = exp x"
  2.1269            unfolding num_eq fl_eq exp_real_of_nat_mult[symmetric]
  2.1270 -          using \<open>real (floor_fl x) \<noteq> 0\<close> by auto
  2.1271 +          using \<open>real_of_float (floor_fl x) \<noteq> 0\<close> by auto
  2.1272          finally show ?thesis
  2.1273            unfolding lb_exp.simps if_not_P[OF \<open>\<not> 0 < x\<close>] if_P[OF \<open>x < - 1\<close>]
  2.1274              int_floor_fl_def Let_def if_P[OF True] real_of_float_power .
  2.1275 @@ -2027,7 +2017,7 @@
  2.1276      have "lb_exp prec x \<le> exp x"
  2.1277      proof -
  2.1278        from exp_boundaries'[OF \<open>-x \<le> 0\<close>]
  2.1279 -      have ub_exp: "exp (- real x) \<le> ub_exp prec (-x)"
  2.1280 +      have ub_exp: "exp (- real_of_float x) \<le> ub_exp prec (-x)"
  2.1281          unfolding atLeastAtMost_iff minus_float.rep_eq by auto
  2.1282  
  2.1283        have "float_divl prec 1 (ub_exp prec (-x)) \<le> 1 / ub_exp prec (-x)"
  2.1284 @@ -2046,7 +2036,7 @@
  2.1285        have "\<not> 0 < -x" using \<open>0 < x\<close> by auto
  2.1286  
  2.1287        from exp_boundaries'[OF \<open>-x \<le> 0\<close>]
  2.1288 -      have lb_exp: "lb_exp prec (-x) \<le> exp (- real x)"
  2.1289 +      have lb_exp: "lb_exp prec (-x) \<le> exp (- real_of_float x)"
  2.1290          unfolding atLeastAtMost_iff minus_float.rep_eq by auto
  2.1291  
  2.1292        have "exp x \<le> (1 :: float) / lb_exp prec (-x)"
  2.1293 @@ -2133,33 +2123,37 @@
  2.1294  qed
  2.1295  
  2.1296  lemma ln_float_bounds:
  2.1297 -  assumes "0 \<le> real x"
  2.1298 -    and "real x < 1"
  2.1299 +  assumes "0 \<le> real_of_float x"
  2.1300 +    and "real_of_float x < 1"
  2.1301    shows "x * lb_ln_horner prec (get_even n) 1 x \<le> ln (x + 1)" (is "?lb \<le> ?ln")
  2.1302      and "ln (x + 1) \<le> x * ub_ln_horner prec (get_odd n) 1 x" (is "?ln \<le> ?ub")
  2.1303  proof -
  2.1304    obtain ev where ev: "get_even n = 2 * ev" using get_even_double ..
  2.1305    obtain od where od: "get_odd n = 2 * od + 1" using get_odd_double ..
  2.1306  
  2.1307 -  let "?s n" = "(- 1) ^ n * (1 / real (1 + n)) * (real x)^(Suc n)"
  2.1308 +  let "?s n" = "(- 1) ^ n * (1 / real (1 + n)) * (real_of_float x)^(Suc n)"
  2.1309  
  2.1310    have "?lb \<le> setsum ?s {0 ..< 2 * ev}"
  2.1311      unfolding power_Suc2 mult.assoc[symmetric] times_float.rep_eq setsum_left_distrib[symmetric]
  2.1312 -    unfolding mult.commute[of "real x"] ev
  2.1313 -    using horner_bounds(1)[where G="\<lambda> i k. Suc k" and F="\<lambda>x. x" and f="\<lambda>x. x" and lb="\<lambda>n i k x. lb_ln_horner prec n k x" and ub="\<lambda>n i k x. ub_ln_horner prec n k x" and j'=1 and n="2*ev",
  2.1314 -      OF \<open>0 \<le> real x\<close> refl lb_ln_horner.simps ub_ln_horner.simps] \<open>0 \<le> real x\<close>
  2.1315 +    unfolding mult.commute[of "real_of_float x"] ev 
  2.1316 +    using horner_bounds(1)[where G="\<lambda> i k. Suc k" and F="\<lambda>x. x" and f="\<lambda>x. x" 
  2.1317 +                    and lb="\<lambda>n i k x. lb_ln_horner prec n k x" 
  2.1318 +                    and ub="\<lambda>n i k x. ub_ln_horner prec n k x" and j'=1 and n="2*ev",
  2.1319 +      OF \<open>0 \<le> real_of_float x\<close> refl lb_ln_horner.simps ub_ln_horner.simps] \<open>0 \<le> real_of_float x\<close>
  2.1320 +    unfolding real_of_float_power
  2.1321      by (rule mult_right_mono)
  2.1322    also have "\<dots> \<le> ?ln"
  2.1323 -    using ln_bounds(1)[OF \<open>0 \<le> real x\<close> \<open>real x < 1\<close>] by auto
  2.1324 +    using ln_bounds(1)[OF \<open>0 \<le> real_of_float x\<close> \<open>real_of_float x < 1\<close>] by auto
  2.1325    finally show "?lb \<le> ?ln" .
  2.1326  
  2.1327    have "?ln \<le> setsum ?s {0 ..< 2 * od + 1}"
  2.1328 -    using ln_bounds(2)[OF \<open>0 \<le> real x\<close> \<open>real x < 1\<close>] by auto
  2.1329 +    using ln_bounds(2)[OF \<open>0 \<le> real_of_float x\<close> \<open>real_of_float x < 1\<close>] by auto
  2.1330    also have "\<dots> \<le> ?ub"
  2.1331      unfolding power_Suc2 mult.assoc[symmetric] times_float.rep_eq setsum_left_distrib[symmetric]
  2.1332 -    unfolding mult.commute[of "real x"] od
  2.1333 +    unfolding mult.commute[of "real_of_float x"] od
  2.1334      using horner_bounds(2)[where G="\<lambda> i k. Suc k" and F="\<lambda>x. x" and f="\<lambda>x. x" and lb="\<lambda>n i k x. lb_ln_horner prec n k x" and ub="\<lambda>n i k x. ub_ln_horner prec n k x" and j'=1 and n="2*od+1",
  2.1335 -      OF \<open>0 \<le> real x\<close> refl lb_ln_horner.simps ub_ln_horner.simps] \<open>0 \<le> real x\<close>
  2.1336 +      OF \<open>0 \<le> real_of_float x\<close> refl lb_ln_horner.simps ub_ln_horner.simps] \<open>0 \<le> real_of_float x\<close>
  2.1337 +    unfolding real_of_float_power
  2.1338      by (rule mult_right_mono)
  2.1339    finally show "?ln \<le> ?ub" .
  2.1340  qed
  2.1341 @@ -2201,26 +2195,26 @@
  2.1342    have ln2_sum: "ln 2 = ln (1/2 + 1) + ln (1 / 3 + 1::real)"
  2.1343      using ln_add[of "3 / 2" "1 / 2"] by auto
  2.1344    have lb3: "?lthird \<le> 1 / 3" using lapprox_rat[of prec 1 3] by auto
  2.1345 -  hence lb3_ub: "real ?lthird < 1" by auto
  2.1346 -  have lb3_lb: "0 \<le> real ?lthird" using lapprox_rat_nonneg[of 1 3] by auto
  2.1347 +  hence lb3_ub: "real_of_float ?lthird < 1" by auto
  2.1348 +  have lb3_lb: "0 \<le> real_of_float ?lthird" using lapprox_rat_nonneg[of 1 3] by auto
  2.1349    have ub3: "1 / 3 \<le> ?uthird" using rapprox_rat[of 1 3] by auto
  2.1350 -  hence ub3_lb: "0 \<le> real ?uthird" by auto
  2.1351 -
  2.1352 -  have lb2: "0 \<le> real (Float 1 (- 1))" and ub2: "real (Float 1 (- 1)) < 1"
  2.1353 +  hence ub3_lb: "0 \<le> real_of_float ?uthird" by auto
  2.1354 +
  2.1355 +  have lb2: "0 \<le> real_of_float (Float 1 (- 1))" and ub2: "real_of_float (Float 1 (- 1)) < 1"
  2.1356      unfolding Float_num by auto
  2.1357  
  2.1358    have "0 \<le> (1::int)" and "0 < (3::int)" by auto
  2.1359 -  have ub3_ub: "real ?uthird < 1"
  2.1360 +  have ub3_ub: "real_of_float ?uthird < 1"
  2.1361      by (simp add: Float.compute_rapprox_rat Float.compute_lapprox_rat rapprox_posrat_less1)
  2.1362  
  2.1363    have third_gt0: "(0 :: real) < 1 / 3 + 1" by auto
  2.1364 -  have uthird_gt0: "0 < real ?uthird + 1" using ub3_lb by auto
  2.1365 -  have lthird_gt0: "0 < real ?lthird + 1" using lb3_lb by auto
  2.1366 +  have uthird_gt0: "0 < real_of_float ?uthird + 1" using ub3_lb by auto
  2.1367 +  have lthird_gt0: "0 < real_of_float ?lthird + 1" using lb3_lb by auto
  2.1368  
  2.1369    show ?ub_ln2
  2.1370      unfolding ub_ln2_def Let_def ln2_sum Float_num(4)[symmetric]
  2.1371    proof (rule float_plus_up_le, rule add_mono, fact ln_float_bounds(2)[OF lb2 ub2])
  2.1372 -    have "ln (1 / 3 + 1) \<le> ln (real ?uthird + 1)"
  2.1373 +    have "ln (1 / 3 + 1) \<le> ln (real_of_float ?uthird + 1)"
  2.1374        unfolding ln_le_cancel_iff[OF third_gt0 uthird_gt0] using ub3 by auto
  2.1375      also have "\<dots> \<le> ?uthird * ub_ln_horner prec (get_odd prec) 1 ?uthird"
  2.1376        using ln_float_bounds(2)[OF ub3_lb ub3_ub] .
  2.1377 @@ -2230,7 +2224,7 @@
  2.1378    show ?lb_ln2
  2.1379      unfolding lb_ln2_def Let_def ln2_sum Float_num(4)[symmetric]
  2.1380    proof (rule float_plus_down_le, rule add_mono, fact ln_float_bounds(1)[OF lb2 ub2])
  2.1381 -    have "?lthird * lb_ln_horner prec (get_even prec) 1 ?lthird \<le> ln (real ?lthird + 1)"
  2.1382 +    have "?lthird * lb_ln_horner prec (get_even prec) 1 ?lthird \<le> ln (real_of_float ?lthird + 1)"
  2.1383        using ln_float_bounds(1)[OF lb3_lb lb3_ub] .
  2.1384      note float_round_down_le[OF this]
  2.1385      also have "\<dots> \<le> ln (1 / 3 + 1)"
  2.1386 @@ -2265,18 +2259,18 @@
  2.1387  termination
  2.1388  proof (relation "measure (\<lambda> v. let (prec, x) = case_sum id id v in (if x < 1 then 1 else 0))", auto)
  2.1389    fix prec and x :: float
  2.1390 -  assume "\<not> real x \<le> 0" and "real x < 1" and "real (float_divl (max prec (Suc 0)) 1 x) < 1"
  2.1391 -  hence "0 < real x" "1 \<le> max prec (Suc 0)" "real x < 1"
  2.1392 +  assume "\<not> real_of_float x \<le> 0" and "real_of_float x < 1" and "real_of_float (float_divl (max prec (Suc 0)) 1 x) < 1"
  2.1393 +  hence "0 < real_of_float x" "1 \<le> max prec (Suc 0)" "real_of_float x < 1"
  2.1394      by auto
  2.1395 -  from float_divl_pos_less1_bound[OF \<open>0 < real x\<close> \<open>real x < 1\<close>[THEN less_imp_le] \<open>1 \<le> max prec (Suc 0)\<close>]
  2.1396 +  from float_divl_pos_less1_bound[OF \<open>0 < real_of_float x\<close> \<open>real_of_float x < 1\<close>[THEN less_imp_le] \<open>1 \<le> max prec (Suc 0)\<close>]
  2.1397    show False
  2.1398 -    using \<open>real (float_divl (max prec (Suc 0)) 1 x) < 1\<close> by auto
  2.1399 +    using \<open>real_of_float (float_divl (max prec (Suc 0)) 1 x) < 1\<close> by auto
  2.1400  next
  2.1401    fix prec x
  2.1402 -  assume "\<not> real x \<le> 0" and "real x < 1" and "real (float_divr prec 1 x) < 1"
  2.1403 +  assume "\<not> real_of_float x \<le> 0" and "real_of_float x < 1" and "real_of_float (float_divr prec 1 x) < 1"
  2.1404    hence "0 < x" by auto
  2.1405 -  from float_divr_pos_less1_lower_bound[OF \<open>0 < x\<close>, of prec] \<open>real x < 1\<close> show False
  2.1406 -    using \<open>real (float_divr prec 1 x) < 1\<close> by auto
  2.1407 +  from float_divr_pos_less1_lower_bound[OF \<open>0 < x\<close>, of prec] \<open>real_of_float x < 1\<close> show False
  2.1408 +    using \<open>real_of_float (float_divr prec 1 x) < 1\<close> by auto
  2.1409  qed
  2.1410  
  2.1411  lemma float_pos_eq_mantissa_pos: "x > 0 \<longleftrightarrow> mantissa x > 0"
  2.1412 @@ -2305,11 +2299,11 @@
  2.1413      unfolding zero_float_def[symmetric] using \<open>0 < x\<close> by auto
  2.1414    from denormalize_shift[OF assms(1) this] guess i . note i = this
  2.1415  
  2.1416 -  have "2 powr (1 - (real (bitlen (mantissa x)) + real i)) =
  2.1417 -    2 powr (1 - (real (bitlen (mantissa x)))) * inverse (2 powr (real i))"
  2.1418 +  have "2 powr (1 - (real_of_int (bitlen (mantissa x)) + real_of_int i)) =
  2.1419 +    2 powr (1 - (real_of_int (bitlen (mantissa x)))) * inverse (2 powr (real i))"
  2.1420      by (simp add: powr_minus[symmetric] powr_add[symmetric] field_simps)
  2.1421 -  hence "real (mantissa x) * 2 powr (1 - real (bitlen (mantissa x))) =
  2.1422 -    (real (mantissa x) * 2 ^ i) * 2 powr (1 - real (bitlen (mantissa x * 2 ^ i)))"
  2.1423 +  hence "real_of_int (mantissa x) * 2 powr (1 - real_of_int (bitlen (mantissa x))) =
  2.1424 +    (real_of_int (mantissa x) * 2 ^ i) * 2 powr (1 - real_of_int (bitlen (mantissa x * 2 ^ i)))"
  2.1425      using \<open>mantissa x > 0\<close> by (simp add: powr_realpow)
  2.1426    then show ?th2
  2.1427      unfolding i by transfer auto
  2.1428 @@ -2350,14 +2344,14 @@
  2.1429  proof -
  2.1430    let ?B = "2^nat (bitlen m - 1)"
  2.1431    def bl \<equiv> "bitlen m - 1"
  2.1432 -  have "0 < real m" and "\<And>X. (0 :: real) < 2^X" and "0 < (2 :: real)" and "m \<noteq> 0"
  2.1433 +  have "0 < real_of_int m" and "\<And>X. (0 :: real) < 2^X" and "0 < (2 :: real)" and "m \<noteq> 0"
  2.1434      using assms by auto
  2.1435    hence "0 \<le> bl" by (simp add: bitlen_def bl_def)
  2.1436    show ?thesis
  2.1437    proof (cases "0 \<le> e")
  2.1438      case True
  2.1439      thus ?thesis
  2.1440 -      unfolding bl_def[symmetric] using \<open>0 < real m\<close> \<open>0 \<le> bl\<close>
  2.1441 +      unfolding bl_def[symmetric] using \<open>0 < real_of_int m\<close> \<open>0 \<le> bl\<close>
  2.1442        apply (simp add: ln_mult)
  2.1443        apply (cases "e=0")
  2.1444          apply (cases "bl = 0", simp_all add: powr_minus ln_inverse ln_powr)
  2.1445 @@ -2366,7 +2360,7 @@
  2.1446    next
  2.1447      case False
  2.1448      hence "0 < -e" by auto
  2.1449 -    have lne: "ln (2 powr real e) = ln (inverse (2 powr - e))"
  2.1450 +    have lne: "ln (2 powr real_of_int e) = ln (inverse (2 powr - e))"
  2.1451        by (simp add: powr_minus)
  2.1452      hence pow_gt0: "(0::real) < 2^nat (-e)"
  2.1453        by auto
  2.1454 @@ -2374,7 +2368,7 @@
  2.1455        by auto
  2.1456      show ?thesis
  2.1457        using False unfolding bl_def[symmetric]
  2.1458 -      using \<open>0 < real m\<close> \<open>0 \<le> bl\<close>
  2.1459 +      using \<open>0 < real_of_int m\<close> \<open>0 \<le> bl\<close>
  2.1460        by (auto simp add: lne ln_mult ln_powr ln_div field_simps)
  2.1461    qed
  2.1462  qed
  2.1463 @@ -2385,9 +2379,9 @@
  2.1464      (is "?lb \<le> ?ln \<and> ?ln \<le> ?ub")
  2.1465  proof (cases "x < Float 1 1")
  2.1466    case True
  2.1467 -  hence "real (x - 1) < 1" and "real x < 2" by auto
  2.1468 +  hence "real_of_float (x - 1) < 1" and "real_of_float x < 2" by auto
  2.1469    have "\<not> x \<le> 0" and "\<not> x < 1" using \<open>1 \<le> x\<close> by auto
  2.1470 -  hence "0 \<le> real (x - 1)" using \<open>1 \<le> x\<close> by auto
  2.1471 +  hence "0 \<le> real_of_float (x - 1)" using \<open>1 \<le> x\<close> by auto
  2.1472  
  2.1473    have [simp]: "(Float 3 (- 1)) = 3 / 2" by simp
  2.1474  
  2.1475 @@ -2397,7 +2391,7 @@
  2.1476      show ?thesis
  2.1477        unfolding lb_ln.simps
  2.1478        unfolding ub_ln.simps Let_def
  2.1479 -      using ln_float_bounds[OF \<open>0 \<le> real (x - 1)\<close> \<open>real (x - 1) < 1\<close>, of prec]
  2.1480 +      using ln_float_bounds[OF \<open>0 \<le> real_of_float (x - 1)\<close> \<open>real_of_float (x - 1) < 1\<close>, of prec]
  2.1481          \<open>\<not> x \<le> 0\<close> \<open>\<not> x < 1\<close> True
  2.1482        by (auto intro!: float_round_down_le float_round_up_le)
  2.1483    next
  2.1484 @@ -2405,32 +2399,32 @@
  2.1485      hence *: "3 / 2 < x" by auto
  2.1486  
  2.1487      with ln_add[of "3 / 2" "x - 3 / 2"]
  2.1488 -    have add: "ln x = ln (3 / 2) + ln (real x * 2 / 3)"
  2.1489 +    have add: "ln x = ln (3 / 2) + ln (real_of_float x * 2 / 3)"
  2.1490        by (auto simp add: algebra_simps diff_divide_distrib)
  2.1491  
  2.1492      let "?ub_horner x" = "float_round_up prec (x * ub_ln_horner prec (get_odd prec) 1 x)"
  2.1493      let "?lb_horner x" = "float_round_down prec (x * lb_ln_horner prec (get_even prec) 1 x)"
  2.1494  
  2.1495 -    { have up: "real (rapprox_rat prec 2 3) \<le> 1"
  2.1496 +    { have up: "real_of_float (rapprox_rat prec 2 3) \<le> 1"
  2.1497          by (rule rapprox_rat_le1) simp_all
  2.1498        have low: "2 / 3 \<le> rapprox_rat prec 2 3"
  2.1499          by (rule order_trans[OF _ rapprox_rat]) simp
  2.1500        from mult_less_le_imp_less[OF * low] *
  2.1501 -      have pos: "0 < real (x * rapprox_rat prec 2 3 - 1)" by auto
  2.1502 -
  2.1503 -      have "ln (real x * 2/3)
  2.1504 -        \<le> ln (real (x * rapprox_rat prec 2 3 - 1) + 1)"
  2.1505 +      have pos: "0 < real_of_float (x * rapprox_rat prec 2 3 - 1)" by auto
  2.1506 +
  2.1507 +      have "ln (real_of_float x * 2/3)
  2.1508 +        \<le> ln (real_of_float (x * rapprox_rat prec 2 3 - 1) + 1)"
  2.1509        proof (rule ln_le_cancel_iff[symmetric, THEN iffD1])
  2.1510 -        show "real x * 2 / 3 \<le> real (x * rapprox_rat prec 2 3 - 1) + 1"
  2.1511 +        show "real_of_float x * 2 / 3 \<le> real_of_float (x * rapprox_rat prec 2 3 - 1) + 1"
  2.1512            using * low by auto
  2.1513 -        show "0 < real x * 2 / 3" using * by simp
  2.1514 -        show "0 < real (x * rapprox_rat prec 2 3 - 1) + 1" using pos by auto
  2.1515 +        show "0 < real_of_float x * 2 / 3" using * by simp
  2.1516 +        show "0 < real_of_float (x * rapprox_rat prec 2 3 - 1) + 1" using pos by auto
  2.1517        qed
  2.1518        also have "\<dots> \<le> ?ub_horner (x * rapprox_rat prec 2 3 - 1)"
  2.1519        proof (rule float_round_up_le, rule ln_float_bounds(2))
  2.1520 -        from mult_less_le_imp_less[OF \<open>real x < 2\<close> up] low *
  2.1521 -        show "real (x * rapprox_rat prec 2 3 - 1) < 1" by auto
  2.1522 -        show "0 \<le> real (x * rapprox_rat prec 2 3 - 1)" using pos by auto
  2.1523 +        from mult_less_le_imp_less[OF \<open>real_of_float x < 2\<close> up] low *
  2.1524 +        show "real_of_float (x * rapprox_rat prec 2 3 - 1) < 1" by auto
  2.1525 +        show "0 \<le> real_of_float (x * rapprox_rat prec 2 3 - 1)" using pos by auto
  2.1526        qed
  2.1527       finally have "ln x \<le> ?ub_horner (Float 1 (-1))
  2.1528            + ?ub_horner ((x * rapprox_rat prec 2 3 - 1))"
  2.1529 @@ -2444,23 +2438,23 @@
  2.1530        have up: "lapprox_rat prec 2 3 \<le> 2/3"
  2.1531          by (rule order_trans[OF lapprox_rat], simp)
  2.1532  
  2.1533 -      have low: "0 \<le> real (lapprox_rat prec 2 3)"
  2.1534 +      have low: "0 \<le> real_of_float (lapprox_rat prec 2 3)"
  2.1535          using lapprox_rat_nonneg[of 2 3 prec] by simp
  2.1536  
  2.1537        have "?lb_horner ?max
  2.1538 -        \<le> ln (real ?max + 1)"
  2.1539 +        \<le> ln (real_of_float ?max + 1)"
  2.1540        proof (rule float_round_down_le, rule ln_float_bounds(1))
  2.1541 -        from mult_less_le_imp_less[OF \<open>real x < 2\<close> up] * low
  2.1542 -        show "real ?max < 1" by (cases "real (lapprox_rat prec 2 3) = 0",
  2.1543 +        from mult_less_le_imp_less[OF \<open>real_of_float x < 2\<close> up] * low
  2.1544 +        show "real_of_float ?max < 1" by (cases "real_of_float (lapprox_rat prec 2 3) = 0",
  2.1545            auto simp add: real_of_float_max)
  2.1546 -        show "0 \<le> real ?max" by (auto simp add: real_of_float_max)
  2.1547 +        show "0 \<le> real_of_float ?max" by (auto simp add: real_of_float_max)
  2.1548        qed
  2.1549 -      also have "\<dots> \<le> ln (real x * 2/3)"
  2.1550 +      also have "\<dots> \<le> ln (real_of_float x * 2/3)"
  2.1551        proof (rule ln_le_cancel_iff[symmetric, THEN iffD1])
  2.1552 -        show "0 < real ?max + 1" by (auto simp add: real_of_float_max)
  2.1553 -        show "0 < real x * 2/3" using * by auto
  2.1554 -        show "real ?max + 1 \<le> real x * 2/3" using * up
  2.1555 -          by (cases "0 < real x * real (lapprox_posrat prec 2 3) - 1",
  2.1556 +        show "0 < real_of_float ?max + 1" by (auto simp add: real_of_float_max)
  2.1557 +        show "0 < real_of_float x * 2/3" using * by auto
  2.1558 +        show "real_of_float ?max + 1 \<le> real_of_float x * 2/3" using * up
  2.1559 +          by (cases "0 < real_of_float x * real_of_float (lapprox_posrat prec 2 3) - 1",
  2.1560                auto simp add: max_def)
  2.1561        qed
  2.1562        finally have "?lb_horner (Float 1 (- 1)) + ?lb_horner ?max \<le> ln x"
  2.1563 @@ -2495,24 +2489,24 @@
  2.1564      have "1 \<le> Float m e"
  2.1565        using \<open>1 \<le> x\<close> Float unfolding less_eq_float_def by auto
  2.1566      from bitlen_div[OF \<open>0 < m\<close>] float_gt1_scale[OF \<open>1 \<le> Float m e\<close>] \<open>bl \<ge> 0\<close>
  2.1567 -    have x_bnds: "0 \<le> real (?x - 1)" "real (?x - 1) < 1"
  2.1568 +    have x_bnds: "0 \<le> real_of_float (?x - 1)" "real_of_float (?x - 1) < 1"
  2.1569        unfolding bl_def[symmetric]
  2.1570        by (auto simp: powr_realpow[symmetric] field_simps inverse_eq_divide)
  2.1571           (auto simp : powr_minus field_simps inverse_eq_divide)
  2.1572  
  2.1573      {
  2.1574        have "float_round_down prec (lb_ln2 prec * ?s) \<le> ln 2 * (e + (bitlen m - 1))"
  2.1575 -          (is "real ?lb2 \<le> _")
  2.1576 +          (is "real_of_float ?lb2 \<le> _")
  2.1577          apply (rule float_round_down_le)
  2.1578          unfolding nat_0 power_0 mult_1_right times_float.rep_eq
  2.1579          using lb_ln2[of prec]
  2.1580        proof (rule mult_mono)
  2.1581          from float_gt1_scale[OF \<open>1 \<le> Float m e\<close>]
  2.1582 -        show "0 \<le> real (Float (e + (bitlen m - 1)) 0)" by simp
  2.1583 +        show "0 \<le> real_of_float (Float (e + (bitlen m - 1)) 0)" by simp
  2.1584        qed auto
  2.1585        moreover
  2.1586        from ln_float_bounds(1)[OF x_bnds]
  2.1587 -      have "float_round_down prec ((?x - 1) * lb_ln_horner prec (get_even prec) 1 (?x - 1)) \<le> ln ?x" (is "real ?lb_horner \<le> _")
  2.1588 +      have "float_round_down prec ((?x - 1) * lb_ln_horner prec (get_even prec) 1 (?x - 1)) \<le> ln ?x" (is "real_of_float ?lb_horner \<le> _")
  2.1589          by (auto intro!: float_round_down_le)
  2.1590        ultimately have "float_plus_down prec ?lb2 ?lb_horner \<le> ln x"
  2.1591          unfolding Float ln_shifted_float[OF \<open>0 < m\<close>, of e] by (auto intro!: float_plus_down_le)
  2.1592 @@ -2521,19 +2515,19 @@
  2.1593      {
  2.1594        from ln_float_bounds(2)[OF x_bnds]
  2.1595        have "ln ?x \<le> float_round_up prec ((?x - 1) * ub_ln_horner prec (get_odd prec) 1 (?x - 1))"
  2.1596 -          (is "_ \<le> real ?ub_horner")
  2.1597 +          (is "_ \<le> real_of_float ?ub_horner")
  2.1598          by (auto intro!: float_round_up_le)
  2.1599        moreover
  2.1600        have "ln 2 * (e + (bitlen m - 1)) \<le> float_round_up prec (ub_ln2 prec * ?s)"
  2.1601 -          (is "_ \<le> real ?ub2")
  2.1602 +          (is "_ \<le> real_of_float ?ub2")
  2.1603          apply (rule float_round_up_le)
  2.1604          unfolding nat_0 power_0 mult_1_right times_float.rep_eq
  2.1605          using ub_ln2[of prec]
  2.1606        proof (rule mult_mono)
  2.1607          from float_gt1_scale[OF \<open>1 \<le> Float m e\<close>]
  2.1608 -        show "0 \<le> real (e + (bitlen m - 1))" by auto
  2.1609 +        show "0 \<le> real_of_int (e + (bitlen m - 1))" by auto
  2.1610          have "0 \<le> ln (2 :: real)" by simp
  2.1611 -        thus "0 \<le> real (ub_ln2 prec)" using ub_ln2[of prec] by arith
  2.1612 +        thus "0 \<le> real_of_float (ub_ln2 prec)" using ub_ln2[of prec] by arith
  2.1613        qed auto
  2.1614        ultimately have "ln x \<le> float_plus_up prec ?ub2 ?ub_horner"
  2.1615          unfolding Float ln_shifted_float[OF \<open>0 < m\<close>, of e]
  2.1616 @@ -2562,29 +2556,29 @@
  2.1617  next
  2.1618    case True
  2.1619    have "\<not> x \<le> 0" using \<open>0 < x\<close> by auto
  2.1620 -  from True have "real x \<le> 1" "x \<le> 1"
  2.1621 +  from True have "real_of_float x \<le> 1" "x \<le> 1"
  2.1622      by simp_all
  2.1623 -  have "0 < real x" and "real x \<noteq> 0"
  2.1624 +  have "0 < real_of_float x" and "real_of_float x \<noteq> 0"
  2.1625      using \<open>0 < x\<close> by auto
  2.1626 -  hence A: "0 < 1 / real x" by auto
  2.1627 +  hence A: "0 < 1 / real_of_float x" by auto
  2.1628  
  2.1629    {
  2.1630      let ?divl = "float_divl (max prec 1) 1 x"
  2.1631 -    have A': "1 \<le> ?divl" using float_divl_pos_less1_bound[OF \<open>0 < real x\<close> \<open>real x \<le> 1\<close>] by auto
  2.1632 -    hence B: "0 < real ?divl" by auto
  2.1633 +    have A': "1 \<le> ?divl" using float_divl_pos_less1_bound[OF \<open>0 < real_of_float x\<close> \<open>real_of_float x \<le> 1\<close>] by auto
  2.1634 +    hence B: "0 < real_of_float ?divl" by auto
  2.1635  
  2.1636      have "ln ?divl \<le> ln (1 / x)" unfolding ln_le_cancel_iff[OF B A] using float_divl[of _ 1 x] by auto
  2.1637 -    hence "ln x \<le> - ln ?divl" unfolding nonzero_inverse_eq_divide[OF \<open>real x \<noteq> 0\<close>, symmetric] ln_inverse[OF \<open>0 < real x\<close>] by auto
  2.1638 +    hence "ln x \<le> - ln ?divl" unfolding nonzero_inverse_eq_divide[OF \<open>real_of_float x \<noteq> 0\<close>, symmetric] ln_inverse[OF \<open>0 < real_of_float x\<close>] by auto
  2.1639      from this ub_ln_lb_ln_bounds'[OF A', THEN conjunct1, THEN le_imp_neg_le]
  2.1640      have "?ln \<le> - the (lb_ln prec ?divl)" unfolding uminus_float.rep_eq by (rule order_trans)
  2.1641    } moreover
  2.1642    {
  2.1643      let ?divr = "float_divr prec 1 x"
  2.1644      have A': "1 \<le> ?divr" using float_divr_pos_less1_lower_bound[OF \<open>0 < x\<close> \<open>x \<le> 1\<close>] unfolding less_eq_float_def less_float_def by auto
  2.1645 -    hence B: "0 < real ?divr" by auto
  2.1646 +    hence B: "0 < real_of_float ?divr" by auto
  2.1647  
  2.1648      have "ln (1 / x) \<le> ln ?divr" unfolding ln_le_cancel_iff[OF A B] using float_divr[of 1 x] by auto
  2.1649 -    hence "- ln ?divr \<le> ln x" unfolding nonzero_inverse_eq_divide[OF \<open>real x \<noteq> 0\<close>, symmetric] ln_inverse[OF \<open>0 < real x\<close>] by auto
  2.1650 +    hence "- ln ?divr \<le> ln x" unfolding nonzero_inverse_eq_divide[OF \<open>real_of_float x \<noteq> 0\<close>, symmetric] ln_inverse[OF \<open>0 < real_of_float x\<close>] by auto
  2.1651      from ub_ln_lb_ln_bounds'[OF A', THEN conjunct2, THEN le_imp_neg_le] this
  2.1652      have "- the (ub_ln prec ?divr) \<le> ?ln" unfolding uminus_float.rep_eq by (rule order_trans)
  2.1653    }
  2.1654 @@ -2594,7 +2588,7 @@
  2.1655  
  2.1656  lemma lb_ln:
  2.1657    assumes "Some y = lb_ln prec x"
  2.1658 -  shows "y \<le> ln x" and "0 < real x"
  2.1659 +  shows "y \<le> ln x" and "0 < real_of_float x"
  2.1660  proof -
  2.1661    have "0 < x"
  2.1662    proof (rule ccontr)
  2.1663 @@ -2604,7 +2598,7 @@
  2.1664      thus False
  2.1665        using assms by auto
  2.1666    qed
  2.1667 -  thus "0 < real x" by auto
  2.1668 +  thus "0 < real_of_float x" by auto
  2.1669    have "the (lb_ln prec x) \<le> ln x"
  2.1670      using ub_ln_lb_ln_bounds[OF \<open>0 < x\<close>] ..
  2.1671    thus "y \<le> ln x"
  2.1672 @@ -2613,7 +2607,7 @@
  2.1673  
  2.1674  lemma ub_ln:
  2.1675    assumes "Some y = ub_ln prec x"
  2.1676 -  shows "ln x \<le> y" and "0 < real x"
  2.1677 +  shows "ln x \<le> y" and "0 < real_of_float x"
  2.1678  proof -
  2.1679    have "0 < x"
  2.1680    proof (rule ccontr)
  2.1681 @@ -2622,7 +2616,7 @@
  2.1682      thus False
  2.1683        using assms by auto
  2.1684    qed
  2.1685 -  thus "0 < real x" by auto
  2.1686 +  thus "0 < real_of_float x" by auto
  2.1687    have "ln x \<le> the (ub_ln prec x)"
  2.1688      using ub_ln_lb_ln_bounds[OF \<open>0 < x\<close>] ..
  2.1689    thus "ln x \<le> y"
  2.1690 @@ -2638,16 +2632,16 @@
  2.1691    hence l: "Some l = lb_ln prec lx " and u: "Some u = ub_ln prec ux" and x: "x \<in> {lx .. ux}"
  2.1692      by auto
  2.1693  
  2.1694 -  have "ln ux \<le> u" and "0 < real ux"
  2.1695 +  have "ln ux \<le> u" and "0 < real_of_float ux"
  2.1696      using ub_ln u by auto
  2.1697 -  have "l \<le> ln lx" and "0 < real lx" and "0 < x"
  2.1698 +  have "l \<le> ln lx" and "0 < real_of_float lx" and "0 < x"
  2.1699      using lb_ln[OF l] x by auto
  2.1700  
  2.1701 -  from ln_le_cancel_iff[OF \<open>0 < real lx\<close> \<open>0 < x\<close>] \<open>l \<le> ln lx\<close>
  2.1702 +  from ln_le_cancel_iff[OF \<open>0 < real_of_float lx\<close> \<open>0 < x\<close>] \<open>l \<le> ln lx\<close>
  2.1703    have "l \<le> ln x"
  2.1704      using x unfolding atLeastAtMost_iff by auto
  2.1705    moreover
  2.1706 -  from ln_le_cancel_iff[OF \<open>0 < x\<close> \<open>0 < real ux\<close>] \<open>ln ux \<le> real u\<close>
  2.1707 +  from ln_le_cancel_iff[OF \<open>0 < x\<close> \<open>0 < real_of_float ux\<close>] \<open>ln ux \<le> real_of_float u\<close>
  2.1708    have "ln x \<le> u"
  2.1709      using x unfolding atLeastAtMost_iff by auto
  2.1710    ultimately show "l \<le> ln x \<and> ln x \<le> u" ..
  2.1711 @@ -2746,19 +2740,20 @@
  2.1712  "lift_un' (Some (l1, u1)) f = Some (f l1 u1)" |
  2.1713  "lift_un' b f = None"
  2.1714  
  2.1715 -definition "bounded_by xs vs \<longleftrightarrow>
  2.1716 +definition bounded_by :: "real list \<Rightarrow> (float \<times> float) option list \<Rightarrow> bool" where 
  2.1717 +  "bounded_by xs vs \<longleftrightarrow>
  2.1718    (\<forall> i < length vs. case vs ! i of None \<Rightarrow> True
  2.1719 -         | Some (l, u) \<Rightarrow> xs ! i \<in> { real l .. real u })"
  2.1720 -
  2.1721 +         | Some (l, u) \<Rightarrow> xs ! i \<in> { real_of_float l .. real_of_float u })"
  2.1722 +                                                                     
  2.1723  lemma bounded_byE:
  2.1724    assumes "bounded_by xs vs"
  2.1725    shows "\<And> i. i < length vs \<Longrightarrow> case vs ! i of None \<Rightarrow> True
  2.1726 -         | Some (l, u) \<Rightarrow> xs ! i \<in> { real l .. real u }"
  2.1727 +         | Some (l, u) \<Rightarrow> xs ! i \<in> { real_of_float l .. real_of_float u }"
  2.1728    using assms bounded_by_def by blast
  2.1729  
  2.1730  lemma bounded_by_update:
  2.1731    assumes "bounded_by xs vs"
  2.1732 -    and bnd: "xs ! i \<in> { real l .. real u }"
  2.1733 +    and bnd: "xs ! i \<in> { real_of_float l .. real_of_float u }"
  2.1734    shows "bounded_by xs (vs[i := Some (l,u)])"
  2.1735  proof -
  2.1736    {
  2.1737 @@ -2766,7 +2761,7 @@
  2.1738      let ?vs = "vs[i := Some (l,u)]"
  2.1739      assume "j < length ?vs"
  2.1740      hence [simp]: "j < length vs" by simp
  2.1741 -    have "case ?vs ! j of None \<Rightarrow> True | Some (l, u) \<Rightarrow> xs ! j \<in> { real l .. real u }"
  2.1742 +    have "case ?vs ! j of None \<Rightarrow> True | Some (l, u) \<Rightarrow> xs ! j \<in> { real_of_float l .. real_of_float u }"
  2.1743      proof (cases "?vs ! j")
  2.1744        case (Some b)
  2.1745        thus ?thesis
  2.1746 @@ -2949,7 +2944,7 @@
  2.1747      and lift_un'_Some: "Some (l, u) = lift_un' (approx' prec a bs) f"
  2.1748      and Pa: "\<And>l u. Some (l, u) = approx prec a bs \<Longrightarrow>
  2.1749        l \<le> interpret_floatarith a xs \<and> interpret_floatarith a xs \<le> u"
  2.1750 -  shows "real l \<le> f' (interpret_floatarith a xs) \<and> f' (interpret_floatarith a xs) \<le> real u"
  2.1751 +  shows "real_of_float l \<le> f' (interpret_floatarith a xs) \<and> f' (interpret_floatarith a xs) \<le> real_of_float u"
  2.1752  proof -
  2.1753    from lift_un'[OF lift_un'_Some Pa]
  2.1754    obtain l1 u1 where "l1 \<le> interpret_floatarith a xs"
  2.1755 @@ -3039,7 +3034,7 @@
  2.1756      and lift_un_Some: "Some (l, u) = lift_un (approx' prec a bs) f"
  2.1757      and Pa: "\<And>l u. Some (l, u) = approx prec a bs \<Longrightarrow>
  2.1758        l \<le> interpret_floatarith a xs \<and> interpret_floatarith a xs \<le> u"
  2.1759 -  shows "real l \<le> f' (interpret_floatarith a xs) \<and> f' (interpret_floatarith a xs) \<le> real u"
  2.1760 +  shows "real_of_float l \<le> f' (interpret_floatarith a xs) \<and> f' (interpret_floatarith a xs) \<le> real_of_float u"
  2.1761  proof -
  2.1762    from lift_un[OF lift_un_Some Pa]
  2.1763    obtain l1 u1 where "l1 \<le> interpret_floatarith a xs"
  2.1764 @@ -3109,37 +3104,37 @@
  2.1765      show False
  2.1766        using l' unfolding if_not_P[OF P] by auto
  2.1767    qed
  2.1768 -  moreover have l1_le_u1: "real l1 \<le> real u1"
  2.1769 +  moreover have l1_le_u1: "real_of_float l1 \<le> real_of_float u1"
  2.1770      using l1 u1 by auto
  2.1771 -  ultimately have "real l1 \<noteq> 0" and "real u1 \<noteq> 0"
  2.1772 +  ultimately have "real_of_float l1 \<noteq> 0" and "real_of_float u1 \<noteq> 0"
  2.1773      by auto
  2.1774  
  2.1775    have inv: "inverse u1 \<le> inverse (interpret_floatarith a xs)
  2.1776             \<and> inverse (interpret_floatarith a xs) \<le> inverse l1"
  2.1777    proof (cases "0 < l1")
  2.1778      case True
  2.1779 -    hence "0 < real u1" and "0 < real l1" "0 < interpret_floatarith a xs"
  2.1780 +    hence "0 < real_of_float u1" and "0 < real_of_float l1" "0 < interpret_floatarith a xs"
  2.1781        using l1_le_u1 l1 by auto
  2.1782      show ?thesis
  2.1783 -      unfolding inverse_le_iff_le[OF \<open>0 < real u1\<close> \<open>0 < interpret_floatarith a xs\<close>]
  2.1784 -        inverse_le_iff_le[OF \<open>0 < interpret_floatarith a xs\<close> \<open>0 < real l1\<close>]
  2.1785 +      unfolding inverse_le_iff_le[OF \<open>0 < real_of_float u1\<close> \<open>0 < interpret_floatarith a xs\<close>]
  2.1786 +        inverse_le_iff_le[OF \<open>0 < interpret_floatarith a xs\<close> \<open>0 < real_of_float l1\<close>]
  2.1787        using l1 u1 by auto
  2.1788    next
  2.1789      case False
  2.1790      hence "u1 < 0"
  2.1791        using either by blast
  2.1792 -    hence "real u1 < 0" and "real l1 < 0" "interpret_floatarith a xs < 0"
  2.1793 +    hence "real_of_float u1 < 0" and "real_of_float l1 < 0" "interpret_floatarith a xs < 0"
  2.1794        using l1_le_u1 u1 by auto
  2.1795      show ?thesis
  2.1796 -      unfolding inverse_le_iff_le_neg[OF \<open>real u1 < 0\<close> \<open>interpret_floatarith a xs < 0\<close>]
  2.1797 -        inverse_le_iff_le_neg[OF \<open>interpret_floatarith a xs < 0\<close> \<open>real l1 < 0\<close>]
  2.1798 +      unfolding inverse_le_iff_le_neg[OF \<open>real_of_float u1 < 0\<close> \<open>interpret_floatarith a xs < 0\<close>]
  2.1799 +        inverse_le_iff_le_neg[OF \<open>interpret_floatarith a xs < 0\<close> \<open>real_of_float l1 < 0\<close>]
  2.1800        using l1 u1 by auto
  2.1801    qed
  2.1802  
  2.1803    from l' have "l = float_divl prec 1 u1"
  2.1804      by (cases "0 < l1 \<or> u1 < 0") auto
  2.1805    hence "l \<le> inverse u1"
  2.1806 -    unfolding nonzero_inverse_eq_divide[OF \<open>real u1 \<noteq> 0\<close>]
  2.1807 +    unfolding nonzero_inverse_eq_divide[OF \<open>real_of_float u1 \<noteq> 0\<close>]
  2.1808      using float_divl[of prec 1 u1] by auto
  2.1809    also have "\<dots> \<le> inverse (interpret_floatarith a xs)"
  2.1810      using inv by auto
  2.1811 @@ -3148,7 +3143,7 @@
  2.1812    from u' have "u = float_divr prec 1 l1"
  2.1813      by (cases "0 < l1 \<or> u1 < 0") auto
  2.1814    hence "inverse l1 \<le> u"
  2.1815 -    unfolding nonzero_inverse_eq_divide[OF \<open>real l1 \<noteq> 0\<close>]
  2.1816 +    unfolding nonzero_inverse_eq_divide[OF \<open>real_of_float l1 \<noteq> 0\<close>]
  2.1817      using float_divr[of 1 l1 prec] by auto
  2.1818    hence "inverse (interpret_floatarith a xs) \<le> u"
  2.1819      by (rule order_trans[OF inv[THEN conjunct2]])
  2.1820 @@ -3274,7 +3269,7 @@
  2.1821    case (Suc s)
  2.1822  
  2.1823    let ?m = "(l + u) * Float 1 (- 1)"
  2.1824 -  have "real l \<le> ?m" and "?m \<le> real u"
  2.1825 +  have "real_of_float l \<le> ?m" and "?m \<le> real_of_float u"
  2.1826      unfolding less_eq_float_def using Suc.prems by auto
  2.1827  
  2.1828    with \<open>x \<in> { l .. u }\<close>
  2.1829 @@ -3355,7 +3350,7 @@
  2.1830    then obtain l u l' u'
  2.1831      where l_eq: "Some (l, u) = approx prec a vs"
  2.1832        and u_eq: "Some (l', u') = approx prec b vs"
  2.1833 -      and inequality: "real (float_plus_up prec u (-l')) < 0"
  2.1834 +      and inequality: "real_of_float (float_plus_up prec u (-l')) < 0"
  2.1835      by (cases "approx prec a vs", auto, cases "approx prec b vs", auto)
  2.1836    from le_less_trans[OF float_plus_up inequality]
  2.1837      approx[OF Less.prems(2) l_eq] approx[OF Less.prems(2) u_eq]
  2.1838 @@ -3365,7 +3360,7 @@
  2.1839    then obtain l u l' u'
  2.1840      where l_eq: "Some (l, u) = approx prec a vs"
  2.1841        and u_eq: "Some (l', u') = approx prec b vs"
  2.1842 -      and inequality: "real (float_plus_up prec u (-l')) \<le> 0"
  2.1843 +      and inequality: "real_of_float (float_plus_up prec u (-l')) \<le> 0"
  2.1844      by (cases "approx prec a vs", auto, cases "approx prec b vs", auto)
  2.1845    from order_trans[OF float_plus_up inequality]
  2.1846      approx[OF LessEqual.prems(2) l_eq] approx[OF LessEqual.prems(2) u_eq]
  2.1847 @@ -3376,7 +3371,7 @@
  2.1848      where x_eq: "Some (lx, ux) = approx prec x vs"
  2.1849      and l_eq: "Some (l, u) = approx prec a vs"
  2.1850      and u_eq: "Some (l', u') = approx prec b vs"
  2.1851 -    and inequality: "real (float_plus_up prec u (-lx)) \<le> 0" "real (float_plus_up prec ux (-l')) \<le> 0"
  2.1852 +    and inequality: "real_of_float (float_plus_up prec u (-lx)) \<le> 0" "real_of_float (float_plus_up prec ux (-l')) \<le> 0"
  2.1853      by (cases "approx prec x vs", auto,
  2.1854        cases "approx prec a vs", auto,
  2.1855        cases "approx prec b vs", auto)
  2.1856 @@ -3452,7 +3447,7 @@
  2.1857  next
  2.1858    case (Power a n)
  2.1859    thus ?case
  2.1860 -    by (cases n) (auto intro!: derivative_eq_intros simp del: power_Suc simp add: real_of_nat_def)
  2.1861 +    by (cases n) (auto intro!: derivative_eq_intros simp del: power_Suc)
  2.1862  next
  2.1863    case (Ln a)
  2.1864    thus ?case by (auto intro!: derivative_eq_intros simp add: divide_inverse)
  2.1865 @@ -3522,7 +3517,7 @@
  2.1866  lemma bounded_by_update_var:
  2.1867    assumes "bounded_by xs vs"
  2.1868      and "vs ! i = Some (l, u)"
  2.1869 -    and bnd: "x \<in> { real l .. real u }"
  2.1870 +    and bnd: "x \<in> { real_of_float l .. real_of_float u }"
  2.1871    shows "bounded_by (xs[i := x]) vs"
  2.1872  proof (cases "i < length xs")
  2.1873    case False
  2.1874 @@ -3532,7 +3527,7 @@
  2.1875    case True
  2.1876    let ?xs = "xs[i := x]"
  2.1877    from True have "i < length ?xs" by auto
  2.1878 -  have "case vs ! j of None \<Rightarrow> True | Some (l, u) \<Rightarrow> ?xs ! j \<in> {real l .. real u}"
  2.1879 +  have "case vs ! j of None \<Rightarrow> True | Some (l, u) \<Rightarrow> ?xs ! j \<in> {real_of_float l .. real_of_float u}"
  2.1880      if "j < length vs" for j
  2.1881    proof (cases "vs ! j")
  2.1882      case None
  2.1883 @@ -3557,7 +3552,7 @@
  2.1884  lemma isDERIV_approx':
  2.1885    assumes "bounded_by xs vs"
  2.1886      and vs_x: "vs ! x = Some (l, u)"
  2.1887 -    and X_in: "X \<in> {real l .. real u}"
  2.1888 +    and X_in: "X \<in> {real_of_float l .. real_of_float u}"
  2.1889      and approx: "isDERIV_approx prec x f vs"
  2.1890    shows "isDERIV x f (xs[x := X])"
  2.1891  proof -
  2.1892 @@ -3612,10 +3607,10 @@
  2.1893  
  2.1894  lemma bounded_by_Cons:
  2.1895    assumes bnd: "bounded_by xs vs"
  2.1896 -    and x: "x \<in> { real l .. real u }"
  2.1897 +    and x: "x \<in> { real_of_float l .. real_of_float u }"
  2.1898    shows "bounded_by (x#xs) ((Some (l, u))#vs)"
  2.1899  proof -
  2.1900 -  have "case ((Some (l,u))#vs) ! i of Some (l, u) \<Rightarrow> (x#xs)!i \<in> { real l .. real u } | None \<Rightarrow> True"
  2.1901 +  have "case ((Some (l,u))#vs) ! i of Some (l, u) \<Rightarrow> (x#xs)!i \<in> { real_of_float l .. real_of_float u } | None \<Rightarrow> True"
  2.1902      if *: "i < length ((Some (l, u))#vs)" for i
  2.1903    proof (cases i)
  2.1904      case 0
  2.1905 @@ -3689,7 +3684,7 @@
  2.1906  
  2.1907      from approx[OF this a]
  2.1908      have f_c: "interpret_floatarith ((DERIV_floatarith x ^^ 0) f) (xs[x := c]) \<in> { l1 .. u1 }"
  2.1909 -              (is "?f 0 (real c) \<in> _")
  2.1910 +              (is "?f 0 (real_of_float c) \<in> _")
  2.1911        by auto
  2.1912  
  2.1913      have funpow_Suc[symmetric]: "(f ^^ Suc n) x = (f ^^ n) (f x)"
  2.1914 @@ -3698,7 +3693,7 @@
  2.1915      from Suc.hyps[OF ate, unfolded this] obtain n
  2.1916        where DERIV_hyp: "\<And>m z. \<lbrakk> m < n ; (z::real) \<in> { lx .. ux } \<rbrakk> \<Longrightarrow>
  2.1917          DERIV (?f (Suc m)) z :> ?f (Suc (Suc m)) z"
  2.1918 -      and hyp: "\<forall>t \<in> {real lx .. real ux}.
  2.1919 +      and hyp: "\<forall>t \<in> {real_of_float lx .. real_of_float ux}.
  2.1920          (\<Sum> i = 0..<n. inverse (real (\<Prod> j \<in> {Suc k..<Suc k + i}. j)) * ?f (Suc i) c * (xs!x - c)^i) +
  2.1921            inverse (real (\<Prod> j \<in> {Suc k..<Suc k + n}. j)) * ?f (Suc n) t * (xs!x - c)^n \<in> {l2 .. u2}"
  2.1922            (is "\<forall> t \<in> _. ?X (Suc k) f n t \<in> _")
  2.1923 @@ -3737,9 +3732,9 @@
  2.1924        have "bounded_by [?f 0 c, ?X (Suc k) f n t, xs!x] [Some (l1, u1), Some (l2, u2), vs!x]"
  2.1925          by (auto intro!: bounded_by_Cons)
  2.1926        from approx[OF this final, unfolded atLeastAtMost_iff[symmetric]]
  2.1927 -      have "?X (Suc k) f n t * (xs!x - real c) * inverse k + ?f 0 c \<in> {l .. u}"
  2.1928 +      have "?X (Suc k) f n t * (xs!x - real_of_float c) * inverse k + ?f 0 c \<in> {l .. u}"
  2.1929          by (auto simp add: algebra_simps)
  2.1930 -      also have "?X (Suc k) f n t * (xs!x - real c) * inverse (real k) + ?f 0 c =
  2.1931 +      also have "?X (Suc k) f n t * (xs!x - real_of_float c) * inverse (real k) + ?f 0 c =
  2.1932                 (\<Sum> i = 0..<Suc n. inverse (real (\<Prod> j \<in> {k..<k+i}. j)) * ?f i c * (xs!x - c)^i) +
  2.1933                 inverse (real (\<Prod> j \<in> {k..<k+Suc n}. j)) * ?f (Suc n) t * (xs!x - c)^Suc n" (is "_ = ?T")
  2.1934          unfolding funpow_Suc C_def[symmetric] setsum_move0 setprod_head_Suc
  2.1935 @@ -3752,13 +3747,12 @@
  2.1936  qed
  2.1937  
  2.1938  lemma setprod_fact: "real (\<Prod> {1..<1 + k}) = fact (k :: nat)"
  2.1939 -  using fact_altdef_nat Suc_eq_plus1_left atLeastLessThanSuc_atLeastAtMost real_fact_nat
  2.1940 -  by presburger
  2.1941 +by (metis Suc_eq_plus1_left atLeastLessThanSuc_atLeastAtMost fact_altdef_nat of_nat_fact)
  2.1942  
  2.1943  lemma approx_tse:
  2.1944    assumes "bounded_by xs vs"
  2.1945      and bnd_x: "vs ! x = Some (lx, ux)"
  2.1946 -    and bnd_c: "real c \<in> {lx .. ux}"
  2.1947 +    and bnd_c: "real_of_float c \<in> {lx .. ux}"
  2.1948      and "x < length vs" and "x < length xs"
  2.1949      and ate: "Some (l, u) = approx_tse prec x s c 1 f vs"
  2.1950    shows "interpret_floatarith f xs \<in> {l .. u}"
  2.1951 @@ -3772,7 +3766,7 @@
  2.1952  
  2.1953    from approx_tse_generic[OF \<open>bounded_by xs vs\<close> this bnd_x ate]
  2.1954    obtain n
  2.1955 -    where DERIV: "\<forall> m z. m < n \<and> real lx \<le> z \<and> z \<le> real ux \<longrightarrow> DERIV (F m) z :> F (Suc m) z"
  2.1956 +    where DERIV: "\<forall> m z. m < n \<and> real_of_float lx \<le> z \<and> z \<le> real_of_float ux \<longrightarrow> DERIV (F m) z :> F (Suc m) z"
  2.1957      and hyp: "\<And> (t::real). t \<in> {lx .. ux} \<Longrightarrow>
  2.1958             (\<Sum> j = 0..<n. inverse(fact j) * F j c * (xs!x - c)^j) +
  2.1959               inverse ((fact n)) * F n t * (xs!x - c)^n
  2.1960 @@ -3798,7 +3792,7 @@
  2.1961          by auto
  2.1962      next
  2.1963        case False
  2.1964 -      have "lx \<le> real c" "real c \<le> ux" "lx \<le> xs!x" "xs!x \<le> ux"
  2.1965 +      have "lx \<le> real_of_float c" "real_of_float c \<le> ux" "lx \<le> xs!x" "xs!x \<le> ux"
  2.1966          using Suc bnd_c \<open>bounded_by xs vs\<close>[THEN bounded_byE, OF \<open>x < length vs\<close>] bnd_x by auto
  2.1967        from Taylor.taylor[OF zero_less_Suc, of F, OF F0 DERIV[unfolded Suc] this False]
  2.1968        obtain t::real where t_bnd: "if xs ! x < c then xs ! x < t \<and> t < c else c < t \<and> t < xs ! x"
  2.1969 @@ -3833,7 +3827,7 @@
  2.1970    fixes x :: real
  2.1971    assumes "approx_tse_form' prec t f s l u cmp"
  2.1972      and "x \<in> {l .. u}"
  2.1973 -  shows "\<exists>l' u' ly uy. x \<in> {l' .. u'} \<and> real l \<le> l' \<and> u' \<le> real u \<and> cmp ly uy \<and>
  2.1974 +  shows "\<exists>l' u' ly uy. x \<in> {l' .. u'} \<and> real_of_float l \<le> l' \<and> u' \<le> real_of_float u \<and> cmp ly uy \<and>
  2.1975      approx_tse prec 0 t ((l' + u') * Float 1 (- 1)) 1 f [Some (l', u')] = Some (ly, uy)"
  2.1976    using assms
  2.1977  proof (induct s arbitrary: l u)
  2.1978 @@ -3850,7 +3844,7 @@
  2.1979      and u: "approx_tse_form' prec t f s ?m u cmp"
  2.1980      by (auto simp add: Let_def lazy_conj)
  2.1981  
  2.1982 -  have m_l: "real l \<le> ?m" and m_u: "?m \<le> real u"
  2.1983 +  have m_l: "real_of_float l \<le> ?m" and m_u: "?m \<le> real_of_float u"
  2.1984      unfolding less_eq_float_def using Suc.prems by auto
  2.1985    with \<open>x \<in> { l .. u }\<close> consider "x \<in> { l .. ?m}" | "x \<in> {?m .. u}"
  2.1986      by atomize_elim auto
  2.1987 @@ -3859,7 +3853,7 @@
  2.1988      case 1
  2.1989      from Suc.hyps[OF l this]
  2.1990      obtain l' u' ly uy where
  2.1991 -      "x \<in> {l' .. u'} \<and> real l \<le> l' \<and> real u' \<le> ?m \<and> cmp ly uy \<and>
  2.1992 +      "x \<in> {l' .. u'} \<and> real_of_float l \<le> l' \<and> real_of_float u' \<le> ?m \<and> cmp ly uy \<and>
  2.1993          approx_tse prec 0 t ((l' + u') * Float 1 (- 1)) 1 f [Some (l', u')] = Some (ly, uy)"
  2.1994        by blast
  2.1995      with m_u show ?thesis
  2.1996 @@ -3868,7 +3862,7 @@
  2.1997      case 2
  2.1998      from Suc.hyps[OF u this]
  2.1999      obtain l' u' ly uy where
  2.2000 -      "x \<in> { l' .. u' } \<and> ?m \<le> real l' \<and> u' \<le> real u \<and> cmp ly uy \<and>
  2.2001 +      "x \<in> { l' .. u' } \<and> ?m \<le> real_of_float l' \<and> u' \<le> real_of_float u \<and> cmp ly uy \<and>
  2.2002          approx_tse prec 0 t ((l' + u') * Float 1 (- 1)) 1 f [Some (l', u')] = Some (ly, uy)"
  2.2003        by blast
  2.2004      with m_u show ?thesis
  2.2005 @@ -3885,8 +3879,8 @@
  2.2006    from approx_tse_form'[OF tse x]
  2.2007    obtain l' u' ly uy
  2.2008      where x': "x \<in> {l' .. u'}"
  2.2009 -    and "l \<le> real l'"
  2.2010 -    and "real u' \<le> u" and "0 < ly"
  2.2011 +    and "real_of_float l \<le> real_of_float l'"
  2.2012 +    and "real_of_float u' \<le> real_of_float u" and "0 < ly"
  2.2013      and tse: "approx_tse prec 0 t ((l' + u') * Float 1 (- 1)) 1 (Add a (Minus b)) [Some (l', u')] = Some (ly, uy)"
  2.2014      by blast
  2.2015  
  2.2016 @@ -3908,8 +3902,8 @@
  2.2017    from approx_tse_form'[OF tse x]
  2.2018    obtain l' u' ly uy
  2.2019      where x': "x \<in> {l' .. u'}"
  2.2020 -    and "l \<le> real l'"
  2.2021 -    and "real u' \<le> u" and "0 \<le> ly"
  2.2022 +    and "l \<le> real_of_float l'"
  2.2023 +    and "real_of_float u' \<le> u" and "0 \<le> ly"
  2.2024      and tse: "approx_tse prec 0 t ((l' + u') * Float 1 (- 1)) 1 (Add a (Minus b)) [Some (l', u')] = Some (ly, uy)"
  2.2025      by blast
  2.2026  
     3.1 --- a/src/HOL/Decision_Procs/Ferrack.thy	Tue Nov 03 11:20:21 2015 +0100
     3.2 +++ b/src/HOL/Decision_Procs/Ferrack.thy	Tue Nov 10 14:18:41 2015 +0000
     3.3 @@ -30,13 +30,13 @@
     3.4    (* Semantics of numeral terms (num) *)
     3.5  primrec Inum :: "real list \<Rightarrow> num \<Rightarrow> real"
     3.6  where
     3.7 -  "Inum bs (C c) = (real c)"
     3.8 +  "Inum bs (C c) = (real_of_int c)"
     3.9  | "Inum bs (Bound n) = bs!n"
    3.10 -| "Inum bs (CN n c a) = (real c) * (bs!n) + (Inum bs a)"
    3.11 +| "Inum bs (CN n c a) = (real_of_int c) * (bs!n) + (Inum bs a)"
    3.12  | "Inum bs (Neg a) = -(Inum bs a)"
    3.13  | "Inum bs (Add a b) = Inum bs a + Inum bs b"
    3.14  | "Inum bs (Sub a b) = Inum bs a - Inum bs b"
    3.15 -| "Inum bs (Mul c a) = (real c) * Inum bs a"
    3.16 +| "Inum bs (Mul c a) = (real_of_int c) * Inum bs a"
    3.17      (* FORMULAE *)
    3.18  datatype fm  =
    3.19    T| F| Lt num| Le num| Gt num| Ge num| Eq num| NEq num|
    3.20 @@ -518,7 +518,7 @@
    3.21  lemma reducecoeffh:
    3.22    assumes gt: "dvdnumcoeff t g"
    3.23      and gp: "g > 0"
    3.24 -  shows "real g *(Inum bs (reducecoeffh t g)) = Inum bs t"
    3.25 +  shows "real_of_int g *(Inum bs (reducecoeffh t g)) = Inum bs t"
    3.26    using gt
    3.27  proof (induct t rule: reducecoeffh.induct)
    3.28    case (1 i)
    3.29 @@ -618,7 +618,7 @@
    3.30    from dvdnumcoeff_aux[OF th1 th2 H] show "dvdnumcoeff t ?g" .
    3.31  qed
    3.32  
    3.33 -lemma reducecoeff: "real (numgcd t) * (Inum bs (reducecoeff t)) = Inum bs t"
    3.34 +lemma reducecoeff: "real_of_int (numgcd t) * (Inum bs (reducecoeff t)) = Inum bs t"
    3.35  proof -
    3.36    let ?g = "numgcd t"
    3.37    have "?g \<ge> 0"
    3.38 @@ -778,8 +778,8 @@
    3.39           else (t', n))))"
    3.40  
    3.41  lemma simp_num_pair_ci:
    3.42 -  shows "((\<lambda>(t,n). Inum bs t / real n) (simp_num_pair (t,n))) =
    3.43 -    ((\<lambda>(t,n). Inum bs t / real n) (t, n))"
    3.44 +  shows "((\<lambda>(t,n). Inum bs t / real_of_int n) (simp_num_pair (t,n))) =
    3.45 +    ((\<lambda>(t,n). Inum bs t / real_of_int n) (t, n))"
    3.46    (is "?lhs = ?rhs")
    3.47  proof -
    3.48    let ?t' = "simpnum t"
    3.49 @@ -819,15 +819,15 @@
    3.50          have gpdd: "?g' dvd n" by simp
    3.51          have gpdgp: "?g' dvd ?g'" by simp
    3.52          from reducecoeffh[OF dvdnumcoeff_trans[OF gpdg th1] g'p]
    3.53 -        have th2:"real ?g' * ?t = Inum bs ?t'"
    3.54 +        have th2:"real_of_int ?g' * ?t = Inum bs ?t'"
    3.55            by simp
    3.56 -        from g1 g'1 have "?lhs = ?t / real (n div ?g')"
    3.57 +        from g1 g'1 have "?lhs = ?t / real_of_int (n div ?g')"
    3.58            by (simp add: simp_num_pair_def Let_def)
    3.59 -        also have "\<dots> = (real ?g' * ?t) / (real ?g' * (real (n div ?g')))"
    3.60 +        also have "\<dots> = (real_of_int ?g' * ?t) / (real_of_int ?g' * (real_of_int (n div ?g')))"
    3.61            by simp
    3.62 -        also have "\<dots> = (Inum bs ?t' / real n)"
    3.63 +        also have "\<dots> = (Inum bs ?t' / real_of_int n)"
    3.64            using real_of_int_div[OF gpdd] th2 gp0 by simp
    3.65 -        finally have "?lhs = Inum bs t / real n"
    3.66 +        finally have "?lhs = Inum bs t / real_of_int n"
    3.67            by simp
    3.68          then show ?thesis
    3.69            by (simp add: simp_num_pair_def)
    3.70 @@ -1278,17 +1278,17 @@
    3.71  next
    3.72    case (3 c e)
    3.73    from 3 have nb: "numbound0 e" by simp
    3.74 -  from 3 have cp: "real c > 0" by simp
    3.75 +  from 3 have cp: "real_of_int c > 0" by simp
    3.76    fix a
    3.77    let ?e = "Inum (a#bs) e"
    3.78 -  let ?z = "(- ?e) / real c"
    3.79 +  let ?z = "(- ?e) / real_of_int c"
    3.80    {
    3.81      fix x
    3.82      assume xz: "x < ?z"
    3.83 -    then have "(real c * x < - ?e)"
    3.84 +    then have "(real_of_int c * x < - ?e)"
    3.85        by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps)
    3.86 -    then have "real c * x + ?e < 0" by arith
    3.87 -    then have "real c * x + ?e \<noteq> 0" by simp
    3.88 +    then have "real_of_int c * x + ?e < 0" by arith
    3.89 +    then have "real_of_int c * x + ?e \<noteq> 0" by simp
    3.90      with xz have "?P ?z x (Eq (CN 0 c e))"
    3.91        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp
    3.92    }
    3.93 @@ -1297,17 +1297,17 @@
    3.94  next
    3.95    case (4 c e)
    3.96    from 4 have nb: "numbound0 e" by simp
    3.97 -  from 4 have cp: "real c > 0" by simp
    3.98 +  from 4 have cp: "real_of_int c > 0" by simp
    3.99    fix a
   3.100    let ?e = "Inum (a # bs) e"
   3.101 -  let ?z = "(- ?e) / real c"
   3.102 +  let ?z = "(- ?e) / real_of_int c"
   3.103    {
   3.104      fix x
   3.105      assume xz: "x < ?z"
   3.106 -    then have "(real c * x < - ?e)"
   3.107 +    then have "(real_of_int c * x < - ?e)"
   3.108        by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps)
   3.109 -    then have "real c * x + ?e < 0" by arith
   3.110 -    then have "real c * x + ?e \<noteq> 0" by simp
   3.111 +    then have "real_of_int c * x + ?e < 0" by arith
   3.112 +    then have "real_of_int c * x + ?e \<noteq> 0" by simp
   3.113      with xz have "?P ?z x (NEq (CN 0 c e))"
   3.114        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp
   3.115    }
   3.116 @@ -1316,16 +1316,16 @@
   3.117  next
   3.118    case (5 c e)
   3.119    from 5 have nb: "numbound0 e" by simp
   3.120 -  from 5 have cp: "real c > 0" by simp
   3.121 +  from 5 have cp: "real_of_int c > 0" by simp
   3.122    fix a
   3.123    let ?e="Inum (a#bs) e"
   3.124 -  let ?z = "(- ?e) / real c"
   3.125 +  let ?z = "(- ?e) / real_of_int c"
   3.126    {
   3.127      fix x
   3.128      assume xz: "x < ?z"
   3.129 -    then have "(real c * x < - ?e)"
   3.130 +    then have "(real_of_int c * x < - ?e)"
   3.131        by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps)
   3.132 -    then have "real c * x + ?e < 0" by arith
   3.133 +    then have "real_of_int c * x + ?e < 0" by arith
   3.134      with xz have "?P ?z x (Lt (CN 0 c e))"
   3.135        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"]  by simp
   3.136    }
   3.137 @@ -1334,16 +1334,16 @@
   3.138  next
   3.139    case (6 c e)
   3.140    from 6 have nb: "numbound0 e" by simp
   3.141 -  from lp 6 have cp: "real c > 0" by simp
   3.142 +  from lp 6 have cp: "real_of_int c > 0" by simp
   3.143    fix a
   3.144    let ?e = "Inum (a # bs) e"
   3.145 -  let ?z = "(- ?e) / real c"
   3.146 +  let ?z = "(- ?e) / real_of_int c"
   3.147    {
   3.148      fix x
   3.149      assume xz: "x < ?z"
   3.150 -    then have "(real c * x < - ?e)"
   3.151 +    then have "(real_of_int c * x < - ?e)"
   3.152        by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps)
   3.153 -    then have "real c * x + ?e < 0" by arith
   3.154 +    then have "real_of_int c * x + ?e < 0" by arith
   3.155      with xz have "?P ?z x (Le (CN 0 c e))"
   3.156        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp
   3.157    }
   3.158 @@ -1352,16 +1352,16 @@
   3.159  next
   3.160    case (7 c e)
   3.161    from 7 have nb: "numbound0 e" by simp
   3.162 -  from 7 have cp: "real c > 0" by simp
   3.163 +  from 7 have cp: "real_of_int c > 0" by simp
   3.164    fix a
   3.165    let ?e = "Inum (a # bs) e"
   3.166 -  let ?z = "(- ?e) / real c"
   3.167 +  let ?z = "(- ?e) / real_of_int c"
   3.168    {
   3.169      fix x
   3.170      assume xz: "x < ?z"
   3.171 -    then have "(real c * x < - ?e)"
   3.172 +    then have "(real_of_int c * x < - ?e)"
   3.173        by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps)
   3.174 -    then have "real c * x + ?e < 0" by arith
   3.175 +    then have "real_of_int c * x + ?e < 0" by arith
   3.176      with xz have "?P ?z x (Gt (CN 0 c e))"
   3.177        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp
   3.178    }
   3.179 @@ -1370,16 +1370,16 @@
   3.180  next
   3.181    case (8 c e)
   3.182    from 8 have nb: "numbound0 e" by simp
   3.183 -  from 8 have cp: "real c > 0" by simp
   3.184 +  from 8 have cp: "real_of_int c > 0" by simp
   3.185    fix a
   3.186    let ?e="Inum (a#bs) e"
   3.187 -  let ?z = "(- ?e) / real c"
   3.188 +  let ?z = "(- ?e) / real_of_int c"
   3.189    {
   3.190      fix x
   3.191      assume xz: "x < ?z"
   3.192 -    then have "(real c * x < - ?e)"
   3.193 +    then have "(real_of_int c * x < - ?e)"
   3.194        by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps)
   3.195 -    then have "real c * x + ?e < 0" by arith
   3.196 +    then have "real_of_int c * x + ?e < 0" by arith
   3.197      with xz have "?P ?z x (Ge (CN 0 c e))"
   3.198        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp
   3.199    }
   3.200 @@ -1408,17 +1408,17 @@
   3.201  next
   3.202    case (3 c e)
   3.203    from 3 have nb: "numbound0 e" by simp
   3.204 -  from 3 have cp: "real c > 0" by simp
   3.205 +  from 3 have cp: "real_of_int c > 0" by simp
   3.206    fix a
   3.207    let ?e = "Inum (a # bs) e"
   3.208 -  let ?z = "(- ?e) / real c"
   3.209 +  let ?z = "(- ?e) / real_of_int c"
   3.210    {
   3.211      fix x
   3.212      assume xz: "x > ?z"
   3.213      with mult_strict_right_mono [OF xz cp] cp
   3.214 -    have "(real c * x > - ?e)" by (simp add: ac_simps)
   3.215 -    then have "real c * x + ?e > 0" by arith
   3.216 -    then have "real c * x + ?e \<noteq> 0" by simp
   3.217 +    have "(real_of_int c * x > - ?e)" by (simp add: ac_simps)
   3.218 +    then have "real_of_int c * x + ?e > 0" by arith
   3.219 +    then have "real_of_int c * x + ?e \<noteq> 0" by simp
   3.220      with xz have "?P ?z x (Eq (CN 0 c e))"
   3.221        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp
   3.222    }
   3.223 @@ -1427,17 +1427,17 @@
   3.224  next
   3.225    case (4 c e)
   3.226    from 4 have nb: "numbound0 e" by simp
   3.227 -  from 4 have cp: "real c > 0" by simp
   3.228 +  from 4 have cp: "real_of_int c > 0" by simp
   3.229    fix a
   3.230    let ?e = "Inum (a # bs) e"
   3.231 -  let ?z = "(- ?e) / real c"
   3.232 +  let ?z = "(- ?e) / real_of_int c"
   3.233    {
   3.234      fix x
   3.235      assume xz: "x > ?z"
   3.236      with mult_strict_right_mono [OF xz cp] cp
   3.237 -    have "(real c * x > - ?e)" by (simp add: ac_simps)
   3.238 -    then have "real c * x + ?e > 0" by arith
   3.239 -    then have "real c * x + ?e \<noteq> 0" by simp
   3.240 +    have "(real_of_int c * x > - ?e)" by (simp add: ac_simps)
   3.241 +    then have "real_of_int c * x + ?e > 0" by arith
   3.242 +    then have "real_of_int c * x + ?e \<noteq> 0" by simp
   3.243      with xz have "?P ?z x (NEq (CN 0 c e))"
   3.244        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp
   3.245    }
   3.246 @@ -1446,16 +1446,16 @@
   3.247  next
   3.248    case (5 c e)
   3.249    from 5 have nb: "numbound0 e" by simp
   3.250 -  from 5 have cp: "real c > 0" by simp
   3.251 +  from 5 have cp: "real_of_int c > 0" by simp
   3.252    fix a
   3.253    let ?e = "Inum (a # bs) e"
   3.254 -  let ?z = "(- ?e) / real c"
   3.255 +  let ?z = "(- ?e) / real_of_int c"
   3.256    {
   3.257      fix x
   3.258      assume xz: "x > ?z"
   3.259      with mult_strict_right_mono [OF xz cp] cp
   3.260 -    have "(real c * x > - ?e)" by (simp add: ac_simps)
   3.261 -    then have "real c * x + ?e > 0" by arith
   3.262 +    have "(real_of_int c * x > - ?e)" by (simp add: ac_simps)
   3.263 +    then have "real_of_int c * x + ?e > 0" by arith
   3.264      with xz have "?P ?z x (Lt (CN 0 c e))"
   3.265        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp
   3.266    }
   3.267 @@ -1464,16 +1464,16 @@
   3.268  next
   3.269    case (6 c e)
   3.270    from 6 have nb: "numbound0 e" by simp
   3.271 -  from 6 have cp: "real c > 0" by simp
   3.272 +  from 6 have cp: "real_of_int c > 0" by simp
   3.273    fix a
   3.274    let ?e = "Inum (a # bs) e"
   3.275 -  let ?z = "(- ?e) / real c"
   3.276 +  let ?z = "(- ?e) / real_of_int c"
   3.277    {
   3.278      fix x
   3.279      assume xz: "x > ?z"
   3.280      with mult_strict_right_mono [OF xz cp] cp
   3.281 -    have "(real c * x > - ?e)" by (simp add: ac_simps)
   3.282 -    then have "real c * x + ?e > 0" by arith
   3.283 +    have "(real_of_int c * x > - ?e)" by (simp add: ac_simps)
   3.284 +    then have "real_of_int c * x + ?e > 0" by arith
   3.285      with xz have "?P ?z x (Le (CN 0 c e))"
   3.286        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp
   3.287    }
   3.288 @@ -1482,16 +1482,16 @@
   3.289  next
   3.290    case (7 c e)
   3.291    from 7 have nb: "numbound0 e" by simp
   3.292 -  from 7 have cp: "real c > 0" by simp
   3.293 +  from 7 have cp: "real_of_int c > 0" by simp
   3.294    fix a
   3.295    let ?e = "Inum (a # bs) e"
   3.296 -  let ?z = "(- ?e) / real c"
   3.297 +  let ?z = "(- ?e) / real_of_int c"
   3.298    {
   3.299      fix x
   3.300      assume xz: "x > ?z"
   3.301      with mult_strict_right_mono [OF xz cp] cp
   3.302 -    have "(real c * x > - ?e)" by (simp add: ac_simps)
   3.303 -    then have "real c * x + ?e > 0" by arith
   3.304 +    have "(real_of_int c * x > - ?e)" by (simp add: ac_simps)
   3.305 +    then have "real_of_int c * x + ?e > 0" by arith
   3.306      with xz have "?P ?z x (Gt (CN 0 c e))"
   3.307        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp
   3.308    }
   3.309 @@ -1500,16 +1500,16 @@
   3.310  next
   3.311    case (8 c e)
   3.312    from 8 have nb: "numbound0 e" by simp
   3.313 -  from 8 have cp: "real c > 0" by simp
   3.314 +  from 8 have cp: "real_of_int c > 0" by simp
   3.315    fix a
   3.316    let ?e="Inum (a#bs) e"
   3.317 -  let ?z = "(- ?e) / real c"
   3.318 +  let ?z = "(- ?e) / real_of_int c"
   3.319    {
   3.320      fix x
   3.321      assume xz: "x > ?z"
   3.322      with mult_strict_right_mono [OF xz cp] cp
   3.323 -    have "(real c * x > - ?e)" by (simp add: ac_simps)
   3.324 -    then have "real c * x + ?e > 0" by arith
   3.325 +    have "(real_of_int c * x > - ?e)" by (simp add: ac_simps)
   3.326 +    then have "real_of_int c * x + ?e > 0" by arith
   3.327      with xz have "?P ?z x (Ge (CN 0 c e))"
   3.328        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp
   3.329    }
   3.330 @@ -1581,10 +1581,10 @@
   3.331  
   3.332  lemma usubst_I:
   3.333    assumes lp: "isrlfm p"
   3.334 -    and np: "real n > 0"
   3.335 +    and np: "real_of_int n > 0"
   3.336      and nbt: "numbound0 t"
   3.337    shows "(Ifm (x # bs) (usubst p (t,n)) =
   3.338 -    Ifm (((Inum (x # bs) t) / (real n)) # bs) p) \<and> bound0 (usubst p (t, n))"
   3.339 +    Ifm (((Inum (x # bs) t) / (real_of_int n)) # bs) p) \<and> bound0 (usubst p (t, n))"
   3.340    (is "(?I x (usubst p (t, n)) = ?I ?u p) \<and> ?B p"
   3.341     is "(_ = ?I (?t/?n) p) \<and> _"
   3.342     is "(_ = ?I (?N x t /_) p) \<and> _")
   3.343 @@ -1592,65 +1592,65 @@
   3.344  proof (induct p rule: usubst.induct)
   3.345    case (5 c e)
   3.346    with assms have cp: "c > 0" and nb: "numbound0 e" by simp_all
   3.347 -  have "?I ?u (Lt (CN 0 c e)) \<longleftrightarrow> real c * (?t / ?n) + ?N x e < 0"
   3.348 +  have "?I ?u (Lt (CN 0 c e)) \<longleftrightarrow> real_of_int c * (?t / ?n) + ?N x e < 0"
   3.349      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
   3.350 -  also have "\<dots> \<longleftrightarrow> ?n * (real c * (?t / ?n)) + ?n*(?N x e) < 0"
   3.351 -    by (simp only: pos_less_divide_eq[OF np, where a="real c *(?t/?n) + (?N x e)"
   3.352 +  also have "\<dots> \<longleftrightarrow> ?n * (real_of_int c * (?t / ?n)) + ?n*(?N x e) < 0"
   3.353 +    by (simp only: pos_less_divide_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)"
   3.354        and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
   3.355 -  also have "\<dots> \<longleftrightarrow> real c * ?t + ?n * (?N x e) < 0" using np by simp
   3.356 +  also have "\<dots> \<longleftrightarrow> real_of_int c * ?t + ?n * (?N x e) < 0" using np by simp
   3.357    finally show ?case using nbt nb by (simp add: algebra_simps)
   3.358  next
   3.359    case (6 c e)
   3.360    with assms have cp: "c > 0" and nb: "numbound0 e" by simp_all
   3.361 -  have "?I ?u (Le (CN 0 c e)) \<longleftrightarrow> real c * (?t / ?n) + ?N x e \<le> 0"
   3.362 +  have "?I ?u (Le (CN 0 c e)) \<longleftrightarrow> real_of_int c * (?t / ?n) + ?N x e \<le> 0"
   3.363      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
   3.364 -  also have "\<dots> = (?n*(real c *(?t/?n)) + ?n*(?N x e) \<le> 0)"
   3.365 -    by (simp only: pos_le_divide_eq[OF np, where a="real c *(?t/?n) + (?N x e)"
   3.366 +  also have "\<dots> = (?n*(real_of_int c *(?t/?n)) + ?n*(?N x e) \<le> 0)"
   3.367 +    by (simp only: pos_le_divide_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)"
   3.368        and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
   3.369 -  also have "\<dots> = (real c *?t + ?n* (?N x e) \<le> 0)" using np by simp
   3.370 +  also have "\<dots> = (real_of_int c *?t + ?n* (?N x e) \<le> 0)" using np by simp
   3.371    finally show ?case using nbt nb by (simp add: algebra_simps)
   3.372  next
   3.373    case (7 c e)
   3.374    with assms have cp: "c >0" and nb: "numbound0 e" by simp_all
   3.375 -  have "?I ?u (Gt (CN 0 c e)) \<longleftrightarrow> real c *(?t / ?n) + ?N x e > 0"
   3.376 +  have "?I ?u (Gt (CN 0 c e)) \<longleftrightarrow> real_of_int c *(?t / ?n) + ?N x e > 0"
   3.377      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
   3.378 -  also have "\<dots> \<longleftrightarrow> ?n * (real c * (?t / ?n)) + ?n * ?N x e > 0"
   3.379 -    by (simp only: pos_divide_less_eq[OF np, where a="real c *(?t/?n) + (?N x e)"
   3.380 +  also have "\<dots> \<longleftrightarrow> ?n * (real_of_int c * (?t / ?n)) + ?n * ?N x e > 0"
   3.381 +    by (simp only: pos_divide_less_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)"
   3.382        and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
   3.383 -  also have "\<dots> \<longleftrightarrow> real c * ?t + ?n * ?N x e > 0" using np by simp
   3.384 +  also have "\<dots> \<longleftrightarrow> real_of_int c * ?t + ?n * ?N x e > 0" using np by simp
   3.385    finally show ?case using nbt nb by (simp add: algebra_simps)
   3.386  next
   3.387    case (8 c e)
   3.388    with assms have cp: "c > 0" and nb: "numbound0 e" by simp_all
   3.389 -  have "?I ?u (Ge (CN 0 c e)) \<longleftrightarrow> real c * (?t / ?n) + ?N x e \<ge> 0"
   3.390 +  have "?I ?u (Ge (CN 0 c e)) \<longleftrightarrow> real_of_int c * (?t / ?n) + ?N x e \<ge> 0"
   3.391      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
   3.392 -  also have "\<dots> \<longleftrightarrow> ?n * (real c * (?t / ?n)) + ?n * ?N x e \<ge> 0"
   3.393 -    by (simp only: pos_divide_le_eq[OF np, where a="real c *(?t/?n) + (?N x e)"
   3.394 +  also have "\<dots> \<longleftrightarrow> ?n * (real_of_int c * (?t / ?n)) + ?n * ?N x e \<ge> 0"
   3.395 +    by (simp only: pos_divide_le_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)"
   3.396        and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
   3.397 -  also have "\<dots> \<longleftrightarrow> real c * ?t + ?n * ?N x e \<ge> 0" using np by simp
   3.398 +  also have "\<dots> \<longleftrightarrow> real_of_int c * ?t + ?n * ?N x e \<ge> 0" using np by simp
   3.399    finally show ?case using nbt nb by (simp add: algebra_simps)
   3.400  next
   3.401    case (3 c e)
   3.402    with assms have cp: "c > 0" and nb: "numbound0 e" by simp_all
   3.403 -  from np have np: "real n \<noteq> 0" by simp
   3.404 -  have "?I ?u (Eq (CN 0 c e)) \<longleftrightarrow> real c * (?t / ?n) + ?N x e = 0"
   3.405 +  from np have np: "real_of_int n \<noteq> 0" by simp
   3.406 +  have "?I ?u (Eq (CN 0 c e)) \<longleftrightarrow> real_of_int c * (?t / ?n) + ?N x e = 0"
   3.407      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
   3.408 -  also have "\<dots> \<longleftrightarrow> ?n * (real c * (?t / ?n)) + ?n * ?N x e = 0"
   3.409 -    by (simp only: nonzero_eq_divide_eq[OF np, where a="real c *(?t/?n) + (?N x e)"
   3.410 +  also have "\<dots> \<longleftrightarrow> ?n * (real_of_int c * (?t / ?n)) + ?n * ?N x e = 0"
   3.411 +    by (simp only: nonzero_eq_divide_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)"
   3.412        and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
   3.413 -  also have "\<dots> \<longleftrightarrow> real c * ?t + ?n * ?N x e = 0" using np by simp
   3.414 +  also have "\<dots> \<longleftrightarrow> real_of_int c * ?t + ?n * ?N x e = 0" using np by simp
   3.415    finally show ?case using nbt nb by (simp add: algebra_simps)
   3.416  next
   3.417    case (4 c e) with assms have cp: "c >0" and nb: "numbound0 e" by simp_all
   3.418 -  from np have np: "real n \<noteq> 0" by simp
   3.419 -  have "?I ?u (NEq (CN 0 c e)) \<longleftrightarrow> real c * (?t / ?n) + ?N x e \<noteq> 0"
   3.420 +  from np have np: "real_of_int n \<noteq> 0" by simp
   3.421 +  have "?I ?u (NEq (CN 0 c e)) \<longleftrightarrow> real_of_int c * (?t / ?n) + ?N x e \<noteq> 0"
   3.422      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
   3.423 -  also have "\<dots> \<longleftrightarrow> ?n * (real c * (?t / ?n)) + ?n * ?N x e \<noteq> 0"
   3.424 -    by (simp only: nonzero_eq_divide_eq[OF np, where a="real c *(?t/?n) + (?N x e)"
   3.425 +  also have "\<dots> \<longleftrightarrow> ?n * (real_of_int c * (?t / ?n)) + ?n * ?N x e \<noteq> 0"
   3.426 +    by (simp only: nonzero_eq_divide_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)"
   3.427        and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
   3.428 -  also have "\<dots> \<longleftrightarrow> real c * ?t + ?n * ?N x e \<noteq> 0" using np by simp
   3.429 +  also have "\<dots> \<longleftrightarrow> real_of_int c * ?t + ?n * ?N x e \<noteq> 0" using np by simp
   3.430    finally show ?case using nbt nb by (simp add: algebra_simps)
   3.431 -qed(simp_all add: nbt numbound0_I[where bs ="bs" and b="(Inum (x#bs) t)/ real n" and b'="x"])
   3.432 +qed(simp_all add: nbt numbound0_I[where bs ="bs" and b="(Inum (x#bs) t)/ real_of_int n" and b'="x"])
   3.433  
   3.434  lemma uset_l:
   3.435    assumes lp: "isrlfm p"
   3.436 @@ -1661,18 +1661,18 @@
   3.437    assumes lp: "isrlfm p"
   3.438      and nmi: "\<not> (Ifm (a # bs) (minusinf p))" (is "\<not> (Ifm (a # bs) (?M p))")
   3.439      and ex: "Ifm (x#bs) p" (is "?I x p")
   3.440 -  shows "\<exists>(s,m) \<in> set (uset p). x \<ge> Inum (a#bs) s / real m"
   3.441 -    (is "\<exists>(s,m) \<in> ?U p. x \<ge> ?N a s / real m")
   3.442 +  shows "\<exists>(s,m) \<in> set (uset p). x \<ge> Inum (a#bs) s / real_of_int m"
   3.443 +    (is "\<exists>(s,m) \<in> ?U p. x \<ge> ?N a s / real_of_int m")
   3.444  proof -
   3.445 -  have "\<exists>(s,m) \<in> set (uset p). real m * x \<ge> Inum (a#bs) s"
   3.446 -    (is "\<exists>(s,m) \<in> ?U p. real m *x \<ge> ?N a s")
   3.447 +  have "\<exists>(s,m) \<in> set (uset p). real_of_int m * x \<ge> Inum (a#bs) s"
   3.448 +    (is "\<exists>(s,m) \<in> ?U p. real_of_int m *x \<ge> ?N a s")
   3.449      using lp nmi ex
   3.450      by (induct p rule: minusinf.induct) (auto simp add:numbound0_I[where bs="bs" and b="a" and b'="x"])
   3.451 -  then obtain s m where smU: "(s,m) \<in> set (uset p)" and mx: "real m * x \<ge> ?N a s"
   3.452 +  then obtain s m where smU: "(s,m) \<in> set (uset p)" and mx: "real_of_int m * x \<ge> ?N a s"
   3.453      by blast
   3.454 -  from uset_l[OF lp] smU have mp: "real m > 0"
   3.455 +  from uset_l[OF lp] smU have mp: "real_of_int m > 0"
   3.456      by auto
   3.457 -  from pos_divide_le_eq[OF mp, where a="x" and b="?N a s", symmetric] mx have "x \<ge> ?N a s / real m"
   3.458 +  from pos_divide_le_eq[OF mp, where a="x" and b="?N a s", symmetric] mx have "x \<ge> ?N a s / real_of_int m"
   3.459      by (auto simp add: mult.commute)
   3.460    then show ?thesis
   3.461      using smU by auto
   3.462 @@ -1682,19 +1682,19 @@
   3.463    assumes lp: "isrlfm p"
   3.464      and nmi: "\<not> (Ifm (a # bs) (plusinf p))" (is "\<not> (Ifm (a # bs) (?M p))")
   3.465      and ex: "Ifm (x # bs) p" (is "?I x p")
   3.466 -  shows "\<exists>(s,m) \<in> set (uset p). x \<le> Inum (a#bs) s / real m"
   3.467 -    (is "\<exists>(s,m) \<in> ?U p. x \<le> ?N a s / real m")
   3.468 +  shows "\<exists>(s,m) \<in> set (uset p). x \<le> Inum (a#bs) s / real_of_int m"
   3.469 +    (is "\<exists>(s,m) \<in> ?U p. x \<le> ?N a s / real_of_int m")
   3.470  proof -
   3.471 -  have "\<exists>(s,m) \<in> set (uset p). real m * x \<le> Inum (a#bs) s"
   3.472 -    (is "\<exists>(s,m) \<in> ?U p. real m *x \<le> ?N a s")
   3.473 +  have "\<exists>(s,m) \<in> set (uset p). real_of_int m * x \<le> Inum (a#bs) s"
   3.474 +    (is "\<exists>(s,m) \<in> ?U p. real_of_int m *x \<le> ?N a s")
   3.475      using lp nmi ex
   3.476      by (induct p rule: minusinf.induct)
   3.477        (auto simp add:numbound0_I[where bs="bs" and b="a" and b'="x"])
   3.478 -  then obtain s m where smU: "(s,m) \<in> set (uset p)" and mx: "real m * x \<le> ?N a s"
   3.479 +  then obtain s m where smU: "(s,m) \<in> set (uset p)" and mx: "real_of_int m * x \<le> ?N a s"
   3.480      by blast
   3.481 -  from uset_l[OF lp] smU have mp: "real m > 0"
   3.482 +  from uset_l[OF lp] smU have mp: "real_of_int m > 0"
   3.483      by auto
   3.484 -  from pos_le_divide_eq[OF mp, where a="x" and b="?N a s", symmetric] mx have "x \<le> ?N a s / real m"
   3.485 +  from pos_le_divide_eq[OF mp, where a="x" and b="?N a s", symmetric] mx have "x \<le> ?N a s / real_of_int m"
   3.486      by (auto simp add: mult.commute)
   3.487    then show ?thesis
   3.488      using smU by auto
   3.489 @@ -1702,8 +1702,8 @@
   3.490  
   3.491  lemma lin_dense:
   3.492    assumes lp: "isrlfm p"
   3.493 -    and noS: "\<forall>t. l < t \<and> t< u \<longrightarrow> t \<notin> (\<lambda>(t,n). Inum (x#bs) t / real n) ` set (uset p)"
   3.494 -      (is "\<forall>t. _ \<and> _ \<longrightarrow> t \<notin> (\<lambda>(t,n). ?N x t / real n ) ` (?U p)")
   3.495 +    and noS: "\<forall>t. l < t \<and> t< u \<longrightarrow> t \<notin> (\<lambda>(t,n). Inum (x#bs) t / real_of_int n) ` set (uset p)"
   3.496 +      (is "\<forall>t. _ \<and> _ \<longrightarrow> t \<notin> (\<lambda>(t,n). ?N x t / real_of_int n ) ` (?U p)")
   3.497      and lx: "l < x"
   3.498      and xu:"x < u"
   3.499      and px:" Ifm (x#bs) p"
   3.500 @@ -1712,163 +1712,163 @@
   3.501    using lp px noS
   3.502  proof (induct p rule: isrlfm.induct)
   3.503    case (5 c e)
   3.504 -  then have cp: "real c > 0" and nb: "numbound0 e"
   3.505 +  then have cp: "real_of_int c > 0" and nb: "numbound0 e"
   3.506      by simp_all
   3.507 -  from 5 have "x * real c + ?N x e < 0"
   3.508 +  from 5 have "x * real_of_int c + ?N x e < 0"
   3.509      by (simp add: algebra_simps)
   3.510 -  then have pxc: "x < (- ?N x e) / real c"
   3.511 +  then have pxc: "x < (- ?N x e) / real_of_int c"
   3.512      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="-?N x e"])
   3.513 -  from 5 have noSc:"\<forall>t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real c"
   3.514 +  from 5 have noSc:"\<forall>t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real_of_int c"
   3.515      by auto
   3.516 -  with ly yu have yne: "y \<noteq> - ?N x e / real c"
   3.517 +  with ly yu have yne: "y \<noteq> - ?N x e / real_of_int c"
   3.518      by auto
   3.519 -  then consider "y < (-?N x e)/ real c" | "y > (- ?N x e) / real c"
   3.520 +  then consider "y < (-?N x e)/ real_of_int c" | "y > (- ?N x e) / real_of_int c"
   3.521      by atomize_elim auto
   3.522    then show ?case
   3.523    proof cases
   3.524      case 1
   3.525 -    then have "y * real c < - ?N x e"
   3.526 +    then have "y * real_of_int c < - ?N x e"
   3.527        by (simp add: pos_less_divide_eq[OF cp, where a="y" and b="-?N x e", symmetric])
   3.528 -    then have "real c * y + ?N x e < 0"
   3.529 +    then have "real_of_int c * y + ?N x e < 0"
   3.530        by (simp add: algebra_simps)
   3.531      then show ?thesis
   3.532        using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] by simp
   3.533    next
   3.534      case 2
   3.535 -    with yu have eu: "u > (- ?N x e) / real c"
   3.536 +    with yu have eu: "u > (- ?N x e) / real_of_int c"
   3.537        by auto
   3.538 -    with noSc ly yu have "(- ?N x e) / real c \<le> l"
   3.539 -      by (cases "(- ?N x e) / real c > l") auto
   3.540 +    with noSc ly yu have "(- ?N x e) / real_of_int c \<le> l"
   3.541 +      by (cases "(- ?N x e) / real_of_int c > l") auto
   3.542      with lx pxc have False
   3.543        by auto
   3.544      then show ?thesis ..
   3.545    qed
   3.546  next
   3.547    case (6 c e)
   3.548 -  then have cp: "real c > 0" and nb: "numbound0 e"
   3.549 +  then have cp: "real_of_int c > 0" and nb: "numbound0 e"
   3.550      by simp_all
   3.551 -  from 6 have "x * real c + ?N x e \<le> 0"
   3.552 +  from 6 have "x * real_of_int c + ?N x e \<le> 0"
   3.553      by (simp add: algebra_simps)
   3.554 -  then have pxc: "x \<le> (- ?N x e) / real c"
   3.555 +  then have pxc: "x \<le> (- ?N x e) / real_of_int c"
   3.556      by (simp only: pos_le_divide_eq[OF cp, where a="x" and b="-?N x e"])
   3.557 -  from 6 have noSc:"\<forall>t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real c"
   3.558 +  from 6 have noSc:"\<forall>t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real_of_int c"
   3.559      by auto
   3.560 -  with ly yu have yne: "y \<noteq> - ?N x e / real c"
   3.561 +  with ly yu have yne: "y \<noteq> - ?N x e / real_of_int c"
   3.562      by auto
   3.563 -  then consider "y < (- ?N x e) / real c" | "y > (-?N x e) / real c"
   3.564 +  then consider "y < (- ?N x e) / real_of_int c" | "y > (-?N x e) / real_of_int c"
   3.565      by atomize_elim auto
   3.566    then show ?case
   3.567    proof cases
   3.568      case 1
   3.569 -    then have "y * real c < - ?N x e"
   3.570 +    then have "y * real_of_int c < - ?N x e"
   3.571        by (simp add: pos_less_divide_eq[OF cp, where a="y" and b="-?N x e", symmetric])
   3.572 -    then have "real c * y + ?N x e < 0"
   3.573 +    then have "real_of_int c * y + ?N x e < 0"
   3.574        by (simp add: algebra_simps)
   3.575      then show ?thesis
   3.576        using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] by simp
   3.577    next
   3.578      case 2
   3.579 -    with yu have eu: "u > (- ?N x e) / real c"
   3.580 +    with yu have eu: "u > (- ?N x e) / real_of_int c"
   3.581        by auto
   3.582 -    with noSc ly yu have "(- ?N x e) / real c \<le> l"
   3.583 -      by (cases "(- ?N x e) / real c > l") auto
   3.584 +    with noSc ly yu have "(- ?N x e) / real_of_int c \<le> l"
   3.585 +      by (cases "(- ?N x e) / real_of_int c > l") auto
   3.586      with lx pxc have False
   3.587        by auto
   3.588      then show ?thesis ..
   3.589    qed
   3.590  next
   3.591    case (7 c e)
   3.592 -  then have cp: "real c > 0" and nb: "numbound0 e"
   3.593 +  then have cp: "real_of_int c > 0" and nb: "numbound0 e"
   3.594      by simp_all
   3.595 -  from 7 have "x * real c + ?N x e > 0"
   3.596 +  from 7 have "x * real_of_int c + ?N x e > 0"
   3.597      by (simp add: algebra_simps)
   3.598 -  then have pxc: "x > (- ?N x e) / real c"
   3.599 +  then have pxc: "x > (- ?N x e) / real_of_int c"
   3.600      by (simp only: pos_divide_less_eq[OF cp, where a="x" and b="-?N x e"])
   3.601 -  from 7 have noSc: "\<forall>t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real c"
   3.602 +  from 7 have noSc: "\<forall>t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real_of_int c"
   3.603      by auto
   3.604 -  with ly yu have yne: "y \<noteq> - ?N x e / real c"
   3.605 +  with ly yu have yne: "y \<noteq> - ?N x e / real_of_int c"
   3.606      by auto
   3.607 -  then consider "y > (- ?N x e) / real c" | "y < (-?N x e) / real c"
   3.608 +  then consider "y > (- ?N x e) / real_of_int c" | "y < (-?N x e) / real_of_int c"
   3.609      by atomize_elim auto
   3.610    then show ?case
   3.611    proof cases
   3.612      case 1
   3.613 -    then have "y * real c > - ?N x e"
   3.614 +    then have "y * real_of_int c > - ?N x e"
   3.615        by (simp add: pos_divide_less_eq[OF cp, where a="y" and b="-?N x e", symmetric])
   3.616 -    then have "real c * y + ?N x e > 0"
   3.617 +    then have "real_of_int c * y + ?N x e > 0"
   3.618        by (simp add: algebra_simps)
   3.619      then show ?thesis
   3.620        using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] by simp
   3.621    next
   3.622      case 2
   3.623 -    with ly have eu: "l < (- ?N x e) / real c"
   3.624 +    with ly have eu: "l < (- ?N x e) / real_of_int c"
   3.625        by auto
   3.626 -    with noSc ly yu have "(- ?N x e) / real c \<ge> u"
   3.627 -      by (cases "(- ?N x e) / real c > l") auto
   3.628 +    with noSc ly yu have "(- ?N x e) / real_of_int c \<ge> u"
   3.629 +      by (cases "(- ?N x e) / real_of_int c > l") auto
   3.630      with xu pxc have False by auto
   3.631      then show ?thesis ..
   3.632    qed
   3.633  next
   3.634    case (8 c e)
   3.635 -  then have cp: "real c > 0" and nb: "numbound0 e"
   3.636 +  then have cp: "real_of_int c > 0" and nb: "numbound0 e"
   3.637      by simp_all
   3.638 -  from 8 have "x * real c + ?N x e \<ge> 0"
   3.639 +  from 8 have "x * real_of_int c + ?N x e \<ge> 0"
   3.640      by (simp add: algebra_simps)
   3.641 -  then have pxc: "x \<ge> (- ?N x e) / real c"
   3.642 +  then have pxc: "x \<ge> (- ?N x e) / real_of_int c"
   3.643      by (simp only: pos_divide_le_eq[OF cp, where a="x" and b="-?N x e"])
   3.644 -  from 8 have noSc:"\<forall>t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real c"
   3.645 +  from 8 have noSc:"\<forall>t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real_of_int c"
   3.646      by auto
   3.647 -  with ly yu have yne: "y \<noteq> - ?N x e / real c"
   3.648 +  with ly yu have yne: "y \<noteq> - ?N x e / real_of_int c"
   3.649      by auto
   3.650 -  then consider "y > (- ?N x e) / real c" | "y < (-?N x e) / real c"
   3.651 +  then consider "y > (- ?N x e) / real_of_int c" | "y < (-?N x e) / real_of_int c"
   3.652      by atomize_elim auto
   3.653    then show ?case
   3.654    proof cases
   3.655      case 1
   3.656 -    then have "y * real c > - ?N x e"
   3.657 +    then have "y * real_of_int c > - ?N x e"
   3.658        by (simp add: pos_divide_less_eq[OF cp, where a="y" and b="-?N x e", symmetric])
   3.659 -    then have "real c * y + ?N x e > 0" by (simp add: algebra_simps)
   3.660 +    then have "real_of_int c * y + ?N x e > 0" by (simp add: algebra_simps)
   3.661      then show ?thesis
   3.662        using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] by simp
   3.663    next
   3.664      case 2
   3.665 -    with ly have eu: "l < (- ?N x e) / real c"
   3.666 +    with ly have eu: "l < (- ?N x e) / real_of_int c"
   3.667        by auto
   3.668 -    with noSc ly yu have "(- ?N x e) / real c \<ge> u"
   3.669 -      by (cases "(- ?N x e) / real c > l") auto
   3.670 +    with noSc ly yu have "(- ?N x e) / real_of_int c \<ge> u"
   3.671 +      by (cases "(- ?N x e) / real_of_int c > l") auto
   3.672      with xu pxc have False
   3.673        by auto
   3.674      then show ?thesis ..
   3.675    qed
   3.676  next
   3.677    case (3 c e)
   3.678 -  then have cp: "real c > 0" and nb: "numbound0 e"
   3.679 +  then have cp: "real_of_int c > 0" and nb: "numbound0 e"
   3.680      by simp_all
   3.681 -  from cp have cnz: "real c \<noteq> 0"
   3.682 +  from cp have cnz: "real_of_int c \<noteq> 0"
   3.683      by simp
   3.684 -  from 3 have "x * real c + ?N x e = 0"
   3.685 +  from 3 have "x * real_of_int c + ?N x e = 0"
   3.686      by (simp add: algebra_simps)
   3.687 -  then have pxc: "x = (- ?N x e) / real c"
   3.688 +  then have pxc: "x = (- ?N x e) / real_of_int c"
   3.689      by (simp only: nonzero_eq_divide_eq[OF cnz, where a="x" and b="-?N x e"])
   3.690 -  from 3 have noSc:"\<forall>t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real c"
   3.691 +  from 3 have noSc:"\<forall>t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real_of_int c"
   3.692      by auto
   3.693 -  with lx xu have yne: "x \<noteq> - ?N x e / real c"
   3.694 +  with lx xu have yne: "x \<noteq> - ?N x e / real_of_int c"
   3.695      by auto
   3.696    with pxc show ?case
   3.697      by simp
   3.698  next
   3.699    case (4 c e)
   3.700 -  then have cp: "real c > 0" and nb: "numbound0 e"
   3.701 +  then have cp: "real_of_int c > 0" and nb: "numbound0 e"
   3.702      by simp_all
   3.703 -  from cp have cnz: "real c \<noteq> 0"
   3.704 +  from cp have cnz: "real_of_int c \<noteq> 0"
   3.705      by simp
   3.706 -  from 4 have noSc:"\<forall>t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real c"
   3.707 +  from 4 have noSc:"\<forall>t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real_of_int c"
   3.708      by auto
   3.709 -  with ly yu have yne: "y \<noteq> - ?N x e / real c"
   3.710 +  with ly yu have yne: "y \<noteq> - ?N x e / real_of_int c"
   3.711      by auto
   3.712 -  then have "y* real c \<noteq> -?N x e"
   3.713 +  then have "y* real_of_int c \<noteq> -?N x e"
   3.714      by (simp only: nonzero_eq_divide_eq[OF cnz, where a="y" and b="-?N x e"]) simp
   3.715 -  then have "y* real c + ?N x e \<noteq> 0"
   3.716 +  then have "y* real_of_int c + ?N x e \<noteq> 0"
   3.717      by (simp add: algebra_simps)
   3.718    then show ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"]
   3.719      by (simp add: algebra_simps)
   3.720 @@ -1947,7 +1947,7 @@
   3.721      and npi: "\<not> (Ifm (x # bs) (plusinf p))"  (is "\<not> (Ifm (x # bs) (?P p))")
   3.722      and ex: "\<exists>x. Ifm (x # bs) p"  (is "\<exists>x. ?I x p")
   3.723    shows "\<exists>(l,n) \<in> set (uset p). \<exists>(s,m) \<in> set (uset p).
   3.724 -    ?I ((Inum (x#bs) l / real n + Inum (x#bs) s / real m) / 2) p"
   3.725 +    ?I ((Inum (x#bs) l / real_of_int n + Inum (x#bs) s / real_of_int m) / 2) p"
   3.726  proof -
   3.727    let ?N = "\<lambda>x t. Inum (x # bs) t"
   3.728    let ?U = "set (uset p)"
   3.729 @@ -1959,22 +1959,22 @@
   3.730    from bound0_I[OF rplusinf_bound0[OF lp], where bs="bs" and b="x" and b'="a"] npi
   3.731    have npi': "\<not> (?I a (?P p))"
   3.732      by simp
   3.733 -  have "\<exists>(l,n) \<in> set (uset p). \<exists>(s,m) \<in> set (uset p). ?I ((?N a l/real n + ?N a s /real m) / 2) p"
   3.734 +  have "\<exists>(l,n) \<in> set (uset p). \<exists>(s,m) \<in> set (uset p). ?I ((?N a l/real_of_int n + ?N a s /real_of_int m) / 2) p"
   3.735    proof -
   3.736 -    let ?M = "(\<lambda>(t,c). ?N a t / real c) ` ?U"
   3.737 +    let ?M = "(\<lambda>(t,c). ?N a t / real_of_int c) ` ?U"
   3.738      have fM: "finite ?M"
   3.739        by auto
   3.740      from rminusinf_uset[OF lp nmi pa] rplusinf_uset[OF lp npi pa]
   3.741 -    have "\<exists>(l,n) \<in> set (uset p). \<exists>(s,m) \<in> set (uset p). a \<le> ?N x l / real n \<and> a \<ge> ?N x s / real m"
   3.742 +    have "\<exists>(l,n) \<in> set (uset p). \<exists>(s,m) \<in> set (uset p). a \<le> ?N x l / real_of_int n \<and> a \<ge> ?N x s / real_of_int m"
   3.743        by blast
   3.744      then obtain "t" "n" "s" "m"
   3.745        where tnU: "(t,n) \<in> ?U"
   3.746          and smU: "(s,m) \<in> ?U"
   3.747 -        and xs1: "a \<le> ?N x s / real m"
   3.748 -        and tx1: "a \<ge> ?N x t / real n"
   3.749 +        and xs1: "a \<le> ?N x s / real_of_int m"
   3.750 +        and tx1: "a \<ge> ?N x t / real_of_int n"
   3.751        by blast
   3.752      from uset_l[OF lp] tnU smU numbound0_I[where bs="bs" and b="x" and b'="a"] xs1 tx1
   3.753 -    have xs: "a \<le> ?N a s / real m" and tx: "a \<ge> ?N a t / real n"
   3.754 +    have xs: "a \<le> ?N a s / real_of_int m" and tx: "a \<ge> ?N a t / real_of_int n"
   3.755        by auto
   3.756      from tnU have Mne: "?M \<noteq> {}"
   3.757        by auto
   3.758 @@ -1986,19 +1986,19 @@
   3.759        using fM Mne by simp
   3.760      have uinM: "?u \<in> ?M"
   3.761        using fM Mne by simp
   3.762 -    have tnM: "?N a t / real n \<in> ?M"
   3.763 +    have tnM: "?N a t / real_of_int n \<in> ?M"
   3.764        using tnU by auto
   3.765 -    have smM: "?N a s / real m \<in> ?M"
   3.766 +    have smM: "?N a s / real_of_int m \<in> ?M"
   3.767        using smU by auto
   3.768      have lM: "\<forall>t\<in> ?M. ?l \<le> t"
   3.769        using Mne fM by auto
   3.770      have Mu: "\<forall>t\<in> ?M. t \<le> ?u"
   3.771        using Mne fM by auto
   3.772 -    have "?l \<le> ?N a t / real n"
   3.773 +    have "?l \<le> ?N a t / real_of_int n"
   3.774        using tnM Mne by simp
   3.775      then have lx: "?l \<le> a"
   3.776        using tx by simp
   3.777 -    have "?N a s / real m \<le> ?u"
   3.778 +    have "?N a s / real_of_int m \<le> ?u"
   3.779        using smM Mne by simp
   3.780      then have xu: "a \<le> ?u"
   3.781        using xs by simp
   3.782 @@ -2010,13 +2010,13 @@
   3.783      proof cases
   3.784        case 1
   3.785        note um = \<open>u \<in> ?M\<close> and pu = \<open>?I u p\<close>
   3.786 -      then have "\<exists>(tu,nu) \<in> ?U. u = ?N a tu / real nu"
   3.787 +      then have "\<exists>(tu,nu) \<in> ?U. u = ?N a tu / real_of_int nu"
   3.788          by auto
   3.789 -      then obtain tu nu where tuU: "(tu, nu) \<in> ?U" and tuu: "u= ?N a tu / real nu"
   3.790 +      then obtain tu nu where tuU: "(tu, nu) \<in> ?U" and tuu: "u= ?N a tu / real_of_int nu"
   3.791          by blast
   3.792        have "(u + u) / 2 = u"
   3.793          by auto
   3.794 -      with pu tuu have "?I (((?N a tu / real nu) + (?N a tu / real nu)) / 2) p"
   3.795 +      with pu tuu have "?I (((?N a tu / real_of_int nu) + (?N a tu / real_of_int nu)) / 2) p"
   3.796          by simp
   3.797        with tuU show ?thesis by blast
   3.798      next
   3.799 @@ -2024,13 +2024,13 @@
   3.800        note t1M = \<open>t1 \<in> ?M\<close> and t2M = \<open>t2\<in> ?M\<close>
   3.801          and noM = \<open>\<forall>y. t1 < y \<and> y < t2 \<longrightarrow> y \<notin> ?M\<close>
   3.802          and t1x = \<open>t1 < a\<close> and xt2 = \<open>a < t2\<close> and px = \<open>?I a p\<close>
   3.803 -      from t1M have "\<exists>(t1u,t1n) \<in> ?U. t1 = ?N a t1u / real t1n"
   3.804 +      from t1M have "\<exists>(t1u,t1n) \<in> ?U. t1 = ?N a t1u / real_of_int t1n"
   3.805          by auto
   3.806 -      then obtain t1u t1n where t1uU: "(t1u, t1n) \<in> ?U" and t1u: "t1 = ?N a t1u / real t1n"
   3.807 +      then obtain t1u t1n where t1uU: "(t1u, t1n) \<in> ?U" and t1u: "t1 = ?N a t1u / real_of_int t1n"
   3.808          by blast
   3.809 -      from t2M have "\<exists>(t2u,t2n) \<in> ?U. t2 = ?N a t2u / real t2n"
   3.810 +      from t2M have "\<exists>(t2u,t2n) \<in> ?U. t2 = ?N a t2u / real_of_int t2n"
   3.811          by auto
   3.812 -      then obtain t2u t2n where t2uU: "(t2u, t2n) \<in> ?U" and t2u: "t2 = ?N a t2u / real t2n"
   3.813 +      then obtain t2u t2n where t2uU: "(t2u, t2n) \<in> ?U" and t2u: "t2 = ?N a t2u / real_of_int t2n"
   3.814          by blast
   3.815        from t1x xt2 have t1t2: "t1 < t2"
   3.816          by simp
   3.817 @@ -2043,13 +2043,13 @@
   3.818      qed
   3.819    qed
   3.820    then obtain l n s m where lnU: "(l, n) \<in> ?U" and smU:"(s, m) \<in> ?U"
   3.821 -    and pu: "?I ((?N a l / real n + ?N a s / real m) / 2) p"
   3.822 +    and pu: "?I ((?N a l / real_of_int n + ?N a s / real_of_int m) / 2) p"
   3.823      by blast
   3.824    from lnU smU uset_l[OF lp] have nbl: "numbound0 l" and nbs: "numbound0 s"
   3.825      by auto
   3.826    from numbound0_I[OF nbl, where bs="bs" and b="a" and b'="x"]
   3.827      numbound0_I[OF nbs, where bs="bs" and b="a" and b'="x"] pu
   3.828 -  have "?I ((?N x l / real n + ?N x s / real m) / 2) p"
   3.829 +  have "?I ((?N x l / real_of_int n + ?N x s / real_of_int m) / 2) p"
   3.830      by simp
   3.831    with lnU smU show ?thesis
   3.832      by auto
   3.833 @@ -2063,7 +2063,7 @@
   3.834    shows "(\<exists>x. Ifm (x#bs) p) \<longleftrightarrow>
   3.835      Ifm (x # bs) (minusinf p) \<or> Ifm (x # bs) (plusinf p) \<or>
   3.836        (\<exists>(t,n) \<in> set (uset p). \<exists>(s,m) \<in> set (uset p).
   3.837 -        Ifm ((((Inum (x # bs) t) / real n + (Inum (x # bs) s) / real m) / 2) # bs) p)"
   3.838 +        Ifm ((((Inum (x # bs) t) / real_of_int n + (Inum (x # bs) s) / real_of_int m) / 2) # bs) p)"
   3.839    (is "(\<exists>x. ?I x p) \<longleftrightarrow> (?M \<or> ?P \<or> ?F)" is "?E = ?D")
   3.840  proof
   3.841    assume px: "\<exists>x. ?I x p"
   3.842 @@ -2111,23 +2111,23 @@
   3.843      then show ?thesis by blast
   3.844    next
   3.845      case 2
   3.846 -    let ?f = "\<lambda>(t,n). Inum (x # bs) t / real n"
   3.847 +    let ?f = "\<lambda>(t,n). Inum (x # bs) t / real_of_int n"
   3.848      let ?N = "\<lambda>t. Inum (x # bs) t"
   3.849      {
   3.850        fix t n s m
   3.851        assume "(t, n) \<in> set (uset p)" and "(s, m) \<in> set (uset p)"
   3.852        with uset_l[OF lp] have tnb: "numbound0 t"
   3.853 -        and np: "real n > 0" and snb: "numbound0 s" and mp: "real m > 0"
   3.854 +        and np: "real_of_int n > 0" and snb: "numbound0 s" and mp: "real_of_int m > 0"
   3.855          by auto
   3.856        let ?st = "Add (Mul m t) (Mul n s)"
   3.857 -      from np mp have mnp: "real (2 * n * m) > 0"
   3.858 +      from np mp have mnp: "real_of_int (2 * n * m) > 0"
   3.859          by (simp add: mult.commute)
   3.860        from tnb snb have st_nb: "numbound0 ?st"
   3.861          by simp
   3.862 -      have st: "(?N t / real n + ?N s / real m) / 2 = ?N ?st / real (2 * n * m)"
   3.863 +      have st: "(?N t / real_of_int n + ?N s / real_of_int m) / 2 = ?N ?st / real_of_int (2 * n * m)"
   3.864          using mnp mp np by (simp add: algebra_simps add_divide_distrib)
   3.865        from usubst_I[OF lp mnp st_nb, where x="x" and bs="bs"]
   3.866 -      have "?I x (usubst p (?st, 2 * n * m)) = ?I ((?N t / real n + ?N s / real m) / 2) p"
   3.867 +      have "?I x (usubst p (?st, 2 * n * m)) = ?I ((?N t / real_of_int n + ?N s / real_of_int m) / 2) p"
   3.868          by (simp only: st[symmetric])
   3.869      }
   3.870      with rinf_uset[OF lp 2 px] have ?F
   3.871 @@ -2149,11 +2149,11 @@
   3.872      from rplusinf_ex[OF lp this] show ?thesis .
   3.873    next
   3.874      case 3
   3.875 -    with uset_l[OF lp] have tnb: "numbound0 t" and np: "real k > 0"
   3.876 -      and snb: "numbound0 s" and mp: "real l > 0"
   3.877 +    with uset_l[OF lp] have tnb: "numbound0 t" and np: "real_of_int k > 0"
   3.878 +      and snb: "numbound0 s" and mp: "real_of_int l > 0"
   3.879        by auto
   3.880      let ?st = "Add (Mul l t) (Mul k s)"
   3.881 -    from np mp have mnp: "real (2 * k * l) > 0"
   3.882 +    from np mp have mnp: "real_of_int (2 * k * l) > 0"
   3.883        by (simp add: mult.commute)
   3.884      from tnb snb have st_nb: "numbound0 ?st"
   3.885        by simp
   3.886 @@ -2182,9 +2182,9 @@
   3.887  
   3.888  lemma uset_cong_aux:
   3.889    assumes Ul: "\<forall>(t,n) \<in> set U. numbound0 t \<and> n > 0"
   3.890 -  shows "((\<lambda>(t,n). Inum (x # bs) t / real n) `
   3.891 +  shows "((\<lambda>(t,n). Inum (x # bs) t / real_of_int n) `
   3.892      (set (map (\<lambda>((t,n),(s,m)). (Add (Mul m t) (Mul n s), 2 * n * m)) (alluopairs U)))) =
   3.893 -    ((\<lambda>((t,n),(s,m)). (Inum (x # bs) t / real n + Inum (x # bs) s / real m) / 2) ` (set U \<times> set U))"
   3.894 +    ((\<lambda>((t,n),(s,m)). (Inum (x # bs) t / real_of_int n + Inum (x # bs) s / real_of_int m) / 2) ` (set U \<times> set U))"
   3.895    (is "?lhs = ?rhs")
   3.896  proof auto
   3.897    fix t n s m
   3.898 @@ -2197,10 +2197,10 @@
   3.899      by auto
   3.900    from Ul th have nnz: "n \<noteq> 0"
   3.901      by auto
   3.902 -  have st: "(?N t / real n + ?N s / real m) / 2 = ?N ?st / real (2 * n * m)"
   3.903 +  have st: "(?N t / real_of_int n + ?N s / real_of_int m) / 2 = ?N ?st / real_of_int (2 * n * m)"
   3.904      using mnz nnz by (simp add: algebra_simps add_divide_distrib)
   3.905 -  then show "(real m *  Inum (x # bs) t + real n * Inum (x # bs) s) / (2 * real n * real m)
   3.906 -      \<in> (\<lambda>((t, n), s, m). (Inum (x # bs) t / real n + Inum (x # bs) s / real m) / 2) `
   3.907 +  then show "(real_of_int m *  Inum (x # bs) t + real_of_int n * Inum (x # bs) s) / (2 * real_of_int n * real_of_int m)
   3.908 +      \<in> (\<lambda>((t, n), s, m). (Inum (x # bs) t / real_of_int n + Inum (x # bs) s / real_of_int m) / 2) `
   3.909           (set U \<times> set U)"
   3.910      using mnz nnz th
   3.911      apply (auto simp add: th add_divide_distrib algebra_simps split_def image_def)
   3.912 @@ -2218,10 +2218,10 @@
   3.913      by auto
   3.914    from Ul tnU have nnz: "n \<noteq> 0"
   3.915      by auto
   3.916 -  have st: "(?N t / real n + ?N s / real m) / 2 = ?N ?st / real (2 * n * m)"
   3.917 +  have st: "(?N t / real_of_int n + ?N s / real_of_int m) / 2 = ?N ?st / real_of_int (2 * n * m)"
   3.918      using mnz nnz by (simp add: algebra_simps add_divide_distrib)
   3.919 -  let ?P = "\<lambda>(t',n') (s',m'). (Inum (x # bs) t / real n + Inum (x # bs) s / real m)/2 =
   3.920 -    (Inum (x # bs) t' / real n' + Inum (x # bs) s' / real m') / 2"
   3.921 +  let ?P = "\<lambda>(t',n') (s',m'). (Inum (x # bs) t / real_of_int n + Inum (x # bs) s / real_of_int m)/2 =
   3.922 +    (Inum (x # bs) t' / real_of_int n' + Inum (x # bs) s' / real_of_int m') / 2"
   3.923    have Pc:"\<forall>a b. ?P a b = ?P b a"
   3.924      by auto
   3.925    from Ul alluopairs_set1 have Up:"\<forall>((t,n),(s,m)) \<in> set (alluopairs U). n \<noteq> 0 \<and> m \<noteq> 0"
   3.926 @@ -2235,24 +2235,24 @@
   3.927    from ts'_U Up have mnz': "m' \<noteq> 0" and nnz': "n'\<noteq> 0"
   3.928      by auto
   3.929    let ?st' = "Add (Mul m' t') (Mul n' s')"
   3.930 -  have st': "(?N t' / real n' + ?N s' / real m') / 2 = ?N ?st' / real (2 * n' * m')"
   3.931 +  have st': "(?N t' / real_of_int n' + ?N s' / real_of_int m') / 2 = ?N ?st' / real_of_int (2 * n' * m')"
   3.932      using mnz' nnz' by (simp add: algebra_simps add_divide_distrib)
   3.933 -  from Pts' have "(Inum (x # bs) t / real n + Inum (x # bs) s / real m) / 2 =
   3.934 -    (Inum (x # bs) t' / real n' + Inum (x # bs) s' / real m') / 2"
   3.935 +  from Pts' have "(Inum (x # bs) t / real_of_int n + Inum (x # bs) s / real_of_int m) / 2 =
   3.936 +    (Inum (x # bs) t' / real_of_int n' + Inum (x # bs) s' / real_of_int m') / 2"
   3.937      by simp
   3.938 -  also have "\<dots> = (\<lambda>(t, n). Inum (x # bs) t / real n)
   3.939 +  also have "\<dots> = (\<lambda>(t, n). Inum (x # bs) t / real_of_int n)
   3.940        ((\<lambda>((t, n), s, m). (Add (Mul m t) (Mul n s), 2 * n * m)) ((t', n'), (s', m')))"
   3.941      by (simp add: st')
   3.942 -  finally show "(Inum (x # bs) t / real n + Inum (x # bs) s / real m) / 2
   3.943 -    \<in> (\<lambda>(t, n). Inum (x # bs) t / real n) `
   3.944 +  finally show "(Inum (x # bs) t / real_of_int n + Inum (x # bs) s / real_of_int m) / 2
   3.945 +    \<in> (\<lambda>(t, n). Inum (x # bs) t / real_of_int n) `
   3.946        (\<lambda>((t, n), s, m). (Add (Mul m t) (Mul n s), 2 * n * m)) ` set (alluopairs U)"
   3.947      using ts'_U by blast
   3.948  qed
   3.949  
   3.950  lemma uset_cong:
   3.951    assumes lp: "isrlfm p"
   3.952 -    and UU': "((\<lambda>(t,n). Inum (x # bs) t / real n) ` U') =
   3.953 -      ((\<lambda>((t,n),(s,m)). (Inum (x # bs) t / real n + Inum (x # bs) s / real m) / 2) ` (U \<times> U))"
   3.954 +    and UU': "((\<lambda>(t,n). Inum (x # bs) t / real_of_int n) ` U') =
   3.955 +      ((\<lambda>((t,n),(s,m)). (Inum (x # bs) t / real_of_int n + Inum (x # bs) s / real_of_int m) / 2) ` (U \<times> U))"
   3.956        (is "?f ` U' = ?g ` (U \<times> U)")
   3.957      and U: "\<forall>(t,n) \<in> U. numbound0 t \<and> n > 0"
   3.958      and U': "\<forall>(t,n) \<in> U'. numbound0 t \<and> n > 0"
   3.959 @@ -2270,11 +2270,11 @@
   3.960        and snb: "numbound0 s" and mp: "m > 0"
   3.961        by auto
   3.962      let ?st = "Add (Mul m t) (Mul n s)"
   3.963 -    from np mp have mnp: "real (2 * n * m) > 0"
   3.964 -      by (simp add: mult.commute real_of_int_mult[symmetric] del: real_of_int_mult)
   3.965 +    from np mp have mnp: "real_of_int (2 * n * m) > 0"
   3.966 +      by (simp add: mult.commute of_int_mult[symmetric] del: of_int_mult)
   3.967      from tnb snb have stnb: "numbound0 ?st"
   3.968        by simp
   3.969 -    have st: "(?N t / real n + ?N s / real m) / 2 = ?N ?st / real (2 * n * m)"
   3.970 +    have st: "(?N t / real_of_int n + ?N s / real_of_int m) / 2 = ?N ?st / real_of_int (2 * n * m)"
   3.971        using mp np by (simp add: algebra_simps add_divide_distrib)
   3.972      from tnU smU UU' have "?g ((t, n), (s, m)) \<in> ?f ` U'"
   3.973        by blast
   3.974 @@ -2285,10 +2285,10 @@
   3.975        done
   3.976      then obtain t' n' where tnU': "(t',n') \<in> U'" and th: "?g ((t, n), (s, m)) = ?f (t', n')"
   3.977        by blast
   3.978 -    from U' tnU' have tnb': "numbound0 t'" and np': "real n' > 0"
   3.979 +    from U' tnU' have tnb': "numbound0 t'" and np': "real_of_int n' > 0"
   3.980        by auto
   3.981      from usubst_I[OF lp mnp stnb, where bs="bs" and x="x"] Pst
   3.982 -    have Pst2: "Ifm (Inum (x # bs) (Add (Mul m t) (Mul n s)) / real (2 * n * m) # bs) p"
   3.983 +    have Pst2: "Ifm (Inum (x # bs) (Add (Mul m t) (Mul n s)) / real_of_int (2 * n * m) # bs) p"
   3.984        by simp
   3.985      from conjunct1[OF usubst_I[OF lp np' tnb', where bs="bs" and x="x"], symmetric]
   3.986        th[simplified split_def fst_conv snd_conv,symmetric] Pst2[simplified st[symmetric]]
   3.987 @@ -2316,17 +2316,17 @@
   3.988        and snb: "numbound0 s" and mp: "m > 0"
   3.989        by auto
   3.990      let ?st = "Add (Mul m t) (Mul n s)"
   3.991 -    from np mp have mnp: "real (2 * n * m) > 0"
   3.992 -      by (simp add: mult.commute real_of_int_mult[symmetric] del: real_of_int_mult)
   3.993 +    from np mp have mnp: "real_of_int (2 * n * m) > 0"
   3.994 +      by (simp add: mult.commute of_int_mult[symmetric] del: of_int_mult)
   3.995      from tnb snb have stnb: "numbound0 ?st"
   3.996        by simp
   3.997 -    have st: "(?N t / real n + ?N s / real m) / 2 = ?N ?st / real (2 * n * m)"
   3.998 +    have st: "(?N t / real_of_int n + ?N s / real_of_int m) / 2 = ?N ?st / real_of_int (2 * n * m)"
   3.999        using mp np by (simp add: algebra_simps add_divide_distrib)
  3.1000 -    from U' tnU' have tnb': "numbound0 t'" and np': "real n' > 0"
  3.1001 +    from U' tnU' have tnb': "numbound0 t'" and np': "real_of_int n' > 0"
  3.1002        by auto
  3.1003      from usubst_I[OF lp np' tnb', where bs="bs" and x="x",simplified
  3.1004        th[simplified split_def fst_conv snd_conv] st] Pt'
  3.1005 -    have Pst2: "Ifm (Inum (x # bs) (Add (Mul m t) (Mul n s)) / real (2 * n * m) # bs) p"
  3.1006 +    have Pst2: "Ifm (Inum (x # bs) (Add (Mul m t) (Mul n s)) / real_of_int (2 * n * m) # bs) p"
  3.1007        by simp
  3.1008      with usubst_I[OF lp mnp stnb, where x="x" and bs="bs"] tnU smU
  3.1009      show ?thesis by blast
  3.1010 @@ -2348,8 +2348,8 @@
  3.1011    let ?S = "map ?g ?Up"
  3.1012    let ?SS = "map simp_num_pair ?S"
  3.1013    let ?Y = "remdups ?SS"
  3.1014 -  let ?f = "\<lambda>(t,n). ?N t / real n"
  3.1015 -  let ?h = "\<lambda>((t,n),(s,m)). (?N t / real n + ?N s / real m) / 2"
  3.1016 +  let ?f = "\<lambda>(t,n). ?N t / real_of_int n"
  3.1017 +  let ?h = "\<lambda>((t,n),(s,m)). (?N t / real_of_int n + ?N s / real_of_int m) / 2"
  3.1018    let ?F = "\<lambda>p. \<exists>a \<in> set (uset p). \<exists>b \<in> set (uset p). ?I x (usubst p (?g (a, b)))"
  3.1019    let ?ep = "evaldjf (simpfm \<circ> (usubst ?q)) ?Y"
  3.1020    from rlfm_I[OF simpfm_qf[OF qf]] have lq: "isrlfm ?q"
  3.1021 @@ -2403,7 +2403,7 @@
  3.1022    proof -
  3.1023      have "bound0 (simpfm (usubst ?q (t, n)))" if tnY: "(t,n) \<in> set ?Y" for t n
  3.1024      proof -
  3.1025 -      from Y_l that have tnb: "numbound0 t" and np: "real n > 0"
  3.1026 +      from Y_l that have tnb: "numbound0 t" and np: "real_of_int n > 0"
  3.1027          by auto
  3.1028        from usubst_I[OF lq np tnb] have "bound0 (usubst ?q (t, n))"
  3.1029          by simp
  3.1030 @@ -2464,8 +2464,8 @@
  3.1031  val mk_Bound = @{code Bound} o @{code nat_of_integer};
  3.1032  
  3.1033  fun num_of_term vs (Free vT) = mk_Bound (find_index (fn vT' => vT = vT') vs)
  3.1034 -  | num_of_term vs @{term "real (0::int)"} = mk_C 0
  3.1035 -  | num_of_term vs @{term "real (1::int)"} = mk_C 1
  3.1036 +  | num_of_term vs @{term "real_of_int (0::int)"} = mk_C 0
  3.1037 +  | num_of_term vs @{term "real_of_int (1::int)"} = mk_C 1
  3.1038    | num_of_term vs @{term "0::real"} = mk_C 0
  3.1039    | num_of_term vs @{term "1::real"} = mk_C 1
  3.1040    | num_of_term vs (Bound i) = mk_Bound i
  3.1041 @@ -2477,7 +2477,7 @@
  3.1042    | num_of_term vs (@{term "op * :: real \<Rightarrow> real \<Rightarrow> real"} $ t1 $ t2) = (case num_of_term vs t1
  3.1043       of @{code C} i => @{code Mul} (i, num_of_term vs t2)
  3.1044        | _ => error "num_of_term: unsupported multiplication")
  3.1045 -  | num_of_term vs (@{term "real :: int \<Rightarrow> real"} $ t') =
  3.1046 +  | num_of_term vs (@{term "real_of_int :: int \<Rightarrow> real"} $ t') =
  3.1047       (mk_C (snd (HOLogic.dest_number t'))
  3.1048         handle TERM _ => error ("num_of_term: unknown term"))
  3.1049    | num_of_term vs t' =
  3.1050 @@ -2504,7 +2504,7 @@
  3.1051        @{code A} (fm_of_term (("", dummyT) ::  vs) p)
  3.1052    | fm_of_term vs t = error ("fm_of_term : unknown term " ^ Syntax.string_of_term @{context} t);
  3.1053  
  3.1054 -fun term_of_num vs (@{code C} i) = @{term "real :: int \<Rightarrow> real"} $
  3.1055 +fun term_of_num vs (@{code C} i) = @{term "real_of_int :: int \<Rightarrow> real"} $
  3.1056        HOLogic.mk_number HOLogic.intT (@{code integer_of_int} i)
  3.1057    | term_of_num vs (@{code Bound} n) = Free (nth vs (@{code integer_of_nat} n))
  3.1058    | term_of_num vs (@{code Neg} t') = @{term "uminus :: real \<Rightarrow> real"} $ term_of_num vs t'
     4.1 --- a/src/HOL/Decision_Procs/MIR.thy	Tue Nov 03 11:20:21 2015 +0100
     4.2 +++ b/src/HOL/Decision_Procs/MIR.thy	Tue Nov 10 14:18:41 2015 +0000
     4.3 @@ -9,7 +9,7 @@
     4.4  
     4.5  section \<open>Quantifier elimination for @{text "\<real> (0, 1, +, floor, <)"}\<close>
     4.6  
     4.7 -declare real_of_int_floor_cancel [simp del]
     4.8 +declare of_int_floor_cancel [simp del]
     4.9  
    4.10  lemma myle:
    4.11    fixes a b :: "'a::{ordered_ab_group_add}"
    4.12 @@ -21,73 +21,51 @@
    4.13    shows "(a < b) = (0 < b - a)"
    4.14    by (metis le_iff_diff_le_0 less_le_not_le myle)
    4.15  
    4.16 -  (* Maybe should be added to the library \<dots> *)
    4.17 -lemma floor_int_eq: "(real n\<le> x \<and> x < real (n+1)) = (floor x = n)"
    4.18 -proof( auto)
    4.19 -  assume lb: "real n \<le> x"
    4.20 -    and ub: "x < real n + 1"
    4.21 -  have "real (floor x) \<le> x" by simp 
    4.22 -  hence "real (floor x) < real (n + 1) " using ub by arith
    4.23 -  hence "floor x < n+1" by simp
    4.24 -  moreover from lb have "n \<le> floor x" using floor_mono[where x="real n" and y="x"] 
    4.25 -    by simp ultimately show "floor x = n" by simp
    4.26 -qed
    4.27 -
    4.28  (* Periodicity of dvd *)
    4.29 -lemma dvd_period:
    4.30 -  assumes advdd: "(a::int) dvd d"
    4.31 -  shows "(a dvd (x + t)) = (a dvd ((x+ c*d) + t))"
    4.32 -  using advdd  
    4.33 -proof-
    4.34 -  { fix x k
    4.35 -    from inf_period(3)[OF advdd, rule_format, where x=x and k="-k"]  
    4.36 -    have " ((a::int) dvd (x + t)) = (a dvd (x+k*d + t))" by simp}
    4.37 -  hence "\<forall>x.\<forall>k. ((a::int) dvd (x + t)) = (a dvd (x+k*d + t))"  by simp
    4.38 -  then show ?thesis by simp
    4.39 -qed
    4.40 +lemmas dvd_period = zdvd_period
    4.41  
    4.42  (* The Divisibility relation between reals *)
    4.43  definition rdvd:: "real \<Rightarrow> real \<Rightarrow> bool" (infixl "rdvd" 50)
    4.44 -  where "x rdvd y \<longleftrightarrow> (\<exists>k::int. y = x * real k)"
    4.45 +  where "x rdvd y \<longleftrightarrow> (\<exists>k::int. y = x * real_of_int k)"
    4.46  
    4.47  lemma int_rdvd_real: 
    4.48 -  "real (i::int) rdvd x = (i dvd (floor x) \<and> real (floor x) = x)" (is "?l = ?r")
    4.49 +  "real_of_int (i::int) rdvd x = (i dvd (floor x) \<and> real_of_int (floor x) = x)" (is "?l = ?r")
    4.50  proof
    4.51    assume "?l" 
    4.52 -  hence th: "\<exists> k. x=real (i*k)" by (simp add: rdvd_def)
    4.53 -  hence th': "real (floor x) = x" by (auto simp del: real_of_int_mult)
    4.54 -  with th have "\<exists> k. real (floor x) = real (i*k)" by simp
    4.55 -  hence "\<exists> k. floor x = i*k" by (simp only: real_of_int_inject)
    4.56 +  hence th: "\<exists> k. x=real_of_int (i*k)" by (simp add: rdvd_def)
    4.57 +  hence th': "real_of_int (floor x) = x" by (auto simp del: of_int_mult)
    4.58 +  with th have "\<exists> k. real_of_int (floor x) = real_of_int (i*k)" by simp
    4.59 +  hence "\<exists> k. floor x = i*k" by blast
    4.60    thus ?r  using th' by (simp add: dvd_def) 
    4.61  next
    4.62    assume "?r" hence "(i::int) dvd \<lfloor>x::real\<rfloor>" ..
    4.63 -  hence "\<exists> k. real (floor x) = real (i*k)" 
    4.64 -    by (simp only: real_of_int_inject) (simp add: dvd_def)
    4.65 +  hence "\<exists> k. real_of_int (floor x) = real_of_int (i*k)"
    4.66 +    using dvd_def by blast 
    4.67    thus ?l using \<open>?r\<close> by (simp add: rdvd_def)
    4.68  qed
    4.69  
    4.70 -lemma int_rdvd_iff: "(real (i::int) rdvd real t) = (i dvd t)"
    4.71 -  by (auto simp add: rdvd_def dvd_def) (rule_tac x="k" in exI, simp only: real_of_int_mult[symmetric])
    4.72 -
    4.73 -
    4.74 -lemma rdvd_abs1: "(abs (real d) rdvd t) = (real (d ::int) rdvd t)"
    4.75 +lemma int_rdvd_iff: "(real_of_int (i::int) rdvd real_of_int t) = (i dvd t)"
    4.76 +  by (auto simp add: rdvd_def dvd_def) (rule_tac x="k" in exI, simp only: of_int_mult[symmetric])
    4.77 +
    4.78 +
    4.79 +lemma rdvd_abs1: "(abs (real_of_int d) rdvd t) = (real_of_int (d ::int) rdvd t)"
    4.80  proof
    4.81 -  assume d: "real d rdvd t"
    4.82 -  from d int_rdvd_real have d2: "d dvd (floor t)" and ti: "real (floor t) = t"
    4.83 +  assume d: "real_of_int d rdvd t"
    4.84 +  from d int_rdvd_real have d2: "d dvd (floor t)" and ti: "real_of_int (floor t) = t"
    4.85      by auto
    4.86  
    4.87    from iffD2[OF abs_dvd_iff] d2 have "(abs d) dvd (floor t)" by blast
    4.88 -  with ti int_rdvd_real[symmetric] have "real (abs d) rdvd t" by blast 
    4.89 -  thus "abs (real d) rdvd t" by simp
    4.90 +  with ti int_rdvd_real[symmetric] have "real_of_int (abs d) rdvd t" by blast 
    4.91 +  thus "abs (real_of_int d) rdvd t" by simp
    4.92  next
    4.93 -  assume "abs (real d) rdvd t" hence "real (abs d) rdvd t" by simp
    4.94 -  with int_rdvd_real[where i="abs d" and x="t"] have d2: "abs d dvd floor t" and ti: "real (floor t) =t"
    4.95 +  assume "abs (real_of_int d) rdvd t" hence "real_of_int (abs d) rdvd t" by simp
    4.96 +  with int_rdvd_real[where i="abs d" and x="t"] have d2: "abs d dvd floor t" and ti: "real_of_int (floor t) =t"
    4.97      by auto
    4.98    from iffD1[OF abs_dvd_iff] d2 have "d dvd floor t" by blast
    4.99 -  with ti int_rdvd_real[symmetric] show "real d rdvd t" by blast
   4.100 +  with ti int_rdvd_real[symmetric] show "real_of_int d rdvd t" by blast
   4.101  qed
   4.102  
   4.103 -lemma rdvd_minus: "(real (d::int) rdvd t) = (real d rdvd -t)"
   4.104 +lemma rdvd_minus: "(real_of_int (d::int) rdvd t) = (real_of_int d rdvd -t)"
   4.105    apply (auto simp add: rdvd_def)
   4.106    apply (rule_tac x="-k" in exI, simp) 
   4.107    apply (rule_tac x="-k" in exI, simp)
   4.108 @@ -98,7 +76,7 @@
   4.109  
   4.110  lemma rdvd_mult: 
   4.111    assumes knz: "k\<noteq>0"
   4.112 -  shows "(real (n::int) * real (k::int) rdvd x * real k) = (real n rdvd x)"
   4.113 +  shows "(real_of_int (n::int) * real_of_int (k::int) rdvd x * real_of_int k) = (real_of_int n rdvd x)"
   4.114    using knz by (simp add: rdvd_def)
   4.115  
   4.116    (*********************************************************************************)
   4.117 @@ -122,18 +100,18 @@
   4.118  
   4.119    (* Semantics of numeral terms (num) *)
   4.120  primrec Inum :: "real list \<Rightarrow> num \<Rightarrow> real" where
   4.121 -  "Inum bs (C c) = (real c)"
   4.122 +  "Inum bs (C c) = (real_of_int c)"
   4.123  | "Inum bs (Bound n) = bs!n"
   4.124 -| "Inum bs (CN n c a) = (real c) * (bs!n) + (Inum bs a)"
   4.125 +| "Inum bs (CN n c a) = (real_of_int c) * (bs!n) + (Inum bs a)"
   4.126  | "Inum bs (Neg a) = -(Inum bs a)"
   4.127  | "Inum bs (Add a b) = Inum bs a + Inum bs b"
   4.128  | "Inum bs (Sub a b) = Inum bs a - Inum bs b"
   4.129 -| "Inum bs (Mul c a) = (real c) * Inum bs a"
   4.130 -| "Inum bs (Floor a) = real (floor (Inum bs a))"
   4.131 -| "Inum bs (CF c a b) = real c * real (floor (Inum bs a)) + Inum bs b"
   4.132 -definition "isint t bs \<equiv> real (floor (Inum bs t)) = Inum bs t"
   4.133 -
   4.134 -lemma isint_iff: "isint n bs = (real (floor (Inum bs n)) = Inum bs n)"
   4.135 +| "Inum bs (Mul c a) = (real_of_int c) * Inum bs a"
   4.136 +| "Inum bs (Floor a) = real_of_int (floor (Inum bs a))"
   4.137 +| "Inum bs (CF c a b) = real_of_int c * real_of_int (floor (Inum bs a)) + Inum bs b"
   4.138 +definition "isint t bs \<equiv> real_of_int (floor (Inum bs t)) = Inum bs t"
   4.139 +
   4.140 +lemma isint_iff: "isint n bs = (real_of_int (floor (Inum bs n)) = Inum bs n)"
   4.141    by (simp add: isint_def)
   4.142  
   4.143  lemma isint_Floor: "isint (Floor n) bs"
   4.144 @@ -143,10 +121,10 @@
   4.145  proof-
   4.146    let ?e = "Inum bs e"
   4.147    let ?fe = "floor ?e"
   4.148 -  assume be: "isint e bs" hence efe:"real ?fe = ?e" by (simp add: isint_iff)
   4.149 -  have "real ((floor (Inum bs (Mul c e)))) = real (floor (real (c * ?fe)))" using efe by simp
   4.150 -  also have "\<dots> = real (c* ?fe)" by (simp only: floor_real_of_int) 
   4.151 -  also have "\<dots> = real c * ?e" using efe by simp
   4.152 +  assume be: "isint e bs" hence efe:"real_of_int ?fe = ?e" by (simp add: isint_iff)
   4.153 +  have "real_of_int ((floor (Inum bs (Mul c e)))) = real_of_int (floor (real_of_int (c * ?fe)))" using efe by simp
   4.154 +  also have "\<dots> = real_of_int (c* ?fe)" using floor_of_int by blast 
   4.155 +  also have "\<dots> = real_of_int c * ?e" using efe by simp
   4.156    finally show ?thesis using isint_iff by simp
   4.157  qed
   4.158  
   4.159 @@ -154,9 +132,9 @@
   4.160  proof-
   4.161    let ?I = "\<lambda> t. Inum bs t"
   4.162    assume ie: "isint e bs"
   4.163 -  hence th: "real (floor (?I e)) = ?I e" by (simp add: isint_def)  
   4.164 -  have "real (floor (?I (Neg e))) = real (floor (- (real (floor (?I e)))))" by (simp add: th)
   4.165 -  also have "\<dots> = - real (floor (?I e))" by simp
   4.166 +  hence th: "real_of_int (floor (?I e)) = ?I e" by (simp add: isint_def)  
   4.167 +  have "real_of_int (floor (?I (Neg e))) = real_of_int (floor (- (real_of_int (floor (?I e)))))" by (simp add: th)
   4.168 +  also have "\<dots> = - real_of_int (floor (?I e))" by simp
   4.169    finally show "isint (Neg e) bs" by (simp add: isint_def th)
   4.170  qed
   4.171  
   4.172 @@ -164,9 +142,9 @@
   4.173    assumes ie: "isint e bs" shows "isint (Sub (C c) e) bs"
   4.174  proof-
   4.175    let ?I = "\<lambda> t. Inum bs t"
   4.176 -  from ie have th: "real (floor (?I e)) = ?I e" by (simp add: isint_def)  
   4.177 -  have "real (floor (?I (Sub (C c) e))) = real (floor ((real (c -floor (?I e)))))" by (simp add: th)
   4.178 -  also have "\<dots> = real (c- floor (?I e))" by simp
   4.179 +  from ie have th: "real_of_int (floor (?I e)) = ?I e" by (simp add: isint_def)  
   4.180 +  have "real_of_int (floor (?I (Sub (C c) e))) = real_of_int (floor ((real_of_int (c -floor (?I e)))))" by (simp add: th)
   4.181 +  also have "\<dots> = real_of_int (c- floor (?I e))" by simp
   4.182    finally show "isint (Sub (C c) e) bs" by (simp add: isint_def th)
   4.183  qed
   4.184  
   4.185 @@ -176,9 +154,9 @@
   4.186  proof-
   4.187    let ?a = "Inum bs a"
   4.188    let ?b = "Inum bs b"
   4.189 -  from ai bi isint_iff have "real (floor (?a + ?b)) = real (floor (real (floor ?a) + real (floor ?b)))"
   4.190 +  from ai bi isint_iff have "real_of_int (floor (?a + ?b)) = real_of_int (floor (real_of_int (floor ?a) + real_of_int (floor ?b)))"
   4.191      by simp
   4.192 -  also have "\<dots> = real (floor ?a) + real (floor ?b)" by simp
   4.193 +  also have "\<dots> = real_of_int (floor ?a) + real_of_int (floor ?b)" by simp
   4.194    also have "\<dots> = ?a + ?b" using ai bi isint_iff by simp
   4.195    finally show "isint (Add a b) bs" by (simp add: isint_iff)
   4.196  qed
   4.197 @@ -219,8 +197,8 @@
   4.198  | "Ifm bs (Ge a) = (Inum bs a \<ge> 0)"
   4.199  | "Ifm bs (Eq a) = (Inum bs a = 0)"
   4.200  | "Ifm bs (NEq a) = (Inum bs a \<noteq> 0)"
   4.201 -| "Ifm bs (Dvd i b) = (real i rdvd Inum bs b)"
   4.202 -| "Ifm bs (NDvd i b) = (\<not>(real i rdvd Inum bs b))"
   4.203 +| "Ifm bs (Dvd i b) = (real_of_int i rdvd Inum bs b)"
   4.204 +| "Ifm bs (NDvd i b) = (\<not>(real_of_int i rdvd Inum bs b))"
   4.205  | "Ifm bs (NOT p) = (\<not> (Ifm bs p))"
   4.206  | "Ifm bs (And p q) = (Ifm bs p \<and> Ifm bs q)"
   4.207  | "Ifm bs (Or p q) = (Ifm bs p \<or> Ifm bs q)"
   4.208 @@ -607,7 +585,7 @@
   4.209  
   4.210  lemma reducecoeffh:
   4.211    assumes gt: "dvdnumcoeff t g" and gp: "g > 0" 
   4.212 -  shows "real g *(Inum bs (reducecoeffh t g)) = Inum bs t"
   4.213 +  shows "real_of_int g *(Inum bs (reducecoeffh t g)) = Inum bs t"
   4.214    using gt
   4.215  proof(induct t rule: reducecoeffh.induct) 
   4.216    case (1 i) hence gd: "g dvd i" by simp
   4.217 @@ -708,7 +686,7 @@
   4.218    from dvdnumcoeff_aux[OF th1 th2 H] show "dvdnumcoeff t ?g" .
   4.219  qed
   4.220  
   4.221 -lemma reducecoeff: "real (numgcd t) * (Inum bs (reducecoeff t)) = Inum bs t"
   4.222 +lemma reducecoeff: "real_of_int (numgcd t) * (Inum bs (reducecoeff t)) = Inum bs t"
   4.223  proof-
   4.224    let ?g = "numgcd t"
   4.225    have "?g \<ge> 0"  by (simp add: numgcd_pos)
   4.226 @@ -757,7 +735,7 @@
   4.227  apply (case_tac "lex_bnd t1 t2", simp_all)
   4.228   apply (case_tac "c1+c2 = 0")
   4.229    apply (case_tac "t1 = t2")
   4.230 -   apply (simp_all add: algebra_simps distrib_right[symmetric] real_of_int_mult[symmetric] real_of_int_add[symmetric]del: real_of_int_mult real_of_int_add distrib_right)
   4.231 +   apply (simp_all add: algebra_simps distrib_right[symmetric] of_int_mult[symmetric] of_int_add[symmetric]del: of_int_mult of_int_add distrib_right)
   4.232    done
   4.233  
   4.234  lemma numadd_nb[simp]: "\<lbrakk> numbound0 t ; numbound0 s\<rbrakk> \<Longrightarrow> numbound0 (numadd (t,s))"
   4.235 @@ -852,15 +830,15 @@
   4.236      hence th1: "?n t = ?N (Add (Floor ?tv) ?ti)" 
   4.237        by (cases ?tv) (auto simp add: numfloor_def Let_def split_def)
   4.238      from split_int[OF tvti] have "?N (Floor t) = ?N (Floor(Add ?tv ?ti))" and tii:"isint ?ti bs" by simp+
   4.239 -    hence "?N (Floor t) = real (floor (?N (Add ?tv ?ti)))" by simp 
   4.240 -    also have "\<dots> = real (floor (?N ?tv) + (floor (?N ?ti)))"
   4.241 +    hence "?N (Floor t) = real_of_int (floor (?N (Add ?tv ?ti)))" by simp 
   4.242 +    also have "\<dots> = real_of_int (floor (?N ?tv) + (floor (?N ?ti)))"
   4.243        by (simp,subst tii[simplified isint_iff, symmetric]) simp
   4.244      also have "\<dots> = ?N (Add (Floor ?tv) ?ti)" by (simp add: tii[simplified isint_iff])
   4.245      finally have ?thesis using th1 by simp}
   4.246    moreover {fix v assume H:"?tv = C v" 
   4.247      from split_int[OF tvti] have "?N (Floor t) = ?N (Floor(Add ?tv ?ti))" and tii:"isint ?ti bs" by simp+
   4.248 -    hence "?N (Floor t) = real (floor (?N (Add ?tv ?ti)))" by simp 
   4.249 -    also have "\<dots> = real (floor (?N ?tv) + (floor (?N ?ti)))"
   4.250 +    hence "?N (Floor t) = real_of_int (floor (?N (Add ?tv ?ti)))" by simp 
   4.251 +    also have "\<dots> = real_of_int (floor (?N ?tv) + (floor (?N ?ti)))"
   4.252        by (simp,subst tii[simplified isint_iff, symmetric]) simp
   4.253      also have "\<dots> = ?N (Add (Floor ?tv) ?ti)" by (simp add: tii[simplified isint_iff])
   4.254      finally have ?thesis by (simp add: H numfloor_def Let_def split_def) }
   4.255 @@ -951,7 +929,7 @@
   4.256        else (t',n))))"
   4.257  
   4.258  lemma simp_num_pair_ci:
   4.259 -  shows "((\<lambda> (t,n). Inum bs t / real n) (simp_num_pair (t,n))) = ((\<lambda> (t,n). Inum bs t / real n) (t,n))"
   4.260 +  shows "((\<lambda> (t,n). Inum bs t / real_of_int n) (simp_num_pair (t,n))) = ((\<lambda> (t,n). Inum bs t / real_of_int n) (t,n))"
   4.261    (is "?lhs = ?rhs")
   4.262  proof-
   4.263    let ?t' = "simpnum t"
   4.264 @@ -975,12 +953,12 @@
   4.265          have gpdd: "?g' dvd n" by simp
   4.266          have gpdgp: "?g' dvd ?g'" by simp
   4.267          from reducecoeffh[OF dvdnumcoeff_trans[OF gpdg th1] g'p] 
   4.268 -        have th2:"real ?g' * ?t = Inum bs ?t'" by simp
   4.269 -        from nnz g1 g'1 have "?lhs = ?t / real (n div ?g')" by (simp add: simp_num_pair_def Let_def)
   4.270 -        also have "\<dots> = (real ?g' * ?t) / (real ?g' * (real (n div ?g')))" by simp
   4.271 -        also have "\<dots> = (Inum bs ?t' / real n)"
   4.272 +        have th2:"real_of_int ?g' * ?t = Inum bs ?t'" by simp
   4.273 +        from nnz g1 g'1 have "?lhs = ?t / real_of_int (n div ?g')" by (simp add: simp_num_pair_def Let_def)
   4.274 +        also have "\<dots> = (real_of_int ?g' * ?t) / (real_of_int ?g' * (real_of_int (n div ?g')))" by simp
   4.275 +        also have "\<dots> = (Inum bs ?t' / real_of_int n)"
   4.276            using real_of_int_div[OF gpdd] th2 gp0 by simp
   4.277 -        finally have "?lhs = Inum bs t / real n" by simp
   4.278 +        finally have "?lhs = Inum bs t / real_of_int n" by simp
   4.279          then have ?thesis using nnz g1 g'1 by (simp add: simp_num_pair_def) }
   4.280        ultimately have ?thesis by blast }
   4.281      ultimately have ?thesis by blast }
   4.282 @@ -1092,27 +1070,27 @@
   4.283  lemma check_int: "check_int t \<Longrightarrow> isint t bs"
   4.284    by (induct t) (auto simp add: isint_add isint_Floor isint_Mul isint_neg isint_c isint_CF)
   4.285  
   4.286 -lemma rdvd_left1_int: "real \<lfloor>t\<rfloor> = t \<Longrightarrow> 1 rdvd t"
   4.287 +lemma rdvd_left1_int: "real_of_int \<lfloor>t\<rfloor> = t \<Longrightarrow> 1 rdvd t"
   4.288    by (simp add: rdvd_def,rule_tac x="\<lfloor>t\<rfloor>" in exI) simp
   4.289  
   4.290  lemma rdvd_reduce: 
   4.291    assumes gd:"g dvd d" and gc:"g dvd c" and gp: "g > 0"
   4.292 -  shows "real (d::int) rdvd real (c::int)*t = (real (d div g) rdvd real (c div g)*t)"
   4.293 +  shows "real_of_int (d::int) rdvd real_of_int (c::int)*t = (real_of_int (d div g) rdvd real_of_int (c div g)*t)"
   4.294  proof
   4.295 -  assume d: "real d rdvd real c * t"
   4.296 -  from d rdvd_def obtain k where k_def: "real c * t = real d* real (k::int)" by auto
   4.297 +  assume d: "real_of_int d rdvd real_of_int c * t"
   4.298 +  from d rdvd_def obtain k where k_def: "real_of_int c * t = real_of_int d* real_of_int (k::int)" by auto
   4.299    from gd dvd_def obtain kd where kd_def: "d = g * kd" by auto
   4.300    from gc dvd_def obtain kc where kc_def: "c = g * kc" by auto
   4.301 -  from k_def kd_def kc_def have "real g * real kc * t = real g * real kd * real k" by simp
   4.302 -  hence "real kc * t = real kd * real k" using gp by simp
   4.303 -  hence th:"real kd rdvd real kc * t" using rdvd_def by blast
   4.304 +  from k_def kd_def kc_def have "real_of_int g * real_of_int kc * t = real_of_int g * real_of_int kd * real_of_int k" by simp
   4.305 +  hence "real_of_int kc * t = real_of_int kd * real_of_int k" using gp by simp
   4.306 +  hence th:"real_of_int kd rdvd real_of_int kc * t" using rdvd_def by blast
   4.307    from kd_def gp have th':"kd = d div g" by simp
   4.308    from kc_def gp have "kc = c div g" by simp
   4.309 -  with th th' show "real (d div g) rdvd real (c div g) * t" by simp
   4.310 +  with th th' show "real_of_int (d div g) rdvd real_of_int (c div g) * t" by simp
   4.311  next
   4.312 -  assume d: "real (d div g) rdvd real (c div g) * t"
   4.313 +  assume d: "real_of_int (d div g) rdvd real_of_int (c div g) * t"
   4.314    from gp have gnz: "g \<noteq> 0" by simp
   4.315 -  thus "real d rdvd real c * t" using d rdvd_mult[OF gnz, where n="d div g" and x="real (c div g) * t"] real_of_int_div[OF gd] real_of_int_div[OF gc] by simp
   4.316 +  thus "real_of_int d rdvd real_of_int c * t" using d rdvd_mult[OF gnz, where n="d div g" and x="real_of_int (c div g) * t"] real_of_int_div[OF gd] real_of_int_div[OF gc] by simp
   4.317  qed
   4.318  
   4.319  definition simpdvd :: "int \<Rightarrow> num \<Rightarrow> (int \<times> num)" where
   4.320 @@ -1143,11 +1121,11 @@
   4.321        have gpdd: "?g' dvd d" by simp
   4.322        have gpdgp: "?g' dvd ?g'" by simp
   4.323        from reducecoeffh[OF dvdnumcoeff_trans[OF gpdg th1] g'p] 
   4.324 -      have th2:"real ?g' * ?t = Inum bs t" by simp
   4.325 +      have th2:"real_of_int ?g' * ?t = Inum bs t" by simp
   4.326        from assms g1 g0 g'1
   4.327        have "Ifm bs (Dvd (fst (simpdvd d t)) (snd(simpdvd d t))) = Ifm bs (Dvd (d div ?g') ?tt)"
   4.328          by (simp add: simpdvd_def Let_def)
   4.329 -      also have "\<dots> = (real d rdvd (Inum bs t))"
   4.330 +      also have "\<dots> = (real_of_int d rdvd (Inum bs t))"
   4.331          using rdvd_reduce[OF gpdd gpdgp g'p, where t="?t", simplified div_self[OF gp0]] 
   4.332            th2[symmetric] by simp
   4.333        finally have ?thesis by simp  }
   4.334 @@ -1190,9 +1168,9 @@
   4.335      have sa_nz: "nozerocoeff ?sa" by (rule simpnum_nz)
   4.336      {assume gz: "?g=0" from numgcd_nz[OF sa_nz gz] H have "False" by auto}
   4.337      with numgcd_pos[where t="?sa"] have "?g > 0" by (cases "?g=0", auto)
   4.338 -    hence gp: "real ?g > 0" by simp
   4.339 -    have "Inum bs ?sa = real ?g* ?r" by (simp add: reducecoeff)
   4.340 -    with sa have "Inum bs a < 0 = (real ?g * ?r < real ?g * 0)" by simp
   4.341 +    hence gp: "real_of_int ?g > 0" by simp
   4.342 +    have "Inum bs ?sa = real_of_int ?g* ?r" by (simp add: reducecoeff)
   4.343 +    with sa have "Inum bs a < 0 = (real_of_int ?g * ?r < real_of_int ?g * 0)" by simp
   4.344      also have "\<dots> = (?r < 0)" using gp
   4.345        by (simp only: mult_less_cancel_left) simp
   4.346      finally have ?case using H by (cases "?sa" , simp_all add: Let_def)}
   4.347 @@ -1207,9 +1185,9 @@
   4.348      have sa_nz: "nozerocoeff ?sa" by (rule simpnum_nz)
   4.349      {assume gz: "?g=0" from numgcd_nz[OF sa_nz gz] H have "False" by auto}
   4.350      with numgcd_pos[where t="?sa"] have "?g > 0" by (cases "?g=0", auto)
   4.351 -    hence gp: "real ?g > 0" by simp
   4.352 -    have "Inum bs ?sa = real ?g* ?r" by (simp add: reducecoeff)
   4.353 -    with sa have "Inum bs a \<le> 0 = (real ?g * ?r \<le> real ?g * 0)" by simp
   4.354 +    hence gp: "real_of_int ?g > 0" by simp
   4.355 +    have "Inum bs ?sa = real_of_int ?g* ?r" by (simp add: reducecoeff)
   4.356 +    with sa have "Inum bs a \<le> 0 = (real_of_int ?g * ?r \<le> real_of_int ?g * 0)" by simp
   4.357      also have "\<dots> = (?r \<le> 0)" using gp
   4.358        by (simp only: mult_le_cancel_left) simp
   4.359      finally have ?case using H by (cases "?sa" , simp_all add: Let_def)}
   4.360 @@ -1224,9 +1202,9 @@
   4.361      have sa_nz: "nozerocoeff ?sa" by (rule simpnum_nz)
   4.362      {assume gz: "?g=0" from numgcd_nz[OF sa_nz gz] H have "False" by auto}
   4.363      with numgcd_pos[where t="?sa"] have "?g > 0" by (cases "?g=0", auto)
   4.364 -    hence gp: "real ?g > 0" by simp
   4.365 -    have "Inum bs ?sa = real ?g* ?r" by (simp add: reducecoeff)
   4.366 -    with sa have "Inum bs a > 0 = (real ?g * ?r > real ?g * 0)" by simp
   4.367 +    hence gp: "real_of_int ?g > 0" by simp
   4.368 +    have "Inum bs ?sa = real_of_int ?g* ?r" by (simp add: reducecoeff)
   4.369 +    with sa have "Inum bs a > 0 = (real_of_int ?g * ?r > real_of_int ?g * 0)" by simp
   4.370      also have "\<dots> = (?r > 0)" using gp
   4.371        by (simp only: mult_less_cancel_left) simp
   4.372      finally have ?case using H by (cases "?sa" , simp_all add: Let_def)}
   4.373 @@ -1241,9 +1219,9 @@
   4.374      have sa_nz: "nozerocoeff ?sa" by (rule simpnum_nz)
   4.375      {assume gz: "?g=0" from numgcd_nz[OF sa_nz gz] H have "False" by auto}
   4.376      with numgcd_pos[where t="?sa"] have "?g > 0" by (cases "?g=0", auto)
   4.377 -    hence gp: "real ?g > 0" by simp
   4.378 -    have "Inum bs ?sa = real ?g* ?r" by (simp add: reducecoeff)
   4.379 -    with sa have "Inum bs a \<ge> 0 = (real ?g * ?r \<ge> real ?g * 0)" by simp
   4.380 +    hence gp: "real_of_int ?g > 0" by simp
   4.381 +    have "Inum bs ?sa = real_of_int ?g* ?r" by (simp add: reducecoeff)
   4.382 +    with sa have "Inum bs a \<ge> 0 = (real_of_int ?g * ?r \<ge> real_of_int ?g * 0)" by simp
   4.383      also have "\<dots> = (?r \<ge> 0)" using gp
   4.384        by (simp only: mult_le_cancel_left) simp
   4.385      finally have ?case using H by (cases "?sa" , simp_all add: Let_def)}
   4.386 @@ -1258,9 +1236,9 @@
   4.387      have sa_nz: "nozerocoeff ?sa" by (rule simpnum_nz)
   4.388      {assume gz: "?g=0" from numgcd_nz[OF sa_nz gz] H have "False" by auto}
   4.389      with numgcd_pos[where t="?sa"] have "?g > 0" by (cases "?g=0", auto)
   4.390 -    hence gp: "real ?g > 0" by simp
   4.391 -    have "Inum bs ?sa = real ?g* ?r" by (simp add: reducecoeff)
   4.392 -    with sa have "Inum bs a = 0 = (real ?g * ?r = 0)" by simp
   4.393 +    hence gp: "real_of_int ?g > 0" by simp
   4.394 +    have "Inum bs ?sa = real_of_int ?g* ?r" by (simp add: reducecoeff)
   4.395 +    with sa have "Inum bs a = 0 = (real_of_int ?g * ?r = 0)" by simp
   4.396      also have "\<dots> = (?r = 0)" using gp
   4.397        by simp
   4.398      finally have ?case using H by (cases "?sa" , simp_all add: Let_def)}
   4.399 @@ -1275,9 +1253,9 @@
   4.400      have sa_nz: "nozerocoeff ?sa" by (rule simpnum_nz)
   4.401      {assume gz: "?g=0" from numgcd_nz[OF sa_nz gz] H have "False" by auto}
   4.402      with numgcd_pos[where t="?sa"] have "?g > 0" by (cases "?g=0", auto)
   4.403 -    hence gp: "real ?g > 0" by simp
   4.404 -    have "Inum bs ?sa = real ?g* ?r" by (simp add: reducecoeff)
   4.405 -    with sa have "Inum bs a \<noteq> 0 = (real ?g * ?r \<noteq> 0)" by simp
   4.406 +    hence gp: "real_of_int ?g > 0" by simp
   4.407 +    have "Inum bs ?sa = real_of_int ?g* ?r" by (simp add: reducecoeff)
   4.408 +    with sa have "Inum bs a \<noteq> 0 = (real_of_int ?g * ?r \<noteq> 0)" by simp
   4.409      also have "\<dots> = (?r \<noteq> 0)" using gp
   4.410        by simp
   4.411      finally have ?case using H by (cases "?sa") (simp_all add: Let_def) }
   4.412 @@ -1471,7 +1449,7 @@
   4.413  termination by (relation "measure num_size") auto
   4.414  
   4.415  lemma zsplit0_I:
   4.416 -  shows "\<And> n a. zsplit0 t = (n,a) \<Longrightarrow> (Inum ((real (x::int)) #bs) (CN 0 n a) = Inum (real x #bs) t) \<and> numbound0 a"
   4.417 +  shows "\<And> n a. zsplit0 t = (n,a) \<Longrightarrow> (Inum ((real_of_int (x::int)) #bs) (CN 0 n a) = Inum (real_of_int x #bs) t) \<and> numbound0 a"
   4.418    (is "\<And> n a. ?S t = (n,a) \<Longrightarrow> (?I x (CN 0 n a) = ?I x t) \<and> ?N a")
   4.419  proof(induct t rule: zsplit0.induct)
   4.420    case (1 c n a) thus ?case by auto 
   4.421 @@ -1500,7 +1478,7 @@
   4.422    ultimately have th: "a=Add ?as ?at \<and> n=?ns + ?nt" using 6
   4.423      by (simp add: Let_def split_def)
   4.424    from abjs[symmetric] have bluddy: "\<exists> x y. (x,y) = zsplit0 s" by blast
   4.425 -  from 6 have "(\<exists> x y. (x,y) = zsplit0 s) \<longrightarrow> (\<forall>xa xb. zsplit0 t = (xa, xb) \<longrightarrow> Inum (real x # bs) (CN 0 xa xb) = Inum (real x # bs) t \<and> numbound0 xb)" by blast (*FIXME*)
   4.426 +  from 6 have "(\<exists> x y. (x,y) = zsplit0 s) \<longrightarrow> (\<forall>xa xb. zsplit0 t = (xa, xb) \<longrightarrow> Inum (real_of_int x # bs) (CN 0 xa xb) = Inum (real_of_int x # bs) t \<and> numbound0 xb)" by blast (*FIXME*)
   4.427    with bluddy abjt have th3: "(?I x (CN 0 ?nt ?at) = ?I x t) \<and> ?N ?at" by blast
   4.428    from abjs 6  have th2: "(?I x (CN 0 ?ns ?as) = ?I x s) \<and> ?N ?as" by blast
   4.429    from th3[simplified] th2[simplified] th[simplified] show ?case 
   4.430 @@ -1516,7 +1494,7 @@
   4.431    ultimately have th: "a=Sub ?as ?at \<and> n=?ns - ?nt" using 7
   4.432      by (simp add: Let_def split_def)
   4.433    from abjs[symmetric] have bluddy: "\<exists> x y. (x,y) = zsplit0 s" by blast
   4.434 -  from 7 have "(\<exists> x y. (x,y) = zsplit0 s) \<longrightarrow> (\<forall>xa xb. zsplit0 t = (xa, xb) \<longrightarrow> Inum (real x # bs) (CN 0 xa xb) = Inum (real x # bs) t \<and> numbound0 xb)" by blast (*FIXME*)
   4.435 +  from 7 have "(\<exists> x y. (x,y) = zsplit0 s) \<longrightarrow> (\<forall>xa xb. zsplit0 t = (xa, xb) \<longrightarrow> Inum (real_of_int x # bs) (CN 0 xa xb) = Inum (real_of_int x # bs) t \<and> numbound0 xb)" by blast (*FIXME*)
   4.436    with bluddy abjt have th3: "(?I x (CN 0 ?nt ?at) = ?I x t) \<and> ?N ?at" by blast
   4.437    from abjs 7 have th2: "(?I x (CN 0 ?ns ?as) = ?I x s) \<and> ?N ?as" by blast
   4.438    from th3[simplified] th2[simplified] th[simplified] show ?case 
   4.439 @@ -1528,7 +1506,7 @@
   4.440    have abj: "zsplit0 t = (?nt,?at)" by simp hence th: "a=Mul i ?at \<and> n=i*?nt" using 8
   4.441      by (simp add: Let_def split_def)
   4.442    from abj 8 have th2: "(?I x (CN 0 ?nt ?at) = ?I x t) \<and> ?N ?at" by blast
   4.443 -  hence "?I x (Mul i t) = (real i) * ?I x (CN 0 ?nt ?at)" by simp
   4.444 +  hence "?I x (Mul i t) = (real_of_int i) * ?I x (CN 0 ?nt ?at)" by simp
   4.445    also have "\<dots> = ?I x (CN 0 (i*?nt) (Mul i ?at))" by (simp add: distrib_left)
   4.446    finally show ?case using th th2 by simp
   4.447  next
   4.448 @@ -1539,13 +1517,13 @@
   4.449      by (simp add: Let_def split_def)
   4.450    from abj 9 have th2: "(?I x (CN 0 ?nt ?at) = ?I x t) \<and> ?N ?at" by blast
   4.451    hence na: "?N a" using th by simp
   4.452 -  have th': "(real ?nt)*(real x) = real (?nt * x)" by simp
   4.453 +  have th': "(real_of_int ?nt)*(real_of_int x) = real_of_int (?nt * x)" by simp
   4.454    have "?I x (Floor t) = ?I x (Floor (CN 0 ?nt ?at))" using th2 by simp
   4.455 -  also have "\<dots> = real (floor ((real ?nt)* real(x) + ?I x ?at))" by simp
   4.456 -  also have "\<dots> = real (floor (?I x ?at + real (?nt* x)))" by (simp add: ac_simps)
   4.457 -  also have "\<dots> = real (floor (?I x ?at) + (?nt* x))" 
   4.458 -    using floor_add[where x="?I x ?at" and a="?nt* x"] by simp 
   4.459 -  also have "\<dots> = real (?nt)*(real x) + real (floor (?I x ?at))" by (simp add: ac_simps)
   4.460 +  also have "\<dots> = real_of_int (floor ((real_of_int ?nt)* real_of_int(x) + ?I x ?at))" by simp
   4.461 +  also have "\<dots> = real_of_int (floor (?I x ?at + real_of_int (?nt* x)))" by (simp add: ac_simps)
   4.462 +  also have "\<dots> = real_of_int (floor (?I x ?at) + (?nt* x))" 
   4.463 +    using floor_add_of_int[of "?I x ?at" "?nt* x"] by simp 
   4.464 +  also have "\<dots> = real_of_int (?nt)*(real_of_int x) + real_of_int (floor (?I x ?at))" by (simp add: ac_simps)
   4.465    finally have "?I x (Floor t) = ?I x (CN 0 n a)" using th by simp
   4.466    with na show ?case by simp
   4.467  qed
   4.468 @@ -1643,72 +1621,72 @@
   4.469    "zlfm p = p" (hints simp add: fmsize_pos)
   4.470  
   4.471  lemma split_int_less_real: 
   4.472 -  "(real (a::int) < b) = (a < floor b \<or> (a = floor b \<and> real (floor b) < b))"
   4.473 +  "(real_of_int (a::int) < b) = (a < floor b \<or> (a = floor b \<and> real_of_int (floor b) < b))"
   4.474  proof( auto)
   4.475 -  assume alb: "real a < b" and agb: "\<not> a < floor b"
   4.476 -  from agb have "floor b \<le> a" by simp hence th: "b < real a + 1" by (simp only: floor_le_eq)
   4.477 +  assume alb: "real_of_int a < b" and agb: "\<not> a < floor b"
   4.478 +  from agb have "floor b \<le> a" by simp hence th: "b < real_of_int a + 1" by (simp only: floor_le_iff)
   4.479    from floor_eq[OF alb th] show "a= floor b" by simp 
   4.480  next
   4.481    assume alb: "a < floor b"
   4.482 -  hence "real a < real (floor b)" by simp
   4.483 -  moreover have "real (floor b) \<le> b" by simp ultimately show  "real a < b" by arith 
   4.484 +  hence "real_of_int a < real_of_int (floor b)" by simp
   4.485 +  moreover have "real_of_int (floor b) \<le> b" by simp ultimately show  "real_of_int a < b" by arith 
   4.486  qed
   4.487  
   4.488  lemma split_int_less_real': 
   4.489 -  "(real (a::int) + b < 0) = (real a - real (floor(-b)) < 0 \<or> (real a - real (floor (-b)) = 0 \<and> real (floor (-b)) + b < 0))"
   4.490 +  "(real_of_int (a::int) + b < 0) = (real_of_int a - real_of_int (floor(-b)) < 0 \<or> (real_of_int a - real_of_int (floor (-b)) = 0 \<and> real_of_int (floor (-b)) + b < 0))"
   4.491  proof- 
   4.492 -  have "(real a + b <0) = (real a < -b)" by arith
   4.493 +  have "(real_of_int a + b <0) = (real_of_int a < -b)" by arith
   4.494    with split_int_less_real[where a="a" and b="-b"] show ?thesis by arith  
   4.495  qed
   4.496  
   4.497  lemma split_int_gt_real': 
   4.498 -  "(real (a::int) + b > 0) = (real a + real (floor b) > 0 \<or> (real a + real (floor b) = 0 \<and> real (floor b) - b < 0))"
   4.499 +  "(real_of_int (a::int) + b > 0) = (real_of_int a + real_of_int (floor b) > 0 \<or> (real_of_int a + real_of_int (floor b) = 0 \<and> real_of_int (floor b) - b < 0))"
   4.500  proof- 
   4.501 -  have th: "(real a + b >0) = (real (-a) + (-b)< 0)" by arith
   4.502 -  show ?thesis using myless[of _ "real (floor b)"] 
   4.503 +  have th: "(real_of_int a + b >0) = (real_of_int (-a) + (-b)< 0)" by arith
   4.504 +  show ?thesis using myless[of _ "real_of_int (floor b)"] 
   4.505      by (simp only:th split_int_less_real'[where a="-a" and b="-b"]) 
   4.506      (simp add: algebra_simps,arith)
   4.507  qed
   4.508  
   4.509  lemma split_int_le_real: 
   4.510 -  "(real (a::int) \<le> b) = (a \<le> floor b \<or> (a = floor b \<and> real (floor b) < b))"
   4.511 +  "(real_of_int (a::int) \<le> b) = (a \<le> floor b \<or> (a = floor b \<and> real_of_int (floor b) < b))"
   4.512  proof( auto)
   4.513 -  assume alb: "real a \<le> b" and agb: "\<not> a \<le> floor b"
   4.514 -  from alb have "floor (real a) \<le> floor b " by (simp only: floor_mono) 
   4.515 +  assume alb: "real_of_int a \<le> b" and agb: "\<not> a \<le> floor b"
   4.516 +  from alb have "floor (real_of_int a) \<le> floor b " by (simp only: floor_mono) 
   4.517    hence "a \<le> floor b" by simp with agb show "False" by simp
   4.518  next
   4.519    assume alb: "a \<le> floor b"
   4.520 -  hence "real a \<le> real (floor b)" by (simp only: floor_mono)
   4.521 -  also have "\<dots>\<le> b" by simp  finally show  "real a \<le> b" . 
   4.522 +  hence "real_of_int a \<le> real_of_int (floor b)" by (simp only: floor_mono)
   4.523 +  also have "\<dots>\<le> b" by simp  finally show  "real_of_int a \<le> b" . 
   4.524  qed
   4.525  
   4.526  lemma split_int_le_real': 
   4.527 -  "(real (a::int) + b \<le> 0) = (real a - real (floor(-b)) \<le> 0 \<or> (real a - real (floor (-b)) = 0 \<and> real (floor (-b)) + b < 0))"
   4.528 +  "(real_of_int (a::int) + b \<le> 0) = (real_of_int a - real_of_int (floor(-b)) \<le> 0 \<or> (real_of_int a - real_of_int (floor (-b)) = 0 \<and> real_of_int (floor (-b)) + b < 0))"
   4.529  proof- 
   4.530 -  have "(real a + b \<le>0) = (real a \<le> -b)" by arith
   4.531 +  have "(real_of_int a + b \<le>0) = (real_of_int a \<le> -b)" by arith
   4.532    with split_int_le_real[where a="a" and b="-b"] show ?thesis by arith  
   4.533  qed
   4.534  
   4.535  lemma split_int_ge_real': 
   4.536 -  "(real (a::int) + b \<ge> 0) = (real a + real (floor b) \<ge> 0 \<or> (real a + real (floor b) = 0 \<and> real (floor b) - b < 0))"
   4.537 +  "(real_of_int (a::int) + b \<ge> 0) = (real_of_int a + real_of_int (floor b) \<ge> 0 \<or> (real_of_int a + real_of_int (floor b) = 0 \<and> real_of_int (floor b) - b < 0))"
   4.538  proof- 
   4.539 -  have th: "(real a + b \<ge>0) = (real (-a) + (-b) \<le> 0)" by arith
   4.540 +  have th: "(real_of_int a + b \<ge>0) = (real_of_int (-a) + (-b) \<le> 0)" by arith
   4.541    show ?thesis by (simp only: th split_int_le_real'[where a="-a" and b="-b"])
   4.542      (simp add: algebra_simps ,arith)
   4.543  qed
   4.544  
   4.545 -lemma split_int_eq_real: "(real (a::int) = b) = ( a = floor b \<and> b = real (floor b))" (is "?l = ?r")
   4.546 +lemma split_int_eq_real: "(real_of_int (a::int) = b) = ( a = floor b \<and> b = real_of_int (floor b))" (is "?l = ?r")
   4.547  by auto
   4.548  
   4.549 -lemma split_int_eq_real': "(real (a::int) + b = 0) = ( a - floor (-b) = 0 \<and> real (floor (-b)) + b = 0)" (is "?l = ?r")
   4.550 +lemma split_int_eq_real': "(real_of_int (a::int) + b = 0) = ( a - floor (-b) = 0 \<and> real_of_int (floor (-b)) + b = 0)" (is "?l = ?r")
   4.551  proof-
   4.552 -  have "?l = (real a = -b)" by arith
   4.553 +  have "?l = (real_of_int a = -b)" by arith
   4.554    with split_int_eq_real[where a="a" and b="-b"] show ?thesis by simp arith
   4.555  qed
   4.556  
   4.557  lemma zlfm_I:
   4.558    assumes qfp: "qfree p"
   4.559 -  shows "(Ifm (real i #bs) (zlfm p) = Ifm (real i# bs) p) \<and> iszlfm (zlfm p) (real (i::int) #bs)"
   4.560 +  shows "(Ifm (real_of_int i #bs) (zlfm p) = Ifm (real_of_int i# bs) p) \<and> iszlfm (zlfm p) (real_of_int (i::int) #bs)"
   4.561    (is "(?I (?l p) = ?I p) \<and> ?L (?l p)")
   4.562  using qfp
   4.563  proof(induct p rule: zlfm.induct)
   4.564 @@ -1717,8 +1695,8 @@
   4.565    let ?r = "snd (zsplit0 a)"
   4.566    have spl: "zsplit0 a = (?c,?r)" by simp
   4.567    from zsplit0_I[OF spl, where x="i" and bs="bs"] 
   4.568 -  have Ia:"Inum (real i # bs) a = Inum (real i #bs) (CN 0 ?c ?r)" and nb: "numbound0 ?r" by auto 
   4.569 -  let ?N = "\<lambda> t. Inum (real i#bs) t"
   4.570 +  have Ia:"Inum (real_of_int i # bs) a = Inum (real_of_int i #bs) (CN 0 ?c ?r)" and nb: "numbound0 ?r" by auto 
   4.571 +  let ?N = "\<lambda> t. Inum (real_of_int i#bs) t"
   4.572    have "?c = 0 \<or> (?c >0 \<and> ?c\<noteq>0) \<or> (?c<0 \<and> ?c\<noteq>0)" by arith
   4.573    moreover
   4.574    {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"] 
   4.575 @@ -1726,13 +1704,13 @@
   4.576    moreover
   4.577    {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Lt a))" 
   4.578        by (simp add: nb Let_def split_def isint_Floor isint_neg)
   4.579 -    have "?I (Lt a) = (real (?c * i) + (?N ?r) < 0)" using Ia by (simp add: Let_def split_def)
   4.580 +    have "?I (Lt a) = (real_of_int (?c * i) + (?N ?r) < 0)" using Ia by (simp add: Let_def split_def)
   4.581      also have "\<dots> = (?I (?l (Lt a)))" apply (simp only: split_int_less_real'[where a="?c*i" and b="?N ?r"]) by (simp add: Ia cp cnz Let_def split_def)
   4.582      finally have ?case using l by simp}
   4.583    moreover
   4.584    {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Lt a))" 
   4.585        by (simp add: nb Let_def split_def isint_Floor isint_neg)
   4.586 -    have "?I (Lt a) = (real (?c * i) + (?N ?r) < 0)" using Ia by (simp add: Let_def split_def)
   4.587 +    have "?I (Lt a) = (real_of_int (?c * i) + (?N ?r) < 0)" using Ia by (simp add: Let_def split_def)
   4.588      also from cn cnz have "\<dots> = (?I (?l (Lt a)))" by (simp only: split_int_less_real'[where a="?c*i" and b="?N ?r"]) (simp add: Ia Let_def split_def ac_simps, arith)
   4.589      finally have ?case using l by simp}
   4.590    ultimately show ?case by blast
   4.591 @@ -1742,8 +1720,8 @@
   4.592    let ?r = "snd (zsplit0 a)"
   4.593    have spl: "zsplit0 a = (?c,?r)" by simp
   4.594    from zsplit0_I[OF spl, where x="i" and bs="bs"] 
   4.595 -  have Ia:"Inum (real i # bs) a = Inum (real i #bs) (CN 0 ?c ?r)" and nb: "numbound0 ?r" by auto 
   4.596 -  let ?N = "\<lambda> t. Inum (real i#bs) t"
   4.597 +  have Ia:"Inum (real_of_int i # bs) a = Inum (real_of_int i #bs) (CN 0 ?c ?r)" and nb: "numbound0 ?r" by auto 
   4.598 +  let ?N = "\<lambda> t. Inum (real_of_int i#bs) t"
   4.599    have "?c = 0 \<or> (?c >0 \<and> ?c\<noteq>0) \<or> (?c<0 \<and> ?c\<noteq>0)" by arith
   4.600    moreover
   4.601    {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"] 
   4.602 @@ -1751,13 +1729,13 @@
   4.603    moreover
   4.604    {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Le a))" 
   4.605        by (simp add: nb Let_def split_def isint_Floor isint_neg)
   4.606 -    have "?I (Le a) = (real (?c * i) + (?N ?r) \<le> 0)" using Ia by (simp add: Let_def split_def)
   4.607 +    have "?I (Le a) = (real_of_int (?c * i) + (?N ?r) \<le> 0)" using Ia by (simp add: Let_def split_def)
   4.608      also have "\<dots> = (?I (?l (Le a)))" by (simp only: split_int_le_real'[where a="?c*i" and b="?N ?r"]) (simp add: Ia cp cnz Let_def split_def)
   4.609      finally have ?case using l by simp}
   4.610    moreover
   4.611    {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Le a))" 
   4.612        by (simp add: nb Let_def split_def isint_Floor isint_neg)
   4.613 -    have "?I (Le a) = (real (?c * i) + (?N ?r) \<le> 0)" using Ia by (simp add: Let_def split_def)
   4.614 +    have "?I (Le a) = (real_of_int (?c * i) + (?N ?r) \<le> 0)" using Ia by (simp add: Let_def split_def)
   4.615      also from cn cnz have "\<dots> = (?I (?l (Le a)))" by (simp only: split_int_le_real'[where a="?c*i" and b="?N ?r"]) (simp add: Ia Let_def split_def ac_simps, arith)
   4.616      finally have ?case using l by simp}
   4.617    ultimately show ?case by blast
   4.618 @@ -1767,8 +1745,8 @@
   4.619    let ?r = "snd (zsplit0 a)"
   4.620    have spl: "zsplit0 a = (?c,?r)" by simp
   4.621    from zsplit0_I[OF spl, where x="i" and bs="bs"] 
   4.622 -  have Ia:"Inum (real i # bs) a = Inum (real i #bs) (CN 0 ?c ?r)" and nb: "numbound0 ?r" by auto 
   4.623 -  let ?N = "\<lambda> t. Inum (real i#bs) t"
   4.624 +  have Ia:"Inum (real_of_int i # bs) a = Inum (real_of_int i #bs) (CN 0 ?c ?r)" and nb: "numbound0 ?r" by auto 
   4.625 +  let ?N = "\<lambda> t. Inum (real_of_int i#bs) t"
   4.626    have "?c = 0 \<or> (?c >0 \<and> ?c\<noteq>0) \<or> (?c<0 \<and> ?c\<noteq>0)" by arith
   4.627    moreover
   4.628    {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"] 
   4.629 @@ -1776,13 +1754,13 @@
   4.630    moreover
   4.631    {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Gt a))" 
   4.632        by (simp add: nb Let_def split_def isint_Floor isint_neg)
   4.633 -    have "?I (Gt a) = (real (?c * i) + (?N ?r) > 0)" using Ia by (simp add: Let_def split_def)
   4.634 +    have "?I (Gt a) = (real_of_int (?c * i) + (?N ?r) > 0)" using Ia by (simp add: Let_def split_def)
   4.635      also have "\<dots> = (?I (?l (Gt a)))" by (simp only: split_int_gt_real'[where a="?c*i" and b="?N ?r"]) (simp add: Ia cp cnz Let_def split_def)
   4.636      finally have ?case using l by simp}
   4.637    moreover
   4.638    {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Gt a))" 
   4.639        by (simp add: nb Let_def split_def isint_Floor isint_neg)
   4.640 -    have "?I (Gt a) = (real (?c * i) + (?N ?r) > 0)" using Ia by (simp add: Let_def split_def)
   4.641 +    have "?I (Gt a) = (real_of_int (?c * i) + (?N ?r) > 0)" using Ia by (simp add: Let_def split_def)
   4.642      also from cn cnz have "\<dots> = (?I (?l (Gt a)))" by (simp only: split_int_gt_real'[where a="?c*i" and b="?N ?r"]) (simp add: Ia Let_def split_def ac_simps, arith)
   4.643      finally have ?case using l by simp}
   4.644    ultimately show ?case by blast
   4.645 @@ -1792,8 +1770,8 @@
   4.646    let ?r = "snd (zsplit0 a)"
   4.647    have spl: "zsplit0 a = (?c,?r)" by simp
   4.648    from zsplit0_I[OF spl, where x="i" and bs="bs"] 
   4.649 -  have Ia:"Inum (real i # bs) a = Inum (real i #bs) (CN 0 ?c ?r)" and nb: "numbound0 ?r" by auto 
   4.650 -  let ?N = "\<lambda> t. Inum (real i#bs) t"
   4.651 +  have Ia:"Inum (real_of_int i # bs) a = Inum (real_of_int i #bs) (CN 0 ?c ?r)" and nb: "numbound0 ?r" by auto 
   4.652 +  let ?N = "\<lambda> t. Inum (real_of_int i#bs) t"
   4.653    have "?c = 0 \<or> (?c >0 \<and> ?c\<noteq>0) \<or> (?c<0 \<and> ?c\<noteq>0)" by arith
   4.654    moreover
   4.655    {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"] 
   4.656 @@ -1801,13 +1779,13 @@
   4.657    moreover
   4.658    {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Ge a))" 
   4.659        by (simp add: nb Let_def split_def isint_Floor isint_neg)
   4.660 -    have "?I (Ge a) = (real (?c * i) + (?N ?r) \<ge> 0)" using Ia by (simp add: Let_def split_def)
   4.661 +    have "?I (Ge a) = (real_of_int (?c * i) + (?N ?r) \<ge> 0)" using Ia by (simp add: Let_def split_def)
   4.662      also have "\<dots> = (?I (?l (Ge a)))" by (simp only: split_int_ge_real'[where a="?c*i" and b="?N ?r"]) (simp add: Ia cp cnz Let_def split_def)
   4.663      finally have ?case using l by simp}
   4.664    moreover
   4.665    {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Ge a))" 
   4.666        by (simp add: nb Let_def split_def isint_Floor isint_neg)
   4.667 -    have "?I (Ge a) = (real (?c * i) + (?N ?r) \<ge> 0)" using Ia by (simp add: Let_def split_def)
   4.668 +    have "?I (Ge a) = (real_of_int (?c * i) + (?N ?r) \<ge> 0)" using Ia by (simp add: Let_def split_def)
   4.669      also from cn cnz have "\<dots> = (?I (?l (Ge a)))" by (simp only: split_int_ge_real'[where a="?c*i" and b="?N ?r"]) (simp add: Ia Let_def split_def ac_simps, arith)
   4.670      finally have ?case using l by simp}
   4.671    ultimately show ?case by blast
   4.672 @@ -1817,8 +1795,8 @@
   4.673    let ?r = "snd (zsplit0 a)"
   4.674    have spl: "zsplit0 a = (?c,?r)" by simp
   4.675    from zsplit0_I[OF spl, where x="i" and bs="bs"] 
   4.676 -  have Ia:"Inum (real i # bs) a = Inum (real i #bs) (CN 0 ?c ?r)" and nb: "numbound0 ?r" by auto 
   4.677 -  let ?N = "\<lambda> t. Inum (real i#bs) t"
   4.678 +  have Ia:"Inum (real_of_int i # bs) a = Inum (real_of_int i #bs) (CN 0 ?c ?r)" and nb: "numbound0 ?r" by auto 
   4.679 +  let ?N = "\<lambda> t. Inum (real_of_int i#bs) t"
   4.680    have "?c = 0 \<or> (?c >0 \<and> ?c\<noteq>0) \<or> (?c<0 \<and> ?c\<noteq>0)" by arith
   4.681    moreover
   4.682    {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"] 
   4.683 @@ -1826,14 +1804,14 @@
   4.684    moreover
   4.685    {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Eq a))" 
   4.686        by (simp add: nb Let_def split_def isint_Floor isint_neg)
   4.687 -    have "?I (Eq a) = (real (?c * i) + (?N ?r) = 0)" using Ia by (simp add: Let_def split_def)
   4.688 -    also have "\<dots> = (?I (?l (Eq a)))" using cp cnz  by (simp only: split_int_eq_real'[where a="?c*i" and b="?N ?r"]) (simp add: Let_def split_def Ia real_of_int_mult[symmetric] del: real_of_int_mult)
   4.689 +    have "?I (Eq a) = (real_of_int (?c * i) + (?N ?r) = 0)" using Ia by (simp add: Let_def split_def)
   4.690 +    also have "\<dots> = (?I (?l (Eq a)))" using cp cnz  by (simp only: split_int_eq_real'[where a="?c*i" and b="?N ?r"]) (simp add: Let_def split_def Ia of_int_mult[symmetric] del: of_int_mult)
   4.691      finally have ?case using l by simp}
   4.692    moreover
   4.693    {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Eq a))" 
   4.694        by (simp add: nb Let_def split_def isint_Floor isint_neg)
   4.695 -    have "?I (Eq a) = (real (?c * i) + (?N ?r) = 0)" using Ia by (simp add: Let_def split_def)
   4.696 -    also from cn cnz have "\<dots> = (?I (?l (Eq a)))" by (simp only: split_int_eq_real'[where a="?c*i" and b="?N ?r"]) (simp add: Let_def split_def Ia real_of_int_mult[symmetric] del: real_of_int_mult,arith)
   4.697 +    have "?I (Eq a) = (real_of_int (?c * i) + (?N ?r) = 0)" using Ia by (simp add: Let_def split_def)
   4.698 +    also from cn cnz have "\<dots> = (?I (?l (Eq a)))" by (simp only: split_int_eq_real'[where a="?c*i" and b="?N ?r"]) (simp add: Let_def split_def Ia of_int_mult[symmetric] del: of_int_mult,arith)
   4.699      finally have ?case using l by simp}
   4.700    ultimately show ?case by blast
   4.701  next
   4.702 @@ -1842,8 +1820,8 @@
   4.703    let ?r = "snd (zsplit0 a)"
   4.704    have spl: "zsplit0 a = (?c,?r)" by simp
   4.705    from zsplit0_I[OF spl, where x="i" and bs="bs"] 
   4.706 -  have Ia:"Inum (real i # bs) a = Inum (real i #bs) (CN 0 ?c ?r)" and nb: "numbound0 ?r" by auto 
   4.707 -  let ?N = "\<lambda> t. Inum (real i#bs) t"
   4.708 +  have Ia:"Inum (real_of_int i # bs) a = Inum (real_of_int i #bs) (CN 0 ?c ?r)" and nb: "numbound0 ?r" by auto 
   4.709 +  let ?N = "\<lambda> t. Inum (real_of_int i#bs) t"
   4.710    have "?c = 0 \<or> (?c >0 \<and> ?c\<noteq>0) \<or> (?c<0 \<and> ?c\<noteq>0)" by arith
   4.711    moreover
   4.712    {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"] 
   4.713 @@ -1851,14 +1829,14 @@
   4.714    moreover
   4.715    {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (NEq a))" 
   4.716        by (simp add: nb Let_def split_def isint_Floor isint_neg)
   4.717 -    have "?I (NEq a) = (real (?c * i) + (?N ?r) \<noteq> 0)" using Ia by (simp add: Let_def split_def)
   4.718 -    also have "\<dots> = (?I (?l (NEq a)))" using cp cnz  by (simp only: split_int_eq_real'[where a="?c*i" and b="?N ?r"]) (simp add: Let_def split_def Ia real_of_int_mult[symmetric] del: real_of_int_mult)
   4.719 +    have "?I (NEq a) = (real_of_int (?c * i) + (?N ?r) \<noteq> 0)" using Ia by (simp add: Let_def split_def)
   4.720 +    also have "\<dots> = (?I (?l (NEq a)))" using cp cnz  by (simp only: split_int_eq_real'[where a="?c*i" and b="?N ?r"]) (simp add: Let_def split_def Ia of_int_mult[symmetric] del: of_int_mult)
   4.721      finally have ?case using l by simp}
   4.722    moreover
   4.723    {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (NEq a))" 
   4.724        by (simp add: nb Let_def split_def isint_Floor isint_neg)
   4.725 -    have "?I (NEq a) = (real (?c * i) + (?N ?r) \<noteq> 0)" using Ia by (simp add: Let_def split_def)
   4.726 -    also from cn cnz have "\<dots> = (?I (?l (NEq a)))" by (simp only: split_int_eq_real'[where a="?c*i" and b="?N ?r"]) (simp add: Let_def split_def Ia real_of_int_mult[symmetric] del: real_of_int_mult,arith)
   4.727 +    have "?I (NEq a) = (real_of_int (?c * i) + (?N ?r) \<noteq> 0)" using Ia by (simp add: Let_def split_def)
   4.728 +    also from cn cnz have "\<dots> = (?I (?l (NEq a)))" by (simp only: split_int_eq_real'[where a="?c*i" and b="?N ?r"]) (simp add: Let_def split_def Ia of_int_mult[symmetric] del: of_int_mult,arith)
   4.729      finally have ?case using l by simp}
   4.730    ultimately show ?case by blast
   4.731  next
   4.732 @@ -1867,8 +1845,8 @@
   4.733    let ?r = "snd (zsplit0 a)"
   4.734    have spl: "zsplit0 a = (?c,?r)" by simp
   4.735    from zsplit0_I[OF spl, where x="i" and bs="bs"] 
   4.736 -  have Ia:"Inum (real i # bs) a = Inum (real i #bs) (CN 0 ?c ?r)" and nb: "numbound0 ?r" by auto 
   4.737 -  let ?N = "\<lambda> t. Inum (real i#bs) t"
   4.738 +  have Ia:"Inum (real_of_int i # bs) a = Inum (real_of_int i #bs) (CN 0 ?c ?r)" and nb: "numbound0 ?r" by auto 
   4.739 +  let ?N = "\<lambda> t. Inum (real_of_int i#bs) t"
   4.740    have "j=0 \<or> (j\<noteq>0 \<and> ?c = 0) \<or> (j\<noteq>0 \<and> ?c >0 \<and> ?c\<noteq>0) \<or> (j\<noteq> 0 \<and> ?c<0 \<and> ?c\<noteq>0)" by arith
   4.741    moreover
   4.742    { assume j: "j=0" hence z: "zlfm (Dvd j a) = (zlfm (Eq a))" by (simp add: Let_def) 
   4.743 @@ -1880,31 +1858,31 @@
   4.744    moreover
   4.745    {assume cp: "?c > 0" and cnz: "?c\<noteq>0" and jnz: "j\<noteq>0" hence l: "?L (?l (Dvd j a))" 
   4.746        by (simp add: nb Let_def split_def isint_Floor isint_neg)
   4.747 -    have "?I (Dvd j a) = (real j rdvd (real (?c * i) + (?N ?r)))" 
   4.748 +    have "?I (Dvd j a) = (real_of_int j rdvd (real_of_int (?c * i) + (?N ?r)))" 
   4.749        using Ia by (simp add: Let_def split_def)
   4.750 -    also have "\<dots> = (real (abs j) rdvd real (?c*i) + (?N ?r))" 
   4.751 -      by (simp only: rdvd_abs1[where d="j" and t="real (?c*i) + ?N ?r", symmetric]) simp
   4.752 -    also have "\<dots> = ((abs j) dvd (floor ((?N ?r) + real (?c*i))) \<and> 
   4.753 -       (real (floor ((?N ?r) + real (?c*i))) = (real (?c*i) + (?N ?r))))" 
   4.754 -      by(simp only: int_rdvd_real[where i="abs j" and x="real (?c*i) + (?N ?r)"]) (simp only: ac_simps)
   4.755 +    also have "\<dots> = (real_of_int (abs j) rdvd real_of_int (?c*i) + (?N ?r))" 
   4.756 +      by (simp only: rdvd_abs1[where d="j" and t="real_of_int (?c*i) + ?N ?r", symmetric]) simp
   4.757 +    also have "\<dots> = ((abs j) dvd (floor ((?N ?r) + real_of_int (?c*i))) \<and> 
   4.758 +       (real_of_int (floor ((?N ?r) + real_of_int (?c*i))) = (real_of_int (?c*i) + (?N ?r))))" 
   4.759 +      by(simp only: int_rdvd_real[where i="abs j" and x="real_of_int (?c*i) + (?N ?r)"]) (simp only: ac_simps)
   4.760      also have "\<dots> = (?I (?l (Dvd j a)))" using cp cnz jnz  
   4.761        by (simp add: Let_def split_def int_rdvd_iff[symmetric]  
   4.762 -        del: real_of_int_mult) (auto simp add: ac_simps)
   4.763 +        del: of_int_mult) (auto simp add: ac_simps)
   4.764      finally have ?case using l jnz  by simp }
   4.765    moreover
   4.766    {assume cn: "?c < 0" and cnz: "?c\<noteq>0" and jnz: "j\<noteq>0" hence l: "?L (?l (Dvd j a))" 
   4.767        by (simp add: nb Let_def split_def isint_Floor isint_neg)
   4.768 -    have "?I (Dvd j a) = (real j rdvd (real (?c * i) + (?N ?r)))" 
   4.769 +    have "?I (Dvd j a) = (real_of_int j rdvd (real_of_int (?c * i) + (?N ?r)))" 
   4.770        using Ia by (simp add: Let_def split_def)
   4.771 -    also have "\<dots> = (real (abs j) rdvd real (?c*i) + (?N ?r))" 
   4.772 -      by (simp only: rdvd_abs1[where d="j" and t="real (?c*i) + ?N ?r", symmetric]) simp
   4.773 -    also have "\<dots> = ((abs j) dvd (floor ((?N ?r) + real (?c*i))) \<and> 
   4.774 -       (real (floor ((?N ?r) + real (?c*i))) = (real (?c*i) + (?N ?r))))" 
   4.775 -      by(simp only: int_rdvd_real[where i="abs j" and x="real (?c*i) + (?N ?r)"]) (simp only: ac_simps)
   4.776 +    also have "\<dots> = (real_of_int (abs j) rdvd real_of_int (?c*i) + (?N ?r))" 
   4.777 +      by (simp only: rdvd_abs1[where d="j" and t="real_of_int (?c*i) + ?N ?r", symmetric]) simp
   4.778 +    also have "\<dots> = ((abs j) dvd (floor ((?N ?r) + real_of_int (?c*i))) \<and> 
   4.779 +       (real_of_int (floor ((?N ?r) + real_of_int (?c*i))) = (real_of_int (?c*i) + (?N ?r))))" 
   4.780 +      by(simp only: int_rdvd_real[where i="abs j" and x="real_of_int (?c*i) + (?N ?r)"]) (simp only: ac_simps)
   4.781      also have "\<dots> = (?I (?l (Dvd j a)))" using cn cnz jnz
   4.782 -      using rdvd_minus [where d="abs j" and t="real (?c*i + floor (?N ?r))", simplified, symmetric]
   4.783 +      using rdvd_minus [where d="abs j" and t="real_of_int (?c*i + floor (?N ?r))", simplified, symmetric]
   4.784        by (simp add: Let_def split_def int_rdvd_iff[symmetric]  
   4.785 -        del: real_of_int_mult) (auto simp add: ac_simps)
   4.786 +        del: of_int_mult) (auto simp add: ac_simps)
   4.787      finally have ?case using l jnz by blast }
   4.788    ultimately show ?case by blast
   4.789  next
   4.790 @@ -1913,8 +1891,8 @@
   4.791    let ?r = "snd (zsplit0 a)"
   4.792    have spl: "zsplit0 a = (?c,?r)" by simp
   4.793    from zsplit0_I[OF spl, where x="i" and bs="bs"] 
   4.794 -  have Ia:"Inum (real i # bs) a = Inum (real i #bs) (CN 0 ?c ?r)" and nb: "numbound0 ?r" by auto 
   4.795 -  let ?N = "\<lambda> t. Inum (real i#bs) t"
   4.796 +  have Ia:"Inum (real_of_int i # bs) a = Inum (real_of_int i #bs) (CN 0 ?c ?r)" and nb: "numbound0 ?r" by auto 
   4.797 +  let ?N = "\<lambda> t. Inum (real_of_int i#bs) t"
   4.798    have "j=0 \<or> (j\<noteq>0 \<and> ?c = 0) \<or> (j\<noteq>0 \<and> ?c >0 \<and> ?c\<noteq>0) \<or> (j\<noteq> 0 \<and> ?c<0 \<and> ?c\<noteq>0)" by arith
   4.799    moreover
   4.800    {assume j: "j=0" hence z: "zlfm (NDvd j a) = (zlfm (NEq a))" by (simp add: Let_def) 
   4.801 @@ -1926,31 +1904,31 @@
   4.802    moreover
   4.803    {assume cp: "?c > 0" and cnz: "?c\<noteq>0" and jnz: "j\<noteq>0" hence l: "?L (?l (NDvd j a))" 
   4.804        by (simp add: nb Let_def split_def isint_Floor isint_neg)
   4.805 -    have "?I (NDvd j a) = (\<not> (real j rdvd (real (?c * i) + (?N ?r))))" 
   4.806 +    have "?I (NDvd j a) = (\<not> (real_of_int j rdvd (real_of_int (?c * i) + (?N ?r))))" 
   4.807        using Ia by (simp add: Let_def split_def)
   4.808 -    also have "\<dots> = (\<not> (real (abs j) rdvd real (?c*i) + (?N ?r)))" 
   4.809 -      by (simp only: rdvd_abs1[where d="j" and t="real (?c*i) + ?N ?r", symmetric]) simp
   4.810 -    also have "\<dots> = (\<not> ((abs j) dvd (floor ((?N ?r) + real (?c*i))) \<and> 
   4.811 -       (real (floor ((?N ?r) + real (?c*i))) = (real (?c*i) + (?N ?r)))))" 
   4.812 -      by(simp only: int_rdvd_real[where i="abs j" and x="real (?c*i) + (?N ?r)"]) (simp only: ac_simps)
   4.813 +    also have "\<dots> = (\<not> (real_of_int (abs j) rdvd real_of_int (?c*i) + (?N ?r)))" 
   4.814 +      by (simp only: rdvd_abs1[where d="j" and t="real_of_int (?c*i) + ?N ?r", symmetric]) simp
   4.815 +    also have "\<dots> = (\<not> ((abs j) dvd (floor ((?N ?r) + real_of_int (?c*i))) \<and> 
   4.816 +       (real_of_int (floor ((?N ?r) + real_of_int (?c*i))) = (real_of_int (?c*i) + (?N ?r)))))" 
   4.817 +      by(simp only: int_rdvd_real[where i="abs j" and x="real_of_int (?c*i) + (?N ?r)"]) (simp only: ac_simps)
   4.818      also have "\<dots> = (?I (?l (NDvd j a)))" using cp cnz jnz  
   4.819        by (simp add: Let_def split_def int_rdvd_iff[symmetric]  
   4.820 -        del: real_of_int_mult) (auto simp add: ac_simps)
   4.821 +        del: of_int_mult) (auto simp add: ac_simps)
   4.822      finally have ?case using l jnz  by simp }
   4.823    moreover
   4.824    {assume cn: "?c < 0" and cnz: "?c\<noteq>0" and jnz: "j\<noteq>0" hence l: "?L (?l (NDvd j a))" 
   4.825        by (simp add: nb Let_def split_def isint_Floor isint_neg)
   4.826 -    have "?I (NDvd j a) = (\<not> (real j rdvd (real (?c * i) + (?N ?r))))" 
   4.827 +    have "?I (NDvd j a) = (\<not> (real_of_int j rdvd (real_of_int (?c * i) + (?N ?r))))" 
   4.828        using Ia by (simp add: Let_def split_def)
   4.829 -    also have "\<dots> = (\<not> (real (abs j) rdvd real (?c*i) + (?N ?r)))" 
   4.830 -      by (simp only: rdvd_abs1[where d="j" and t="real (?c*i) + ?N ?r", symmetric]) simp
   4.831 -    also have "\<dots> = (\<not> ((abs j) dvd (floor ((?N ?r) + real (?c*i))) \<and> 
   4.832 -       (real (floor ((?N ?r) + real (?c*i))) = (real (?c*i) + (?N ?r)))))" 
   4.833 -      by(simp only: int_rdvd_real[where i="abs j" and x="real (?c*i) + (?N ?r)"]) (simp only: ac_simps)
   4.834 +    also have "\<dots> = (\<not> (real_of_int (abs j) rdvd real_of_int (?c*i) + (?N ?r)))" 
   4.835 +      by (simp only: rdvd_abs1[where d="j" and t="real_of_int (?c*i) + ?N ?r", symmetric]) simp
   4.836 +    also have "\<dots> = (\<not> ((abs j) dvd (floor ((?N ?r) + real_of_int (?c*i))) \<and> 
   4.837 +       (real_of_int (floor ((?N ?r) + real_of_int (?c*i))) = (real_of_int (?c*i) + (?N ?r)))))" 
   4.838 +      by(simp only: int_rdvd_real[where i="abs j" and x="real_of_int (?c*i) + (?N ?r)"]) (simp only: ac_simps)
   4.839      also have "\<dots> = (?I (?l (NDvd j a)))" using cn cnz jnz
   4.840 -      using rdvd_minus [where d="abs j" and t="real (?c*i + floor (?N ?r))", simplified, symmetric]
   4.841 +      using rdvd_minus [where d="abs j" and t="real_of_int (?c*i + floor (?N ?r))", simplified, symmetric]
   4.842        by (simp add: Let_def split_def int_rdvd_iff[symmetric]  
   4.843 -        del: real_of_int_mult) (auto simp add: ac_simps)
   4.844 +        del: of_int_mult) (auto simp add: ac_simps)
   4.845      finally have ?case using l jnz by blast }
   4.846    ultimately show ?case by blast
   4.847  qed auto
   4.848 @@ -2040,7 +2018,7 @@
   4.849  
   4.850  lemma minusinf_inf:
   4.851    assumes linp: "iszlfm p (a # bs)"
   4.852 -  shows "\<exists> (z::int). \<forall> x < z. Ifm ((real x)#bs) (minusinf p) = Ifm ((real x)#bs) p"
   4.853 +  shows "\<exists> (z::int). \<forall> x < z. Ifm ((real_of_int x)#bs) (minusinf p) = Ifm ((real_of_int x)#bs) p"
   4.854    (is "?P p" is "\<exists> (z::int). \<forall> x < z. ?I x (?M p) = ?I x p")
   4.855  using linp
   4.856  proof (induct p rule: minusinf.induct)
   4.857 @@ -2064,173 +2042,173 @@
   4.858  next
   4.859    case (3 c e) 
   4.860    then have "c > 0" by simp
   4.861 -  hence rcpos: "real c > 0" by simp
   4.862 +  hence rcpos: "real_of_int c > 0" by simp
   4.863    from 3 have nbe: "numbound0 e" by simp
   4.864    fix y
   4.865 -  have "\<forall> x < (floor (- (Inum (y#bs) e) / (real c))). ?I x (?M (Eq (CN 0 c e))) = ?I x (Eq (CN 0 c e))"
   4.866 -  proof (simp add: less_floor_eq , rule allI, rule impI) 
   4.867 +  have "\<forall> x < (floor (- (Inum (y#bs) e) / (real_of_int c))). ?I x (?M (Eq (CN 0 c e))) = ?I x (Eq (CN 0 c e))"
   4.868 +  proof (simp add: less_floor_iff , rule allI, rule impI) 
   4.869      fix x :: int
   4.870 -    assume A: "real x + 1 \<le> - (Inum (y # bs) e / real c)"
   4.871 -    hence th1:"real x < - (Inum (y # bs) e / real c)" by simp
   4.872 -    with rcpos  have "(real c)*(real  x) < (real c)*(- (Inum (y # bs) e / real c))"
   4.873 +    assume A: "real_of_int x + 1 \<le> - (Inum (y # bs) e / real_of_int c)"
   4.874 +    hence th1:"real_of_int x < - (Inum (y # bs) e / real_of_int c)" by simp
   4.875 +    with rcpos  have "(real_of_int c)*(real_of_int  x) < (real_of_int c)*(- (Inum (y # bs) e / real_of_int c))"
   4.876        by (simp only: mult_strict_left_mono [OF th1 rcpos])
   4.877 -    hence "real c * real x + Inum (y # bs) e \<noteq> 0"using rcpos  by simp
   4.878 -    thus "real c * real x + Inum (real x # bs) e \<noteq> 0" 
   4.879 -      using numbound0_I[OF nbe, where b="y" and bs="bs" and b'="real x"]  by simp
   4.880 +    hence "real_of_int c * real_of_int x + Inum (y # bs) e \<noteq> 0"using rcpos  by simp
   4.881 +    thus "real_of_int c * real_of_int x + Inum (real_of_int x # bs) e \<noteq> 0" 
   4.882 +      using numbound0_I[OF nbe, where b="y" and bs="bs" and b'="real_of_int x"]  by simp
   4.883    qed
   4.884    thus ?case by blast
   4.885  next
   4.886    case (4 c e) 
   4.887 -  then have "c > 0" by simp hence rcpos: "real c > 0" by simp
   4.888 +  then have "c > 0" by simp hence rcpos: "real_of_int c > 0" by simp
   4.889    from 4 have nbe: "numbound0 e" by simp
   4.890    fix y
   4.891 -  have "\<forall> x < (floor (- (Inum (y#bs) e) / (real c))). ?I x (?M (NEq (CN 0 c e))) = ?I x (NEq (CN 0 c e))"
   4.892 -  proof (simp add: less_floor_eq , rule allI, rule impI) 
   4.893 +  have "\<forall> x < (floor (- (Inum (y#bs) e) / (real_of_int c))). ?I x (?M (NEq (CN 0 c e))) = ?I x (NEq (CN 0 c e))"
   4.894 +  proof (simp add: less_floor_iff , rule allI, rule impI) 
   4.895      fix x :: int
   4.896 -    assume A: "real x + 1 \<le> - (Inum (y # bs) e / real c)"
   4.897 -    hence th1:"real x < - (Inum (y # bs) e / real c)" by simp
   4.898 -    with rcpos  have "(real c)*(real  x) < (real c)*(- (Inum (y # bs) e / real c))"
   4.899 +    assume A: "real_of_int x + 1 \<le> - (Inum (y # bs) e / real_of_int c)"
   4.900 +    hence th1:"real_of_int x < - (Inum (y # bs) e / real_of_int c)" by simp
   4.901 +    with rcpos  have "(real_of_int c)*(real_of_int x) < (real_of_int c)*(- (Inum (y # bs) e / real_of_int c))"
   4.902        by (simp only: mult_strict_left_mono [OF th1 rcpos])
   4.903 -    hence "real c * real x + Inum (y # bs) e \<noteq> 0"using rcpos  by simp
   4.904 -    thus "real c * real x + Inum (real x # bs) e \<noteq> 0" 
   4.905 -      using numbound0_I[OF nbe, where b="y" and bs="bs" and b'="real x"]  by simp
   4.906 +    hence "real_of_int c * real_of_int x + Inum (y # bs) e \<noteq> 0"using rcpos  by simp
   4.907 +    thus "real_of_int c * real_of_int x + Inum (real_of_int x # bs) e \<noteq> 0" 
   4.908 +      using numbound0_I[OF nbe, where b="y" and bs="bs" and b'="real_of_int x"]  by simp
   4.909    qed
   4.910    thus ?case by blast
   4.911  next
   4.912    case (5 c e) 
   4.913 -  then have "c > 0" by simp hence rcpos: "real c > 0" by simp
   4.914 +  then have "c > 0" by simp hence rcpos: "real_of_int c > 0" by simp
   4.915    from 5 have nbe: "numbound0 e" by simp
   4.916    fix y
   4.917 -  have "\<forall> x < (floor (- (Inum (y#bs) e) / (real c))). ?I x (?M (Lt (CN 0 c e))) = ?I x (Lt (CN 0 c e))"
   4.918 -  proof (simp add: less_floor_eq , rule allI, rule impI) 
   4.919 +  have "\<forall> x < (floor (- (Inum (y#bs) e) / (real_of_int c))). ?I x (?M (Lt (CN 0 c e))) = ?I x (Lt (CN 0 c e))"
   4.920 +  proof (simp add: less_floor_iff , rule allI, rule impI) 
   4.921      fix x :: int
   4.922 -    assume A: "real x + 1 \<le> - (Inum (y # bs) e / real c)"
   4.923 -    hence th1:"real x < - (Inum (y # bs) e / real c)" by simp
   4.924 -    with rcpos  have "(real c)*(real  x) < (real c)*(- (Inum (y # bs) e / real c))"
   4.925 +    assume A: "real_of_int x + 1 \<le> - (Inum (y # bs) e / real_of_int c)"
   4.926 +    hence th1:"real_of_int x < - (Inum (y # bs) e / real_of_int c)" by simp
   4.927 +    with rcpos  have "(real_of_int c)*(real_of_int x) < (real_of_int c)*(- (Inum (y # bs) e / real_of_int c))"
   4.928        by (simp only: mult_strict_left_mono [OF th1 rcpos])
   4.929 -    thus "real c * real x + Inum (real x # bs) e < 0" 
   4.930 -      using numbound0_I[OF nbe, where b="y" and bs="bs" and b'="real x"] rcpos by simp
   4.931 +    thus "real_of_int c * real_of_int x + Inum (real_of_int x # bs) e < 0" 
   4.932 +      using numbound0_I[OF nbe, where b="y" and bs="bs" and b'="real_of_int x"] rcpos by simp
   4.933    qed
   4.934    thus ?case by blast
   4.935  next
   4.936    case (6 c e) 
   4.937 -  then have "c > 0" by simp hence rcpos: "real c > 0" by simp
   4.938 +  then have "c > 0" by simp hence rcpos: "real_of_int c > 0" by simp
   4.939    from 6 have nbe: "numbound0 e" by simp
   4.940    fix y
   4.941 -  have "\<forall> x < (floor (- (Inum (y#bs) e) / (real c))). ?I x (?M (Le (CN 0 c e))) = ?I x (Le (CN 0 c e))"
   4.942 -  proof (simp add: less_floor_eq , rule allI, rule impI) 
   4.943 +  have "\<forall> x < (floor (- (Inum (y#bs) e) / (real_of_int c))). ?I x (?M (Le (CN 0 c e))) = ?I x (Le (CN 0 c e))"
   4.944 +  proof (simp add: less_floor_iff , rule allI, rule impI) 
   4.945      fix x :: int
   4.946 -    assume A: "real x + 1 \<le> - (Inum (y # bs) e / real c)"
   4.947 -    hence th1:"real x < - (Inum (y # bs) e / real c)" by simp
   4.948 -    with rcpos  have "(real c)*(real  x) < (real c)*(- (Inum (y # bs) e / real c))"
   4.949 +    assume A: "real_of_int x + 1 \<le> - (Inum (y # bs) e / real_of_int c)"
   4.950 +    hence th1:"real_of_int x < - (Inum (y # bs) e / real_of_int c)" by simp
   4.951 +    with rcpos  have "(real_of_int c)*(real_of_int x) < (real_of_int c)*(- (Inum (y # bs) e / real_of_int c))"
   4.952        by (simp only: mult_strict_left_mono [OF th1 rcpos])
   4.953 -    thus "real c * real x + Inum (real x # bs) e \<le> 0" 
   4.954 -      using numbound0_I[OF nbe, where b="y" and bs="bs" and b'="real x"] rcpos by simp
   4.955 +    thus "real_of_int c * real_of_int x + Inum (real_of_int x # bs) e \<le> 0" 
   4.956 +      using numbound0_I[OF nbe, where b="y" and bs="bs" and b'="real_of_int x"] rcpos by simp
   4.957    qed
   4.958    thus ?case by blast
   4.959  next
   4.960    case (7 c e) 
   4.961 -  then have "c > 0" by simp hence rcpos: "real c > 0" by simp
   4.962 +  then have "c > 0" by simp hence rcpos: "real_of_int c > 0" by simp
   4.963    from 7 have nbe: "numbound0 e" by simp
   4.964    fix y
   4.965 -  have "\<forall> x < (floor (- (Inum (y#bs) e) / (real c))). ?I x (?M (Gt (CN 0 c e))) = ?I x (Gt (CN 0 c e))"
   4.966 -  proof (simp add: less_floor_eq , rule allI, rule impI) 
   4.967 +  have "\<forall> x < (floor (- (Inum (y#bs) e) / (real_of_int c))). ?I x (?M (Gt (CN 0 c e))) = ?I x (Gt (CN 0 c e))"
   4.968 +  proof (simp add: less_floor_iff , rule allI, rule impI) 
   4.969      fix x :: int
   4.970 -    assume A: "real x + 1 \<le> - (Inum (y # bs) e / real c)"
   4.971 -    hence th1:"real x < - (Inum (y # bs) e / real c)" by simp
   4.972 -    with rcpos  have "(real c)*(real  x) < (real c)*(- (Inum (y # bs) e / real c))"
   4.973 +    assume A: "real_of_int x + 1 \<le> - (Inum (y # bs) e / real_of_int c)"
   4.974 +    hence th1:"real_of_int x < - (Inum (y # bs) e / real_of_int c)" by simp
   4.975 +    with rcpos  have "(real_of_int c)*(real_of_int x) < (real_of_int c)*(- (Inum (y # bs) e / real_of_int c))"
   4.976        by (simp only: mult_strict_left_mono [OF th1 rcpos])
   4.977 -    thus "\<not> (real c * real x + Inum (real x # bs) e>0)" 
   4.978 -      using numbound0_I[OF nbe, where b="y" and bs="bs" and b'="real x"] rcpos by simp
   4.979 +    thus "\<not> (real_of_int c * real_of_int x + Inum (real_of_int x # bs) e>0)" 
   4.980 +      using numbound0_I[OF nbe, where b="y" and bs="bs" and b'="real_of_int x"] rcpos by simp
   4.981    qed
   4.982    thus ?case by blast
   4.983  next
   4.984    case (8 c e) 
   4.985 -  then have "c > 0" by simp hence rcpos: "real c > 0" by simp
   4.986 +  then have "c > 0" by simp hence rcpos: "real_of_int c > 0" by simp
   4.987    from 8 have nbe: "numbound0 e" by simp
   4.988    fix y
   4.989 -  have "\<forall> x < (floor (- (Inum (y#bs) e) / (real c))). ?I x (?M (Ge (CN 0 c e))) = ?I x (Ge (CN 0 c e))"
   4.990 -  proof (simp add: less_floor_eq , rule allI, rule impI) 
   4.991 +  have "\<forall> x < (floor (- (Inum (y#bs) e) / (real_of_int c))). ?I x (?M (Ge (CN 0 c e))) = ?I x (Ge (CN 0 c e))"
   4.992 +  proof (simp add: less_floor_iff , rule allI, rule impI) 
   4.993      fix x :: int
   4.994 -    assume A: "real x + 1 \<le> - (Inum (y # bs) e / real c)"
   4.995 -    hence th1:"real x < - (Inum (y # bs) e / real c)" by simp
   4.996 -    with rcpos  have "(real c)*(real  x) < (real c)*(- (Inum (y # bs) e / real c))"
   4.997 +    assume A: "real_of_int x + 1 \<le> - (Inum (y # bs) e / real_of_int c)"
   4.998 +    hence th1:"real_of_int x < - (Inum (y # bs) e / real_of_int c)" by simp
   4.999 +    with rcpos  have "(real_of_int c)*(real_of_int x) < (real_of_int c)*(- (Inum (y # bs) e / real_of_int c))"
  4.1000        by (simp only: mult_strict_left_mono [OF th1 rcpos])
  4.1001 -    thus "\<not> real c * real x + Inum (real x # bs) e \<ge> 0" 
  4.1002 -      using numbound0_I[OF nbe, where b="y" and bs="bs" and b'="real x"] rcpos by simp
  4.1003 +    thus "\<not> real_of_int c * real_of_int x + Inum (real_of_int x # bs) e \<ge> 0" 
  4.1004 +      using numbound0_I[OF nbe, where b="y" and bs="bs" and b'="real_of_int x"] rcpos by simp
  4.1005    qed
  4.1006    thus ?case by blast
  4.1007  qed simp_all
  4.1008  
  4.1009  lemma minusinf_repeats:
  4.1010    assumes d: "d_\<delta> p d" and linp: "iszlfm p (a # bs)"
  4.1011 -  shows "Ifm ((real(x - k*d))#bs) (minusinf p) = Ifm (real x #bs) (minusinf p)"
  4.1012 +  shows "Ifm ((real_of_int(x - k*d))#bs) (minusinf p) = Ifm (real_of_int x #bs) (minusinf p)"
  4.1013  using linp d
  4.1014  proof(induct p rule: iszlfm.induct) 
  4.1015    case (9 i c e) hence nbe: "numbound0 e"  and id: "i dvd d" by simp+
  4.1016      hence "\<exists> k. d=i*k" by (simp add: dvd_def)
  4.1017      then obtain "di" where di_def: "d=i*di" by blast
  4.1018      show ?case 
  4.1019 -    proof(simp add: numbound0_I[OF nbe,where bs="bs" and b="real x - real k * real d" and b'="real x"] right_diff_distrib, rule iffI)
  4.1020 +    proof(simp add: numbound0_I[OF nbe,where bs="bs" and b="real_of_int x - real_of_int k * real_of_int d" and b'="real_of_int x"] right_diff_distrib, rule iffI)
  4.1021        assume 
  4.1022 -        "real i rdvd real c * real x - real c * (real k * real d) + Inum (real x # bs) e"
  4.1023 +        "real_of_int i rdvd real_of_int c * real_of_int x - real_of_int c * (real_of_int k * real_of_int d) + Inum (real_of_int x # bs) e"
  4.1024        (is "?ri rdvd ?rc*?rx - ?rc*(?rk*?rd) + ?I x e" is "?ri rdvd ?rt")
  4.1025 -      hence "\<exists> (l::int). ?rt = ?ri * (real l)" by (simp add: rdvd_def)
  4.1026 -      hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri*(real l)+?rc*(?rk * (real i) * (real di))" 
  4.1027 +      hence "\<exists> (l::int). ?rt = ?ri * (real_of_int l)" by (simp add: rdvd_def)
  4.1028 +      hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri*(real_of_int l)+?rc*(?rk * (real_of_int i) * (real_of_int di))" 
  4.1029          by (simp add: algebra_simps di_def)
  4.1030 -      hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri*(real (l + c*k*di))"
  4.1031 +      hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri*(real_of_int (l + c*k*di))"
  4.1032          by (simp add: algebra_simps)
  4.1033 -      hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri* (real l)" by blast
  4.1034 -      thus "real i rdvd real c * real x + Inum (real x # bs) e" using rdvd_def by simp
  4.1035 +      hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri* (real_of_int l)" by blast
  4.1036 +      thus "real_of_int i rdvd real_of_int c * real_of_int x + Inum (real_of_int x # bs) e" using rdvd_def by simp
  4.1037      next
  4.1038        assume 
  4.1039 -        "real i rdvd real c * real x + Inum (real x # bs) e" (is "?ri rdvd ?rc*?rx+?e")
  4.1040 -      hence "\<exists> (l::int). ?rc*?rx+?e = ?ri * (real l)" by (simp add: rdvd_def)
  4.1041 -      hence "\<exists> (l::int). ?rc*?rx - real c * (real k * real d) +?e = ?ri * (real l) - real c * (real k * real d)" by simp
  4.1042 -      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)
  4.1043 -      hence "\<exists> (l::int). ?rc*?rx - real c * (real k * real d) +?e = ?ri * (real (l - c*k*di))" by (simp add: algebra_simps)
  4.1044 -      hence "\<exists> (l::int). ?rc*?rx - real c * (real k * real d) +?e = ?ri * (real l)"
  4.1045 +        "real_of_int i rdvd real_of_int c * real_of_int x + Inum (real_of_int x # bs) e" (is "?ri rdvd ?rc*?rx+?e")
  4.1046 +      hence "\<exists> (l::int). ?rc*?rx+?e = ?ri * (real_of_int l)" by (simp add: rdvd_def)
  4.1047 +      hence "\<exists> (l::int). ?rc*?rx - real_of_int c * (real_of_int k * real_of_int d) +?e = ?ri * (real_of_int l) - real_of_int c * (real_of_int k * real_of_int d)" by simp
  4.1048 +      hence "\<exists> (l::int). ?rc*?rx - real_of_int c * (real_of_int k * real_of_int d) +?e = ?ri * (real_of_int l) - real_of_int c * (real_of_int k * real_of_int i * real_of_int di)" by (simp add: di_def)
  4.1049 +      hence "\<exists> (l::int). ?rc*?rx - real_of_int c * (real_of_int k * real_of_int d) +?e = ?ri * (real_of_int (l - c*k*di))" by (simp add: algebra_simps)
  4.1050 +      hence "\<exists> (l::int). ?rc*?rx - real_of_int c * (real_of_int k * real_of_int d) +?e = ?ri * (real_of_int l)"
  4.1051          by blast
  4.1052 -      thus "real i rdvd real c * real x - real c * (real k * real d) + Inum (real x # bs) e" using rdvd_def by simp
  4.1053 +      thus "real_of_int i rdvd real_of_int c * real_of_int x - real_of_int c * (real_of_int k * real_of_int d) + Inum (real_of_int x # bs) e" using rdvd_def by simp
  4.1054      qed
  4.1055  next
  4.1056    case (10 i c e) hence nbe: "numbound0 e"  and id: "i dvd d" by simp+
  4.1057      hence "\<exists> k. d=i*k" by (simp add: dvd_def)
  4.1058      then obtain "di" where di_def: "d=i*di" by blast
  4.1059      show ?case 
  4.1060 -    proof(simp add: numbound0_I[OF nbe,where bs="bs" and b="real x - real k * real d" and b'="real x"] right_diff_distrib, rule iffI)
  4.1061 +    proof(simp add: numbound0_I[OF nbe,where bs="bs" and b="real_of_int x - real_of_int k * real_of_int d" and b'="real_of_int x"] right_diff_distrib, rule iffI)
  4.1062        assume 
  4.1063 -        "real i rdvd real c * real x - real c * (real k * real d) + Inum (real x # bs) e"
  4.1064 +        "real_of_int i rdvd real_of_int c * real_of_int x - real_of_int c * (real_of_int k * real_of_int d) + Inum (real_of_int x # bs) e"
  4.1065        (is "?ri rdvd ?rc*?rx - ?rc*(?rk*?rd) + ?I x e" is "?ri rdvd ?rt")
  4.1066 -      hence "\<exists> (l::int). ?rt = ?ri * (real l)" by (simp add: rdvd_def)
  4.1067 -      hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri*(real l)+?rc*(?rk * (real i) * (real di))" 
  4.1068 +      hence "\<exists> (l::int). ?rt = ?ri * (real_of_int l)" by (simp add: rdvd_def)
  4.1069 +      hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri*(real_of_int l)+?rc*(?rk * (real_of_int i) * (real_of_int di))" 
  4.1070          by (simp add: algebra_simps di_def)
  4.1071 -      hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri*(real (l + c*k*di))"
  4.1072 +      hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri*(real_of_int (l + c*k*di))"
  4.1073          by (simp add: algebra_simps)
  4.1074 -      hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri* (real l)" by blast
  4.1075 -      thus "real i rdvd real c * real x + Inum (real x # bs) e" using rdvd_def by simp
  4.1076 +      hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri* (real_of_int l)" by blast
  4.1077 +      thus "real_of_int i rdvd real_of_int c * real_of_int x + Inum (real_of_int x # bs) e" using rdvd_def by simp
  4.1078      next
  4.1079        assume 
  4.1080 -        "real i rdvd real c * real x + Inum (real x # bs) e" (is "?ri rdvd ?rc*?rx+?e")
  4.1081 -      hence "\<exists> (l::int). ?rc*?rx+?e = ?ri * (real l)"
  4.1082 +        "real_of_int i rdvd real_of_int c * real_of_int x + Inum (real_of_int x # bs) e" (is "?ri rdvd ?rc*?rx+?e")
  4.1083 +      hence "\<exists> (l::int). ?rc*?rx+?e = ?ri * (real_of_int l)"
  4.1084          by (simp add: rdvd_def)
  4.1085 -      hence "\<exists> (l::int). ?rc*?rx - real c * (real k * real d) +?e = ?ri * (real l) - real c * (real k * real d)"
  4.1086 +      hence "\<exists> (l::int). ?rc*?rx - real_of_int c * (real_of_int k * real_of_int d) +?e = ?ri * (real_of_int l) - real_of_int c * (real_of_int k * real_of_int d)"
  4.1087          by simp
  4.1088 -      hence "\<exists> (l::int). ?rc*?rx - real c * (real k * real d) +?e = ?ri * (real l) - real c * (real k * real i * real di)"
  4.1089 +      hence "\<exists> (l::int). ?rc*?rx - real_of_int c * (real_of_int k * real_of_int d) +?e = ?ri * (real_of_int l) - real_of_int c * (real_of_int k * real_of_int i * real_of_int di)"
  4.1090          by (simp add: di_def)
  4.1091 -      hence "\<exists> (l::int). ?rc*?rx - real c * (real k * real d) +?e = ?ri * (real (l - c*k*di))"
  4.1092 +      hence "\<exists> (l::int). ?rc*?rx - real_of_int c * (real_of_int k * real_of_int d) +?e = ?ri * (real_of_int (l - c*k*di))"
  4.1093          by (simp add: algebra_simps)
  4.1094 -      hence "\<exists> (l::int). ?rc*?rx - real c * (real k * real d) +?e = ?ri * (real l)"
  4.1095 +      hence "\<exists> (l::int). ?rc*?rx - real_of_int c * (real_of_int k * real_of_int d) +?e = ?ri * (real_of_int l)"
  4.1096          by blast
  4.1097 -      thus "real i rdvd real c * real x - real c * (real k * real d) + Inum (real x # bs) e"
  4.1098 +      thus "real_of_int i rdvd real_of_int c * real_of_int x - real_of_int c * (real_of_int k * real_of_int d) + Inum (real_of_int x # bs) e"
  4.1099          using rdvd_def by simp
  4.1100      qed
  4.1101 -qed (auto simp add: numbound0_I[where bs="bs" and b="real(x - k*d)" and b'="real x"] simp del: real_of_int_mult real_of_int_diff)
  4.1102 +qed (auto simp add: numbound0_I[where bs="bs" and b="real_of_int(x - k*d)" and b'="real_of_int x"] simp del: of_int_mult of_int_diff)
  4.1103  
  4.1104  lemma minusinf_ex:
  4.1105 -  assumes lin: "iszlfm p (real (a::int) #bs)"
  4.1106 -  and exmi: "\<exists> (x::int). Ifm (real x#bs) (minusinf p)" (is "\<exists> x. ?P1 x")
  4.1107 -  shows "\<exists> (x::int). Ifm (real x#bs) p" (is "\<exists> x. ?P x")
  4.1108 +  assumes lin: "iszlfm p (real_of_int (a::int) #bs)"
  4.1109 +  and exmi: "\<exists> (x::int). Ifm (real_of_int x#bs) (minusinf p)" (is "\<exists> x. ?P1 x")
  4.1110 +  shows "\<exists> (x::int). Ifm (real_of_int x#bs) p" (is "\<exists> x. ?P x")
  4.1111  proof-
  4.1112    let ?d = "\<delta> p"
  4.1113    from \<delta> [OF lin] have dpos: "?d >0" by simp
  4.1114 @@ -2241,9 +2219,9 @@
  4.1115  qed
  4.1116  
  4.1117  lemma minusinf_bex:
  4.1118 -  assumes lin: "iszlfm p (real (a::int) #bs)"
  4.1119 -  shows "(\<exists> (x::int). Ifm (real x#bs) (minusinf p)) = 
  4.1120 -         (\<exists> (x::int)\<in> {1..\<delta> p}. Ifm (real x#bs) (minusinf p))"
  4.1121 +  assumes lin: "iszlfm p (real_of_int (a::int) #bs)"
  4.1122 +  shows "(\<exists> (x::int). Ifm (real_of_int x#bs) (minusinf p)) = 
  4.1123 +         (\<exists> (x::int)\<in> {1..\<delta> p}. Ifm (real_of_int x#bs) (minusinf p))"
  4.1124    (is "(\<exists> x. ?P x) = _")
  4.1125  proof-
  4.1126    let ?d = "\<delta> p"
  4.1127 @@ -2338,30 +2316,30 @@
  4.1128  
  4.1129  lemma mirror_\<alpha>_\<beta>:
  4.1130    assumes lp: "iszlfm p (a#bs)"
  4.1131 -  shows "(Inum (real (i::int)#bs)) ` set (\<alpha> p) = (Inum (real i#bs)) ` set (\<beta> (mirror p))"
  4.1132 +  shows "(Inum (real_of_int (i::int)#bs)) ` set (\<alpha> p) = (Inum (real_of_int i#bs)) ` set (\<beta> (mirror p))"
  4.1133    using lp by (induct p rule: mirror.induct) auto
  4.1134  
  4.1135  lemma mirror: 
  4.1136    assumes lp: "iszlfm p (a#bs)"
  4.1137 -  shows "Ifm (real (x::int)#bs) (mirror p) = Ifm (real (- x)#bs) p" 
  4.1138 +  shows "Ifm (real_of_int (x::int)#bs) (mirror p) = Ifm (real_of_int (- x)#bs) p" 
  4.1139    using lp
  4.1140  proof(induct p rule: iszlfm.induct)
  4.1141    case (9 j c e)
  4.1142 -  have th: "(real j rdvd real c * real x - Inum (real x # bs) e) =
  4.1143 -       (real j rdvd - (real c * real x - Inum (real x # bs) e))"
  4.1144 +  have th: "(real_of_int j rdvd real_of_int c * real_of_int x - Inum (real_of_int x # bs) e) =
  4.1145 +       (real_of_int j rdvd - (real_of_int c * real_of_int x - Inum (real_of_int x # bs) e))"
  4.1146      by (simp only: rdvd_minus[symmetric])
  4.1147    from 9 th show ?case
  4.1148      by (simp add: algebra_simps
  4.1149 -      numbound0_I[where bs="bs" and b'="real x" and b="- real x"])
  4.1150 +      numbound0_I[where bs="bs" and b'="real_of_int x" and b="- real_of_int x"])
  4.1151  next
  4.1152    case (10 j c e)
  4.1153 -  have th: "(real j rdvd real c * real x - Inum (real x # bs) e) =
  4.1154 -       (real j rdvd - (real c * real x - Inum (real x # bs) e))"
  4.1155 +  have th: "(real_of_int j rdvd real_of_int c * real_of_int x - Inum (real_of_int x # bs) e) =
  4.1156 +       (real_of_int j rdvd - (real_of_int c * real_of_int x - Inum (real_of_int x # bs) e))"
  4.1157      by (simp only: rdvd_minus[symmetric])
  4.1158    from 10 th show  ?case
  4.1159      by (simp add: algebra_simps
  4.1160 -      numbound0_I[where bs="bs" and b'="real x" and b="- real x"])
  4.1161 -qed (auto simp add: numbound0_I[where bs="bs" and b="real x" and b'="- real x"])
  4.1162 +      numbound0_I[where bs="bs" and b'="real_of_int x" and b="- real_of_int x"])
  4.1163 +qed (auto simp add: numbound0_I[where bs="bs" and b="real_of_int x" and b'="- real_of_int x"])
  4.1164  
  4.1165  lemma mirror_l: "iszlfm p (a#bs) \<Longrightarrow> iszlfm (mirror p) (a#bs)"
  4.1166    by (induct p rule: mirror.induct) (auto simp add: isint_neg)
  4.1167 @@ -2375,8 +2353,8 @@
  4.1168  
  4.1169  
  4.1170  lemma mirror_ex: 
  4.1171 -  assumes lp: "iszlfm p (real (i::int)#bs)"
  4.1172 -  shows "(\<exists> (x::int). Ifm (real x#bs) (mirror p)) = (\<exists> (x::int). Ifm (real x#bs) p)"
  4.1173 +  assumes lp: "iszlfm p (real_of_int (i::int)#bs)"
  4.1174 +  shows "(\<exists> (x::int). Ifm (real_of_int x#bs) (mirror p)) = (\<exists> (x::int). Ifm (real_of_int x#bs) p)"
  4.1175    (is "(\<exists> x. ?I x ?mp) = (\<exists> x. ?I x p)")
  4.1176  proof(auto)
  4.1177    fix x assume "?I x ?mp" hence "?I (- x) p" using mirror[OF lp] by blast
  4.1178 @@ -2425,7 +2403,7 @@
  4.1179  qed (auto simp add: lcm_pos_int)
  4.1180  
  4.1181  lemma a_\<beta>: assumes linp: "iszlfm p (a #bs)" and d: "d_\<beta> p l" and lp: "l > 0"
  4.1182 -  shows "iszlfm (a_\<beta> p l) (a #bs) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> (Ifm (real (l * x) #bs) (a_\<beta> p l) = Ifm ((real x)#bs) p)"
  4.1183 +  shows "iszlfm (a_\<beta> p l) (a #bs) \<and> d_\<beta> (a_\<beta> p l) 1 \<and> (Ifm (real_of_int (l * x) #bs) (a_\<beta> p l) = Ifm ((real_of_int x)#bs) p)"
  4.1184  using linp d
  4.1185  proof (induct p rule: iszlfm.induct)
  4.1186    case (5 c e) hence cp: "c>0" and be: "numbound0 e" and ei:"isint e (a#bs)" and d': "c dvd l" by simp+
  4.1187 @@ -2438,13 +2416,13 @@
  4.1188      have "c * (l div c) = c* (l div c) + l mod c" using d' dvd_eq_mod_eq_0[of "c" "l"] by simp
  4.1189      hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric] 
  4.1190        by simp
  4.1191 -    hence "(real l * real x + real (l div c) * Inum (real x # bs) e < (0::real)) =
  4.1192 -          (real (c * (l div c)) * real x + real (l div c) * Inum (real x # bs) e < 0)"
  4.1193 +    hence "(real_of_int l * real_of_int x + real_of_int (l div c) * Inum (real_of_int x # bs) e < (0::real)) =
  4.1194 +          (real_of_int (c * (l div c)) * real_of_int x + real_of_int (l div c) * Inum (real_of_int x # bs) e < 0)"
  4.1195        by simp
  4.1196 -    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)
  4.1197 -    also have "\<dots> = (real c * real x + Inum (real x # bs) e < 0)"
  4.1198 -    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
  4.1199 -  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
  4.1200 +    also have "\<dots> = (real_of_int (l div c) * (real_of_int c * real_of_int x + Inum (real_of_int x # bs) e) < (real_of_int (l div c)) * 0)" by (simp add: algebra_simps)
  4.1201 +    also have "\<dots> = (real_of_int c * real_of_int x + Inum (real_of_int x # bs) e < 0)"
  4.1202 +    using mult_less_0_iff [where a="real_of_int (l div c)" and b="real_of_int c * real_of_int x + Inum (real_of_int x # bs) e"] ldcp by simp
  4.1203 +  finally show ?case using numbound0_I[OF be,where b="real_of_int (l * x)" and b'="real_of_int x" and bs="bs"] be  isint_Mul[OF ei] by simp
  4.1204  next
  4.1205    case (6 c e) hence cp: "c>0" and be: "numbound0 e" and ei:"isint e (a#bs)" and d': "c dvd l" by simp+
  4.1206      from lp cp have clel: "c\<le>l" by (simp add: zdvd_imp_le [OF d' lp])
  4.1207 @@ -2456,13 +2434,13 @@
  4.1208      have "c * (l div c) = c* (l div c) + l mod c" using d' dvd_eq_mod_eq_0[of "c" "l"] by simp
  4.1209      hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric] 
  4.1210        by simp
  4.1211 -    hence "(real l * real x + real (l div c) * Inum (real x # bs) e \<le> (0::real)) =
  4.1212 -          (real (c * (l div c)) * real x + real (l div c) * Inum (real x # bs) e \<le> 0)"
  4.1213 +    hence "(real_of_int l * real_of_int x + real_of_int (l div c) * Inum (real_of_int x # bs) e \<le> (0::real)) =
  4.1214 +          (real_of_int (c * (l div c)) * real_of_int x + real_of_int (l div c) * Inum (real_of_int x # bs) e \<le> 0)"
  4.1215        by simp
  4.1216 -    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)
  4.1217 -    also have "\<dots> = (real c * real x + Inum (real x # bs) e \<le> 0)"
  4.1218 -    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
  4.1219 -  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
  4.1220 +    also have "\<dots> = (real_of_int (l div c) * (real_of_int c * real_of_int x + Inum (real_of_int x # bs) e) \<le> (real_of_int (l div c)) * 0)" by (simp add: algebra_simps)
  4.1221 +    also have "\<dots> = (real_of_int c * real_of_int x + Inum (real_of_int x # bs) e \<le> 0)"
  4.1222 +    using mult_le_0_iff [where a="real_of_int (l div c)" and b="real_of_int c * real_of_int x + Inum (real_of_int x # bs) e"] ldcp by simp
  4.1223 +  finally show ?case using numbound0_I[OF be,where b="real_of_int (l * x)" and b'="real_of_int x" and bs="bs"]  be  isint_Mul[OF ei] by simp
  4.1224  next
  4.1225    case (7 c e) hence cp: "c>0" and be: "numbound0 e" and ei:"isint e (a#bs)" and d': "c dvd l" by simp+
  4.1226      from lp cp have clel: "c\<le>l" by (simp add: zdvd_imp_le [OF d' lp])
  4.1227 @@ -2474,13 +2452,13 @@
  4.1228      have "c * (l div c) = c* (l div c) + l mod c" using d' dvd_eq_mod_eq_0[of "c" "l"] by simp
  4.1229      hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric] 
  4.1230        by simp
  4.1231 -    hence "(real l * real x + real (l div c) * Inum (real x # bs) e > (0::real)) =
  4.1232 -          (real (c * (l div c)) * real x + real (l div c) * Inum (real x # bs) e > 0)"
  4.1233 +    hence "(real_of_int l * real_of_int x + real_of_int (l div c) * Inum (real_of_int x # bs) e > (0::real)) =
  4.1234 +          (real_of_int (c * (l div c)) * real_of_int x + real_of_int (l div c) * Inum (real_of_int x # bs) e > 0)"
  4.1235        by simp
  4.1236 -    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)
  4.1237 -    also have "\<dots> = (real c * real x + Inum (real x # bs) e > 0)"
  4.1238 -    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
  4.1239 -  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
  4.1240 +    also have "\<dots> = (real_of_int (l div c) * (real_of_int c * real_of_int x + Inum (real_of_int x # bs) e) > (real_of_int (l div c)) * 0)" by (simp add: algebra_simps)
  4.1241 +    also have "\<dots> = (real_of_int c * real_of_int x + Inum (real_of_int x # bs) e > 0)"
  4.1242 +    using zero_less_mult_iff [where a="real_of_int (l div c)" and b="real_of_int c * real_of_int x + Inum (real_of_int x # bs) e"] ldcp by simp
  4.1243 +  finally show ?case using numbound0_I[OF be,where b="real_of_int (l * x)" and b'="real_of_int x" and bs="bs"]  be  isint_Mul[OF ei] by simp
  4.1244  next
  4.1245    case (8 c e) hence cp: "c>0" and be: "numbound0 e"  and ei:"isint e (a#bs)" and d': "c dvd l" by simp+
  4.1246      from lp cp have clel: "c\<le>l" by (simp add: zdvd_imp_le [OF d' lp])
  4.1247 @@ -2492,13 +2470,13 @@
  4.1248      have "c * (l div c) = c* (l div c) + l mod c" using d' dvd_eq_mod_eq_0[of "c" "l"] by simp
  4.1249      hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric] 
  4.1250        by simp
  4.1251 -    hence "(real l * real x + real (l div c) * Inum (real x # bs) e \<ge> (0::real)) =
  4.1252 -          (real (c * (l div c)) * real x + real (l div c) * Inum (real x # bs) e \<ge> 0)"
  4.1253 +    hence "(real_of_int l * real_of_int x + real_of_int (l div c) * Inum (real_of_int x # bs) e \<ge> (0::real)) =
  4.1254 +          (real_of_int (c * (l div c)) * real_of_int x + real_of_int (l div c) * Inum (real_of_int x # bs) e \<ge> 0)"
  4.1255        by simp
  4.1256 -    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)
  4.1257 -    also have "\<dots> = (real c * real x + Inum (real x # bs) e \<ge> 0)"
  4.1258 -    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
  4.1259 -  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
  4.1260 +    also have "\<dots> = (real_of_int (l div c) * (real_of_int c * real_of_int x + Inum (real_of_int x # bs) e) \<ge> (real_of_int (l div c)) * 0)" by (simp add: algebra_simps)
  4.1261 +    also have "\<dots> = (real_of_int c * real_of_int x + Inum (real_of_int x # bs) e \<ge> 0)"
  4.1262 +    using zero_le_mult_iff [where a="real_of_int (l div c)" and b="real_of_int c * real_of_int x + Inum (real_of_int x # bs) e"] ldcp by simp
  4.1263 +  finally show ?case using numbound0_I[OF be,where b="real_of_int (l * x)" and b'="real_of_int x" and bs="bs"]  be  isint_Mul[OF ei] by simp
  4.1264  next
  4.1265    case (3 c e) hence cp: "c>0" and be: "numbound0 e" and ei:"isint e (a#bs)" and d': "c dvd l" by simp+
  4.1266      from lp cp have clel: "c\<le>l" by (simp add: zdvd_imp_le [OF d' lp])
  4.1267 @@ -2510,13 +2488,13 @@
  4.1268      have "c * (l div c) = c* (l div c) + l mod c" using d' dvd_eq_mod_eq_0[of "c" "l"] by simp
  4.1269      hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric] 
  4.1270        by simp
  4.1271 -    hence "(real l * real x + real (l div c) * Inum (real x # bs) e = (0::real)) =
  4.1272 -          (real (c * (l div c)) * real x + real (l div c) * Inum (real x # bs) e = 0)"
  4.1273 +    hence "(real_of_int l * real_of_int x + real_of_int (l div c) * Inum (real_of_int x # bs) e = (0::real)) =
  4.1274 +          (real_of_int (c * (l div c)) * real_of_int x + real_of_int (l div c) * Inum (real_of_int x # bs) e = 0)"
  4.1275        by simp
  4.1276 -    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)
  4.1277 -    also have "\<dots> = (real c * real x + Inum (real x # bs) e = 0)"
  4.1278 -    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
  4.1279 -  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
  4.1280 +    also have "\<dots> = (real_of_int (l div c) * (real_of_int c * real_of_int x + Inum (real_of_int x # bs) e) = (real_of_int (l div c)) * 0)" by (simp add: algebra_simps)
  4.1281 +    also have "\<dots> = (real_of_int c * real_of_int x + Inum (real_of_int x # bs) e = 0)"
  4.1282 +    using mult_eq_0_iff [where a="real_of_int (l div c)" and b="real_of_int c * real_of_int x + Inum (real_of_int x # bs) e"] ldcp by simp
  4.1283 +  finally show ?case using numbound0_I[OF be,where b="real_of_int (l * x)" and b'="real_of_int x" and bs="bs"]  be  isint_Mul[OF ei] by simp
  4.1284  next
  4.1285    case (4 c e) hence cp: "c>0" and be: "numbound0 e" and ei:"isint e (a#bs)" and d': "c dvd l" by simp+
  4.1286      from lp cp have clel: "c\<le>l" by (simp add: zdvd_imp_le [OF d' lp])
  4.1287 @@ -2528,13 +2506,13 @@
  4.1288      have "c * (l div c) = c* (l div c) + l mod c" using d' dvd_eq_mod_eq_0[of "c" "l"] by simp
  4.1289      hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric] 
  4.1290        by simp
  4.1291 -    hence "(real l * real x + real (l div c) * Inum (real x # bs) e \<noteq> (0::real)) =
  4.1292 -          (real (c * (l div c)) * real x + real (l div c) * Inum (real x # bs) e \<noteq> 0)"
  4.1293 +    hence "(real_of_int l * real_of_int x + real_of_int (l div c) * Inum (real_of_int x # bs) e \<noteq> (0::real)) =
  4.1294 +          (real_of_int (c * (l div c)) * real_of_int x + real_of_int (l div c) * Inum (real_of_int x # bs) e \<noteq> 0)"
  4.1295        by simp
  4.1296 -    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)
  4.1297 -    also have "\<dots> = (real c * real x + Inum (real x # bs) e \<noteq> 0)"
  4.1298 -    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
  4.1299 -  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
  4.1300 +    also have "\<dots> = (real_of_int (l div c) * (real_of_int c * real_of_int x + Inum (real_of_int x # bs) e) \<noteq> (real_of_int (l div c)) * 0)" by (simp add: algebra_simps)
  4.1301 +    also have "\<dots> = (real_of_int c * real_of_int x + Inum (real_of_int x # bs) e \<noteq> 0)"
  4.1302 +    using zero_le_mult_iff [where a="real_of_int (l div c)" and b="real_of_int c * real_of_int x + Inum (real_of_int x # bs) e"] ldcp by simp
  4.1303 +  finally show ?case using numbound0_I[OF be,where b="real_of_int (l * x)" and b'="real_of_int x" and bs="bs"]  be  isint_Mul[OF ei] by simp
  4.1304  next
  4.1305    case (9 j c e) hence cp: "c>0" and be: "numbound0 e" and ei:"isint e (a#bs)" and jp: "j > 0" and d': "c dvd l" by simp+
  4.1306      from lp cp have clel: "c\<le>l" by (simp add: zdvd_imp_le [OF d' lp])
  4.1307 @@ -2546,12 +2524,12 @@
  4.1308      have "c * (l div c) = c* (l div c) + l mod c" using d' dvd_eq_mod_eq_0[of "c" "l"] by simp
  4.1309      hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric] 
  4.1310        by simp
  4.1311 -    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
  4.1312 -    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)
  4.1313 -    also fix k have "\<dots> = (\<exists> (k::int). real c * real x + Inum (real x # bs) e - real j * real k = 0)"
  4.1314 -    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
  4.1315 -  also have "\<dots> = (\<exists> (k::int). real c * real x + Inum (real x # bs) e = real j * real k)" by simp
  4.1316 -  finally show ?case using numbound0_I[OF be,where b="real (l * x)" and b'="real x" and bs="bs"] rdvd_def  be  isint_Mul[OF ei] mult_strict_mono[OF ldcp jp ldcp ] by simp 
  4.1317 +    hence "(\<exists> (k::int). real_of_int l * real_of_int x + real_of_int (l div c) * Inum (real_of_int x # bs) e = (real_of_int (l div c) * real_of_int j) * real_of_int k) = (\<exists> (k::int). real_of_int (c * (l div c)) * real_of_int x + real_of_int (l div c) * Inum (real_of_int x # bs) e = (real_of_int (l div c) * real_of_int j) * real_of_int k)"  by simp
  4.1318 +    also have "\<dots> = (\<exists> (k::int). real_of_int (l div c) * (real_of_int c * real_of_int x + Inum (real_of_int x # bs) e - real_of_int j * real_of_int k) = real_of_int (l div c)*0)" by (simp add: algebra_simps)
  4.1319 +    also fix k have "\<dots> = (\<exists> (k::int). real_of_int c * real_of_int x + Inum (real_of_int x # bs) e - real_of_int j * real_of_int k = 0)"
  4.1320 +    using zero_le_mult_iff [where a="real_of_int (l div c)" and b="real_of_int c * real_of_int x + Inum (real_of_int x # bs) e - real_of_int j * real_of_int k"] ldcp by simp
  4.1321 +  also have "\<dots> = (\<exists> (k::int). real_of_int c * real_of_int x + Inum (real_of_int x # bs) e = real_of_int j * real_of_int k)" by simp
  4.1322 +  finally show ?case using numbound0_I[OF be,where b="real_of_int (l * x)" and b'="real_of_int x" and bs="bs"] rdvd_def  be  isint_Mul[OF ei] mult_strict_mono[OF ldcp jp ldcp ] by simp 
  4.1323  next
  4.1324    case (10 j c e) hence cp: "c>0" and be: "numbound0 e" and ei:"isint e (a#bs)" and jp: "j > 0" and d': "c dvd l" by simp+
  4.1325      from lp cp have clel: "c\<le>l" by (simp add: zdvd_imp_le [OF d' lp])
  4.1326 @@ -2563,16 +2541,16 @@
  4.1327      have "c * (l div c) = c* (l div c) + l mod c" using d' dvd_eq_mod_eq_0[of "c" "l"] by simp
  4.1328      hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric] 
  4.1329        by simp
  4.1330 -    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
  4.1331 -    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)
  4.1332 -    also fix k have "\<dots> = (\<exists> (k::int). real c * real x + Inum (real x # bs) e - real j * real k = 0)"
  4.1333 -    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
  4.1334 -  also have "\<dots> = (\<exists> (k::int). real c * real x + Inum (real x # bs) e = real j * real k)" by simp
  4.1335 -  finally show ?case using numbound0_I[OF be,where b="real (l * x)" and b'="real x" and bs="bs"] rdvd_def  be  isint_Mul[OF ei]  mult_strict_mono[OF ldcp jp ldcp ] by simp
  4.1336 -qed (simp_all add: numbound0_I[where bs="bs" and b="real (l * x)" and b'="real x"] isint_Mul del: real_of_int_mult)
  4.1337 +    hence "(\<exists> (k::int). real_of_int l * real_of_int x + real_of_int (l div c) * Inum (real_of_int x # bs) e = (real_of_int (l div c) * real_of_int j) * real_of_int k) = (\<exists> (k::int). real_of_int (c * (l div c)) * real_of_int x + real_of_int (l div c) * Inum (real_of_int x # bs) e = (real_of_int (l div c) * real_of_int j) * real_of_int k)"  by simp
  4.1338 +    also have "\<dots> = (\<exists> (k::int). real_of_int (l div c) * (real_of_int c * real_of_int x + Inum (real_of_int x # bs) e - real_of_int j * real_of_int k) = real_of_int (l div c)*0)" by (simp add: algebra_simps)
  4.1339 +    also fix k have "\<dots> = (\<exists> (k::int). real_of_int c * real_of_int x + Inum (real_of_int x # bs) e - real_of_int j * real_of_int k = 0)"
  4.1340 +    using zero_le_mult_iff [where a="real_of_int (l div c)" and b="real_of_int c * real_of_int x + Inum (real_of_int x # bs) e - real_of_int j * real_of_int k"] ldcp by simp
  4.1341 +  also have "\<dots> = (\<exists> (k::int). real_of_int c * real_of_int x + Inum (real_of_int x # bs) e = real_of_int j * real_of_int k)" by simp
  4.1342 +  finally show ?case using numbound0_I[OF be,where b="real_of_int (l * x)" and b'="real_of_int x" and bs="bs"] rdvd_def  be  isint_Mul[OF ei]  mult_strict_mono[OF ldcp jp ldcp ] by simp
  4.1343 +qed (simp_all add: numbound0_I[where bs="bs" and b="real_of_int (l * x)" and b'="real_of_int x"] isint_Mul del: of_int_mult)
  4.1344  
  4.1345  lemma a_\<beta>_ex: assumes linp: "iszlfm p (a#bs)" and d: "d_\<beta> p l" and lp: "l>0"
  4.1346 -  shows "(\<exists> x. l dvd x \<and> Ifm (real x #bs) (a_\<beta> p l)) = (\<exists> (x::int). Ifm (real x#bs) p)"
  4.1347 +  shows "(\<exists> x. l dvd x \<and> Ifm (real_of_int x #bs) (a_\<beta> p l)) = (\<exists> (x::int). Ifm (real_of_int x#bs) p)"
  4.1348    (is "(\<exists> x. l dvd x \<and> ?P x) = (\<exists> x. ?P' x)")
  4.1349  proof-
  4.1350    have "(\<exists> x. l dvd x \<and> ?P x) = (\<exists> (x::int). ?P (l*x))"
  4.1351 @@ -2586,148 +2564,146 @@
  4.1352    and u: "d_\<beta> p 1"
  4.1353    and d: "d_\<delta> p d"
  4.1354    and dp: "d > 0"
  4.1355 -  and nob: "\<not>(\<exists>(j::int) \<in> {1 .. d}. \<exists> b\<in> (Inum (a#bs)) ` set(\<beta> p). real x = b + real j)"
  4.1356 -  and p: "Ifm (real x#bs) p" (is "?P x")
  4.1357 +  and nob: "\<not>(\<exists>(j::int) \<in> {1 .. d}. \<exists> b\<in> (Inum (a#bs)) ` set(\<beta> p). real_of_int x = b + real_of_int j)"
  4.1358 +  and p: "Ifm (real_of_int x#bs) p" (is "?P x")
  4.1359    shows "?P (x - d)"
  4.1360  using lp u d dp nob p
  4.1361  proof(induct p rule: iszlfm.induct)
  4.1362    case (5 c e) hence c1: "c=1" and  bn:"numbound0 e" using dvd1_eq1[where x="c"] by simp_all
  4.1363 -  with dp p c1 numbound0_I[OF bn,where b="real (x-d)" and b'="real x" and bs="bs"] 5
  4.1364 -  show ?case by (simp del: real_of_int_minus)
  4.1365 +  with dp p c1 numbound0_I[OF bn,where b="real_of_int (x-d)" and b'="real_of_int x" and bs="bs"] 5
  4.1366 +  show ?case by (simp del: of_int_minus)
  4.1367  next
  4.1368    case (6 c e)  hence c1: "c=1" and  bn:"numbound0 e" using dvd1_eq1[where x="c"] by simp_all
  4.1369 -  with dp p c1 numbound0_I[OF bn,where b="real (x-d)" and b'="real x" and bs="bs"] 6
  4.1370 -  show ?case by (simp del: real_of_int_minus)
  4.1371 +  with dp p c1 numbound0_I[OF bn,where b="real_of_int (x-d)" and b'="real_of_int x" and bs="bs"] 6
  4.1372 +  show ?case by (simp del: of_int_minus)
  4.1373  next
  4.1374 -  case (7 c e) hence p: "Ifm (real x #bs) (Gt (CN 0 c e))" and c1: "c=1"
  4.1375 +  case (7 c e) hence p: "Ifm (real_of_int x #bs) (Gt (CN 0 c e))" and c1: "c=1"
  4.1376      and bn:"numbound0 e" and ie1:"isint e (a#bs)" using dvd1_eq1[where x="c"] by simp_all
  4.1377 -  let ?e = "Inum (real x # bs) e"
  4.1378 -  from ie1 have ie: "real (floor ?e) = ?e" using isint_iff[where n="e" and bs="a#bs"]
  4.1379 -      numbound0_I[OF bn,where b="a" and b'="real x" and bs="bs"]
  4.1380 +  let ?e = "Inum (real_of_int x # bs) e"
  4.1381 +  from ie1 have ie: "real_of_int (floor ?e) = ?e" using isint_iff[where n="e" and bs="a#bs"]
  4.1382 +      numbound0_I[OF bn,where b="a" and b'="real_of_int x" and bs="bs"]
  4.1383      by (simp add: isint_iff)
  4.1384 -    {assume "real (x-d) +?e > 0" hence ?case using c1 
  4.1385 -      numbound0_I[OF bn,where b="real (x-d)" and b'="real x" and bs="bs"]
  4.1386 -        by (simp del: real_of_int_minus)}
  4.1387 +    {assume "real_of_int (x-d) +?e > 0" hence ?case using c1 
  4.1388 +      numbound0_I[OF bn,where b="real_of_int (x-d)" and b'="real_of_int x" and bs="bs"]
  4.1389 +        by (simp del: of_int_minus)}
  4.1390      moreover
  4.1391 -    {assume H: "\<not> real (x-d) + ?e > 0" 
  4.1392 +    {assume H: "\<not> real_of_int (x-d) + ?e > 0" 
  4.1393        let ?v="Neg e"
  4.1394        have vb: "?v \<in> set (\<beta> (Gt (CN 0 c e)))" by simp
  4.1395 -      from 7(5)[simplified simp_thms Inum.simps \<beta>.simps list.set bex_simps numbound0_I[OF bn,where b="a" and b'="real x" and bs="bs"]] 
  4.1396 -      have nob: "\<not> (\<exists> j\<in> {1 ..d}. real x =  - ?e + real j)" by auto 
  4.1397 -      from H p have "real x + ?e > 0 \<and> real x + ?e \<le> real d" by (simp add: c1)
  4.1398 -      hence "real (x + floor ?e) > real (0::int) \<and> real (x + floor ?e) \<le> real d"
  4.1399 +      from 7(5)[simplified simp_thms Inum.simps \<beta>.simps list.set bex_simps numbound0_I[OF bn,where b="a" and b'="real_of_int x" and bs="bs"]] 
  4.1400 +      have nob: "\<not> (\<exists> j\<in> {1 ..d}. real_of_int x =  - ?e + real_of_int j)" by auto 
  4.1401 +      from H p have "real_of_int x + ?e > 0 \<and> real_of_int x + ?e \<le> real_of_int d" by (simp add: c1)
  4.1402 +      hence "real_of_int (x + floor ?e) > real_of_int (0::int) \<and> real_of_int (x + floor ?e) \<le> real_of_int d"
  4.1403          using ie by simp
  4.1404        hence "x + floor ?e \<ge> 1 \<and> x + floor ?e \<le> d"  by simp
  4.1405        hence "\<exists> (j::int) \<in> {1 .. d}. j = x + floor ?e" by simp
  4.1406 -      hence "\<exists> (j::int) \<in> {1 .. d}. real x = real (- floor ?e + j)" 
  4.1407 -        by (simp only: real_of_int_inject) (simp add: algebra_simps)
  4.1408 -      hence "\<exists> (j::int) \<in> {1 .. d}. real x = - ?e + real j" 
  4.1409 +      hence "\<exists> (j::int) \<in> {1 .. d}. real_of_int x = real_of_int (- floor ?e + j)" by force 
  4.1410 +      hence "\<exists> (j::int) \<in> {1 .. d}. real_of_int x = - ?e + real_of_int j" 
  4.1411          by (simp add: ie[simplified isint_iff])
  4.1412        with nob have ?case by auto}
  4.1413      ultimately show ?case by blast
  4.1414  next
  4.1415 -  case (8 c e) hence p: "Ifm (real x #bs) (Ge (CN 0 c e))" and c1: "c=1" and bn:"numbound0 e" 
  4.1416 +  case (8 c e) hence p: "Ifm (real_of_int x #bs) (Ge (CN 0 c e))" and c1: "c=1" and bn:"numbound0 e" 
  4.1417      and ie1:"isint e (a #bs)" using dvd1_eq1[where x="c"] by simp+
  4.1418 -    let ?e = "Inum (real x # bs) e"
  4.1419 -    from ie1 have ie: "real (floor ?e) = ?e" using numbound0_I[OF bn,where b="real x" and b'="a" and bs="bs"] isint_iff[where n="e" and bs="(real x)#bs"]
  4.1420 +    let ?e = "Inum (real_of_int x # bs) e"
  4.1421 +    from ie1 have ie: "real_of_int (floor ?e) = ?e" using numbound0_I[OF bn,where b="real_of_int x" and b'="a" and bs="bs"] isint_iff[where n="e" and bs="(real_of_int x)#bs"]
  4.1422        by (simp add: isint_iff)
  4.1423 -    {assume "real (x-d) +?e \<ge> 0" hence ?case using  c1 
  4.1424 -      numbound0_I[OF bn,where b="real (x-d)" and b'="real x" and bs="bs"]
  4.1425 -        by (simp del: real_of_int_minus)}
  4.1426 +    {assume "real_of_int (x-d) +?e \<ge> 0" hence ?case using  c1 
  4.1427 +      numbound0_I[OF bn,where b="real_of_int (x-d)" and b'="real_of_int x" and bs="bs"]
  4.1428 +        by (simp del: of_int_minus)}
  4.1429      moreover
  4.1430 -    {assume H: "\<not> real (x-d) + ?e \<ge> 0" 
  4.1431 +    {assume H: "\<not> real_of_int (x-d) + ?e \<ge> 0" 
  4.1432        let ?v="Sub (C (- 1)) e"
  4.1433        have vb: "?v \<in> set (\<beta> (Ge (CN 0 c e)))" by simp
  4.1434 -      from 8(5)[simplified simp_thms Inum.simps \<beta>.simps list.set bex_simps numbound0_I[OF bn,where b="a" and b'="real x" and bs="bs"]] 
  4.1435 -      have nob: "\<not> (\<exists> j\<in> {1 ..d}. real x =  - ?e - 1 + real j)" by auto 
  4.1436 -      from H p have "real x + ?e \<ge> 0 \<and> real x + ?e < real d" by (simp add: c1)
  4.1437 -      hence "real (x + floor ?e) \<ge> real (0::int) \<and> real (x + floor ?e) < real d"
  4.1438 +      from 8(5)[simplified simp_thms Inum.simps \<beta>.simps list.set bex_simps numbound0_I[OF bn,where b="a" and b'="real_of_int x" and bs="bs"]] 
  4.1439 +      have nob: "\<not> (\<exists> j\<in> {1 ..d}. real_of_int x =  - ?e - 1 + real_of_int j)" by auto 
  4.1440 +      from H p have "real_of_int x + ?e \<ge> 0 \<and> real_of_int x + ?e < real_of_int d" by (simp add: c1)
  4.1441 +      hence "real_of_int (x + floor ?e) \<ge> real_of_int (0::int) \<and> real_of_int (x + floor ?e) < real_of_int d"
  4.1442          using ie by simp
  4.1443        hence "x + floor ?e +1 \<ge> 1 \<and> x + floor ?e + 1 \<le> d"  by simp
  4.1444        hence "\<exists> (j::int) \<in> {1 .. d}. j = x + floor ?e + 1" by simp
  4.1445        hence "\<exists> (j::int) \<in> {1 .. d}. x= - floor ?e - 1 + j" by (simp add: algebra_simps)
  4.1446 -      hence "\<exists> (j::int) \<in> {1 .. d}. real x= real (- floor ?e - 1 + j)" 
  4.1447 -        by (simp only: real_of_int_inject)
  4.1448 -      hence "\<exists> (j::int) \<in> {1 .. d}. real x= - ?e - 1 + real j" 
  4.1449 +      hence "\<exists> (j::int) \<in> {1 .. d}. real_of_int x= real_of_int (- floor ?e - 1 + j)" by blast
  4.1450 +      hence "\<exists> (j::int) \<in> {1 .. d}. real_of_int x= - ?e - 1 + real_of_int j" 
  4.1451          by (simp add: ie[simplified isint_iff])
  4.1452        with nob have ?case by simp }
  4.1453      ultimately show ?case by blast
  4.1454  next
  4.1455 -  case (3 c e) hence p: "Ifm (real x #bs) (Eq (CN 0 c e))" (is "?p x") and c1: "c=1" 
  4.1456 +  case (3 c e) hence p: "Ifm (real_of_int x #bs) (Eq (CN 0 c e))" (is "?p x") and c1: "c=1" 
  4.1457      and bn:"numbound0 e" and ie1: "isint e (a #bs)" using dvd1_eq1[where x="c"] by simp+
  4.1458 -    let ?e = "Inum (real x # bs) e"
  4.1459 +    let ?e = "Inum (real_of_int x # bs) e"
  4.1460      let ?v="(Sub (C (- 1)) e)"
  4.1461      have vb: "?v \<in> set (\<beta> (Eq (CN 0 c e)))" by simp
  4.1462 -    from p have "real x= - ?e" by (simp add: c1) with 3(5) show ?case using dp
  4.1463 +    from p have "real_of_int x= - ?e" by (simp add: c1) with 3(5) show ?case using dp
  4.1464        by simp (erule ballE[where x="1"],
  4.1465 -        simp_all add:algebra_simps numbound0_I[OF bn,where b="real x"and b'="a"and bs="bs"])
  4.1466 +        simp_all add:algebra_simps numbound0_I[OF bn,where b="real_of_int x"and b'="a"and bs="bs"])
  4.1467  next
  4.1468 -  case (4 c e)hence p: "Ifm (real x #bs) (NEq (CN 0 c e))" (is "?p x") and c1: "c=1" 
  4.1469 +  case (4 c e)hence p: "Ifm (real_of_int x #bs) (NEq (CN 0 c e))" (is "?p x") and c1: "c=1" 
  4.1470      and bn:"numbound0 e" and ie1: "isint e (a #bs)" using dvd1_eq1[where x="c"] by simp+
  4.1471 -    let ?e = "Inum (real x # bs) e"
  4.1472 +    let ?e = "Inum (real_of_int x # bs) e"
  4.1473      let ?v="Neg e"
  4.1474      have vb: "?v \<in> set (\<beta> (NEq (CN 0 c e)))" by simp
  4.1475 -    {assume "real x - real d + Inum ((real (x -d)) # bs) e \<noteq> 0" 
  4.1476 +    {assume "real_of_int x - real_of_int d + Inum ((real_of_int (x -d)) # bs) e \<noteq> 0" 
  4.1477        hence ?case by (simp add: c1)}
  4.1478      moreover
  4.1479 -    {assume H: "real x - real d + Inum ((real (x -d)) # bs) e = 0"
  4.1480 -      hence "real x = - Inum ((real (x -d)) # bs) e + real d" by simp
  4.1481 -      hence "real x = - Inum (a # bs) e + real d"
  4.1482 -        by (simp add: numbound0_I[OF bn,where b="real x - real d"and b'="a"and bs="bs"])
  4.1483 +    {assume H: "real_of_int x - real_of_int d + Inum ((real_of_int (x -d)) # bs) e = 0"
  4.1484 +      hence "real_of_int x = - Inum ((real_of_int (x -d)) # bs) e + real_of_int d" by simp
  4.1485 +      hence "real_of_int x = - Inum (a # bs) e + real_of_int d"
  4.1486 +        by (simp add: numbound0_I[OF bn,where b="real_of_int x - real_of_int d"and b'="a"and bs="bs"])
  4.1487         with 4(5) have ?case using dp by simp}
  4.1488    ultimately show ?case by blast
  4.1489  next 
  4.1490 -  case (9 j c e) hence p: "Ifm (real x #bs) (Dvd j (CN 0 c e))" (is "?p x") and c1: "c=1" 
  4.1491 +  case (9 j c e) hence p: "Ifm (real_of_int x #bs) (Dvd j (CN 0 c e))" (is "?p x") and c1: "c=1" 
  4.1492      and bn:"numbound0 e" using dvd1_eq1[where x="c"] by simp+
  4.1493 -  let ?e = "Inum (real x # bs) e"
  4.1494 +  let ?e = "Inum (real_of_int x # bs) e"
  4.1495    from 9 have "isint e (a #bs)"  by simp 
  4.1496 -  hence ie: "real (floor ?e) = ?e" using isint_iff[where n="e" and bs="(real x)#bs"] numbound0_I[OF bn,where b="real x" and b'="a" and bs="bs"]
  4.1497 +  hence ie: "real_of_int (floor ?e) = ?e" using isint_iff[where n="e" and bs="(real_of_int x)#bs"] numbound0_I[OF bn,where b="real_of_int x" and b'="a" and bs="bs"]
  4.1498      by (simp add: isint_iff)
  4.1499    from 9 have id: "j dvd d" by simp
  4.1500 -  from c1 ie[symmetric] have "?p x = (real j rdvd real (x+ floor ?e))" by simp
  4.1501 +  from c1 ie[symmetric] have "?p x = (real_of_int j rdvd real_of_int (x+ floor ?e))" by simp
  4.1502    also have "\<dots> = (j dvd x + floor ?e)" 
  4.1503 -    using int_rdvd_real[where i="j" and x="real (x+ floor ?e)"] by simp
  4.1504 +    using int_rdvd_real[where i="j" and x="real_of_int (x+ floor ?e)"] by simp
  4.1505    also have "\<dots> = (j dvd x - d + floor ?e)" 
  4.1506      using dvd_period[OF id, where x="x" and c="-1" and t="floor ?e"] by simp
  4.1507 -  also have "\<dots> = (real j rdvd real (x - d + floor ?e))" 
  4.1508 -    using int_rdvd_real[where i="j" and x="real (x-d + floor ?e)",symmetric, simplified]
  4.1509 +  also have "\<dots> = (real_of_int j rdvd real_of_int (x - d + floor ?e))" 
  4.1510 +    using int_rdvd_real[where i="j" and x="real_of_int (x-d + floor ?e)",symmetric, simplified]
  4.1511        ie by simp
  4.1512 -  also have "\<dots> = (real j rdvd real x - real d + ?e)" 
  4.1513 +  also have "\<dots> = (real_of_int j rdvd real_of_int x - real_of_int d + ?e)" 
  4.1514      using ie by simp
  4.1515    finally show ?case 
  4.1516 -    using numbound0_I[OF bn,where b="real (x-d)" and b'="real x" and bs="bs"] c1 p by simp
  4.1517 +    using numbound0_I[OF bn,where b="real_of_int (x-d)" and b'="real_of_int x" and bs="bs"] c1 p by simp
  4.1518  next
  4.1519 -  case (10 j c e) hence p: "Ifm (real x #bs) (NDvd j (CN 0 c e))" (is "?p x") and c1: "c=1" and bn:"numbound0 e" using dvd1_eq1[where x="c"] by simp+
  4.1520 -  let ?e = "Inum (real x # bs) e"
  4.1521 +  case (10 j c e) hence p: "Ifm (real_of_int x #bs) (NDvd j (CN 0 c e))" (is "?p x") and c1: "c=1" and bn:"numbound0 e" using dvd1_eq1[where x="c"] by simp+
  4.1522 +  let ?e = "Inum (real_of_int x # bs) e"
  4.1523    from 10 have "isint e (a#bs)"  by simp 
  4.1524 -  hence ie: "real (floor ?e) = ?e" using numbound0_I[OF bn,where b="real x" and b'="a" and bs="bs"] isint_iff[where n="e" and bs="(real x)#bs"]
  4.1525 +  hence ie: "real_of_int (floor ?e) = ?e" using numbound0_I[OF bn,where b="real_of_int x" and b'="a" and bs="bs"] isint_iff[where n="e" and bs="(real_of_int x)#bs"]
  4.1526      by (simp add: isint_iff)
  4.1527    from 10 have id: "j dvd d" by simp
  4.1528 -  from c1 ie[symmetric] have "?p x = (\<not> real j rdvd real (x+ floor ?e))" by simp
  4.1529 +  from c1 ie[symmetric] have "?p x = (\<not> real_of_int j rdvd real_of_int (x+ floor ?e))" by simp
  4.1530    also have "\<dots> = (\<not> j dvd x + floor ?e)" 
  4.1531 -    using int_rdvd_real[where i="j" and x="real (x+ floor ?e)"] by simp
  4.1532 +    using int_rdvd_real[where i="j" and x="real_of_int (x+ floor ?e)"] by simp
  4.1533    also have "\<dots> = (\<not> j dvd x - d + floor ?e)" 
  4.1534      using dvd_period[OF id, where x="x" and c="-1" and t="floor ?e"] by simp
  4.1535 -  also have "\<dots> = (\<not> real j rdvd real (x - d + floor ?e))" 
  4.1536 -    using int_rdvd_real[where i="j" and x="real (x-d + floor ?e)",symmetric, simplified]
  4.1537 +  also have "\<dots> = (\<not> real_of_int j rdvd real_of_int (x - d + floor ?e))" 
  4.1538 +    using int_rdvd_real[where i="j" and x="real_of_int (x-d + floor ?e)",symmetric, simplified]
  4.1539        ie by simp
  4.1540 -  also have "\<dots> = (\<not> real j rdvd real x - real d + ?e)" 
  4.1541 +  also have "\<dots> = (\<not> real_of_int j rdvd real_of_int x - real_of_int d + ?e)" 
  4.1542      using ie by simp
  4.1543    finally show ?case
  4.1544 -    using numbound0_I[OF bn,where b="real (x-d)" and b'="real x" and bs="bs"] c1 p by simp
  4.1545 -qed (auto simp add: numbound0_I[where bs="bs" and b="real (x - d)" and b'="real x"]
  4.1546 -  simp del: real_of_int_diff)
  4.1547 +    using numbound0_I[OF bn,where b="real_of_int (x-d)" and b'="real_of_int x" and bs="bs"] c1 p by simp
  4.1548 +qed (auto simp add: numbound0_I[where bs="bs" and b="real_of_int (x - d)" and b'="real_of_int x"]
  4.1549 +  simp del: of_int_diff)
  4.1550  
  4.1551  lemma \<beta>':   
  4.1552    assumes lp: "iszlfm p (a #bs)"
  4.1553    and u: "d_\<beta> p 1"
  4.1554    and d: "d_\<delta> p d"
  4.1555    and dp: "d > 0"
  4.1556 -  shows "\<forall> x. \<not>(\<exists>(j::int) \<in> {1 .. d}. \<exists> b\<in> set(\<beta> p). Ifm ((Inum (a#bs) b + real j) #bs) p) \<longrightarrow> Ifm (real x#bs) p \<longrightarrow> Ifm (real (x - d)#bs) p" (is "\<forall> x. ?b \<longrightarrow> ?P x \<longrightarrow> ?P (x - d)")
  4.1557 +  shows "\<forall> x. \<not>(\<exists>(j::int) \<in> {1 .. d}. \<exists> b\<in> set(\<beta> p). Ifm ((Inum (a#bs) b + real_of_int j) #bs) p) \<longrightarrow> Ifm (real_of_int x#bs) p \<longrightarrow> Ifm (real_of_int (x - d)#bs) p" (is "\<forall> x. ?b \<longrightarrow> ?P x \<longrightarrow> ?P (x - d)")
  4.1558  proof(clarify)
  4.1559    fix x 
  4.1560    assume nb:"?b" and px: "?P x" 
  4.1561 -  hence nb2: "\<not>(\<exists>(j::int) \<in> {1 .. d}. \<exists> b\<in> (Inum (a#bs)) ` set(\<beta> p). real x = b + real j)"
  4.1562 +  hence nb2: "\<not>(\<exists>(j::int) \<in> {1 .. d}. \<exists> b\<in> (Inum (a#bs)) ` set(\<beta> p). real_of_int x = b + real_of_int j)"
  4.1563      by auto
  4.1564    from  \<beta>[OF lp u d dp nb2 px] show "?P (x -d )" .
  4.1565  qed
  4.1566 @@ -2764,22 +2740,22 @@
  4.1567    and u: "d_\<beta> p 1"
  4.1568    and d: "d_\<delta> p d"
  4.1569    and dp: "d > 0"
  4.1570 -  shows "(\<exists> (x::int). Ifm (real x #bs) p) = (\<exists> j\<in> {1.. d}. Ifm (real j #bs) (minusinf p) \<or> (\<exists> b \<in> set (\<beta> p). Ifm ((Inum (a#bs) b + real j) #bs) p))"
  4.1571 -  (is "(\<exists> (x::int). ?P (real x)) = (\<exists> j\<in> ?D. ?M j \<or> (\<exists> b\<in> ?B. ?P (?I b + real j)))")
  4.1572 +  shows "(\<exists> (x::int). Ifm (real_of_int x #bs) p) = (\<exists> j\<in> {1.. d}. Ifm (real_of_int j #bs) (minusinf p) \<or> (\<exists> b \<in> set (\<beta> p). Ifm ((Inum (a#bs) b + real_of_int j) #bs) p))"
  4.1573 +  (is "(\<exists> (x::int). ?P (real_of_int x)) = (\<exists> j\<in> ?D. ?M j \<or> (\<exists> b\<in> ?B. ?P (?I b + real_of_int j)))")
  4.1574  proof-
  4.1575    from minusinf_inf[OF lp] 
  4.1576 -  have th: "\<exists>(z::int). \<forall>x<z. ?P (real x) = ?M x" by blast
  4.1577 +  have th: "\<exists>(z::int). \<forall>x<z. ?P (real_of_int x) = ?M x" by blast
  4.1578    let ?B' = "{floor (?I b) | b. b\<in> ?B}"
  4.1579 -  from \<beta>_int[OF lp] isint_iff[where bs="a # bs"] have B: "\<forall> b\<in> ?B. real (floor (?I b)) = ?I b" by simp
  4.1580 +  from \<beta>_int[OF lp] isint_iff[where bs="a # bs"] have B: "\<forall> b\<in> ?B. real_of_int (floor (?I b)) = ?I b" by simp
  4.1581    from B[rule_format] 
  4.1582 -  have "(\<exists>j\<in>?D. \<exists>b\<in> ?B. ?P (?I b + real j)) = (\<exists>j\<in>?D. \<exists>b\<in> ?B. ?P (real (floor (?I b)) + real j))" 
  4.1583 +  have "(\<exists>j\<in>?D. \<exists>b\<in> ?B. ?P (?I b + real_of_int j)) = (\<exists>j\<in>?D. \<exists>b\<in> ?B. ?P (real_of_int (floor (?I b)) + real_of_int j))" 
  4.1584      by simp
  4.1585 -  also have "\<dots> = (\<exists>j\<in>?D. \<exists>b\<in> ?B. ?P (real (floor (?I b) + j)))" by simp
  4.1586 -  also have"\<dots> = (\<exists> j \<in> ?D. \<exists> b \<in> ?B'. ?P (real (b + j)))"  by blast
  4.1587 +  also have "\<dots> = (\<exists>j\<in>?D. \<exists>b\<in> ?B. ?P (real_of_int (floor (?I b) + j)))" by simp
  4.1588 +  also have"\<dots> = (\<exists> j \<in> ?D. \<exists> b \<in> ?B'. ?P (real_of_int (b + j)))"  by blast
  4.1589    finally have BB': 
  4.1590 -    "(\<exists>j\<in>?D. \<exists>b\<in> ?B. ?P (?I b + real j)) = (\<exists> j \<in> ?D. \<exists> b \<in> ?B'. ?P (real (b + j)))" 
  4.1591 +    "(\<exists>j\<in>?D. \<exists>b\<in> ?B. ?P (?I b + real_of_int j)) = (\<exists> j \<in> ?D. \<exists> b \<in> ?B'. ?P (real_of_int (b + j)))" 
  4.1592      by blast 
  4.1593 -  hence th2: "\<forall> x. \<not> (\<exists> j \<in> ?D. \<exists> b \<in> ?B'. ?P (real (b + j))) \<longrightarrow> ?P (real x) \<longrightarrow> ?P (real (x - d))" using \<beta>'[OF lp u d dp] by blast
  4.1594 +  hence th2: "\<forall> x. \<not> (\<exists> j \<in> ?D. \<exists> b \<in> ?B'. ?P (real_of_int (b + j))) \<longrightarrow> ?P (real_of_int x) \<longrightarrow> ?P (real_of_int (x - d))" using \<beta>'[OF lp u d dp] by blast
  4.1595    from minusinf_repeats[OF d lp]
  4.1596    have th3: "\<forall> x k. ?M x = ?M (x-k*d)" by simp
  4.1597    from cpmi_eq[OF dp th th2 th3] BB' show ?thesis by blast
  4.1598 @@ -2840,38 +2816,38 @@
  4.1599    "\<sigma> p k t \<equiv> And (Dvd k t) (\<sigma>_\<rho> p (t,k))"
  4.1600  
  4.1601  lemma \<sigma>_\<rho>:
  4.1602 -  assumes linp: "iszlfm p (real (x::int)#bs)"
  4.1603 -  and kpos: "real k > 0"
  4.1604 +  assumes linp: "iszlfm p (real_of_int (x::int)#bs)"
  4.1605 +  and kpos: "real_of_int k > 0"
  4.1606    and tnb: "numbound0 t"
  4.1607 -  and tint: "isint t (real x#bs)"
  4.1608 +  and tint: "isint t (real_of_int x#bs)"
  4.1609    and kdt: "k dvd floor (Inum (b'#bs) t)"
  4.1610 -  shows "Ifm (real x#bs) (\<sigma>_\<rho> p (t,k)) = 
  4.1611 -  (Ifm ((real ((floor (Inum (b'#bs) t)) div k))#bs) p)" 
  4.1612 -  (is "?I (real x) (?s p) = (?I (real ((floor (?N b' t)) div k)) p)" is "_ = (?I ?tk p)")
  4.1613 +  shows "Ifm (real_of_int x#bs) (\<sigma>_\<rho> p (t,k)) = 
  4.1614 +  (Ifm ((real_of_int ((floor (Inum (b'#bs) t)) div k))#bs) p)" 
  4.1615 +  (is "?I (real_of_int x) (?s p) = (?I (real_of_int ((floor (?N b' t)) div k)) p)" is "_ = (?I ?tk p)")
  4.1616  using linp kpos tnb
  4.1617  proof(induct p rule: \<sigma>_\<rho>.induct)
  4.1618    case (3 c e) 
  4.1619    from 3 have cp: "c > 0" and nb: "numbound0 e" by auto
  4.1620    { assume kdc: "k dvd c" 
  4.1621 -    from tint have ti: "real (floor (?N (real x) t)) = ?N (real x) t" using isint_def by simp
  4.1622 +    from tint have ti: "real_of_int (floor (?N (real_of_int x) t)) = ?N (real_of_int x) t" using isint_def by simp
  4.1623      from kdc have ?case using real_of_int_div[OF kdc] real_of_int_div[OF kdt]
  4.1624 -      numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  4.1625 -      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"] by (simp add: ti) } 
  4.1626 +      numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  4.1627 +      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) } 
  4.1628    moreover 
  4.1629    { assume *: "\<not> k dvd c"
  4.1630 -    from kpos have knz': "real k \<noteq> 0" by simp
  4.1631 -    from tint have ti: "real (floor (?N (real x) t)) = ?N (real x) t"
  4.1632 +    from kpos have knz': "real_of_int k \<noteq> 0" by simp
  4.1633 +    from tint have ti: "real_of_int (floor (?N (real_of_int x) t)) = ?N (real_of_int x) t"
  4.1634        using isint_def by simp
  4.1635 -    from assms * 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)"
  4.1636 +    from assms * have "?I (real_of_int x) (?s (Eq (CN 0 c e))) = ((real_of_int c * (?N (real_of_int x) t / real_of_int k) + ?N (real_of_int x) e)* real_of_int k = 0)"
  4.1637        using real_of_int_div[OF kdt]
  4.1638 -        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  4.1639 -        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"]
  4.1640 +        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  4.1641 +        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
  4.1642        by (simp add: ti algebra_simps)
  4.1643        also have "\<dots> = (?I ?tk (Eq (CN 0 c e)))"
  4.1644          using nonzero_eq_divide_eq[OF knz',
  4.1645 -            where a="real c * (?N (real x) t / real k) + ?N (real x) e" and b="0", symmetric]
  4.1646 -          real_of_int_div[OF kdt] numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  4.1647 -          numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"]
  4.1648 +            where a="real_of_int c * (?N (real_of_int x) t / real_of_int k) + ?N (real_of_int x) e" and b="0", symmetric]
  4.1649 +          real_of_int_div[OF kdt] numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  4.1650 +          numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
  4.1651          by (simp add: ti)
  4.1652        finally have ?case . }
  4.1653      ultimately show ?case by blast 
  4.1654 @@ -2879,24 +2855,24 @@
  4.1655    case (4 c e)  
  4.1656    then have cp: "c > 0" and nb: "numbound0 e" by auto
  4.1657    { assume kdc: "k dvd c" 
  4.1658 -    from tint have ti: "real (floor (?N (real x) t)) = ?N (real x) t" using isint_def by simp
  4.1659 +    from tint have ti: "real_of_int (floor (?N (real_of_int x) t)) = ?N (real_of_int x) t" using isint_def by simp
  4.1660      from kdc have  ?case using real_of_int_div[OF kdc] real_of_int_div[OF kdt]
  4.1661 -      numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  4.1662 -      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"] by (simp add: ti) } 
  4.1663 +      numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  4.1664 +      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) } 
  4.1665    moreover 
  4.1666    { assume *: "\<not> k dvd c"
  4.1667 -    from kpos have knz': "real k \<noteq> 0" by simp
  4.1668 -    from tint have ti: "real (floor (?N (real x) t)) = ?N (real x) t" using isint_def by simp
  4.1669 -    from assms * 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)"
  4.1670 +    from kpos have knz': "real_of_int k \<noteq> 0" by simp
  4.1671 +    from tint have ti: "real_of_int (floor (?N (real_of_int x) t)) = ?N (real_of_int x) t" using isint_def by simp
  4.1672 +    from assms * have "?I (real_of_int x) (?s (NEq (CN 0 c e))) = ((real_of_int c * (?N (real_of_int x) t / real_of_int k) + ?N (real_of_int x) e)* real_of_int k \<noteq> 0)"
  4.1673        using real_of_int_div[OF kdt]
  4.1674 -        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  4.1675 -        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"]
  4.1676 +        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  4.1677 +        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
  4.1678        by (simp add: ti algebra_simps)
  4.1679      also have "\<dots> = (?I ?tk (NEq (CN 0 c e)))"
  4.1680        using nonzero_eq_divide_eq[OF knz',
  4.1681 -          where a="real c * (?N (real x) t / real k) + ?N (real x) e" and b="0", symmetric]
  4.1682 -        real_of_int_div[OF kdt] numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  4.1683 -        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"]
  4.1684 +          where a="real_of_int c * (?N (real_of_int x) t / real_of_int k) + ?N (real_of_int x) e" and b="0", symmetric]
  4.1685 +        real_of_int_div[OF kdt] numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  4.1686 +        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
  4.1687        by (simp add: ti)
  4.1688      finally have ?case . }
  4.1689    ultimately show ?case by blast 
  4.1690 @@ -2904,23 +2880,23 @@
  4.1691    case (5 c e) 
  4.1692    then have cp: "c > 0" and nb: "numbound0 e" by auto
  4.1693    { assume kdc: "k dvd c" 
  4.1694 -    from tint have ti: "real (floor (?N (real x) t)) = ?N (real x) t" using isint_def by simp
  4.1695 +    from tint have ti: "real_of_int (floor (?N (real_of_int x) t)) = ?N (real_of_int x) t" using isint_def by simp
  4.1696      from kdc have  ?case using real_of_int_div[OF kdc] real_of_int_div[OF kdt]
  4.1697 -      numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  4.1698 -      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"] by (simp add: ti) } 
  4.1699 +      numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  4.1700 +      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) } 
  4.1701    moreover 
  4.1702    { assume *: "\<not> k dvd c"
  4.1703 -    from tint have ti: "real (floor (?N (real x) t)) = ?N (real x) t" using isint_def by simp
  4.1704 -    from assms * 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)"
  4.1705 +    from tint have ti: "real_of_int (floor (?N (real_of_int x) t)) = ?N (real_of_int x) t" using isint_def by simp
  4.1706 +    from assms * have "?I (real_of_int x) (?s (Lt (CN 0 c e))) = ((real_of_int c * (?N (real_of_int x) t / real_of_int k) + ?N (real_of_int x) e)* real_of_int k < 0)"
  4.1707        using real_of_int_div[OF kdt]
  4.1708 -        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  4.1709 -        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"]
  4.1710 +        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  4.1711 +        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
  4.1712        by (simp add: ti algebra_simps)
  4.1713      also have "\<dots> = (?I ?tk (Lt (CN 0 c e)))"
  4.1714        using pos_less_divide_eq[OF kpos,
  4.1715 -          where a="real c * (?N (real x) t / real k) + ?N (real x) e" and b="0", symmetric]
  4.1716 -        real_of_int_div[OF kdt] numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  4.1717 -        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"]
  4.1718 +          where a="real_of_int c * (?N (real_of_int x) t / real_of_int k) + ?N (real_of_int x) e" and b="0", symmetric]
  4.1719 +        real_of_int_div[OF kdt] numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  4.1720 +        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
  4.1721        by (simp add: ti)
  4.1722      finally have ?case . }
  4.1723    ultimately show ?case by blast 
  4.1724 @@ -2928,23 +2904,23 @@
  4.1725    case (6 c e)
  4.1726    then have cp: "c > 0" and nb: "numbound0 e" by auto
  4.1727    { assume kdc: "k dvd c" 
  4.1728 -    from tint have ti: "real (floor (?N (real x) t)) = ?N (real x) t" using isint_def by simp
  4.1729 +    from tint have ti: "real_of_int (floor (?N (real_of_int x) t)) = ?N (real_of_int x) t" using isint_def by simp
  4.1730      from kdc have  ?case using real_of_int_div[OF kdc] real_of_int_div[OF kdt]
  4.1731 -      numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  4.1732 -      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"] by (simp add: ti) } 
  4.1733 +      numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  4.1734 +      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) } 
  4.1735    moreover 
  4.1736    { assume *: "\<not> k dvd c"
  4.1737 -    from tint have ti: "real (floor (?N (real x) t)) = ?N (real x) t" using isint_def by simp
  4.1738 -    from assms * 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)"
  4.1739 +    from tint have ti: "real_of_int (floor (?N (real_of_int x) t)) = ?N (real_of_int x) t" using isint_def by simp
  4.1740 +    from assms * have "?I (real_of_int x) (?s (Le (CN 0 c e))) = ((real_of_int c * (?N (real_of_int x) t / real_of_int k) + ?N (real_of_int x) e)* real_of_int k \<le> 0)"
  4.1741        using real_of_int_div[OF kdt]
  4.1742 -        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  4.1743 -        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"]
  4.1744 +        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  4.1745 +        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
  4.1746        by (simp add: ti algebra_simps)
  4.1747      also have "\<dots> = (?I ?tk (Le (CN 0 c e)))"
  4.1748        using pos_le_divide_eq[OF kpos,
  4.1749 -          where a="real c * (?N (real x) t / real k) + ?N (real x) e" and b="0", symmetric]
  4.1750 -        real_of_int_div[OF kdt] numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  4.1751 -        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"]
  4.1752 +          where a="real_of_int c * (?N (real_of_int x) t / real_of_int k) + ?N (real_of_int x) e" and b="0", symmetric]
  4.1753 +        real_of_int_div[OF kdt] numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  4.1754 +        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
  4.1755        by (simp add: ti)
  4.1756      finally have ?case . }
  4.1757    ultimately show ?case by blast 
  4.1758 @@ -2952,23 +2928,23 @@
  4.1759    case (7 c e) 
  4.1760    then have cp: "c > 0" and nb: "numbound0 e" by auto
  4.1761    { assume kdc: "k dvd c" 
  4.1762 -    from tint have ti: "real (floor (?N (real x) t)) = ?N (real x) t" using isint_def by simp
  4.1763 +    from tint have ti: "real_of_int (floor (?N (real_of_int x) t)) = ?N (real_of_int x) t" using isint_def by simp
  4.1764      from kdc have  ?case using real_of_int_div[OF kdc] real_of_int_div[OF kdt]
  4.1765 -      numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  4.1766 -      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"] by (simp add: ti) } 
  4.1767 +      numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  4.1768 +      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) } 
  4.1769    moreover 
  4.1770    { assume *: "\<not> k dvd c"
  4.1771 -    from tint have ti: "real (floor (?N (real x) t)) = ?N (real x) t" using isint_def by simp
  4.1772 -    from assms * 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)"
  4.1773 +    from tint have ti: "real_of_int (floor (?N (real_of_int x) t)) = ?N (real_of_int x) t" using isint_def by simp
  4.1774 +    from assms * have "?I (real_of_int x) (?s (Gt (CN 0 c e))) = ((real_of_int c * (?N (real_of_int x) t / real_of_int k) + ?N (real_of_int x) e)* real_of_int k > 0)"
  4.1775        using real_of_int_div[OF kdt]
  4.1776 -        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  4.1777 -        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"]
  4.1778 +        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  4.1779 +        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
  4.1780        by (simp add: ti algebra_simps)
  4.1781      also have "\<dots> = (?I ?tk (Gt (CN 0 c e)))"
  4.1782        using pos_divide_less_eq[OF kpos,
  4.1783 -          where a="real c * (?N (real x) t / real k) + ?N (real x) e" and b="0", symmetric]
  4.1784 -        real_of_int_div[OF kdt] numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  4.1785 -        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"]
  4.1786 +          where a="real_of_int c * (?N (real_of_int x) t / real_of_int k) + ?N (real_of_int x) e" and b="0", symmetric]
  4.1787 +        real_of_int_div[OF kdt] numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  4.1788 +        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
  4.1789        by (simp add: ti)
  4.1790      finally have ?case . }
  4.1791    ultimately show ?case by blast 
  4.1792 @@ -2976,23 +2952,23 @@
  4.1793    case (8 c e)  
  4.1794    then have cp: "c > 0" and nb: "numbound0 e" by auto
  4.1795    { assume kdc: "k dvd c" 
  4.1796 -    from tint have ti: "real (floor (?N (real x) t)) = ?N (real x) t" using isint_def by simp
  4.1797 +    from tint have ti: "real_of_int (floor (?N (real_of_int x) t)) = ?N (real_of_int x) t" using isint_def by simp
  4.1798      from kdc have  ?case using real_of_int_div[OF kdc] real_of_int_div[OF kdt]
  4.1799 -      numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  4.1800 -      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"] by (simp add: ti) } 
  4.1801 +      numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  4.1802 +      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) } 
  4.1803    moreover 
  4.1804    { assume *: "\<not> k dvd c"
  4.1805 -    from tint have ti: "real (floor (?N (real x) t)) = ?N (real x) t" using isint_def by simp
  4.1806 -    from assms * 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)"
  4.1807 +    from tint have ti: "real_of_int (floor (?N (real_of_int x) t)) = ?N (real_of_int x) t" using isint_def by simp
  4.1808 +    from assms * have "?I (real_of_int x) (?s (Ge (CN 0 c e))) = ((real_of_int c * (?N (real_of_int x) t / real_of_int k) + ?N (real_of_int x) e)* real_of_int k \<ge> 0)"
  4.1809        using real_of_int_div[OF kdt]
  4.1810 -        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  4.1811 -        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"]
  4.1812 +        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  4.1813 +        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
  4.1814        by (simp add: ti algebra_simps)
  4.1815      also have "\<dots> = (?I ?tk (Ge (CN 0 c e)))"
  4.1816        using pos_divide_le_eq[OF kpos,
  4.1817 -          where a="real c * (?N (real x) t / real k) + ?N (real x) e" and b="0", symmetric]
  4.1818 -        real_of_int_div[OF kdt] numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  4.1819 -        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"]
  4.1820 +          where a="real_of_int c * (?N (real_of_int x) t / real_of_int k) + ?N (real_of_int x) e" and b="0", symmetric]
  4.1821 +        real_of_int_div[OF kdt] numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  4.1822 +        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
  4.1823        by (simp add: ti)
  4.1824      finally have ?case . }
  4.1825    ultimately show ?case by blast 
  4.1826 @@ -3000,23 +2976,23 @@
  4.1827    case (9 i c e)
  4.1828    then have cp: "c > 0" and nb: "numbound0 e" by auto
  4.1829    { assume kdc: "k dvd c" 
  4.1830 -    from tint have ti: "real (floor (?N (real x) t)) = ?N (real x) t" using isint_def by simp
  4.1831 +    from tint have ti: "real_of_int (floor (?N (real_of_int x) t)) = ?N (real_of_int x) t" using isint_def by simp
  4.1832      from kdc have ?case using real_of_int_div[OF kdc] real_of_int_div[OF kdt]
  4.1833 -      numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  4.1834 -      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"] by (simp add: ti) } 
  4.1835 +      numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  4.1836 +      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) } 
  4.1837    moreover 
  4.1838    { assume *: "\<not> k dvd c"
  4.1839 -    from kpos have knz: "k\<noteq>0" by simp hence knz': "real k \<noteq> 0" by simp
  4.1840 -    from tint have ti: "real (floor (?N (real x) t)) = ?N (real x) t" using isint_def by simp
  4.1841 -    from assms * 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)"
  4.1842 +    from kpos have knz: "k\<noteq>0" by simp hence knz': "real_of_int k \<noteq> 0" by simp
  4.1843 +    from tint have ti: "real_of_int (floor (?N (real_of_int x) t)) = ?N (real_of_int x) t" using isint_def by simp
  4.1844 +    from assms * have "?I (real_of_int x) (?s (Dvd i (CN 0 c e))) = (real_of_int i * real_of_int k rdvd (real_of_int c * (?N (real_of_int x) t / real_of_int k) + ?N (real_of_int x) e)* real_of_int k)"
  4.1845        using real_of_int_div[OF kdt]
  4.1846 -        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  4.1847 -        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"]
  4.1848 +        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  4.1849 +        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
  4.1850        by (simp add: ti algebra_simps)
  4.1851      also have "\<dots> = (?I ?tk (Dvd i (CN 0 c e)))"
  4.1852        using rdvd_mult[OF knz, where n="i"]
  4.1853 -        real_of_int_div[OF kdt] numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  4.1854 -        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"]
  4.1855 +        real_of_int_div[OF kdt] numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  4.1856 +        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
  4.1857        by (simp add: ti)
  4.1858      finally have ?case . }
  4.1859    ultimately show ?case by blast 
  4.1860 @@ -3024,28 +3000,28 @@
  4.1861    case (10 i c e)
  4.1862    then have cp: "c > 0" and nb: "numbound0 e" by auto
  4.1863    { assume kdc: "k dvd c" 
  4.1864 -    from tint have ti: "real (floor (?N (real x) t)) = ?N (real x) t" using isint_def by simp
  4.1865 +    from tint have ti: "real_of_int (floor (?N (real_of_int x) t)) = ?N (real_of_int x) t" using isint_def by simp
  4.1866      from kdc have  ?case using real_of_int_div[OF kdc] real_of_int_div[OF kdt]
  4.1867 -      numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  4.1868 -      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"] by (simp add: ti) } 
  4.1869 +      numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  4.1870 +      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) } 
  4.1871    moreover 
  4.1872    { assume *: "\<not> k dvd c"
  4.1873 -    from kpos have knz: "k\<noteq>0" by simp hence knz': "real k \<noteq> 0" by simp
  4.1874 -    from tint have ti: "real (floor (?N (real x) t)) = ?N (real x) t" using isint_def by simp
  4.1875 -    from assms * 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))"
  4.1876 +    from kpos have knz: "k\<noteq>0" by simp hence knz': "real_of_int k \<noteq> 0" by simp
  4.1877 +    from tint have ti: "real_of_int (floor (?N (real_of_int x) t)) = ?N (real_of_int x) t" using isint_def by simp
  4.1878 +    from assms * have "?I (real_of_int x) (?s (NDvd i (CN 0 c e))) = (\<not> (real_of_int i * real_of_int k rdvd (real_of_int c * (?N (real_of_int x) t / real_of_int k) + ?N (real_of_int x) e)* real_of_int k))"
  4.1879        using real_of_int_div[OF kdt]
  4.1880 -        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  4.1881 -        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"]
  4.1882 +        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  4.1883 +        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
  4.1884        by (simp add: ti algebra_simps)
  4.1885      also have "\<dots> = (?I ?tk (NDvd i (CN 0 c e)))"
  4.1886        using rdvd_mult[OF knz, where n="i"] real_of_int_div[OF kdt]
  4.1887 -        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real x"]
  4.1888 -        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real x"]
  4.1889 +        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  4.1890 +        numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
  4.1891        by (simp add: ti)
  4.1892      finally have ?case . }
  4.1893    ultimately show ?case by blast 
  4.1894 -qed (simp_all add: bound0_I[where bs="bs" and b="real ((floor (?N b' t)) div k)" and b'="real x"]
  4.1895 -  numbound0_I[where bs="bs" and b="real ((floor (?N b' t)) div k)" and b'="real x"])
  4.1896 +qed (simp_all add: bound0_I[where bs="bs" and b="real_of_int ((floor (?N b' t)) div k)" and b'="real_of_int x"]
  4.1897 +  numbound0_I[where bs="bs" and b="real_of_int ((floor (?N b' t)) div k)" and b'="real_of_int x"])
  4.1898  
  4.1899  
  4.1900  lemma \<sigma>_\<rho>_nb: assumes lp:"iszlfm p (a#bs)" and nb: "numbound0 t"
  4.1901 @@ -3054,153 +3030,153 @@
  4.1902    by (induct p rule: iszlfm.induct, auto simp add: nb)
  4.1903  
  4.1904  lemma \<rho>_l:
  4.1905 -  assumes lp: "iszlfm p (real (i::int)#bs)"
  4.1906 -  shows "\<forall> (b,k) \<in> set (\<rho> p). k >0 \<and> numbound0 b \<and> isint b (real i#bs)"
  4.1907 +  assumes lp: "iszlfm p (real_of_int (i::int)#bs)"
  4.1908 +  shows "\<forall> (b,k) \<in> set (\<rho> p). k >0 \<and> numbound0 b \<and> isint b (real_of_int i#bs)"
  4.1909  using lp by (induct p rule: \<rho>.induct, auto simp add: isint_sub isint_neg)
  4.1910  
  4.1911  lemma \<alpha>_\<rho>_l:
  4.1912 -  assumes lp: "iszlfm p (real (i::int)#bs)"
  4.1913 -  shows "\<forall> (b,k) \<in> set (\<alpha>_\<rho> p). k >0 \<and> numbound0 b \<and> isint b (real i#bs)"
  4.1914 -using lp isint_add [OF isint_c[where j="- 1"],where bs="real i#bs"]
  4.1915 +  assumes lp: "iszlfm p (real_of_int (i::int)#bs)"
  4.1916 +  shows "\<forall> (b,k) \<in> set (\<alpha>_\<rho> p). k >0 \<and> numbound0 b \<and> isint b (real_of_int i#bs)"
  4.1917 +using lp isint_add [OF isint_c[where j="- 1"],where bs="real_of_int i#bs"]
  4.1918   by (induct p rule: \<alpha>_\<rho>.induct, auto)
  4.1919  
  4.1920 -lemma \<rho>: assumes lp: "iszlfm p (real (i::int) #bs)"
  4.1921 -  and pi: "Ifm (real i#bs) p"
  4.1922 +lemma \<rho>: assumes lp: "iszlfm p (real_of_int (i::int) #bs)"
  4.1923 +  and pi: "Ifm (real_of_int i#bs) p"
  4.1924    and d: "d_\<delta> p d"
  4.1925    and dp: "d > 0"
  4.1926 -  and nob: "\<forall>(e,c) \<in> set (\<rho> p). \<forall> j\<in> {1 .. c*d}. real (c*i) \<noteq> Inum (real i#bs) e + real j"
  4.1927 +  and nob: "\<forall>(e,c) \<in> set (\<rho> p). \<forall> j\<in> {1 .. c*d}. real_of_int (c*i) \<noteq> Inum (real_of_int i#bs) e + real_of_int j"
  4.1928    (is "\<forall>(e,c) \<in> set (\<rho> p). \<forall> j\<in> {1 .. c*d}. _ \<noteq> ?N i e + _")
  4.1929 -  shows "Ifm (real(i - d)#bs) p"
  4.1930 +  shows "Ifm (real_of_int(i - d)#bs) p"
  4.1931    using lp pi d nob
  4.1932  proof(induct p rule: iszlfm.induct)
  4.1933 -  case (3 c e) hence cp: "c >0" and nb: "numbound0 e" and ei: "isint e (real i#bs)"
  4.1934 -    and pi: "real (c*i) = - 1 -  ?N i e + real (1::int)" and nob: "\<forall> j\<in> {1 .. c*d}. real (c*i) \<noteq> -1 - ?N i e + real j"
  4.1935 +  case (3 c e) hence cp: "c >0" and nb: "numbound0 e" and ei: "isint e (real_of_int i#bs)"
  4.1936 +    and pi: "real_of_int (c*i) = - 1 -  ?N i e + real_of_int (1::int)" and nob: "\<forall> j\<in> {1 .. c*d}. real_of_int (c*i) \<noteq> -1 - ?N i e + real_of_int j"
  4.1937      by simp+
  4.1938    from mult_strict_left_mono[OF dp cp]  have one:"1 \<in> {1 .. c*d}" by auto
  4.1939    from nob[rule_format, where j="1", OF one] pi show ?case by simp
  4.1940  next
  4.1941    case (4 c e)  
  4.1942 -  hence cp: "c >0" and nb: "numbound0 e" and ei: "isint e (real i#bs)"
  4.1943 -    and nob: "\<forall> j\<in> {1 .. c*d}. real (c*i) \<noteq> - ?N i e + real j"
  4.1944 +  hence cp: "c >0" and nb: "numbound0 e" and ei: "isint e (real_of_int i#bs)"
  4.1945 +    and nob: "\<forall> j\<in> {1 .. c*d}. real_of_int (c*i) \<noteq> - ?N i e + real_of_int j"
  4.1946      by simp+
  4.1947 -  {assume "real (c*i) \<noteq> - ?N i e + real (c*d)"
  4.1948 -    with numbound0_I[OF nb, where bs="bs" and b="real i - real d" and b'="real i"]
  4.1949 +  {assume "real_of_int (c*i) \<noteq> - ?N i e + real_of_int (c*d)"
  4.1950 +    with numbound0_I[OF nb, where bs="bs" and b="real_of_int i - real_of_int d" and b'="real_of_int i"]
  4.1951      have ?case by (simp add: algebra_simps)}
  4.1952    moreover
  4.1953 -  {assume pi: "real (c*i) = - ?N i e + real (c*d)"
  4.1954 +  {assume pi: "real_of_int (c*i) = - ?N i e + real_of_int (c*d)"
  4.1955      from mult_strict_left_mono[OF dp cp] have d: "(c*d) \<in> {1 .. c*d}" by simp
  4.1956      from nob[rule_format, where j="c*d", OF d] pi have ?case by simp }
  4.1957    ultimately show ?case by blast
  4.1958  next
  4.1959    case (5 c e) hence cp: "c > 0" by simp
  4.1960 -  from 5 mult_strict_left_mono[OF dp cp, simplified real_of_int_less_iff[symmetric] 
  4.1961 -    real_of_int_mult]
  4.1962 +  from 5 mult_strict_left_mono[OF dp cp, simplified of_int_less_iff[symmetric] 
  4.1963 +    of_int_mult]
  4.1964    show ?case using 5 dp 
  4.1965 -    by (simp add: numbound0_I[where bs="bs" and b="real i - real d" and b'="real i"] 
  4.1966 +    apply (simp add: numbound0_I[where bs="bs" and b="real_of_int i - real_of_int d" and b'="real_of_int i"] 
  4.1967        algebra_simps del: mult_pos_pos)
  4.1968 +     by (metis add.right_neutral of_int_0_less_iff of_int_mult pos_add_strict)
  4.1969  next
  4.1970    case (6 c e) hence cp: "c > 0" by simp
  4.1971 -  from 6 mult_strict_left_mono[OF dp cp, simplified real_of_int_less_iff[symmetric] 
  4.1972 -    real_of_int_mult]
  4.1973 +  from 6 mult_strict_left_mono[OF dp cp, simplified of_int_less_iff[symmetric] 
  4.1974 +    of_int_mult]
  4.1975    show ?case using 6 dp 
  4.1976 -    by (simp add: numbound0_I[where bs="bs" and b="real i - real d" and b'="real i"] 
  4.1977 +    apply (simp add: numbound0_I[where bs="bs" and b="real_of_int i - real_of_int d" and b'="real_of_int i"] 
  4.1978        algebra_simps del: mult_pos_pos)
  4.1979 +      using order_trans by fastforce
  4.1980  next
  4.1981 -  case (7 c e) hence cp: "c >0" and nb: "numbound0 e" and ei: "isint e (real i#bs)"
  4.1982 -    and nob: "\<forall> j\<in> {1 .. c*d}. real (c*i) \<noteq> - ?N i e + real j"
  4.1983 -    and pi: "real (c*i) + ?N i e > 0" and cp': "real c >0"
  4.1984 +  case (7 c e) hence cp: "c >0" and nb: "numbound0 e" and ei: "isint e (real_of_int i#bs)"
  4.1985 +    and nob: "\<forall> j\<in> {1 .. c*d}. real_of_int (c*i) \<noteq> - ?N i e + real_of_int j"
  4.1986 +    and pi: "real_of_int (c*i) + ?N i e > 0" and cp': "real_of_int c >0"
  4.1987      by simp+
  4.1988    let ?fe = "floor (?N i e)"
  4.1989 -  from pi cp have th:"(real i +?N i e / real c)*real c > 0" by (simp add: algebra_simps)
  4.1990 -  from pi ei[simplified isint_iff] have "real (c*i + ?fe) > real (0::int)" by simp
  4.1991 -  hence pi': "c*i + ?fe > 0" by (simp only: real_of_int_less_iff[symmetric])
  4.1992 -  have "real (c*i) + ?N i e > real (c*d) \<or> real (c*i) + ?N i e \<le> real (c*d)" by auto
  4.1993 +  from pi cp have th:"(real_of_int i +?N i e / real_of_int c)*real_of_int c > 0" by (simp add: algebra_simps)
  4.1994 +  from pi ei[simplified isint_iff] have "real_of_int (c*i + ?fe) > real_of_int (0::int)" by simp
  4.1995 +  hence pi': "c*i + ?fe > 0" by (simp only: of_int_less_iff[symmetric])
  4.1996 +  have "real_of_int (c*i) + ?N i e > real_of_int (c*d) \<or> real_of_int (c*i) + ?N i e \<le> real_of_int (c*d)" by auto
  4.1997    moreover
  4.1998 -  {assume "real (c*i) + ?N i e > real (c*d)" hence ?case
  4.1999 +  {assume "real_of_int (c*i) + ?N i e > real_of_int (c*d)" hence ?case
  4.2000        by (simp add: algebra_simps 
  4.2001 -        numbound0_I[OF nb,where bs="bs" and b="real i - real d" and b'="real i"])} 
  4.2002 +        numbound0_I[OF nb,where bs="bs" and b="real_of_int i - real_of_int d" and b'="real_of_int i"])} 
  4.2003    moreover 
  4.2004 -  {assume H:"real (c*i) + ?N i e \<le> real (c*d)"
  4.2005 -    with ei[simplified isint_iff] have "real (c*i + ?fe) \<le> real (c*d)" by simp
  4.2006 -    hence pid: "c*i + ?fe \<le> c*d" by (simp only: real_of_int_le_iff)
  4.2007 +  {assume H:"real_of_int (c*i) + ?N i e \<le> real_of_int (c*d)"
  4.2008 +    with ei[simplified isint_iff] have "real_of_int (c*i + ?fe) \<le> real_of_int (c*d)" by simp
  4.2009 +    hence pid: "c*i + ?fe \<le> c*d" by (simp only: of_int_le_iff)
  4.2010      with pi' have "\<exists> j1\<in> {1 .. c*d}. c*i + ?fe = j1" by auto
  4.2011 -    hence "\<exists> j1\<in> {1 .. c*d}. real (c*i) = - ?N i e + real j1" 
  4.2012 -      by (simp only: real_of_int_mult real_of_int_add real_of_int_inject[symmetric] ei[simplified isint_iff])
  4.2013 -        (simp add: algebra_simps)
  4.2014 +    hence "\<exists> j1\<in> {1 .. c*d}. real_of_int (c*i) = - ?N i e + real_of_int j1"
  4.2015 +      unfolding Bex_def using ei[simplified isint_iff] by fastforce
  4.2016      with nob  have ?case by blast }
  4.2017    ultimately show ?case by blast
  4.2018  next
  4.2019 -  case (8 c e)  hence cp: "c >0" and nb: "numbound0 e" and ei: "isint e (real i#bs)"
  4.2020 -    and nob: "\<forall> j\<in> {1 .. c*d}. real (c*i) \<noteq> - 1 - ?N i e + real j"
  4.2021 -    and pi: "real (c*i) + ?N i e \<ge> 0" and cp': "real c >0"
  4.2022 +  case (8 c e)  hence cp: "c >0" and nb: "numbound0 e" and ei: "isint e (real_of_int i#bs)"
  4.2023 +    and nob: "\<forall> j\<in> {1 .. c*d}. real_of_int (c*i) \<noteq> - 1 - ?N i e + real_of_int j"
  4.2024 +    and pi: "real_of_int (c*i) + ?N i e \<ge> 0" and cp': "real_of_int c >0"
  4.2025      by simp+
  4.2026    let ?fe = "floor (?N i e)"
  4.2027 -  from pi cp have th:"(real i +?N i e / real c)*real c \<ge> 0" by (simp add: algebra_simps)
  4.2028 -  from pi ei[simplified isint_iff] have "real (c*i + ?fe) \<ge> real (0::int)" by simp
  4.2029 -  hence pi': "c*i + 1 + ?fe \<ge> 1" by (simp only: real_of_int_le_iff[symmetric])
  4.2030 -  have "real (c*i) + ?N i e \<ge> real (c*d) \<or> real (c*i) + ?N i e < real (c*d)" by auto
  4.2031 +  from pi cp have th:"(real_of_int i +?N i e / real_of_int c)*real_of_int c \<ge> 0" by (simp add: algebra_simps)
  4.2032 +  from pi ei[simplified isint_iff] have "real_of_int (c*i + ?fe) \<ge> real_of_int (0::int)" by simp
  4.2033 +  hence pi': "c*i + 1 + ?fe \<ge> 1" by (simp only: of_int_le_iff[symmetric])
  4.2034 +  have "real_of_int (c*i) + ?N i e \<ge> real_of_int (c*d) \<or> real_of_int (c*i) + ?N i e < real_of_int (c*d)" by auto
  4.2035    moreover
  4.2036 -  {assume "real (c*i) + ?N i e \<ge> real (c*d)" hence ?case
  4.2037 +  {assume "real_of_int (c*i) + ?N i e \<ge> real_of_int (c*d)" hence ?case
  4.2038        by (simp add: algebra_simps 
  4.2039 -        numbound0_I[OF nb,where bs="bs" and b="real i - real d" and b'="real i"])} 
  4.2040 +        numbound0_I[OF nb,where bs="bs" and b="real_of_int i - real_of_int d" and b'="real_of_int i"])} 
  4.2041    moreover 
  4.2042 -  {assume H:"real (c*i) + ?N i e < real (c*d)"
  4.2043 -    with ei[simplified isint_iff] have "real (c*i + ?fe) < real (c*d)" by simp
  4.2044 -    hence pid: "c*i + 1 + ?fe \<le> c*d" by (simp only: real_of_int_le_iff)
  4.2045 +  {assume H:"real_of_int (c*i) + ?N i e < real_of_int (c*d)"
  4.2046 +    with ei[simplified isint_iff] have "real_of_int (c*i + ?fe) < real_of_int (c*d)" by simp
  4.2047 +    hence pid: "c*i + 1 + ?fe \<le> c*d" by (simp only: of_int_le_iff)
  4.2048      with pi' have "\<exists> j1\<in> {1 .. c*d}. c*i + 1+ ?fe = j1" by auto
  4.2049 -    hence "\<exists> j1\<in> {1 .. c*d}. real (c*i) + 1= - ?N i e + real j1"
  4.2050 -      by (simp only: real_of_int_mult real_of_int_add real_of_int_inject[symmetric] ei[simplified isint_iff] real_of_one) 
  4.2051 -        (simp add: algebra_simps)
  4.2052 -    hence "\<exists> j1\<in> {1 .. c*d}. real (c*i) = (- ?N i e + real j1) - 1"
  4.2053 +    hence "\<exists> j1\<in> {1 .. c*d}. real_of_int (c*i) + 1= - ?N i e + real_of_int j1"
  4.2054 +      unfolding Bex_def using ei[simplified isint_iff] by fastforce
  4.2055 +    hence "\<exists> j1\<in> {1 .. c*d}. real_of_int (c*i) = (- ?N i e + real_of_int j1) - 1"
  4.2056        by (simp only: algebra_simps)
  4.2057 -        hence "\<exists> j1\<in> {1 .. c*d}. real (c*i) = - 1 - ?N i e + real j1"
  4.2058 +        hence "\<exists> j1\<in> {1 .. c*d}. real_of_int (c*i) = - 1 - ?N i e + real_of_int j1"
  4.2059            by (simp add: algebra_simps)
  4.2060      with nob  have ?case by blast }
  4.2061    ultimately show ?case by blast
  4.2062  next
  4.2063 -  case (9 j c e)  hence p: "real j rdvd real (c*i) + ?N i e" (is "?p x") and cp: "c > 0" and bn:"numbound0 e"  by simp+
  4.2064 -  let ?e = "Inum (real i # bs) e"
  4.2065 -  from 9 have "isint e (real i #bs)"  by simp 
  4.2066 -  hence ie: "real (floor ?e) = ?e" using isint_iff[where n="e" and bs="(real i)#bs"] numbound0_I[OF bn,where b="real i" and b'="real i" and bs="bs"]
  4.2067 +  case (9 j c e)  hence p: "real_of_int j rdvd real_of_int (c*i) + ?N i e" (is "?p x") and cp: "c > 0" and bn:"numbound0 e"  by simp+
  4.2068 +  let ?e = "Inum (real_of_int i # bs) e"
  4.2069 +  from 9 have "isint e (real_of_int i #bs)"  by simp 
  4.2070 +  hence ie: "real_of_int (floor ?e) = ?e" using isint_iff[where n="e" and bs="(real_of_int i)#bs"] numbound0_I[OF bn,where b="real_of_int i" and b'="real_of_int i" and bs="bs"]
  4.2071      by (simp add: isint_iff)
  4.2072    from 9 have id: "j dvd d" by simp
  4.2073 -  from ie[symmetric] have "?p i = (real j rdvd real (c*i+ floor ?e))" by simp
  4.2074 +  from ie[symmetric] have "?p i = (real_of_int j rdvd real_of_int (c*i+ floor ?e))" by simp
  4.2075    also have "\<dots> = (j dvd c*i + floor ?e)" 
  4.2076      using int_rdvd_iff [where i="j" and t="c*i+ floor ?e"] by simp
  4.2077    also have "\<dots> = (j dvd c*i - c*d + floor ?e)" 
  4.2078      using dvd_period[OF id, where x="c*i" and c="-c" and t="floor ?e"] by simp
  4.2079 -  also have "\<dots> = (real j rdvd real (c*i - c*d + floor ?e))" 
  4.2080 +  also have "\<dots> = (real_of_int j rdvd real_of_int (c*i - c*d + floor ?e))" 
  4.2081      using int_rdvd_iff[where i="j" and t="(c*i - c*d + floor ?e)",symmetric, simplified]
  4.2082        ie by simp
  4.2083 -  also have "\<dots> = (real j rdvd real (c*(i - d)) + ?e)" 
  4.2084 +  also have "\<dots> = (real_of_int j rdvd real_of_int (c*(i - d)) + ?e)" 
  4.2085      using ie by (simp add:algebra_simps)
  4.2086    finally show ?case 
  4.2087 -    using numbound0_I[OF bn,where b="real i - real d" and b'="real i" and bs="bs"] p 
  4.2088 +    using numbound0_I[OF bn,where b="real_of_int i - real_of_int d" and b'="real_of_int i" and bs="bs"] p 
  4.2089      by (simp add: algebra_simps)
  4.2090  next
  4.2091    case (10 j c e)
  4.2092 -  hence p: "\<not> (real j rdvd real (c*i) + ?N i e)" (is "?p x") and cp: "c > 0" and bn:"numbound0 e"
  4.2093 +  hence p: "\<not> (real_of_int j rdvd real_of_int (c*i) + ?N i e)" (is "?p x") and cp: "c > 0" and bn:"numbound0 e"
  4.2094      by simp+
  4.2095 -  let ?e = "Inum (real i # bs) e"
  4.2096 -  from 10 have "isint e (real i #bs)"  by simp 
  4.2097 -  hence ie: "real (floor ?e) = ?e"
  4.2098 -    using isint_iff[where n="e" and bs="(real i)#bs"] numbound0_I[OF bn,where b="real i" and b'="real i" and bs="bs"]
  4.2099 +  let ?e = "Inum (real_of_int i # bs) e"
  4.2100 +  from 10 have "isint e (real_of_int i #bs)"  by simp 
  4.2101 +  hence ie: "real_of_int (floor ?e) = ?e"
  4.2102 +    using isint_iff[where n="e" and bs="(real_of_int i)#bs"] numbound0_I[OF bn,where b="real_of_int i" and b'="real_of_int i" and bs="bs"]
  4.2103      by (simp add: isint_iff)
  4.2104    from 10 have id: "j dvd d" by simp
  4.2105 -  from ie[symmetric] have "?p i = (\<not> (real j rdvd real (c*i+ floor ?e)))" by simp
  4.2106 +  from ie[symmetric] have "?p i = (\<not> (real_of_int j rdvd real_of_int (c*i+ floor ?e)))" by simp
  4.2107    also have "\<dots> = Not (j dvd c*i + floor ?e)" 
  4.2108      using int_rdvd_iff [where i="j" and t="c*i+ floor ?e"] by simp
  4.2109    also have "\<dots> = Not (j dvd c*i - c*d + floor ?e)" 
  4.2110      using dvd_period[OF id, where x="c*i" and c="-c" and t="floor ?e"] by simp
  4.2111 -  also have "\<dots> = Not (real j rdvd real (c*i - c*d + floor ?e))" 
  4.2112 +  also have "\<dots> = Not (real_of_int j rdvd real_of_int (c*i - c*d + floor ?e))" 
  4.2113      using int_rdvd_iff[where i="j" and t="(c*i - c*d + floor ?e)",symmetric, simplified]
  4.2114        ie by simp
  4.2115 -  also have "\<dots> = Not (real j rdvd real (c*(i - d)) + ?e)" 
  4.2116 +  also have "\<dots> = Not (real_of_int j rdvd real_of_int (c*(i - d)) + ?e)" 
  4.2117      using ie by (simp add:algebra_simps)
  4.2118    finally show ?case 
  4.2119 -    using numbound0_I[OF bn,where b="real i - real d" and b'="real i" and bs="bs"] p 
  4.2120 +    using numbound0_I[OF bn,where b="real_of_int i - real_of_int d" and b'="real_of_int i" and bs="bs"] p 
  4.2121      by (simp add: algebra_simps)
  4.2122 -qed (auto simp add: numbound0_I[where bs="bs" and b="real i - real d" and b'="real i"])
  4.2123 +qed (auto simp add: numbound0_I[where bs="bs" and b="real_of_int i - real_of_int d" and b'="real_of_int i"])
  4.2124  
  4.2125  lemma \<sigma>_nb: assumes lp: "iszlfm p (a#bs)" and nb: "numbound0 t"
  4.2126    shows "bound0 (\<sigma> p k t)"
  4.2127 @@ -3209,37 +3185,37 @@
  4.2128  lemma \<rho>':   assumes lp: "iszlfm p (a #bs)"
  4.2129    and d: "d_\<delta> p d"
  4.2130    and dp: "d > 0"
  4.2131 -  shows "\<forall> x. \<not>(\<exists> (e,c) \<in> set(\<rho> p). \<exists>(j::int) \<in> {1 .. c*d}. Ifm (a #bs) (\<sigma> p c (Add e (C j)))) \<longrightarrow> Ifm (real x#bs) p \<longrightarrow> Ifm (real (x - d)#bs) p" (is "\<forall> x. ?b x \<longrightarrow> ?P x \<longrightarrow> ?P (x - d)")
  4.2132 +  shows "\<forall> x. \<not>(\<exists> (e,c) \<in> set(\<rho> p). \<exists>(j::int) \<in> {1 .. c*d}. Ifm (a #bs) (\<sigma> p c (Add e (C j)))) \<longrightarrow> Ifm (real_of_int x#bs) p \<longrightarrow> Ifm (real_of_int (x - d)#bs) p" (is "\<forall> x. ?b x \<longrightarrow> ?P x \<longrightarrow> ?P (x - d)")
  4.2133  proof(clarify)
  4.2134    fix x 
  4.2135    assume nob1:"?b x" and px: "?P x" 
  4.2136 -  from iszlfm_gen[OF lp, rule_format, where y="real x"] have lp': "iszlfm p (real x#bs)".
  4.2137 -  have nob: "\<forall>(e, c)\<in>set (\<rho> p). \<forall>j\<in>{1..c * d}. real (c * x) \<noteq> Inum (real x # bs) e + real j" 
  4.2138 +  from iszlfm_gen[OF lp, rule_format, where y="real_of_int x"] have lp': "iszlfm p (real_of_int x#bs)".
  4.2139 +  have nob: "\<forall>(e, c)\<in>set (\<rho> p). \<forall>j\<in>{1..c * d}. real_of_int (c * x) \<noteq> Inum (real_of_int x # bs) e + real_of_int j" 
  4.2140    proof(clarify)
  4.2141      fix e c j assume ecR: "(e,c) \<in> set (\<rho> p)" and jD: "j\<in> {1 .. c*d}"
  4.2142 -      and cx: "real (c*x) = Inum (real x#bs) e + real j"
  4.2143 -    let ?e = "Inum (real x#bs) e"
  4.2144 +      and cx: "real_of_int (c*x) = Inum (real_of_int x#bs) e + real_of_int j"
  4.2145 +    let ?e = "Inum (real_of_int x#bs) e"
  4.2146      let ?fe = "floor ?e"
  4.2147 -    from \<rho>_l[OF lp'] ecR have ei:"isint e (real x#bs)" and cp:"c>0" and nb:"numbound0 e"
  4.2148 +    from \<rho>_l[OF lp'] ecR have ei:"isint e (real_of_int x#bs)" and cp:"c>0" and nb:"numbound0 e"
  4.2149        by auto
  4.2150      from numbound0_gen [OF nb ei, rule_format,where y="a"] have "isint e (a#bs)" .
  4.2151 -    from cx ei[simplified isint_iff] have "real (c*x) = real (?fe + j)" by simp
  4.2152 -    hence cx: "c*x = ?fe + j" by (simp only: real_of_int_inject)
  4.2153 +    from cx ei[simplified isint_iff] have "real_of_int (c*x) = real_of_int (?fe + j)" by simp
  4.2154 +    hence cx: "c*x = ?fe + j" by (simp only: of_int_eq_iff)
  4.2155      hence cdej:"c dvd ?fe + j" by (simp add: dvd_def) (rule_tac x="x" in exI, simp)
  4.2156 -    hence "real c rdvd real (?fe + j)" by (simp only: int_rdvd_iff)
  4.2157 -    hence rcdej: "real c rdvd ?e + real j" by (simp add: ei[simplified isint_iff])
  4.2158 +    hence "real_of_int c rdvd real_of_int (?fe + j)" by (simp only: int_rdvd_iff)
  4.2159 +    hence rcdej: "real_of_int c rdvd ?e + real_of_int j" by (simp add: ei[simplified isint_iff])
  4.2160      from cx have "(c*x) div c = (?fe + j) div c" by simp
  4.2161      with cp have "x = (?fe + j) div c" by simp
  4.2162      with px have th: "?P ((?fe + j) div c)" by auto
  4.2163 -    from cp have cp': "real c > 0" by simp
  4.2164 -    from cdej have cdej': "c dvd floor (Inum (real x#bs) (Add e (C j)))" by simp
  4.2165 +    from cp have cp': "real_of_int c > 0" by simp
  4.2166 +    from cdej have cdej': "c dvd floor (Inum (real_of_int x#bs) (Add e (C j)))" by simp
  4.2167      from nb have nb': "numbound0 (Add e (C j))" by simp
  4.2168 -    have ji: "isint (C j) (real x#bs)" by (simp add: isint_def)
  4.2169 -    from isint_add[OF ei ji] have ei':"isint (Add e (C j)) (real x#bs)" .
  4.2170 -    from th \<sigma>_\<rho>[where b'="real x", OF lp' cp' nb' ei' cdej',symmetric]
  4.2171 -    have "Ifm (real x#bs) (\<sigma>_\<rho> p (Add e (C j), c))" by simp
  4.2172 -    with rcdej have th: "Ifm (real x#bs) (\<sigma> p c (Add e (C j)))" by (simp add: \<sigma>_def)
  4.2173 -    from th bound0_I[OF \<sigma>_nb[OF lp nb', where k="c"],where bs="bs" and b="real x" and b'="a"]
  4.2174 +    have ji: "isint (C j) (real_of_int x#bs)" by (simp add: isint_def)
  4.2175 +    from isint_add[OF ei ji] have ei':"isint (Add e (C j)) (real_of_int x#bs)" .
  4.2176 +    from th \<sigma>_\<rho>[where b'="real_of_int x", OF lp' cp' nb' ei' cdej',symmetric]
  4.2177 +    have "Ifm (real_of_int x#bs) (\<sigma>_\<rho> p (Add e (C j), c))" by simp
  4.2178 +    with rcdej have th: "Ifm (real_of_int x#bs) (\<sigma> p c (Add e (C j)))" by (simp add: \<sigma>_def)
  4.2179 +    from th bound0_I[OF \<sigma>_nb[OF lp nb', where k="c"],where bs="bs" and b="real_of_int x" and b'="a"]
  4.2180      have "Ifm (a#bs) (\<sigma> p c (Add e (C j)))" by blast
  4.2181        with ecR jD nob1    show "False" by blast
  4.2182    qed
  4.2183 @@ -3248,8 +3224,8 @@
  4.2184  
  4.2185  
  4.2186  lemma rl_thm: 
  4.2187 -  assumes lp: "iszlfm p (real (i::int)#bs)"
  4.2188 -  shows "(\<exists> (x::int). Ifm (real x#bs) p) = ((\<exists> j\<in> {1 .. \<delta> p}. Ifm (real j#bs) (minusinf p)) \<or> (\<exists> (e,c) \<in> set (\<rho> p). \<exists> j\<in> {1 .. c*(\<delta> p)}. Ifm (a#bs) (\<sigma> p c (Add e (C j)))))"
  4.2189 +  assumes lp: "iszlfm p (real_of_int (i::int)#bs)"
  4.2190 +  shows "(\<exists> (x::int). Ifm (real_of_int x#bs) p) = ((\<exists> j\<in> {1 .. \<delta> p}. Ifm (real_of_int j#bs) (minusinf p)) \<or> (\<exists> (e,c) \<in> set (\<rho> p). \<exists> j\<in> {1 .. c*(\<delta> p)}. Ifm (a#bs) (\<sigma> p c (Add e (C j)))))"
  4.2191    (is "(\<exists>(x::int). ?P x) = ((\<exists> j\<in> {1.. \<delta> p}. ?MP j)\<or>(\<exists> (e,c) \<in> ?R. \<exists> j\<in> _. ?SP c e j))" 
  4.2192      is "?lhs = (?MD \<or> ?RD)"  is "?lhs = ?rhs")
  4.2193  proof-
  4.2194 @@ -3259,21 +3235,21 @@
  4.2195      from H minusinf_ex[OF lp th] have ?thesis  by blast}
  4.2196    moreover
  4.2197    { fix e c j assume exR:"(e,c) \<in> ?R" and jD:"j\<in> {1 .. c*?d}" and spx:"?SP c e j"
  4.2198 -    from exR \<rho>_l[OF lp] have nb: "numbound0 e" and ei:"isint e (real i#bs)" and cp: "c > 0"
  4.2199 +    from exR \<rho>_l[OF lp] have nb: "numbound0 e" and ei:"isint e (real_of_int i#bs)" and cp: "c > 0"
  4.2200        by auto
  4.2201 -    have "isint (C j) (real i#bs)" by (simp add: isint_iff)
  4.2202 -    with isint_add[OF numbound0_gen[OF nb ei,rule_format, where y="real i"]]
  4.2203 -    have eji:"isint (Add e (C j)) (real i#bs)" by simp
  4.2204 +    have "isint (C j) (real_of_int i#bs)" by (simp add: isint_iff)
  4.2205 +    with isint_add[OF numbound0_gen[OF nb ei,rule_format, where y="real_of_int i"]]
  4.2206 +    have eji:"isint (Add e (C j)) (real_of_int i#bs)" by simp
  4.2207      from nb have nb': "numbound0 (Add e (C j))" by simp
  4.2208 -    from spx bound0_I[OF \<sigma>_nb[OF lp nb', where k="c"], where bs="bs" and b="a" and b'="real i"]
  4.2209 -    have spx': "Ifm (real i # bs) (\<sigma> p c (Add e (C j)))" by blast
  4.2210 -    from spx' have rcdej:"real c rdvd (Inum (real i#bs) (Add e (C j)))" 
  4.2211 -      and sr:"Ifm (real i#bs) (\<sigma>_\<rho> p (Add e (C j),c))" by (simp add: \<sigma>_def)+
  4.2212 +    from spx bound0_I[OF \<sigma>_nb[OF lp nb', where k="c"], where bs="bs" and b="a" and b'="real_of_int i"]
  4.2213 +    have spx': "Ifm (real_of_int i # bs) (\<sigma> p c (Add e (C j)))" by blast
  4.2214 +    from spx' have rcdej:"real_of_int c rdvd (Inum (real_of_int i#bs) (Add e (C j)))" 
  4.2215 +      and sr:"Ifm (real_of_int i#bs) (\<sigma>_\<rho> p (Add e (C j),c))" by (simp add: \<sigma>_def)+
  4.2216      from rcdej eji[simplified isint_iff] 
  4.2217 -    have "real c rdvd real (floor (Inum (real i#bs) (Add e (C j))))" by simp
  4.2218 -    hence cdej:"c dvd floor (Inum (real i#bs) (Add e (C j)))" by (simp only: int_rdvd_iff)
  4.2219 -    from cp have cp': "real c > 0" by simp
  4.2220 -    from \<sigma>_\<rho>[OF lp cp' nb' eji cdej] spx' have "?P (\<lfloor>Inum (real i # bs) (Add e (C j))\<rfloor> div c)"
  4.2221 +    have "real_of_int c rdvd real_of_int (floor (Inum (real_of_int i#bs) (Add e (C j))))" by simp
  4.2222 +    hence cdej:"c dvd floor (Inum (real_of_int i#bs) (Add e (C j)))" by (simp only: int_rdvd_iff)
  4.2223 +    from cp have cp': "real_of_int c > 0" by simp
  4.2224 +    from \<sigma>_\<rho>[OF lp cp' nb' eji cdej] spx' have "?P (\<lfloor>Inum (real_of_int i # bs) (Add e (C j))\<rfloor> div c)"
  4.2225        by (simp add: \<sigma>_def)
  4.2226      hence ?lhs by blast
  4.2227      with exR jD spx have ?thesis by blast}
  4.2228 @@ -3440,10 +3416,10 @@
  4.2229        let ?l = "floor (?N s') + j"
  4.2230        from H 
  4.2231        have "?I (?p (p',n',s') j) \<longrightarrow> 
  4.2232 -          (((?N ?nxs \<ge> real ?l) \<and> (?N ?nxs < real (?l + 1))) \<and> (?N a = ?N ?nxs ))" 
  4.2233 +          (((?N ?nxs \<ge> real_of_int ?l) \<and> (?N ?nxs < real_of_int (?l + 1))) \<and> (?N a = ?N ?nxs ))" 
  4.2234          by (simp add: fp_def np algebra_simps)
  4.2235        also have "\<dots> \<longrightarrow> ((floor (?N ?nxs) = ?l) \<and> (?N a = ?N ?nxs ))"
  4.2236 -        using floor_int_eq[where x="?N ?nxs" and n="?l"] by simp
  4.2237 +        using floor_unique_iff[where x="?N ?nxs" and a="?l"] by simp
  4.2238        moreover
  4.2239        have "\<dots> \<longrightarrow> (?N (Floor a) = ?N ((Add (Floor s') (C j))))" by simp
  4.2240        ultimately have "?I (?p (p',n',s') j) \<longrightarrow> (?N (Floor a) = ?N ((Add (Floor s') (C j))))"
  4.2241 @@ -3466,10 +3442,10 @@
  4.2242        let ?l = "floor (?N s') + j"
  4.2243        from H 
  4.2244        have "?I (?p (p',n',s') j) \<longrightarrow> 
  4.2245 -          (((?N ?nxs \<ge> real ?l) \<and> (?N ?nxs < real (?l + 1))) \<and> (?N a = ?N ?nxs ))" 
  4.2246 +          (((?N ?nxs \<ge> real_of_int ?l) \<and> (?N ?nxs < real_of_int (?l + 1))) \<and> (?N a = ?N ?nxs ))" 
  4.2247          by (simp add: np fp_def algebra_simps)
  4.2248        also have "\<dots> \<longrightarrow> ((floor (?N ?nxs) = ?l) \<and> (?N a = ?N ?nxs ))"
  4.2249 -        using floor_int_eq[where x="?N ?nxs" and n="?l"] by simp
  4.2250 +        using floor_unique_iff[where x="?N ?nxs" and a="?l"] by simp
  4.2251        moreover
  4.2252        have "\<dots> \<longrightarrow> (?N (Floor a) = ?N ((Add (Floor s') (C j))))"  by simp
  4.2253        ultimately have "?I (?p (p',n',s') j) \<longrightarrow> (?N (Floor a) = ?N ((Add (Floor s') (C j))))"
  4.2254 @@ -3483,10 +3459,11 @@
  4.2255  qed (auto simp add: Let_def split_def algebra_simps)
  4.2256  
  4.2257  lemma real_in_int_intervals: 
  4.2258 -  assumes xb: "real m \<le> x \<and> x < real ((n::int) + 1)"
  4.2259 -  shows "\<exists> j\<in> {m.. n}. real j \<le> x \<and> x < real (j+1)" (is "\<exists> j\<in> ?N. ?P j")
  4.2260 +  assumes xb: "real_of_int m \<le> x \<and> x < real_of_int ((n::int) + 1)"
  4.2261 +  shows "\<exists> j\<in> {m.. n}. real_of_int j \<le> x \<and> x < real_of_int (j+1)" (is "\<exists> j\<in> ?N. ?P j")
  4.2262  by (rule bexI[where P="?P" and x="floor x" and A="?N"]) 
  4.2263 -(auto simp add: floor_less_eq[where x="x" and a="n+1", simplified] xb[simplified] floor_mono[where x="real m" and y="x", OF conjunct1[OF xb], simplified floor_real_of_int[where n="m"]])
  4.2264 +(auto simp add: floor_less_iff[where x="x" and z="n+1", simplified] 
  4.2265 +  xb[simplified] floor_mono[where x="real_of_int m" and y="x", OF conjunct1[OF xb], simplified floor_of_int[where z="m"]])
  4.2266  
  4.2267  lemma rsplit0_complete:
  4.2268    assumes xp:"0 \<le> x" and x1:"x < 1"
  4.2269 @@ -3571,20 +3548,20 @@
  4.2270    moreover
  4.2271    {
  4.2272      assume np: "n > 0"
  4.2273 -    from real_of_int_floor_le[where r="?N s"] have "?N (Floor s) \<le> ?N s" by simp
  4.2274 -    also from mult_left_mono[OF xp] np have "?N s \<le> real n * x + ?N s" by simp
  4.2275 -    finally have "?N (Floor s) \<le> real n * x + ?N s" .
  4.2276 +    from of_int_floor_le[of "?N s"] have "?N (Floor s) \<le> ?N s" by simp
  4.2277 +    also from mult_left_mono[OF xp] np have "?N s \<le> real_of_int n * x + ?N s" by simp
  4.2278 +    finally have "?N (Floor s) \<le> real_of_int n * x + ?N s" .
  4.2279      moreover
  4.2280 -    {from x1 np have "real n *x + ?N s < real n + ?N s" by simp
  4.2281 +    {from x1 np have "real_of_int n *x + ?N s < real_of_int n + ?N s" by simp
  4.2282        also from real_of_int_floor_add_one_gt[where r="?N s"] 
  4.2283 -      have "\<dots> < real n + ?N (Floor s) + 1" by simp
  4.2284 -      finally have "real n *x + ?N s < ?N (Floor s) + real (n+1)" by simp}
  4.2285 -    ultimately have "?N (Floor s) \<le> real n *x + ?N s\<and> real n *x + ?N s < ?N (Floor s) + real (n+1)" by simp
  4.2286 -    hence th: "0 \<le> real n *x + ?N s - ?N (Floor s) \<and> real n *x + ?N s - ?N (Floor s) < real (n+1)" by simp
  4.2287 -    from real_in_int_intervals th have  "\<exists> j\<in> {0 .. n}. real j \<le> real n *x + ?N s - ?N (Floor s)\<and> real n *x + ?N s - ?N (Floor s) < real (j+1)" by simp
  4.2288 +      have "\<dots> < real_of_int n + ?N (Floor s) + 1" by simp
  4.2289 +      finally have "real_of_int n *x + ?N s < ?N (Floor s) + real_of_int (n+1)" by simp}
  4.2290 +    ultimately have "?N (Floor s) \<le> real_of_int n *x + ?N s\<and> real_of_int n *x + ?N s < ?N (Floor s) + real_of_int (n+1)" by simp
  4.2291 +    hence th: "0 \<le> real_of_int n *x + ?N s - ?N (Floor s) \<and> real_of_int n *x + ?N s - ?N (Floor s) < real_of_int (n+1)" by simp
  4.2292 +    from real_in_int_intervals th have  "\<exists> j\<in> {0 .. n}. real_of_int j \<le> real_of_int n *x + ?N s - ?N (Floor s)\<and> real_of_int n *x + ?N s - ?N (Floor s) < real_of_int (j+1)" by simp
  4.2293      
  4.2294 -    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"
  4.2295 -      by(simp only: myle[of _ "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)"]) 
  4.2296 +    hence "\<exists> j\<in> {0 .. n}. 0 \<le> real_of_int n *x + ?N s - ?N (Floor s) - real_of_int j \<and> real_of_int n *x + ?N s - ?N (Floor s) - real_of_int (j+1) < 0"
  4.2297 +      by(simp only: myle[of _ "real_of_int n * x + Inum (x # bs) s - Inum (x # bs) (Floor s)"] less_iff_diff_less_0[where a="real_of_int n *x + ?N s - ?N (Floor s)"]) 
  4.2298      hence "\<exists> j\<in> {0.. n}. ?I (?p (p,n,s) j)"
  4.2299        using pns by (simp add: fp_def np algebra_simps)
  4.2300      then obtain "j" where j_def: "j\<in> {0 .. n} \<and> ?I (?p (p,n,s) j)" by blast
  4.2301 @@ -3596,23 +3573,23 @@
  4.2302    }
  4.2303    moreover
  4.2304    { assume nn: "n < 0" hence np: "-n >0" by simp
  4.2305 -    from real_of_int_floor_le[where r="?N s"] have "?N (Floor s) + 1 > ?N s" by simp
  4.2306 -    moreover from mult_left_mono_neg[OF xp] nn have "?N s \<ge> real n * x + ?N s" by simp
  4.2307 -    ultimately have "?N (Floor s) + 1 > real n * x + ?N s" by arith 
  4.2308 +    from of_int_floor_le[of "?N s"] have "?N (Floor s) + 1 > ?N s" by simp
  4.2309 +    moreover from mult_left_mono_neg[OF xp] nn have "?N s \<ge> real_of_int n * x + ?N s" by simp
  4.2310 +    ultimately have "?N (Floor s) + 1 > real_of_int n * x + ?N s" by arith 
  4.2311      moreover
  4.2312 -    {from x1 nn have "real n *x + ?N s \<ge> real n + ?N s" by simp
  4.2313 -      moreover from real_of_int_floor_le[where r="?N s"]  have "real n + ?N s \<ge> real n + ?N (Floor s)" by simp
  4.2314 -      ultimately have "real n *x + ?N s \<ge> ?N (Floor s) + real n" 
  4.2315 +    {from x1 nn have "real_of_int n *x + ?N s \<ge> real_of_int n + ?N s" by simp
  4.2316 +      moreover from of_int_floor_le[of "?N s"]  have "real_of_int n + ?N s \<ge> real_of_int n + ?N (Floor s)" by simp
  4.2317 +      ultimately have "real_of_int n *x + ?N s \<ge> ?N (Floor s) + real_of_int n" 
  4.2318          by (simp only: algebra_simps)}
  4.2319 -    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
  4.2320 -    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
  4.2321 +    ultimately have "?N (Floor s) + real_of_int n \<le> real_of_int n *x + ?N s\<and> real_of_int n *x + ?N s < ?N (Floor s) + real_of_int (1::int)" by simp
  4.2322 +    hence th: "real_of_int n \<le> real_of_int n *x + ?N s - ?N (Floor s) \<and> real_of_int n *x + ?N s - ?N (Floor s) < real_of_int (1::int)" by simp
  4.2323      have th1: "\<forall> (a::real). (- a > 0) = (a < 0)" by auto
  4.2324      have th2: "\<forall> (a::real). (0 \<ge> - a) = (a \<ge> 0)" by auto
  4.2325 -    from real_in_int_intervals th  have  "\<exists> j\<in> {n .. 0}. real j \<le> real n *x + ?N s - ?N (Floor s)\<and> real n *x + ?N s - ?N (Floor s) < real (j+1)" by simp
  4.2326 +    from real_in_int_intervals th  have  "\<exists> j\<in> {n .. 0}. real_of_int j \<le> real_of_int n *x + ?N s - ?N (Floor s)\<and> real_of_int n *x + ?N s - ?N (Floor s) < real_of_int (j+1)" by simp
  4.2327      
  4.2328 -    hence "\<exists> j\<in> {n .. 0}. 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"
  4.2329 -      by(simp only: myle[of _ "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)"]) 
  4.2330 -    hence "\<exists> j\<in> {n .. 0}. 0 \<ge> - (real n *x + ?N s - ?N (Floor s) - real j) \<and> - (real n *x + ?N s - ?N (Floor s) - real (j+1)) > 0" by (simp only: th1[rule_format] th2[rule_format])
  4.2331 +    hence "\<exists> j\<in> {n .. 0}. 0 \<le> real_of_int n *x + ?N s - ?N (Floor s) - real_of_int j \<and> real_of_int n *x + ?N s - ?N (Floor s) - real_of_int (j+1) < 0"
  4.2332 +      by(simp only: myle[of _ "real_of_int n * x + Inum (x # bs) s - Inum (x # bs) (Floor s)"] less_iff_diff_less_0[where a="real_of_int n *x + ?N s - ?N (Floor s)"]) 
  4.2333 +    hence "\<exists> j\<in> {n .. 0}. 0 \<ge> - (real_of_int n *x + ?N s - ?N (Floor s) - real_of_int j) \<and> - (real_of_int n *x + ?N s - ?N (Floor s) - real_of_int (j+1)) > 0" by (simp only: th1[rule_format] th2[rule_format])
  4.2334      hence "\<exists> j\<in> {n.. 0}. ?I (?p (p,n,s) j)"
  4.2335        using pns by (simp add: fp_def nn algebra_simps
  4.2336          del: diff_less_0_iff_less diff_le_0_iff_le) 
  4.2337 @@ -3773,37 +3750,37 @@
  4.2338  
  4.2339  lemma small_le: 
  4.2340    assumes u0:"0 \<le> u" and u1: "u < 1"
  4.2341 -  shows "(-u \<le> real (n::int)) = (0 \<le> n)"
  4.2342 +  shows "(-u \<le> real_of_int (n::int)) = (0 \<le> n)"
  4.2343  using u0 u1  by auto
  4.2344  
  4.2345  lemma small_lt: 
  4.2346    assumes u0:"0 \<le> u" and u1: "u < 1"
  4.2347 -  shows "(real (n::int) < real (m::int) - u) = (n < m)"
  4.2348 +  shows "(real_of_int (n::int) < real_of_int (m::int) - u) = (n < m)"
  4.2349  using u0 u1  by auto
  4.2350  
  4.2351  lemma rdvd01_cs: 
  4.2352 -  assumes up: "u \<ge> 0" and u1: "u<1" and np: "real n > 0"
  4.2353 -  shows "(real (i::int) rdvd real (n::int) * u - s) = (\<exists> j\<in> {0 .. n - 1}. real n * u = s - real (floor s) + real j \<and> real i rdvd real (j - floor s))" (is "?lhs = ?rhs")
  4.2354 +  assumes up: "u \<ge> 0" and u1: "u<1" and np: "real_of_int n > 0"
  4.2355 +  shows "(real_of_int (i::int) rdvd real_of_int (n::int) * u - s) = (\<exists> j\<in> {0 .. n - 1}. real_of_int n * u = s - real_of_int (floor s) + real_of_int j \<and> real_of_int i rdvd real_of_int (j - floor s))" (is "?lhs = ?rhs")
  4.2356  proof-
  4.2357 -  let ?ss = "s - real (floor s)"
  4.2358 +  let ?ss = "s - real_of_int (floor s)"
  4.2359    from real_of_int_floor_add_one_gt[where r="s", simplified myless[of "s"]] 
  4.2360 -    real_of_int_floor_le[where r="s"]  have ss0:"?ss \<ge> 0" and ss1:"?ss < 1" 
  4.2361 +    of_int_floor_le  have ss0:"?ss \<ge> 0" and ss1:"?ss < 1" 
  4.2362      by (auto simp add: myle[of _ "s", symmetric] myless[of "?ss"])
  4.2363 -  from np have n0: "real n \<ge> 0" by simp
  4.2364 +  from np have n0: "real_of_int n \<ge> 0" by simp
  4.2365    from mult_left_mono[OF up n0] mult_strict_left_mono[OF u1 np] 
  4.2366 -  have nu0:"real n * u - s \<ge> -s" and nun:"real n * u -s < real n - s" by auto  
  4.2367 -  from int_rdvd_real[where i="i" and x="real (n::int) * u - s"] 
  4.2368 -  have "real i rdvd real n * u - s = 
  4.2369 -    (i dvd floor (real n * u -s) \<and> (real (floor (real n * u - s)) = real n * u - s ))" 
  4.2370 +  have nu0:"real_of_int n * u - s \<ge> -s" and nun:"real_of_int n * u -s < real_of_int n - s" by auto  
  4.2371 +  from int_rdvd_real[where i="i" and x="real_of_int (n::int) * u - s"] 
  4.2372 +  have "real_of_int i rdvd real_of_int n * u - s = 
  4.2373 +    (i dvd floor (real_of_int n * u -s) \<and> (real_of_int (floor (real_of_int n * u - s)) = real_of_int n * u - s ))" 
  4.2374      (is "_ = (?DE)" is "_ = (?D \<and> ?E)") by simp
  4.2375 -  also have "\<dots> = (?DE \<and> real(floor (real n * u - s) + floor s)\<ge> -?ss 
  4.2376 -    \<and> real(floor (real n * u - s) + floor s)< real n - ?ss)" (is "_=(?DE \<and>real ?a \<ge> _ \<and> real ?a < _)")
  4.2377 +  also have "\<dots> = (?DE \<and> real_of_int(floor (real_of_int n * u - s) + floor s)\<ge> -?ss 
  4.2378 +    \<and> real_of_int(floor (real_of_int n * u - s) + floor s)< real_of_int n - ?ss)" (is "_=(?DE \<and>real_of_int ?a \<ge> _ \<and> real_of_int ?a < _)")
  4.2379      using nu0 nun  by auto
  4.2380    also have "\<dots> = (?DE \<and> ?a \<ge> 0 \<and> ?a < n)" by(simp only: small_le[OF ss0 ss1] small_lt[OF ss0 ss1])
  4.2381    also have "\<dots> = (?DE \<and> (\<exists> j\<in> {0 .. (n - 1)}. ?a = j))" by simp
  4.2382 -  also have "\<dots> = (?DE \<and> (\<exists> j\<in> {0 .. (n - 1)}. real (\<lfloor>real n * u - s\<rfloor>) = real j - real \<lfloor>s\<rfloor> ))"
  4.2383 -    by (simp only: algebra_simps real_of_int_diff[symmetric] real_of_int_inject)
  4.2384 -  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>"]
  4.2385 +  also have "\<dots> = (?DE \<and> (\<exists> j\<in> {0 .. (n - 1)}. real_of_int (\<lfloor>real_of_int n * u - s\<rfloor>) = real_of_int j - real_of_int \<lfloor>s\<rfloor> ))"
  4.2386 +    by (simp only: algebra_simps of_int_diff[symmetric] of_int_eq_iff)
  4.2387 +  also have "\<dots> = ((\<exists> j\<in> {0 .. (n - 1)}. real_of_int n * u - s = real_of_int j - real_of_int \<lfloor>s\<rfloor> \<and> real_of_int i rdvd real_of_int n * u - s))" using int_rdvd_iff[where i="i" and t="\<lfloor>real_of_int n * u - s\<rfloor>"]
  4.2388      by (auto cong: conj_cong)
  4.2389    also have "\<dots> = ?rhs" by(simp cong: conj_cong) (simp add: algebra_simps )
  4.2390    finally show ?thesis .
  4.2391 @@ -3820,7 +3797,7 @@
  4.2392    NDVDJ_def: "NDVDJ i n s = (foldr conj (map (\<lambda> j. disj (NEq (CN 0 n (Add s (Sub (Floor (Neg s)) (C j))))) (NDvd i (Sub (C j) (Floor (Neg s))))) [0..n - 1]) T)"
  4.2393  
  4.2394  lemma DVDJ_DVD: 
  4.2395 -  assumes xp:"x\<ge> 0" and x1: "x < 1" and np:"real n > 0"
  4.2396 +  assumes xp:"x\<ge> 0" and x1: "x < 1" and np:"real_of_int n > 0"
  4.2397    shows "Ifm (x#bs) (DVDJ i n s) = Ifm (x#bs) (Dvd i (CN 0 n s))"
  4.2398  proof-
  4.2399    let ?f = "\<lambda> j. conj (Eq(CN 0 n (Add s (Sub(Floor (Neg s)) (C j))))) (Dvd i (Sub (C j) (Floor (Neg s))))"
  4.2400 @@ -3828,15 +3805,15 @@
  4.2401    from foldr_disj_map[where xs="[0..n - 1]" and bs="x#bs" and f="?f"]
  4.2402    have "Ifm (x#bs) (DVDJ i n s) = (\<exists> j\<in> {0 .. (n - 1)}. Ifm (x#bs) (?f j))" 
  4.2403      by (simp add: np DVDJ_def)
  4.2404 -  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)))"
  4.2405 +  also have "\<dots> = (\<exists> j\<in> {0 .. (n - 1)}. real_of_int n * x = (- ?s) - real_of_int (floor (- ?s)) + real_of_int j \<and> real_of_int i rdvd real_of_int (j - floor (- ?s)))"
  4.2406      by (simp add: algebra_simps)
  4.2407    also from rdvd01_cs[OF xp x1 np, where i="i" and s="-?s"] 
  4.2408 -  have "\<dots> = (real i rdvd real n * x - (-?s))" by simp
  4.2409 +  have "\<dots> = (real_of_int i rdvd real_of_int n * x - (-?s))" by simp
  4.2410    finally show ?thesis by simp
  4.2411  qed
  4.2412  
  4.2413  lemma NDVDJ_NDVD: 
  4.2414 -  assumes xp:"x\<ge> 0" and x1: "x < 1" and np:"real n > 0"
  4.2415 +  assumes xp:"x\<ge> 0" and x1: "x < 1" and np:"real_of_int n > 0"
  4.2416    shows "Ifm (x#bs) (NDVDJ i n s) = Ifm (x#bs) (NDvd i (CN 0 n s))"
  4.2417  proof-
  4.2418    let ?f = "\<lambda> j. disj(NEq(CN 0 n (Add s (Sub (Floor (Neg s)) (C j))))) (NDvd i (Sub (C j) (Floor(Neg s))))"
  4.2419 @@ -3844,10 +3821,10 @@
  4.2420    from foldr_conj_map[where xs="[0..n - 1]" and bs="x#bs" and f="?f"]
  4.2421    have "Ifm (x#bs) (NDVDJ i n s) = (\<forall> j\<in> {0 .. (n - 1)}. Ifm (x#bs) (?f j))" 
  4.2422      by (simp add: np NDVDJ_def)
  4.2423 -  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))))"
  4.2424 +  also have "\<dots> = (\<not> (\<exists> j\<in> {0 .. (n - 1)}. real_of_int n * x = (- ?s) - real_of_int (floor (- ?s)) + real_of_int j \<and> real_of_int i rdvd real_of_int (j - floor (- ?s))))"
  4.2425      by (simp add: algebra_simps)
  4.2426    also from rdvd01_cs[OF xp x1 np, where i="i" and s="-?s"] 
  4.2427 -  have "\<dots> = (\<not> (real i rdvd real n * x - (-?s)))" by simp
  4.2428 +  have "\<dots> = (\<not> (real_of_int i rdvd real_of_int n * x - (-?s)))" by simp
  4.2429    finally show ?thesis by simp
  4.2430  qed  
  4.2431  
  4.2432 @@ -3902,7 +3879,7 @@
  4.2433    moreover {assume inz: "i\<noteq>0" and "n=0" hence ?th by (simp add: H DVD_def) } 
  4.2434    moreover {assume inz: "i\<noteq>0" and "n<0" hence ?th 
  4.2435        by (simp add: DVD_def H DVDJ_DVD[OF xp x1] rdvd_abs1 
  4.2436 -        rdvd_minus[where d="i" and t="real n * x + Inum (x # bs) s"]) } 
  4.2437 +        rdvd_minus[where d="i" and t="real_of_int n * x + Inum (x # bs) s"]) } 
  4.2438    moreover {assume inz: "i\<noteq>0" and "n>0" hence ?th by (simp add:DVD_def H DVDJ_DVD[OF xp x1] rdvd_abs1)}
  4.2439    ultimately show ?th by blast
  4.2440  qed
  4.2441 @@ -3920,7 +3897,7 @@
  4.2442    moreover {assume inz: "i\<noteq>0" and "n=0" hence ?th by (simp add: H NDVD_def) } 
  4.2443    moreover {assume inz: "i\<noteq>0" and "n<0" hence ?th 
  4.2444        by (simp add: NDVD_def H NDVDJ_NDVD[OF xp x1] rdvd_abs1 
  4.2445 -        rdvd_minus[where d="i" and t="real n * x + Inum (x # bs) s"]) } 
  4.2446 +        rdvd_minus[where d="i" and t="real_of_int n * x + Inum (x # bs) s"]) } 
  4.2447    moreover {assume inz: "i\<noteq>0" and "n>0" hence ?th 
  4.2448        by (simp add:NDVD_def H NDVDJ_NDVD[OF xp x1] rdvd_abs1)}
  4.2449    ultimately show ?th by blast
  4.2450 @@ -4152,16 +4129,16 @@
  4.2451  next
  4.2452    case (3 c e) 
  4.2453    from 3 have nb: "numbound0 e" by simp
  4.2454 -  from 3 have cp: "real c > 0" by simp
  4.2455 +  from 3 have cp: "real_of_int c > 0" by simp
  4.2456    fix a
  4.2457    let ?e="Inum (a#bs) e"
  4.2458 -  let ?z = "(- ?e) / real c"
  4.2459 +  let ?z = "(- ?e) / real_of_int c"
  4.2460    {fix x
  4.2461      assume xz: "x < ?z"
  4.2462 -    hence "(real c * x < - ?e)" 
  4.2463 +    hence "(real_of_int c * x < - ?e)" 
  4.2464        by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps) 
  4.2465 -    hence "real c * x + ?e < 0" by arith
  4.2466 -    hence "real c * x + ?e \<noteq> 0" by simp
  4.2467 +    hence "real_of_int c * x + ?e < 0" by arith
  4.2468 +    hence "real_of_int c * x + ?e \<noteq> 0" by simp
  4.2469      with xz have "?P ?z x (Eq (CN 0 c e))"
  4.2470        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp  }
  4.2471    hence "\<forall> x < ?z. ?P ?z x (Eq (CN 0 c e))" by simp
  4.2472 @@ -4169,16 +4146,16 @@
  4.2473  next
  4.2474    case (4 c e)   
  4.2475    from 4 have nb: "numbound0 e" by simp
  4.2476 -  from 4 have cp: "real c > 0" by simp
  4.2477 +  from 4 have cp: "real_of_int c > 0" by simp
  4.2478    fix a
  4.2479    let ?e="Inum (a#bs) e"
  4.2480 -  let ?z = "(- ?e) / real c"
  4.2481 +  let ?z = "(- ?e) / real_of_int c"
  4.2482    {fix x
  4.2483      assume xz: "x < ?z"
  4.2484 -    hence "(real c * x < - ?e)" 
  4.2485 +    hence "(real_of_int c * x < - ?e)" 
  4.2486        by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps) 
  4.2487 -    hence "real c * x + ?e < 0" by arith
  4.2488 -    hence "real c * x + ?e \<noteq> 0" by simp
  4.2489 +    hence "real_of_int c * x + ?e < 0" by arith
  4.2490 +    hence "real_of_int c * x + ?e \<noteq> 0" by simp
  4.2491      with xz have "?P ?z x (NEq (CN 0 c e))"
  4.2492        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp }
  4.2493    hence "\<forall> x < ?z. ?P ?z x (NEq (CN 0 c e))" by simp
  4.2494 @@ -4186,15 +4163,15 @@
  4.2495  next
  4.2496    case (5 c e) 
  4.2497    from 5 have nb: "numbound0 e" by simp
  4.2498 -  from 5 have cp: "real c > 0" by simp
  4.2499 +  from 5 have cp: "real_of_int c > 0" by simp
  4.2500    fix a
  4.2501    let ?e="Inum (a#bs) e"
  4.2502 -  let ?z = "(- ?e) / real c"
  4.2503 +  let ?z = "(- ?e) / real_of_int c"
  4.2504    {fix x
  4.2505      assume xz: "x < ?z"
  4.2506 -    hence "(real c * x < - ?e)" 
  4.2507 +    hence "(real_of_int c * x < - ?e)" 
  4.2508        by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps) 
  4.2509 -    hence "real c * x + ?e < 0" by arith
  4.2510 +    hence "real_of_int c * x + ?e < 0" by arith
  4.2511      with xz have "?P ?z x (Lt (CN 0 c e))"
  4.2512        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"]  by simp }
  4.2513    hence "\<forall> x < ?z. ?P ?z x (Lt (CN 0 c e))" by simp
  4.2514 @@ -4202,15 +4179,15 @@
  4.2515  next
  4.2516    case (6 c e)  
  4.2517    from 6 have nb: "numbound0 e" by simp
  4.2518 -  from 6 have cp: "real c > 0" by simp
  4.2519 +  from 6 have cp: "real_of_int c > 0" by simp
  4.2520    fix a
  4.2521    let ?e="Inum (a#bs) e"
  4.2522 -  let ?z = "(- ?e) / real c"
  4.2523 +  let ?z = "(- ?e) / real_of_int c"
  4.2524    {fix x
  4.2525      assume xz: "x < ?z"
  4.2526 -    hence "(real c * x < - ?e)" 
  4.2527 +    hence "(real_of_int c * x < - ?e)" 
  4.2528        by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps) 
  4.2529 -    hence "real c * x + ?e < 0" by arith
  4.2530 +    hence "real_of_int c * x + ?e < 0" by arith
  4.2531      with xz have "?P ?z x (Le (CN 0 c e))"
  4.2532        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp }
  4.2533    hence "\<forall> x < ?z. ?P ?z x (Le (CN 0 c e))" by simp
  4.2534 @@ -4218,15 +4195,15 @@
  4.2535  next
  4.2536    case (7 c e)  
  4.2537    from 7 have nb: "numbound0 e" by simp
  4.2538 -  from 7 have cp: "real c > 0" by simp
  4.2539 +  from 7 have cp: "real_of_int c > 0" by simp
  4.2540    fix a
  4.2541    let ?e="Inum (a#bs) e"
  4.2542 -  let ?z = "(- ?e) / real c"
  4.2543 +  let ?z = "(- ?e) / real_of_int c"
  4.2544    {fix x
  4.2545      assume xz: "x < ?z"
  4.2546 -    hence "(real c * x < - ?e)" 
  4.2547 +    hence "(real_of_int c * x < - ?e)" 
  4.2548        by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps) 
  4.2549 -    hence "real c * x + ?e < 0" by arith
  4.2550 +    hence "real_of_int c * x + ?e < 0" by arith
  4.2551      with xz have "?P ?z x (Gt (CN 0 c e))"
  4.2552        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp }
  4.2553    hence "\<forall> x < ?z. ?P ?z x (Gt (CN 0 c e))" by simp
  4.2554 @@ -4234,15 +4211,15 @@
  4.2555  next
  4.2556    case (8 c e)  
  4.2557    from 8 have nb: "numbound0 e" by simp
  4.2558 -  from 8 have cp: "real c > 0" by simp
  4.2559 +  from 8 have cp: "real_of_int c > 0" by simp
  4.2560    fix a
  4.2561    let ?e="Inum (a#bs) e"
  4.2562 -  let ?z = "(- ?e) / real c"
  4.2563 +  let ?z = "(- ?e) / real_of_int c"
  4.2564    {fix x
  4.2565      assume xz: "x < ?z"
  4.2566 -    hence "(real c * x < - ?e)" 
  4.2567 +    hence "(real_of_int c * x < - ?e)" 
  4.2568        by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps) 
  4.2569 -    hence "real c * x + ?e < 0" by arith
  4.2570 +    hence "real_of_int c * x + ?e < 0" by arith
  4.2571      with xz have "?P ?z x (Ge (CN 0 c e))"
  4.2572        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp }
  4.2573    hence "\<forall> x < ?z. ?P ?z x (Ge (CN 0 c e))" by simp
  4.2574 @@ -4260,16 +4237,16 @@
  4.2575  next
  4.2576    case (3 c e) 
  4.2577    from 3 have nb: "numbound0 e" by simp
  4.2578 -  from 3 have cp: "real c > 0" by simp
  4.2579 +  from 3 have cp: "real_of_int c > 0" by simp
  4.2580    fix a
  4.2581    let ?e="Inum (a#bs) e"
  4.2582 -  let ?z = "(- ?e) / real c"
  4.2583 +  let ?z = "(- ?e) / real_of_int c"
  4.2584    {fix x
  4.2585      assume xz: "x > ?z"
  4.2586      with mult_strict_right_mono [OF xz cp] cp
  4.2587 -    have "(real c * x > - ?e)" by (simp add: ac_simps)
  4.2588 -    hence "real c * x + ?e > 0" by arith
  4.2589 -    hence "real c * x + ?e \<noteq> 0" by simp
  4.2590 +    have "(real_of_int c * x > - ?e)" by (simp add: ac_simps)
  4.2591 +    hence "real_of_int c * x + ?e > 0" by arith
  4.2592 +    hence "real_of_int c * x + ?e \<noteq> 0" by simp
  4.2593      with xz have "?P ?z x (Eq (CN 0 c e))"
  4.2594        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp }
  4.2595    hence "\<forall> x > ?z. ?P ?z x (Eq (CN 0 c e))" by simp
  4.2596 @@ -4277,16 +4254,16 @@
  4.2597  next
  4.2598    case (4 c e) 
  4.2599    from 4 have nb: "numbound0 e" by simp
  4.2600 -  from 4 have cp: "real c > 0" by simp
  4.2601 +  from 4 have cp: "real_of_int c > 0" by simp
  4.2602    fix a
  4.2603    let ?e="Inum (a#bs) e"
  4.2604 -  let ?z = "(- ?e) / real c"
  4.2605 +  let ?z = "(- ?e) / real_of_int c"
  4.2606    {fix x
  4.2607      assume xz: "x > ?z"
  4.2608      with mult_strict_right_mono [OF xz cp] cp
  4.2609 -    have "(real c * x > - ?e)" by (simp add: ac_simps)
  4.2610 -    hence "real c * x + ?e > 0" by arith
  4.2611 -    hence "real c * x + ?e \<noteq> 0" by simp
  4.2612 +    have "(real_of_int c * x > - ?e)" by (simp add: ac_simps)
  4.2613 +    hence "real_of_int c * x + ?e > 0" by arith
  4.2614 +    hence "real_of_int c * x + ?e \<noteq> 0" by simp
  4.2615      with xz have "?P ?z x (NEq (CN 0 c e))"
  4.2616        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp }
  4.2617    hence "\<forall> x > ?z. ?P ?z x (NEq (CN 0 c e))" by simp
  4.2618 @@ -4294,15 +4271,15 @@
  4.2619  next
  4.2620    case (5 c e) 
  4.2621    from 5 have nb: "numbound0 e" by simp
  4.2622 -  from 5 have cp: "real c > 0" by simp
  4.2623 +  from 5 have cp: "real_of_int c > 0" by simp
  4.2624    fix a
  4.2625    let ?e="Inum (a#bs) e"
  4.2626 -  let ?z = "(- ?e) / real c"
  4.2627 +  let ?z = "(- ?e) / real_of_int c"
  4.2628    {fix x
  4.2629      assume xz: "x > ?z"
  4.2630      with mult_strict_right_mono [OF xz cp] cp
  4.2631 -    have "(real c * x > - ?e)" by (simp add: ac_simps)
  4.2632 -    hence "real c * x + ?e > 0" by arith
  4.2633 +    have "(real_of_int c * x > - ?e)" by (simp add: ac_simps)
  4.2634 +    hence "real_of_int c * x + ?e > 0" by arith
  4.2635      with xz have "?P ?z x (Lt (CN 0 c e))"
  4.2636        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp }
  4.2637    hence "\<forall> x > ?z. ?P ?z x (Lt (CN 0 c e))" by simp
  4.2638 @@ -4310,15 +4287,15 @@
  4.2639  next
  4.2640    case (6 c e) 
  4.2641    from 6 have nb: "numbound0 e" by simp
  4.2642 -  from 6 have cp: "real c > 0" by simp
  4.2643 +  from 6 have cp: "real_of_int c > 0" by simp
  4.2644    fix a
  4.2645    let ?e="Inum (a#bs) e"
  4.2646 -  let ?z = "(- ?e) / real c"
  4.2647 +  let ?z = "(- ?e) / real_of_int c"
  4.2648    {fix x
  4.2649      assume xz: "x > ?z"
  4.2650      with mult_strict_right_mono [OF xz cp] cp
  4.2651 -    have "(real c * x > - ?e)" by (simp add: ac_simps)
  4.2652 -    hence "real c * x + ?e > 0" by arith
  4.2653 +    have "(real_of_int c * x > - ?e)" by (simp add: ac_simps)
  4.2654 +    hence "real_of_int c * x + ?e > 0" by arith
  4.2655      with xz have "?P ?z x (Le (CN 0 c e))"
  4.2656        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp }
  4.2657    hence "\<forall> x > ?z. ?P ?z x (Le (CN 0 c e))" by simp
  4.2658 @@ -4326,15 +4303,15 @@
  4.2659  next
  4.2660    case (7 c e) 
  4.2661    from 7 have nb: "numbound0 e" by simp
  4.2662 -  from 7 have cp: "real c > 0" by simp
  4.2663 +  from 7 have cp: "real_of_int c > 0" by simp
  4.2664    fix a
  4.2665    let ?e="Inum (a#bs) e"
  4.2666 -  let ?z = "(- ?e) / real c"
  4.2667 +  let ?z = "(- ?e) / real_of_int c"
  4.2668    {fix x
  4.2669      assume xz: "x > ?z"
  4.2670      with mult_strict_right_mono [OF xz cp] cp
  4.2671 -    have "(real c * x > - ?e)" by (simp add: ac_simps)
  4.2672 -    hence "real c * x + ?e > 0" by arith
  4.2673 +    have "(real_of_int c * x > - ?e)" by (simp add: ac_simps)
  4.2674 +    hence "real_of_int c * x + ?e > 0" by arith
  4.2675      with xz have "?P ?z x (Gt (CN 0 c e))"
  4.2676        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp }
  4.2677    hence "\<forall> x > ?z. ?P ?z x (Gt (CN 0 c e))" by simp
  4.2678 @@ -4342,15 +4319,15 @@
  4.2679  next
  4.2680    case (8 c e) 
  4.2681    from 8 have nb: "numbound0 e" by simp
  4.2682 -  from 8 have cp: "real c > 0" by simp
  4.2683 +  from 8 have cp: "real_of_int c > 0" by simp
  4.2684    fix a
  4.2685    let ?e="Inum (a#bs) e"
  4.2686 -  let ?z = "(- ?e) / real c"
  4.2687 +  let ?z = "(- ?e) / real_of_int c"
  4.2688    {fix x
  4.2689      assume xz: "x > ?z"
  4.2690      with mult_strict_right_mono [OF xz cp] cp
  4.2691 -    have "(real c * x > - ?e)" by (simp add: ac_simps)
  4.2692 -    hence "real c * x + ?e > 0" by arith
  4.2693 +    have "(real_of_int c * x > - ?e)" by (simp add: ac_simps)
  4.2694 +    hence "real_of_int c * x + ?e > 0" by arith
  4.2695      with xz have "?P ?z x (Ge (CN 0 c e))"
  4.2696        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"]   by simp }
  4.2697    hence "\<forall> x > ?z. ?P ?z x (Ge (CN 0 c e))" by simp
  4.2698 @@ -4423,78 +4400,78 @@
  4.2699    "\<upsilon> p = (\<lambda> (t,n). p)"
  4.2700  
  4.2701  lemma \<upsilon>_I: assumes lp: "isrlfm p"
  4.2702 -  and np: "real n > 0" and nbt: "numbound0 t"
  4.2703 -  shows "(Ifm (x#bs) (\<upsilon> p (t,n)) = Ifm (((Inum (x#bs) t)/(real n))#bs) p) \<and> bound0 (\<upsilon> p (t,n))" (is "(?I x (\<upsilon> p (t,n)) = ?I ?u p) \<and> ?B p" is "(_ = ?I (?t/?n) p) \<and> _" is "(_ = ?I (?N x t /_) p) \<and> _")
  4.2704 +  and np: "real_of_int n > 0" and nbt: "numbound0 t"
  4.2705 +  shows "(Ifm (x#bs) (\<upsilon> p (t,n)) = Ifm (((Inum (x#bs) t)/(real_of_int n))#bs) p) \<and> bound0 (\<upsilon> p (t,n))" (is "(?I x (\<upsilon> p (t,n)) = ?I ?u p) \<and> ?B p" is "(_ = ?I (?t/?n) p) \<and> _" is "(_ = ?I (?N x t /_) p) \<and> _")
  4.2706    using lp
  4.2707  proof(induct p rule: \<upsilon>.induct)
  4.2708    case (5 c e)
  4.2709    from 5 have cp: "c >0" and nb: "numbound0 e" by simp_all
  4.2710 -  have "?I ?u (Lt (CN 0 c e)) = (real c *(?t/?n) + (?N x e) < 0)"
  4.2711 +  have "?I ?u (Lt (CN 0 c e)) = (real_of_int c *(?t/?n) + (?N x e) < 0)"
  4.2712      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
  4.2713 -  also have "\<dots> = (?n*(real c *(?t/?n)) + ?n*(?N x e) < 0)"
  4.2714 -    by (simp only: pos_less_divide_eq[OF np, where a="real c *(?t/?n) + (?N x e)" 
  4.2715 +  also have "\<dots> = (?n*(real_of_int c *(?t/?n)) + ?n*(?N x e) < 0)"
  4.2716 +    by (simp only: pos_less_divide_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)" 
  4.2717        and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
  4.2718 -  also have "\<dots> = (real c *?t + ?n* (?N x e) < 0)"
  4.2719 +  also have "\<dots> = (real_of_int c *?t + ?n* (?N x e) < 0)"
  4.2720      using np by simp 
  4.2721    finally show ?case using nbt nb by (simp add: algebra_simps)
  4.2722  next
  4.2723    case (6 c e)
  4.2724    from 6 have cp: "c >0" and nb: "numbound0 e" by simp_all
  4.2725 -  have "?I ?u (Le (CN 0 c e)) = (real c *(?t/?n) + (?N x e) \<le> 0)"
  4.2726 +  have "?I ?u (Le (CN 0 c e)) = (real_of_int c *(?t/?n) + (?N x e) \<le> 0)"
  4.2727      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
  4.2728 -  also have "\<dots> = (?n*(real c *(?t/?n)) + ?n*(?N x e) \<le> 0)"
  4.2729 -    by (simp only: pos_le_divide_eq[OF np, where a="real c *(?t/?n) + (?N x e)" 
  4.2730 +  also have "\<dots> = (?n*(real_of_int c *(?t/?n)) + ?n*(?N x e) \<le> 0)"
  4.2731 +    by (simp only: pos_le_divide_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)" 
  4.2732        and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
  4.2733 -  also have "\<dots> = (real c *?t + ?n* (?N x e) \<le> 0)"
  4.2734 +  also have "\<dots> = (real_of_int c *?t + ?n* (?N x e) \<le> 0)"
  4.2735      using np by simp 
  4.2736    finally show ?case using nbt nb by (simp add: algebra_simps)
  4.2737  next
  4.2738    case (7 c e)
  4.2739    from 7 have cp: "c >0" and nb: "numbound0 e" by simp_all
  4.2740 -  have "?I ?u (Gt (CN 0 c e)) = (real c *(?t/?n) + (?N x e) > 0)"
  4.2741 +  have "?I ?u (Gt (CN 0 c e)) = (real_of_int c *(?t/?n) + (?N x e) > 0)"
  4.2742      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
  4.2743 -  also have "\<dots> = (?n*(real c *(?t/?n)) + ?n*(?N x e) > 0)"
  4.2744 -    by (simp only: pos_divide_less_eq[OF np, where a="real c *(?t/?n) + (?N x e)" 
  4.2745 +  also have "\<dots> = (?n*(real_of_int c *(?t/?n)) + ?n*(?N x e) > 0)"
  4.2746 +    by (simp only: pos_divide_less_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)" 
  4.2747        and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
  4.2748 -  also have "\<dots> = (real c *?t + ?n* (?N x e) > 0)"
  4.2749 +  also have "\<dots> = (real_of_int c *?t + ?n* (?N x e) > 0)"
  4.2750      using np by simp 
  4.2751    finally show ?case using nbt nb by (simp add: algebra_simps)
  4.2752  next
  4.2753    case (8 c e)
  4.2754    from 8 have cp: "c >0" and nb: "numbound0 e" by simp_all
  4.2755 -  have "?I ?u (Ge (CN 0 c e)) = (real c *(?t/?n) + (?N x e) \<ge> 0)"
  4.2756 +  have "?I ?u (Ge (CN 0 c e)) = (real_of_int c *(?t/?n) + (?N x e) \<ge> 0)"
  4.2757      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
  4.2758 -  also have "\<dots> = (?n*(real c *(?t/?n)) + ?n*(?N x e) \<ge> 0)"
  4.2759 -    by (simp only: pos_divide_le_eq[OF np, where a="real c *(?t/?n) + (?N x e)" 
  4.2760 +  also have "\<dots> = (?n*(real_of_int c *(?t/?n)) + ?n*(?N x e) \<ge> 0)"
  4.2761 +    by (simp only: pos_divide_le_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)" 
  4.2762        and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
  4.2763 -  also have "\<dots> = (real c *?t + ?n* (?N x e) \<ge> 0)"
  4.2764 +  also have "\<dots> = (real_of_int c *?t + ?n* (?N x e) \<ge> 0)"
  4.2765      using np by simp 
  4.2766    finally show ?case using nbt nb by (simp add: algebra_simps)
  4.2767  next
  4.2768    case (3 c e)
  4.2769    from 3 have cp: "c >0" and nb: "numbound0 e" by simp_all
  4.2770 -  from np have np: "real n \<noteq> 0" by simp
  4.2771 -  have "?I ?u (Eq (CN 0 c e)) = (real c *(?t/?n) + (?N x e) = 0)"
  4.2772 +  from np have np: "real_of_int n \<noteq> 0" by simp
  4.2773 +  have "?I ?u (Eq (CN 0 c e)) = (real_of_int c *(?t/?n) + (?N x e) = 0)"
  4.2774      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
  4.2775 -  also have "\<dots> = (?n*(real c *(?t/?n)) + ?n*(?N x e) = 0)"
  4.2776 -    by (simp only: nonzero_eq_divide_eq[OF np, where a="real c *(?t/?n) + (?N x e)" 
  4.2777 +  also have "\<dots> = (?n*(real_of_int c *(?t/?n)) + ?n*(?N x e) = 0)"
  4.2778 +    by (simp only: nonzero_eq_divide_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)" 
  4.2779        and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
  4.2780 -  also have "\<dots> = (real c *?t + ?n* (?N x e) = 0)"
  4.2781 +  also have "\<dots> = (real_of_int c *?t + ?n* (?N x e) = 0)"
  4.2782      using np by simp 
  4.2783    finally show ?case using nbt nb by (simp add: algebra_simps)
  4.2784  next
  4.2785    case (4 c e)
  4.2786    from 4 have cp: "c >0" and nb: "numbound0 e" by simp_all
  4.2787 -  from np have np: "real n \<noteq> 0" by simp
  4.2788 -  have "?I ?u (NEq (CN 0 c e)) = (real c *(?t/?n) + (?N x e) \<noteq> 0)"
  4.2789 +  from np have np: "real_of_int n \<noteq> 0" by simp
  4.2790 +  have "?I ?u (NEq (CN 0 c e)) = (real_of_int c *(?t/?n) + (?N x e) \<noteq> 0)"
  4.2791      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
  4.2792 -  also have "\<dots> = (?n*(real c *(?t/?n)) + ?n*(?N x e) \<noteq> 0)"
  4.2793 -    by (simp only: nonzero_eq_divide_eq[OF np, where a="real c *(?t/?n) + (?N x e)" 
  4.2794 +  also have "\<dots> = (?n*(real_of_int c *(?t/?n)) + ?n*(?N x e) \<noteq> 0)"
  4.2795 +    by (simp only: nonzero_eq_divide_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)" 
  4.2796        and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
  4.2797 -  also have "\<dots> = (real c *?t + ?n* (?N x e) \<noteq> 0)"
  4.2798 +  also have "\<dots> = (real_of_int c *?t + ?n* (?N x e) \<noteq> 0)"
  4.2799      using np by simp 
  4.2800    finally show ?case using nbt nb by (simp add: algebra_simps)
  4.2801 -qed(simp_all add: nbt numbound0_I[where bs ="bs" and b="(Inum (x#bs) t)/ real n" and b'="x"])
  4.2802 +qed(simp_all add: nbt numbound0_I[where bs ="bs" and b="(Inum (x#bs) t)/ real_of_int n" and b'="x"])
  4.2803  
  4.2804  lemma \<Upsilon>_l:
  4.2805    assumes lp: "isrlfm p"
  4.2806 @@ -4506,14 +4483,14 @@
  4.2807    assumes lp: "isrlfm p"
  4.2808    and nmi: "\<not> (Ifm (a#bs) (minusinf p))" (is "\<not> (Ifm (a#bs) (?M p))")
  4.2809    and ex: "Ifm (x#bs) p" (is "?I x p")
  4.2810 -  shows "\<exists> (s,m) \<in> set (\<Upsilon> p). x \<ge> Inum (a#bs) s / real m" (is "\<exists> (s,m) \<in> ?U p. x \<ge> ?N a s / real m")
  4.2811 +  shows "\<exists> (s,m) \<in> set (\<Upsilon> p). x \<ge> Inum (a#bs) s / real_of_int m" (is "\<exists> (s,m) \<in> ?U p. x \<ge> ?N a s / real_of_int m")
  4.2812  proof-
  4.2813 -  have "\<exists> (s,m) \<in> set (\<Upsilon> p). real m * x \<ge> Inum (a#bs) s " (is "\<exists> (s,m) \<in> ?U p. real m *x \<ge> ?N a s")
  4.2814 +  have "\<exists> (s,m) \<in> set (\<Upsilon> p). real_of_int m * x \<ge> Inum (a#bs) s " (is "\<exists> (s,m) \<in> ?U p. real_of_int m *x \<ge> ?N a s")
  4.2815      using lp nmi ex
  4.2816      by (induct p rule: minusinf.induct, auto simp add:numbound0_I[where bs="bs" and b="a" and b'="x"])
  4.2817 -  then obtain s m where smU: "(s,m) \<in> set (\<Upsilon> p)" and mx: "real m * x \<ge> ?N a s" by blast
  4.2818 -  from \<Upsilon>_l[OF lp] smU have mp: "real m > 0" by auto
  4.2819 -  from pos_divide_le_eq[OF mp, where a="x" and b="?N a s", symmetric] mx have "x \<ge> ?N a s / real m" 
  4.2820 +  then obtain s m where smU: "(s,m) \<in> set (\<Upsilon> p)" and mx: "real_of_int m * x \<ge> ?N a s" by blast
  4.2821 +  from \<Upsilon>_l[OF lp] smU have mp: "real_of_int m > 0" by auto
  4.2822 +  from pos_divide_le_eq[OF mp, where a="x" and b="?N a s", symmetric] mx have "x \<ge> ?N a s / real_of_int m" 
  4.2823      by (auto simp add: mult.commute)
  4.2824    thus ?thesis using smU by auto
  4.2825  qed
  4.2826 @@ -4522,119 +4499,119 @@
  4.2827    assumes lp: "isrlfm p"
  4.2828    and nmi: "\<not> (Ifm (a#bs) (plusinf p))" (is "\<not> (Ifm (a#bs) (?M p))")
  4.2829    and ex: "Ifm (x#bs) p" (is "?I x p")
  4.2830 -  shows "\<exists> (s,m) \<in> set (\<Upsilon> p). x \<le> Inum (a#bs) s / real m" (is "\<exists> (s,m) \<in> ?U p. x \<le> ?N a s / real m")
  4.2831 +  shows "\<exists> (s,m) \<in> set (\<Upsilon> p). x \<le> Inum (a#bs) s / real_of_int m" (is "\<exists> (s,m) \<in> ?U p. x \<le> ?N a s / real_of_int m")
  4.2832  proof-
  4.2833 -  have "\<exists> (s,m) \<in> set (\<Upsilon> p). real m * x \<le> Inum (a#bs) s " (is "\<exists> (s,m) \<in> ?U p. real m *x \<le> ?N a s")
  4.2834 +  have "\<exists> (s,m) \<in> set (\<Upsilon> p). real_of_int m * x \<le> Inum (a#bs) s " (is "\<exists> (s,m) \<in> ?U p. real_of_int m *x \<le> ?N a s")
  4.2835      using lp nmi ex
  4.2836      by (induct p rule: minusinf.induct, auto simp add:numbound0_I[where bs="bs" and b="a" and b'="x"])
  4.2837 -  then obtain s m where smU: "(s,m) \<in> set (\<Upsilon> p)" and mx: "real m * x \<le> ?N a s" by blast
  4.2838 -  from \<Upsilon>_l[OF lp] smU have mp: "real m > 0" by auto
  4.2839 -  from pos_le_divide_eq[OF mp, where a="x" and b="?N a s", symmetric] mx have "x \<le> ?N a s / real m" 
  4.2840 +  then obtain s m where smU: "(s,m) \<in> set (\<Upsilon> p)" and mx: "real_of_int m * x \<le> ?N a s" by blast
  4.2841 +  from \<Upsilon>_l[OF lp] smU have mp: "real_of_int m > 0" by auto
  4.2842 +  from pos_le_divide_eq[OF mp, where a="x" and b="?N a s", symmetric] mx have "x \<le> ?N a s / real_of_int m" 
  4.2843      by (auto simp add: mult.commute)
  4.2844    thus ?thesis using smU by auto
  4.2845  qed
  4.2846  
  4.2847  lemma lin_dense: 
  4.2848    assumes lp: "isrlfm p"
  4.2849 -  and noS: "\<forall> t. l < t \<and> t< u \<longrightarrow> t \<notin> (\<lambda> (t,n). Inum (x#bs) t / real n) ` set (\<Upsilon> p)" 
  4.2850 -  (is "\<forall> t. _ \<and> _ \<longrightarrow> t \<notin> (\<lambda> (t,n). ?N x t / real n ) ` (?U p)")
  4.2851 +  and noS: "\<forall> t. l < t \<and> t< u \<longrightarrow> t \<notin> (\<lambda> (t,n). Inum (x#bs) t / real_of_int n) ` set (\<Upsilon> p)" 
  4.2852 +  (is "\<forall> t. _ \<and> _ \<longrightarrow> t \<notin> (\<lambda> (t,n). ?N x t / real_of_int n ) ` (?U p)")
  4.2853    and lx: "l < x" and xu:"x < u" and px:" Ifm (x#bs) p"
  4.2854    and ly: "l < y" and yu: "y < u"
  4.2855    shows "Ifm (y#bs) p"
  4.2856  using lp px noS
  4.2857  proof (induct p rule: isrlfm.induct)
  4.2858 -  case (5 c e) hence cp: "real c > 0" and nb: "numbound0 e" by simp_all
  4.2859 -  from 5 have "x * real c + ?N x e < 0" by (simp add: algebra_simps)
  4.2860 -  hence pxc: "x < (- ?N x e) / real c" 
  4.2861 +  case (5 c e) hence cp: "real_of_int c > 0" and nb: "numbound0 e" by simp_all
  4.2862 +  from 5 have "x * real_of_int c + ?N x e < 0" by (simp add: algebra_simps)
  4.2863 +  hence pxc: "x < (- ?N x e) / real_of_int c" 
  4.2864      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="-?N x e"])
  4.2865 -  from 5 have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real c" by auto
  4.2866 -  with ly yu have yne: "y \<noteq> - ?N x e / real c" by auto
  4.2867 -  hence "y < (- ?N x e) / real c \<or> y > (-?N x e) / real c" by auto
  4.2868 -  moreover {assume y: "y < (-?N x e)/ real c"
  4.2869 -    hence "y * real c < - ?N x e"
  4.2870 +  from 5 have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real_of_int c" by auto
  4.2871 +  with ly yu have yne: "y \<noteq> - ?N x e / real_of_int c" by auto
  4.2872 +  hence "y < (- ?N x e) / real_of_int c \<or> y > (-?N x e) / real_of_int c" by auto
  4.2873 +  moreover {assume y: "y < (-?N x e)/ real_of_int c"
  4.2874 +    hence "y * real_of_int c < - ?N x e"
  4.2875        by (simp add: pos_less_divide_eq[OF cp, where a="y" and b="-?N x e", symmetric])
  4.2876 -    hence "real c * y + ?N x e < 0" by (simp add: algebra_simps)
  4.2877 +    hence "real_of_int c * y + ?N x e < 0" by (simp add: algebra_simps)
  4.2878      hence ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] by simp}
  4.2879 -  moreover {assume y: "y > (- ?N x e) / real c" 
  4.2880 -    with yu have eu: "u > (- ?N x e) / real c" by auto
  4.2881 -    with noSc ly yu have "(- ?N x e) / real c \<le> l" by (cases "(- ?N x e) / real c > l", auto)
  4.2882 +  moreover {assume y: "y > (- ?N x e) / real_of_int c" 
  4.2883 +    with yu have eu: "u > (- ?N x e) / real_of_int c" by auto
  4.2884 +    with noSc ly yu have "(- ?N x e) / real_of_int c \<le> l" by (cases "(- ?N x e) / real_of_int c > l", auto)
  4.2885      with lx pxc have "False" by auto
  4.2886      hence ?case by simp }
  4.2887    ultimately show ?case by blast
  4.2888  next
  4.2889 -  case (6 c e) hence cp: "real c > 0" and nb: "numbound0 e" by simp_all
  4.2890 -  from 6 have "x * real c + ?N x e \<le> 0" by (simp add: algebra_simps)
  4.2891 -  hence pxc: "x \<le> (- ?N x e) / real c" 
  4.2892 +  case (6 c e) hence cp: "real_of_int c > 0" and nb: "numbound0 e" by simp_all
  4.2893 +  from 6 have "x * real_of_int c + ?N x e \<le> 0" by (simp add: algebra_simps)
  4.2894 +  hence pxc: "x \<le> (- ?N x e) / real_of_int c" 
  4.2895      by (simp only: pos_le_divide_eq[OF cp, where a="x" and b="-?N x e"])
  4.2896 -  from 6 have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real c" by auto
  4.2897 -  with ly yu have yne: "y \<noteq> - ?N x e / real c" by auto
  4.2898 -  hence "y < (- ?N x e) / real c \<or> y > (-?N x e) / real c" by auto
  4.2899 -  moreover {assume y: "y < (-?N x e)/ real c"
  4.2900 -    hence "y * real c < - ?N x e"
  4.2901 +  from 6 have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real_of_int c" by auto
  4.2902 +  with ly yu have yne: "y \<noteq> - ?N x e / real_of_int c" by auto
  4.2903 +  hence "y < (- ?N x e) / real_of_int c \<or> y > (-?N x e) / real_of_int c" by auto
  4.2904 +  moreover {assume y: "y < (-?N x e)/ real_of_int c"
  4.2905 +    hence "y * real_of_int c < - ?N x e"
  4.2906        by (simp add: pos_less_divide_eq[OF cp, where a="y" and b="-?N x e", symmetric])
  4.2907 -    hence "real c * y + ?N x e < 0" by (simp add: algebra_simps)
  4.2908 +    hence "real_of_int c * y + ?N x e < 0" by (simp add: algebra_simps)
  4.2909      hence ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] by simp}
  4.2910 -  moreover {assume y: "y > (- ?N x e) / real c" 
  4.2911 -    with yu have eu: "u > (- ?N x e) / real c" by auto
  4.2912 -    with noSc ly yu have "(- ?N x e) / real c \<le> l" by (cases "(- ?N x e) / real c > l", auto)
  4.2913 +  moreover {assume y: "y > (- ?N x e) / real_of_int c" 
  4.2914 +    with yu have eu: "u > (- ?N x e) / real_of_int c" by auto
  4.2915 +    with noSc ly yu have "(- ?N x e) / real_of_int c \<le> l" by (cases "(- ?N x e) / real_of_int c > l", auto)
  4.2916      with lx pxc have "False" by auto
  4.2917      hence ?case by simp }
  4.2918    ultimately show ?case by blast
  4.2919  next
  4.2920 -  case (7 c e) hence cp: "real c > 0" and nb: "numbound0 e" by simp_all
  4.2921 -  from 7 have "x * real c + ?N x e > 0" by (simp add: algebra_simps)
  4.2922 -  hence pxc: "x > (- ?N x e) / real c" 
  4.2923 +  case (7 c e) hence cp: "real_of_int c > 0" and nb: "numbound0 e" by simp_all
  4.2924 +  from 7 have "x * real_of_int c + ?N x e > 0" by (simp add: algebra_simps)
  4.2925 +  hence pxc: "x > (- ?N x e) / real_of_int c" 
  4.2926      by (simp only: pos_divide_less_eq[OF cp, where a="x" and b="-?N x e"])
  4.2927 -  from 7 have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real c" by auto
  4.2928 -  with ly yu have yne: "y \<noteq> - ?N x e / real c" by auto
  4.2929 -  hence "y < (- ?N x e) / real c \<or> y > (-?N x e) / real c" by auto
  4.2930 -  moreover {assume y: "y > (-?N x e)/ real c"
  4.2931 -    hence "y * real c > - ?N x e"
  4.2932 +  from 7 have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real_of_int c" by auto
  4.2933 +  with ly yu have yne: "y \<noteq> - ?N x e / real_of_int c" by auto
  4.2934 +  hence "y < (- ?N x e) / real_of_int c \<or> y > (-?N x e) / real_of_int c" by auto
  4.2935 +  moreover {assume y: "y > (-?N x e)/ real_of_int c"
  4.2936 +    hence "y * real_of_int c > - ?N x e"
  4.2937        by (simp add: pos_divide_less_eq[OF cp, where a="y" and b="-?N x e", symmetric])
  4.2938 -    hence "real c * y + ?N x e > 0" by (simp add: algebra_simps)
  4.2939 +    hence "real_of_int c * y + ?N x e > 0" by (simp add: algebra_simps)
  4.2940      hence ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] by simp}
  4.2941 -  moreover {assume y: "y < (- ?N x e) / real c" 
  4.2942 -    with ly have eu: "l < (- ?N x e) / real c" by auto
  4.2943 -    with noSc ly yu have "(- ?N x e) / real c \<ge> u" by (cases "(- ?N x e) / real c > l", auto)
  4.2944 +  moreover {assume y: "y < (- ?N x e) / real_of_int c" 
  4.2945 +    with ly have eu: "l < (- ?N x e) / real_of_int c" by auto
  4.2946 +    with noSc ly yu have "(- ?N x e) / real_of_int c \<ge> u" by (cases "(- ?N x e) / real_of_int c > l", auto)
  4.2947      with xu pxc have "False" by auto
  4.2948      hence ?case by simp }
  4.2949    ultimately show ?case by blast
  4.2950  next
  4.2951 -  case (8 c e) hence cp: "real c > 0" and nb: "numbound0 e" by simp_all
  4.2952 -  from 8 have "x * real c + ?N x e \<ge> 0" by (simp add: algebra_simps)
  4.2953 -  hence pxc: "x \<ge> (- ?N x e) / real c" 
  4.2954 +  case (8 c e) hence cp: "real_of_int c > 0" and nb: "numbound0 e" by simp_all
  4.2955 +  from 8 have "x * real_of_int c + ?N x e \<ge> 0" by (simp add: algebra_simps)
  4.2956 +  hence pxc: "x \<ge> (- ?N x e) / real_of_int c" 
  4.2957      by (simp only: pos_divide_le_eq[OF cp, where a="x" and b="-?N x e"])
  4.2958 -  from 8 have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real c" by auto
  4.2959 -  with ly yu have yne: "y \<noteq> - ?N x e / real c" by auto
  4.2960 -  hence "y < (- ?N x e) / real c \<or> y > (-?N x e) / real c" by auto
  4.2961 -  moreover {assume y: "y > (-?N x e)/ real c"
  4.2962 -    hence "y * real c > - ?N x e"
  4.2963 +  from 8 have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real_of_int c" by auto
  4.2964 +  with ly yu have yne: "y \<noteq> - ?N x e / real_of_int c" by auto
  4.2965 +  hence "y < (- ?N x e) / real_of_int c \<or> y > (-?N x e) / real_of_int c" by auto
  4.2966 +  moreover {assume y: "y > (-?N x e)/ real_of_int c"
  4.2967 +    hence "y * real_of_int c > - ?N x e"
  4.2968        by (simp add: pos_divide_less_eq[OF cp, where a="y" and b="-?N x e", symmetric])
  4.2969 -    hence "real c * y + ?N x e > 0" by (simp add: algebra_simps)
  4.2970 +    hence "real_of_int c * y + ?N x e > 0" by (simp add: algebra_simps)
  4.2971      hence ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] by simp}
  4.2972 -  moreover {assume y: "y < (- ?N x e) / real c" 
  4.2973 -    with ly have eu: "l < (- ?N x e) / real c" by auto
  4.2974 -    with noSc ly yu have "(- ?N x e) / real c \<ge> u" by (cases "(- ?N x e) / real c > l", auto)
  4.2975 +  moreover {assume y: "y < (- ?N x e) / real_of_int c" 
  4.2976 +    with ly have eu: "l < (- ?N x e) / real_of_int c" by auto
  4.2977 +    with noSc ly yu have "(- ?N x e) / real_of_int c \<ge> u" by (cases "(- ?N x e) / real_of_int c > l", auto)
  4.2978      with xu pxc have "False" by auto
  4.2979      hence ?case by simp }
  4.2980    ultimately show ?case by blast
  4.2981  next
  4.2982 -  case (3 c e) hence cp: "real c > 0" and nb: "numbound0 e" by simp_all
  4.2983 -  from cp have cnz: "real c \<noteq> 0" by simp
  4.2984 -  from 3 have "x * real c + ?N x e = 0" by (simp add: algebra_simps)
  4.2985 -  hence pxc: "x = (- ?N x e) / real c" 
  4.2986 +  case (3 c e) hence cp: "real_of_int c > 0" and nb: "numbound0 e" by simp_all
  4.2987 +  from cp have cnz: "real_of_int c \<noteq> 0" by simp
  4.2988 +  from 3 have "x * real_of_int c + ?N x e = 0" by (simp add: algebra_simps)
  4.2989 +  hence pxc: "x = (- ?N x e) / real_of_int c" 
  4.2990      by (simp only: nonzero_eq_divide_eq[OF cnz, where a="x" and b="-?N x e"])
  4.2991 -  from 3 have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real c" by auto
  4.2992 -  with lx xu have yne: "x \<noteq> - ?N x e / real c" by auto
  4.2993 +  from 3 have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real_of_int c" by auto
  4.2994 +  with lx xu have yne: "x \<noteq> - ?N x e / real_of_int c" by auto
  4.2995    with pxc show ?case by simp
  4.2996  next
  4.2997 -  case (4 c e) hence cp: "real c > 0" and nb: "numbound0 e" by simp_all
  4.2998 -  from cp have cnz: "real c \<noteq> 0" by simp
  4.2999 -  from 4 have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real c" by auto
  4.3000 -  with ly yu have yne: "y \<noteq> - ?N x e / real c" by auto
  4.3001 -  hence "y* real c \<noteq> -?N x e"      
  4.3002 +  case (4 c e) hence cp: "real_of_int c > 0" and nb: "numbound0 e" by simp_all
  4.3003 +  from cp have cnz: "real_of_int c \<noteq> 0" by simp
  4.3004 +  from 4 have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real_of_int c" by auto
  4.3005 +  with ly yu have yne: "y \<noteq> - ?N x e / real_of_int c" by auto
  4.3006 +  hence "y* real_of_int c \<noteq> -?N x e"      
  4.3007      by (simp only: nonzero_eq_divide_eq[OF cnz, where a="y" and b="-?N x e"]) simp
  4.3008 -  hence "y* real c + ?N x e \<noteq> 0" by (simp add: algebra_simps)
  4.3009 +  hence "y* real_of_int c + ?N x e \<noteq> 0" by (simp add: algebra_simps)
  4.3010    thus ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] 
  4.3011      by (simp add: algebra_simps)
  4.3012  qed (auto simp add: numbound0_I[where bs="bs" and b="y" and b'="x"])
  4.3013 @@ -4645,7 +4622,7 @@
  4.3014    and npi: "\<not> (Ifm (x#bs) (plusinf p))" (is "\<not> (Ifm (x#bs) (?P p))")
  4.3015    and ex: "\<exists> x.  Ifm (x#bs) p" (is "\<exists> x. ?I x p")
  4.3016    shows "\<exists> (l,n) \<in> set (\<Upsilon> p). \<exists> (s,m) \<in> set (\<Upsilon> p).
  4.3017 -    ?I ((Inum (x#bs) l / real n + Inum (x#bs) s / real m) / 2) p" 
  4.3018 +    ?I ((Inum (x#bs) l / real_of_int n + Inum (x#bs) s / real_of_int m) / 2) p" 
  4.3019  proof-
  4.3020    let ?N = "\<lambda> x t. Inum (x#bs) t"
  4.3021    let ?U = "set (\<Upsilon> p)"
  4.3022 @@ -4654,46 +4631,46 @@
  4.3023    have nmi': "\<not> (?I a (?M p))" by simp
  4.3024    from bound0_I[OF rplusinf_bound0[OF lp], where bs="bs" and b="x" and b'="a"] npi
  4.3025    have npi': "\<not> (?I a (?P p))" by simp
  4.3026 -  have "\<exists> (l,n) \<in> set (\<Upsilon> p). \<exists> (s,m) \<in> set (\<Upsilon> p). ?I ((?N a l/real n + ?N a s /real m) / 2) p"
  4.3027 +  have "\<exists> (l,n) \<in> set (\<Upsilon> p). \<exists> (s,m) \<in> set (\<Upsilon> p). ?I ((?N a l/real_of_int n + ?N a s /real_of_int m) / 2) p"
  4.3028    proof-
  4.3029 -    let ?M = "(\<lambda> (t,c). ?N a t / real c) ` ?U"
  4.3030 +    let ?M = "(\<lambda> (t,c). ?N a t / real_of_int c) ` ?U"
  4.3031      have fM: "finite ?M" by auto
  4.3032      from rminusinf_\<Upsilon>[OF lp nmi pa] rplusinf_\<Upsilon>[OF lp npi pa] 
  4.3033 -    have "\<exists> (l,n) \<in> set (\<Upsilon> p). \<exists> (s,m) \<in> set (\<Upsilon> p). a \<le> ?N x l / real n \<and> a \<ge> ?N x s / real m" by blast
  4.3034 +    have "\<exists> (l,n) \<in> set (\<Upsilon> p). \<exists> (s,m) \<in> set (\<Upsilon> p). a \<le> ?N x l / real_of_int n \<and> a \<ge> ?N x s / real_of_int m" by blast
  4.3035      then obtain "t" "n" "s" "m" where 
  4.3036        tnU: "(t,n) \<in> ?U" and smU: "(s,m) \<in> ?U" 
  4.3037 -      and xs1: "a \<le> ?N x s / real m" and tx1: "a \<ge> ?N x t / real n" by blast
  4.3038 -    from \<Upsilon>_l[OF lp] tnU smU numbound0_I[where bs="bs" and b="x" and b'="a"] xs1 tx1 have xs: "a \<le> ?N a s / real m" and tx: "a \<ge> ?N a t / real n" by auto
  4.3039 +      and xs1: "a \<le> ?N x s / real_of_int m" and tx1: "a \<ge> ?N x t / real_of_int n" by blast
  4.3040 +    from \<Upsilon>_l[OF lp] tnU smU numbound0_I[where bs="bs" and b="x" and b'="a"] xs1 tx1 have xs: "a \<le> ?N a s / real_of_int m" and tx: "a \<ge> ?N a t / real_of_int n" by auto
  4.3041      from tnU have Mne: "?M \<noteq> {}" by auto
  4.3042      hence Une: "?U \<noteq> {}" by simp
  4.3043      let ?l = "Min ?M"
  4.3044      let ?u = "Max ?M"
  4.3045      have linM: "?l \<in> ?M" using fM Mne by simp
  4.3046      have uinM: "?u \<in> ?M" using fM Mne by simp
  4.3047 -    have tnM: "?N a t / real n \<in> ?M" using tnU by auto
  4.3048 -    have smM: "?N a s / real m \<in> ?M" using smU by auto 
  4.3049 +    have tnM: "?N a t / real_of_int n \<in> ?M" using tnU by auto
  4.3050 +    have smM: "?N a s / real_of_int m \<in> ?M" using smU by auto 
  4.3051      have lM: "\<forall> t\<in> ?M. ?l \<le> t" using Mne fM by auto
  4.3052      have Mu: "\<forall> t\<in> ?M. t \<le> ?u" using Mne fM by auto
  4.3053 -    have "?l \<le> ?N a t / real n" using tnM Mne by simp hence lx: "?l \<le> a" using tx by simp
  4.3054 -    have "?N a s / real m \<le> ?u" using smM Mne by simp hence xu: "a \<le> ?u" using xs by simp
  4.3055 +    have "?l \<le> ?N a t / real_of_int n" using tnM Mne by simp hence lx: "?l \<le> a" using tx by simp
  4.3056 +    have "?N a s / real_of_int m \<le> ?u" using smM Mne by simp hence xu: "a \<le> ?u" using xs by simp
  4.3057      from finite_set_intervals2[where P="\<lambda> x. ?I x p",OF pa lx xu linM uinM fM lM Mu]
  4.3058      have "(\<exists> s\<in> ?M. ?I s p) \<or> 
  4.3059        (\<exists> t1\<in> ?M. \<exists> t2 \<in> ?M. (\<forall> y. t1 < y \<and> y < t2 \<longrightarrow> y \<notin> ?M) \<and> t1 < a \<and> a < t2 \<and> ?I a p)" .
  4.3060      moreover { fix u assume um: "u\<in> ?M" and pu: "?I u p"
  4.3061 -      hence "\<exists> (tu,nu) \<in> ?U. u = ?N a tu / real nu" by auto
  4.3062 -      then obtain "tu" "nu" where tuU: "(tu,nu) \<in> ?U" and tuu:"u= ?N a tu / real nu" by blast
  4.3063 +      hence "\<exists> (tu,nu) \<in> ?U. u = ?N a tu / real_of_int nu" by auto
  4.3064 +      then obtain "tu" "nu" where tuU: "(tu,nu) \<in> ?U" and tuu:"u= ?N a tu / real_of_int nu" by blast
  4.3065        have "(u + u) / 2 = u" by auto with pu tuu 
  4.3066 -      have "?I (((?N a tu / real nu) + (?N a tu / real nu)) / 2) p" by simp
  4.3067 +      have "?I (((?N a tu / real_of_int nu) + (?N a tu / real_of_int nu)) / 2) p" by simp
  4.3068        with tuU have ?thesis by blast}
  4.3069      moreover{
  4.3070        assume "\<exists> t1\<in> ?M. \<exists> t2 \<in> ?M. (\<forall> y. t1 < y \<and> y < t2 \<longrightarrow> y \<notin> ?M) \<and> t1 < a \<and> a < t2 \<and> ?I a p"
  4.3071        then obtain t1 and t2 where t1M: "t1 \<in> ?M" and t2M: "t2\<in> ?M" 
  4.3072          and noM: "\<forall> y. t1 < y \<and> y < t2 \<longrightarrow> y \<notin> ?M" and t1x: "t1 < a" and xt2: "a < t2" and px: "?I a p"
  4.3073          by blast
  4.3074 -      from t1M have "\<exists> (t1u,t1n) \<in> ?U. t1 = ?N a t1u / real t1n" by auto
  4.3075 -      then obtain "t1u" "t1n" where t1uU: "(t1u,t1n) \<in> ?U" and t1u: "t1 = ?N a t1u / real t1n" by blast
  4.3076 -      from t2M have "\<exists> (t2u,t2n) \<in> ?U. t2 = ?N a t2u / real t2n" by auto
  4.3077 -      then obtain "t2u" "t2n" where t2uU: "(t2u,t2n) \<in> ?U" and t2u: "t2 = ?N a t2u / real t2n" by blast
  4.3078 +      from t1M have "\<exists> (t1u,t1n) \<in> ?U. t1 = ?N a t1u / real_of_int t1n" by auto
  4.3079 +      then obtain "t1u" "t1n" where t1uU: "(t1u,t1n) \<in> ?U" and t1u: "t1 = ?N a t1u / real_of_int t1n" by blast
  4.3080 +      from t2M have "\<exists> (t2u,t2n) \<in> ?U. t2 = ?N a t2u / real_of_int t2n" by auto
  4.3081 +      then obtain "t2u" "t2n" where t2uU: "(t2u,t2n) \<in> ?U" and t2u: "t2 = ?N a t2u / real_of_int t2n" by blast
  4.3082        from t1x xt2 have t1t2: "t1 < t2" by simp
  4.3083        let ?u = "(t1 + t2) / 2"
  4.3084        from less_half_sum[OF t1t2] gt_half_sum[OF t1t2] have t1lu: "t1 < ?u" and ut2: "?u < t2" by auto
  4.3085 @@ -4702,11 +4679,11 @@
  4.3086      ultimately show ?thesis by blast
  4.3087    qed
  4.3088    then obtain "l" "n" "s"  "m" where lnU: "(l,n) \<in> ?U" and smU:"(s,m) \<in> ?U" 
  4.3089 -    and pu: "?I ((?N a l / real n + ?N a s / real m) / 2) p" by blast
  4.3090 +    and pu: "?I ((?N a l / real_of_int n + ?N a s / real_of_int m) / 2) p" by blast
  4.3091    from lnU smU \<Upsilon>_l[OF lp] have nbl: "numbound0 l" and nbs: "numbound0 s" by auto
  4.3092    from numbound0_I[OF nbl, where bs="bs" and b="a" and b'="x"] 
  4.3093      numbound0_I[OF nbs, where bs="bs" and b="a" and b'="x"] pu
  4.3094 -  have "?I ((?N x l / real n + ?N x s / real m) / 2) p" by simp
  4.3095 +  have "?I ((?N x l / real_of_int n + ?N x s / real_of_int m) / 2) p" by simp
  4.3096    with lnU smU
  4.3097    show ?thesis by auto
  4.3098  qed
  4.3099 @@ -4714,7 +4691,7 @@
  4.3100  
  4.3101  theorem fr_eq: 
  4.3102    assumes lp: "isrlfm p"
  4.3103 -  shows "(\<exists> x. Ifm (x#bs) p) = ((Ifm (x#bs) (minusinf p)) \<or> (Ifm (x#bs) (plusinf p)) \<or> (\<exists> (t,n) \<in> set (\<Upsilon> p). \<exists> (s,m) \<in> set (\<Upsilon> p). Ifm ((((Inum (x#bs) t)/  real n + (Inum (x#bs) s) / real m) /2)#bs) p))"
  4.3104 +  shows "(\<exists> x. Ifm (x#bs) p) = ((Ifm (x#bs) (minusinf p)) \<or> (Ifm (x#bs) (plusinf p)) \<or> (\<exists> (t,n) \<in> set (\<Upsilon> p). \<exists> (s,m) \<in> set (\<Upsilon> p). Ifm ((((Inum (x#bs) t)/  real_of_int n + (Inum (x#bs) s) / real_of_int m) /2)#bs) p))"
  4.3105    (is "(\<exists> x. ?I x p) = (?M \<or> ?P \<or> ?F)" is "?E = ?D")
  4.3106  proof
  4.3107    assume px: "\<exists> x. ?I x p"
  4.3108 @@ -4741,18 +4718,18 @@
  4.3109    have "?M \<or> ?P \<or> (\<not> ?M \<and> \<not> ?P)" by blast
  4.3110    moreover {assume "?M \<or> ?P" hence "?D" by blast}
  4.3111    moreover {assume nmi: "\<not> ?M" and npi: "\<not> ?P"
  4.3112 -    let ?f ="\<lambda> (t,n). Inum (x#bs) t / real n"
  4.3113 +    let ?f ="\<lambda> (t,n). Inum (x#bs) t / real_of_int n"
  4.3114      let ?N = "\<lambda> t. Inum (x#bs) t"
  4.3115      {fix t n s m assume "(t,n)\<in> set (\<Upsilon> p)" and "(s,m) \<in> set (\<Upsilon> p)"
  4.3116 -      with \<Upsilon>_l[OF lp] have tnb: "numbound0 t" and np:"real n > 0" and snb: "numbound0 s" and mp:"real m > 0"
  4.3117 +      with \<Upsilon>_l[OF lp] have tnb: "numbound0 t" and np:"real_of_int n > 0" and snb: "numbound0 s" and mp:"real_of_int m > 0"
  4.3118          by auto
  4.3119        let ?st = "Add (Mul m t) (Mul n s)"
  4.3120 -      from np mp have mnp: "real (2*n*m) > 0" by (simp add: mult.commute)
  4.3121 +      from np mp have mnp: "real_of_int (2*n*m) > 0" by (simp add: mult.commute)
  4.3122        from tnb snb have st_nb: "numbound0 ?st" by simp
  4.3123 -      have st: "(?N t / real n + ?N s / real m)/2 = ?N ?st / real (2*n*m)"
  4.3124 +      have st: "(?N t / real_of_int n + ?N s / real_of_int m)/2 = ?N ?st / real_of_int (2*n*m)"
  4.3125          using mnp mp np by (simp add: algebra_simps add_divide_distrib)
  4.3126        from \<upsilon>_I[OF lp mnp st_nb, where x="x" and bs="bs"] 
  4.3127 -      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])}
  4.3128 +      have "?I x (\<upsilon> p (?st,2*n*m)) = ?I ((?N t / real_of_int n + ?N s / real_of_int m) /2) p" by (simp only: st[symmetric])}
  4.3129      with rinf_\<Upsilon>[OF lp nmi npi px] have "?F" by blast hence "?D" by blast}
  4.3130    ultimately show "?D" by blast
  4.3131  next
  4.3132 @@ -4761,9 +4738,9 @@
  4.3133    moreover {assume p: "?P" from rplusinf_ex[OF lp p] have "?E" . }
  4.3134    moreover {fix t k s l assume "(t,k) \<in> set (\<Upsilon> p)" and "(s,l) \<in> set (\<Upsilon> p)" 
  4.3135      and px:"?I x (\<upsilon> p (Add (Mul l t) (Mul k s), 2*k*l))"
  4.3136 -    with \<Upsilon>_l[OF lp] have tnb: "numbound0 t" and np:"real k > 0" and snb: "numbound0 s" and mp:"real l > 0" by auto
  4.3137 +    with \<Upsilon>_l[OF lp] have tnb: "numbound0 t" and np:"real_of_int k > 0" and snb: "numbound0 s" and mp:"real_of_int l > 0" by auto
  4.3138      let ?st = "Add (Mul l t) (Mul k s)"
  4.3139 -    from np mp have mnp: "real (2*k*l) > 0" by (simp add: mult.commute)
  4.3140 +    from np mp have mnp: "real_of_int (2*k*l) > 0" by (simp add: mult.commute)
  4.3141      from tnb snb have st_nb: "numbound0 ?st" by simp
  4.3142      from \<upsilon>_I[OF lp mnp st_nb, where bs="bs"] px have "?E" by auto}
  4.3143    ultimately show "?E" by blast
  4.3144 @@ -4772,17 +4749,17 @@
  4.3145  text\<open>The overall Part\<close>
  4.3146  
  4.3147  lemma real_ex_int_real01:
  4.3148 -  shows "(\<exists> (x::real). P x) = (\<exists> (i::int) (u::real). 0\<le> u \<and> u< 1 \<and> P (real i + u))"
  4.3149 +  shows "(\<exists> (x::real). P x) = (\<exists> (i::int) (u::real). 0\<le> u \<and> u< 1 \<and> P (real_of_int i + u))"
  4.3150  proof(auto)
  4.3151    fix x
  4.3152    assume Px: "P x"
  4.3153    let ?i = "floor x"
  4.3154 -  let ?u = "x - real ?i"
  4.3155 -  have "x = real ?i + ?u" by simp
  4.3156 -  hence "P (real ?i + ?u)" using Px by simp
  4.3157 -  moreover have "real ?i \<le> x" using real_of_int_floor_le by simp hence "0 \<le> ?u" by arith
  4.3158 +  let ?u = "x - real_of_int ?i"
  4.3159 +  have "x = real_of_int ?i + ?u" by simp
  4.3160 +  hence "P (real_of_int ?i + ?u)" using Px by simp
  4.3161 +  moreover have "real_of_int ?i \<le> x" using of_int_floor_le by simp hence "0 \<le> ?u" by arith
  4.3162    moreover have "?u < 1" using real_of_int_floor_add_one_gt[where r="x"] by arith 
  4.3163 -  ultimately show "(\<exists> (i::int) (u::real). 0\<le> u \<and> u< 1 \<and> P (real i + u))" by blast
  4.3164 +  ultimately show "(\<exists> (i::int) (u::real). 0\<le> u \<and> u< 1 \<and> P (real_of_int i + u))" by blast
  4.3165  qed
  4.3166  
  4.3167  fun exsplitnum :: "num \<Rightarrow> num" where
  4.3168 @@ -4826,11 +4803,11 @@
  4.3169  
  4.3170  lemma splitex:
  4.3171    assumes qf: "qfree p"
  4.3172 -  shows "(Ifm bs (E p)) = (\<exists> (i::int). Ifm (real i#bs) (E (And (And (Ge(CN 0 1 (C 0))) (Lt (CN 0 1 (C (- 1))))) (exsplit p))))" (is "?lhs = ?rhs")
  4.3173 +  shows "(Ifm bs (E p)) = (\<exists> (i::int). Ifm (real_of_int i#bs) (E (And (And (Ge(CN 0 1 (C 0))) (Lt (CN 0 1 (C (- 1))))) (exsplit p))))" (is "?lhs = ?rhs")
  4.3174  proof-
  4.3175 -  have "?rhs = (\<exists> (i::int). \<exists> x. 0\<le> x \<and> x < 1 \<and> Ifm (x#(real i)#bs) (exsplit p))"
  4.3176 +  have "?rhs = (\<exists> (i::int). \<exists> x. 0\<le> x \<and> x < 1 \<and> Ifm (x#(real_of_int i)#bs) (exsplit p))"
  4.3177      by (simp add: myless[of _ "1"] myless[of _ "0"] ac_simps)
  4.3178 -  also have "\<dots> = (\<exists> (i::int). \<exists> x. 0\<le> x \<and> x < 1 \<and> Ifm ((real i + x) #bs) p)"
  4.3179 +  also have "\<dots> = (\<exists> (i::int). \<exists> x. 0\<le> x \<and> x < 1 \<and> Ifm ((real_of_int i + x) #bs) p)"
  4.3180      by (simp only: exsplit[OF qf] ac_simps)
  4.3181    also have "\<dots> = (\<exists> x. Ifm (x#bs) p)" 
  4.3182      by (simp only: real_ex_int_real01[where P="\<lambda> x. Ifm (x#bs) p"])
  4.3183 @@ -4880,10 +4857,10 @@
  4.3184      then obtain t n s m where aU:"(t,n) \<in> ?U" and bU:"(s,m)\<in> ?U" and rqx: "?I x (\<upsilon> ?rq (Add (Mul m t) (Mul n s), 2*n*m))" by blast
  4.3185      from qf have lrq:"isrlfm ?rq"using rlfm_l[OF qf] 
  4.3186        by (auto simp add: rsplit_def lt_def ge_def)
  4.3187 -    from aU bU \<Upsilon>_l[OF lrq] have tnb: "numbound0 t" and np:"real n > 0" and snb: "numbound0 s" and mp:"real m > 0" by (auto simp add: split_def)
  4.3188 +    from aU bU \<Upsilon>_l[OF lrq] have tnb: "numbound0 t" and np:"real_of_int n > 0" and snb: "numbound0 s" and mp:"real_of_int m > 0" by (auto simp add: split_def)
  4.3189      let ?st = "Add (Mul m t) (Mul n s)"
  4.3190      from tnb snb have stnb: "numbound0 ?st" by simp
  4.3191 -    from np mp have mnp: "real (2*n*m) > 0" by (simp add: mult.commute)
  4.3192 +    from np mp have mnp: "real_of_int (2*n*m) > 0" by (simp add: mult.commute)
  4.3193      from conjunct1[OF \<upsilon>_I[OF lrq mnp stnb, where bs="bs" and x="x"], symmetric] rqx
  4.3194      have "\<exists> x. ?I x ?rq" by auto
  4.3195      thus "?E" 
  4.3196 @@ -4894,7 +4871,7 @@
  4.3197  
  4.3198  lemma \<Upsilon>_cong_aux:
  4.3199    assumes Ul: "\<forall> (t,n) \<in> set U. numbound0 t \<and> n >0"
  4.3200 -  shows "((\<lambda> (t,n). Inum (x#bs) t /real n) ` (set (map (\<lambda> ((t,n),(s,m)). (Add (Mul m t) (Mul n s) , 2*n*m)) (alluopairs U)))) = ((\<lambda> ((t,n),(s,m)). (Inum (x#bs) t /real n + Inum (x#bs) s /real m)/2) ` (set U \<times> set U))"
  4.3201 +  shows "((\<lambda> (t,n). Inum (x#bs) t /real_of_int n) ` (set (map (\<lambda> ((t,n),(s,m)). (Add (Mul m t) (Mul n s) , 2*n*m)) (alluopairs U)))) = ((\<lambda> ((t,n),(s,m)). (Inum (x#bs) t /real_of_int n + Inum (x#bs) s /real_of_int m)/2) ` (set U \<times> set U))"
  4.3202    (is "?lhs = ?rhs")
  4.3203  proof(auto)
  4.3204    fix t n s m
  4.3205 @@ -4905,13 +4882,13 @@
  4.3206    let ?st= "Add (Mul m t) (Mul n s)"
  4.3207    from Ul th have mnz: "m \<noteq> 0" by auto
  4.3208    from Ul th have  nnz: "n \<noteq> 0" by auto  
  4.3209 -  have st: "(?N t / real n + ?N s / real m)/2 = ?N ?st / real (2*n*m)"
  4.3210 +  have st: "(?N t / real_of_int n + ?N s / real_of_int m)/2 = ?N ?st / real_of_int (2*n*m)"
  4.3211     using mnz nnz by (simp add: algebra_simps add_divide_distrib)
  4.3212   
  4.3213 -  thus "(real m *  Inum (x # bs) t + real n * Inum (x # bs) s) /
  4.3214 -       (2 * real n * real m)
  4.3215 +  thus "(real_of_int m *  Inum (x # bs) t + real_of_int n * Inum (x # bs) s) /
  4.3216 +       (2 * real_of_int n * real_of_int m)
  4.3217         \<in> (\<lambda>((t, n), s, m).
  4.3218 -             (Inum (x # bs) t / real n + Inum (x # bs) s / real m) / 2) `
  4.3219 +             (Inum (x # bs) t / real_of_int n + Inum (x # bs) s / real_of_int m) / 2) `
  4.3220           (set U \<times> set U)"using mnz nnz th  
  4.3221      apply (auto simp add: th add_divide_distrib algebra_simps split_def image_def)
  4.3222      by (rule_tac x="(s,m)" in bexI,simp_all) 
  4.3223 @@ -4923,9 +4900,9 @@
  4.3224    let ?st= "Add (Mul m t) (Mul n s)"
  4.3225    from Ul smU have mnz: "m \<noteq> 0" by auto
  4.3226    from Ul tnU have  nnz: "n \<noteq> 0" by auto  
  4.3227 -  have st: "(?N t / real n + ?N s / real m)/2 = ?N ?st / real (2*n*m)"
  4.3228 +  have st: "(?N t / real_of_int n + ?N s / real_of_int m)/2 = ?N ?st / real_of_int (2*n*m)"
  4.3229     using mnz nnz by (simp add: algebra_simps add_divide_distrib)
  4.3230 - 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"
  4.3231 + let ?P = "\<lambda> (t',n') (s',m'). (Inum (x # bs) t / real_of_int n + Inum (x # bs) s / real_of_int m)/2 = (Inum (x # bs) t' / real_of_int n' + Inum (x # bs) s' / real_of_int m')/2"
  4.3232   have Pc:"\<forall> a b. ?P a b = ?P b a"
  4.3233     by auto
  4.3234   from Ul alluopairs_set1 have Up:"\<forall> ((t,n),(s,m)) \<in> set (alluopairs U). n \<noteq> 0 \<and> m \<noteq> 0" by blast
  4.3235 @@ -4936,13 +4913,13 @@
  4.3236     and Pts': "?P (t',n') (s',m')" by blast
  4.3237   from ts'_U Up have mnz': "m' \<noteq> 0" and nnz': "n'\<noteq> 0" by auto
  4.3238   let ?st' = "Add (Mul m' t') (Mul n' s')"
  4.3239 -   have st': "(?N t' / real n' + ?N s' / real m')/2 = ?N ?st' / real (2*n'*m')"
  4.3240 +   have st': "(?N t' / real_of_int n' + ?N s' / real_of_int m')/2 = ?N ?st' / real_of_int (2*n'*m')"
  4.3241     using mnz' nnz' by (simp add: algebra_simps add_divide_distrib)
  4.3242   from Pts' have 
  4.3243 -   "(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
  4.3244 - 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')
  4.3245 - finally show "(Inum (x # bs) t / real n + Inum (x # bs) s / real m) / 2
  4.3246 -          \<in> (\<lambda>(t, n). Inum (x # bs) t / real n) `
  4.3247 +   "(Inum (x # bs) t / real_of_int n + Inum (x # bs) s / real_of_int m)/2 = (Inum (x # bs) t' / real_of_int n' + Inum (x # bs) s' / real_of_int m')/2" by simp
  4.3248 + also have "\<dots> = ((\<lambda>(t, n). Inum (x # bs) t / real_of_int n) ((\<lambda>((t, n), s, m). (Add (Mul m t) (Mul n s), 2 * n * m)) ((t',n'),(s',m'))))" by (simp add: st')
  4.3249 + finally show "(Inum (x # bs) t / real_of_int n + Inum (x # bs) s / real_of_int m) / 2
  4.3250 +          \<in> (\<lambda>(t, n). Inum (x # bs) t / real_of_int n) `
  4.3251              (\<lambda>((t, n), s, m). (Add (Mul m t) (Mul n s), 2 * n * m)) `
  4.3252              set (alluopairs U)"
  4.3253     using ts'_U by blast
  4.3254 @@ -4950,7 +4927,7 @@
  4.3255  
  4.3256  lemma \<Upsilon>_cong:
  4.3257    assumes lp: "isrlfm p"
  4.3258 -  and UU': "((\<lambda> (t,n). Inum (x#bs) t /real n) ` U') = ((\<lambda> ((t,n),(s,m)). (Inum (x#bs) t /real n + Inum (x#bs) s /real m)/2) ` (U \<times> U))" (is "?f ` U' = ?g ` (U\<times>U)")
  4.3259 +  and UU': "((\<lambda> (t,n). Inum (x#bs) t /real_of_int n) ` U') = ((\<lambda> ((t,n),(s,m)). (Inum (x#bs) t /real_of_int n + Inum (x#bs) s /real_of_int m)/2) ` (U \<times> U))" (is "?f ` U' = ?g ` (U\<times>U)")
  4.3260    and U: "\<forall> (t,n) \<in> U. numbound0 t \<and> n > 0"
  4.3261    and U': "\<forall> (t,n) \<in> U'. numbound0 t \<and> n > 0"
  4.3262    shows "(\<exists> (t,n) \<in> U. \<exists> (s,m) \<in> U. Ifm (x#bs) (\<upsilon> p (Add (Mul m t) (Mul n s),2*n*m))) = (\<exists> (t,n) \<in> U'. Ifm (x#bs) (\<upsilon> p (t,n)))"
  4.3263 @@ -4963,18 +4940,18 @@
  4.3264    from tnU smU U have tnb: "numbound0 t" and np: "n > 0" 
  4.3265      and snb: "numbound0 s" and mp:"m > 0"  by auto
  4.3266    let ?st= "Add (Mul m t) (Mul n s)"
  4.3267 -  from np mp have mnp: "real (2*n*m) > 0" 
  4.3268 -      by (simp add: mult.commute real_of_int_mult[symmetric] del: real_of_int_mult)
  4.3269 +  from np mp have mnp: "real_of_int (2*n*m) > 0" 
  4.3270 +      by (simp add: mult.commute of_int_mult[symmetric] del: of_int_mult)
  4.3271      from tnb snb have stnb: "numbound0 ?st" by simp
  4.3272 -  have st: "(?N t / real n + ?N s / real m)/2 = ?N ?st / real (2*n*m)"
  4.3273 +  have st: "(?N t / real_of_int n + ?N s / real_of_int m)/2 = ?N ?st / real_of_int (2*n*m)"
  4.3274     using mp np by (simp add: algebra_simps add_divide_distrib)
  4.3275    from tnU smU UU' have "?g ((t,n),(s,m)) \<in> ?f ` U'" by blast
  4.3276    hence "\<exists> (t',n') \<in> U'. ?g ((t,n),(s,m)) = ?f (t',n')"
  4.3277      by auto (rule_tac x="(a,b)" in bexI, auto)
  4.3278    then obtain t' n' where tnU': "(t',n') \<in> U'" and th: "?g ((t,n),(s,m)) = ?f (t',n')" by blast
  4.3279 -  from U' tnU' have tnb': "numbound0 t'" and np': "real n' > 0" by auto
  4.3280 +  from U' tnU' have tnb': "numbound0 t'" and np': "real_of_int n' > 0" by auto
  4.3281    from \<upsilon>_I[OF lp mnp stnb, where bs="bs" and x="x"] Pst 
  4.3282 -  have Pst2: "Ifm (Inum (x # bs) (Add (Mul m t) (Mul n s)) / real (2 * n * m) # bs) p" by simp
  4.3283 +  have Pst2: "Ifm (Inum (x # bs) (Add (Mul m t) (Mul n s)) / real_of_int (2 * n * m) # bs) p" by simp
  4.3284    from conjunct1[OF \<upsilon>_I[OF lp np' tnb', where bs="bs" and x="x"], symmetric] th[simplified split_def fst_conv snd_conv,symmetric] Pst2[simplified st[symmetric]]
  4.3285    have "Ifm (x # bs) (\<upsilon> p (t', n')) " by (simp only: st) 
  4.3286    then show ?rhs using tnU' by auto 
  4.3287 @@ -4991,14 +4968,14 @@
  4.3288    from tnU smU U have tnb: "numbound0 t" and np: "n > 0" 
  4.3289      and snb: "numbound0 s" and mp:"m > 0"  by auto
  4.3290    let ?st= "Add (Mul m t) (Mul n s)"
  4.3291 -  from np mp have mnp: "real (2*n*m) > 0" 
  4.3292 -      by (simp add: mult.commute real_of_int_mult[symmetric] del: real_of_int_mult)
  4.3293 +  from np mp have mnp: "real_of_int (2*n*m) > 0" 
  4.3294 +      by (simp add: mult.commute of_int_mult[symmetric] del: of_int_mult)
  4.3295      from tnb snb have stnb: "numbound0 ?st" by simp
  4.3296 -  have st: "(?N t / real n + ?N s / real m)/2 = ?N ?st / real (2*n*m)"
  4.3297 +  have st: "(?N t / real_of_int n + ?N s / real_of_int m)/2 = ?N ?st / real_of_int (2*n*m)"
  4.3298     using mp np by (simp add: algebra_simps add_divide_distrib)
  4.3299 -  from U' tnU' have tnb': "numbound0 t'" and np': "real n' > 0" by auto
  4.3300 +  from U' tnU' have tnb': "numbound0 t'" and np': "real_of_int n' > 0" by auto
  4.3301    from \<upsilon>_I[OF lp np' tnb', where bs="bs" and x="x",simplified th[simplified split_def fst_conv snd_conv] st] Pt'
  4.3302 -  have Pst2: "Ifm (Inum (x # bs) (Add (Mul m t) (Mul n s)) / real (2 * n * m) # bs) p" by simp
  4.3303 +  have Pst2: "Ifm (Inum (x # bs) (Add (Mul m t) (Mul n s)) / real_of_int (2 * n * m) # bs) p" by simp
  4.3304    with \<upsilon>_I[OF lp mnp stnb, where x="x" and bs="bs"] tnU smU show ?lhs by blast
  4.3305  qed
  4.3306    
  4.3307 @@ -5016,8 +4993,8 @@
  4.3308    let ?S = "map ?g ?Up"
  4.3309    let ?SS = "map simp_num_pair ?S"
  4.3310    let ?Y = "remdups ?SS"
  4.3311 -  let ?f= "(\<lambda> (t,n). ?N t / real n)"
  4.3312 -  let ?h = "\<lambda> ((t,n),(s,m)). (?N t/real n + ?N s/ real m) /2"
  4.3313 +  let ?f= "(\<lambda> (t,n). ?N t / real_of_int n)"
  4.3314 +  let ?h = "\<lambda> ((t,n),(s,m)). (?N t/real_of_int n + ?N s/ real_of_int m) /2"
  4.3315    let ?F = "\<lambda> p. \<exists> a \<in> set (\<Upsilon> p). \<exists> b \<in> set (\<Upsilon> p). ?I x (\<upsilon> p (?g(a,b)))"
  4.3316    let ?ep = "evaldjf (\<upsilon> ?q) ?Y"
  4.3317    from rlfm_l[OF qf] have lq: "isrlfm ?q" 
  4.3318 @@ -5058,7 +5035,7 @@
  4.3319    have "\<forall> (t,n) \<in> set ?Y. bound0 (\<upsilon> ?q (t,n))"
  4.3320    proof-
  4.3321      { fix t n assume tnY: "(t,n) \<in> set ?Y"
  4.3322 -      with Y_l have tnb: "numbound0 t" and np: "real n > 0" by auto
  4.3323 +      with Y_l have tnb: "numbound0 t" and np: "real_of_int n > 0" by auto
  4.3324        from \<upsilon>_I[OF lq np tnb]
  4.3325      have "bound0 (\<upsilon> ?q (t,n))"  by simp}
  4.3326      thus ?thesis by blast
  4.3327 @@ -5080,9 +5057,9 @@
  4.3328  qed
  4.3329  
  4.3330  lemma cp_thm': 
  4.3331 -  assumes lp: "iszlfm p (real (i::int)#bs)"
  4.3332 +  assumes lp: "iszlfm p (real_of_int (i::int)#bs)"
  4.3333    and up: "d_\<beta> p 1" and dd: "d_\<delta> p d" and dp: "d > 0"
  4.3334 -  shows "(\<exists> (x::int). Ifm (real x#bs) p) = ((\<exists> j\<in> {1 .. d}. Ifm (real j#bs) (minusinf p)) \<or> (\<exists> j\<in> {1.. d}. \<exists> b\<in> (Inum (real i#bs)) ` set (\<beta> p). Ifm ((b+real j)#bs) p))"
  4.3335 +  shows "(\<exists> (x::int). Ifm (real_of_int x#bs) p) = ((\<exists> j\<in> {1 .. d}. Ifm (real_of_int j#bs) (minusinf p)) \<or> (\<exists> j\<in> {1.. d}. \<exists> b\<in> (Inum (real_of_int i#bs)) ` set (\<beta> p). Ifm ((b+real_of_int j)#bs) p))"
  4.3336    using cp_thm[OF lp up dd dp] by auto
  4.3337  
  4.3338  definition unit :: "fm \<Rightarrow> fm \<times> num list \<times> int" where
  4.3339 @@ -5091,14 +5068,18 @@
  4.3340               in if length B \<le> length a then (q,B,d) else (mirror q, a,d))"
  4.3341  
  4.3342  lemma unit: assumes qf: "qfree p"
  4.3343 -  shows "\<And> q B d. unit p = (q,B,d) \<Longrightarrow> ((\<exists> (x::int). Ifm (real x#bs) p) = (\<exists> (x::int). Ifm (real x#bs) q)) \<and> (Inum (real i#bs)) ` set B = (Inum (real i#bs)) ` set (\<beta> q) \<and> d_\<beta> q 1 \<and> d_\<delta> q d \<and> d >0 \<and> iszlfm q (real (i::int)#bs) \<and> (\<forall> b\<in> set B. numbound0 b)"
  4.3344 +  shows "\<And> q B d. unit p = (q,B,d) \<Longrightarrow>
  4.3345 +      ((\<exists> (x::int). Ifm (real_of_int x#bs) p) = 
  4.3346 +       (\<exists> (x::int). Ifm (real_of_int x#bs) q)) \<and> 
  4.3347 +       (Inum (real_of_int i#bs)) ` set B = (Inum (real_of_int i#bs)) ` set (\<beta> q) \<and> 
  4.3348 +       d_\<beta> q 1 \<and> d_\<delta> q d \<and> d >0 \<and> iszlfm q (real_of_int (i::int)#bs) \<and> (\<forall> b\<in> set B. numbound0 b)"
  4.3349  proof-
  4.3350    fix q B d 
  4.3351    assume qBd: "unit p = (q,B,d)"
  4.3352 -  let ?thes = "((\<exists> (x::int). Ifm (real x#bs) p) = (\<exists> (x::int). Ifm (real x#bs) q)) \<and>
  4.3353 -    Inum (real i#bs) ` set B = Inum (real i#bs) ` set (\<beta> q) \<and>
  4.3354 -    d_\<beta> q 1 \<and> d_\<delta> q d \<and> 0 < d \<and> iszlfm q (real i # bs) \<and> (\<forall> b\<in> set B. numbound0 b)"
  4.3355 -  let ?I = "\<lambda> (x::int) p. Ifm (real x#bs) p"
  4.3356 +  let ?thes = "((\<exists> (x::int). Ifm (real_of_int x#bs) p) = (\<exists> (x::int). Ifm (real_of_int x#bs) q)) \<and>
  4.3357 +    Inum (real_of_int i#bs) ` set B = Inum (real_of_int i#bs) ` set (\<beta> q) \<and>
  4.3358 +    d_\<beta> q 1 \<and> d_\<delta> q d \<and> 0 < d \<and> iszlfm q (real_of_int i # bs) \<and> (\<forall> b\<in> set B. numbound0 b)"
  4.3359 +  let ?I = "\<lambda> (x::int) p. Ifm (real_of_int x#bs) p"
  4.3360    let ?p' = "zlfm p"
  4.3361    let ?l = "\<zeta> ?p'"
  4.3362    let ?q = "And (Dvd ?l (CN 0 1 (C 0))) (a_\<beta> ?p' ?l)"
  4.3363 @@ -5110,20 +5091,20 @@
  4.3364    from conjunct1[OF zlfm_I[OF qf, where bs="bs"]] 
  4.3365    have pp': "\<forall> i. ?I i ?p' = ?I i p" by auto
  4.3366    from iszlfm_gen[OF conjunct2[OF zlfm_I[OF qf, where bs="bs" and i="i"]]]
  4.3367 -  have lp': "\<forall> (i::int). iszlfm ?p' (real i#bs)" by simp 
  4.3368<