Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
authorpaulson <lp15@cam.ac.uk>
Tue Nov 17 12:32:08 2015 +0000 (2015-11-17)
changeset 616946571c78c9667
parent 61693 f6b9f528c89c
child 61695 df4a03527b56
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
NEWS
src/Doc/Tutorial/Types/Numbers.thy
src/HOL/Decision_Procs/MIR.thy
src/HOL/Decision_Procs/cooper_tac.ML
src/HOL/Decision_Procs/mir_tac.ML
src/HOL/Inequalities.thy
src/HOL/Int.thy
src/HOL/Library/Convex.thy
src/HOL/Limits.thy
src/HOL/Matrix_LP/ComputeNumeral.thy
src/HOL/Multivariate_Analysis/Cauchy_Integral_Thm.thy
src/HOL/Multivariate_Analysis/Complex_Transcendental.thy
src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy
src/HOL/Multivariate_Analysis/Ordered_Euclidean_Space.thy
src/HOL/Multivariate_Analysis/Path_Connected.thy
src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy
src/HOL/Multivariate_Analysis/ex/Approximations.thy
src/HOL/Old_Number_Theory/Fib.thy
src/HOL/Old_Number_Theory/WilsonRuss.thy
src/HOL/Power.thy
src/HOL/Probability/Projective_Limit.thy
src/HOL/Real.thy
src/HOL/Tools/Qelim/cooper.ML
src/HOL/Tools/nat_numeral_simprocs.ML
src/HOL/Tools/numeral_simprocs.ML
src/HOL/Tools/semiring_normalizer.ML
src/HOL/Transcendental.thy
src/HOL/ex/Sum_of_Powers.thy
     1.1 --- a/NEWS	Tue Nov 17 12:01:19 2015 +0100
     1.2 +++ b/NEWS	Tue Nov 17 12:32:08 2015 +0000
     1.3 @@ -406,6 +406,36 @@
     1.4  constant and its defining fact become qualified, e.g. Option.is_none and
     1.5  Option.is_none_def. Occasional INCOMPATIBILITY in applications.
     1.6  
     1.7 +* The coercions to type 'real' have been reorganised. The function 'real'
     1.8 +is no longer overloaded, but has type 'nat => real' and abbreviates
     1.9 +of_nat for that type. Also 'real_of_int :: int => real' abbreviates
    1.10 +of_int for that type. Other overloaded instances of 'real' have been
    1.11 +replaced by 'real_of_ereal' and 'real_of_float'.
    1.12 +Consolidated facts (among others):
    1.13 +  real_of_nat_le_iff -> of_nat_le_iff
    1.14 +  real_of_nat_numeral of_nat_numeral
    1.15 +  real_of_int_zero of_int_0
    1.16 +  real_of_nat_zero of_nat_0
    1.17 +  real_of_one of_int_1
    1.18 +  real_of_int_add of_int_add
    1.19 +  real_of_nat_add of_nat_add
    1.20 +  real_of_int_diff of_int_diff
    1.21 +  real_of_nat_diff of_nat_diff
    1.22 +  floor_subtract floor_diff_of_int
    1.23 +  real_of_int_inject of_int_eq_iff
    1.24 +  real_of_int_gt_zero_cancel_iff of_int_0_less_iff
    1.25 +  real_of_int_ge_zero_cancel_iff of_int_0_le_iff
    1.26 +  real_of_nat_ge_zero of_nat_0_le_iff
    1.27 +  real_of_int_ceiling_ge le_of_int_ceiling
    1.28 +  ceiling_less_eq ceiling_less_iff
    1.29 +  ceiling_le_eq ceiling_le_iff
    1.30 +  less_floor_eq less_floor_iff
    1.31 +  floor_less_eq floor_less_iff
    1.32 +  floor_divide_eq_div floor_divide_of_int_eq
    1.33 +  real_of_int_zero_cancel of_nat_eq_0_iff
    1.34 +  ceiling_real_of_int ceiling_of_int
    1.35 +INCOMPATIBILITY.
    1.36 +
    1.37  * Some old and rarely used ASCII replacement syntax has been removed.
    1.38  INCOMPATIBILITY, standard syntax with symbols should be used instead.
    1.39  The subsequent commands help to reproduce the old forms, e.g. to
     2.1 --- a/src/Doc/Tutorial/Types/Numbers.thy	Tue Nov 17 12:01:19 2015 +0100
     2.2 +++ b/src/Doc/Tutorial/Types/Numbers.thy	Tue Nov 17 12:32:08 2015 +0000
     2.3 @@ -22,8 +22,8 @@
     2.4  *}
     2.5  
     2.6  text{*
     2.7 -@{thm[display] numeral_1_eq_1[no_vars]}
     2.8 -\rulename{numeral_1_eq_1}
     2.9 +@{thm[display] numeral_One[no_vars]}
    2.10 +\rulename{numeral_One}
    2.11  
    2.12  @{thm[display] add_2_eq_Suc[no_vars]}
    2.13  \rulename{add_2_eq_Suc}
     3.1 --- a/src/HOL/Decision_Procs/MIR.thy	Tue Nov 17 12:01:19 2015 +0100
     3.2 +++ b/src/HOL/Decision_Procs/MIR.thy	Tue Nov 17 12:32:08 2015 +0000
     3.3 @@ -28,15 +28,15 @@
     3.4  definition rdvd:: "real \<Rightarrow> real \<Rightarrow> bool" (infixl "rdvd" 50)
     3.5    where "x rdvd y \<longleftrightarrow> (\<exists>k::int. y = x * real_of_int k)"
     3.6  
     3.7 -lemma int_rdvd_real: 
     3.8 +lemma int_rdvd_real:
     3.9    "real_of_int (i::int) rdvd x = (i dvd (floor x) \<and> real_of_int (floor x) = x)" (is "?l = ?r")
    3.10  proof
    3.11 -  assume "?l" 
    3.12 +  assume "?l"
    3.13    hence th: "\<exists> k. x=real_of_int (i*k)" by (simp add: rdvd_def)
    3.14    hence th': "real_of_int (floor x) = x" by (auto simp del: of_int_mult)
    3.15    with th have "\<exists> k. real_of_int (floor x) = real_of_int (i*k)" by simp
    3.16    hence "\<exists> k. floor x = i*k" by presburger
    3.17 -  thus ?r  using th' by (simp add: dvd_def) 
    3.18 +  thus ?r  using th' by (simp add: dvd_def)
    3.19  next
    3.20    assume "?r" hence "(i::int) dvd \<lfloor>x::real\<rfloor>" ..
    3.21    hence "\<exists> k. real_of_int (floor x) = real_of_int (i*k)"
    3.22 @@ -55,7 +55,7 @@
    3.23      by auto
    3.24  
    3.25    from iffD2[OF abs_dvd_iff] d2 have "(abs d) dvd (floor t)" by blast
    3.26 -  with ti int_rdvd_real[symmetric] have "real_of_int (abs d) rdvd t" by blast 
    3.27 +  with ti int_rdvd_real[symmetric] have "real_of_int (abs d) rdvd t" by blast
    3.28    thus "abs (real_of_int d) rdvd t" by simp
    3.29  next
    3.30    assume "abs (real_of_int d) rdvd t" hence "real_of_int (abs d) rdvd t" by simp
    3.31 @@ -67,14 +67,14 @@
    3.32  
    3.33  lemma rdvd_minus: "(real_of_int (d::int) rdvd t) = (real_of_int d rdvd -t)"
    3.34    apply (auto simp add: rdvd_def)
    3.35 -  apply (rule_tac x="-k" in exI, simp) 
    3.36 +  apply (rule_tac x="-k" in exI, simp)
    3.37    apply (rule_tac x="-k" in exI, simp)
    3.38    done
    3.39  
    3.40  lemma rdvd_left_0_eq: "(0 rdvd t) = (t=0)"
    3.41    by (auto simp add: rdvd_def)
    3.42  
    3.43 -lemma rdvd_mult: 
    3.44 +lemma rdvd_mult:
    3.45    assumes knz: "k\<noteq>0"
    3.46    shows "(real_of_int (n::int) * real_of_int (k::int) rdvd x * real_of_int k) = (real_of_int n rdvd x)"
    3.47    using knz by (simp add: rdvd_def)
    3.48 @@ -83,7 +83,7 @@
    3.49    (****                            SHADOW SYNTAX AND SEMANTICS                  ****)
    3.50    (*********************************************************************************)
    3.51  
    3.52 -datatype num = C int | Bound nat | CN nat int num | Neg num | Add num num| Sub num num 
    3.53 +datatype num = C int | Bound nat | CN nat int num | Neg num | Add num num| Sub num num
    3.54    | Mul int num | Floor num| CF int num num
    3.55  
    3.56    (* A size for num to make inductive proofs simpler*)
    3.57 @@ -132,17 +132,17 @@
    3.58  proof-
    3.59    let ?I = "\<lambda> t. Inum bs t"
    3.60    assume ie: "isint e bs"
    3.61 -  hence th: "real_of_int (floor (?I e)) = ?I e" by (simp add: isint_def)  
    3.62 +  hence th: "real_of_int (floor (?I e)) = ?I e" by (simp add: isint_def)
    3.63    have "real_of_int (floor (?I (Neg e))) = real_of_int (floor (- (real_of_int (floor (?I e)))))" by (simp add: th)
    3.64    also have "\<dots> = - real_of_int (floor (?I e))" by simp
    3.65    finally show "isint (Neg e) bs" by (simp add: isint_def th)
    3.66  qed
    3.67  
    3.68 -lemma isint_sub: 
    3.69 +lemma isint_sub:
    3.70    assumes ie: "isint e bs" shows "isint (Sub (C c) e) bs"
    3.71  proof-
    3.72    let ?I = "\<lambda> t. Inum bs t"
    3.73 -  from ie have th: "real_of_int (floor (?I e)) = ?I e" by (simp add: isint_def)  
    3.74 +  from ie have th: "real_of_int (floor (?I e)) = ?I e" by (simp add: isint_def)
    3.75    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)
    3.76    also have "\<dots> = real_of_int (c- floor (?I e))" by simp
    3.77    finally show "isint (Sub (C c) e) bs" by (simp add: isint_def th)
    3.78 @@ -166,7 +166,7 @@
    3.79  
    3.80  
    3.81      (* FORMULAE *)
    3.82 -datatype fm  = 
    3.83 +datatype fm  =
    3.84    T| F| Lt num| Le num| Gt num| Ge num| Eq num| NEq num| Dvd int num| NDvd int num|
    3.85    NOT fm| And fm fm|  Or fm fm| Imp fm fm| Iff fm fm| E fm| A fm
    3.86  
    3.87 @@ -213,7 +213,7 @@
    3.88    "prep (E F) = F"
    3.89    "prep (E (Or p q)) = Or (prep (E p)) (prep (E q))"
    3.90    "prep (E (Imp p q)) = Or (prep (E (NOT p))) (prep (E q))"
    3.91 -  "prep (E (Iff p q)) = Or (prep (E (And p q))) (prep (E (And (NOT p) (NOT q))))" 
    3.92 +  "prep (E (Iff p q)) = Or (prep (E (And p q))) (prep (E (And (NOT p) (NOT q))))"
    3.93    "prep (E (NOT (And p q))) = Or (prep (E (NOT p))) (prep (E(NOT q)))"
    3.94    "prep (E (NOT (Imp p q))) = prep (E (And p (NOT q)))"
    3.95    "prep (E (NOT (Iff p q))) = Or (prep (E (And p (NOT q)))) (prep (E(And (NOT p) q)))"
    3.96 @@ -241,10 +241,10 @@
    3.97  fun qfree:: "fm \<Rightarrow> bool" where
    3.98    "qfree (E p) = False"
    3.99    | "qfree (A p) = False"
   3.100 -  | "qfree (NOT p) = qfree p" 
   3.101 -  | "qfree (And p q) = (qfree p \<and> qfree q)" 
   3.102 -  | "qfree (Or  p q) = (qfree p \<and> qfree q)" 
   3.103 -  | "qfree (Imp p q) = (qfree p \<and> qfree q)" 
   3.104 +  | "qfree (NOT p) = qfree p"
   3.105 +  | "qfree (And p q) = (qfree p \<and> qfree q)"
   3.106 +  | "qfree (Or  p q) = (qfree p \<and> qfree q)"
   3.107 +  | "qfree (Imp p q) = (qfree p \<and> qfree q)"
   3.108    | "qfree (Iff p q) = (qfree p \<and> qfree q)"
   3.109    | "qfree p = True"
   3.110  
   3.111 @@ -255,20 +255,20 @@
   3.112    | "numbound0 (CN n i a) = (n > 0 \<and> numbound0 a)"
   3.113    | "numbound0 (Neg a) = numbound0 a"
   3.114    | "numbound0 (Add a b) = (numbound0 a \<and> numbound0 b)"
   3.115 -  | "numbound0 (Sub a b) = (numbound0 a \<and> numbound0 b)" 
   3.116 +  | "numbound0 (Sub a b) = (numbound0 a \<and> numbound0 b)"
   3.117    | "numbound0 (Mul i a) = numbound0 a"
   3.118    | "numbound0 (Floor a) = numbound0 a"
   3.119 -  | "numbound0 (CF c a b) = (numbound0 a \<and> numbound0 b)" 
   3.120 +  | "numbound0 (CF c a b) = (numbound0 a \<and> numbound0 b)"
   3.121  
   3.122  lemma numbound0_I:
   3.123    assumes nb: "numbound0 a"
   3.124    shows "Inum (b#bs) a = Inum (b'#bs) a"
   3.125    using nb by (induct a) auto
   3.126  
   3.127 -lemma numbound0_gen: 
   3.128 +lemma numbound0_gen:
   3.129    assumes nb: "numbound0 t" and ti: "isint t (x#bs)"
   3.130    shows "\<forall> y. isint t (y#bs)"
   3.131 -  using nb ti 
   3.132 +  using nb ti
   3.133  proof(clarify)
   3.134    fix y
   3.135    from numbound0_I[OF nb, where bs="bs" and b="y" and b'="x"] ti[simplified isint_def]
   3.136 @@ -308,7 +308,7 @@
   3.137    | "numsubst0 t (CF i a b) = CF i (numsubst0 t a) (numsubst0 t b)"
   3.138    | "numsubst0 t (Neg a) = Neg (numsubst0 t a)"
   3.139    | "numsubst0 t (Add a b) = Add (numsubst0 t a) (numsubst0 t b)"
   3.140 -  | "numsubst0 t (Sub a b) = Sub (numsubst0 t a) (numsubst0 t b)" 
   3.141 +  | "numsubst0 t (Sub a b) = Sub (numsubst0 t a) (numsubst0 t b)"
   3.142    | "numsubst0 t (Mul i a) = Mul i (numsubst0 t a)"
   3.143    | "numsubst0 t (Floor a) = Floor (numsubst0 t a)"
   3.144  
   3.145 @@ -358,7 +358,7 @@
   3.146  | "decr (NEq a) = NEq (decrnum a)"
   3.147  | "decr (Dvd i a) = Dvd i (decrnum a)"
   3.148  | "decr (NDvd i a) = NDvd i (decrnum a)"
   3.149 -| "decr (NOT p) = NOT (decr p)" 
   3.150 +| "decr (NOT p) = NOT (decr p)"
   3.151  | "decr (And p q) = And (decr p) (decr q)"
   3.152  | "decr (Or p q) = Or (decr p) (decr q)"
   3.153  | "decr (Imp p q) = Imp (decr p) (decr q)"
   3.154 @@ -404,20 +404,20 @@
   3.155  
   3.156  
   3.157  definition djf:: "('a \<Rightarrow> fm) \<Rightarrow> 'a \<Rightarrow> fm \<Rightarrow> fm" where
   3.158 -  "djf f p q = (if q=T then T else if q=F then f p else 
   3.159 +  "djf f p q = (if q=T then T else if q=F then f p else
   3.160    (let fp = f p in case fp of T \<Rightarrow> T | F \<Rightarrow> q | _ \<Rightarrow> Or fp q))"
   3.161  
   3.162  definition evaldjf:: "('a \<Rightarrow> fm) \<Rightarrow> 'a list \<Rightarrow> fm" where
   3.163    "evaldjf f ps = foldr (djf f) ps F"
   3.164  
   3.165  lemma djf_Or: "Ifm bs (djf f p q) = Ifm bs (Or (f p) q)"
   3.166 -  by (cases "q=T", simp add: djf_def,cases "q=F",simp add: djf_def) 
   3.167 -  (cases "f p", simp_all add: Let_def djf_def) 
   3.168 +  by (cases "q=T", simp add: djf_def,cases "q=F",simp add: djf_def)
   3.169 +  (cases "f p", simp_all add: Let_def djf_def)
   3.170  
   3.171  lemma evaldjf_ex: "Ifm bs (evaldjf f ps) = (\<exists> p \<in> set ps. Ifm bs (f p))"
   3.172    by (induct ps) (simp_all add: evaldjf_def djf_Or)
   3.173  
   3.174 -lemma evaldjf_bound0: 
   3.175 +lemma evaldjf_bound0:
   3.176    assumes nb: "\<forall> x\<in> set xs. bound0 (f x)"
   3.177    shows "bound0 (evaldjf f xs)"
   3.178    using nb
   3.179 @@ -427,7 +427,7 @@
   3.180    apply auto
   3.181    done
   3.182  
   3.183 -lemma evaldjf_qf: 
   3.184 +lemma evaldjf_qf:
   3.185    assumes nb: "\<forall> x\<in> set xs. qfree (f x)"
   3.186    shows "qfree (evaldjf f xs)"
   3.187    using nb
   3.188 @@ -474,12 +474,12 @@
   3.189    shows "Ifm bs (DJ f p) = Ifm bs (f p)"
   3.190  proof -
   3.191    have "Ifm bs (DJ f p) = (\<exists> q \<in> set (disjuncts p). Ifm bs (f q))"
   3.192 -    by (simp add: DJ_def evaldjf_ex) 
   3.193 +    by (simp add: DJ_def evaldjf_ex)
   3.194    also have "\<dots> = Ifm bs (f p)" using fdj fF by (induct p rule: disjuncts.induct, auto)
   3.195    finally show ?thesis .
   3.196  qed
   3.197  
   3.198 -lemma DJ_qf: assumes 
   3.199 +lemma DJ_qf: assumes
   3.200    fqf: "\<forall> p. qfree p \<longrightarrow> qfree (f p)"
   3.201    shows "\<forall>p. qfree p \<longrightarrow> qfree (DJ f p) "
   3.202  proof(clarify)
   3.203 @@ -487,7 +487,7 @@
   3.204    have th: "DJ f p = evaldjf f (disjuncts p)" by (simp add: DJ_def)
   3.205    from disjuncts_qf[OF qf] have "\<forall> q\<in> set (disjuncts p). qfree q" .
   3.206    with fqf have th':"\<forall> q\<in> set (disjuncts p). qfree (f q)" by blast
   3.207 -  
   3.208 +
   3.209    from evaldjf_qf[OF th'] th show "qfree (DJ f p)" by simp
   3.210  qed
   3.211  
   3.212 @@ -551,7 +551,7 @@
   3.213  definition reducecoeff :: "num \<Rightarrow> num"
   3.214  where
   3.215    "reducecoeff t =
   3.216 -    (let g = numgcd t in 
   3.217 +    (let g = numgcd t in
   3.218       if g = 0 then C 0 else if g=1 then t else reducecoeffh t g)"
   3.219  
   3.220  fun dvdnumcoeff:: "num \<Rightarrow> int \<Rightarrow> bool" where
   3.221 @@ -560,10 +560,10 @@
   3.222  | "dvdnumcoeff (CF c s t) = (\<lambda> g. g dvd c \<and> (dvdnumcoeff t g))"
   3.223  | "dvdnumcoeff t = (\<lambda>g. False)"
   3.224  
   3.225 -lemma dvdnumcoeff_trans: 
   3.226 +lemma dvdnumcoeff_trans:
   3.227    assumes gdg: "g dvd g'" and dgt':"dvdnumcoeff t g'"
   3.228    shows "dvdnumcoeff t g"
   3.229 -  using dgt' gdg 
   3.230 +  using dgt' gdg
   3.231    by (induct t rule: dvdnumcoeff.induct) (simp_all add: gdg dvd_trans[OF gdg])
   3.232  
   3.233  declare dvd_trans [trans add]
   3.234 @@ -584,10 +584,10 @@
   3.235    by (simp add: numgcd_def numgcdh_pos maxcoeff_pos)
   3.236  
   3.237  lemma reducecoeffh:
   3.238 -  assumes gt: "dvdnumcoeff t g" and gp: "g > 0" 
   3.239 +  assumes gt: "dvdnumcoeff t g" and gp: "g > 0"
   3.240    shows "real_of_int g *(Inum bs (reducecoeffh t g)) = Inum bs t"
   3.241    using gt
   3.242 -proof(induct t rule: reducecoeffh.induct) 
   3.243 +proof(induct t rule: reducecoeffh.induct)
   3.244    case (1 i) hence gd: "g dvd i" by simp
   3.245    from assms 1 show ?case by (simp add: real_of_int_div[OF gd])
   3.246  next
   3.247 @@ -595,7 +595,7 @@
   3.248    from assms 2 show ?case by (simp add: real_of_int_div[OF gd] algebra_simps)
   3.249  next
   3.250    case (3 c s t)  hence gd: "g dvd c" by simp
   3.251 -  from assms 3 show ?case by (simp add: real_of_int_div[OF gd] algebra_simps) 
   3.252 +  from assms 3 show ?case by (simp add: real_of_int_div[OF gd] algebra_simps)
   3.253  qed (auto simp add: numgcd_def gp)
   3.254  
   3.255  fun ismaxcoeff:: "num \<Rightarrow> int \<Rightarrow> bool" where
   3.256 @@ -614,7 +614,7 @@
   3.257    have thh: "maxcoeff t \<le> max (abs c) (maxcoeff t)" by simp
   3.258    from ismaxcoeff_mono[OF H thh] show ?case by simp
   3.259  next
   3.260 -  case (3 c t s) 
   3.261 +  case (3 c t s)
   3.262    hence H1:"ismaxcoeff s (maxcoeff s)" by auto
   3.263    have thh1: "maxcoeff s \<le> max \<bar>c\<bar> (maxcoeff s)" by (simp add: max_def)
   3.264    from ismaxcoeff_mono[OF H1 thh1] show ?case by simp
   3.265 @@ -637,7 +637,7 @@
   3.266    shows "dvdnumcoeff t (numgcdh t m)"
   3.267  using assms
   3.268  proof(induct t rule: numgcdh.induct)
   3.269 -  case (2 n c t) 
   3.270 +  case (2 n c t)
   3.271    let ?g = "numgcdh t m"
   3.272    from 2 have th:"gcd c ?g > 1" by simp
   3.273    from zgcd_gt1[OF th] numgcdh_pos[OF mp, where t="t"]
   3.274 @@ -651,11 +651,11 @@
   3.275      have th': "gcd c ?g dvd ?g" by simp
   3.276      from dvdnumcoeff_trans[OF th' th] have ?case by simp
   3.277      hence ?case by simp }
   3.278 -  moreover {assume "abs c > 1" and g0:"?g = 0" 
   3.279 +  moreover {assume "abs c > 1" and g0:"?g = 0"
   3.280      from numgcdh0[OF g0] have "m=0". with 2 g0 have ?case by simp }
   3.281    ultimately show ?case by blast
   3.282  next
   3.283 -  case (3 c s t) 
   3.284 +  case (3 c s t)
   3.285    let ?g = "numgcdh t m"
   3.286    from 3 have th:"gcd c ?g > 1" by simp
   3.287    from zgcd_gt1[OF th] numgcdh_pos[OF mp, where t="t"]
   3.288 @@ -669,14 +669,14 @@
   3.289      have th': "gcd c ?g dvd ?g" by simp
   3.290      from dvdnumcoeff_trans[OF th' th] have ?case by simp
   3.291      hence ?case by simp }
   3.292 -  moreover {assume "abs c > 1" and g0:"?g = 0" 
   3.293 +  moreover {assume "abs c > 1" and g0:"?g = 0"
   3.294      from numgcdh0[OF g0] have "m=0". with 3 g0 have ?case by simp }
   3.295    ultimately show ?case by blast
   3.296  qed auto
   3.297  
   3.298  lemma dvdnumcoeff_aux2:
   3.299    assumes "numgcd t > 1" shows "dvdnumcoeff t (numgcd t) \<and> numgcd t > 0"
   3.300 -  using assms 
   3.301 +  using assms
   3.302  proof (simp add: numgcd_def)
   3.303    let ?mc = "maxcoeff t"
   3.304    let ?g = "numgcdh t ?mc"
   3.305 @@ -691,12 +691,12 @@
   3.306    let ?g = "numgcd t"
   3.307    have "?g \<ge> 0"  by (simp add: numgcd_pos)
   3.308    hence "?g = 0 \<or> ?g = 1 \<or> ?g > 1" by auto
   3.309 -  moreover {assume "?g = 0" hence ?thesis by (simp add: numgcd0)} 
   3.310 -  moreover {assume "?g = 1" hence ?thesis by (simp add: reducecoeff_def)} 
   3.311 +  moreover {assume "?g = 0" hence ?thesis by (simp add: numgcd0)}
   3.312 +  moreover {assume "?g = 1" hence ?thesis by (simp add: reducecoeff_def)}
   3.313    moreover { assume g1:"?g > 1"
   3.314      from dvdnumcoeff_aux2[OF g1] have th1:"dvdnumcoeff t ?g" and g0: "?g > 0" by blast+
   3.315 -    from reducecoeffh[OF th1 g0, where bs="bs"] g1 have ?thesis 
   3.316 -      by (simp add: reducecoeff_def Let_def)} 
   3.317 +    from reducecoeffh[OF th1 g0, where bs="bs"] g1 have ?thesis
   3.318 +      by (simp add: reducecoeff_def Let_def)}
   3.319    ultimately show ?thesis by blast
   3.320  qed
   3.321  
   3.322 @@ -709,15 +709,15 @@
   3.323  consts numadd:: "num \<times> num \<Rightarrow> num"
   3.324  recdef numadd "measure (\<lambda> (t,s). size t + size s)"
   3.325    "numadd (CN n1 c1 r1,CN n2 c2 r2) =
   3.326 -  (if n1=n2 then 
   3.327 +  (if n1=n2 then
   3.328    (let c = c1 + c2
   3.329    in (if c=0 then numadd(r1,r2) else CN n1 c (numadd (r1,r2))))
   3.330    else if n1 \<le> n2 then CN n1 c1 (numadd (r1,CN n2 c2 r2))
   3.331    else (CN n2 c2 (numadd (CN n1 c1 r1,r2))))"
   3.332 -  "numadd (CN n1 c1 r1,t) = CN n1 c1 (numadd (r1, t))"  
   3.333 -  "numadd (t,CN n2 c2 r2) = CN n2 c2 (numadd (t,r2))" 
   3.334 -  "numadd (CF c1 t1 r1,CF c2 t2 r2) = 
   3.335 -   (if t1 = t2 then 
   3.336 +  "numadd (CN n1 c1 r1,t) = CN n1 c1 (numadd (r1, t))"
   3.337 +  "numadd (t,CN n2 c2 r2) = CN n2 c2 (numadd (t,r2))"
   3.338 +  "numadd (CF c1 t1 r1,CF c2 t2 r2) =
   3.339 +   (if t1 = t2 then
   3.340      (let c=c1+c2; s= numadd(r1,r2) in (if c=0 then s else CF c t1 s))
   3.341     else if lex_bnd t1 t2 then CF c1 t1 (numadd(r1,CF c2 t2 r2))
   3.342     else CF c2 t2 (numadd(CF c1 t1 r1,r2)))"
   3.343 @@ -775,7 +775,7 @@
   3.344  lemma isint_CF: assumes si: "isint s bs" shows "isint (CF c t s) bs"
   3.345  proof-
   3.346    have cti: "isint (Mul c (Floor t)) bs" by (simp add: isint_Mul isint_Floor)
   3.347 -  
   3.348 +
   3.349    have "?thesis = isint (Add (Mul c (Floor t)) s) bs" by (simp add: isint_def)
   3.350    also have "\<dots>" by (simp add: isint_add cti si)
   3.351    finally show ?thesis .
   3.352 @@ -783,11 +783,11 @@
   3.353  
   3.354  fun split_int:: "num \<Rightarrow> num \<times> num" where
   3.355    "split_int (C c) = (C 0, C c)"
   3.356 -| "split_int (CN n c b) = 
   3.357 -     (let (bv,bi) = split_int b 
   3.358 +| "split_int (CN n c b) =
   3.359 +     (let (bv,bi) = split_int b
   3.360         in (CN n c bv, bi))"
   3.361 -| "split_int (CF c a b) = 
   3.362 -     (let (bv,bi) = split_int b 
   3.363 +| "split_int (CF c a b) =
   3.364 +     (let (bv,bi) = split_int b
   3.365         in (bv, CF c a bi))"
   3.366  | "split_int a = (a,C 0)"
   3.367  
   3.368 @@ -801,7 +801,7 @@
   3.369    from 2(2) have tibi: "ti = ?bi" by (simp add: Let_def split_def)
   3.370    from 2(2) b[symmetric] bii show ?case by (auto simp add: Let_def split_def)
   3.371  next
   3.372 -  case (3 c a b tv ti) 
   3.373 +  case (3 c a b tv ti)
   3.374    let ?bv = "fst (split_int b)"
   3.375    let ?bi = "snd (split_int b)"
   3.376    have "split_int b = (?bv,?bi)" by simp
   3.377 @@ -817,8 +817,8 @@
   3.378  
   3.379  definition numfloor:: "num \<Rightarrow> num"
   3.380  where
   3.381 -  "numfloor t = (let (tv,ti) = split_int t in 
   3.382 -  (case tv of C i \<Rightarrow> numadd (tv,ti) 
   3.383 +  "numfloor t = (let (tv,ti) = split_int t in
   3.384 +  (case tv of C i \<Rightarrow> numadd (tv,ti)
   3.385    | _ \<Rightarrow> numadd(CF 1 tv (C 0),ti)))"
   3.386  
   3.387  lemma numfloor[simp]: "Inum bs (numfloor t) = Inum bs (Floor t)" (is "?n t = ?N (Floor t)")
   3.388 @@ -827,17 +827,17 @@
   3.389    let ?ti = "snd (split_int t)"
   3.390    have tvti:"split_int t = (?tv,?ti)" by simp
   3.391    {assume H: "\<forall> v. ?tv \<noteq> C v"
   3.392 -    hence th1: "?n t = ?N (Add (Floor ?tv) ?ti)" 
   3.393 +    hence th1: "?n t = ?N (Add (Floor ?tv) ?ti)"
   3.394        by (cases ?tv) (auto simp add: numfloor_def Let_def split_def)
   3.395      from split_int[OF tvti] have "?N (Floor t) = ?N (Floor(Add ?tv ?ti))" and tii:"isint ?ti bs" by simp+
   3.396 -    hence "?N (Floor t) = real_of_int (floor (?N (Add ?tv ?ti)))" by simp 
   3.397 +    hence "?N (Floor t) = real_of_int (floor (?N (Add ?tv ?ti)))" by simp
   3.398      also have "\<dots> = real_of_int (floor (?N ?tv) + (floor (?N ?ti)))"
   3.399        by (simp,subst tii[simplified isint_iff, symmetric]) simp
   3.400      also have "\<dots> = ?N (Add (Floor ?tv) ?ti)" by (simp add: tii[simplified isint_iff])
   3.401      finally have ?thesis using th1 by simp}
   3.402 -  moreover {fix v assume H:"?tv = C v" 
   3.403 +  moreover {fix v assume H:"?tv = C v"
   3.404      from split_int[OF tvti] have "?N (Floor t) = ?N (Floor(Add ?tv ?ti))" and tii:"isint ?ti bs" by simp+
   3.405 -    hence "?N (Floor t) = real_of_int (floor (?N (Add ?tv ?ti)))" by simp 
   3.406 +    hence "?N (Floor t) = real_of_int (floor (?N (Add ?tv ?ti)))" by simp
   3.407      also have "\<dots> = real_of_int (floor (?N ?tv) + (floor (?N ?ti)))"
   3.408        by (simp,subst tii[simplified isint_iff, symmetric]) simp
   3.409      also have "\<dots> = ?N (Add (Floor ?tv) ?ti)" by (simp add: tii[simplified isint_iff])
   3.410 @@ -906,7 +906,7 @@
   3.411    with cnz have "max (abs c) (maxcoeff t) > 0" by arith
   3.412    with 2 show ?case by simp
   3.413  next
   3.414 -  case (3 c s t) 
   3.415 +  case (3 c s t)
   3.416    hence cnz: "c \<noteq>0" and mx: "max (abs c) (maxcoeff t) = 0" by simp+
   3.417    have "max (abs c) (maxcoeff t) \<ge> abs c" by simp
   3.418    with cnz have "max (abs c) (maxcoeff t) > 0" by arith
   3.419 @@ -922,10 +922,10 @@
   3.420  
   3.421  definition simp_num_pair :: "(num \<times> int) \<Rightarrow> num \<times> int" where
   3.422    "simp_num_pair \<equiv> (\<lambda> (t,n). (if n = 0 then (C 0, 0) else
   3.423 -   (let t' = simpnum t ; g = numgcd t' in 
   3.424 -      if g > 1 then (let g' = gcd n g in 
   3.425 -        if g' = 1 then (t',n) 
   3.426 -        else (reducecoeffh t' g', n div g')) 
   3.427 +   (let t' = simpnum t ; g = numgcd t' in
   3.428 +      if g > 1 then (let g' = gcd n g in
   3.429 +        if g' = 1 then (t',n)
   3.430 +        else (reducecoeffh t' g', n div g'))
   3.431        else (t',n))))"
   3.432  
   3.433  lemma simp_num_pair_ci:
   3.434 @@ -952,7 +952,7 @@
   3.435          have gpdg: "?g' dvd ?g" by simp
   3.436          have gpdd: "?g' dvd n" by simp
   3.437          have gpdgp: "?g' dvd ?g'" by simp
   3.438 -        from reducecoeffh[OF dvdnumcoeff_trans[OF gpdg th1] g'p] 
   3.439 +        from reducecoeffh[OF dvdnumcoeff_trans[OF gpdg th1] g'p]
   3.440          have th2:"real_of_int ?g' * ?t = Inum bs ?t'" by simp
   3.441          from nnz g1 g'1 have "?lhs = ?t / real_of_int (n div ?g')" by (simp add: simp_num_pair_def Let_def)
   3.442          also have "\<dots> = (real_of_int ?g' * ?t) / (real_of_int ?g' * (real_of_int (n div ?g')))" by simp
   3.443 @@ -993,7 +993,7 @@
   3.444          hence ?thesis using assms g1 g'1
   3.445            by(auto simp add: simp_num_pair_def Let_def reducecoeffh_numbound0)}
   3.446        ultimately have ?thesis by blast }
   3.447 -    ultimately have ?thesis by blast } 
   3.448 +    ultimately have ?thesis by blast }
   3.449    ultimately show ?thesis by blast
   3.450  qed
   3.451  
   3.452 @@ -1020,29 +1020,29 @@
   3.453    by (induct p) auto
   3.454  
   3.455  definition conj :: "fm \<Rightarrow> fm \<Rightarrow> fm" where
   3.456 -  "conj p q \<equiv> (if (p = F \<or> q=F) then F else if p=T then q else if q=T then p else 
   3.457 +  "conj p q \<equiv> (if (p = F \<or> q=F) then F else if p=T then q else if q=T then p else
   3.458     if p = q then p else And p q)"
   3.459  lemma conj[simp]: "Ifm bs (conj p q) = Ifm bs (And p q)"
   3.460    by (cases "p=F \<or> q=F", simp_all add: conj_def) (cases p, simp_all)
   3.461  
   3.462  lemma conj_qf[simp]: "\<lbrakk>qfree p ; qfree q\<rbrakk> \<Longrightarrow> qfree (conj p q)"
   3.463 -  using conj_def by auto 
   3.464 +  using conj_def by auto
   3.465  lemma conj_nb[simp]: "\<lbrakk>bound0 p ; bound0 q\<rbrakk> \<Longrightarrow> bound0 (conj p q)"
   3.466 -  using conj_def by auto 
   3.467 +  using conj_def by auto
   3.468  
   3.469  definition disj :: "fm \<Rightarrow> fm \<Rightarrow> fm" where
   3.470 -  "disj p q \<equiv> (if (p = T \<or> q=T) then T else if p=F then q else if q=F then p 
   3.471 +  "disj p q \<equiv> (if (p = T \<or> q=T) then T else if p=F then q else if q=F then p
   3.472         else if p=q then p else Or p q)"
   3.473  
   3.474  lemma disj[simp]: "Ifm bs (disj p q) = Ifm bs (Or p q)"
   3.475    by (cases "p=T \<or> q=T",simp_all add: disj_def) (cases p,simp_all)
   3.476  lemma disj_qf[simp]: "\<lbrakk>qfree p ; qfree q\<rbrakk> \<Longrightarrow> qfree (disj p q)"
   3.477 -  using disj_def by auto 
   3.478 +  using disj_def by auto
   3.479  lemma disj_nb[simp]: "\<lbrakk>bound0 p ; bound0 q\<rbrakk> \<Longrightarrow> bound0 (disj p q)"
   3.480 -  using disj_def by auto 
   3.481 +  using disj_def by auto
   3.482  
   3.483  definition imp :: "fm \<Rightarrow> fm \<Rightarrow> fm" where
   3.484 -  "imp p q \<equiv> (if (p = F \<or> q=T \<or> p=q) then T else if p=T then q else if q=F then not p 
   3.485 +  "imp p q \<equiv> (if (p = F \<or> q=T \<or> p=q) then T else if p=T then q else if q=F then not p
   3.486      else Imp p q)"
   3.487  lemma imp[simp]: "Ifm bs (imp p q) = Ifm bs (Imp p q)"
   3.488    by (cases "p=F \<or> q=T",simp_all add: imp_def)
   3.489 @@ -1050,8 +1050,8 @@
   3.490    using imp_def by (cases "p=F \<or> q=T",simp_all add: imp_def)
   3.491  
   3.492  definition iff :: "fm \<Rightarrow> fm \<Rightarrow> fm" where
   3.493 -  "iff p q \<equiv> (if (p = q) then T else if (p = not q \<or> not p = q) then F else 
   3.494 -       if p=F then not q else if q=F then not p else if p=T then q else if q=T then p else 
   3.495 +  "iff p q \<equiv> (if (p = q) then T else if (p = not q \<or> not p = q) then F else
   3.496 +       if p=F then not q else if q=F then not p else if p=T then q else if q=T then p else
   3.497    Iff p q)"
   3.498  
   3.499  lemma iff[simp]: "Ifm bs (iff p q) = Ifm bs (Iff p q)"
   3.500 @@ -1074,7 +1074,7 @@
   3.501  lemma rdvd_left1_int: "real_of_int \<lfloor>t\<rfloor> = t \<Longrightarrow> 1 rdvd t"
   3.502    by (simp add: rdvd_def,rule_tac x="\<lfloor>t\<rfloor>" in exI) simp
   3.503  
   3.504 -lemma rdvd_reduce: 
   3.505 +lemma rdvd_reduce:
   3.506    assumes gd:"g dvd d" and gc:"g dvd c" and gp: "g > 0"
   3.507    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)"
   3.508  proof
   3.509 @@ -1095,13 +1095,13 @@
   3.510  qed
   3.511  
   3.512  definition simpdvd :: "int \<Rightarrow> num \<Rightarrow> (int \<times> num)" where
   3.513 -  "simpdvd d t \<equiv> 
   3.514 -   (let g = numgcd t in 
   3.515 -      if g > 1 then (let g' = gcd d g in 
   3.516 -        if g' = 1 then (d, t) 
   3.517 -        else (d div g',reducecoeffh t g')) 
   3.518 +  "simpdvd d t \<equiv>
   3.519 +   (let g = numgcd t in
   3.520 +      if g > 1 then (let g' = gcd d g in
   3.521 +        if g' = 1 then (d, t)
   3.522 +        else (d div g',reducecoeffh t g'))
   3.523        else (d, t))"
   3.524 -lemma simpdvd: 
   3.525 +lemma simpdvd:
   3.526    assumes tnz: "nozerocoeff t" and dnz: "d \<noteq> 0"
   3.527    shows "Ifm bs (Dvd (fst (simpdvd d t)) (snd (simpdvd d t))) = Ifm bs (Dvd d t)"
   3.528  proof-
   3.529 @@ -1121,13 +1121,13 @@
   3.530        have gpdg: "?g' dvd ?g" by simp
   3.531        have gpdd: "?g' dvd d" by simp
   3.532        have gpdgp: "?g' dvd ?g'" by simp
   3.533 -      from reducecoeffh[OF dvdnumcoeff_trans[OF gpdg th1] g'p] 
   3.534 +      from reducecoeffh[OF dvdnumcoeff_trans[OF gpdg th1] g'p]
   3.535        have th2:"real_of_int ?g' * ?t = Inum bs t" by simp
   3.536        from assms g1 g0 g'1
   3.537        have "Ifm bs (Dvd (fst (simpdvd d t)) (snd(simpdvd d t))) = Ifm bs (Dvd (d div ?g') ?tt)"
   3.538          by (simp add: simpdvd_def Let_def)
   3.539        also have "\<dots> = (real_of_int d rdvd (Inum bs t))"
   3.540 -        using rdvd_reduce[OF gpdd gpdgp g'p, where t="?t", simplified div_self[OF gp0]] 
   3.541 +        using rdvd_reduce[OF gpdd gpdgp g'p, where t="?t", simplified div_self[OF gp0]]
   3.542            th2[symmetric] by simp
   3.543        finally have ?thesis by simp  }
   3.544      ultimately have ?thesis by blast
   3.545 @@ -1141,7 +1141,7 @@
   3.546  | "simpfm (Imp p q) = imp (simpfm p) (simpfm q)"
   3.547  | "simpfm (Iff p q) = iff (simpfm p) (simpfm q)"
   3.548  | "simpfm (NOT p) = not (simpfm p)"
   3.549 -| "simpfm (Lt a) = (let a' = simpnum a in case a' of C v \<Rightarrow> if (v < 0) then T else F 
   3.550 +| "simpfm (Lt a) = (let a' = simpnum a in case a' of C v \<Rightarrow> if (v < 0) then T else F
   3.551    | _ \<Rightarrow> Lt (reducecoeff a'))"
   3.552  | "simpfm (Le a) = (let a' = simpnum a in case a' of C v \<Rightarrow> if (v \<le> 0)  then T else F | _ \<Rightarrow> Le (reducecoeff a'))"
   3.553  | "simpfm (Gt a) = (let a' = simpnum a in case a' of C v \<Rightarrow> if (v > 0)  then T else F | _ \<Rightarrow> Gt (reducecoeff a'))"
   3.554 @@ -1151,7 +1151,7 @@
   3.555  | "simpfm (Dvd i a) = (if i=0 then simpfm (Eq a)
   3.556               else if (abs i = 1) \<and> check_int a then T
   3.557               else let a' = simpnum a in case a' of C v \<Rightarrow> if (i dvd v)  then T else F | _ \<Rightarrow> (let (d,t) = simpdvd i a' in Dvd d t))"
   3.558 -| "simpfm (NDvd i a) = (if i=0 then simpfm (NEq a) 
   3.559 +| "simpfm (NDvd i a) = (if i=0 then simpfm (NEq a)
   3.560               else if (abs i = 1) \<and> check_int a then F
   3.561               else let a' = simpnum a in case a' of C v \<Rightarrow> if (\<not>(i dvd v)) then T else F | _ \<Rightarrow> (let (d,t) = simpdvd i a' in NDvd d t))"
   3.562  | "simpfm p = p"
   3.563 @@ -1265,22 +1265,22 @@
   3.564    case (12 i a)  let ?sa = "simpnum a"   have sa: "Inum bs ?sa = Inum bs a" by simp
   3.565    have "i=0 \<or> (abs i = 1 \<and> check_int a) \<or> (i\<noteq>0 \<and> ((abs i \<noteq> 1) \<or> (\<not> check_int a)))" by auto
   3.566    {assume "i=0" hence ?case using "12.hyps" by (simp add: rdvd_left_0_eq Let_def)}
   3.567 -  moreover 
   3.568 -  {assume ai1: "abs i = 1" and ai: "check_int a" 
   3.569 +  moreover
   3.570 +  {assume ai1: "abs i = 1" and ai: "check_int a"
   3.571      hence "i=1 \<or> i= - 1" by arith
   3.572 -    moreover {assume i1: "i = 1" 
   3.573 -      from rdvd_left1_int[OF check_int[OF ai, simplified isint_iff]] 
   3.574 +    moreover {assume i1: "i = 1"
   3.575 +      from rdvd_left1_int[OF check_int[OF ai, simplified isint_iff]]
   3.576        have ?case using i1 ai by simp }
   3.577 -    moreover {assume i1: "i = - 1" 
   3.578 -      from rdvd_left1_int[OF check_int[OF ai, simplified isint_iff]] 
   3.579 +    moreover {assume i1: "i = - 1"
   3.580 +      from rdvd_left1_int[OF check_int[OF ai, simplified isint_iff]]
   3.581          rdvd_abs1[where d="- 1" and t="Inum bs a"]
   3.582        have ?case using i1 ai by simp }
   3.583      ultimately have ?case by blast}
   3.584 -  moreover   
   3.585 +  moreover
   3.586    {assume inz: "i\<noteq>0" and cond: "(abs i \<noteq> 1) \<or> (\<not> check_int a)"
   3.587      {fix v assume "?sa = C v" hence ?case using sa[symmetric] inz cond
   3.588          by (cases "abs i = 1", auto simp add: int_rdvd_iff) }
   3.589 -    moreover {assume H:"\<not> (\<exists> v. ?sa = C v)" 
   3.590 +    moreover {assume H:"\<not> (\<exists> v. ?sa = C v)"
   3.591        hence th: "simpfm (Dvd i a) = Dvd (fst (simpdvd i ?sa)) (snd (simpdvd i ?sa))" using inz cond by (cases ?sa, auto simp add: Let_def split_def)
   3.592        from simpnum_nz have nz:"nozerocoeff ?sa" by simp
   3.593        from simpdvd [OF nz inz] th have ?case using sa by simp}
   3.594 @@ -1290,23 +1290,23 @@
   3.595    case (13 i a)  let ?sa = "simpnum a"   have sa: "Inum bs ?sa = Inum bs a" by simp
   3.596    have "i=0 \<or> (abs i = 1 \<and> check_int a) \<or> (i\<noteq>0 \<and> ((abs i \<noteq> 1) \<or> (\<not> check_int a)))" by auto
   3.597    {assume "i=0" hence ?case using "13.hyps" by (simp add: rdvd_left_0_eq Let_def)}
   3.598 -  moreover 
   3.599 -  {assume ai1: "abs i = 1" and ai: "check_int a" 
   3.600 +  moreover
   3.601 +  {assume ai1: "abs i = 1" and ai: "check_int a"
   3.602      hence "i=1 \<or> i= - 1" by arith
   3.603 -    moreover {assume i1: "i = 1" 
   3.604 -      from rdvd_left1_int[OF check_int[OF ai, simplified isint_iff]] 
   3.605 +    moreover {assume i1: "i = 1"
   3.606 +      from rdvd_left1_int[OF check_int[OF ai, simplified isint_iff]]
   3.607        have ?case using i1 ai by simp }
   3.608 -    moreover {assume i1: "i = - 1" 
   3.609 -      from rdvd_left1_int[OF check_int[OF ai, simplified isint_iff]] 
   3.610 +    moreover {assume i1: "i = - 1"
   3.611 +      from rdvd_left1_int[OF check_int[OF ai, simplified isint_iff]]
   3.612          rdvd_abs1[where d="- 1" and t="Inum bs a"]
   3.613        have ?case using i1 ai by simp }
   3.614      ultimately have ?case by blast}
   3.615 -  moreover   
   3.616 +  moreover
   3.617    {assume inz: "i\<noteq>0" and cond: "(abs i \<noteq> 1) \<or> (\<not> check_int a)"
   3.618      {fix v assume "?sa = C v" hence ?case using sa[symmetric] inz cond
   3.619          by (cases "abs i = 1", auto simp add: int_rdvd_iff) }
   3.620 -    moreover {assume H:"\<not> (\<exists> v. ?sa = C v)" 
   3.621 -      hence th: "simpfm (NDvd i a) = NDvd (fst (simpdvd i ?sa)) (snd (simpdvd i ?sa))" using inz cond 
   3.622 +    moreover {assume H:"\<not> (\<exists> v. ?sa = C v)"
   3.623 +      hence th: "simpfm (NDvd i a) = NDvd (fst (simpdvd i ?sa)) (snd (simpdvd i ?sa))" using inz cond
   3.624          by (cases ?sa, auto simp add: Let_def split_def)
   3.625        from simpnum_nz have nz:"nozerocoeff ?sa" by simp
   3.626        from simpdvd [OF nz inz] th have ?case using sa by simp}
   3.627 @@ -1371,7 +1371,7 @@
   3.628    "CJNB f p \<equiv> (let cjs = conjuncts p ; (yes,no) = List.partition bound0 cjs
   3.629                     in conj (decr (list_conj yes)) (f (list_conj no)))"
   3.630  
   3.631 -lemma CJNB_qe: 
   3.632 +lemma CJNB_qe:
   3.633    assumes qe: "\<forall> bs p. qfree p \<longrightarrow> qfree (qe p) \<and> (Ifm bs (qe p) = Ifm bs (E p))"
   3.634    shows "\<forall> bs p. qfree p \<longrightarrow> qfree (CJNB qe p) \<and> (Ifm bs ((CJNB qe p)) = Ifm bs (E p))"
   3.635  proof(clarify)
   3.636 @@ -1383,15 +1383,15 @@
   3.637    let ?cno = "list_conj ?no"
   3.638    let ?cyes = "list_conj ?yes"
   3.639    have part: "List.partition bound0 ?cjs = (?yes,?no)" by simp
   3.640 -  from partition_P[OF part] have "\<forall> q\<in> set ?yes. bound0 q" by blast 
   3.641 -  hence yes_nb: "bound0 ?cyes" by (simp add: list_conj_nb) 
   3.642 +  from partition_P[OF part] have "\<forall> q\<in> set ?yes. bound0 q" by blast
   3.643 +  hence yes_nb: "bound0 ?cyes" by (simp add: list_conj_nb)
   3.644    hence yes_qf: "qfree (decr ?cyes )" by (simp add: decr_qf)
   3.645 -  from conjuncts_qf[OF qfp] partition_set[OF part] 
   3.646 +  from conjuncts_qf[OF qfp] partition_set[OF part]
   3.647    have " \<forall>q\<in> set ?no. qfree q" by auto
   3.648    hence no_qf: "qfree ?cno"by (simp add: list_conj_qf)
   3.649 -  with qe have cno_qf:"qfree (qe ?cno )" 
   3.650 +  with qe have cno_qf:"qfree (qe ?cno )"
   3.651      and noE: "Ifm bs (qe ?cno) = Ifm bs (E ?cno)" by blast+
   3.652 -  from cno_qf yes_qf have qf: "qfree (CJNB qe p)" 
   3.653 +  from cno_qf yes_qf have qf: "qfree (CJNB qe p)"
   3.654      by (simp add: CJNB_def Let_def split_def)
   3.655    {fix bs
   3.656      from conjuncts have "Ifm bs p = (\<forall>q\<in> set ?cjs. Ifm bs q)" by blast
   3.657 @@ -1405,7 +1405,7 @@
   3.658      by (auto simp add: decr[OF yes_nb] simp del: partition_filter_conv)
   3.659    also have "\<dots> = (Ifm bs (conj (decr ?cyes) (qe ?cno)))"
   3.660      using qe[rule_format, OF no_qf] by auto
   3.661 -  finally have "Ifm bs (E p) = Ifm bs (CJNB qe p)" 
   3.662 +  finally have "Ifm bs (E p) = Ifm bs (CJNB qe p)"
   3.663      by (simp add: Let_def CJNB_def split_def)
   3.664    with qf show "qfree (CJNB qe p) \<and> Ifm bs (CJNB qe p) = Ifm bs (E p)" by blast
   3.665  qed
   3.666 @@ -1414,8 +1414,8 @@
   3.667    "qelim (E p) = (\<lambda> qe. DJ (CJNB qe) (qelim p qe))"
   3.668  | "qelim (A p) = (\<lambda> qe. not (qe ((qelim (NOT p) qe))))"
   3.669  | "qelim (NOT p) = (\<lambda> qe. not (qelim p qe))"
   3.670 -| "qelim (And p q) = (\<lambda> qe. conj (qelim p qe) (qelim q qe))" 
   3.671 -| "qelim (Or  p q) = (\<lambda> qe. disj (qelim p qe) (qelim q qe))" 
   3.672 +| "qelim (And p q) = (\<lambda> qe. conj (qelim p qe) (qelim q qe))"
   3.673 +| "qelim (Or  p q) = (\<lambda> qe. disj (qelim p qe) (qelim q qe))"
   3.674  | "qelim (Imp p q) = (\<lambda> qe. disj (qelim (NOT p) qe) (qelim q qe))"
   3.675  | "qelim (Iff p q) = (\<lambda> qe. iff (qelim p qe) (qelim q qe))"
   3.676  | "qelim p = (\<lambda> y. simpfm p)"
   3.677 @@ -1425,7 +1425,7 @@
   3.678  lemma qelim_ci:
   3.679    assumes qe_inv: "\<forall> bs p. qfree p \<longrightarrow> qfree (qe p) \<and> (Ifm bs (qe p) = Ifm bs (E p))"
   3.680    shows "\<And> bs. qfree (qelim p qe) \<and> (Ifm bs (qelim p qe) = Ifm bs p)"
   3.681 -  using qe_inv DJ_qe[OF CJNB_qe[OF qe_inv]] 
   3.682 +  using qe_inv DJ_qe[OF CJNB_qe[OF qe_inv]]
   3.683    by (induct p rule: qelim.induct) (auto simp del: simpfm.simps)
   3.684  
   3.685  
   3.686 @@ -1438,11 +1438,11 @@
   3.687  | "zsplit0 (CN n c a) = zsplit0 (Add (Mul c (Bound n)) a)"
   3.688  | "zsplit0 (CF c a b) = zsplit0 (Add (Mul c (Floor a)) b)"
   3.689  | "zsplit0 (Neg a) = (let (i',a') =  zsplit0 a in (-i', Neg a'))"
   3.690 -| "zsplit0 (Add a b) = (let (ia,a') =  zsplit0 a ; 
   3.691 -                            (ib,b') =  zsplit0 b 
   3.692 +| "zsplit0 (Add a b) = (let (ia,a') =  zsplit0 a ;
   3.693 +                            (ib,b') =  zsplit0 b
   3.694                              in (ia+ib, Add a' b'))"
   3.695 -| "zsplit0 (Sub a b) = (let (ia,a') =  zsplit0 a ; 
   3.696 -                            (ib,b') =  zsplit0 b 
   3.697 +| "zsplit0 (Sub a b) = (let (ia,a') =  zsplit0 a ;
   3.698 +                            (ib,b') =  zsplit0 b
   3.699                              in (ia-ib, Sub a' b'))"
   3.700  | "zsplit0 (Mul i a) = (let (i',a') =  zsplit0 a in (i*i', Mul i a'))"
   3.701  | "zsplit0 (Floor a) = (let (i',a') =  zsplit0 a in (i',Floor a'))"
   3.702 @@ -1453,18 +1453,18 @@
   3.703    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"
   3.704    (is "\<And> n a. ?S t = (n,a) \<Longrightarrow> (?I x (CN 0 n a) = ?I x t) \<and> ?N a")
   3.705  proof(induct t rule: zsplit0.induct)
   3.706 -  case (1 c n a) thus ?case by auto 
   3.707 +  case (1 c n a) thus ?case by auto
   3.708  next
   3.709    case (2 m n a) thus ?case by (cases "m=0") auto
   3.710  next
   3.711    case (3 n i a n a') thus ?case by auto
   3.712 -next 
   3.713 +next
   3.714    case (4 c a b n a') thus ?case by auto
   3.715  next
   3.716    case (5 t n a)
   3.717    let ?nt = "fst (zsplit0 t)"
   3.718    let ?at = "snd (zsplit0 t)"
   3.719 -  have abj: "zsplit0 t = (?nt,?at)" by simp hence th: "a=Neg ?at \<and> n=-?nt" using 5 
   3.720 +  have abj: "zsplit0 t = (?nt,?at)" by simp hence th: "a=Neg ?at \<and> n=-?nt" using 5
   3.721      by (simp add: Let_def split_def)
   3.722    from abj 5 have th2: "(?I x (CN 0 ?nt ?at) = ?I x t) \<and> ?N ?at" by blast
   3.723    from th2[simplified] th[simplified] show ?case by simp
   3.724 @@ -1474,15 +1474,15 @@
   3.725    let ?as = "snd (zsplit0 s)"
   3.726    let ?nt = "fst (zsplit0 t)"
   3.727    let ?at = "snd (zsplit0 t)"
   3.728 -  have abjs: "zsplit0 s = (?ns,?as)" by simp 
   3.729 -  moreover have abjt:  "zsplit0 t = (?nt,?at)" by simp 
   3.730 +  have abjs: "zsplit0 s = (?ns,?as)" by simp
   3.731 +  moreover have abjt:  "zsplit0 t = (?nt,?at)" by simp
   3.732    ultimately have th: "a=Add ?as ?at \<and> n=?ns + ?nt" using 6
   3.733      by (simp add: Let_def split_def)
   3.734    from abjs[symmetric] have bluddy: "\<exists> x y. (x,y) = zsplit0 s" by blast
   3.735    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*)
   3.736    with bluddy abjt have th3: "(?I x (CN 0 ?nt ?at) = ?I x t) \<and> ?N ?at" by blast
   3.737    from abjs 6  have th2: "(?I x (CN 0 ?ns ?as) = ?I x s) \<and> ?N ?as" by blast
   3.738 -  from th3[simplified] th2[simplified] th[simplified] show ?case 
   3.739 +  from th3[simplified] th2[simplified] th[simplified] show ?case
   3.740      by (simp add: distrib_right)
   3.741  next
   3.742    case (7 s t n a)
   3.743 @@ -1490,15 +1490,15 @@
   3.744    let ?as = "snd (zsplit0 s)"
   3.745    let ?nt = "fst (zsplit0 t)"
   3.746    let ?at = "snd (zsplit0 t)"
   3.747 -  have abjs: "zsplit0 s = (?ns,?as)" by simp 
   3.748 -  moreover have abjt:  "zsplit0 t = (?nt,?at)" by simp 
   3.749 +  have abjs: "zsplit0 s = (?ns,?as)" by simp
   3.750 +  moreover have abjt:  "zsplit0 t = (?nt,?at)" by simp
   3.751    ultimately have th: "a=Sub ?as ?at \<and> n=?ns - ?nt" using 7
   3.752      by (simp add: Let_def split_def)
   3.753    from abjs[symmetric] have bluddy: "\<exists> x y. (x,y) = zsplit0 s" by blast
   3.754    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*)
   3.755    with bluddy abjt have th3: "(?I x (CN 0 ?nt ?at) = ?I x t) \<and> ?N ?at" by blast
   3.756    from abjs 7 have th2: "(?I x (CN 0 ?ns ?as) = ?I x s) \<and> ?N ?as" by blast
   3.757 -  from th3[simplified] th2[simplified] th[simplified] show ?case 
   3.758 +  from th3[simplified] th2[simplified] th[simplified] show ?case
   3.759      by (simp add: left_diff_distrib)
   3.760  next
   3.761    case (8 i t n a)
   3.762 @@ -1522,8 +1522,8 @@
   3.763    have "?I x (Floor t) = ?I x (Floor (CN 0 ?nt ?at))" using th2 by simp
   3.764    also have "\<dots> = real_of_int (floor ((real_of_int ?nt)* real_of_int(x) + ?I x ?at))" by simp
   3.765    also have "\<dots> = real_of_int (floor (?I x ?at + real_of_int (?nt* x)))" by (simp add: ac_simps)
   3.766 -  also have "\<dots> = real_of_int (floor (?I x ?at) + (?nt* x))" 
   3.767 -    using floor_add_of_int[of "?I x ?at" "?nt* x"] by simp 
   3.768 +  also have "\<dots> = real_of_int (floor (?I x ?at) + (?nt* x))"
   3.769 +    using floor_add_of_int[of "?I x ?at" "?nt* x"] by simp
   3.770    also have "\<dots> = real_of_int (?nt)*(real_of_int x) + real_of_int (floor (?I x ?at))" by (simp add: ac_simps)
   3.771    finally have "?I x (Floor t) = ?I x (CN 0 n a)" using th by simp
   3.772    with na show ?case by simp
   3.773 @@ -1533,17 +1533,17 @@
   3.774    iszlfm :: "fm \<Rightarrow> real list \<Rightarrow> bool"   (* Linearity test for fm *)
   3.775    zlfm :: "fm \<Rightarrow> fm"       (* Linearity transformation for fm *)
   3.776  recdef iszlfm "measure size"
   3.777 -  "iszlfm (And p q) = (\<lambda> bs. iszlfm p bs \<and> iszlfm q bs)" 
   3.778 -  "iszlfm (Or p q) = (\<lambda> bs. iszlfm p bs \<and> iszlfm q bs)" 
   3.779 +  "iszlfm (And p q) = (\<lambda> bs. iszlfm p bs \<and> iszlfm q bs)"
   3.780 +  "iszlfm (Or p q) = (\<lambda> bs. iszlfm p bs \<and> iszlfm q bs)"
   3.781    "iszlfm (Eq  (CN 0 c e)) = (\<lambda> bs. c>0 \<and> numbound0 e \<and> isint e bs)"
   3.782    "iszlfm (NEq (CN 0 c e)) = (\<lambda> bs. c>0 \<and> numbound0 e \<and> isint e bs)"
   3.783    "iszlfm (Lt  (CN 0 c e)) = (\<lambda> bs. c>0 \<and> numbound0 e \<and> isint e bs)"
   3.784    "iszlfm (Le  (CN 0 c e)) = (\<lambda> bs. c>0 \<and> numbound0 e \<and> isint e bs)"
   3.785    "iszlfm (Gt  (CN 0 c e)) = (\<lambda> bs. c>0 \<and> numbound0 e \<and> isint e bs)"
   3.786    "iszlfm (Ge  (CN 0 c e)) = (\<lambda> bs. c>0 \<and> numbound0 e \<and> isint e bs)"
   3.787 -  "iszlfm (Dvd i (CN 0 c e)) = 
   3.788 +  "iszlfm (Dvd i (CN 0 c e)) =
   3.789                   (\<lambda> bs. c>0 \<and> i>0 \<and> numbound0 e \<and> isint e bs)"
   3.790 -  "iszlfm (NDvd i (CN 0 c e))= 
   3.791 +  "iszlfm (NDvd i (CN 0 c e))=
   3.792                   (\<lambda> bs. c>0 \<and> i>0 \<and> numbound0 e \<and> isint e bs)"
   3.793    "iszlfm p = (\<lambda> bs. isatom p \<and> (bound0 p))"
   3.794  
   3.795 @@ -1570,39 +1570,39 @@
   3.796    "zlfm (Or p q) = disj (zlfm p) (zlfm q)"
   3.797    "zlfm (Imp p q) = disj (zlfm (NOT p)) (zlfm q)"
   3.798    "zlfm (Iff p q) = disj (conj (zlfm p) (zlfm q)) (conj (zlfm (NOT p)) (zlfm (NOT q)))"
   3.799 -  "zlfm (Lt a) = (let (c,r) = zsplit0 a in 
   3.800 -     if c=0 then Lt r else 
   3.801 -     if c>0 then Or (Lt (CN 0 c (Neg (Floor (Neg r))))) (And (Eq (CN 0 c (Neg (Floor (Neg r))))) (Lt (Add (Floor (Neg r)) r))) 
   3.802 +  "zlfm (Lt a) = (let (c,r) = zsplit0 a in
   3.803 +     if c=0 then Lt r else
   3.804 +     if c>0 then Or (Lt (CN 0 c (Neg (Floor (Neg r))))) (And (Eq (CN 0 c (Neg (Floor (Neg r))))) (Lt (Add (Floor (Neg r)) r)))
   3.805       else Or (Gt (CN 0 (-c) (Floor(Neg r)))) (And (Eq(CN 0 (-c) (Floor(Neg r)))) (Lt (Add (Floor (Neg r)) r))))"
   3.806 -  "zlfm (Le a) = (let (c,r) = zsplit0 a in 
   3.807 -     if c=0 then Le r else 
   3.808 -     if c>0 then Or (Le (CN 0 c (Neg (Floor (Neg r))))) (And (Eq (CN 0 c (Neg (Floor (Neg r))))) (Lt (Add (Floor (Neg r)) r))) 
   3.809 +  "zlfm (Le a) = (let (c,r) = zsplit0 a in
   3.810 +     if c=0 then Le r else
   3.811 +     if c>0 then Or (Le (CN 0 c (Neg (Floor (Neg r))))) (And (Eq (CN 0 c (Neg (Floor (Neg r))))) (Lt (Add (Floor (Neg r)) r)))
   3.812       else Or (Ge (CN 0 (-c) (Floor(Neg r)))) (And (Eq(CN 0 (-c) (Floor(Neg r)))) (Lt (Add (Floor (Neg r)) r))))"
   3.813 -  "zlfm (Gt a) = (let (c,r) = zsplit0 a in 
   3.814 -     if c=0 then Gt r else 
   3.815 -     if c>0 then Or (Gt (CN 0 c (Floor r))) (And (Eq (CN 0 c (Floor r))) (Lt (Sub (Floor r) r))) 
   3.816 +  "zlfm (Gt a) = (let (c,r) = zsplit0 a in
   3.817 +     if c=0 then Gt r else
   3.818 +     if c>0 then Or (Gt (CN 0 c (Floor r))) (And (Eq (CN 0 c (Floor r))) (Lt (Sub (Floor r) r)))
   3.819       else Or (Lt (CN 0 (-c) (Neg (Floor r)))) (And (Eq(CN 0 (-c) (Neg (Floor r)))) (Lt (Sub (Floor r) r))))"
   3.820 -  "zlfm (Ge a) = (let (c,r) = zsplit0 a in 
   3.821 -     if c=0 then Ge r else 
   3.822 -     if c>0 then Or (Ge (CN 0 c (Floor r))) (And (Eq (CN 0 c (Floor r))) (Lt (Sub (Floor r) r))) 
   3.823 +  "zlfm (Ge a) = (let (c,r) = zsplit0 a in
   3.824 +     if c=0 then Ge r else
   3.825 +     if c>0 then Or (Ge (CN 0 c (Floor r))) (And (Eq (CN 0 c (Floor r))) (Lt (Sub (Floor r) r)))
   3.826       else Or (Le (CN 0 (-c) (Neg (Floor r)))) (And (Eq(CN 0 (-c) (Neg (Floor r)))) (Lt (Sub (Floor r) r))))"
   3.827 -  "zlfm (Eq a) = (let (c,r) = zsplit0 a in 
   3.828 -              if c=0 then Eq r else 
   3.829 +  "zlfm (Eq a) = (let (c,r) = zsplit0 a in
   3.830 +              if c=0 then Eq r else
   3.831        if c>0 then (And (Eq (CN 0 c (Neg (Floor (Neg r))))) (Eq (Add (Floor (Neg r)) r)))
   3.832        else (And (Eq (CN 0 (-c) (Floor (Neg r)))) (Eq (Add (Floor (Neg r)) r))))"
   3.833 -  "zlfm (NEq a) = (let (c,r) = zsplit0 a in 
   3.834 -              if c=0 then NEq r else 
   3.835 +  "zlfm (NEq a) = (let (c,r) = zsplit0 a in
   3.836 +              if c=0 then NEq r else
   3.837        if c>0 then (Or (NEq (CN 0 c (Neg (Floor (Neg r))))) (NEq (Add (Floor (Neg r)) r)))
   3.838        else (Or (NEq (CN 0 (-c) (Floor (Neg r)))) (NEq (Add (Floor (Neg r)) r))))"
   3.839 -  "zlfm (Dvd i a) = (if i=0 then zlfm (Eq a) 
   3.840 -  else (let (c,r) = zsplit0 a in 
   3.841 -              if c=0 then Dvd (abs i) r else 
   3.842 -      if c>0 then And (Eq (Sub (Floor r) r)) (Dvd (abs i) (CN 0 c (Floor r))) 
   3.843 +  "zlfm (Dvd i a) = (if i=0 then zlfm (Eq a)
   3.844 +  else (let (c,r) = zsplit0 a in
   3.845 +              if c=0 then Dvd (abs i) r else
   3.846 +      if c>0 then And (Eq (Sub (Floor r) r)) (Dvd (abs i) (CN 0 c (Floor r)))
   3.847        else And (Eq (Sub (Floor r) r)) (Dvd (abs i) (CN 0 (-c) (Neg (Floor r))))))"
   3.848 -  "zlfm (NDvd i a) = (if i=0 then zlfm (NEq a) 
   3.849 -  else (let (c,r) = zsplit0 a in 
   3.850 -              if c=0 then NDvd (abs i) r else 
   3.851 -      if c>0 then Or (NEq (Sub (Floor r) r)) (NDvd (abs i) (CN 0 c (Floor r))) 
   3.852 +  "zlfm (NDvd i a) = (if i=0 then zlfm (NEq a)
   3.853 +  else (let (c,r) = zsplit0 a in
   3.854 +              if c=0 then NDvd (abs i) r else
   3.855 +      if c>0 then Or (NEq (Sub (Floor r) r)) (NDvd (abs i) (CN 0 c (Floor r)))
   3.856        else Or (NEq (Sub (Floor r) r)) (NDvd (abs i) (CN 0 (-c) (Neg (Floor r))))))"
   3.857    "zlfm (NOT (And p q)) = disj (zlfm (NOT p)) (zlfm (NOT q))"
   3.858    "zlfm (NOT (Or p q)) = conj (zlfm (NOT p)) (zlfm (NOT q))"
   3.859 @@ -1621,56 +1621,56 @@
   3.860    "zlfm (NOT (NDvd i a)) = zlfm (Dvd i a)"
   3.861    "zlfm p = p" (hints simp add: fmsize_pos)
   3.862  
   3.863 -lemma split_int_less_real: 
   3.864 +lemma split_int_less_real:
   3.865    "(real_of_int (a::int) < b) = (a < floor b \<or> (a = floor b \<and> real_of_int (floor b) < b))"
   3.866  proof( auto)
   3.867    assume alb: "real_of_int a < b" and agb: "\<not> a < floor b"
   3.868    from agb have "floor b \<le> a" by simp hence th: "b < real_of_int a + 1" by (simp only: floor_le_iff)
   3.869 -  from floor_eq[OF alb th] show "a= floor b" by simp 
   3.870 +  from floor_eq[OF alb th] show "a= floor b" by simp
   3.871  next
   3.872    assume alb: "a < floor b"
   3.873    hence "real_of_int a < real_of_int (floor b)" by simp
   3.874 -  moreover have "real_of_int (floor b) \<le> b" by simp ultimately show  "real_of_int a < b" by arith 
   3.875 +  moreover have "real_of_int (floor b) \<le> b" by simp ultimately show  "real_of_int a < b" by arith
   3.876  qed
   3.877  
   3.878 -lemma split_int_less_real': 
   3.879 +lemma split_int_less_real':
   3.880    "(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))"
   3.881 -proof- 
   3.882 +proof-
   3.883    have "(real_of_int a + b <0) = (real_of_int a < -b)" by arith
   3.884 -  with split_int_less_real[where a="a" and b="-b"] show ?thesis by arith  
   3.885 +  with split_int_less_real[where a="a" and b="-b"] show ?thesis by arith
   3.886  qed
   3.887  
   3.888 -lemma split_int_gt_real': 
   3.889 +lemma split_int_gt_real':
   3.890    "(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))"
   3.891 -proof- 
   3.892 +proof-
   3.893    have th: "(real_of_int a + b >0) = (real_of_int (-a) + (-b)< 0)" by arith
   3.894 -  show ?thesis using myless[of _ "real_of_int (floor b)"] 
   3.895 -    by (simp only:th split_int_less_real'[where a="-a" and b="-b"]) 
   3.896 +  show ?thesis using myless[of _ "real_of_int (floor b)"]
   3.897 +    by (simp only:th split_int_less_real'[where a="-a" and b="-b"])
   3.898      (simp add: algebra_simps,arith)
   3.899  qed
   3.900  
   3.901 -lemma split_int_le_real: 
   3.902 +lemma split_int_le_real:
   3.903    "(real_of_int (a::int) \<le> b) = (a \<le> floor b \<or> (a = floor b \<and> real_of_int (floor b) < b))"
   3.904  proof( auto)
   3.905    assume alb: "real_of_int a \<le> b" and agb: "\<not> a \<le> floor b"
   3.906 -  from alb have "floor (real_of_int a) \<le> floor b " by (simp only: floor_mono) 
   3.907 +  from alb have "floor (real_of_int a) \<le> floor b " by (simp only: floor_mono)
   3.908    hence "a \<le> floor b" by simp with agb show "False" by simp
   3.909  next
   3.910    assume alb: "a \<le> floor b"
   3.911    hence "real_of_int a \<le> real_of_int (floor b)" by (simp only: floor_mono)
   3.912 -  also have "\<dots>\<le> b" by simp  finally show  "real_of_int a \<le> b" . 
   3.913 +  also have "\<dots>\<le> b" by simp  finally show  "real_of_int a \<le> b" .
   3.914  qed
   3.915  
   3.916 -lemma split_int_le_real': 
   3.917 +lemma split_int_le_real':
   3.918    "(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))"
   3.919 -proof- 
   3.920 +proof-
   3.921    have "(real_of_int a + b \<le>0) = (real_of_int a \<le> -b)" by arith
   3.922 -  with split_int_le_real[where a="a" and b="-b"] show ?thesis by arith  
   3.923 +  with split_int_le_real[where a="a" and b="-b"] show ?thesis by arith
   3.924  qed
   3.925  
   3.926 -lemma split_int_ge_real': 
   3.927 +lemma split_int_ge_real':
   3.928    "(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))"
   3.929 -proof- 
   3.930 +proof-
   3.931    have th: "(real_of_int a + b \<ge>0) = (real_of_int (-a) + (-b) \<le> 0)" by arith
   3.932    show ?thesis by (simp only: th split_int_le_real'[where a="-a" and b="-b"])
   3.933      (simp add: algebra_simps ,arith)
   3.934 @@ -1691,25 +1691,25 @@
   3.935    (is "(?I (?l p) = ?I p) \<and> ?L (?l p)")
   3.936  using qfp
   3.937  proof(induct p rule: zlfm.induct)
   3.938 -  case (5 a) 
   3.939 +  case (5 a)
   3.940    let ?c = "fst (zsplit0 a)"
   3.941    let ?r = "snd (zsplit0 a)"
   3.942    have spl: "zsplit0 a = (?c,?r)" by simp
   3.943 -  from zsplit0_I[OF spl, where x="i" and bs="bs"] 
   3.944 -  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 
   3.945 +  from zsplit0_I[OF spl, where x="i" and bs="bs"]
   3.946 +  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
   3.947    let ?N = "\<lambda> t. Inum (real_of_int i#bs) t"
   3.948    have "?c = 0 \<or> (?c >0 \<and> ?c\<noteq>0) \<or> (?c<0 \<and> ?c\<noteq>0)" by arith
   3.949    moreover
   3.950 -  {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"] 
   3.951 +  {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"]
   3.952        by (cases "?r", simp_all add: Let_def split_def,rename_tac nat a b,case_tac "nat", simp_all)}
   3.953    moreover
   3.954 -  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Lt a))" 
   3.955 +  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Lt a))"
   3.956        by (simp add: nb Let_def split_def isint_Floor isint_neg)
   3.957      have "?I (Lt a) = (real_of_int (?c * i) + (?N ?r) < 0)" using Ia by (simp add: Let_def split_def)
   3.958      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)
   3.959      finally have ?case using l by simp}
   3.960    moreover
   3.961 -  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Lt a))" 
   3.962 +  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Lt a))"
   3.963        by (simp add: nb Let_def split_def isint_Floor isint_neg)
   3.964      have "?I (Lt a) = (real_of_int (?c * i) + (?N ?r) < 0)" using Ia by (simp add: Let_def split_def)
   3.965      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)
   3.966 @@ -1720,46 +1720,46 @@
   3.967    let ?c = "fst (zsplit0 a)"
   3.968    let ?r = "snd (zsplit0 a)"
   3.969    have spl: "zsplit0 a = (?c,?r)" by simp
   3.970 -  from zsplit0_I[OF spl, where x="i" and bs="bs"] 
   3.971 -  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 
   3.972 +  from zsplit0_I[OF spl, where x="i" and bs="bs"]
   3.973 +  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
   3.974    let ?N = "\<lambda> t. Inum (real_of_int i#bs) t"
   3.975    have "?c = 0 \<or> (?c >0 \<and> ?c\<noteq>0) \<or> (?c<0 \<and> ?c\<noteq>0)" by arith
   3.976    moreover
   3.977 -  {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"] 
   3.978 +  {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"]
   3.979        by (cases "?r", simp_all add: Let_def split_def, rename_tac nat a b, case_tac "nat",simp_all)}
   3.980    moreover
   3.981 -  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Le a))" 
   3.982 +  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Le a))"
   3.983        by (simp add: nb Let_def split_def isint_Floor isint_neg)
   3.984      have "?I (Le a) = (real_of_int (?c * i) + (?N ?r) \<le> 0)" using Ia by (simp add: Let_def split_def)
   3.985      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)
   3.986      finally have ?case using l by simp}
   3.987    moreover
   3.988 -  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Le a))" 
   3.989 +  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Le a))"
   3.990        by (simp add: nb Let_def split_def isint_Floor isint_neg)
   3.991      have "?I (Le a) = (real_of_int (?c * i) + (?N ?r) \<le> 0)" using Ia by (simp add: Let_def split_def)
   3.992      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)
   3.993      finally have ?case using l by simp}
   3.994    ultimately show ?case by blast
   3.995  next
   3.996 -  case (7 a) 
   3.997 +  case (7 a)
   3.998    let ?c = "fst (zsplit0 a)"
   3.999    let ?r = "snd (zsplit0 a)"
  3.1000    have spl: "zsplit0 a = (?c,?r)" by simp
  3.1001 -  from zsplit0_I[OF spl, where x="i" and bs="bs"] 
  3.1002 -  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 
  3.1003 +  from zsplit0_I[OF spl, where x="i" and bs="bs"]
  3.1004 +  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
  3.1005    let ?N = "\<lambda> t. Inum (real_of_int i#bs) t"
  3.1006    have "?c = 0 \<or> (?c >0 \<and> ?c\<noteq>0) \<or> (?c<0 \<and> ?c\<noteq>0)" by arith
  3.1007    moreover
  3.1008 -  {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"] 
  3.1009 +  {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"]
  3.1010        by (cases "?r", simp_all add: Let_def split_def, rename_tac nat a b, case_tac "nat", simp_all)}
  3.1011    moreover
  3.1012 -  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Gt a))" 
  3.1013 +  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Gt a))"
  3.1014        by (simp add: nb Let_def split_def isint_Floor isint_neg)
  3.1015      have "?I (Gt a) = (real_of_int (?c * i) + (?N ?r) > 0)" using Ia by (simp add: Let_def split_def)
  3.1016      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)
  3.1017      finally have ?case using l by simp}
  3.1018    moreover
  3.1019 -  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Gt a))" 
  3.1020 +  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Gt a))"
  3.1021        by (simp add: nb Let_def split_def isint_Floor isint_neg)
  3.1022      have "?I (Gt a) = (real_of_int (?c * i) + (?N ?r) > 0)" using Ia by (simp add: Let_def split_def)
  3.1023      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)
  3.1024 @@ -1770,21 +1770,21 @@
  3.1025     let ?c = "fst (zsplit0 a)"
  3.1026    let ?r = "snd (zsplit0 a)"
  3.1027    have spl: "zsplit0 a = (?c,?r)" by simp
  3.1028 -  from zsplit0_I[OF spl, where x="i" and bs="bs"] 
  3.1029 -  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 
  3.1030 +  from zsplit0_I[OF spl, where x="i" and bs="bs"]
  3.1031 +  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
  3.1032    let ?N = "\<lambda> t. Inum (real_of_int i#bs) t"
  3.1033    have "?c = 0 \<or> (?c >0 \<and> ?c\<noteq>0) \<or> (?c<0 \<and> ?c\<noteq>0)" by arith
  3.1034    moreover
  3.1035 -  {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"] 
  3.1036 +  {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"]
  3.1037        by (cases "?r", simp_all add: Let_def split_def, rename_tac nat a b, case_tac "nat", simp_all)}
  3.1038    moreover
  3.1039 -  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Ge a))" 
  3.1040 +  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Ge a))"
  3.1041        by (simp add: nb Let_def split_def isint_Floor isint_neg)
  3.1042      have "?I (Ge a) = (real_of_int (?c * i) + (?N ?r) \<ge> 0)" using Ia by (simp add: Let_def split_def)
  3.1043      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)
  3.1044      finally have ?case using l by simp}
  3.1045    moreover
  3.1046 -  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Ge a))" 
  3.1047 +  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Ge a))"
  3.1048        by (simp add: nb Let_def split_def isint_Floor isint_neg)
  3.1049      have "?I (Ge a) = (real_of_int (?c * i) + (?N ?r) \<ge> 0)" using Ia by (simp add: Let_def split_def)
  3.1050      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)
  3.1051 @@ -1795,21 +1795,21 @@
  3.1052    let ?c = "fst (zsplit0 a)"
  3.1053    let ?r = "snd (zsplit0 a)"
  3.1054    have spl: "zsplit0 a = (?c,?r)" by simp
  3.1055 -  from zsplit0_I[OF spl, where x="i" and bs="bs"] 
  3.1056 -  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 
  3.1057 +  from zsplit0_I[OF spl, where x="i" and bs="bs"]
  3.1058 +  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
  3.1059    let ?N = "\<lambda> t. Inum (real_of_int i#bs) t"
  3.1060    have "?c = 0 \<or> (?c >0 \<and> ?c\<noteq>0) \<or> (?c<0 \<and> ?c\<noteq>0)" by arith
  3.1061    moreover
  3.1062 -  {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"] 
  3.1063 +  {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"]
  3.1064        by (cases "?r", simp_all add: Let_def split_def, rename_tac nat a b, case_tac "nat", simp_all)}
  3.1065    moreover
  3.1066 -  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Eq a))" 
  3.1067 +  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Eq a))"
  3.1068        by (simp add: nb Let_def split_def isint_Floor isint_neg)
  3.1069      have "?I (Eq a) = (real_of_int (?c * i) + (?N ?r) = 0)" using Ia by (simp add: Let_def split_def)
  3.1070      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)
  3.1071      finally have ?case using l by simp}
  3.1072    moreover
  3.1073 -  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Eq a))" 
  3.1074 +  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Eq a))"
  3.1075        by (simp add: nb Let_def split_def isint_Floor isint_neg)
  3.1076      have "?I (Eq a) = (real_of_int (?c * i) + (?N ?r) = 0)" using Ia by (simp add: Let_def split_def)
  3.1077      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)
  3.1078 @@ -1820,21 +1820,21 @@
  3.1079    let ?c = "fst (zsplit0 a)"
  3.1080    let ?r = "snd (zsplit0 a)"
  3.1081    have spl: "zsplit0 a = (?c,?r)" by simp
  3.1082 -  from zsplit0_I[OF spl, where x="i" and bs="bs"] 
  3.1083 -  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 
  3.1084 +  from zsplit0_I[OF spl, where x="i" and bs="bs"]
  3.1085 +  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
  3.1086    let ?N = "\<lambda> t. Inum (real_of_int i#bs) t"
  3.1087    have "?c = 0 \<or> (?c >0 \<and> ?c\<noteq>0) \<or> (?c<0 \<and> ?c\<noteq>0)" by arith
  3.1088    moreover
  3.1089 -  {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"] 
  3.1090 +  {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"]
  3.1091        by (cases "?r", simp_all add: Let_def split_def, rename_tac nat a b, case_tac "nat", simp_all)}
  3.1092    moreover
  3.1093 -  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (NEq a))" 
  3.1094 +  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (NEq a))"
  3.1095        by (simp add: nb Let_def split_def isint_Floor isint_neg)
  3.1096      have "?I (NEq a) = (real_of_int (?c * i) + (?N ?r) \<noteq> 0)" using Ia by (simp add: Let_def split_def)
  3.1097      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)
  3.1098      finally have ?case using l by simp}
  3.1099    moreover
  3.1100 -  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (NEq a))" 
  3.1101 +  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (NEq a))"
  3.1102        by (simp add: nb Let_def split_def isint_Floor isint_neg)
  3.1103      have "?I (NEq a) = (real_of_int (?c * i) + (?N ?r) \<noteq> 0)" using Ia by (simp add: Let_def split_def)
  3.1104      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)
  3.1105 @@ -1845,44 +1845,44 @@
  3.1106    let ?c = "fst (zsplit0 a)"
  3.1107    let ?r = "snd (zsplit0 a)"
  3.1108    have spl: "zsplit0 a = (?c,?r)" by simp
  3.1109 -  from zsplit0_I[OF spl, where x="i" and bs="bs"] 
  3.1110 -  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 
  3.1111 +  from zsplit0_I[OF spl, where x="i" and bs="bs"]
  3.1112 +  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
  3.1113    let ?N = "\<lambda> t. Inum (real_of_int i#bs) t"
  3.1114    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
  3.1115    moreover
  3.1116 -  { assume j: "j=0" hence z: "zlfm (Dvd j a) = (zlfm (Eq a))" by (simp add: Let_def) 
  3.1117 +  { assume j: "j=0" hence z: "zlfm (Dvd j a) = (zlfm (Eq a))" by (simp add: Let_def)
  3.1118      hence ?case using 11 j by (simp del: zlfm.simps add: rdvd_left_0_eq)}
  3.1119    moreover
  3.1120 -  {assume "?c=0" and "j\<noteq>0" hence ?case 
  3.1121 +  {assume "?c=0" and "j\<noteq>0" hence ?case
  3.1122        using zsplit0_I[OF spl, where x="i" and bs="bs"] rdvd_abs1[where d="j"]
  3.1123        by (cases "?r", simp_all add: Let_def split_def, rename_tac nat a b, case_tac "nat", simp_all)}
  3.1124    moreover
  3.1125 -  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" and jnz: "j\<noteq>0" hence l: "?L (?l (Dvd j a))" 
  3.1126 +  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" and jnz: "j\<noteq>0" hence l: "?L (?l (Dvd j a))"
  3.1127        by (simp add: nb Let_def split_def isint_Floor isint_neg)
  3.1128 -    have "?I (Dvd j a) = (real_of_int j rdvd (real_of_int (?c * i) + (?N ?r)))" 
  3.1129 +    have "?I (Dvd j a) = (real_of_int j rdvd (real_of_int (?c * i) + (?N ?r)))"
  3.1130        using Ia by (simp add: Let_def split_def)
  3.1131 -    also have "\<dots> = (real_of_int (abs j) rdvd real_of_int (?c*i) + (?N ?r))" 
  3.1132 +    also have "\<dots> = (real_of_int (abs j) rdvd real_of_int (?c*i) + (?N ?r))"
  3.1133        by (simp only: rdvd_abs1[where d="j" and t="real_of_int (?c*i) + ?N ?r", symmetric]) simp
  3.1134 -    also have "\<dots> = ((abs j) dvd (floor ((?N ?r) + real_of_int (?c*i))) \<and> 
  3.1135 -       (real_of_int (floor ((?N ?r) + real_of_int (?c*i))) = (real_of_int (?c*i) + (?N ?r))))" 
  3.1136 +    also have "\<dots> = ((abs j) dvd (floor ((?N ?r) + real_of_int (?c*i))) \<and>
  3.1137 +       (real_of_int (floor ((?N ?r) + real_of_int (?c*i))) = (real_of_int (?c*i) + (?N ?r))))"
  3.1138        by(simp only: int_rdvd_real[where i="abs j" and x="real_of_int (?c*i) + (?N ?r)"]) (simp only: ac_simps)
  3.1139 -    also have "\<dots> = (?I (?l (Dvd j a)))" using cp cnz jnz  
  3.1140 -      by (simp add: Let_def split_def int_rdvd_iff[symmetric]  
  3.1141 +    also have "\<dots> = (?I (?l (Dvd j a)))" using cp cnz jnz
  3.1142 +      by (simp add: Let_def split_def int_rdvd_iff[symmetric]
  3.1143          del: of_int_mult) (auto simp add: ac_simps)
  3.1144      finally have ?case using l jnz  by simp }
  3.1145    moreover
  3.1146 -  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" and jnz: "j\<noteq>0" hence l: "?L (?l (Dvd j a))" 
  3.1147 +  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" and jnz: "j\<noteq>0" hence l: "?L (?l (Dvd j a))"
  3.1148        by (simp add: nb Let_def split_def isint_Floor isint_neg)
  3.1149 -    have "?I (Dvd j a) = (real_of_int j rdvd (real_of_int (?c * i) + (?N ?r)))" 
  3.1150 +    have "?I (Dvd j a) = (real_of_int j rdvd (real_of_int (?c * i) + (?N ?r)))"
  3.1151        using Ia by (simp add: Let_def split_def)
  3.1152 -    also have "\<dots> = (real_of_int (abs j) rdvd real_of_int (?c*i) + (?N ?r))" 
  3.1153 +    also have "\<dots> = (real_of_int (abs j) rdvd real_of_int (?c*i) + (?N ?r))"
  3.1154        by (simp only: rdvd_abs1[where d="j" and t="real_of_int (?c*i) + ?N ?r", symmetric]) simp
  3.1155 -    also have "\<dots> = ((abs j) dvd (floor ((?N ?r) + real_of_int (?c*i))) \<and> 
  3.1156 -       (real_of_int (floor ((?N ?r) + real_of_int (?c*i))) = (real_of_int (?c*i) + (?N ?r))))" 
  3.1157 +    also have "\<dots> = ((abs j) dvd (floor ((?N ?r) + real_of_int (?c*i))) \<and>
  3.1158 +       (real_of_int (floor ((?N ?r) + real_of_int (?c*i))) = (real_of_int (?c*i) + (?N ?r))))"
  3.1159        by(simp only: int_rdvd_real[where i="abs j" and x="real_of_int (?c*i) + (?N ?r)"]) (simp only: ac_simps)
  3.1160      also have "\<dots> = (?I (?l (Dvd j a)))" using cn cnz jnz
  3.1161        using rdvd_minus [where d="abs j" and t="real_of_int (?c*i + floor (?N ?r))", simplified, symmetric]
  3.1162 -      by (simp add: Let_def split_def int_rdvd_iff[symmetric]  
  3.1163 +      by (simp add: Let_def split_def int_rdvd_iff[symmetric]
  3.1164          del: of_int_mult) (auto simp add: ac_simps)
  3.1165      finally have ?case using l jnz by blast }
  3.1166    ultimately show ?case by blast
  3.1167 @@ -1891,44 +1891,44 @@
  3.1168    let ?c = "fst (zsplit0 a)"
  3.1169    let ?r = "snd (zsplit0 a)"
  3.1170    have spl: "zsplit0 a = (?c,?r)" by simp
  3.1171 -  from zsplit0_I[OF spl, where x="i" and bs="bs"] 
  3.1172 -  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 
  3.1173 +  from zsplit0_I[OF spl, where x="i" and bs="bs"]
  3.1174 +  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
  3.1175    let ?N = "\<lambda> t. Inum (real_of_int i#bs) t"
  3.1176    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
  3.1177    moreover
  3.1178 -  {assume j: "j=0" hence z: "zlfm (NDvd j a) = (zlfm (NEq a))" by (simp add: Let_def) 
  3.1179 +  {assume j: "j=0" hence z: "zlfm (NDvd j a) = (zlfm (NEq a))" by (simp add: Let_def)
  3.1180      hence ?case using 12 j by (simp del: zlfm.simps add: rdvd_left_0_eq)}
  3.1181    moreover
  3.1182 -  {assume "?c=0" and "j\<noteq>0" hence ?case 
  3.1183 +  {assume "?c=0" and "j\<noteq>0" hence ?case
  3.1184        using zsplit0_I[OF spl, where x="i" and bs="bs"] rdvd_abs1[where d="j"]
  3.1185        by (cases "?r", simp_all add: Let_def split_def, rename_tac nat a b, case_tac "nat", simp_all)}
  3.1186    moreover
  3.1187 -  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" and jnz: "j\<noteq>0" hence l: "?L (?l (NDvd j a))" 
  3.1188 +  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" and jnz: "j\<noteq>0" hence l: "?L (?l (NDvd j a))"
  3.1189        by (simp add: nb Let_def split_def isint_Floor isint_neg)
  3.1190 -    have "?I (NDvd j a) = (\<not> (real_of_int j rdvd (real_of_int (?c * i) + (?N ?r))))" 
  3.1191 +    have "?I (NDvd j a) = (\<not> (real_of_int j rdvd (real_of_int (?c * i) + (?N ?r))))"
  3.1192        using Ia by (simp add: Let_def split_def)
  3.1193 -    also have "\<dots> = (\<not> (real_of_int (abs j) rdvd real_of_int (?c*i) + (?N ?r)))" 
  3.1194 +    also have "\<dots> = (\<not> (real_of_int (abs j) rdvd real_of_int (?c*i) + (?N ?r)))"
  3.1195        by (simp only: rdvd_abs1[where d="j" and t="real_of_int (?c*i) + ?N ?r", symmetric]) simp
  3.1196 -    also have "\<dots> = (\<not> ((abs j) dvd (floor ((?N ?r) + real_of_int (?c*i))) \<and> 
  3.1197 -       (real_of_int (floor ((?N ?r) + real_of_int (?c*i))) = (real_of_int (?c*i) + (?N ?r)))))" 
  3.1198 +    also have "\<dots> = (\<not> ((abs j) dvd (floor ((?N ?r) + real_of_int (?c*i))) \<and>
  3.1199 +       (real_of_int (floor ((?N ?r) + real_of_int (?c*i))) = (real_of_int (?c*i) + (?N ?r)))))"
  3.1200        by(simp only: int_rdvd_real[where i="abs j" and x="real_of_int (?c*i) + (?N ?r)"]) (simp only: ac_simps)
  3.1201 -    also have "\<dots> = (?I (?l (NDvd j a)))" using cp cnz jnz  
  3.1202 -      by (simp add: Let_def split_def int_rdvd_iff[symmetric]  
  3.1203 +    also have "\<dots> = (?I (?l (NDvd j a)))" using cp cnz jnz
  3.1204 +      by (simp add: Let_def split_def int_rdvd_iff[symmetric]
  3.1205          del: of_int_mult) (auto simp add: ac_simps)
  3.1206      finally have ?case using l jnz  by simp }
  3.1207    moreover
  3.1208 -  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" and jnz: "j\<noteq>0" hence l: "?L (?l (NDvd j a))" 
  3.1209 +  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" and jnz: "j\<noteq>0" hence l: "?L (?l (NDvd j a))"
  3.1210        by (simp add: nb Let_def split_def isint_Floor isint_neg)
  3.1211 -    have "?I (NDvd j a) = (\<not> (real_of_int j rdvd (real_of_int (?c * i) + (?N ?r))))" 
  3.1212 +    have "?I (NDvd j a) = (\<not> (real_of_int j rdvd (real_of_int (?c * i) + (?N ?r))))"
  3.1213        using Ia by (simp add: Let_def split_def)
  3.1214 -    also have "\<dots> = (\<not> (real_of_int (abs j) rdvd real_of_int (?c*i) + (?N ?r)))" 
  3.1215 +    also have "\<dots> = (\<not> (real_of_int (abs j) rdvd real_of_int (?c*i) + (?N ?r)))"
  3.1216        by (simp only: rdvd_abs1[where d="j" and t="real_of_int (?c*i) + ?N ?r", symmetric]) simp
  3.1217 -    also have "\<dots> = (\<not> ((abs j) dvd (floor ((?N ?r) + real_of_int (?c*i))) \<and> 
  3.1218 -       (real_of_int (floor ((?N ?r) + real_of_int (?c*i))) = (real_of_int (?c*i) + (?N ?r)))))" 
  3.1219 +    also have "\<dots> = (\<not> ((abs j) dvd (floor ((?N ?r) + real_of_int (?c*i))) \<and>
  3.1220 +       (real_of_int (floor ((?N ?r) + real_of_int (?c*i))) = (real_of_int (?c*i) + (?N ?r)))))"
  3.1221        by(simp only: int_rdvd_real[where i="abs j" and x="real_of_int (?c*i) + (?N ?r)"]) (simp only: ac_simps)
  3.1222      also have "\<dots> = (?I (?l (NDvd j a)))" using cn cnz jnz
  3.1223        using rdvd_minus [where d="abs j" and t="real_of_int (?c*i + floor (?N ?r))", simplified, symmetric]
  3.1224 -      by (simp add: Let_def split_def int_rdvd_iff[symmetric]  
  3.1225 +      by (simp add: Let_def split_def int_rdvd_iff[symmetric]
  3.1226          del: of_int_mult) (auto simp add: ac_simps)
  3.1227      finally have ?case using l jnz by blast }
  3.1228    ultimately show ?case by blast
  3.1229 @@ -1940,8 +1940,8 @@
  3.1230         \<open>d_\<delta>\<close> checks if a given l divides all the ds above\<close>
  3.1231  
  3.1232  fun minusinf:: "fm \<Rightarrow> fm" where
  3.1233 -  "minusinf (And p q) = conj (minusinf p) (minusinf q)" 
  3.1234 -| "minusinf (Or p q) = disj (minusinf p) (minusinf q)" 
  3.1235 +  "minusinf (And p q) = conj (minusinf p) (minusinf q)"
  3.1236 +| "minusinf (Or p q) = disj (minusinf p) (minusinf q)"
  3.1237  | "minusinf (Eq  (CN 0 c e)) = F"
  3.1238  | "minusinf (NEq (CN 0 c e)) = T"
  3.1239  | "minusinf (Lt  (CN 0 c e)) = T"
  3.1240 @@ -1954,8 +1954,8 @@
  3.1241    by (induct p rule: minusinf.induct, auto)
  3.1242  
  3.1243  fun plusinf:: "fm \<Rightarrow> fm" where
  3.1244 -  "plusinf (And p q) = conj (plusinf p) (plusinf q)" 
  3.1245 -| "plusinf (Or p q) = disj (plusinf p) (plusinf q)" 
  3.1246 +  "plusinf (And p q) = conj (plusinf p) (plusinf q)"
  3.1247 +| "plusinf (Or p q) = disj (plusinf p) (plusinf q)"
  3.1248  | "plusinf (Eq  (CN 0 c e)) = F"
  3.1249  | "plusinf (NEq (CN 0 c e)) = T"
  3.1250  | "plusinf (Lt  (CN 0 c e)) = F"
  3.1251 @@ -1965,20 +1965,20 @@
  3.1252  | "plusinf p = p"
  3.1253  
  3.1254  fun \<delta> :: "fm \<Rightarrow> int" where
  3.1255 -  "\<delta> (And p q) = lcm (\<delta> p) (\<delta> q)" 
  3.1256 -| "\<delta> (Or p q) = lcm (\<delta> p) (\<delta> q)" 
  3.1257 +  "\<delta> (And p q) = lcm (\<delta> p) (\<delta> q)"
  3.1258 +| "\<delta> (Or p q) = lcm (\<delta> p) (\<delta> q)"
  3.1259  | "\<delta> (Dvd i (CN 0 c e)) = i"
  3.1260  | "\<delta> (NDvd i (CN 0 c e)) = i"
  3.1261  | "\<delta> p = 1"
  3.1262  
  3.1263  fun d_\<delta> :: "fm \<Rightarrow> int \<Rightarrow> bool" where
  3.1264 -  "d_\<delta> (And p q) = (\<lambda> d. d_\<delta> p d \<and> d_\<delta> q d)" 
  3.1265 -| "d_\<delta> (Or p q) = (\<lambda> d. d_\<delta> p d \<and> d_\<delta> q d)" 
  3.1266 +  "d_\<delta> (And p q) = (\<lambda> d. d_\<delta> p d \<and> d_\<delta> q d)"
  3.1267 +| "d_\<delta> (Or p q) = (\<lambda> d. d_\<delta> p d \<and> d_\<delta> q d)"
  3.1268  | "d_\<delta> (Dvd i (CN 0 c e)) = (\<lambda> d. i dvd d)"
  3.1269  | "d_\<delta> (NDvd i (CN 0 c e)) = (\<lambda> d. i dvd d)"
  3.1270  | "d_\<delta> p = (\<lambda> d. True)"
  3.1271  
  3.1272 -lemma delta_mono: 
  3.1273 +lemma delta_mono:
  3.1274    assumes lin: "iszlfm p bs"
  3.1275    and d: "d dvd d'"
  3.1276    and ad: "d_\<delta> p d"
  3.1277 @@ -1996,17 +1996,17 @@
  3.1278    shows "d_\<delta> p (\<delta> p) \<and> \<delta> p >0"
  3.1279  using lin
  3.1280  proof (induct p rule: iszlfm.induct)
  3.1281 -  case (1 p q) 
  3.1282 +  case (1 p q)
  3.1283    let ?d = "\<delta> (And p q)"
  3.1284    from 1 lcm_pos_int have dp: "?d >0" by simp
  3.1285 -  have d1: "\<delta> p dvd \<delta> (And p q)" using 1 by simp 
  3.1286 -  hence th: "d_\<delta> p ?d" 
  3.1287 +  have d1: "\<delta> p dvd \<delta> (And p q)" using 1 by simp
  3.1288 +  hence th: "d_\<delta> p ?d"
  3.1289      using delta_mono 1 by (simp only: iszlfm.simps) blast
  3.1290 -  have "\<delta> q dvd \<delta> (And p q)" using 1 by simp 
  3.1291 +  have "\<delta> q dvd \<delta> (And p q)" using 1 by simp
  3.1292    hence th': "d_\<delta> q ?d" using delta_mono 1 by (simp only: iszlfm.simps) blast
  3.1293 -  from th th' dp show ?case by simp 
  3.1294 +  from th th' dp show ?case by simp
  3.1295  next
  3.1296 -  case (2 p q)  
  3.1297 +  case (2 p q)
  3.1298    let ?d = "\<delta> (And p q)"
  3.1299    from 2 lcm_pos_int have dp: "?d >0" by simp
  3.1300    have "\<delta> p dvd \<delta> (And p q)" using 2 by simp
  3.1301 @@ -2041,101 +2041,101 @@
  3.1302    from z1_def z2_def have "\<forall> x < ?z. ?I x (?M (Or f g)) = ?I x (Or f g)" by simp
  3.1303    thus ?case by blast
  3.1304  next
  3.1305 -  case (3 c e) 
  3.1306 +  case (3 c e)
  3.1307    then have "c > 0" by simp
  3.1308    hence rcpos: "real_of_int c > 0" by simp
  3.1309    from 3 have nbe: "numbound0 e" by simp
  3.1310    fix y
  3.1311    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))"
  3.1312 -  proof (simp add: less_floor_iff , rule allI, rule impI) 
  3.1313 +  proof (simp add: less_floor_iff , rule allI, rule impI)
  3.1314      fix x :: int
  3.1315      assume A: "real_of_int x + 1 \<le> - (Inum (y # bs) e / real_of_int c)"
  3.1316      hence th1:"real_of_int x < - (Inum (y # bs) e / real_of_int c)" by simp
  3.1317      with rcpos  have "(real_of_int c)*(real_of_int  x) < (real_of_int c)*(- (Inum (y # bs) e / real_of_int c))"
  3.1318        by (simp only: mult_strict_left_mono [OF th1 rcpos])
  3.1319      hence "real_of_int c * real_of_int x + Inum (y # bs) e \<noteq> 0"using rcpos  by simp
  3.1320 -    thus "real_of_int c * real_of_int x + Inum (real_of_int x # bs) e \<noteq> 0" 
  3.1321 +    thus "real_of_int c * real_of_int x + Inum (real_of_int x # bs) e \<noteq> 0"
  3.1322        using numbound0_I[OF nbe, where b="y" and bs="bs" and b'="real_of_int x"]  by simp
  3.1323    qed
  3.1324    thus ?case by blast
  3.1325  next
  3.1326 -  case (4 c e) 
  3.1327 +  case (4 c e)
  3.1328    then have "c > 0" by simp hence rcpos: "real_of_int c > 0" by simp
  3.1329    from 4 have nbe: "numbound0 e" by simp
  3.1330    fix y
  3.1331    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))"
  3.1332 -  proof (simp add: less_floor_iff , rule allI, rule impI) 
  3.1333 +  proof (simp add: less_floor_iff , rule allI, rule impI)
  3.1334      fix x :: int
  3.1335      assume A: "real_of_int x + 1 \<le> - (Inum (y # bs) e / real_of_int c)"
  3.1336      hence th1:"real_of_int x < - (Inum (y # bs) e / real_of_int c)" by simp
  3.1337      with rcpos  have "(real_of_int c)*(real_of_int x) < (real_of_int c)*(- (Inum (y # bs) e / real_of_int c))"
  3.1338        by (simp only: mult_strict_left_mono [OF th1 rcpos])
  3.1339      hence "real_of_int c * real_of_int x + Inum (y # bs) e \<noteq> 0"using rcpos  by simp
  3.1340 -    thus "real_of_int c * real_of_int x + Inum (real_of_int x # bs) e \<noteq> 0" 
  3.1341 +    thus "real_of_int c * real_of_int x + Inum (real_of_int x # bs) e \<noteq> 0"
  3.1342        using numbound0_I[OF nbe, where b="y" and bs="bs" and b'="real_of_int x"]  by simp
  3.1343    qed
  3.1344    thus ?case by blast
  3.1345  next
  3.1346 -  case (5 c e) 
  3.1347 +  case (5 c e)
  3.1348    then have "c > 0" by simp hence rcpos: "real_of_int c > 0" by simp
  3.1349    from 5 have nbe: "numbound0 e" by simp
  3.1350    fix y
  3.1351    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))"
  3.1352 -  proof (simp add: less_floor_iff , rule allI, rule impI) 
  3.1353 +  proof (simp add: less_floor_iff , rule allI, rule impI)
  3.1354      fix x :: int
  3.1355      assume A: "real_of_int x + 1 \<le> - (Inum (y # bs) e / real_of_int c)"
  3.1356      hence th1:"real_of_int x < - (Inum (y # bs) e / real_of_int c)" by simp
  3.1357      with rcpos  have "(real_of_int c)*(real_of_int x) < (real_of_int c)*(- (Inum (y # bs) e / real_of_int c))"
  3.1358        by (simp only: mult_strict_left_mono [OF th1 rcpos])
  3.1359 -    thus "real_of_int c * real_of_int x + Inum (real_of_int x # bs) e < 0" 
  3.1360 +    thus "real_of_int c * real_of_int x + Inum (real_of_int x # bs) e < 0"
  3.1361        using numbound0_I[OF nbe, where b="y" and bs="bs" and b'="real_of_int x"] rcpos by simp
  3.1362    qed
  3.1363    thus ?case by blast
  3.1364  next
  3.1365 -  case (6 c e) 
  3.1366 +  case (6 c e)
  3.1367    then have "c > 0" by simp hence rcpos: "real_of_int c > 0" by simp
  3.1368    from 6 have nbe: "numbound0 e" by simp
  3.1369    fix y
  3.1370    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))"
  3.1371 -  proof (simp add: less_floor_iff , rule allI, rule impI) 
  3.1372 +  proof (simp add: less_floor_iff , rule allI, rule impI)
  3.1373      fix x :: int
  3.1374      assume A: "real_of_int x + 1 \<le> - (Inum (y # bs) e / real_of_int c)"
  3.1375      hence th1:"real_of_int x < - (Inum (y # bs) e / real_of_int c)" by simp
  3.1376      with rcpos  have "(real_of_int c)*(real_of_int x) < (real_of_int c)*(- (Inum (y # bs) e / real_of_int c))"
  3.1377        by (simp only: mult_strict_left_mono [OF th1 rcpos])
  3.1378 -    thus "real_of_int c * real_of_int x + Inum (real_of_int x # bs) e \<le> 0" 
  3.1379 +    thus "real_of_int c * real_of_int x + Inum (real_of_int x # bs) e \<le> 0"
  3.1380        using numbound0_I[OF nbe, where b="y" and bs="bs" and b'="real_of_int x"] rcpos by simp
  3.1381    qed
  3.1382    thus ?case by blast
  3.1383  next
  3.1384 -  case (7 c e) 
  3.1385 +  case (7 c e)
  3.1386    then have "c > 0" by simp hence rcpos: "real_of_int c > 0" by simp
  3.1387    from 7 have nbe: "numbound0 e" by simp
  3.1388    fix y
  3.1389    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))"
  3.1390 -  proof (simp add: less_floor_iff , rule allI, rule impI) 
  3.1391 +  proof (simp add: less_floor_iff , rule allI, rule impI)
  3.1392      fix x :: int
  3.1393      assume A: "real_of_int x + 1 \<le> - (Inum (y # bs) e / real_of_int c)"
  3.1394      hence th1:"real_of_int x < - (Inum (y # bs) e / real_of_int c)" by simp
  3.1395      with rcpos  have "(real_of_int c)*(real_of_int x) < (real_of_int c)*(- (Inum (y # bs) e / real_of_int c))"
  3.1396        by (simp only: mult_strict_left_mono [OF th1 rcpos])
  3.1397 -    thus "\<not> (real_of_int c * real_of_int x + Inum (real_of_int x # bs) e>0)" 
  3.1398 +    thus "\<not> (real_of_int c * real_of_int x + Inum (real_of_int x # bs) e>0)"
  3.1399        using numbound0_I[OF nbe, where b="y" and bs="bs" and b'="real_of_int x"] rcpos by simp
  3.1400    qed
  3.1401    thus ?case by blast
  3.1402  next
  3.1403 -  case (8 c e) 
  3.1404 +  case (8 c e)
  3.1405    then have "c > 0" by simp hence rcpos: "real_of_int c > 0" by simp
  3.1406    from 8 have nbe: "numbound0 e" by simp
  3.1407    fix y
  3.1408    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))"
  3.1409 -  proof (simp add: less_floor_iff , rule allI, rule impI) 
  3.1410 +  proof (simp add: less_floor_iff , rule allI, rule impI)
  3.1411      fix x :: int
  3.1412      assume A: "real_of_int x + 1 \<le> - (Inum (y # bs) e / real_of_int c)"
  3.1413      hence th1:"real_of_int x < - (Inum (y # bs) e / real_of_int c)" by simp
  3.1414      with rcpos  have "(real_of_int c)*(real_of_int x) < (real_of_int c)*(- (Inum (y # bs) e / real_of_int c))"
  3.1415        by (simp only: mult_strict_left_mono [OF th1 rcpos])
  3.1416 -    thus "\<not> real_of_int c * real_of_int x + Inum (real_of_int x # bs) e \<ge> 0" 
  3.1417 +    thus "\<not> real_of_int c * real_of_int x + Inum (real_of_int x # bs) e \<ge> 0"
  3.1418        using numbound0_I[OF nbe, where b="y" and bs="bs" and b'="real_of_int x"] rcpos by simp
  3.1419    qed
  3.1420    thus ?case by blast
  3.1421 @@ -2145,24 +2145,24 @@
  3.1422    assumes d: "d_\<delta> p d" and linp: "iszlfm p (a # bs)"
  3.1423    shows "Ifm ((real_of_int(x - k*d))#bs) (minusinf p) = Ifm (real_of_int x #bs) (minusinf p)"
  3.1424  using linp d
  3.1425 -proof(induct p rule: iszlfm.induct) 
  3.1426 +proof(induct p rule: iszlfm.induct)
  3.1427    case (9 i c e) hence nbe: "numbound0 e"  and id: "i dvd d" by simp+
  3.1428      hence "\<exists> k. d=i*k" by (simp add: dvd_def)
  3.1429      then obtain "di" where di_def: "d=i*di" by blast
  3.1430 -    show ?case 
  3.1431 +    show ?case
  3.1432      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)
  3.1433 -      assume 
  3.1434 +      assume
  3.1435          "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"
  3.1436        (is "?ri rdvd ?rc*?rx - ?rc*(?rk*?rd) + ?I x e" is "?ri rdvd ?rt")
  3.1437        hence "\<exists> (l::int). ?rt = ?ri * (real_of_int l)" by (simp add: rdvd_def)
  3.1438 -      hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri*(real_of_int l)+?rc*(?rk * (real_of_int i) * (real_of_int di))" 
  3.1439 +      hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri*(real_of_int l)+?rc*(?rk * (real_of_int i) * (real_of_int di))"
  3.1440          by (simp add: algebra_simps di_def)
  3.1441        hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri*(real_of_int (l + c*k*di))"
  3.1442          by (simp add: algebra_simps)
  3.1443        hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri* (real_of_int l)" by blast
  3.1444        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
  3.1445      next
  3.1446 -      assume 
  3.1447 +      assume
  3.1448          "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")
  3.1449        hence "\<exists> (l::int). ?rc*?rx+?e = ?ri * (real_of_int l)" by (simp add: rdvd_def)
  3.1450        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
  3.1451 @@ -2176,20 +2176,20 @@
  3.1452    case (10 i c e) hence nbe: "numbound0 e"  and id: "i dvd d" by simp+
  3.1453      hence "\<exists> k. d=i*k" by (simp add: dvd_def)
  3.1454      then obtain "di" where di_def: "d=i*di" by blast
  3.1455 -    show ?case 
  3.1456 +    show ?case
  3.1457      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)
  3.1458 -      assume 
  3.1459 +      assume
  3.1460          "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"
  3.1461        (is "?ri rdvd ?rc*?rx - ?rc*(?rk*?rd) + ?I x e" is "?ri rdvd ?rt")
  3.1462        hence "\<exists> (l::int). ?rt = ?ri * (real_of_int l)" by (simp add: rdvd_def)
  3.1463 -      hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri*(real_of_int l)+?rc*(?rk * (real_of_int i) * (real_of_int di))" 
  3.1464 +      hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri*(real_of_int l)+?rc*(?rk * (real_of_int i) * (real_of_int di))"
  3.1465          by (simp add: algebra_simps di_def)
  3.1466        hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri*(real_of_int (l + c*k*di))"
  3.1467          by (simp add: algebra_simps)
  3.1468        hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri* (real_of_int l)" by blast
  3.1469        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
  3.1470      next
  3.1471 -      assume 
  3.1472 +      assume
  3.1473          "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")
  3.1474        hence "\<exists> (l::int). ?rc*?rx+?e = ?ri * (real_of_int l)"
  3.1475          by (simp add: rdvd_def)
  3.1476 @@ -2221,7 +2221,7 @@
  3.1477  
  3.1478  lemma minusinf_bex:
  3.1479    assumes lin: "iszlfm p (real_of_int (a::int) #bs)"
  3.1480 -  shows "(\<exists> (x::int). Ifm (real_of_int x#bs) (minusinf p)) = 
  3.1481 +  shows "(\<exists> (x::int). Ifm (real_of_int x#bs) (minusinf p)) =
  3.1482           (\<exists> (x::int)\<in> {1..\<delta> p}. Ifm (real_of_int x#bs) (minusinf p))"
  3.1483    (is "(\<exists> x. ?P x) = _")
  3.1484  proof-
  3.1485 @@ -2234,7 +2234,7 @@
  3.1486  
  3.1487  lemma dvd1_eq1: "x >0 \<Longrightarrow> (x::int) dvd 1 = (x = 1)" by auto
  3.1488  
  3.1489 -consts 
  3.1490 +consts
  3.1491    a_\<beta> :: "fm \<Rightarrow> int \<Rightarrow> fm" (* adjusts the coeffitients of a formula *)
  3.1492    d_\<beta> :: "fm \<Rightarrow> int \<Rightarrow> bool" (* tests if all coeffs c of c divide a given l*)
  3.1493    \<zeta>  :: "fm \<Rightarrow> int" (* computes the lcm of all coefficients of x*)
  3.1494 @@ -2242,8 +2242,8 @@
  3.1495    \<alpha> :: "fm \<Rightarrow> num list"
  3.1496  
  3.1497  recdef a_\<beta> "measure size"
  3.1498 -  "a_\<beta> (And p q) = (\<lambda> k. And (a_\<beta> p k) (a_\<beta> q k))" 
  3.1499 -  "a_\<beta> (Or p q) = (\<lambda> k. Or (a_\<beta> p k) (a_\<beta> q k))" 
  3.1500 +  "a_\<beta> (And p q) = (\<lambda> k. And (a_\<beta> p k) (a_\<beta> q k))"
  3.1501 +  "a_\<beta> (Or p q) = (\<lambda> k. Or (a_\<beta> p k) (a_\<beta> q k))"
  3.1502    "a_\<beta> (Eq  (CN 0 c e)) = (\<lambda> k. Eq (CN 0 1 (Mul (k div c) e)))"
  3.1503    "a_\<beta> (NEq (CN 0 c e)) = (\<lambda> k. NEq (CN 0 1 (Mul (k div c) e)))"
  3.1504    "a_\<beta> (Lt  (CN 0 c e)) = (\<lambda> k. Lt (CN 0 1 (Mul (k div c) e)))"
  3.1505 @@ -2255,8 +2255,8 @@
  3.1506    "a_\<beta> p = (\<lambda> k. p)"
  3.1507  
  3.1508  recdef d_\<beta> "measure size"
  3.1509 -  "d_\<beta> (And p q) = (\<lambda> k. (d_\<beta> p k) \<and> (d_\<beta> q k))" 
  3.1510 -  "d_\<beta> (Or p q) = (\<lambda> k. (d_\<beta> p k) \<and> (d_\<beta> q k))" 
  3.1511 +  "d_\<beta> (And p q) = (\<lambda> k. (d_\<beta> p k) \<and> (d_\<beta> q k))"
  3.1512 +  "d_\<beta> (Or p q) = (\<lambda> k. (d_\<beta> p k) \<and> (d_\<beta> q k))"
  3.1513    "d_\<beta> (Eq  (CN 0 c e)) = (\<lambda> k. c dvd k)"
  3.1514    "d_\<beta> (NEq (CN 0 c e)) = (\<lambda> k. c dvd k)"
  3.1515    "d_\<beta> (Lt  (CN 0 c e)) = (\<lambda> k. c dvd k)"
  3.1516 @@ -2268,8 +2268,8 @@
  3.1517    "d_\<beta> p = (\<lambda> k. True)"
  3.1518  
  3.1519  recdef \<zeta> "measure size"
  3.1520 -  "\<zeta> (And p q) = lcm (\<zeta> p) (\<zeta> q)" 
  3.1521 -  "\<zeta> (Or p q) = lcm (\<zeta> p) (\<zeta> q)" 
  3.1522 +  "\<zeta> (And p q) = lcm (\<zeta> p) (\<zeta> q)"
  3.1523 +  "\<zeta> (Or p q) = lcm (\<zeta> p) (\<zeta> q)"
  3.1524    "\<zeta> (Eq  (CN 0 c e)) = c"
  3.1525    "\<zeta> (NEq (CN 0 c e)) = c"
  3.1526    "\<zeta> (Lt  (CN 0 c e)) = c"
  3.1527 @@ -2281,8 +2281,8 @@
  3.1528    "\<zeta> p = 1"
  3.1529  
  3.1530  recdef \<beta> "measure size"
  3.1531 -  "\<beta> (And p q) = (\<beta> p @ \<beta> q)" 
  3.1532 -  "\<beta> (Or p q) = (\<beta> p @ \<beta> q)" 
  3.1533 +  "\<beta> (And p q) = (\<beta> p @ \<beta> q)"
  3.1534 +  "\<beta> (Or p q) = (\<beta> p @ \<beta> q)"
  3.1535    "\<beta> (Eq  (CN 0 c e)) = [Sub (C (- 1)) e]"
  3.1536    "\<beta> (NEq (CN 0 c e)) = [Neg e]"
  3.1537    "\<beta> (Lt  (CN 0 c e)) = []"
  3.1538 @@ -2292,8 +2292,8 @@
  3.1539    "\<beta> p = []"
  3.1540  
  3.1541  recdef \<alpha> "measure size"
  3.1542 -  "\<alpha> (And p q) = (\<alpha> p @ \<alpha> q)" 
  3.1543 -  "\<alpha> (Or p q) = (\<alpha> p @ \<alpha> q)" 
  3.1544 +  "\<alpha> (And p q) = (\<alpha> p @ \<alpha> q)"
  3.1545 +  "\<alpha> (Or p q) = (\<alpha> p @ \<alpha> q)"
  3.1546    "\<alpha> (Eq  (CN 0 c e)) = [Add (C (- 1)) e]"
  3.1547    "\<alpha> (NEq (CN 0 c e)) = [e]"
  3.1548    "\<alpha> (Lt  (CN 0 c e)) = [e]"
  3.1549 @@ -2303,8 +2303,8 @@
  3.1550    "\<alpha> p = []"
  3.1551  consts mirror :: "fm \<Rightarrow> fm"
  3.1552  recdef mirror "measure size"
  3.1553 -  "mirror (And p q) = And (mirror p) (mirror q)" 
  3.1554 -  "mirror (Or p q) = Or (mirror p) (mirror q)" 
  3.1555 +  "mirror (And p q) = And (mirror p) (mirror q)"
  3.1556 +  "mirror (Or p q) = Or (mirror p) (mirror q)"
  3.1557    "mirror (Eq  (CN 0 c e)) = Eq (CN 0 c (Neg e))"
  3.1558    "mirror (NEq (CN 0 c e)) = NEq (CN 0 c (Neg e))"
  3.1559    "mirror (Lt  (CN 0 c e)) = Gt (CN 0 c (Neg e))"
  3.1560 @@ -2320,9 +2320,9 @@
  3.1561    shows "(Inum (real_of_int (i::int)#bs)) ` set (\<alpha> p) = (Inum (real_of_int i#bs)) ` set (\<beta> (mirror p))"
  3.1562    using lp by (induct p rule: mirror.induct) auto
  3.1563  
  3.1564 -lemma mirror: 
  3.1565 +lemma mirror:
  3.1566    assumes lp: "iszlfm p (a#bs)"
  3.1567 -  shows "Ifm (real_of_int (x::int)#bs) (mirror p) = Ifm (real_of_int (- x)#bs) p" 
  3.1568 +  shows "Ifm (real_of_int (x::int)#bs) (mirror p) = Ifm (real_of_int (- x)#bs) p"
  3.1569    using lp
  3.1570  proof(induct p rule: iszlfm.induct)
  3.1571    case (9 j c e)
  3.1572 @@ -2345,7 +2345,7 @@
  3.1573  lemma mirror_l: "iszlfm p (a#bs) \<Longrightarrow> iszlfm (mirror p) (a#bs)"
  3.1574    by (induct p rule: mirror.induct) (auto simp add: isint_neg)
  3.1575  
  3.1576 -lemma mirror_d_\<beta>: "iszlfm p (a#bs) \<and> d_\<beta> p 1 
  3.1577 +lemma mirror_d_\<beta>: "iszlfm p (a#bs) \<and> d_\<beta> p 1
  3.1578    \<Longrightarrow> iszlfm (mirror p) (a#bs) \<and> d_\<beta> (mirror p) 1"
  3.1579    by (induct p rule: mirror.induct) (auto simp add: isint_neg)
  3.1580  
  3.1581 @@ -2353,7 +2353,7 @@
  3.1582    by (induct p rule: mirror.induct) auto
  3.1583  
  3.1584  
  3.1585 -lemma mirror_ex: 
  3.1586 +lemma mirror_ex:
  3.1587    assumes lp: "iszlfm p (real_of_int (i::int)#bs)"
  3.1588    shows "(\<exists> (x::int). Ifm (real_of_int x#bs) (mirror p)) = (\<exists> (x::int). Ifm (real_of_int x#bs) p)"
  3.1589    (is "(\<exists> x. ?I x ?mp) = (\<exists> x. ?I x p)")
  3.1590 @@ -2361,7 +2361,7 @@
  3.1591    fix x assume "?I x ?mp" hence "?I (- x) p" using mirror[OF lp] by blast
  3.1592    thus "\<exists> x. ?I x p" by blast
  3.1593  next
  3.1594 -  fix x assume "?I x p" hence "?I (- x) ?mp" 
  3.1595 +  fix x assume "?I x p" hence "?I (- x) ?mp"
  3.1596      using mirror[OF lp, where x="- x", symmetric] by auto
  3.1597    thus "\<exists> x. ?I x ?mp" by blast
  3.1598  qed
  3.1599 @@ -2370,7 +2370,7 @@
  3.1600    shows "\<forall> b\<in> set (\<beta> p). numbound0 b"
  3.1601    using lp by (induct p rule: \<beta>.induct,auto)
  3.1602  
  3.1603 -lemma d_\<beta>_mono: 
  3.1604 +lemma d_\<beta>_mono:
  3.1605    assumes linp: "iszlfm p (a #bs)"
  3.1606    and dr: "d_\<beta> p l"
  3.1607    and d: "l dvd l'"
  3.1608 @@ -2383,7 +2383,7 @@
  3.1609  using lp
  3.1610  by(induct p rule: \<alpha>.induct, auto simp add: isint_add isint_c)
  3.1611  
  3.1612 -lemma \<zeta>: 
  3.1613 +lemma \<zeta>:
  3.1614    assumes linp: "iszlfm p (a #bs)"
  3.1615    shows "\<zeta> p > 0 \<and> d_\<beta> p (\<zeta> p)"
  3.1616  using linp
  3.1617 @@ -2391,15 +2391,15 @@
  3.1618    case (1 p q)
  3.1619    then  have dl1: "\<zeta> p dvd lcm (\<zeta> p) (\<zeta> q)" by simp
  3.1620    from 1 have dl2: "\<zeta> q dvd lcm (\<zeta> p) (\<zeta> q)" by simp
  3.1621 -  from 1 d_\<beta>_mono[where p = "p" and l="\<zeta> p" and l'="lcm (\<zeta> p) (\<zeta> q)"] 
  3.1622 -    d_\<beta>_mono[where p = "q" and l="\<zeta> q" and l'="lcm (\<zeta> p) (\<zeta> q)"] 
  3.1623 +  from 1 d_\<beta>_mono[where p = "p" and l="\<zeta> p" and l'="lcm (\<zeta> p) (\<zeta> q)"]
  3.1624 +    d_\<beta>_mono[where p = "q" and l="\<zeta> q" and l'="lcm (\<zeta> p) (\<zeta> q)"]
  3.1625      dl1 dl2 show ?case by (auto simp add: lcm_pos_int)
  3.1626  next
  3.1627    case (2 p q)
  3.1628    then have dl1: "\<zeta> p dvd lcm (\<zeta> p) (\<zeta> q)" by simp
  3.1629    from 2 have dl2: "\<zeta> q dvd lcm (\<zeta> p) (\<zeta> q)" by simp
  3.1630 -  from 2 d_\<beta>_mono[where p = "p" and l="\<zeta> p" and l'="lcm (\<zeta> p) (\<zeta> q)"] 
  3.1631 -    d_\<beta>_mono[where p = "q" and l="\<zeta> q" and l'="lcm (\<zeta> p) (\<zeta> q)"] 
  3.1632 +  from 2 d_\<beta>_mono[where p = "p" and l="\<zeta> p" and l'="lcm (\<zeta> p) (\<zeta> q)"]
  3.1633 +    d_\<beta>_mono[where p = "q" and l="\<zeta> q" and l'="lcm (\<zeta> p) (\<zeta> q)"]
  3.1634      dl1 dl2 show ?case by (auto simp add: lcm_pos_int)
  3.1635  qed (auto simp add: lcm_pos_int)
  3.1636  
  3.1637 @@ -2412,10 +2412,10 @@
  3.1638      from cp have cnz: "c \<noteq> 0" by simp
  3.1639      have "c div c\<le> l div c"
  3.1640        by (simp add: zdiv_mono1[OF clel cp])
  3.1641 -    then have ldcp:"0 < l div c" 
  3.1642 +    then have ldcp:"0 < l div c"
  3.1643        by (simp add: div_self[OF cnz])
  3.1644      have "c * (l div c) = c* (l div c) + l mod c" using d' dvd_eq_mod_eq_0[of "c" "l"] by simp
  3.1645 -    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric] 
  3.1646 +    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric]
  3.1647        by simp
  3.1648      hence "(real_of_int l * real_of_int x + real_of_int (l div c) * Inum (real_of_int x # bs) e < (0::real)) =
  3.1649            (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)"
  3.1650 @@ -2430,10 +2430,10 @@
  3.1651      from cp have cnz: "c \<noteq> 0" by simp
  3.1652      have "c div c\<le> l div c"
  3.1653        by (simp add: zdiv_mono1[OF clel cp])
  3.1654 -    then have ldcp:"0 < l div c" 
  3.1655 +    then have ldcp:"0 < l div c"
  3.1656        by (simp add: div_self[OF cnz])
  3.1657      have "c * (l div c) = c* (l div c) + l mod c" using d' dvd_eq_mod_eq_0[of "c" "l"] by simp
  3.1658 -    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric] 
  3.1659 +    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric]
  3.1660        by simp
  3.1661      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)) =
  3.1662            (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)"
  3.1663 @@ -2448,10 +2448,10 @@
  3.1664      from cp have cnz: "c \<noteq> 0" by simp
  3.1665      have "c div c\<le> l div c"
  3.1666        by (simp add: zdiv_mono1[OF clel cp])
  3.1667 -    then have ldcp:"0 < l div c" 
  3.1668 +    then have ldcp:"0 < l div c"
  3.1669        by (simp add: div_self[OF cnz])
  3.1670      have "c * (l div c) = c* (l div c) + l mod c" using d' dvd_eq_mod_eq_0[of "c" "l"] by simp
  3.1671 -    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric] 
  3.1672 +    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric]
  3.1673        by simp
  3.1674      hence "(real_of_int l * real_of_int x + real_of_int (l div c) * Inum (real_of_int x # bs) e > (0::real)) =
  3.1675            (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)"
  3.1676 @@ -2466,10 +2466,10 @@
  3.1677      from cp have cnz: "c \<noteq> 0" by simp
  3.1678      have "c div c\<le> l div c"
  3.1679        by (simp add: zdiv_mono1[OF clel cp])
  3.1680 -    then have ldcp:"0 < l div c" 
  3.1681 +    then have ldcp:"0 < l div c"
  3.1682        by (simp add: div_self[OF cnz])
  3.1683      have "c * (l div c) = c* (l div c) + l mod c" using d' dvd_eq_mod_eq_0[of "c" "l"] by simp
  3.1684 -    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric] 
  3.1685 +    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric]
  3.1686        by simp
  3.1687      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)) =
  3.1688            (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)"
  3.1689 @@ -2484,10 +2484,10 @@
  3.1690      from cp have cnz: "c \<noteq> 0" by simp
  3.1691      have "c div c\<le> l div c"
  3.1692        by (simp add: zdiv_mono1[OF clel cp])
  3.1693 -    then have ldcp:"0 < l div c" 
  3.1694 +    then have ldcp:"0 < l div c"
  3.1695        by (simp add: div_self[OF cnz])
  3.1696      have "c * (l div c) = c* (l div c) + l mod c" using d' dvd_eq_mod_eq_0[of "c" "l"] by simp
  3.1697 -    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric] 
  3.1698 +    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric]
  3.1699        by simp
  3.1700      hence "(real_of_int l * real_of_int x + real_of_int (l div c) * Inum (real_of_int x # bs) e = (0::real)) =
  3.1701            (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)"
  3.1702 @@ -2502,10 +2502,10 @@
  3.1703      from cp have cnz: "c \<noteq> 0" by simp
  3.1704      have "c div c\<le> l div c"
  3.1705        by (simp add: zdiv_mono1[OF clel cp])
  3.1706 -    then have ldcp:"0 < l div c" 
  3.1707 +    then have ldcp:"0 < l div c"
  3.1708        by (simp add: div_self[OF cnz])
  3.1709      have "c * (l div c) = c* (l div c) + l mod c" using d' dvd_eq_mod_eq_0[of "c" "l"] by simp
  3.1710 -    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric] 
  3.1711 +    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric]
  3.1712        by simp
  3.1713      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)) =
  3.1714            (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)"
  3.1715 @@ -2520,27 +2520,27 @@
  3.1716      from cp have cnz: "c \<noteq> 0" by simp
  3.1717      have "c div c\<le> l div c"
  3.1718        by (simp add: zdiv_mono1[OF clel cp])
  3.1719 -    then have ldcp:"0 < l div c" 
  3.1720 +    then have ldcp:"0 < l div c"
  3.1721        by (simp add: div_self[OF cnz])
  3.1722      have "c * (l div c) = c* (l div c) + l mod c" using d' dvd_eq_mod_eq_0[of "c" "l"] by simp
  3.1723 -    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric] 
  3.1724 +    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric]
  3.1725        by simp
  3.1726      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
  3.1727      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)
  3.1728      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)"
  3.1729      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
  3.1730    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
  3.1731 -  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 
  3.1732 +  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
  3.1733  next
  3.1734    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+
  3.1735      from lp cp have clel: "c\<le>l" by (simp add: zdvd_imp_le [OF d' lp])
  3.1736      from cp have cnz: "c \<noteq> 0" by simp
  3.1737      have "c div c\<le> l div c"
  3.1738        by (simp add: zdiv_mono1[OF clel cp])
  3.1739 -    then have ldcp:"0 < l div c" 
  3.1740 +    then have ldcp:"0 < l div c"
  3.1741        by (simp add: div_self[OF cnz])
  3.1742      have "c * (l div c) = c* (l div c) + l mod c" using d' dvd_eq_mod_eq_0[of "c" "l"] by simp
  3.1743 -    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric] 
  3.1744 +    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric]
  3.1745        by simp
  3.1746      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
  3.1747      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)
  3.1748 @@ -2557,7 +2557,7 @@
  3.1749    have "(\<exists> x. l dvd x \<and> ?P x) = (\<exists> (x::int). ?P (l*x))"
  3.1750      using unity_coeff_ex[where l="l" and P="?P", simplified] by simp
  3.1751    also have "\<dots> = (\<exists> (x::int). ?P' x)" using a_\<beta>[OF linp d lp] by simp
  3.1752 -  finally show ?thesis  . 
  3.1753 +  finally show ?thesis  .
  3.1754  qed
  3.1755  
  3.1756  lemma \<beta>:
  3.1757 @@ -2584,40 +2584,40 @@
  3.1758    from ie1 have ie: "real_of_int (floor ?e) = ?e" using isint_iff[where n="e" and bs="a#bs"]
  3.1759        numbound0_I[OF bn,where b="a" and b'="real_of_int x" and bs="bs"]
  3.1760      by (simp add: isint_iff)
  3.1761 -    {assume "real_of_int (x-d) +?e > 0" hence ?case using c1 
  3.1762 +    {assume "real_of_int (x-d) +?e > 0" hence ?case using c1
  3.1763        numbound0_I[OF bn,where b="real_of_int (x-d)" and b'="real_of_int x" and bs="bs"]
  3.1764          by (simp del: of_int_minus)}
  3.1765      moreover
  3.1766 -    {assume H: "\<not> real_of_int (x-d) + ?e > 0" 
  3.1767 +    {assume H: "\<not> real_of_int (x-d) + ?e > 0"
  3.1768        let ?v="Neg e"
  3.1769        have vb: "?v \<in> set (\<beta> (Gt (CN 0 c e)))" by simp
  3.1770 -      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"]] 
  3.1771 -      have nob: "\<not> (\<exists> j\<in> {1 ..d}. real_of_int x =  - ?e + real_of_int j)" by auto 
  3.1772 +      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"]]
  3.1773 +      have nob: "\<not> (\<exists> j\<in> {1 ..d}. real_of_int x =  - ?e + real_of_int j)" by auto
  3.1774        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)
  3.1775        hence "real_of_int (x + floor ?e) > real_of_int (0::int) \<and> real_of_int (x + floor ?e) \<le> real_of_int d"
  3.1776          using ie by simp
  3.1777        hence "x + floor ?e \<ge> 1 \<and> x + floor ?e \<le> d"  by simp
  3.1778        hence "\<exists> (j::int) \<in> {1 .. d}. j = x + floor ?e" by simp
  3.1779 -      hence "\<exists> (j::int) \<in> {1 .. d}. real_of_int x = real_of_int (- floor ?e + j)" by force 
  3.1780 -      hence "\<exists> (j::int) \<in> {1 .. d}. real_of_int x = - ?e + real_of_int j" 
  3.1781 +      hence "\<exists> (j::int) \<in> {1 .. d}. real_of_int x = real_of_int (- floor ?e + j)" by force
  3.1782 +      hence "\<exists> (j::int) \<in> {1 .. d}. real_of_int x = - ?e + real_of_int j"
  3.1783          by (simp add: ie[simplified isint_iff])
  3.1784        with nob have ?case by auto}
  3.1785      ultimately show ?case by blast
  3.1786  next
  3.1787 -  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" 
  3.1788 +  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"
  3.1789      and ie1:"isint e (a #bs)" using dvd1_eq1[where x="c"] by simp+
  3.1790      let ?e = "Inum (real_of_int x # bs) e"
  3.1791      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"]
  3.1792        by (simp add: isint_iff)
  3.1793 -    {assume "real_of_int (x-d) +?e \<ge> 0" hence ?case using  c1 
  3.1794 +    {assume "real_of_int (x-d) +?e \<ge> 0" hence ?case using  c1
  3.1795        numbound0_I[OF bn,where b="real_of_int (x-d)" and b'="real_of_int x" and bs="bs"]
  3.1796          by (simp del: of_int_minus)}
  3.1797      moreover
  3.1798 -    {assume H: "\<not> real_of_int (x-d) + ?e \<ge> 0" 
  3.1799 +    {assume H: "\<not> real_of_int (x-d) + ?e \<ge> 0"
  3.1800        let ?v="Sub (C (- 1)) e"
  3.1801        have vb: "?v \<in> set (\<beta> (Ge (CN 0 c e)))" by simp
  3.1802 -      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"]] 
  3.1803 -      have nob: "\<not> (\<exists> j\<in> {1 ..d}. real_of_int x =  - ?e - 1 + real_of_int j)" by auto 
  3.1804 +      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"]]
  3.1805 +      have nob: "\<not> (\<exists> j\<in> {1 ..d}. real_of_int x =  - ?e - 1 + real_of_int j)" by auto
  3.1806        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)
  3.1807        hence "real_of_int (x + floor ?e) \<ge> real_of_int (0::int) \<and> real_of_int (x + floor ?e) < real_of_int d"
  3.1808          using ie by simp
  3.1809 @@ -2625,12 +2625,12 @@
  3.1810        hence "\<exists> (j::int) \<in> {1 .. d}. j = x + floor ?e + 1" by simp
  3.1811        hence "\<exists> (j::int) \<in> {1 .. d}. x= - floor ?e - 1 + j" by (simp add: algebra_simps)
  3.1812        hence "\<exists> (j::int) \<in> {1 .. d}. real_of_int x= real_of_int (- floor ?e - 1 + j)" by presburger
  3.1813 -      hence "\<exists> (j::int) \<in> {1 .. d}. real_of_int x= - ?e - 1 + real_of_int j" 
  3.1814 +      hence "\<exists> (j::int) \<in> {1 .. d}. real_of_int x= - ?e - 1 + real_of_int j"
  3.1815          by (simp add: ie[simplified isint_iff])
  3.1816        with nob have ?case by simp }
  3.1817      ultimately show ?case by blast
  3.1818  next
  3.1819 -  case (3 c e) hence p: "Ifm (real_of_int x #bs) (Eq (CN 0 c e))" (is "?p x") and c1: "c=1" 
  3.1820 +  case (3 c e) hence p: "Ifm (real_of_int x #bs) (Eq (CN 0 c e))" (is "?p x") and c1: "c=1"
  3.1821      and bn:"numbound0 e" and ie1: "isint e (a #bs)" using dvd1_eq1[where x="c"] by simp+
  3.1822      let ?e = "Inum (real_of_int x # bs) e"
  3.1823      let ?v="(Sub (C (- 1)) e)"
  3.1824 @@ -2639,12 +2639,12 @@
  3.1825        by simp (erule ballE[where x="1"],
  3.1826          simp_all add:algebra_simps numbound0_I[OF bn,where b="real_of_int x"and b'="a"and bs="bs"])
  3.1827  next
  3.1828 -  case (4 c e)hence p: "Ifm (real_of_int x #bs) (NEq (CN 0 c e))" (is "?p x") and c1: "c=1" 
  3.1829 +  case (4 c e)hence p: "Ifm (real_of_int x #bs) (NEq (CN 0 c e))" (is "?p x") and c1: "c=1"
  3.1830      and bn:"numbound0 e" and ie1: "isint e (a #bs)" using dvd1_eq1[where x="c"] by simp+
  3.1831      let ?e = "Inum (real_of_int x # bs) e"
  3.1832      let ?v="Neg e"
  3.1833      have vb: "?v \<in> set (\<beta> (NEq (CN 0 c e)))" by simp
  3.1834 -    {assume "real_of_int x - real_of_int d + Inum ((real_of_int (x -d)) # bs) e \<noteq> 0" 
  3.1835 +    {assume "real_of_int x - real_of_int d + Inum ((real_of_int (x -d)) # bs) e \<noteq> 0"
  3.1836        hence ?case by (simp add: c1)}
  3.1837      moreover
  3.1838      {assume H: "real_of_int x - real_of_int d + Inum ((real_of_int (x -d)) # bs) e = 0"
  3.1839 @@ -2653,57 +2653,57 @@
  3.1840          by (simp add: numbound0_I[OF bn,where b="real_of_int x - real_of_int d"and b'="a"and bs="bs"])
  3.1841         with 4(5) have ?case using dp by simp}
  3.1842    ultimately show ?case by blast
  3.1843 -next 
  3.1844 -  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" 
  3.1845 +next
  3.1846 +  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"
  3.1847      and bn:"numbound0 e" using dvd1_eq1[where x="c"] by simp+
  3.1848    let ?e = "Inum (real_of_int x # bs) e"
  3.1849 -  from 9 have "isint e (a #bs)"  by simp 
  3.1850 +  from 9 have "isint e (a #bs)"  by simp
  3.1851    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"]
  3.1852      by (simp add: isint_iff)
  3.1853    from 9 have id: "j dvd d" by simp
  3.1854    from c1 ie[symmetric] have "?p x = (real_of_int j rdvd real_of_int (x+ floor ?e))" by simp
  3.1855 -  also have "\<dots> = (j dvd x + floor ?e)" 
  3.1856 +  also have "\<dots> = (j dvd x + floor ?e)"
  3.1857      using int_rdvd_real[where i="j" and x="real_of_int (x+ floor ?e)"] by simp
  3.1858 -  also have "\<dots> = (j dvd x - d + floor ?e)" 
  3.1859 +  also have "\<dots> = (j dvd x - d + floor ?e)"
  3.1860      using dvd_period[OF id, where x="x" and c="-1" and t="floor ?e"] by simp
  3.1861 -  also have "\<dots> = (real_of_int j rdvd real_of_int (x - d + floor ?e))" 
  3.1862 +  also have "\<dots> = (real_of_int j rdvd real_of_int (x - d + floor ?e))"
  3.1863      using int_rdvd_real[where i="j" and x="real_of_int (x-d + floor ?e)",symmetric, simplified]
  3.1864        ie by simp
  3.1865 -  also have "\<dots> = (real_of_int j rdvd real_of_int x - real_of_int d + ?e)" 
  3.1866 +  also have "\<dots> = (real_of_int j rdvd real_of_int x - real_of_int d + ?e)"
  3.1867      using ie by simp
  3.1868 -  finally show ?case 
  3.1869 +  finally show ?case
  3.1870      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
  3.1871  next
  3.1872    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+
  3.1873    let ?e = "Inum (real_of_int x # bs) e"
  3.1874 -  from 10 have "isint e (a#bs)"  by simp 
  3.1875 +  from 10 have "isint e (a#bs)"  by simp
  3.1876    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"]
  3.1877      by (simp add: isint_iff)
  3.1878    from 10 have id: "j dvd d" by simp
  3.1879    from c1 ie[symmetric] have "?p x = (\<not> real_of_int j rdvd real_of_int (x+ floor ?e))" by simp
  3.1880 -  also have "\<dots> = (\<not> j dvd x + floor ?e)" 
  3.1881 +  also have "\<dots> = (\<not> j dvd x + floor ?e)"
  3.1882      using int_rdvd_real[where i="j" and x="real_of_int (x+ floor ?e)"] by simp
  3.1883 -  also have "\<dots> = (\<not> j dvd x - d + floor ?e)" 
  3.1884 +  also have "\<dots> = (\<not> j dvd x - d + floor ?e)"
  3.1885      using dvd_period[OF id, where x="x" and c="-1" and t="floor ?e"] by simp
  3.1886 -  also have "\<dots> = (\<not> real_of_int j rdvd real_of_int (x - d + floor ?e))" 
  3.1887 +  also have "\<dots> = (\<not> real_of_int j rdvd real_of_int (x - d + floor ?e))"
  3.1888      using int_rdvd_real[where i="j" and x="real_of_int (x-d + floor ?e)",symmetric, simplified]
  3.1889        ie by simp
  3.1890 -  also have "\<dots> = (\<not> real_of_int j rdvd real_of_int x - real_of_int d + ?e)" 
  3.1891 +  also have "\<dots> = (\<not> real_of_int j rdvd real_of_int x - real_of_int d + ?e)"
  3.1892      using ie by simp
  3.1893    finally show ?case
  3.1894      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
  3.1895  qed (auto simp add: numbound0_I[where bs="bs" and b="real_of_int (x - d)" and b'="real_of_int x"]
  3.1896    simp del: of_int_diff)
  3.1897  
  3.1898 -lemma \<beta>':   
  3.1899 +lemma \<beta>':
  3.1900    assumes lp: "iszlfm p (a #bs)"
  3.1901    and u: "d_\<beta> p 1"
  3.1902    and d: "d_\<delta> p d"
  3.1903    and dp: "d > 0"
  3.1904    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)")
  3.1905  proof(clarify)
  3.1906 -  fix x 
  3.1907 -  assume nb:"?b" and px: "?P x" 
  3.1908 +  fix x
  3.1909 +  assume nb:"?b" and px: "?P x"
  3.1910    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)"
  3.1911      by auto
  3.1912    from  \<beta>[OF lp u d dp nb2 px] show "?P (x -d )" .
  3.1913 @@ -2714,7 +2714,7 @@
  3.1914  using lp by (induct p rule: iszlfm.induct) (auto simp add: isint_neg isint_sub)
  3.1915  
  3.1916  lemma cpmi_eq: "0 < D \<Longrightarrow> (EX z::int. ALL x. x < z --> (P x = P1 x))
  3.1917 -==> ALL x.~(EX (j::int) : {1..D}. EX (b::int) : B. P(b+j)) --> P (x) --> P (x - D) 
  3.1918 +==> ALL x.~(EX (j::int) : {1..D}. EX (b::int) : B. P(b+j)) --> P (x) --> P (x - D)
  3.1919  ==> (ALL (x::int). ALL (k::int). ((P1 x)= (P1 (x-k*D))))
  3.1920  ==> (EX (x::int). P(x)) = ((EX (j::int) : {1..D} . (P1(j))) | (EX (j::int) : {1..D}. EX (b::int) : B. P (b+j)))"
  3.1921  apply(rule iffI)
  3.1922 @@ -2744,18 +2744,18 @@
  3.1923    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))"
  3.1924    (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)))")
  3.1925  proof-
  3.1926 -  from minusinf_inf[OF lp] 
  3.1927 +  from minusinf_inf[OF lp]
  3.1928    have th: "\<exists>(z::int). \<forall>x<z. ?P (real_of_int x) = ?M x" by blast
  3.1929    let ?B' = "{floor (?I b) | b. b\<in> ?B}"
  3.1930    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
  3.1931 -  from B[rule_format] 
  3.1932 -  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))" 
  3.1933 +  from B[rule_format]
  3.1934 +  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))"
  3.1935      by simp
  3.1936    also have "\<dots> = (\<exists>j\<in>?D. \<exists>b\<in> ?B. ?P (real_of_int (floor (?I b) + j)))" by simp
  3.1937    also have"\<dots> = (\<exists> j \<in> ?D. \<exists> b \<in> ?B'. ?P (real_of_int (b + j)))"  by blast
  3.1938 -  finally have BB': 
  3.1939 -    "(\<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)))" 
  3.1940 -    by blast 
  3.1941 +  finally have BB':
  3.1942 +    "(\<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)))"
  3.1943 +    by blast
  3.1944    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
  3.1945    from minusinf_repeats[OF d lp]
  3.1946    have th3: "\<forall> x k. ?M x = ?M (x-k*d)" by simp
  3.1947 @@ -2765,14 +2765,14 @@
  3.1948      (* Reddy and Loveland *)
  3.1949  
  3.1950  
  3.1951 -consts 
  3.1952 +consts
  3.1953    \<rho> :: "fm \<Rightarrow> (num \<times> int) list" (* Compute the Reddy and Loveland Bset*)
  3.1954    \<sigma>_\<rho>:: "fm \<Rightarrow> num \<times> int \<Rightarrow> fm" (* Performs the modified substitution of Reddy and Loveland*)
  3.1955    \<alpha>_\<rho> :: "fm \<Rightarrow> (num\<times>int) list"
  3.1956    a_\<rho> :: "fm \<Rightarrow> int \<Rightarrow> fm"
  3.1957  recdef \<rho> "measure size"
  3.1958 -  "\<rho> (And p q) = (\<rho> p @ \<rho> q)" 
  3.1959 -  "\<rho> (Or p q) = (\<rho> p @ \<rho> q)" 
  3.1960 +  "\<rho> (And p q) = (\<rho> p @ \<rho> q)"
  3.1961 +  "\<rho> (Or p q) = (\<rho> p @ \<rho> q)"
  3.1962    "\<rho> (Eq  (CN 0 c e)) = [(Sub (C (- 1)) e,c)]"
  3.1963    "\<rho> (NEq (CN 0 c e)) = [(Neg e,c)]"
  3.1964    "\<rho> (Lt  (CN 0 c e)) = []"
  3.1965 @@ -2782,29 +2782,29 @@
  3.1966    "\<rho> p = []"
  3.1967  
  3.1968  recdef \<sigma>_\<rho> "measure size"
  3.1969 -  "\<sigma>_\<rho> (And p q) = (\<lambda> (t,k). And (\<sigma>_\<rho> p (t,k)) (\<sigma>_\<rho> q (t,k)))" 
  3.1970 -  "\<sigma>_\<rho> (Or p q) = (\<lambda> (t,k). Or (\<sigma>_\<rho> p (t,k)) (\<sigma>_\<rho> q (t,k)))" 
  3.1971 -  "\<sigma>_\<rho> (Eq  (CN 0 c e)) = (\<lambda> (t,k). if k dvd c then (Eq (Add (Mul (c div k) t) e)) 
  3.1972 +  "\<sigma>_\<rho> (And p q) = (\<lambda> (t,k). And (\<sigma>_\<rho> p (t,k)) (\<sigma>_\<rho> q (t,k)))"
  3.1973 +  "\<sigma>_\<rho> (Or p q) = (\<lambda> (t,k). Or (\<sigma>_\<rho> p (t,k)) (\<sigma>_\<rho> q (t,k)))"
  3.1974 +  "\<sigma>_\<rho> (Eq  (CN 0 c e)) = (\<lambda> (t,k). if k dvd c then (Eq (Add (Mul (c div k) t) e))
  3.1975                                              else (Eq (Add (Mul c t) (Mul k e))))"
  3.1976 -  "\<sigma>_\<rho> (NEq (CN 0 c e)) = (\<lambda> (t,k). if k dvd c then (NEq (Add (Mul (c div k) t) e)) 
  3.1977 +  "\<sigma>_\<rho> (NEq (CN 0 c e)) = (\<lambda> (t,k). if k dvd c then (NEq (Add (Mul (c div k) t) e))
  3.1978                                              else (NEq (Add (Mul c t) (Mul k e))))"
  3.1979 -  "\<sigma>_\<rho> (Lt  (CN 0 c e)) = (\<lambda> (t,k). if k dvd c then (Lt (Add (Mul (c div k) t) e)) 
  3.1980 +  "\<sigma>_\<rho> (Lt  (CN 0 c e)) = (\<lambda> (t,k). if k dvd c then (Lt (Add (Mul (c div k) t) e))
  3.1981                                              else (Lt (Add (Mul c t) (Mul k e))))"
  3.1982 -  "\<sigma>_\<rho> (Le  (CN 0 c e)) = (\<lambda> (t,k). if k dvd c then (Le (Add (Mul (c div k) t) e)) 
  3.1983 +  "\<sigma>_\<rho> (Le  (CN 0 c e)) = (\<lambda> (t,k). if k dvd c then (Le (Add (Mul (c div k) t) e))
  3.1984                                              else (Le (Add (Mul c t) (Mul k e))))"
  3.1985 -  "\<sigma>_\<rho> (Gt  (CN 0 c e)) = (\<lambda> (t,k). if k dvd c then (Gt (Add (Mul (c div k) t) e)) 
  3.1986 +  "\<sigma>_\<rho> (Gt  (CN 0 c e)) = (\<lambda> (t,k). if k dvd c then (Gt (Add (Mul (c div k) t) e))
  3.1987                                              else (Gt (Add (Mul c t) (Mul k e))))"
  3.1988 -  "\<sigma>_\<rho> (Ge  (CN 0 c e)) = (\<lambda> (t,k). if k dvd c then (Ge (Add (Mul (c div k) t) e)) 
  3.1989 +  "\<sigma>_\<rho> (Ge  (CN 0 c e)) = (\<lambda> (t,k). if k dvd c then (Ge (Add (Mul (c div k) t) e))
  3.1990                                              else (Ge (Add (Mul c t) (Mul k e))))"
  3.1991 -  "\<sigma>_\<rho> (Dvd i (CN 0 c e)) =(\<lambda> (t,k). if k dvd c then (Dvd i (Add (Mul (c div k) t) e)) 
  3.1992 +  "\<sigma>_\<rho> (Dvd i (CN 0 c e)) =(\<lambda> (t,k). if k dvd c then (Dvd i (Add (Mul (c div k) t) e))
  3.1993                                              else (Dvd (i*k) (Add (Mul c t) (Mul k e))))"
  3.1994 -  "\<sigma>_\<rho> (NDvd i (CN 0 c e))=(\<lambda> (t,k). if k dvd c then (NDvd i (Add (Mul (c div k) t) e)) 
  3.1995 +  "\<sigma>_\<rho> (NDvd i (CN 0 c e))=(\<lambda> (t,k). if k dvd c then (NDvd i (Add (Mul (c div k) t) e))
  3.1996                                              else (NDvd (i*k) (Add (Mul c t) (Mul k e))))"
  3.1997    "\<sigma>_\<rho> p = (\<lambda> (t,k). p)"
  3.1998  
  3.1999  recdef \<alpha>_\<rho> "measure size"
  3.2000 -  "\<alpha>_\<rho> (And p q) = (\<alpha>_\<rho> p @ \<alpha>_\<rho> q)" 
  3.2001 -  "\<alpha>_\<rho> (Or p q) = (\<alpha>_\<rho> p @ \<alpha>_\<rho> q)" 
  3.2002 +  "\<alpha>_\<rho> (And p q) = (\<alpha>_\<rho> p @ \<alpha>_\<rho> q)"
  3.2003 +  "\<alpha>_\<rho> (Or p q) = (\<alpha>_\<rho> p @ \<alpha>_\<rho> q)"
  3.2004    "\<alpha>_\<rho> (Eq  (CN 0 c e)) = [(Add (C (- 1)) e,c)]"
  3.2005    "\<alpha>_\<rho> (NEq (CN 0 c e)) = [(e,c)]"
  3.2006    "\<alpha>_\<rho> (Lt  (CN 0 c e)) = [(e,c)]"
  3.2007 @@ -2822,19 +2822,19 @@
  3.2008    and tnb: "numbound0 t"
  3.2009    and tint: "isint t (real_of_int x#bs)"
  3.2010    and kdt: "k dvd floor (Inum (b'#bs) t)"
  3.2011 -  shows "Ifm (real_of_int x#bs) (\<sigma>_\<rho> p (t,k)) = 
  3.2012 -  (Ifm ((real_of_int ((floor (Inum (b'#bs) t)) div k))#bs) p)" 
  3.2013 +  shows "Ifm (real_of_int x#bs) (\<sigma>_\<rho> p (t,k)) =
  3.2014 +  (Ifm ((real_of_int ((floor (Inum (b'#bs) t)) div k))#bs) p)"
  3.2015    (is "?I (real_of_int x) (?s p) = (?I (real_of_int ((floor (?N b' t)) div k)) p)" is "_ = (?I ?tk p)")
  3.2016  using linp kpos tnb
  3.2017  proof(induct p rule: \<sigma>_\<rho>.induct)
  3.2018 -  case (3 c e) 
  3.2019 +  case (3 c e)
  3.2020    from 3 have cp: "c > 0" and nb: "numbound0 e" by auto
  3.2021 -  { assume kdc: "k dvd c" 
  3.2022 +  { assume kdc: "k dvd c"
  3.2023      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
  3.2024      from kdc have ?case using real_of_int_div[OF kdc] real_of_int_div[OF kdt]
  3.2025        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  3.2026 -      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) } 
  3.2027 -  moreover 
  3.2028 +      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) }
  3.2029 +  moreover
  3.2030    { assume *: "\<not> k dvd c"
  3.2031      from kpos have knz': "real_of_int k \<noteq> 0" by simp
  3.2032      from tint have ti: "real_of_int (floor (?N (real_of_int x) t)) = ?N (real_of_int x) t"
  3.2033 @@ -2851,16 +2851,16 @@
  3.2034            numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
  3.2035          by (simp add: ti)
  3.2036        finally have ?case . }
  3.2037 -    ultimately show ?case by blast 
  3.2038 +    ultimately show ?case by blast
  3.2039  next
  3.2040 -  case (4 c e)  
  3.2041 +  case (4 c e)
  3.2042    then have cp: "c > 0" and nb: "numbound0 e" by auto
  3.2043 -  { assume kdc: "k dvd c" 
  3.2044 +  { assume kdc: "k dvd c"
  3.2045      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
  3.2046      from kdc have  ?case using real_of_int_div[OF kdc] real_of_int_div[OF kdt]
  3.2047        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  3.2048 -      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) } 
  3.2049 -  moreover 
  3.2050 +      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) }
  3.2051 +  moreover
  3.2052    { assume *: "\<not> k dvd c"
  3.2053      from kpos have knz': "real_of_int k \<noteq> 0" by simp
  3.2054      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
  3.2055 @@ -2876,16 +2876,16 @@
  3.2056          numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
  3.2057        by (simp add: ti)
  3.2058      finally have ?case . }
  3.2059 -  ultimately show ?case by blast 
  3.2060 +  ultimately show ?case by blast
  3.2061  next
  3.2062 -  case (5 c e) 
  3.2063 +  case (5 c e)
  3.2064    then have cp: "c > 0" and nb: "numbound0 e" by auto
  3.2065 -  { assume kdc: "k dvd c" 
  3.2066 +  { assume kdc: "k dvd c"
  3.2067      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
  3.2068      from kdc have  ?case using real_of_int_div[OF kdc] real_of_int_div[OF kdt]
  3.2069        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  3.2070 -      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) } 
  3.2071 -  moreover 
  3.2072 +      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) }
  3.2073 +  moreover
  3.2074    { assume *: "\<not> k dvd c"
  3.2075      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
  3.2076      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)"
  3.2077 @@ -2900,16 +2900,16 @@
  3.2078          numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
  3.2079        by (simp add: ti)
  3.2080      finally have ?case . }
  3.2081 -  ultimately show ?case by blast 
  3.2082 +  ultimately show ?case by blast
  3.2083  next
  3.2084    case (6 c e)
  3.2085    then have cp: "c > 0" and nb: "numbound0 e" by auto
  3.2086 -  { assume kdc: "k dvd c" 
  3.2087 +  { assume kdc: "k dvd c"
  3.2088      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
  3.2089      from kdc have  ?case using real_of_int_div[OF kdc] real_of_int_div[OF kdt]
  3.2090        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  3.2091 -      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) } 
  3.2092 -  moreover 
  3.2093 +      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) }
  3.2094 +  moreover
  3.2095    { assume *: "\<not> k dvd c"
  3.2096      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
  3.2097      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)"
  3.2098 @@ -2924,16 +2924,16 @@
  3.2099          numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
  3.2100        by (simp add: ti)
  3.2101      finally have ?case . }
  3.2102 -  ultimately show ?case by blast 
  3.2103 +  ultimately show ?case by blast
  3.2104  next
  3.2105 -  case (7 c e) 
  3.2106 +  case (7 c e)
  3.2107    then have cp: "c > 0" and nb: "numbound0 e" by auto
  3.2108 -  { assume kdc: "k dvd c" 
  3.2109 +  { assume kdc: "k dvd c"
  3.2110      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
  3.2111      from kdc have  ?case using real_of_int_div[OF kdc] real_of_int_div[OF kdt]
  3.2112        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  3.2113 -      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) } 
  3.2114 -  moreover 
  3.2115 +      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) }
  3.2116 +  moreover
  3.2117    { assume *: "\<not> k dvd c"
  3.2118      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
  3.2119      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)"
  3.2120 @@ -2948,16 +2948,16 @@
  3.2121          numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
  3.2122        by (simp add: ti)
  3.2123      finally have ?case . }
  3.2124 -  ultimately show ?case by blast 
  3.2125 +  ultimately show ?case by blast
  3.2126  next
  3.2127 -  case (8 c e)  
  3.2128 +  case (8 c e)
  3.2129    then have cp: "c > 0" and nb: "numbound0 e" by auto
  3.2130 -  { assume kdc: "k dvd c" 
  3.2131 +  { assume kdc: "k dvd c"
  3.2132      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
  3.2133      from kdc have  ?case using real_of_int_div[OF kdc] real_of_int_div[OF kdt]
  3.2134        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  3.2135 -      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) } 
  3.2136 -  moreover 
  3.2137 +      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) }
  3.2138 +  moreover
  3.2139    { assume *: "\<not> k dvd c"
  3.2140      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
  3.2141      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)"
  3.2142 @@ -2972,16 +2972,16 @@
  3.2143          numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
  3.2144        by (simp add: ti)
  3.2145      finally have ?case . }
  3.2146 -  ultimately show ?case by blast 
  3.2147 +  ultimately show ?case by blast
  3.2148  next
  3.2149    case (9 i c e)
  3.2150    then have cp: "c > 0" and nb: "numbound0 e" by auto
  3.2151 -  { assume kdc: "k dvd c" 
  3.2152 +  { assume kdc: "k dvd c"
  3.2153      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
  3.2154      from kdc have ?case using real_of_int_div[OF kdc] real_of_int_div[OF kdt]
  3.2155        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  3.2156 -      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) } 
  3.2157 -  moreover 
  3.2158 +      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) }
  3.2159 +  moreover
  3.2160    { assume *: "\<not> k dvd c"
  3.2161      from kpos have knz: "k\<noteq>0" by simp hence knz': "real_of_int k \<noteq> 0" by simp
  3.2162      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
  3.2163 @@ -2996,16 +2996,16 @@
  3.2164          numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
  3.2165        by (simp add: ti)
  3.2166      finally have ?case . }
  3.2167 -  ultimately show ?case by blast 
  3.2168 +  ultimately show ?case by blast
  3.2169  next
  3.2170    case (10 i c e)
  3.2171    then have cp: "c > 0" and nb: "numbound0 e" by auto
  3.2172 -  { assume kdc: "k dvd c" 
  3.2173 +  { assume kdc: "k dvd c"
  3.2174      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
  3.2175      from kdc have  ?case using real_of_int_div[OF kdc] real_of_int_div[OF kdt]
  3.2176        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
  3.2177 -      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) } 
  3.2178 -  moreover 
  3.2179 +      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) }
  3.2180 +  moreover
  3.2181    { assume *: "\<not> k dvd c"
  3.2182      from kpos have knz: "k\<noteq>0" by simp hence knz': "real_of_int k \<noteq> 0" by simp
  3.2183      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
  3.2184 @@ -3020,7 +3020,7 @@
  3.2185          numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
  3.2186        by (simp add: ti)
  3.2187      finally have ?case . }
  3.2188 -  ultimately show ?case by blast 
  3.2189 +  ultimately show ?case by blast
  3.2190  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"]
  3.2191    numbound0_I[where bs="bs" and b="real_of_int ((floor (?N b' t)) div k)" and b'="real_of_int x"])
  3.2192  
  3.2193 @@ -3056,7 +3056,7 @@
  3.2194    from mult_strict_left_mono[OF dp cp]  have one:"1 \<in> {1 .. c*d}" by auto
  3.2195    from nob[rule_format, where j="1", OF one] pi show ?case by simp
  3.2196  next
  3.2197 -  case (4 c e)  
  3.2198 +  case (4 c e)
  3.2199    hence cp: "c >0" and nb: "numbound0 e" and ei: "isint e (real_of_int i#bs)"
  3.2200      and nob: "\<forall> j\<in> {1 .. c*d}. real_of_int (c*i) \<noteq> - ?N i e + real_of_int j"
  3.2201      by simp+
  3.2202 @@ -3070,18 +3070,18 @@
  3.2203    ultimately show ?case by blast
  3.2204  next
  3.2205    case (5 c e) hence cp: "c > 0" by simp
  3.2206 -  from 5 mult_strict_left_mono[OF dp cp, simplified of_int_less_iff[symmetric] 
  3.2207 +  from 5 mult_strict_left_mono[OF dp cp, simplified of_int_less_iff[symmetric]
  3.2208      of_int_mult]
  3.2209 -  show ?case using 5 dp 
  3.2210 -    apply (simp add: numbound0_I[where bs="bs" and b="real_of_int i - real_of_int d" and b'="real_of_int i"] 
  3.2211 +  show ?case using 5 dp
  3.2212 +    apply (simp add: numbound0_I[where bs="bs" and b="real_of_int i - real_of_int d" and b'="real_of_int i"]
  3.2213        algebra_simps del: mult_pos_pos)
  3.2214       by (metis add.right_neutral of_int_0_less_iff of_int_mult pos_add_strict)
  3.2215  next
  3.2216    case (6 c e) hence cp: "c > 0" by simp
  3.2217 -  from 6 mult_strict_left_mono[OF dp cp, simplified of_int_less_iff[symmetric] 
  3.2218 +  from 6 mult_strict_left_mono[OF dp cp, simplified of_int_less_iff[symmetric]
  3.2219      of_int_mult]
  3.2220 -  show ?case using 6 dp 
  3.2221 -    apply (simp add: numbound0_I[where bs="bs" and b="real_of_int i - real_of_int d" and b'="real_of_int i"] 
  3.2222 +  show ?case using 6 dp
  3.2223 +    apply (simp add: numbound0_I[where bs="bs" and b="real_of_int i - real_of_int d" and b'="real_of_int i"]
  3.2224        algebra_simps del: mult_pos_pos)
  3.2225        using order_trans by fastforce
  3.2226  next
  3.2227 @@ -3096,9 +3096,9 @@
  3.2228    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
  3.2229    moreover
  3.2230    {assume "real_of_int (c*i) + ?N i e > real_of_int (c*d)" hence ?case
  3.2231 -      by (simp add: algebra_simps 
  3.2232 -        numbound0_I[OF nb,where bs="bs" and b="real_of_int i - real_of_int d" and b'="real_of_int i"])} 
  3.2233 -  moreover 
  3.2234 +      by (simp add: algebra_simps
  3.2235 +        numbound0_I[OF nb,where bs="bs" and b="real_of_int i - real_of_int d" and b'="real_of_int i"])}
  3.2236 +  moreover
  3.2237    {assume H:"real_of_int (c*i) + ?N i e \<le> real_of_int (c*d)"
  3.2238      with ei[simplified isint_iff] have "real_of_int (c*i + ?fe) \<le> real_of_int (c*d)" by simp
  3.2239      hence pid: "c*i + ?fe \<le> c*d" by (simp only: of_int_le_iff)
  3.2240 @@ -3119,9 +3119,9 @@
  3.2241    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
  3.2242    moreover
  3.2243    {assume "real_of_int (c*i) + ?N i e \<ge> real_of_int (c*d)" hence ?case
  3.2244 -      by (simp add: algebra_simps 
  3.2245 -        numbound0_I[OF nb,where bs="bs" and b="real_of_int i - real_of_int d" and b'="real_of_int i"])} 
  3.2246 -  moreover 
  3.2247 +      by (simp add: algebra_simps
  3.2248 +        numbound0_I[OF nb,where bs="bs" and b="real_of_int i - real_of_int d" and b'="real_of_int i"])}
  3.2249 +  moreover
  3.2250    {assume H:"real_of_int (c*i) + ?N i e < real_of_int (c*d)"
  3.2251      with ei[simplified isint_iff] have "real_of_int (c*i + ?fe) < real_of_int (c*d)" by simp
  3.2252      hence pid: "c*i + 1 + ?fe \<le> c*d" by (simp only: of_int_le_iff)
  3.2253 @@ -3137,61 +3137,61 @@
  3.2254  next
  3.2255    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+
  3.2256    let ?e = "Inum (real_of_int i # bs) e"
  3.2257 -  from 9 have "isint e (real_of_int i #bs)"  by simp 
  3.2258 +  from 9 have "isint e (real_of_int i #bs)"  by simp
  3.2259    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"]
  3.2260      by (simp add: isint_iff)
  3.2261    from 9 have id: "j dvd d" by simp
  3.2262    from ie[symmetric] have "?p i = (real_of_int j rdvd real_of_int (c*i+ floor ?e))" by simp
  3.2263 -  also have "\<dots> = (j dvd c*i + floor ?e)" 
  3.2264 +  also have "\<dots> = (j dvd c*i + floor ?e)"
  3.2265      using int_rdvd_iff [where i="j" and t="c*i+ floor ?e"] by simp
  3.2266 -  also have "\<dots> = (j dvd c*i - c*d + floor ?e)" 
  3.2267 +  also have "\<dots> = (j dvd c*i - c*d + floor ?e)"
  3.2268      using dvd_period[OF id, where x="c*i" and c="-c" and t="floor ?e"] by simp
  3.2269 -  also have "\<dots> = (real_of_int j rdvd real_of_int (c*i - c*d + floor ?e))" 
  3.2270 +  also have "\<dots> = (real_of_int j rdvd real_of_int (c*i - c*d + floor ?e))"
  3.2271      using int_rdvd_iff[where i="j" and t="(c*i - c*d + floor ?e)",symmetric, simplified]
  3.2272        ie by simp
  3.2273 -  also have "\<dots> = (real_of_int j rdvd real_of_int (c*(i - d)) + ?e)" 
  3.2274 +  also have "\<dots> = (real_of_int j rdvd real_of_int (c*(i - d)) + ?e)"
  3.2275      using ie by (simp add:algebra_simps)
  3.2276 -  finally show ?case 
  3.2277 -    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 
  3.2278 +  finally show ?case
  3.2279 +    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
  3.2280      by (simp add: algebra_simps)
  3.2281  next
  3.2282    case (10 j c e)
  3.2283    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"
  3.2284      by simp+
  3.2285    let ?e = "Inum (real_of_int i # bs) e"
  3.2286 -  from 10 have "isint e (real_of_int i #bs)"  by simp 
  3.2287 +  from 10 have "isint e (real_of_int i #bs)"  by simp
  3.2288    hence ie: "real_of_int (floor ?e) = ?e"
  3.2289      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"]
  3.2290      by (simp add: isint_iff)
  3.2291    from 10 have id: "j dvd d" by simp
  3.2292    from ie[symmetric] have "?p i = (\<not> (real_of_int j rdvd real_of_int (c*i+ floor ?e)))" by simp
  3.2293 -  also have "\<dots> = Not (j dvd c*i + floor ?e)" 
  3.2294 +  also have "\<dots> = Not (j dvd c*i + floor ?e)"
  3.2295      using int_rdvd_iff [where i="j" and t="c*i+ floor ?e"] by simp
  3.2296 -  also have "\<dots> = Not (j dvd c*i - c*d + floor ?e)" 
  3.2297 +  also have "\<dots> = Not (j dvd c*i - c*d + floor ?e)"
  3.2298      using dvd_period[OF id, where x="c*i" and c="-c" and t="floor ?e"] by simp
  3.2299 -  also have "\<dots> = Not (real_of_int j rdvd real_of_int (c*i - c*d + floor ?e))" 
  3.2300 +  also have "\<dots> = Not (real_of_int j rdvd real_of_int (c*i - c*d + floor ?e))"
  3.2301      using int_rdvd_iff[where i="j" and t="(c*i - c*d + floor ?e)",symmetric, simplified]
  3.2302        ie by simp
  3.2303 -  also have "\<dots> = Not (real_of_int j rdvd real_of_int (c*(i - d)) + ?e)" 
  3.2304 +  also have "\<dots> = Not (real_of_int j rdvd real_of_int (c*(i - d)) + ?e)"
  3.2305      using ie by (simp add:algebra_simps)
  3.2306 -  finally show ?case 
  3.2307 -    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 
  3.2308 +  finally show ?case
  3.2309 +    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
  3.2310      by (simp add: algebra_simps)
  3.2311  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"])
  3.2312  
  3.2313  lemma \<sigma>_nb: assumes lp: "iszlfm p (a#bs)" and nb: "numbound0 t"
  3.2314    shows "bound0 (\<sigma> p k t)"
  3.2315    using \<sigma>_\<rho>_nb[OF lp nb] nb by (simp add: \<sigma>_def)
  3.2316 -  
  3.2317 +
  3.2318  lemma \<rho>':   assumes lp: "iszlfm p (a #bs)"
  3.2319    and d: "d_\<delta> p d"
  3.2320    and dp: "d > 0"
  3.2321    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)")
  3.2322  proof(clarify)
  3.2323 -  fix x 
  3.2324 -  assume nob1:"?b x" and px: "?P x" 
  3.2325 +  fix x
  3.2326 +  assume nob1:"?b x" and px: "?P x"
  3.2327    from iszlfm_gen[OF lp, rule_format, where y="real_of_int x"] have lp': "iszlfm p (real_of_int x#bs)".
  3.2328 -  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" 
  3.2329 +  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"
  3.2330    proof(clarify)
  3.2331      fix e c j assume ecR: "(e,c) \<in> set (\<rho> p)" and jD: "j\<in> {1 .. c*d}"
  3.2332        and cx: "real_of_int (c*x) = Inum (real_of_int x#bs) e + real_of_int j"
  3.2333 @@ -3220,14 +3220,14 @@
  3.2334      have "Ifm (a#bs) (\<sigma> p c (Add e (C j)))" by blast
  3.2335        with ecR jD nob1    show "False" by blast
  3.2336    qed
  3.2337 -  from \<rho>[OF lp' px d dp nob] show "?P (x -d )" . 
  3.2338 +  from \<rho>[OF lp' px d dp nob] show "?P (x -d )" .
  3.2339  qed
  3.2340  
  3.2341  
  3.2342 -lemma rl_thm: 
  3.2343 +lemma rl_thm:
  3.2344    assumes lp: "iszlfm p (real_of_int (i::int)#bs)"
  3.2345    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)))))"
  3.2346 -  (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))" 
  3.2347 +  (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))"
  3.2348      is "?lhs = (?MD \<or> ?RD)"  is "?lhs = ?rhs")
  3.2349  proof-
  3.2350    let ?d= "\<delta> p"
  3.2351 @@ -3244,9 +3244,9 @@
  3.2352      from nb have nb': "numbound0 (Add e (C j))" by simp
  3.2353      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"]
  3.2354      have spx': "Ifm (real_of_int i # bs) (\<sigma> p c (Add e (C j)))" by blast
  3.2355 -    from spx' have rcdej:"real_of_int c rdvd (Inum (real_of_int i#bs) (Add e (C j)))" 
  3.2356 +    from spx' have rcdej:"real_of_int c rdvd (Inum (real_of_int i#bs) (Add e (C j)))"
  3.2357        and sr:"Ifm (real_of_int i#bs) (\<sigma>_\<rho> p (Add e (C j),c))" by (simp add: \<sigma>_def)+
  3.2358 -    from rcdej eji[simplified isint_iff] 
  3.2359 +    from rcdej eji[simplified isint_iff]
  3.2360      have "real_of_int c rdvd real_of_int (floor (Inum (real_of_int i#bs) (Add e (C j))))" by simp
  3.2361      hence cdej:"c dvd floor (Inum (real_of_int i#bs) (Add e (C j)))" by (simp only: int_rdvd_iff)
  3.2362      from cp have cp': "real_of_int c > 0" by simp
  3.2363 @@ -3260,7 +3260,7 @@
  3.2364      from \<rho>'[OF lp' d dp, rule_format, OF nob] have th:"\<forall> x. ?P x \<longrightarrow> ?P (x - ?d)" by blast
  3.2365      from minusinf_inf[OF lp] obtain z where z:"\<forall> x<z. ?MP x = ?P x" by blast
  3.2366      have zp: "abs (x - z) + 1 \<ge> 0" by arith
  3.2367 -    from decr_lemma[OF dp,where x="x" and z="z"] 
  3.2368 +    from decr_lemma[OF dp,where x="x" and z="z"]
  3.2369        decr_mult_lemma[OF dp th zp, rule_format, OF px] z have th:"\<exists> x. ?MP x" by auto
  3.2370      with minusinf_bex[OF lp] px nob have ?thesis by blast}
  3.2371    ultimately show ?thesis by blast
  3.2372 @@ -3270,15 +3270,15 @@
  3.2373    shows "(\<lambda> (t,k). (Inum (a#bs) t, k)) ` set (\<alpha>_\<rho> p) = (\<lambda> (t,k). (Inum (a#bs) t,k)) ` set (\<rho> (mirror p))"
  3.2374    using lp
  3.2375    by (induct p rule: mirror.induct) (simp_all add: split_def image_Un)
  3.2376 -  
  3.2377 +
  3.2378  text \<open>The \<open>\<real>\<close> part\<close>
  3.2379  
  3.2380  text\<open>Linearity for fm where Bound 0 ranges over \<open>\<real>\<close>\<close>
  3.2381  consts
  3.2382    isrlfm :: "fm \<Rightarrow> bool"   (* Linearity test for fm *)
  3.2383  recdef isrlfm "measure size"
  3.2384 -  "isrlfm (And p q) = (isrlfm p \<and> isrlfm q)" 
  3.2385 -  "isrlfm (Or p q) = (isrlfm p \<and> isrlfm q)" 
  3.2386 +  "isrlfm (And p q) = (isrlfm p \<and> isrlfm q)"
  3.2387 +  "isrlfm (Or p q) = (isrlfm p \<and> isrlfm q)"
  3.2388    "isrlfm (Eq  (CN 0 c e)) = (c>0 \<and> numbound0 e)"
  3.2389    "isrlfm (NEq (CN 0 c e)) = (c>0 \<and> numbound0 e)"
  3.2390    "isrlfm (Lt  (CN 0 c e)) = (c>0 \<and> numbound0 e)"
  3.2391 @@ -3288,21 +3288,21 @@
  3.2392    "isrlfm p = (isatom p \<and> (bound0 p))"
  3.2393  
  3.2394  definition fp :: "fm \<Rightarrow> int \<Rightarrow> num \<Rightarrow> int \<Rightarrow> fm" where
  3.2395 -  "fp p n s j \<equiv> (if n > 0 then 
  3.2396 +  "fp p n s j \<equiv> (if n > 0 then
  3.2397              (And p (And (Ge (CN 0 n (Sub s (Add (Floor s) (C j)))))
  3.2398                          (Lt (CN 0 n (Sub s (Add (Floor s) (C (j+1))))))))
  3.2399 -            else 
  3.2400 -            (And p (And (Le (CN 0 (-n) (Add (Neg s) (Add (Floor s) (C j))))) 
  3.2401 +            else
  3.2402 +            (And p (And (Le (CN 0 (-n) (Add (Neg s) (Add (Floor s) (C j)))))
  3.2403                          (Gt (CN 0 (-n) (Add (Neg s) (Add (Floor s) (C (j + 1)))))))))"
  3.2404  
  3.2405    (* splits the bounded from the unbounded part*)
  3.2406  function (sequential) rsplit0 :: "num \<Rightarrow> (fm \<times> int \<times> num) list" where
  3.2407    "rsplit0 (Bound 0) = [(T,1,C 0)]"
  3.2408 -| "rsplit0 (Add a b) = (let acs = rsplit0 a ; bcs = rsplit0 b 
  3.2409 +| "rsplit0 (Add a b) = (let acs = rsplit0 a ; bcs = rsplit0 b
  3.2410                in map (\<lambda> ((p,n,t),(q,m,s)). (And p q, n+m, Add t s)) [(a,b). a\<leftarrow>acs,b\<leftarrow>bcs])"
  3.2411  | "rsplit0 (Sub a b) = rsplit0 (Add a (Neg b))"
  3.2412  | "rsplit0 (Neg a) = map (\<lambda> (p,n,s). (p,-n,Neg s)) (rsplit0 a)"
  3.2413 -| "rsplit0 (Floor a) = concat (map 
  3.2414 +| "rsplit0 (Floor a) = concat (map
  3.2415        (\<lambda> (p,n,s). if n=0 then [(p,0,Floor s)]
  3.2416            else (map (\<lambda> j. (fp p n s j, 0, Add (Floor s) (C j))) (if n > 0 then [0 .. n] else [n .. 0])))
  3.2417         (rsplit0 a))"
  3.2418 @@ -3321,22 +3321,22 @@
  3.2419  
  3.2420  
  3.2421  lemma rsplit0_cs:
  3.2422 -  shows "\<forall> (p,n,s) \<in> set (rsplit0 t). 
  3.2423 -  (Ifm (x#bs) p \<longrightarrow>  (Inum (x#bs) t = Inum (x#bs) (CN 0 n s))) \<and> numbound0 s \<and> isrlfm p" 
  3.2424 +  shows "\<forall> (p,n,s) \<in> set (rsplit0 t).
  3.2425 +  (Ifm (x#bs) p \<longrightarrow>  (Inum (x#bs) t = Inum (x#bs) (CN 0 n s))) \<and> numbound0 s \<and> isrlfm p"
  3.2426    (is "\<forall> (p,n,s) \<in> ?SS t. (?I p \<longrightarrow> ?N t = ?N (CN 0 n s)) \<and> _ \<and> _ ")
  3.2427  proof(induct t rule: rsplit0.induct)
  3.2428 -  case (5 a) 
  3.2429 +  case (5 a)
  3.2430    let ?p = "\<lambda> (p,n,s) j. fp p n s j"
  3.2431    let ?f = "(\<lambda> (p,n,s) j. (?p (p,n,s) j, (0::int),Add (Floor s) (C j)))"
  3.2432    let ?J = "\<lambda> n. if n>0 then [0..n] else [n..0]"
  3.2433    let ?ff=" (\<lambda> (p,n,s). if n= 0 then [(p,0,Floor s)] else map (?f (p,n,s)) (?J n))"
  3.2434    have int_cases: "\<forall> (i::int). i= 0 \<or> i < 0 \<or> i > 0" by arith
  3.2435 -  have U1: "(UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). set (?ff (p,n,s)))) = 
  3.2436 +  have U1: "(UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). set (?ff (p,n,s)))) =
  3.2437      (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). set [(p,0,Floor s)]))" by auto
  3.2438 -  have U2': "\<forall> (p,n,s) \<in> {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0}. 
  3.2439 +  have U2': "\<forall> (p,n,s) \<in> {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0}.
  3.2440      ?ff (p,n,s) = map (?f(p,n,s)) [0..n]" by auto
  3.2441 -  hence U2: "(UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s). set (?ff (p,n,s)))) = 
  3.2442 -    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s). 
  3.2443 +  hence U2: "(UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s). set (?ff (p,n,s)))) =
  3.2444 +    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s).
  3.2445      set (map (?f(p,n,s)) [0..n])))"
  3.2446    proof-
  3.2447      fix M :: "('a\<times>'b\<times>'c) set" and f :: "('a\<times>'b\<times>'c) \<Rightarrow> 'd list" and g
  3.2448 @@ -3346,7 +3346,7 @@
  3.2449    qed
  3.2450    have U3': "\<forall> (p,n,s) \<in> {(p,n,s). (p,n,s) \<in> ?SS a \<and> n<0}. ?ff (p,n,s) = map (?f(p,n,s)) [n..0]"
  3.2451      by auto
  3.2452 -  hence U3: "(UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n<0} (\<lambda> (p,n,s). set (?ff (p,n,s)))) = 
  3.2453 +  hence U3: "(UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n<0} (\<lambda> (p,n,s). set (?ff (p,n,s)))) =
  3.2454      (UNION {(p,n,s). (p,n,s)\<in> ?SS a\<and>n<0} (\<lambda>(p,n,s). set (map (?f(p,n,s)) [n..0])))"
  3.2455        proof-
  3.2456      fix M :: "('a\<times>'b\<times>'c) set" and f :: "('a\<times>'b\<times>'c) \<Rightarrow> 'd list" and g
  3.2457 @@ -3357,29 +3357,29 @@
  3.2458    have "?SS (Floor a) = UNION (?SS a) (\<lambda>x. set (?ff x))"
  3.2459      by auto
  3.2460    also have "\<dots> = UNION (?SS a) (\<lambda> (p,n,s). set (?ff (p,n,s)))" by blast
  3.2461 -  also have "\<dots> = 
  3.2462 -    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). set (?ff (p,n,s)))) Un 
  3.2463 -    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s). set (?ff (p,n,s)))) Un 
  3.2464 -    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n<0} (\<lambda> (p,n,s). set (?ff (p,n,s)))))" 
  3.2465 +  also have "\<dots> =
  3.2466 +    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). set (?ff (p,n,s)))) Un
  3.2467 +    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s). set (?ff (p,n,s)))) Un
  3.2468 +    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n<0} (\<lambda> (p,n,s). set (?ff (p,n,s)))))"
  3.2469      using int_cases[rule_format] by blast
  3.2470 -  also have "\<dots> =  
  3.2471 -    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). set [(p,0,Floor s)])) Un 
  3.2472 -   (UNION {(p,n,s). (p,n,s)\<in> ?SS a\<and>n>0} (\<lambda>(p,n,s). set(map(?f(p,n,s)) [0..n]))) Un 
  3.2473 -   (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n<0} (\<lambda> (p,n,s). 
  3.2474 +  also have "\<dots> =
  3.2475 +    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). set [(p,0,Floor s)])) Un
  3.2476 +   (UNION {(p,n,s). (p,n,s)\<in> ?SS a\<and>n>0} (\<lambda>(p,n,s). set(map(?f(p,n,s)) [0..n]))) Un
  3.2477 +   (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n<0} (\<lambda> (p,n,s).
  3.2478      set (map (?f(p,n,s)) [n..0]))))" by (simp only: U1 U2 U3)
  3.2479 -  also have "\<dots> =  
  3.2480 -    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). {(p,0,Floor s)})) Un 
  3.2481 -    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s). (?f(p,n,s)) ` {0 .. n})) Un 
  3.2482 +  also have "\<dots> =
  3.2483 +    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). {(p,0,Floor s)})) Un
  3.2484 +    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s). (?f(p,n,s)) ` {0 .. n})) Un
  3.2485      (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n<0} (\<lambda> (p,n,s). (?f(p,n,s)) ` {n .. 0})))"
  3.2486      by (simp only: set_map set_upto list.set)
  3.2487 -  also have "\<dots> =   
  3.2488 -    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). {(p,0,Floor s)})) Un 
  3.2489 -    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s). {?f(p,n,s) j| j. j\<in> {0 .. n}})) Un 
  3.2490 +  also have "\<dots> =
  3.2491 +    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). {(p,0,Floor s)})) Un
  3.2492 +    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s). {?f(p,n,s) j| j. j\<in> {0 .. n}})) Un
  3.2493      (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n<0} (\<lambda> (p,n,s).  {?f(p,n,s) j| j. j\<in> {n .. 0}})))" by blast
  3.2494 -  finally 
  3.2495 -  have FS: "?SS (Floor a) =   
  3.2496 -    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). {(p,0,Floor s)})) Un 
  3.2497 -    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s). {?f(p,n,s) j| j. j\<in> {0 .. n}})) Un 
  3.2498 +  finally
  3.2499 +  have FS: "?SS (Floor a) =
  3.2500 +    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). {(p,0,Floor s)})) Un
  3.2501 +    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s). {?f(p,n,s) j| j. j\<in> {0 .. n}})) Un
  3.2502      (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n<0} (\<lambda> (p,n,s).  {?f(p,n,s) j| j. j\<in> {n .. 0}})))"    by blast
  3.2503    show ?case
  3.2504    proof(simp only: FS, clarsimp simp del: Ifm.simps Inum.simps, -)
  3.2505 @@ -3396,17 +3396,17 @@
  3.2506             ac < 0 \<and>
  3.2507             (\<exists>j. p = fp ab ac ba j \<and>
  3.2508                  n = 0 \<and> s = Add (Floor ba) (C j) \<and> ac \<le> j \<and> j \<le> 0))"
  3.2509 -    moreover 
  3.2510 +    moreover
  3.2511      { fix s'
  3.2512        assume "(p, 0, s') \<in> ?SS a" and "n = 0" and "s = Floor s'"
  3.2513        hence ?ths using 5(1) by auto }
  3.2514      moreover
  3.2515      { fix p' n' s' j
  3.2516 -      assume pns: "(p', n', s') \<in> ?SS a" 
  3.2517 -        and np: "0 < n'" 
  3.2518 -        and p_def: "p = ?p (p',n',s') j" 
  3.2519 -        and n0: "n = 0" 
  3.2520 -        and s_def: "s = (Add (Floor s') (C j))" 
  3.2521 +      assume pns: "(p', n', s') \<in> ?SS a"
  3.2522 +        and np: "0 < n'"
  3.2523 +        and p_def: "p = ?p (p',n',s') j"
  3.2524 +        and n0: "n = 0"
  3.2525 +        and s_def: "s = (Add (Floor s') (C j))"
  3.2526          and jp: "0 \<le> j" and jn: "j \<le> n'"
  3.2527        from 5 pns have H:"(Ifm ((x::real) # (bs::real list)) p' \<longrightarrow>
  3.2528            Inum (x # bs) a = Inum (x # bs) (CN 0 n' s')) \<and>
  3.2529 @@ -3415,9 +3415,9 @@
  3.2530        from H have nf: "isrlfm (?p (p',n',s') j)" using fp_def np by simp
  3.2531        let ?nxs = "CN 0 n' s'"
  3.2532        let ?l = "floor (?N s') + j"
  3.2533 -      from H 
  3.2534 -      have "?I (?p (p',n',s') j) \<longrightarrow> 
  3.2535 -          (((?N ?nxs \<ge> real_of_int ?l) \<and> (?N ?nxs < real_of_int (?l + 1))) \<and> (?N a = ?N ?nxs ))" 
  3.2536 +      from H
  3.2537 +      have "?I (?p (p',n',s') j) \<longrightarrow>
  3.2538 +          (((?N ?nxs \<ge> real_of_int ?l) \<and> (?N ?nxs < real_of_int (?l + 1))) \<and> (?N a = ?N ?nxs ))"
  3.2539          by (simp add: fp_def np algebra_simps)
  3.2540        also have "\<dots> \<longrightarrow> ((floor (?N ?nxs) = ?l) \<and> (?N a = ?N ?nxs ))"
  3.2541          using floor_unique_iff[where x="?N ?nxs" and a="?l"] by simp
  3.2542 @@ -3428,11 +3428,11 @@
  3.2543        with s_def n0 p_def nb nf have ?ths by auto}
  3.2544      moreover
  3.2545      { fix p' n' s' j
  3.2546 -      assume pns: "(p', n', s') \<in> ?SS a" 
  3.2547 -        and np: "n' < 0" 
  3.2548 -        and p_def: "p = ?p (p',n',s') j" 
  3.2549 -        and n0: "n = 0" 
  3.2550 -        and s_def: "s = (Add (Floor s') (C j))" 
  3.2551 +      assume pns: "(p', n', s') \<in> ?SS a"
  3.2552 +        and np: "n' < 0"
  3.2553 +        and p_def: "p = ?p (p',n',s') j"
  3.2554 +        and n0: "n = 0"
  3.2555 +        and s_def: "s = (Add (Floor s') (C j))"
  3.2556          and jp: "n' \<le> j" and jn: "j \<le> 0"
  3.2557        from 5 pns have H:"(Ifm ((x::real) # (bs::real list)) p' \<longrightarrow>
  3.2558            Inum (x # bs) a = Inum (x # bs) (CN 0 n' s')) \<and>
  3.2559 @@ -3441,9 +3441,9 @@
  3.2560        from H have nf: "isrlfm (?p (p',n',s') j)" using fp_def np by simp
  3.2561        let ?nxs = "CN 0 n' s'"
  3.2562        let ?l = "floor (?N s') + j"
  3.2563 -      from H 
  3.2564 -      have "?I (?p (p',n',s') j) \<longrightarrow> 
  3.2565 -          (((?N ?nxs \<ge> real_of_int ?l) \<and> (?N ?nxs < real_of_int (?l + 1))) \<and> (?N a = ?N ?nxs ))" 
  3.2566 +      from H
  3.2567 +      have "?I (?p (p',n',s') j) \<longrightarrow>
  3.2568 +          (((?N ?nxs \<ge> real_of_int ?l) \<and> (?N ?nxs < real_of_int (?l + 1))) \<and> (?N a = ?N ?nxs ))"
  3.2569          by (simp add: np fp_def algebra_simps)
  3.2570        also have "\<dots> \<longrightarrow> ((floor (?N ?nxs) = ?l) \<and> (?N a = ?N ?nxs ))"
  3.2571          using floor_unique_iff[where x="?N ?nxs" and a="?l"] by simp
  3.2572 @@ -3459,18 +3459,18 @@
  3.2573      by auto
  3.2574  qed (auto simp add: Let_def split_def algebra_simps)
  3.2575  
  3.2576 -lemma real_in_int_intervals: 
  3.2577 +lemma real_in_int_intervals:
  3.2578    assumes xb: "real_of_int m \<le> x \<and> x < real_of_int ((n::int) + 1)"
  3.2579    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")
  3.2580 -by (rule bexI[where P="?P" and x="floor x" and A="?N"]) 
  3.2581 -(auto simp add: floor_less_iff[where x="x" and z="n+1", simplified] 
  3.2582 +by (rule bexI[where P="?P" and x="floor x" and A="?N"])
  3.2583 +(auto simp add: floor_less_iff[where x="x" and z="n+1", simplified]
  3.2584    xb[simplified] floor_mono[where x="real_of_int m" and y="x", OF conjunct1[OF xb], simplified floor_of_int[where z="m"]])
  3.2585  
  3.2586  lemma rsplit0_complete:
  3.2587    assumes xp:"0 \<le> x" and x1:"x < 1"
  3.2588    shows "\<exists> (p,n,s) \<in> set (rsplit0 t). Ifm (x#bs) p" (is "\<exists> (p,n,s) \<in> ?SS t. ?I p")
  3.2589  proof(induct t rule: rsplit0.induct)
  3.2590 -  case (2 a b) 
  3.2591 +  case (2 a b)
  3.2592    then have "\<exists> (pa,na,sa) \<in> ?SS a. ?I pa" by auto
  3.2593    then obtain "pa" "na" "sa" where pa: "(pa,na,sa)\<in> ?SS a \<and> ?I pa" by blast
  3.2594    with 2 have "\<exists> (pb,nb,sb) \<in> ?SS b. ?I pb" by blast
  3.2595 @@ -3484,7 +3484,7 @@
  3.2596    moreover from pa pb have "?I (And pa pb)" by simp
  3.2597    ultimately show ?case by blast
  3.2598  next
  3.2599 -  case (5 a) 
  3.2600 +  case (5 a)
  3.2601    let ?p = "\<lambda> (p,n,s) j. fp p n s j"
  3.2602    let ?f = "(\<lambda> (p,n,s) j. (?p (p,n,s) j, (0::int),(Add (Floor s) (C j))))"
  3.2603    let ?J = "\<lambda> n. if n>0 then [0..n] else [n..0]"
  3.2604 @@ -3512,30 +3512,30 @@
  3.2605  
  3.2606    have "?SS (Floor a) = UNION (?SS a) (\<lambda>x. set (?ff x))" by auto
  3.2607    also have "\<dots> = UNION (?SS a) (\<lambda> (p,n,s). set (?ff (p,n,s)))" by blast
  3.2608 -  also have "\<dots> = 
  3.2609 -    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). set (?ff (p,n,s)))) Un 
  3.2610 -    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s). set (?ff (p,n,s)))) Un 
  3.2611 -    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n<0} (\<lambda> (p,n,s). set (?ff (p,n,s)))))" 
  3.2612 +  also have "\<dots> =
  3.2613 +    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). set (?ff (p,n,s)))) Un
  3.2614 +    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s). set (?ff (p,n,s)))) Un
  3.2615 +    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n<0} (\<lambda> (p,n,s). set (?ff (p,n,s)))))"
  3.2616      using int_cases[rule_format] by blast
  3.2617 -  also have "\<dots> =  
  3.2618 -    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). set [(p,0,Floor s)])) Un 
  3.2619 -    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s). set (map (?f(p,n,s)) [0..n]))) Un 
  3.2620 +  also have "\<dots> =
  3.2621 +    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). set [(p,0,Floor s)])) Un
  3.2622 +    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s). set (map (?f(p,n,s)) [0..n]))) Un
  3.2623      (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n<0} (\<lambda> (p,n,s). set (map (?f(p,n,s)) [n..0]))))"
  3.2624      by (simp only: U1 U2 U3)
  3.2625 -  also have "\<dots> =  
  3.2626 -    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). {(p,0,Floor s)})) Un 
  3.2627 -    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s). (?f(p,n,s)) ` {0 .. n})) Un 
  3.2628 +  also have "\<dots> =
  3.2629 +    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). {(p,0,Floor s)})) Un
  3.2630 +    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s). (?f(p,n,s)) ` {0 .. n})) Un
  3.2631      (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n<0} (\<lambda> (p,n,s). (?f(p,n,s)) ` {n .. 0})))"
  3.2632      by (simp only: set_map set_upto list.set)
  3.2633 -  also have "\<dots> =   
  3.2634 -    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). {(p,0,Floor s)})) Un 
  3.2635 -    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s). {?f(p,n,s) j| j. j\<in> {0 .. n}})) Un 
  3.2636 +  also have "\<dots> =
  3.2637 +    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). {(p,0,Floor s)})) Un
  3.2638 +    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s). {?f(p,n,s) j| j. j\<in> {0 .. n}})) Un
  3.2639      (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n<0} (\<lambda> (p,n,s).  {?f(p,n,s) j| j. j\<in> {n .. 0}})))"
  3.2640      by blast
  3.2641 -  finally 
  3.2642 -  have FS: "?SS (Floor a) =   
  3.2643 -    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). {(p,0,Floor s)})) Un 
  3.2644 -    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s). {?f(p,n,s) j| j. j\<in> {0 .. n}})) Un 
  3.2645 +  finally
  3.2646 +  have FS: "?SS (Floor a) =
  3.2647 +    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). {(p,0,Floor s)})) Un
  3.2648 +    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s). {?f(p,n,s) j| j. j\<in> {0 .. n}})) Un
  3.2649      (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n<0} (\<lambda> (p,n,s).  {?f(p,n,s) j| j. j\<in> {n .. 0}})))"
  3.2650      by blast
  3.2651    from 5 have "\<exists> (p,n,s) \<in> ?SS a. ?I p" by auto
  3.2652 @@ -3543,7 +3543,7 @@
  3.2653    let ?N = "\<lambda> t. Inum (x#bs) t"
  3.2654    from rsplit0_cs[rule_format] pns have ans:"(?N a = ?N (CN 0 n s)) \<and> numbound0 s \<and> isrlfm p"
  3.2655      by auto
  3.2656 -  
  3.2657 +
  3.2658    have "n=0 \<or> n >0 \<or> n <0" by arith
  3.2659    moreover {assume "n=0" hence ?case using pns by (simp only: FS) auto }
  3.2660    moreover
  3.2661 @@ -3554,21 +3554,21 @@
  3.2662      finally have "?N (Floor s) \<le> real_of_int n * x + ?N s" .
  3.2663      moreover
  3.2664      {from x1 np have "real_of_int n *x + ?N s < real_of_int n + ?N s" by simp
  3.2665 -      also from real_of_int_floor_add_one_gt[where r="?N s"] 
  3.2666 +      also from real_of_int_floor_add_one_gt[where r="?N s"]
  3.2667        have "\<dots> < real_of_int n + ?N (Floor s) + 1" by simp
  3.2668        finally have "real_of_int n *x + ?N s < ?N (Floor s) + real_of_int (n+1)" by simp}
  3.2669      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
  3.2670      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
  3.2671      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
  3.2672 -    
  3.2673 +
  3.2674      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"
  3.2675 -      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)"]) 
  3.2676 +      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)"])
  3.2677      hence "\<exists> j\<in> {0.. n}. ?I (?p (p,n,s) j)"
  3.2678        using pns by (simp add: fp_def np algebra_simps)
  3.2679      then obtain "j" where j_def: "j\<in> {0 .. n} \<and> ?I (?p (p,n,s) j)" by blast
  3.2680      hence "\<exists>x \<in> {?p (p,n,s) j |j. 0\<le> j \<and> j \<le> n }. ?I x" by auto
  3.2681 -    hence ?case using pns 
  3.2682 -      by (simp only: FS,simp add: bex_Un) 
  3.2683 +    hence ?case using pns
  3.2684 +      by (simp only: FS,simp add: bex_Un)
  3.2685      (rule disjI2, rule disjI1,rule exI [where x="p"],
  3.2686        rule exI [where x="n"],rule exI [where x="s"],simp_all add: np)
  3.2687    }
  3.2688 @@ -3576,27 +3576,27 @@
  3.2689    { assume nn: "n < 0" hence np: "-n >0" by simp
  3.2690      from of_int_floor_le[of "?N s"] have "?N (Floor s) + 1 > ?N s" by simp
  3.2691      moreover from mult_left_mono_neg[OF xp] nn have "?N s \<ge> real_of_int n * x + ?N s" by simp
  3.2692 -    ultimately have "?N (Floor s) + 1 > real_of_int n * x + ?N s" by arith 
  3.2693 +    ultimately have "?N (Floor s) + 1 > real_of_int n * x + ?N s" by arith
  3.2694      moreover
  3.2695      {from x1 nn have "real_of_int n *x + ?N s \<ge> real_of_int n + ?N s" by simp
  3.2696        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
  3.2697 -      ultimately have "real_of_int n *x + ?N s \<ge> ?N (Floor s) + real_of_int n" 
  3.2698 +      ultimately have "real_of_int n *x + ?N s \<ge> ?N (Floor s) + real_of_int n"
  3.2699          by (simp only: algebra_simps)}
  3.2700      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
  3.2701      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
  3.2702      have th1: "\<forall> (a::real). (- a > 0) = (a < 0)" by auto
  3.2703      have th2: "\<forall> (a::real). (0 \<ge> - a) = (a \<ge> 0)" by auto
  3.2704      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
  3.2705 -    
  3.2706 +
  3.2707      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"
  3.2708 -      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)"]) 
  3.2709 +      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)"])
  3.2710      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])
  3.2711      hence "\<exists> j\<in> {n.. 0}. ?I (?p (p,n,s) j)"
  3.2712        using pns by (simp add: fp_def nn algebra_simps
  3.2713 -        del: diff_less_0_iff_less diff_le_0_iff_le) 
  3.2714 +        del: diff_less_0_iff_less diff_le_0_iff_le)
  3.2715      then obtain "j" where j_def: "j\<in> {n .. 0} \<and> ?I (?p (p,n,s) j)" by blast
  3.2716      hence "\<exists>x \<in> {?p (p,n,s) j |j. n\<le> j \<and> j \<le> 0 }. ?I x" by auto
  3.2717 -    hence ?case using pns 
  3.2718 +    hence ?case using pns
  3.2719        by (simp only: FS,simp add: bex_Un)
  3.2720      (rule disjI2, rule disjI2,rule exI [where x="p"],
  3.2721        rule exI [where x="n"],rule exI [where x="s"],simp_all add: nn)
  3.2722 @@ -3615,7 +3615,7 @@
  3.2723  lemma foldr_conj_map: "Ifm bs (foldr conj (map f xs) T) = (\<forall> x \<in> set xs. Ifm bs (f x))"
  3.2724  by(induct xs, simp_all)
  3.2725  
  3.2726 -lemma foldr_disj_map_rlfm: 
  3.2727 +lemma foldr_disj_map_rlfm:
  3.2728    assumes lf: "\<forall> n s. numbound0 s \<longrightarrow> isrlfm (f n s)"
  3.2729    and \<phi>: "\<forall> (\<phi>,n,s) \<in> set xs. numbound0 s \<and> isrlfm \<phi>"
  3.2730    shows "isrlfm (foldr disj (map (\<lambda> (\<phi>, n, s). conj \<phi> (f n s)) xs) F)"
  3.2731 @@ -3631,7 +3631,7 @@
  3.2732    from foldr_disj_map_rlfm[OF lf th] rsplit_def show ?thesis by simp
  3.2733  qed
  3.2734  
  3.2735 -lemma rsplit: 
  3.2736 +lemma rsplit:
  3.2737    assumes xp: "x \<ge> 0" and x1: "x < 1"
  3.2738    and f: "\<forall> a n s. Inum (x#bs) a = Inum (x#bs) (CN 0 n s) \<and> numbound0 s \<longrightarrow> (Ifm (x#bs) (f n s) = Ifm (x#bs) (g a))"
  3.2739    shows "Ifm (x#bs) (rsplit f a) = Ifm (x#bs) (g a)"
  3.2740 @@ -3642,14 +3642,14 @@
  3.2741    hence "\<exists> (\<phi>,n,s) \<in> set (rsplit0 a). ?I x (And \<phi> (f n s))" using rsplit_ex by simp
  3.2742    then obtain "\<phi>" "n" "s" where fnsS:"(\<phi>,n,s) \<in> set (rsplit0 a)" and "?I x (And \<phi> (f n s))" by blast
  3.2743    hence \<phi>: "?I x \<phi>" and fns: "?I x (f n s)" by auto
  3.2744 -  from rsplit0_cs[where t="a" and bs="bs" and x="x", rule_format, OF fnsS] \<phi> 
  3.2745 +  from rsplit0_cs[where t="a" and bs="bs" and x="x", rule_format, OF fnsS] \<phi>
  3.2746    have th: "(?N x a = ?N x (CN 0 n s)) \<and> numbound0 s" by auto
  3.2747    from f[rule_format, OF th] fns show "?I x (g a)" by simp
  3.2748  next
  3.2749    let ?I = "\<lambda>x p. Ifm (x#bs) p"
  3.2750    let ?N = "\<lambda> x t. Inum (x#bs) t"
  3.2751    assume ga: "?I x (g a)"
  3.2752 -  from rsplit0_complete[OF xp x1, where bs="bs" and t="a"] 
  3.2753 +  from rsplit0_complete[OF xp x1, where bs="bs" and t="a"]
  3.2754    obtain "\<phi>" "n" "s" where fnsS:"(\<phi>,n,s) \<in> set (rsplit0 a)" and fx: "?I x \<phi>" by blast
  3.2755    from rsplit0_cs[where t="a" and x="x" and bs="bs"] fnsS fx
  3.2756    have ans: "?N x a = ?N x (CN 0 n s)" and nb: "numbound0 s" by auto
  3.2757 @@ -3658,27 +3658,27 @@
  3.2758  qed
  3.2759  
  3.2760  definition lt :: "int \<Rightarrow> num \<Rightarrow> fm" where
  3.2761 -  lt_def: "lt c t = (if c = 0 then (Lt t) else if c > 0 then (Lt (CN 0 c t)) 
  3.2762 +  lt_def: "lt c t = (if c = 0 then (Lt t) else if c > 0 then (Lt (CN 0 c t))
  3.2763                          else (Gt (CN 0 (-c) (Neg t))))"
  3.2764  
  3.2765  definition  le :: "int \<Rightarrow> num \<Rightarrow> fm" where
  3.2766 -  le_def: "le c t = (if c = 0 then (Le t) else if c > 0 then (Le (CN 0 c t)) 
  3.2767 +  le_def: "le c t = (if c = 0 then (Le t) else if c > 0 then (Le (CN 0 c t))
  3.2768                          else (Ge (CN 0 (-c) (Neg t))))"
  3.2769  
  3.2770  definition  gt :: "int \<Rightarrow> num \<Rightarrow> fm" where
  3.2771 -  gt_def: "gt c t = (if c = 0 then (Gt t) else if c > 0 then (Gt (CN 0 c t)) 
  3.2772 +  gt_def: "gt c t = (if c = 0 then (Gt t) else if c > 0 then (Gt (CN 0 c t))
  3.2773                          else (Lt (CN 0 (-c) (Neg t))))"
  3.2774  
  3.2775  definition  ge :: "int \<Rightarrow> num \<Rightarrow> fm" where
  3.2776 -  ge_def: "ge c t = (if c = 0 then (Ge t) else if c > 0 then (Ge (CN 0 c t)) 
  3.2777 +  ge_def: "ge c t = (if c = 0 then (Ge t) else if c > 0 then (Ge (CN 0 c t))
  3.2778                          else (Le (CN 0 (-c) (Neg t))))"
  3.2779  
  3.2780  definition  eq :: "int \<Rightarrow> num \<Rightarrow> fm" where
  3.2781 -  eq_def: "eq c t = (if c = 0 then (Eq t) else if c > 0 then (Eq (CN 0 c t)) 
  3.2782 +  eq_def: "eq c t = (if c = 0 then (Eq t) else if c > 0 then (Eq (CN 0 c t))
  3.2783                          else (Eq (CN 0 (-c) (Neg t))))"
  3.2784  
  3.2785  definition neq :: "int \<Rightarrow> num \<Rightarrow> fm" where
  3.2786 -  neq_def: "neq c t = (if c = 0 then (NEq t) else if c > 0 then (NEq (CN 0 c t)) 
  3.2787 +  neq_def: "neq c t = (if c = 0 then (NEq t) else if c > 0 then (NEq (CN 0 c t))
  3.2788                          else (NEq (CN 0 (-c) (Neg t))))"
  3.2789  
  3.2790  lemma lt_mono: "\<forall> a n s. Inum (x#bs) a = Inum (x#bs) (CN 0 n s) \<and> numbound0 s \<longrightarrow> Ifm (x#bs) (lt n s) = Ifm (x#bs) (Lt a)"
  3.2791 @@ -3703,7 +3703,7 @@
  3.2792  qed
  3.2793  
  3.2794  lemma le_l: "isrlfm (rsplit le a)"
  3.2795 -  by (rule rsplit_l[where f="le" and a="a"], auto simp add: le_def) 
  3.2796 +  by (rule rsplit_l[where f="le" and a="a"], auto simp add: le_def)
  3.2797  (case_tac s, simp_all, rename_tac nat a b, case_tac "nat",simp_all)
  3.2798  
  3.2799  lemma gt_mono: "\<forall> a n s. Inum (x#bs) a = Inum (x#bs) (CN 0 n s) \<and> numbound0 s \<longrightarrow> Ifm (x#bs) (gt n s) = Ifm (x#bs) (Gt a)" (is "\<forall> a n s. ?N a = ?N (CN 0 n s) \<and> _ \<longrightarrow> ?I (gt n s) = ?I (Gt a)")
  3.2800 @@ -3714,28 +3714,28 @@
  3.2801    (cases "n > 0", simp_all add: gt_def algebra_simps myless[of _ "0"])
  3.2802  qed
  3.2803  lemma gt_l: "isrlfm (rsplit gt a)"
  3.2804 -  by (rule rsplit_l[where f="gt" and a="a"], auto simp add: gt_def) 
  3.2805 +  by (rule rsplit_l[where f="gt" and a="a"], auto simp add: gt_def)
  3.2806  (case_tac s, simp_all, rename_tac nat a b, case_tac "nat", simp_all)
  3.2807  
  3.2808  lemma ge_mono: "\<forall> a n s. Inum (x#bs) a = Inum (x#bs) (CN 0 n s) \<and> numbound0 s \<longrightarrow> Ifm (x#bs) (ge n s) = Ifm (x#bs) (Ge a)" (is "\<forall> a n s . ?N a = ?N (CN 0 n s) \<and> _ \<longrightarrow> ?I (ge n s) = ?I (Ge a)")
  3.2809  proof(clarify)
  3.2810 -  fix a n s 
  3.2811 +  fix a n s
  3.2812    assume H: "?N a = ?N (CN 0 n s)"
  3.2813    show "?I (ge n s) = ?I (Ge a)" using H by (cases "n=0", (simp add: ge_def))
  3.2814    (cases "n > 0", simp_all add: ge_def algebra_simps myle[of _ "0"])
  3.2815  qed
  3.2816  lemma ge_l: "isrlfm (rsplit ge a)"
  3.2817 -  by (rule rsplit_l[where f="ge" and a="a"], auto simp add: ge_def) 
  3.2818 +  by (rule rsplit_l[where f="ge" and a="a"], auto simp add: ge_def)
  3.2819  (case_tac s, simp_all, rename_tac nat a b, case_tac "nat", simp_all)
  3.2820  
  3.2821  lemma eq_mono: "\<forall> a n s. Inum (x#bs) a = Inum (x#bs) (CN 0 n s) \<and> numbound0 s \<longrightarrow> Ifm (x#bs) (eq n s) = Ifm (x#bs) (Eq a)" (is "\<forall> a n s. ?N a = ?N (CN 0 n s) \<and> _ \<longrightarrow> ?I (eq n s) = ?I (Eq a)")
  3.2822  proof(clarify)
  3.2823 -  fix a n s 
  3.2824 +  fix a n s
  3.2825    assume H: "?N a = ?N (CN 0 n s)"
  3.2826    show "?I (eq n s) = ?I (Eq a)" using H by (auto simp add: eq_def algebra_simps)
  3.2827  qed
  3.2828  lemma eq_l: "isrlfm (rsplit eq a)"
  3.2829 -  by (rule rsplit_l[where f="eq" and a="a"], auto simp add: eq_def) 
  3.2830 +  by (rule rsplit_l[where f="eq" and a="a"], auto simp add: eq_def)
  3.2831  (case_tac s, simp_all, rename_tac nat a b, case_tac"nat", simp_all)
  3.2832  
  3.2833  lemma neq_mono: "\<forall> a n s. Inum (x#bs) a = Inum (x#bs) (CN 0 n s) \<and> numbound0 s \<longrightarrow> Ifm (x#bs) (neq n s) = Ifm (x#bs) (NEq a)" (is "\<forall> a n s. ?N a = ?N (CN 0 n s) \<and> _ \<longrightarrow> ?I (neq n s) = ?I (NEq a)")
  3.2834 @@ -3746,35 +3746,35 @@
  3.2835  qed
  3.2836  
  3.2837  lemma neq_l: "isrlfm (rsplit neq a)"
  3.2838 -  by (rule rsplit_l[where f="neq" and a="a"], auto simp add: neq_def) 
  3.2839 +  by (rule rsplit_l[where f="neq" and a="a"], auto simp add: neq_def)
  3.2840  (case_tac s, simp_all, rename_tac nat a b, case_tac"nat", simp_all)
  3.2841  
  3.2842 -lemma small_le: 
  3.2843 +lemma small_le:
  3.2844    assumes u0:"0 \<le> u" and u1: "u < 1"
  3.2845    shows "(-u \<le> real_of_int (n::int)) = (0 \<le> n)"
  3.2846  using u0 u1  by auto
  3.2847  
  3.2848 -lemma small_lt: 
  3.2849 +lemma small_lt:
  3.2850    assumes u0:"0 \<le> u" and u1: "u < 1"
  3.2851    shows "(real_of_int (n::int) < real_of_int (m::int) - u) = (n < m)"
  3.2852  using u0 u1  by auto
  3.2853  
  3.2854 -lemma rdvd01_cs: 
  3.2855 +lemma rdvd01_cs:
  3.2856    assumes up: "u \<ge> 0" and u1: "u<1" and np: "real_of_int n > 0"
  3.2857    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")
  3.2858  proof-
  3.2859    let ?ss = "s - real_of_int (floor s)"
  3.2860 -  from real_of_int_floor_add_one_gt[where r="s", simplified myless[of "s"]] 
  3.2861 -    of_int_floor_le  have ss0:"?ss \<ge> 0" and ss1:"?ss < 1" 
  3.2862 +  from real_of_int_floor_add_one_gt[where r="s", simplified myless[of "s"]]
  3.2863 +    of_int_floor_le  have ss0:"?ss \<ge> 0" and ss1:"?ss < 1"
  3.2864      by (auto simp add: myle[of _ "s", symmetric] myless[of "?ss"])
  3.2865    from np have n0: "real_of_int n \<ge> 0" by simp
  3.2866 -  from mult_left_mono[OF up n0] mult_strict_left_mono[OF u1 np] 
  3.2867 -  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  
  3.2868 -  from int_rdvd_real[where i="i" and x="real_of_int (n::int) * u - s"] 
  3.2869 -  have "real_of_int i rdvd real_of_int n * u - s = 
  3.2870 -    (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 ))" 
  3.2871 +  from mult_left_mono[OF up n0] mult_strict_left_mono[OF u1 np]
  3.2872 +  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
  3.2873 +  from int_rdvd_real[where i="i" and x="real_of_int (n::int) * u - s"]
  3.2874 +  have "real_of_int i rdvd real_of_int n * u - s =
  3.2875 +    (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 ))"
  3.2876      (is "_ = (?DE)" is "_ = (?D \<and> ?E)") by simp
  3.2877 -  also have "\<dots> = (?DE \<and> real_of_int(floor (real_of_int n * u - s) + floor s)\<ge> -?ss 
  3.2878 +  also have "\<dots> = (?DE \<and> real_of_int(floor (real_of_int n * u - s) + floor s)\<ge> -?ss
  3.2879      \<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 < _)")
  3.2880      using nu0 nun  by auto
  3.2881    also have "\<dots> = (?DE \<and> ?a \<ge> 0 \<and> ?a < n)" by(simp only: small_le[OF ss0 ss1] small_lt[OF ss0 ss1])
  3.2882 @@ -3797,43 +3797,43 @@
  3.2883  where
  3.2884    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)"
  3.2885  
  3.2886 -lemma DVDJ_DVD: 
  3.2887 +lemma DVDJ_DVD:
  3.2888    assumes xp:"x\<ge> 0" and x1: "x < 1" and np:"real_of_int n > 0"
  3.2889    shows "Ifm (x#bs) (DVDJ i n s) = Ifm (x#bs) (Dvd i (CN 0 n s))"
  3.2890  proof-
  3.2891    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))))"
  3.2892    let ?s= "Inum (x#bs) s"
  3.2893    from foldr_disj_map[where xs="[0..n - 1]" and bs="x#bs" and f="?f"]
  3.2894 -  have "Ifm (x#bs) (DVDJ i n s) = (\<exists> j\<in> {0 .. (n - 1)}. Ifm (x#bs) (?f j))" 
  3.2895 +  have "Ifm (x#bs) (DVDJ i n s) = (\<exists> j\<in> {0 .. (n - 1)}. Ifm (x#bs) (?f j))"
  3.2896      by (simp add: np DVDJ_def)
  3.2897    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)))"
  3.2898      by (simp add: algebra_simps)
  3.2899 -  also from rdvd01_cs[OF xp x1 np, where i="i" and s="-?s"] 
  3.2900 +  also from rdvd01_cs[OF xp x1 np, where i="i" and s="-?s"]
  3.2901    have "\<dots> = (real_of_int i rdvd real_of_int n * x - (-?s))" by simp
  3.2902    finally show ?thesis by simp
  3.2903  qed
  3.2904  
  3.2905 -lemma NDVDJ_NDVD: 
  3.2906 +lemma NDVDJ_NDVD:
  3.2907    assumes xp:"x\<ge> 0" and x1: "x < 1" and np:"real_of_int n > 0"
  3.2908    shows "Ifm (x#bs) (NDVDJ i n s) = Ifm (x#bs) (NDvd i (CN 0 n s))"
  3.2909  proof-
  3.2910    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))))"
  3.2911    let ?s= "Inum (x#bs) s"
  3.2912    from foldr_conj_map[where xs="[0..n - 1]" and bs="x#bs" and f="?f"]
  3.2913 -  have "Ifm (x#bs) (NDVDJ i n s) = (\<forall> j\<in> {0 .. (n - 1)}. Ifm (x#bs) (?f j))" 
  3.2914 +  have "Ifm (x#bs) (NDVDJ i n s) = (\<forall> j\<in> {0 .. (n - 1)}. Ifm (x#bs) (?f j))"
  3.2915      by (simp add: np NDVDJ_def)
  3.2916    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))))"
  3.2917      by (simp add: algebra_simps)
  3.2918 -  also from rdvd01_cs[OF xp x1 np, where i="i" and s="-?s"] 
  3.2919 +  also from rdvd01_cs[OF xp x1 np, where i="i" and s="-?s"]
  3.2920    have "\<dots> = (\<not> (real_of_int i rdvd real_of_int n * x - (-?s)))" by simp
  3.2921    finally show ?thesis by simp
  3.2922 -qed  
  3.2923 -
  3.2924 -lemma foldr_disj_map_rlfm2: 
  3.2925 +qed
  3.2926 +
  3.2927 +lemma foldr_disj_map_rlfm2:
  3.2928    assumes lf: "\<forall> n . isrlfm (f n)"
  3.2929    shows "isrlfm (foldr disj (map f xs) F)"
  3.2930  using lf by (induct xs, auto)
  3.2931 -lemma foldr_And_map_rlfm2: 
  3.2932 +lemma foldr_And_map_rlfm2:
  3.2933    assumes lf: "\<forall> n . isrlfm (f n)"
  3.2934    shows "isrlfm (foldr conj (map f xs) T)"
  3.2935  using lf by (induct xs, auto)
  3.2936 @@ -3844,7 +3844,7 @@
  3.2937    let ?f="\<lambda>j. conj (Eq (CN 0 n (Add s (Sub (Floor (Neg s)) (C j)))))
  3.2938                           (Dvd i (Sub (C j) (Floor (Neg s))))"
  3.2939    have th: "\<forall> j. isrlfm (?f j)" using nb np by auto
  3.2940 -  from DVDJ_def foldr_disj_map_rlfm2[OF th] show ?thesis by simp 
  3.2941 +  from DVDJ_def foldr_disj_map_rlfm2[OF th] show ?thesis by simp
  3.2942  qed
  3.2943  
  3.2944  lemma NDVDJ_l: assumes ip: "i >0" and np: "n>0" and nb: "numbound0 s"
  3.2945 @@ -3858,58 +3858,58 @@
  3.2946  
  3.2947  definition DVD :: "int \<Rightarrow> int \<Rightarrow> num \<Rightarrow> fm" where
  3.2948    DVD_def: "DVD i c t =
  3.2949 -  (if i=0 then eq c t else 
  3.2950 +  (if i=0 then eq c t else
  3.2951    if c = 0 then (Dvd i t) else if c >0 then DVDJ (abs i) c t else DVDJ (abs i) (-c) (Neg t))"
  3.2952  
  3.2953  definition  NDVD :: "int \<Rightarrow> int \<Rightarrow> num \<Rightarrow> fm" where
  3.2954    "NDVD i c t =
  3.2955 -  (if i=0 then neq c t else 
  3.2956 +  (if i=0 then neq c t else
  3.2957    if c = 0 then (NDvd i t) else if c >0 then NDVDJ (abs i) c t else NDVDJ (abs i) (-c) (Neg t))"
  3.2958  
  3.2959 -lemma DVD_mono: 
  3.2960 -  assumes xp: "0\<le> x" and x1: "x < 1" 
  3.2961 +lemma DVD_mono:
  3.2962 +  assumes xp: "0\<le> x" and x1: "x < 1"
  3.2963    shows "\<forall> a n s. Inum (x#bs) a = Inum (x#bs) (CN 0 n s) \<and> numbound0 s \<longrightarrow> Ifm (x#bs) (DVD i n s) = Ifm (x#bs) (Dvd i a)"
  3.2964    (is "\<forall> a n s. ?N a = ?N (CN 0 n s) \<and> _ \<longrightarrow> ?I (DVD i n s) = ?I (Dvd i a)")
  3.2965  proof(clarify)
  3.2966 -  fix a n s 
  3.2967 +  fix a n s
  3.2968    assume H: "?N a = ?N (CN 0 n s)" and nb: "numbound0 s"
  3.2969    let ?th = "?I (DVD i n s) = ?I (Dvd i a)"
  3.2970    have "i=0 \<or> (i\<noteq>0 \<and> n=0) \<or> (i\<noteq>0 \<and> n < 0) \<or> (i\<noteq>0 \<and> n > 0)" by arith
  3.2971 -  moreover {assume iz: "i=0" hence ?th using eq_mono[rule_format, OF conjI[OF H nb]] 
  3.2972 +  moreover {assume iz: "i=0" hence ?th using eq_mono[rule_format, OF conjI[OF H nb]]
  3.2973        by (simp add: DVD_def rdvd_left_0_eq)}
  3.2974 -  moreover {assume inz: "i\<noteq>0" and "n=0" hence ?th by (simp add: H DVD_def) } 
  3.2975 -  moreover {assume inz: "i\<noteq>0" and "n<0" hence ?th 
  3.2976 -      by (simp add: DVD_def H DVDJ_DVD[OF xp x1] rdvd_abs1 
  3.2977 -        rdvd_minus[where d="i" and t="real_of_int n * x + Inum (x # bs) s"]) } 
  3.2978 +  moreover {assume inz: "i\<noteq>0" and "n=0" hence ?th by (simp add: H DVD_def) }
  3.2979 +  moreover {assume inz: "i\<noteq>0" and "n<0" hence ?th
  3.2980 +      by (simp add: DVD_def H DVDJ_DVD[OF xp x1] rdvd_abs1
  3.2981 +        rdvd_minus[where d="i" and t="real_of_int n * x + Inum (x # bs) s"]) }
  3.2982    moreover {assume inz: "i\<noteq>0" and "n>0" hence ?th by (simp add:DVD_def H DVDJ_DVD[OF xp x1] rdvd_abs1)}
  3.2983    ultimately show ?th by blast
  3.2984  qed
  3.2985  
  3.2986 -lemma NDVD_mono:   assumes xp: "0\<le> x" and x1: "x < 1" 
  3.2987 +lemma NDVD_mono:   assumes xp: "0\<le> x" and x1: "x < 1"
  3.2988    shows "\<forall> a n s. Inum (x#bs) a = Inum (x#bs) (CN 0 n s) \<and> numbound0 s \<longrightarrow> Ifm (x#bs) (NDVD i n s) = Ifm (x#bs) (NDvd i a)"
  3.2989    (is "\<forall> a n s. ?N a = ?N (CN 0 n s) \<and> _ \<longrightarrow> ?I (NDVD i n s) = ?I (NDvd i a)")
  3.2990  proof(clarify)
  3.2991 -  fix a n s 
  3.2992 +  fix a n s
  3.2993    assume H: "?N a = ?N (CN 0 n s)" and nb: "numbound0 s"
  3.2994    let ?th = "?I (NDVD i n s) = ?I (NDvd i a)"
  3.2995    have "i=0 \<or> (i\<noteq>0 \<and> n=0) \<or> (i\<noteq>0 \<and> n < 0) \<or> (i\<noteq>0 \<and> n > 0)" by arith
  3.2996 -  moreover {assume iz: "i=0" hence ?th using neq_mono[rule_format, OF conjI[OF H nb]] 
  3.2997 +  moreover {assume iz: "i=0" hence ?th using neq_mono[rule_format, OF conjI[OF H nb]]
  3.2998        by (simp add: NDVD_def rdvd_left_0_eq)}
  3.2999 -  moreover {assume inz: "i\<noteq>0" and "n=0" hence ?th by (simp add: H NDVD_def) } 
  3.3000 -  moreover {assume inz: "i\<noteq>0" and "n<0" hence ?th 
  3.3001 -      by (simp add: NDVD_def H NDVDJ_NDVD[OF xp x1] rdvd_abs1 
  3.3002 -        rdvd_minus[where d="i" and t="real_of_int n * x + Inum (x # bs) s"]) } 
  3.3003 -  moreover {assume inz: "i\<noteq>0" and "n>0" hence ?th 
  3.3004 +  moreover {assume inz: "i\<noteq>0" and "n=0" hence ?th by (simp add: H NDVD_def) }
  3.3005 +  moreover {assume inz: "i\<noteq>0" and "n<0" hence ?th
  3.3006 +      by (simp add: NDVD_def H NDVDJ_NDVD[OF xp x1] rdvd_abs1
  3.3007 +        rdvd_minus[where d="i" and t="real_of_int n * x + Inum (x # bs) s"]) }
  3.3008 +  moreover {assume inz: "i\<noteq>0" and "n>0" hence ?th
  3.3009        by (simp add:NDVD_def H NDVDJ_NDVD[OF xp x1] rdvd_abs1)}
  3.3010    ultimately show ?th by blast
  3.3011  qed
  3.3012  
  3.3013  lemma DVD_l: "isrlfm (rsplit (DVD i) a)"
  3.3014 -  by (rule rsplit_l[where f="DVD i" and a="a"], auto simp add: DVD_def eq_def DVDJ_l) 
  3.3015 +  by (rule rsplit_l[where f="DVD i" and a="a"], auto simp add: DVD_def eq_def DVDJ_l)
  3.3016  (case_tac s, simp_all, rename_tac nat a b, case_tac "nat", simp_all)
  3.3017  
  3.3018  lemma NDVD_l: "isrlfm (rsplit (NDVD i) a)"
  3.3019 -  by (rule rsplit_l[where f="NDVD i" and a="a"], auto simp add: NDVD_def neq_def NDVDJ_l) 
  3.3020 +  by (rule rsplit_l[where f="NDVD i" and a="a"], auto simp add: NDVD_def neq_def NDVDJ_l)
  3.3021  (case_tac s, simp_all, rename_tac nat a b, case_tac "nat", simp_all)
  3.3022  
  3.3023  consts rlfm :: "fm \<Rightarrow> fm"
  3.3024 @@ -3948,20 +3948,20 @@
  3.3025  
  3.3026  lemma simpfm_rl: "isrlfm p \<Longrightarrow> isrlfm (simpfm p)"
  3.3027  proof (induct p)
  3.3028 -  case (Lt a) 
  3.3029 +  case (Lt a)
  3.3030    hence "bound0 (Lt a) \<or> (\<exists> c e. a = CN 0 c e \<and> c > 0 \<and> numbound0 e)"
  3.3031      by (cases a,simp_all, rename_tac nat a b, case_tac "nat", simp_all)
  3.3032    moreover
  3.3033 -  {assume "bound0 (Lt a)" hence bn:"bound0 (simpfm (Lt a))"  
  3.3034 +  {assume "bound0 (Lt a)" hence bn:"bound0 (simpfm (Lt a))"
  3.3035        using simpfm_bound0 by blast
  3.3036      have "isatom (simpfm (Lt a))" by (cases "simpnum a", auto simp add: Let_def)
  3.3037      with bn bound0at_l have ?case by blast}
  3.3038 -  moreover 
  3.3039 +  moreover
  3.3040    { fix c e assume a: "a = CN 0 c e" and "c>0" and "numbound0 e"
  3.3041      { assume cn1:"numgcd (CN 0 c (simpnum e)) \<noteq> 1" and cnz:"numgcd (CN 0 c (simpnum e)) \<noteq> 0"
  3.3042        with numgcd_pos[where t="CN 0 c (simpnum e)"]
  3.3043        have th1:"numgcd (CN 0 c (simpnum e)) > 0" by simp
  3.3044 -      from \<open>c > 0\<close> have th:"numgcd (CN 0 c (simpnum e)) \<le> c" 
  3.3045 +      from \<open>c > 0\<close> have th:"numgcd (CN 0 c (simpnum e)) \<le> c"
  3.3046          by (simp add: numgcd_def)
  3.3047        from \<open>c > 0\<close> have th': "c\<noteq>0" by auto
  3.3048        from \<open>c > 0\<close> have cp: "c \<ge> 0" by simp
  3.3049 @@ -3972,20 +3972,20 @@
  3.3050        by (simp add: Let_def reducecoeff_def reducecoeffh_numbound0)}
  3.3051    ultimately show ?case by blast
  3.3052  next
  3.3053 -  case (Le a)   
  3.3054 +  case (Le a)
  3.3055    hence "bound0 (Le a) \<or> (\<exists> c e. a = CN 0 c e \<and> c > 0 \<and> numbound0 e)"
  3.3056      by (cases a,simp_all, rename_tac nat a b, case_tac "nat", simp_all)
  3.3057    moreover
  3.3058 -  { assume "bound0 (Le a)" hence bn:"bound0 (simpfm (Le a))"  
  3.3059 +  { assume "bound0 (Le a)" hence bn:"bound0 (simpfm (Le a))"
  3.3060        using simpfm_bound0 by blast
  3.3061      have "isatom (simpfm (Le a))" by (cases "simpnum a", auto simp add: Let_def)
  3.3062      with bn bound0at_l have ?case by blast}
  3.3063 -  moreover 
  3.3064 +  moreover
  3.3065    { fix c e assume a: "a = CN 0 c e" and "c>0" and "numbound0 e"
  3.3066      { assume cn1:"numgcd (CN 0 c (simpnum e)) \<noteq> 1" and cnz:"numgcd (CN 0 c (simpnum e)) \<noteq> 0"
  3.3067        with numgcd_pos[where t="CN 0 c (simpnum e)"]
  3.3068        have th1:"numgcd (CN 0 c (simpnum e)) > 0" by simp
  3.3069 -      from \<open>c > 0\<close> have th:"numgcd (CN 0 c (simpnum e)) \<le> c" 
  3.3070 +      from \<open>c > 0\<close> have th:"numgcd (CN 0 c (simpnum e)) \<le> c"
  3.3071          by (simp add: numgcd_def)
  3.3072        from \<open>c > 0\<close> have th': "c\<noteq>0" by auto
  3.3073        from \<open>c > 0\<close> have cp: "c \<ge> 0" by simp
  3.3074 @@ -3996,20 +3996,20 @@
  3.3075        by (simp add: Let_def reducecoeff_def reducecoeffh_numbound0)}
  3.3076    ultimately show ?case by blast
  3.3077  next
  3.3078 -  case (Gt a)   
  3.3079 +  case (Gt a)
  3.3080    hence "bound0 (Gt a) \<or> (\<exists> c e. a = CN 0 c e \<and> c > 0 \<and> numbound0 e)"
  3.3081      by (cases a, simp_all, rename_tac nat a b,case_tac "nat", simp_all)
  3.3082    moreover
  3.3083 -  {assume "bound0 (Gt a)" hence bn:"bound0 (simpfm (Gt a))"  
  3.3084 +  {assume "bound0 (Gt a)" hence bn:"bound0 (simpfm (Gt a))"
  3.3085        using simpfm_bound0 by blast
  3.3086      have "isatom (simpfm (Gt a))" by (cases "simpnum a", auto simp add: Let_def)
  3.3087      with bn bound0at_l have ?case by blast}
  3.3088 -  moreover 
  3.3089 +  moreover
  3.3090    { fix c e assume a: "a = CN 0 c e" and "c>0" and "numbound0 e"
  3.3091      { assume cn1: "numgcd (CN 0 c (simpnum e)) \<noteq> 1" and cnz:"numgcd (CN 0 c (simpnum e)) \<noteq> 0"
  3.3092        with numgcd_pos[where t="CN 0 c (simpnum e)"]
  3.3093        have th1:"numgcd (CN 0 c (simpnum e)) > 0" by simp
  3.3094 -      from \<open>c > 0\<close> have th:"numgcd (CN 0 c (simpnum e)) \<le> c" 
  3.3095 +      from \<open>c > 0\<close> have th:"numgcd (CN 0 c (simpnum e)) \<le> c"
  3.3096          by (simp add: numgcd_def)
  3.3097        from \<open>c > 0\<close> have th': "c\<noteq>0" by auto
  3.3098        from \<open>c > 0\<close> have cp: "c \<ge> 0" by simp
  3.3099 @@ -4020,20 +4020,20 @@
  3.3100        by (simp add: Let_def reducecoeff_def reducecoeffh_numbound0)}
  3.3101    ultimately show ?case by blast
  3.3102  next
  3.3103 -  case (Ge a)   
  3.3104 +  case (Ge a)
  3.3105    hence "bound0 (Ge a) \<or> (\<exists> c e. a = CN 0 c e \<and> c > 0 \<and> numbound0 e)"
  3.3106      by (cases a,simp_all, rename_tac nat a b, case_tac "nat", simp_all)
  3.3107    moreover
  3.3108 -  { assume "bound0 (Ge a)" hence bn:"bound0 (simpfm (Ge a))"  
  3.3109 +  { assume "bound0 (Ge a)" hence bn:"bound0 (simpfm (Ge a))"
  3.3110        using simpfm_bound0 by blast
  3.3111      have "isatom (simpfm (Ge a))" by (cases "simpnum a", auto simp add: Let_def)
  3.3112      with bn bound0at_l have ?case by blast}
  3.3113 -  moreover 
  3.3114 +  moreover
  3.3115    { fix c e assume a: "a = CN 0 c e" and "c>0" and "numbound0 e"
  3.3116      { assume cn1:"numgcd (CN 0 c (simpnum e)) \<noteq> 1" and cnz:"numgcd (CN 0 c (simpnum e)) \<noteq> 0"
  3.3117        with numgcd_pos[where t="CN 0 c (simpnum e)"]
  3.3118        have th1:"numgcd (CN 0 c (simpnum e)) > 0" by simp
  3.3119 -      from \<open>c > 0\<close> have th:"numgcd (CN 0 c (simpnum e)) \<le> c" 
  3.3120 +      from \<open>c > 0\<close> have th:"numgcd (CN 0 c (simpnum e)) \<le> c"
  3.3121          by (simp add: numgcd_def)
  3.3122        from \<open>c > 0\<close> have th': "c\<noteq>0" by auto
  3.3123        from \<open>c > 0\<close> have cp: "c \<ge> 0" by simp
  3.3124 @@ -4044,20 +4044,20 @@
  3.3125        by (simp add: Let_def reducecoeff_def reducecoeffh_numbound0)}
  3.3126    ultimately show ?case by blast
  3.3127  next
  3.3128 -  case (Eq a)   
  3.3129 +  case (Eq a)
  3.3130    hence "bound0 (Eq a) \<or> (\<exists> c e. a = CN 0 c e \<and> c > 0 \<and> numbound0 e)"
  3.3131      by (cases a,simp_all, rename_tac nat a b, case_tac "nat", simp_all)
  3.3132    moreover
  3.3133 -  { assume "bound0 (Eq a)" hence bn:"bound0 (simpfm (Eq a))"  
  3.3134 +  { assume "bound0 (Eq a)" hence bn:"bound0 (simpfm (Eq a))"
  3.3135        using simpfm_bound0 by blast
  3.3136      have "isatom (simpfm (Eq a))" by (cases "simpnum a", auto simp add: Let_def)
  3.3137      with bn bound0at_l have ?case by blast}
  3.3138 -  moreover 
  3.3139 +  moreover
  3.3140    { fix c e assume a: "a = CN 0 c e" and "c>0" and "numbound0 e"
  3.3141      { assume cn1:"numgcd (CN 0 c (simpnum e)) \<noteq> 1" and cnz:"numgcd (CN 0 c (simpnum e)) \<noteq> 0"
  3.3142        with numgcd_pos[where t="CN 0 c (simpnum e)"]
  3.3143        have th1:"numgcd (CN 0 c (simpnum e)) > 0" by simp
  3.3144 -      from \<open>c > 0\<close> have th:"numgcd (CN 0 c (simpnum e)) \<le> c" 
  3.3145 +      from \<open>c > 0\<close> have th:"numgcd (CN 0 c (simpnum e)) \<le> c"
  3.3146          by (simp add: numgcd_def)
  3.3147        from \<open>c > 0\<close> have th': "c\<noteq>0" by auto
  3.3148        from \<open>c > 0\<close> have cp: "c \<ge> 0" by simp
  3.3149 @@ -4068,20 +4068,20 @@
  3.3150        by (simp add: Let_def reducecoeff_def reducecoeffh_numbound0)}
  3.3151    ultimately show ?case by blast
  3.3152  next
  3.3153 -  case (NEq a)  
  3.3154 +  case (NEq a)
  3.3155    hence "bound0 (NEq a) \<or> (\<exists> c e. a = CN 0 c e \<and> c > 0 \<and> numbound0 e)"
  3.3156      by (cases a,simp_all, rename_tac nat a b, case_tac "nat", simp_all)
  3.3157    moreover
  3.3158 -  {assume "bound0 (NEq a)" hence bn:"bound0 (simpfm (NEq a))"  
  3.3159 +  {assume "bound0 (NEq a)" hence bn:"bound0 (simpfm (NEq a))"
  3.3160        using simpfm_bound0 by blast
  3.3161      have "isatom (simpfm (NEq a))" by (cases "simpnum a", auto simp add: Let_def)
  3.3162      with bn bound0at_l have ?case by blast}
  3.3163 -  moreover 
  3.3164 +  moreover
  3.3165    { fix c e assume a: "a = CN 0 c e" and "c>0" and "numbound0 e"
  3.3166      { assume cn1:"numgcd (CN 0 c (simpnum e)) \<noteq> 1" and cnz:"numgcd (CN 0 c (simpnum e)) \<noteq> 0"
  3.3167        with numgcd_pos[where t="CN 0 c (simpnum e)"]
  3.3168        have th1:"numgcd (CN 0 c (simpnum e)) > 0" by simp
  3.3169 -      from \<open>c > 0\<close> have th:"numgcd (CN 0 c (simpnum e)) \<le> c" 
  3.3170 +      from \<open>c > 0\<close> have th:"numgcd (CN 0 c (simpnum e)) \<le> c"
  3.3171          by (simp add: numgcd_def)
  3.3172        from \<open>c > 0\<close> have th': "c\<noteq>0" by auto
  3.3173        from \<open>c > 0\<close> have cp: "c \<ge> 0" by simp
  3.3174 @@ -4092,12 +4092,12 @@
  3.3175        by (simp add: Let_def reducecoeff_def reducecoeffh_numbound0)}
  3.3176    ultimately show ?case by blast
  3.3177  next
  3.3178 -  case (Dvd i a) hence "bound0 (Dvd i a)" by auto hence bn:"bound0 (simpfm (Dvd i a))"  
  3.3179 +  case (Dvd i a) hence "bound0 (Dvd i a)" by auto hence bn:"bound0 (simpfm (Dvd i a))"
  3.3180      using simpfm_bound0 by blast
  3.3181    have "isatom (simpfm (Dvd i a))" by (cases "simpnum a", auto simp add: Let_def split_def)
  3.3182    with bn bound0at_l show ?case by blast
  3.3183  next
  3.3184 -  case (NDvd i a)  hence "bound0 (NDvd i a)" by auto hence bn:"bound0 (simpfm (NDvd i a))"  
  3.3185 +  case (NDvd i a)  hence "bound0 (NDvd i a)" by auto hence bn:"bound0 (simpfm (NDvd i a))"
  3.3186      using simpfm_bound0 by blast
  3.3187    have "isatom (simpfm (NDvd i a))" by (cases "simpnum a", auto simp add: Let_def split_def)
  3.3188    with bn bound0at_l show ?case by blast
  3.3189 @@ -4107,15 +4107,15 @@
  3.3190    assumes qfp: "qfree p"
  3.3191    and xp: "0 \<le> x" and x1: "x < 1"
  3.3192    shows "(Ifm (x#bs) (rlfm p) = Ifm (x# bs) p) \<and> isrlfm (rlfm p)"
  3.3193 -  using qfp 
  3.3194 -by (induct p rule: rlfm.induct) 
  3.3195 +  using qfp
  3.3196 +by (induct p rule: rlfm.induct)
  3.3197  (auto simp add: rsplit[OF xp x1 lt_mono] lt_l rsplit[OF xp x1 le_mono] le_l rsplit[OF xp x1 gt_mono] gt_l
  3.3198                 rsplit[OF xp x1 ge_mono] ge_l rsplit[OF xp x1 eq_mono] eq_l rsplit[OF xp x1 neq_mono] neq_l
  3.3199                 rsplit[OF xp x1 DVD_mono[OF xp x1]] DVD_l rsplit[OF xp x1 NDVD_mono[OF xp x1]] NDVD_l simpfm_rl)
  3.3200  lemma rlfm_l:
  3.3201    assumes qfp: "qfree p"
  3.3202    shows "isrlfm (rlfm p)"
  3.3203 -  using qfp lt_l gt_l ge_l le_l eq_l neq_l DVD_l NDVD_l 
  3.3204 +  using qfp lt_l gt_l ge_l le_l eq_l neq_l DVD_l NDVD_l
  3.3205  by (induct p rule: rlfm.induct) (auto simp add: simpfm_rl)
  3.3206  
  3.3207      (* Operations needed for Ferrante and Rackoff *)
  3.3208 @@ -4128,7 +4128,7 @@
  3.3209  next
  3.3210    case (2 p q) thus ?case by (auto,rule_tac x= "min z za" in exI) auto
  3.3211  next
  3.3212 -  case (3 c e) 
  3.3213 +  case (3 c e)
  3.3214    from 3 have nb: "numbound0 e" by simp
  3.3215    from 3 have cp: "real_of_int c > 0" by simp
  3.3216    fix a
  3.3217 @@ -4136,8 +4136,8 @@
  3.3218    let ?z = "(- ?e) / real_of_int c"
  3.3219    {fix x
  3.3220      assume xz: "x < ?z"
  3.3221 -    hence "(real_of_int c * x < - ?e)" 
  3.3222 -      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps) 
  3.3223 +    hence "(real_of_int c * x < - ?e)"
  3.3224 +      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps)
  3.3225      hence "real_of_int c * x + ?e < 0" by arith
  3.3226      hence "real_of_int c * x + ?e \<noteq> 0" by simp
  3.3227      with xz have "?P ?z x (Eq (CN 0 c e))"
  3.3228 @@ -4145,7 +4145,7 @@
  3.3229    hence "\<forall> x < ?z. ?P ?z x (Eq (CN 0 c e))" by simp
  3.3230    thus ?case by blast
  3.3231  next
  3.3232 -  case (4 c e)   
  3.3233 +  case (4 c e)
  3.3234    from 4 have nb: "numbound0 e" by simp
  3.3235    from 4 have cp: "real_of_int c > 0" by simp
  3.3236    fix a
  3.3237 @@ -4153,8 +4153,8 @@
  3.3238    let ?z = "(- ?e) / real_of_int c"
  3.3239    {fix x
  3.3240      assume xz: "x < ?z"
  3.3241 -    hence "(real_of_int c * x < - ?e)" 
  3.3242 -      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps) 
  3.3243 +    hence "(real_of_int c * x < - ?e)"
  3.3244 +      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps)
  3.3245      hence "real_of_int c * x + ?e < 0" by arith
  3.3246      hence "real_of_int c * x + ?e \<noteq> 0" by simp
  3.3247      with xz have "?P ?z x (NEq (CN 0 c e))"
  3.3248 @@ -4162,7 +4162,7 @@
  3.3249    hence "\<forall> x < ?z. ?P ?z x (NEq (CN 0 c e))" by simp
  3.3250    thus ?case by blast
  3.3251  next
  3.3252 -  case (5 c e) 
  3.3253 +  case (5 c e)
  3.3254    from 5 have nb: "numbound0 e" by simp
  3.3255    from 5 have cp: "real_of_int c > 0" by simp
  3.3256    fix a
  3.3257 @@ -4170,15 +4170,15 @@
  3.3258    let ?z = "(- ?e) / real_of_int c"
  3.3259    {fix x
  3.3260      assume xz: "x < ?z"
  3.3261 -    hence "(real_of_int c * x < - ?e)" 
  3.3262 -      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps) 
  3.3263 +    hence "(real_of_int c * x < - ?e)"
  3.3264 +      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps)
  3.3265      hence "real_of_int c * x + ?e < 0" by arith
  3.3266      with xz have "?P ?z x (Lt (CN 0 c e))"
  3.3267        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"]  by simp }
  3.3268    hence "\<forall> x < ?z. ?P ?z x (Lt (CN 0 c e))" by simp
  3.3269    thus ?case by blast
  3.3270  next
  3.3271 -  case (6 c e)  
  3.3272 +  case (6 c e)
  3.3273    from 6 have nb: "numbound0 e" by simp
  3.3274    from 6 have cp: "real_of_int c > 0" by simp
  3.3275    fix a
  3.3276 @@ -4186,15 +4186,15 @@
  3.3277    let ?z = "(- ?e) / real_of_int c"
  3.3278    {fix x
  3.3279      assume xz: "x < ?z"
  3.3280 -    hence "(real_of_int c * x < - ?e)" 
  3.3281 -      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps) 
  3.3282 +    hence "(real_of_int c * x < - ?e)"
  3.3283 +      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps)
  3.3284      hence "real_of_int c * x + ?e < 0" by arith
  3.3285      with xz have "?P ?z x (Le (CN 0 c e))"
  3.3286        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp }
  3.3287    hence "\<forall> x < ?z. ?P ?z x (Le (CN 0 c e))" by simp
  3.3288    thus ?case by blast
  3.3289  next
  3.3290 -  case (7 c e)  
  3.3291 +  case (7 c e)
  3.3292    from 7 have nb: "numbound0 e" by simp
  3.3293    from 7 have cp: "real_of_int c > 0" by simp
  3.3294    fix a
  3.3295 @@ -4202,15 +4202,15 @@
  3.3296    let ?z = "(- ?e) / real_of_int c"
  3.3297    {fix x
  3.3298      assume xz: "x < ?z"
  3.3299 -    hence "(real_of_int c * x < - ?e)" 
  3.3300 -      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps) 
  3.3301 +    hence "(real_of_int c * x < - ?e)"
  3.3302 +      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps)
  3.3303      hence "real_of_int c * x + ?e < 0" by arith
  3.3304      with xz have "?P ?z x (Gt (CN 0 c e))"
  3.3305        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp }
  3.3306    hence "\<forall> x < ?z. ?P ?z x (Gt (CN 0 c e))" by simp
  3.3307    thus ?case by blast
  3.3308  next
  3.3309 -  case (8 c e)  
  3.3310 +  case (8 c e)
  3.3311    from 8 have nb: "numbound0 e" by simp
  3.3312    from 8 have cp: "real_of_int c > 0" by simp
  3.3313    fix a
  3.3314 @@ -4218,8 +4218,8 @@
  3.3315    let ?z = "(- ?e) / real_of_int c"
  3.3316    {fix x
  3.3317      assume xz: "x < ?z"
  3.3318 -    hence "(real_of_int c * x < - ?e)" 
  3.3319 -      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps) 
  3.3320 +    hence "(real_of_int c * x < - ?e)"
  3.3321 +      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps)
  3.3322      hence "real_of_int c * x + ?e < 0" by arith
  3.3323      with xz have "?P ?z x (Ge (CN 0 c e))"
  3.3324        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp }
  3.3325 @@ -4236,7 +4236,7 @@
  3.3326  next
  3.3327    case (2 p q) thus ?case by (auto,rule_tac x= "max z za" in exI) auto
  3.3328  next
  3.3329 -  case (3 c e) 
  3.3330 +  case (3 c e)
  3.3331    from 3 have nb: "numbound0 e" by simp
  3.3332    from 3 have cp: "real_of_int c > 0" by simp
  3.3333    fix a
  3.3334 @@ -4253,7 +4253,7 @@
  3.3335    hence "\<forall> x > ?z. ?P ?z x (Eq (CN 0 c e))" by simp
  3.3336    thus ?case by blast
  3.3337  next
  3.3338 -  case (4 c e) 
  3.3339 +  case (4 c e)
  3.3340    from 4 have nb: "numbound0 e" by simp
  3.3341    from 4 have cp: "real_of_int c > 0" by simp
  3.3342    fix a
  3.3343 @@ -4270,7 +4270,7 @@
  3.3344    hence "\<forall> x > ?z. ?P ?z x (NEq (CN 0 c e))" by simp
  3.3345    thus ?case by blast
  3.3346  next
  3.3347 -  case (5 c e) 
  3.3348 +  case (5 c e)
  3.3349    from 5 have nb: "numbound0 e" by simp
  3.3350    from 5 have cp: "real_of_int c > 0" by simp
  3.3351    fix a
  3.3352 @@ -4286,7 +4286,7 @@
  3.3353    hence "\<forall> x > ?z. ?P ?z x (Lt (CN 0 c e))" by simp
  3.3354    thus ?case by blast
  3.3355  next
  3.3356 -  case (6 c e) 
  3.3357 +  case (6 c e)
  3.3358    from 6 have nb: "numbound0 e" by simp
  3.3359    from 6 have cp: "real_of_int c > 0" by simp
  3.3360    fix a
  3.3361 @@ -4302,7 +4302,7 @@
  3.3362    hence "\<forall> x > ?z. ?P ?z x (Le (CN 0 c e))" by simp
  3.3363    thus ?case by blast
  3.3364  next
  3.3365 -  case (7 c e) 
  3.3366 +  case (7 c e)
  3.3367    from 7 have nb: "numbound0 e" by simp
  3.3368    from 7 have cp: "real_of_int c > 0" by simp
  3.3369    fix a
  3.3370 @@ -4318,7 +4318,7 @@
  3.3371    hence "\<forall> x > ?z. ?P ?z x (Gt (CN 0 c e))" by simp
  3.3372    thus ?case by blast
  3.3373  next
  3.3374 -  case (8 c e) 
  3.3375 +  case (8 c e)
  3.3376    from 8 have nb: "numbound0 e" by simp
  3.3377    from 8 have cp: "real_of_int c > 0" by simp
  3.3378    fix a
  3.3379 @@ -4354,7 +4354,7 @@
  3.3380  proof-
  3.3381    from bound0_I [OF rminusinf_bound0[OF lp], where b="a" and bs ="bs"] ex
  3.3382    have th: "\<forall> x. Ifm (x#bs) (minusinf p)" by auto
  3.3383 -  from rminusinf_inf[OF lp, where bs="bs"] 
  3.3384 +  from rminusinf_inf[OF lp, where bs="bs"]
  3.3385    obtain z where z_def: "\<forall>x<z. Ifm (x # bs) (minusinf p) = Ifm (x # bs) p" by blast
  3.3386    from th have "Ifm ((z - 1)#bs) (minusinf p)" by simp
  3.3387    moreover have "z - 1 < z" by simp
  3.3388 @@ -4368,19 +4368,19 @@
  3.3389  proof-
  3.3390    from bound0_I [OF rplusinf_bound0[OF lp], where b="a" and bs ="bs"] ex
  3.3391    have th: "\<forall> x. Ifm (x#bs) (plusinf p)" by auto
  3.3392 -  from rplusinf_inf[OF lp, where bs="bs"] 
  3.3393 +  from rplusinf_inf[OF lp, where bs="bs"]
  3.3394    obtain z where z_def: "\<forall>x>z. Ifm (x # bs) (plusinf p) = Ifm (x # bs) p" by blast
  3.3395    from th have "Ifm ((z + 1)#bs) (plusinf p)" by simp
  3.3396    moreover have "z + 1 > z" by simp
  3.3397    ultimately show ?thesis using z_def by auto
  3.3398  qed
  3.3399  
  3.3400 -consts 
  3.3401 +consts
  3.3402    \<Upsilon>:: "fm \<Rightarrow> (num \<times> int) list"
  3.3403    \<upsilon> :: "fm \<Rightarrow> (num \<times> int) \<Rightarrow> fm "
  3.3404  recdef \<Upsilon> "measure size"
  3.3405 -  "\<Upsilon> (And p q) = (\<Upsilon> p @ \<Upsilon> q)" 
  3.3406 -  "\<Upsilon> (Or p q) = (\<Upsilon> p @ \<Upsilon> q)" 
  3.3407 +  "\<Upsilon> (And p q) = (\<Upsilon> p @ \<Upsilon> q)"
  3.3408 +  "\<Upsilon> (Or p q) = (\<Upsilon> p @ \<Upsilon> q)"
  3.3409    "\<Upsilon> (Eq  (CN 0 c e)) = [(Neg e,c)]"
  3.3410    "\<Upsilon> (NEq (CN 0 c e)) = [(Neg e,c)]"
  3.3411    "\<Upsilon> (Lt  (CN 0 c e)) = [(Neg e,c)]"
  3.3412 @@ -4410,10 +4410,10 @@
  3.3413    have "?I ?u (Lt (CN 0 c e)) = (real_of_int c *(?t/?n) + (?N x e) < 0)"
  3.3414      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
  3.3415    also have "\<dots> = (?n*(real_of_int c *(?t/?n)) + ?n*(?N x e) < 0)"
  3.3416 -    by (simp only: pos_less_divide_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)" 
  3.3417 +    by (simp only: pos_less_divide_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)"
  3.3418        and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
  3.3419    also have "\<dots> = (real_of_int c *?t + ?n* (?N x e) < 0)"
  3.3420 -    using np by simp 
  3.3421 +    using np by simp
  3.3422    finally show ?case using nbt nb by (simp add: algebra_simps)
  3.3423  next
  3.3424    case (6 c e)
  3.3425 @@ -4421,10 +4421,10 @@
  3.3426    have "?I ?u (Le (CN 0 c e)) = (real_of_int c *(?t/?n) + (?N x e) \<le> 0)"
  3.3427      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
  3.3428    also have "\<dots> = (?n*(real_of_int c *(?t/?n)) + ?n*(?N x e) \<le> 0)"
  3.3429 -    by (simp only: pos_le_divide_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)" 
  3.3430 +    by (simp only: pos_le_divide_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)"
  3.3431        and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
  3.3432    also have "\<dots> = (real_of_int c *?t + ?n* (?N x e) \<le> 0)"
  3.3433 -    using np by simp 
  3.3434 +    using np by simp
  3.3435    finally show ?case using nbt nb by (simp add: algebra_simps)
  3.3436  next
  3.3437    case (7 c e)
  3.3438 @@ -4432,10 +4432,10 @@
  3.3439    have "?I ?u (Gt (CN 0 c e)) = (real_of_int c *(?t/?n) + (?N x e) > 0)"
  3.3440      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
  3.3441    also have "\<dots> = (?n*(real_of_int c *(?t/?n)) + ?n*(?N x e) > 0)"
  3.3442 -    by (simp only: pos_divide_less_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)" 
  3.3443 +    by (simp only: pos_divide_less_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)"
  3.3444        and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
  3.3445    also have "\<dots> = (real_of_int c *?t + ?n* (?N x e) > 0)"
  3.3446 -    using np by simp 
  3.3447 +    using np by simp
  3.3448    finally show ?case using nbt nb by (simp add: algebra_simps)
  3.3449  next
  3.3450    case (8 c e)
  3.3451 @@ -4443,10 +4443,10 @@
  3.3452    have "?I ?u (Ge (CN 0 c e)) = (real_of_int c *(?t/?n) + (?N x e) \<ge> 0)"
  3.3453      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
  3.3454    also have "\<dots> = (?n*(real_of_int c *(?t/?n)) + ?n*(?N x e) \<ge> 0)"
  3.3455 -    by (simp only: pos_divide_le_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)" 
  3.3456 +    by (simp only: pos_divide_le_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)"
  3.3457        and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
  3.3458    also have "\<dots> = (real_of_int c *?t + ?n* (?N x e) \<ge> 0)"
  3.3459 -    using np by simp 
  3.3460 +    using np by simp
  3.3461    finally show ?case using nbt nb by (simp add: algebra_simps)
  3.3462  next
  3.3463    case (3 c e)
  3.3464 @@ -4455,10 +4455,10 @@
  3.3465    have "?I ?u (Eq (CN 0 c e)) = (real_of_int c *(?t/?n) + (?N x e) = 0)"
  3.3466      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
  3.3467    also have "\<dots> = (?n*(real_of_int c *(?t/?n)) + ?n*(?N x e) = 0)"
  3.3468 -    by (simp only: nonzero_eq_divide_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)" 
  3.3469 +    by (simp only: nonzero_eq_divide_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)"
  3.3470        and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
  3.3471    also have "\<dots> = (real_of_int c *?t + ?n* (?N x e) = 0)"
  3.3472 -    using np by simp 
  3.3473 +    using np by simp
  3.3474    finally show ?case using nbt nb by (simp add: algebra_simps)
  3.3475  next
  3.3476    case (4 c e)
  3.3477 @@ -4467,10 +4467,10 @@
  3.3478    have "?I ?u (NEq (CN 0 c e)) = (real_of_int c *(?t/?n) + (?N x e) \<noteq> 0)"
  3.3479      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
  3.3480    also have "\<dots> = (?n*(real_of_int c *(?t/?n)) + ?n*(?N x e) \<noteq> 0)"
  3.3481 -    by (simp only: nonzero_eq_divide_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)" 
  3.3482 +    by (simp only: nonzero_eq_divide_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)"
  3.3483        and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
  3.3484    also have "\<dots> = (real_of_int c *?t + ?n* (?N x e) \<noteq> 0)"
  3.3485 -    using np by simp 
  3.3486 +    using np by simp
  3.3487    finally show ?case using nbt nb by (simp add: algebra_simps)
  3.3488  qed(simp_all add: nbt numbound0_I[where bs ="bs" and b="(Inum (x#bs) t)/ real_of_int n" and b'="x"])
  3.3489  
  3.3490 @@ -4491,7 +4491,7 @@
  3.3491      by (induct p rule: minusinf.induct, auto simp add:numbound0_I[where bs="bs" and b="a" and b'="x"])
  3.3492    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
  3.3493    from \<Upsilon>_l[OF lp] smU have mp: "real_of_int m > 0" by auto
  3.3494 -  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.3495 +  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.3496      by (auto simp add: mult.commute)
  3.3497    thus ?thesis using smU by auto
  3.3498  qed
  3.3499 @@ -4507,14 +4507,14 @@
  3.3500      by (induct p rule: minusinf.induct, auto simp add:numbound0_I[where bs="bs" and b="a" and b'="x"])
  3.3501    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
  3.3502    from \<Upsilon>_l[OF lp] smU have mp: "real_of_int m > 0" by auto
  3.3503 -  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.3504 +  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.3505      by (auto simp add: mult.commute)
  3.3506    thus ?thesis using smU by auto
  3.3507  qed
  3.3508  
  3.3509 -lemma lin_dense: 
  3.3510 +lemma lin_dense:
  3.3511    assumes lp: "isrlfm p"
  3.3512 -  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)" 
  3.3513 +  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)"
  3.3514    (is "\<forall> t. _ \<and> _ \<longrightarrow> t \<notin> (\<lambda> (t,n). ?N x t / real_of_int n ) ` (?U p)")
  3.3515    and lx: "l < x" and xu:"x < u" and px:" Ifm (x#bs) p"
  3.3516    and ly: "l < y" and yu: "y < u"
  3.3517 @@ -4523,7 +4523,7 @@
  3.3518  proof (induct p rule: isrlfm.induct)
  3.3519    case (5 c e) hence cp: "real_of_int c > 0" and nb: "numbound0 e" by simp_all
  3.3520    from 5 have "x * real_of_int c + ?N x e < 0" by (simp add: algebra_simps)
  3.3521 -  hence pxc: "x < (- ?N x e) / real_of_int c" 
  3.3522 +  hence pxc: "x < (- ?N x e) / real_of_int c"
  3.3523      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="-?N x e"])
  3.3524    from 5 have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real_of_int c" by auto
  3.3525    with ly yu have yne: "y \<noteq> - ?N x e / real_of_int c" by auto
  3.3526 @@ -4533,7 +4533,7 @@
  3.3527        by (simp add: pos_less_divide_eq[OF cp, where a="y" and b="-?N x e", symmetric])
  3.3528      hence "real_of_int c * y + ?N x e < 0" by (simp add: algebra_simps)
  3.3529      hence ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] by simp}
  3.3530 -  moreover {assume y: "y > (- ?N x e) / real_of_int c" 
  3.3531 +  moreover {assume y: "y > (- ?N x e) / real_of_int c"
  3.3532      with yu have eu: "u > (- ?N x e) / real_of_int c" by auto
  3.3533      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)
  3.3534      with lx pxc have "False" by auto
  3.3535 @@ -4542,7 +4542,7 @@
  3.3536  next
  3.3537    case (6 c e) hence cp: "real_of_int c > 0" and nb: "numbound0 e" by simp_all
  3.3538    from 6 have "x * real_of_int c + ?N x e \<le> 0" by (simp add: algebra_simps)
  3.3539 -  hence pxc: "x \<le> (- ?N x e) / real_of_int c" 
  3.3540 +  hence pxc: "x \<le> (- ?N x e) / real_of_int c"
  3.3541      by (simp only: pos_le_divide_eq[OF cp, where a="x" and b="-?N x e"])
  3.3542    from 6 have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real_of_int c" by auto
  3.3543    with ly yu have yne: "y \<noteq> - ?N x e / real_of_int c" by auto
  3.3544 @@ -4552,7 +4552,7 @@
  3.3545        by (simp add: pos_less_divide_eq[OF cp, where a="y" and b="-?N x e", symmetric])
  3.3546      hence "real_of_int c * y + ?N x e < 0" by (simp add: algebra_simps)
  3.3547      hence ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] by simp}
  3.3548 -  moreover {assume y: "y > (- ?N x e) / real_of_int c" 
  3.3549 +  moreover {assume y: "y > (- ?N x e) / real_of_int c"
  3.3550      with yu have eu: "u > (- ?N x e) / real_of_int c" by auto
  3.3551      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)
  3.3552      with lx pxc have "False" by auto
  3.3553 @@ -4561,7 +4561,7 @@
  3.3554  next
  3.3555    case (7 c e) hence cp: "real_of_int c > 0" and nb: "numbound0 e" by simp_all
  3.3556    from 7 have "x * real_of_int c + ?N x e > 0" by (simp add: algebra_simps)
  3.3557 -  hence pxc: "x > (- ?N x e) / real_of_int c" 
  3.3558 +  hence pxc: "x > (- ?N x e) / real_of_int c"
  3.3559      by (simp only: pos_divide_less_eq[OF cp, where a="x" and b="-?N x e"])
  3.3560    from 7 have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real_of_int c" by auto
  3.3561    with ly yu have yne: "y \<noteq> - ?N x e / real_of_int c" by auto
  3.3562 @@ -4571,7 +4571,7 @@
  3.3563        by (simp add: pos_divide_less_eq[OF cp, where a="y" and b="-?N x e", symmetric])
  3.3564      hence "real_of_int c * y + ?N x e > 0" by (simp add: algebra_simps)
  3.3565      hence ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] by simp}
  3.3566 -  moreover {assume y: "y < (- ?N x e) / real_of_int c" 
  3.3567 +  moreover {assume y: "y < (- ?N x e) / real_of_int c"
  3.3568      with ly have eu: "l < (- ?N x e) / real_of_int c" by auto
  3.3569      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)
  3.3570      with xu pxc have "False" by auto
  3.3571 @@ -4580,7 +4580,7 @@
  3.3572  next
  3.3573    case (8 c e) hence cp: "real_of_int c > 0" and nb: "numbound0 e" by simp_all
  3.3574    from 8 have "x * real_of_int c + ?N x e \<ge> 0" by (simp add: algebra_simps)
  3.3575 -  hence pxc: "x \<ge> (- ?N x e) / real_of_int c" 
  3.3576 +  hence pxc: "x \<ge> (- ?N x e) / real_of_int c"
  3.3577      by (simp only: pos_divide_le_eq[OF cp, where a="x" and b="-?N x e"])
  3.3578    from 8 have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real_of_int c" by auto
  3.3579    with ly yu have yne: "y \<noteq> - ?N x e / real_of_int c" by auto
  3.3580 @@ -4590,7 +4590,7 @@
  3.3581        by (simp add: pos_divide_less_eq[OF cp, where a="y" and b="-?N x e", symmetric])
  3.3582      hence "real_of_int c * y + ?N x e > 0" by (simp add: algebra_simps)
  3.3583      hence ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] by simp}
  3.3584 -  moreover {assume y: "y < (- ?N x e) / real_of_int c" 
  3.3585 +  moreover {assume y: "y < (- ?N x e) / real_of_int c"
  3.3586      with ly have eu: "l < (- ?N x e) / real_of_int c" by auto
  3.3587      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)
  3.3588      with xu pxc have "False" by auto
  3.3589 @@ -4600,7 +4600,7 @@
  3.3590    case (3 c e) hence cp: "real_of_int c > 0" and nb: "numbound0 e" by simp_all
  3.3591    from cp have cnz: "real_of_int c \<noteq> 0" by simp
  3.3592    from 3 have "x * real_of_int c + ?N x e = 0" by (simp add: algebra_simps)
  3.3593 -  hence pxc: "x = (- ?N x e) / real_of_int c" 
  3.3594 +  hence pxc: "x = (- ?N x e) / real_of_int c"
  3.3595      by (simp only: nonzero_eq_divide_eq[OF cnz, where a="x" and b="-?N x e"])
  3.3596    from 3 have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real_of_int c" by auto
  3.3597    with lx xu have yne: "x \<noteq> - ?N x e / real_of_int c" by auto
  3.3598 @@ -4610,10 +4610,10 @@
  3.3599    from cp have cnz: "real_of_int c \<noteq> 0" by simp
  3.3600    from 4 have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real_of_int c" by auto
  3.3601    with ly yu have yne: "y \<noteq> - ?N x e / real_of_int c" by auto
  3.3602 -  hence "y* real_of_int c \<noteq> -?N x e"      
  3.3603 +  hence "y* real_of_int c \<noteq> -?N x e"
  3.3604      by (simp only: nonzero_eq_divide_eq[OF cnz, where a="y" and b="-?N x e"]) simp
  3.3605    hence "y* real_of_int c + ?N x e \<noteq> 0" by (simp add: algebra_simps)
  3.3606 -  thus ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] 
  3.3607 +  thus ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"]
  3.3608      by (simp add: algebra_simps)
  3.3609  qed (auto simp add: numbound0_I[where bs="bs" and b="y" and b'="x"])
  3.3610  
  3.3611 @@ -4623,7 +4623,7 @@
  3.3612    and npi: "\<not> (Ifm (x#bs) (plusinf p))" (is "\<not> (Ifm (x#bs) (?P p))")
  3.3613    and ex: "\<exists> x.  Ifm (x#bs) p" (is "\<exists> x. ?I x p")
  3.3614    shows "\<exists> (l,n) \<in> set (\<Upsilon> p). \<exists> (s,m) \<in> set (\<Upsilon> p).
  3.3615 -    ?I ((Inum (x#bs) l / real_of_int n + Inum (x#bs) s / real_of_int m) / 2) p" 
  3.3616 +    ?I ((Inum (x#bs) l / real_of_int n + Inum (x#bs) s / real_of_int m) / 2) p"
  3.3617  proof-
  3.3618    let ?N = "\<lambda> x t. Inum (x#bs) t"
  3.3619    let ?U = "set (\<Upsilon> p)"
  3.3620 @@ -4636,10 +4636,10 @@
  3.3621    proof-
  3.3622      let ?M = "(\<lambda> (t,c). ?N a t / real_of_int c) ` ?U"
  3.3623      have fM: "finite ?M" by auto
  3.3624 -    from rminusinf_\<Upsilon>[OF lp nmi pa] rplusinf_\<Upsilon>[OF lp npi pa] 
  3.3625 +    from rminusinf_\<Upsilon>[OF lp nmi pa] rplusinf_\<Upsilon>[OF lp npi pa]
  3.3626      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
  3.3627 -    then obtain "t" "n" "s" "m" where 
  3.3628 -      tnU: "(t,n) \<in> ?U" and smU: "(s,m) \<in> ?U" 
  3.3629 +    then obtain "t" "n" "s" "m" where
  3.3630 +      tnU: "(t,n) \<in> ?U" and smU: "(s,m) \<in> ?U"
  3.3631        and xs1: "a \<le> ?N x s / real_of_int m" and tx1: "a \<ge> ?N x t / real_of_int n" by blast
  3.3632      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
  3.3633      from tnU have Mne: "?M \<noteq> {}" by auto
  3.3634 @@ -4649,23 +4649,23 @@
  3.3635      have linM: "?l \<in> ?M" using fM Mne by simp
  3.3636      have uinM: "?u \<in> ?M" using fM Mne by simp
  3.3637      have tnM: "?N a t / real_of_int n \<in> ?M" using tnU by auto
  3.3638 -    have smM: "?N a s / real_of_int m \<in> ?M" using smU by auto 
  3.3639 +    have smM: "?N a s / real_of_int m \<in> ?M" using smU by auto
  3.3640      have lM: "\<forall> t\<in> ?M. ?l \<le> t" using Mne fM by auto
  3.3641      have Mu: "\<forall> t\<in> ?M. t \<le> ?u" using Mne fM by auto
  3.3642      have "?l \<le> ?N a t / real_of_int n" using tnM Mne by simp hence lx: "?l \<le> a" using tx by simp
  3.3643      have "?N a s / real_of_int m \<le> ?u" using smM Mne by simp hence xu: "a \<le> ?u" using xs by simp
  3.3644      from finite_set_intervals2[where P="\<lambda> x. ?I x p",OF pa lx xu linM uinM fM lM Mu]
  3.3645 -    have "(\<exists> s\<in> ?M. ?I s p) \<or> 
  3.3646 +    have "(\<exists> s\<in> ?M. ?I s p) \<or>
  3.3647        (\<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)" .
  3.3648      moreover { fix u assume um: "u\<in> ?M" and pu: "?I u p"
  3.3649        hence "\<exists> (tu,nu) \<in> ?U. u = ?N a tu / real_of_int nu" by auto
  3.3650        then obtain "tu" "nu" where tuU: "(tu,nu) \<in> ?U" and tuu:"u= ?N a tu / real_of_int nu" by blast
  3.3651 -      have "(u + u) / 2 = u" by auto with pu tuu 
  3.3652 +      have "(u + u) / 2 = u" by auto with pu tuu
  3.3653        have "?I (((?N a tu / real_of_int nu) + (?N a tu / real_of_int nu)) / 2) p" by simp
  3.3654        with tuU have ?thesis by blast}
  3.3655      moreover{
  3.3656        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"
  3.3657 -      then obtain t1 and t2 where t1M: "t1 \<in> ?M" and t2M: "t2\<in> ?M" 
  3.3658 +      then obtain t1 and t2 where t1M: "t1 \<in> ?M" and t2M: "t2\<in> ?M"
  3.3659          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"
  3.3660          by blast
  3.3661        from t1M have "\<exists> (t1u,t1n) \<in> ?U. t1 = ?N a t1u / real_of_int t1n" by auto
  3.3662 @@ -4679,10 +4679,10 @@
  3.3663        with t1uU t2uU t1u t2u have ?thesis by blast}
  3.3664      ultimately show ?thesis by blast
  3.3665    qed
  3.3666 -  then obtain "l" "n" "s"  "m" where lnU: "(l,n) \<in> ?U" and smU:"(s,m) \<in> ?U" 
  3.3667 +  then obtain "l" "n" "s"  "m" where lnU: "(l,n) \<in> ?U" and smU:"(s,m) \<in> ?U"
  3.3668      and pu: "?I ((?N a l / real_of_int n + ?N a s / real_of_int m) / 2) p" by blast
  3.3669    from lnU smU \<Upsilon>_l[OF lp] have nbl: "numbound0 l" and nbs: "numbound0 s" by auto
  3.3670 -  from numbound0_I[OF nbl, where bs="bs" and b="a" and b'="x"] 
  3.3671 +  from numbound0_I[OF nbl, where bs="bs" and b="a" and b'="x"]
  3.3672      numbound0_I[OF nbs, where bs="bs" and b="a" and b'="x"] pu
  3.3673    have "?I ((?N x l / real_of_int n + ?N x s / real_of_int m) / 2) p" by simp
  3.3674    with lnU smU
  3.3675 @@ -4690,7 +4690,7 @@
  3.3676  qed
  3.3677      (* The Ferrante - Rackoff Theorem *)
  3.3678  
  3.3679 -theorem fr_eq: 
  3.3680 +theorem fr_eq:
  3.3681    assumes lp: "isrlfm p"
  3.3682    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))"
  3.3683    (is "(\<exists> x. ?I x p) = (?M \<or> ?P \<or> ?F)" is "?E = ?D")
  3.3684 @@ -4702,7 +4702,7 @@
  3.3685      from rinf_\<Upsilon>[OF lp nmi npi] have "?F" using px by blast hence "?D" by blast}
  3.3686    ultimately show "?D" by blast
  3.3687  next
  3.3688 -  assume "?D" 
  3.3689 +  assume "?D"
  3.3690    moreover {assume m:"?M" from rminusinf_ex[OF lp m] have "?E" .}
  3.3691    moreover {assume p: "?P" from rplusinf_ex[OF lp p] have "?E" . }
  3.3692    moreover {assume f:"?F" hence "?E" by blast}
  3.3693 @@ -4710,7 +4710,7 @@
  3.3694  qed
  3.3695  
  3.3696  
  3.3697 -lemma fr_eq_\<upsilon>: 
  3.3698 +lemma fr_eq_\<upsilon>:
  3.3699    assumes lp: "isrlfm p"
  3.3700    shows "(\<exists> x. Ifm (x#bs) p) = ((Ifm (x#bs) (minusinf p)) \<or> (Ifm (x#bs) (plusinf p)) \<or> (\<exists> (t,k) \<in> set (\<Upsilon> p). \<exists> (s,l) \<in> set (\<Upsilon> p). Ifm (x#bs) (\<upsilon> p (Add(Mul l t) (Mul k s) , 2*k*l))))"
  3.3701    (is "(\<exists> x. ?I x p) = (?M \<or> ?P \<or> ?F)" is "?E = ?D")
  3.3702 @@ -4729,15 +4729,15 @@
  3.3703        from tnb snb have st_nb: "numbound0 ?st" by simp
  3.3704        have st: "(?N t / real_of_int n + ?N s / real_of_int m)/2 = ?N ?st / real_of_int (2*n*m)"
  3.3705          using mnp mp np by (simp add: algebra_simps add_divide_distrib)
  3.3706 -      from \<upsilon>_I[OF lp mnp st_nb, where x="x" and bs="bs"] 
  3.3707 +      from \<upsilon>_I[OF lp mnp st_nb, where x="x" and bs="bs"]
  3.3708        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])}
  3.3709      with rinf_\<Upsilon>[OF lp nmi npi px] have "?F" by blast hence "?D" by blast}
  3.3710    ultimately show "?D" by blast
  3.3711  next
  3.3712 -  assume "?D" 
  3.3713 +  assume "?D"
  3.3714    moreover {assume m:"?M" from rminusinf_ex[OF lp m] have "?E" .}
  3.3715    moreover {assume p: "?P" from rplusinf_ex[OF lp p] have "?E" . }
  3.3716 -  moreover {fix t k s l assume "(t,k) \<in> set (\<Upsilon> p)" and "(s,l) \<in> set (\<Upsilon> p)" 
  3.3717 +  moreover {fix t k s l assume "(t,k) \<in> set (\<Upsilon> p)" and "(s,l) \<in> set (\<Upsilon> p)"
  3.3718      and px:"?I x (\<upsilon> p (Add (Mul l t) (Mul k s), 2*k*l))"
  3.3719      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
  3.3720      let ?st = "Add (Mul l t) (Mul k s)"
  3.3721 @@ -4759,7 +4759,7 @@
  3.3722    have "x = real_of_int ?i + ?u" by simp
  3.3723    hence "P (real_of_int ?i + ?u)" using Px by simp
  3.3724    moreover have "real_of_int ?i \<le> x" using of_int_floor_le by simp hence "0 \<le> ?u" by arith
  3.3725 -  moreover have "?u < 1" using real_of_int_floor_add_one_gt[where r="x"] by arith 
  3.3726 +  moreover have "?u < 1" using real_of_int_floor_add_one_gt[where r="x"] by arith
  3.3727    ultimately show "(\<exists> (i::int) (u::real). 0\<le> u \<and> u< 1 \<and> P (real_of_int i + u))" by blast
  3.3728  qed
  3.3729  
  3.3730 @@ -4792,11 +4792,11 @@
  3.3731  | "exsplit (NOT p) = NOT (exsplit p)"
  3.3732  | "exsplit p = p"
  3.3733  
  3.3734 -lemma exsplitnum: 
  3.3735 +lemma exsplitnum:
  3.3736    "Inum (x#y#bs) (exsplitnum t) = Inum ((x+y) #bs) t"
  3.3737    by(induct t rule: exsplitnum.induct) (simp_all add: algebra_simps)
  3.3738  
  3.3739 -lemma exsplit: 
  3.3740 +lemma exsplit:
  3.3741    assumes qfp: "qfree p"
  3.3742    shows "Ifm (x#y#bs) (exsplit p) = Ifm ((x+y)#bs) p"
  3.3743  using qfp exsplitnum[where x="x" and y="y" and bs="bs"]
  3.3744 @@ -4810,7 +4810,7 @@
  3.3745      by (simp add: myless[of _ "1"] myless[of _ "0"] ac_simps)
  3.3746    also have "\<dots> = (\<exists> (i::int). \<exists> x. 0\<le> x \<and> x < 1 \<and> Ifm ((real_of_int i + x) #bs) p)"
  3.3747      by (simp only: exsplit[OF qf] ac_simps)
  3.3748 -  also have "\<dots> = (\<exists> x. Ifm (x#bs) p)" 
  3.3749 +  also have "\<dots> = (\<exists> x. Ifm (x#bs) p)"
  3.3750      by (simp only: real_ex_int_real01[where P="\<lambda> x. Ifm (x#bs) p"])
  3.3751    finally show ?thesis by simp
  3.3752  qed
  3.3753 @@ -4819,12 +4819,12 @@
  3.3754  
  3.3755  definition ferrack01 :: "fm \<Rightarrow> fm" where
  3.3756    "ferrack01 p \<equiv> (let p' = rlfm(And (And (Ge(CN 0 1 (C 0))) (Lt (CN 0 1 (C (- 1))))) p);
  3.3757 -                    U = remdups(map simp_num_pair 
  3.3758 +                    U = remdups(map simp_num_pair
  3.3759                       (map (\<lambda> ((t,n),(s,m)). (Add (Mul m t) (Mul n s) , 2*n*m))
  3.3760 -                           (alluopairs (\<Upsilon> p')))) 
  3.3761 +                           (alluopairs (\<Upsilon> p'))))
  3.3762    in decr (evaldjf (\<upsilon> p') U ))"
  3.3763  
  3.3764 -lemma fr_eq_01: 
  3.3765 +lemma fr_eq_01:
  3.3766    assumes qf: "qfree p"
  3.3767    shows "(\<exists> x. Ifm (x#bs) (And (And (Ge(CN 0 1 (C 0))) (Lt (CN 0 1 (C (- 1))))) p)) = (\<exists> (t,n) \<in> set (\<Upsilon> (rlfm (And (And (Ge(CN 0 1 (C 0))) (Lt (CN 0 1 (C (- 1))))) p))). \<exists> (s,m) \<in> set (\<Upsilon> (rlfm (And (And (Ge(CN 0 1 (C 0))) (Lt (CN 0 1 (C (- 1))))) p))). Ifm (x#bs) (\<upsilon> (rlfm (And (And (Ge(CN 0 1 (C 0))) (Lt (CN 0 1 (C (- 1))))) p)) (Add (Mul m t) (Mul n s), 2*n*m)))"
  3.3768    (is "(\<exists> x. ?I x ?q) = ?F")
  3.3769 @@ -4837,18 +4837,18 @@
  3.3770      by (cases "rlfm p = And (Ge (CN 0 1 (C 0))) (Lt (CN 0 1 (C (- 1))))", simp_all)
  3.3771    have PF: "?P = False" apply (simp add: Let_def reducecoeff_def numgcd_def rsplit_def ge_def lt_def conj_def disj_def)
  3.3772      by (cases "rlfm p = And (Ge (CN 0 1 (C 0))) (Lt (CN 0 1 (C (- 1))))", simp_all)
  3.3773 -  have "(\<exists> x. ?I x ?q ) = 
  3.3774 +  have "(\<exists> x. ?I x ?q ) =
  3.3775      ((?I x (minusinf ?rq)) \<or> (?I x (plusinf ?rq )) \<or> (\<exists> (t,n) \<in> set (\<Upsilon> ?rq). \<exists> (s,m) \<in> set (\<Upsilon> ?rq ). ?I x (\<upsilon> ?rq (Add (Mul m t) (Mul n s), 2*n*m))))"
  3.3776      (is "(\<exists> x. ?I x ?q) = (?M \<or> ?P \<or> ?F)" is "?E = ?D")
  3.3777    proof
  3.3778 -    assume "\<exists> x. ?I x ?q"  
  3.3779 +    assume "\<exists> x. ?I x ?q"
  3.3780      then obtain x where qx: "?I x ?q" by blast
  3.3781 -    hence xp: "0\<le> x" and x1: "x< 1" and px: "?I x p" 
  3.3782 +    hence xp: "0\<le> x" and x1: "x< 1" and px: "?I x p"
  3.3783        by (auto simp add: rsplit_def lt_def ge_def rlfm_I[OF qf])
  3.3784 -    from qx have "?I x ?rq " 
  3.3785 +    from qx have "?I x ?rq "
  3.3786        by (simp add: rsplit_def lt_def ge_def rlfm_I[OF qf xp x1])
  3.3787      hence lqx: "?I x ?rq " using simpfm[where p="?rq" and bs="x#bs"] by auto
  3.3788 -    from qf have qfq:"isrlfm ?rq"  
  3.3789 +    from qf have qfq:"isrlfm ?rq"
  3.3790        by (auto simp add: rsplit_def lt_def ge_def rlfm_I[OF qf xp x1])
  3.3791      with lqx fr_eq_\<upsilon>[OF qfq] show "?M \<or> ?P \<or> ?F" by blast
  3.3792    next
  3.3793 @@ -4856,7 +4856,7 @@
  3.3794      let ?U = "set (\<Upsilon> ?rq )"
  3.3795      from MF PF D have "?F" by auto
  3.3796      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
  3.3797 -    from qf have lrq:"isrlfm ?rq"using rlfm_l[OF qf] 
  3.3798 +    from qf have lrq:"isrlfm ?rq"using rlfm_l[OF qf]
  3.3799        by (auto simp add: rsplit_def lt_def ge_def)
  3.3800      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)
  3.3801      let ?st = "Add (Mul m t) (Mul n s)"
  3.3802 @@ -4864,7 +4864,7 @@
  3.3803      from np mp have mnp: "real_of_int (2*n*m) > 0" by (simp add: mult.commute)
  3.3804      from conjunct1[OF \<upsilon>_I[OF lrq mnp stnb, where bs="bs" and x="x"], symmetric] rqx
  3.3805      have "\<exists> x. ?I x ?rq" by auto
  3.3806 -    thus "?E" 
  3.3807 +    thus "?E"
  3.3808        using rlfm_I[OF qf] by (auto simp add: rsplit_def lt_def ge_def)
  3.3809    qed
  3.3810    with MF PF show ?thesis by blast
  3.3811 @@ -4882,25 +4882,25 @@
  3.3812    let ?N = "\<lambda> t. Inum (x#bs) t"
  3.3813    let ?st= "Add (Mul m t) (Mul n s)"
  3.3814    from Ul th have mnz: "m \<noteq> 0" by auto
  3.3815 -  from Ul th have  nnz: "n \<noteq> 0" by auto  
  3.3816 +  from Ul th have  nnz: "n \<noteq> 0" by auto
  3.3817    have st: "(?N t / real_of_int n + ?N s / real_of_int m)/2 = ?N ?st / real_of_int (2*n*m)"
  3.3818     using mnz nnz by (simp add: algebra_simps add_divide_distrib)
  3.3819 - 
  3.3820 +
  3.3821    thus "(real_of_int m *  Inum (x # bs) t + real_of_int n * Inum (x # bs) s) /
  3.3822         (2 * real_of_int n * real_of_int m)
  3.3823         \<in> (\<lambda>((t, n), s, m).
  3.3824               (Inum (x # bs) t / real_of_int n + Inum (x # bs) s / real_of_int m) / 2) `
  3.3825 -         (set U \<times> set U)"using mnz nnz th  
  3.3826 +         (set U \<times> set U)"using mnz nnz th
  3.3827      apply (auto simp add: th add_divide_distrib algebra_simps split_def image_def)
  3.3828 -    by (rule_tac x="(s,m)" in bexI,simp_all) 
  3.3829 +    by (rule_tac x="(s,m)" in bexI,simp_all)
  3.3830    (rule_tac x="(t,n)" in bexI,simp_all add: mult.commute)
  3.3831  next
  3.3832    fix t n s m
  3.3833 -  assume tnU: "(t,n) \<in> set U" and smU:"(s,m) \<in> set U" 
  3.3834 +  assume tnU: "(t,n) \<in> set U" and smU:"(s,m) \<in> set U"
  3.3835    let ?N = "\<lambda> t. Inum (x#bs) t"
  3.3836    let ?st= "Add (Mul m t) (Mul n s)"
  3.3837    from Ul smU have mnz: "m \<noteq> 0" by auto
  3.3838 -  from Ul tnU have  nnz: "n \<noteq> 0" by auto  
  3.3839 +  from Ul tnU have  nnz: "n \<noteq> 0" by auto
  3.3840    have st: "(?N t / real_of_int n + ?N s / real_of_int m)/2 = ?N ?st / real_of_int (2*n*m)"
  3.3841     using mnz nnz by (simp add: algebra_simps add_divide_distrib)
  3.3842   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"
  3.3843 @@ -4910,13 +4910,13 @@
  3.3844   from alluopairs_ex[OF Pc, where xs="U"] tnU smU
  3.3845   have th':"\<exists> ((t',n'),(s',m')) \<in> set (alluopairs U). ?P (t',n') (s',m')"
  3.3846     by blast
  3.3847 - then obtain t' n' s' m' where ts'_U: "((t',n'),(s',m')) \<in> set (alluopairs U)" 
  3.3848 + then obtain t' n' s' m' where ts'_U: "((t',n'),(s',m')) \<in> set (alluopairs U)"
  3.3849     and Pts': "?P (t',n') (s',m')" by blast
  3.3850   from ts'_U Up have mnz': "m' \<noteq> 0" and nnz': "n'\<noteq> 0" by auto
  3.3851   let ?st' = "Add (Mul m' t') (Mul n' s')"
  3.3852     have st': "(?N t' / real_of_int n' + ?N s' / real_of_int m')/2 = ?N ?st' / real_of_int (2*n'*m')"
  3.3853     using mnz' nnz' by (simp add: algebra_simps add_divide_distrib)
  3.3854 - from Pts' have 
  3.3855 + from Pts' have
  3.3856     "(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
  3.3857   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')
  3.3858   finally show "(Inum (x # bs) t / real_of_int n + Inum (x # bs) s / real_of_int m) / 2
  3.3859 @@ -4935,13 +4935,13 @@
  3.3860    (is "?lhs = ?rhs")
  3.3861  proof
  3.3862    assume ?lhs
  3.3863 -  then obtain t n s m where tnU: "(t,n) \<in> U" and smU:"(s,m) \<in> U" and 
  3.3864 +  then obtain t n s m where tnU: "(t,n) \<in> U" and smU:"(s,m) \<in> U" and
  3.3865      Pst: "Ifm (x#bs) (\<upsilon> p (Add (Mul m t) (Mul n s),2*n*m))" by blast
  3.3866    let ?N = "\<lambda> t. Inum (x#bs) t"
  3.3867 -  from tnU smU U have tnb: "numbound0 t" and np: "n > 0" 
  3.3868 +  from tnU smU U have tnb: "numbound0 t" and np: "n > 0"
  3.3869      and snb: "numbound0 s" and mp:"m > 0"  by auto
  3.3870    let ?st= "Add (Mul m t) (Mul n s)"
  3.3871 -  from np mp have mnp: "real_of_int (2*n*m) > 0" 
  3.3872 +  from np mp have mnp: "real_of_int (2*n*m) > 0"
  3.3873        by (simp add: mult.commute of_int_mult[symmetric] del: of_int_mult)
  3.3874      from tnb snb have stnb: "numbound0 ?st" by simp
  3.3875    have st: "(?N t / real_of_int n + ?N s / real_of_int m)/2 = ?N ?st / real_of_int (2*n*m)"
  3.3876 @@ -4951,25 +4951,25 @@
  3.3877      by auto (rule_tac x="(a,b)" in bexI, auto)
  3.3878    then obtain t' n' where tnU': "(t',n') \<in> U'" and th: "?g ((t,n),(s,m)) = ?f (t',n')" by blast
  3.3879    from U' tnU' have tnb': "numbound0 t'" and np': "real_of_int n' > 0" by auto
  3.3880 -  from \<upsilon>_I[OF lp mnp stnb, where bs="bs" and x="x"] Pst 
  3.3881 +  from \<upsilon>_I[OF lp mnp stnb, where bs="bs" and x="x"] Pst
  3.3882    have Pst2: "Ifm (Inum (x # bs) (Add (Mul m t) (Mul n s)) / real_of_int (2 * n * m) # bs) p" by simp
  3.3883    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]]
  3.3884 -  have "Ifm (x # bs) (\<upsilon> p (t', n')) " by (simp only: st) 
  3.3885 -  then show ?rhs using tnU' by auto 
  3.3886 +  have "Ifm (x # bs) (\<upsilon> p (t', n')) " by (simp only: st)
  3.3887 +  then show ?rhs using tnU' by auto
  3.3888  next
  3.3889    assume ?rhs
  3.3890 -  then obtain t' n' where tnU': "(t',n') \<in> U'" and Pt': "Ifm (x # bs) (\<upsilon> p (t', n'))" 
  3.3891 +  then obtain t' n' where tnU': "(t',n') \<in> U'" and Pt': "Ifm (x # bs) (\<upsilon> p (t', n'))"
  3.3892      by blast
  3.3893    from tnU' UU' have "?f (t',n') \<in> ?g ` (U\<times>U)" by blast
  3.3894 -  hence "\<exists> ((t,n),(s,m)) \<in> (U\<times>U). ?f (t',n') = ?g ((t,n),(s,m))" 
  3.3895 +  hence "\<exists> ((t,n),(s,m)) \<in> (U\<times>U). ?f (t',n') = ?g ((t,n),(s,m))"
  3.3896      by auto (rule_tac x="(a,b)" in bexI, auto)
  3.3897 -  then obtain t n s m where tnU: "(t,n) \<in> U" and smU:"(s,m) \<in> U" and 
  3.3898 +  then obtain t n s m where tnU: "(t,n) \<in> U" and smU:"(s,m) \<in> U" and
  3.3899      th: "?f (t',n') = ?g((t,n),(s,m)) "by blast
  3.3900      let ?N = "\<lambda> t. Inum (x#bs) t"
  3.3901 -  from tnU smU U have tnb: "numbound0 t" and np: "n > 0" 
  3.3902 +  from tnU smU U have tnb: "numbound0 t" and np: "n > 0"
  3.3903      and snb: "numbound0 s" and mp:"m > 0"  by auto
  3.3904    let ?st= "Add (Mul m t) (Mul n s)"
  3.3905 -  from np mp have mnp: "real_of_int (2*n*m) > 0" 
  3.3906 +  from np mp have mnp: "real_of_int (2*n*m) > 0"
  3.3907        by (simp add: mult.commute of_int_mult[symmetric] del: of_int_mult)
  3.3908      from tnb snb have stnb: "numbound0 ?st" by simp
  3.3909    have st: "(?N t / real_of_int n + ?N s / real_of_int m)/2 = ?N ?st / real_of_int (2*n*m)"
  3.3910 @@ -4979,8 +4979,8 @@
  3.3911    have Pst2: "Ifm (Inum (x # bs) (Add (Mul m t) (Mul n s)) / real_of_int (2 * n * m) # bs) p" by simp
  3.3912    with \<upsilon>_I[OF lp mnp stnb, where x="x" and bs="bs"] tnU smU show ?lhs by blast
  3.3913  qed
  3.3914 -  
  3.3915 -lemma ferrack01: 
  3.3916 +
  3.3917 +lemma ferrack01:
  3.3918    assumes qf: "qfree p"
  3.3919    shows "((\<exists> x. Ifm (x#bs) (And (And (Ge(CN 0 1 (C 0))) (Lt (CN 0 1 (C (- 1))))) p)) = (Ifm bs (ferrack01 p))) \<and> qfree (ferrack01 p)" (is "(?lhs = ?rhs) \<and> _")
  3.3920  proof-
  3.3921 @@ -4998,17 +4998,17 @@
  3.3922    let ?h = "\<lambda> ((t,n),(s,m)). (?N t/real_of_int n + ?N s/ real_of_int m) /2"
  3.3923    let ?F = "\<lambda> p. \<exists> a \<in> set (\<Upsilon> p). \<exists> b \<in> set (\<Upsilon> p). ?I x (\<upsilon> p (?g(a,b)))"
  3.3924    let ?ep = "evaldjf (\<upsilon> ?q) ?Y"
  3.3925 -  from rlfm_l[OF qf] have lq: "isrlfm ?q" 
  3.3926 +  from rlfm_l[OF qf] have lq: "isrlfm ?q"
  3.3927      by (simp add: rsplit_def lt_def ge_def conj_def disj_def Let_def reducecoeff_def numgcd_def)
  3.3928    from alluopairs_set1[where xs="?U"] have UpU: "set ?Up \<le> (set ?U \<times> set ?U)" by simp
  3.3929    from \<Upsilon>_l[OF lq] have U_l: "\<forall> (t,n) \<in> set ?U. numbound0 t \<and> n > 0" .
  3.3930 -  from U_l UpU 
  3.3931 +  from U_l UpU
  3.3932    have "\<forall> ((t,n),(s,m)) \<in> set ?Up. numbound0 t \<and> n> 0 \<and> numbound0 s \<and> m > 0" by auto
  3.3933    hence Snb: "\<forall> (t,n) \<in> set ?S. numbound0 t \<and> n > 0 "
  3.3934      by (auto)
  3.3935 -  have Y_l: "\<forall> (t,n) \<in> set ?Y. numbound0 t \<and> n > 0" 
  3.3936 +  have Y_l: "\<forall> (t,n) \<in> set ?Y. numbound0 t \<and> n > 0"
  3.3937    proof-
  3.3938 -    { fix t n assume tnY: "(t,n) \<in> set ?Y" 
  3.3939 +    { fix t n assume tnY: "(t,n) \<in> set ?Y"
  3.3940        hence "(t,n) \<in> set ?SS" by simp
  3.3941        hence "\<exists> (t',n') \<in> set ?S. simp_num_pair (t',n') = (t,n)"
  3.3942          by (auto simp add: split_def simp del: map_map)
  3.3943 @@ -5022,12 +5022,12 @@
  3.3944  
  3.3945    have YU: "(?f ` set ?Y) = (?h ` (set ?U \<times> set ?U))"
  3.3946    proof-
  3.3947 -     from simp_num_pair_ci[where bs="x#bs"] have 
  3.3948 +     from simp_num_pair_ci[where bs="x#bs"] have
  3.3949      "\<forall>x. (?f o simp_num_pair) x = ?f x" by auto
  3.3950       hence th: "?f o simp_num_pair = ?f" using ext by blast
  3.3951      have "(?f ` set ?Y) = ((?f o simp_num_pair) ` set ?S)" by (simp add: image_comp comp_assoc)
  3.3952      also have "\<dots> = (?f ` set ?S)" by (simp add: th)
  3.3953 -    also have "\<dots> = ((?f o ?g) ` set ?Up)" 
  3.3954 +    also have "\<dots> = ((?f o ?g) ` set ?Up)"
  3.3955        by (simp only: set_map o_def image_comp)
  3.3956      also have "\<dots> = (?h ` (set ?U \<times> set ?U))"
  3.3957        using \<Upsilon>_cong_aux[OF U_l, where x="x" and bs="bs", simplified set_map image_comp] by blast
  3.3958 @@ -5047,8 +5047,8 @@
  3.3959    from fr_eq_01[OF qf, where bs="bs" and x="x"] have "?lhs = ?F ?q"
  3.3960      by (simp only: split_def fst_conv snd_conv)
  3.3961    also have "\<dots> = (\<exists> (t,n) \<in> set ?Y. ?I x (\<upsilon> ?q (t,n)))" using \<Upsilon>_cong[OF lq YU U_l Y_l]
  3.3962 -    by (simp only: split_def fst_conv snd_conv) 
  3.3963 -  also have "\<dots> = (Ifm (x#bs) ?ep)" 
  3.3964 +    by (simp only: split_def fst_conv snd_conv)
  3.3965 +  also have "\<dots> = (Ifm (x#bs) ?ep)"
  3.3966      using evaldjf_ex[where ps="?Y" and bs = "x#bs" and f="\<upsilon> ?q",symmetric]
  3.3967      by (simp only: split_def prod.collapse)
  3.3968    also have "\<dots> = (Ifm bs (decr ?ep))" using decr[OF ep_nb] by blast
  3.3969 @@ -5057,7 +5057,7 @@
  3.3970    with lr show ?thesis by blast
  3.3971  qed
  3.3972  
  3.3973 -lemma cp_thm': 
  3.3974 +lemma cp_thm':
  3.3975    assumes lp: "iszlfm p (real_of_int (i::int)#bs)"
  3.3976    and up: "d_\<beta> p 1" and dd: "d_\<delta> p d" and dp: "d > 0"
  3.3977    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))"
  3.3978 @@ -5070,12 +5070,12 @@
  3.3979  
  3.3980  lemma unit: assumes qf: "qfree p"
  3.3981    shows "\<And> q B d. unit p = (q,B,d) \<Longrightarrow>
  3.3982 -      ((\<exists> (x::int). Ifm (real_of_int x#bs) p) = 
  3.3983 -       (\<exists> (x::int). Ifm (real_of_int x#bs) q)) \<and> 
  3.3984 -       (Inum (real_of_int i#bs)) ` set B = (Inum (real_of_int i#bs)) ` set (\<beta> q) \<and> 
  3.3985 +      ((\<exists> (x::int). Ifm (real_of_int x#bs) p) =
  3.3986 +       (\<exists> (x::int). Ifm (real_of_int x#bs) q)) \<and>
  3.3987 +       (Inum (real_of_int i#bs)) ` set B = (Inum (real_of_int i#bs)) ` set (\<beta> q) \<and>
  3.3988         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)"
  3.3989  proof-
  3.3990 -  fix q B d 
  3.3991 +  fix q B d
  3.3992    assume qBd: "unit p = (q,B,d)"
  3.3993    let ?thes = "((\<exists> (x::int). Ifm (real_of_int x#bs) p) = (\<exists> (x::int). Ifm (real_of_int x#bs) q)) \<and>
  3.3994      Inum (real_of_int i#bs) ` set B = Inum (real_of_int i#bs) ` set (\<beta> q) \<and>
  3.3995 @@ -5089,22 +5089,22 @@
  3.3996    let ?B'= "remdups (map simpnum (\<beta> ?q))"
  3.3997    let ?A = "set (\<alpha> ?q)"
  3.3998    let ?A'= "remdups (map simpnum (\<alpha> ?q))"
  3.3999 -  from conjunct1[OF zlfm_I[OF qf, where bs="bs"]] 
  3.4000 +  from conjunct1[OF zlfm_I[OF qf, where bs="bs"]]
  3.4001    have pp': "\<forall> i. ?I i ?p' = ?I i p" by auto
  3.4002    from iszlfm_gen[OF conjunct2[OF zlfm_I[OF qf, where bs="bs" and i="i"]]]
  3.4003 -  have lp': "\<forall> (i::int). iszlfm ?p' (real_of_int i#bs)" by simp 
  3.4004 +  have lp': "\<forall> (i::int). iszlfm ?p' (real_of_int i#bs)" by simp
  3.4005    hence lp'': "iszlfm ?p' (real_of_int (i::int)#bs)" by simp
  3.4006    from lp' \<zeta>[where p="?p'" and bs="bs"] have lp: "?l >0" and dl: "d_\<beta> ?p' ?l" by auto
  3.4007    from a_\<beta>_ex[where p="?p'" and l="?l" and bs="bs", OF lp'' dl lp] pp'
  3.4008 -  have pq_ex:"(\<exists> (x::int). ?I x p) = (\<exists> x. ?I x ?q)" by (simp add: int_rdvd_iff) 
  3.4009 -  from lp'' lp a_\<beta>[OF lp'' dl lp] have lq:"iszlfm ?q (real_of_int i#bs)" and uq: "d_\<beta> ?q 1" 
  3.4010 +  have pq_ex:"(\<exists> (x::int). ?I x p) = (\<exists> x. ?I x ?q)" by (simp add: int_rdvd_iff)
  3.4011 +  from lp'' lp a_\<beta>[OF lp'' dl lp] have lq:"iszlfm ?q (real_of_int i#bs)" and uq: "d_\<beta> ?q 1"
  3.4012      by (auto simp add: isint_def)
  3.4013    from \<delta>[OF lq] have dp:"?d >0" and dd: "d_\<delta> ?q ?d" by blast+
  3.4014    let ?N = "\<lambda> t. Inum (real_of_int (i::int)#bs) t"
  3.4015 -  have "?N ` set ?B' = ((?N o simpnum) ` ?B)" by (simp add:image_comp) 
  3.4016 +  have "?N ` set ?B' = ((?N o simpnum) ` ?B)" by (simp add:image_comp)
  3.4017    also have "\<dots> = ?N ` ?B" using simpnum_ci[where bs="real_of_int i #bs"] by auto
  3.4018    finally have BB': "?N ` set ?B' = ?N ` ?B" .
  3.4019 -  have "?N ` set ?A' = ((?N o simpnum) ` ?A)" by (simp add:image_comp) 
  3.4020 +  have "?N ` set ?A' = ((?N o simpnum) ` ?A)" by (simp add:image_comp)
  3.4021    also have "\<dots> = ?N ` ?A" using simpnum_ci[where bs="real_of_int i #bs"] by auto
  3.4022    finally have AA': "?N ` set ?A' = ?N ` ?A" .
  3.4023    from \<beta>_numbound0[OF lq] have B_nb:"\<forall> b\<in> set ?B'. numbound0 b"
  3.4024 @@ -5114,16 +5114,16 @@
  3.4025    { assume "length ?B' \<le> length ?A'"
  3.4026      hence q:"q=?q" and "B = ?B'" and d:"d = ?d"
  3.4027        using qBd by (auto simp add: Let_def unit_def)
  3.4028 -    with BB' B_nb have b: "?N ` (set B) = ?N ` set (\<beta> q)" 
  3.4029 +    with BB' B_nb have b: "?N ` (set B) = ?N ` set (\<beta> q)"
  3.4030        and bn: "\<forall>b\<in> set B. numbound0 b" by simp+
  3.4031      with pq_ex dp uq dd lq q d have ?thes by simp }
  3.4032 -  moreover 
  3.4033 +  moreover
  3.4034    { assume "\<not> (length ?B' \<le> length ?A')"
  3.4035      hence q:"q=mirror ?q" and "B = ?A'" and d:"d = ?d"
  3.4036        using qBd by (auto simp add: Let_def unit_def)
  3.4037 -    with AA' mirror_\<alpha>_\<beta>[OF lq] A_nb have b:"?N ` (set B) = ?N ` set (\<beta> q)" 
  3.4038 +    with AA' mirror_\<alpha>_\<beta>[OF lq] A_nb have b:"?N ` (set B) = ?N ` set (\<beta> q)"
  3.4039        and bn: "\<forall>b\<in> set B. numbound0 b" by simp+
  3.4040 -    from mirror_ex[OF lq] pq_ex q 
  3.4041 +    from mirror_ex[OF lq] pq_ex q
  3.4042      have pqm_eq:"(\<exists> (x::int). ?I x p) = (\<exists> (x::int). ?I x q)" by simp
  3.4043      from lq uq q mirror_d_\<beta> [where p="?q" and bs="bs" and a="real_of_int i"]
  3.4044      have lq': "iszlfm q (real_of_int i#bs)" and uq: "d_\<beta> q 1" by auto
  3.4045 @@ -5135,17 +5135,17 @@
  3.4046      (* Cooper's Algorithm *)
  3.4047  
  3.4048  definition cooper :: "fm \<Rightarrow> fm" where
  3.4049 -  "cooper p \<equiv> 
  3.4050 +  "cooper p \<equiv>
  3.4051    (let (q,B,d) = unit p; js = [1..d];
  3.4052         mq = simpfm (minusinf q);
  3.4053         md = evaldjf (\<lambda> j. simpfm (subst0 (C j) mq)) js
  3.4054     in if md = T then T else
  3.4055 -    (let qd = evaldjf (\<lambda> t. simpfm (subst0 t q)) 
  3.4056 -                               (remdups (map (\<lambda> (b,j). simpnum (Add b (C j))) 
  3.4057 +    (let qd = evaldjf (\<lambda> t. simpfm (subst0 t q))
  3.4058 +                               (remdups (map (\<lambda> (b,j). simpnum (Add b (C j)))
  3.4059                                              [(b,j). b\<leftarrow>B,j\<leftarrow>js]))
  3.4060       in decr (disj md qd)))"
  3.4061  lemma cooper: assumes qf: "qfree p"
  3.4062 -  shows "((\<exists> (x::int). Ifm (real_of_int x#bs) p) = (Ifm bs (cooper p))) \<and> qfree (cooper p)" 
  3.4063 +  shows "((\<exists> (x::int). Ifm (real_of_int x#bs) p) = (Ifm bs (cooper p))) \<and> qfree (cooper p)"
  3.4064    (is "(?lhs = ?rhs) \<and> _")
  3.4065  proof-
  3.4066  
  3.4067 @@ -5163,65 +5163,65 @@
  3.4068    let ?sbjs = "map (\<lambda> (b,j). simpnum (Add b (C j))) ?bjs"
  3.4069    let ?qd = "evaldjf (\<lambda> t. simpfm (subst0 t ?q)) (remdups ?sbjs)"
  3.4070    have qbf:"unit p = (?q,?B,?d)" by simp
  3.4071 -  from unit[OF qf qbf] have pq_ex: "(\<exists>(x::int). ?I x p) = (\<exists> (x::int). ?I x ?q)" and 
  3.4072 -    B:"?N ` set ?B = ?N ` set (\<beta> ?q)" and 
  3.4073 -    uq:"d_\<beta> ?q 1" and dd: "d_\<delta> ?q ?d" and dp: "?d > 0" and 
  3.4074 -    lq: "iszlfm ?q (real_of_int i#bs)" and 
  3.4075 +  from unit[OF qf qbf] have pq_ex: "(\<exists>(x::int). ?I x p) = (\<exists> (x::int). ?I x ?q)" and
  3.4076 +    B:"?N ` set ?B = ?N ` set (\<beta> ?q)" and
  3.4077 +    uq:"d_\<beta> ?q 1" and dd: "d_\<delta> ?q ?d" and dp: "?d > 0" and
  3.4078 +    lq: "iszlfm ?q (real_of_int i#bs)" and
  3.4079      Bn: "\<forall> b\<in> set ?B. numbound0 b" by auto
  3.4080    from zlin_qfree[OF lq] have qfq: "qfree ?q" .
  3.4081    from simpfm_qf[OF minusinf_qfree[OF qfq]] have qfmq: "qfree ?smq".
  3.4082    have jsnb: "\<forall> j \<in> set ?js. numbound0 (C j)" by simp
  3.4083 -  hence "\<forall> j\<in> set ?js. bound0 (subst0 (C j) ?smq)" 
  3.4084 +  hence "\<forall> j\<in> set ?js. bound0 (subst0 (C j) ?smq)"
  3.4085      by (auto simp only: subst0_bound0[OF qfmq])
  3.4086    hence th: "\<forall> j\<in> set ?js. bound0 (simpfm (subst0 (C j) ?smq))"
  3.4087      by auto
  3.4088 -  from evaldjf_bound0[OF th] have mdb: "bound0 ?md" by simp 
  3.4089 +  from evaldjf_bound0[OF th] have mdb: "bound0 ?md" by simp
  3.4090    from Bn jsnb have "\<forall> (b,j) \<in> set ?bjs. numbound0 (Add b (C j))"
  3.4091      by simp
  3.4092    hence "\<forall> (b,j) \<in> set ?bjs. numbound0 (simpnum (Add b (C j)))"
  3.4093      using simpnum_numbound0 by blast
  3.4094    hence "\<forall> t \<in> set ?sbjs. numbound0 t" by simp
  3.4095    hence "\<forall> t \<in> set (remdups ?sbjs). bound0 (subst0 t ?q)"
  3.4096 -    using subst0_bound0[OF qfq] by auto 
  3.4097 +    using subst0_bound0[OF qfq] by auto
  3.4098    hence th': "\<forall> t \<in> set (remdups ?sbjs). bound0 (simpfm (subst0 t ?q))"
  3.4099      using simpfm_bound0 by blast
  3.4100    from evaldjf_bound0 [OF th'] have qdb: "bound0 ?qd" by simp
  3.4101 -  from mdb qdb 
  3.4102 +  from mdb qdb
  3.4103    have mdqdb: "bound0 (disj ?md ?qd)" by (simp only: disj_def, cases "?md=T \<or> ?qd=T", simp_all)
  3.4104    from trans [OF pq_ex cp_thm'[OF lq uq dd dp]] B
  3.4105    have "?lhs = (\<exists> j\<in> {1.. ?d}. ?I j ?mq \<or> (\<exists> b\<in> ?N ` set ?B. Ifm ((b+ real_of_int j)#bs) ?q))" by auto
  3.4106    also have "\<dots> = ((\<exists> j\<in> set ?js. ?I j ?smq) \<or> (\<exists> (b,j) \<in> (?N ` set ?B \<times> set ?js). Ifm ((b+ real_of_int j)#bs) ?q))" by auto
  3.4107    also have "\<dots>= ((\<exists> j\<in> set ?js. ?I j ?smq) \<or> (\<exists> t \<in> (\<lambda> (b,j). ?N (Add b (C j))) ` set ?bjs. Ifm (t #bs) ?q))" by simp
  3.4108    also have "\<dots>= ((\<exists> j\<in> set ?js. ?I j ?smq) \<or> (\<exists> t \<in> (\<lambda> (b,j). ?N (simpnum (Add b (C j)))) ` set ?bjs. Ifm (t #bs) ?q))" by (simp only: simpnum_ci)
  3.4109 -  also  have "\<dots>= ((\<exists> j\<in> set ?js. ?I j ?smq) \<or> (\<exists> t \<in> set ?sbjs. Ifm (?N t #bs) ?q))" 
  3.4110 -    by (auto simp add: split_def) 
  3.4111 +  also  have "\<dots>= ((\<exists> j\<in> set ?js. ?I j ?smq) \<or> (\<exists> t \<in> set ?sbjs. Ifm (?N t #bs) ?q))"
  3.4112 +    by (auto simp add: split_def)
  3.4113    also have "\<dots> = ((\<exists> j\<in> set ?js. (\<lambda> j. ?I i (simpfm (subst0 (C j) ?smq))) j) \<or> (\<exists> t \<in> set (remdups ?sbjs). (\<lambda> t. ?I i (simpfm (subst0 t ?q))) t))"
  3.4114      by (simp only: simpfm subst0_I[OF qfq] Inum.simps subst0_I[OF qfmq] set_remdups)
  3.4115    also have "\<dots> = ((?I i (evaldjf (\<lambda> j. simpfm (subst0 (C j) ?smq)) ?js)) \<or> (?I i (evaldjf (\<lambda> t. simpfm (subst0 t ?q)) (remdups ?sbjs))))" by (simp only: evaldjf_ex)
  3.4116    finally have mdqd: "?lhs = (?I i (disj ?md ?qd))" by simp
  3.4117    hence mdqd2: "?lhs = (Ifm bs (decr (disj ?md ?qd)))" using decr [OF mdqdb] by simp
  3.4118    {assume mdT: "?md = T"
  3.4119 -    hence cT:"cooper p = T" 
  3.4120 +    hence cT:"cooper p = T"
  3.4121        by (simp only: cooper_def unit_def split_def Let_def if_True) simp
  3.4122      from mdT mdqd have lhs:"?lhs" by auto
  3.4123      from mdT have "?rhs" by (simp add: cooper_def unit_def split_def)
  3.4124      with lhs cT have ?thesis by simp }
  3.4125    moreover
  3.4126 -  {assume mdT: "?md \<noteq> T" hence "cooper p = decr (disj ?md ?qd)" 
  3.4127 -      by (simp only: cooper_def unit_def split_def Let_def if_False) 
  3.4128 +  {assume mdT: "?md \<noteq> T" hence "cooper p = decr (disj ?md ?qd)"
  3.4129 +      by (simp only: cooper_def unit_def split_def Let_def if_False)
  3.4130      with mdqd2 decr_qf[OF mdqdb] have ?thesis by simp }
  3.4131    ultimately show ?thesis by blast
  3.4132  qed
  3.4133  
  3.4134 -lemma DJcooper: 
  3.4135 +lemma DJcooper:
  3.4136    assumes qf: "qfree p"
  3.4137    shows "((\<exists> (x::int). Ifm (real_of_int x#bs) p) = (Ifm bs (DJ cooper p))) \<and> qfree (DJ cooper p)"
  3.4138  proof-
  3.4139    from cooper have cqf: "\<forall> p. qfree p \<longrightarrow> qfree (cooper p)" by  blast
  3.4140    from DJ_qf[OF cqf] qf have thqf:"qfree (DJ cooper p)" by blast
  3.4141 -  have "Ifm bs (DJ cooper p) = (\<exists> q\<in> set (disjuncts p). Ifm bs (cooper q))" 
  3.4142 +  have "Ifm bs (DJ cooper p) = (\<exists> q\<in> set (disjuncts p). Ifm bs (cooper q))"
  3.4143       by (simp add: DJ_def evaldjf_ex)
  3.4144 -  also have "\<dots> = (\<exists> q \<in> set(disjuncts p). \<exists> (x::int). Ifm (real_of_int x#bs)  q)" 
  3.4145 +  also have "\<dots> = (\<exists> q \<in> set(disjuncts p). \<exists> (x::int). Ifm (real_of_int x#bs)  q)"
  3.4146      using cooper disjuncts_qf[OF qf] by blast
  3.4147    also have "\<dots> = (\<exists> (x::int). Ifm (real_of_int x#bs) p)" by (induct p rule: disjuncts.induct, auto)
  3.4148    finally show ?thesis using thqf by blast
  3.4149 @@ -5231,20 +5231,20 @@
  3.4150  
  3.4151  lemma \<sigma>_\<rho>_cong: assumes lp: "iszlfm p (a#bs)" and tt': "Inum (a#bs) t = Inum (a#bs) t'"
  3.4152    shows "Ifm (a#bs) (\<sigma>_\<rho> p (t,c)) = Ifm (a#bs) (\<sigma>_\<rho> p (t',c))"
  3.4153 -  using lp 
  3.4154 +  using lp
  3.4155    by (induct p rule: iszlfm.induct, auto simp add: tt')
  3.4156  
  3.4157  lemma \<sigma>_cong: assumes lp: "iszlfm p (a#bs)" and tt': "Inum (a#bs) t = Inum (a#bs) t'"
  3.4158    shows "Ifm (a#bs) (\<sigma> p c t) = Ifm (a#bs) (\<sigma> p c t')"
  3.4159    by (simp add: \<sigma>_def tt' \<sigma>_\<rho>_cong[OF lp tt'])
  3.4160  
  3.4161 -lemma \<rho>_cong: assumes lp: "iszlfm p (a#bs)" 
  3.4162 +lemma \<rho>_cong: assumes lp: "iszlfm p (a#bs)"
  3.4163    and RR: "(\<lambda>(b,k). (Inum (a#bs) b,k)) ` R =  (\<lambda>(b,k). (Inum (a#bs) b,k)) ` set (\<rho> p)"
  3.4164    shows "(\<exists> (e,c) \<in> R. \<exists> j\<in> {1.. c*(\<delta> p)}. Ifm (a#bs) (\<sigma> p c (Add e (C j)))) = (\<exists> (e,c) \<in> set (\<rho> p). \<exists> j\<in> {1.. c*(\<delta> p)}. Ifm (a#bs) (\<sigma> p c (Add e (C j))))"
  3.4165    (is "?lhs = ?rhs")
  3.4166  proof
  3.4167    let ?d = "\<delta> p"
  3.4168 -  assume ?lhs then obtain e c j where ecR: "(e,c) \<in> R" and jD:"j \<in> {1 .. c*?d}" 
  3.4169 +  assume ?lhs then obtain e c j where ecR: "(e,c) \<in> R" and jD:"j \<in> {1 .. c*?d}"
  3.4170      and px: "Ifm (a#bs) (\<sigma> p c (Add e (C j)))" (is "?sp c e j") by blast
  3.4171    from ecR have "(Inum (a#bs) e,c) \<in> (\<lambda>(b,k). (Inum (a#bs) b,k)) ` R" by auto
  3.4172    hence "(Inum (a#bs) e,c) \<in> (\<lambda>(b,k). (Inum (a#bs) b,k)) ` set (\<rho> p)" using RR by simp
  3.4173 @@ -5252,14 +5252,14 @@
  3.4174    then obtain e' c' where ecRo:"(e',c') \<in> set (\<rho> p)" and ee':"Inum (a#bs) e = Inum (a#bs) e'"
  3.4175      and cc':"c = c'" by blast
  3.4176    from ee' have tt': "Inum (a#bs) (Add e (C j)) = Inum (a#bs) (Add e' (C j))" by simp
  3.4177 -  
  3.4178 +
  3.4179    from \<sigma>_cong[OF lp tt', where c="c"] px have px':"?sp c e' j" by simp
  3.4180    from ecRo jD px' show ?rhs apply (auto simp: cc')
  3.4181      by (rule_tac x="(e', c')" in bexI,simp_all)
  3.4182    (rule_tac x="j" in bexI, simp_all add: cc'[symmetric])
  3.4183  next
  3.4184    let ?d = "\<delta> p"
  3.4185 -  assume ?rhs then obtain e c j where ecR: "(e,c) \<in> set (\<rho> p)" and jD:"j \<in> {1 .. c*?d}" 
  3.4186 +  assume ?rhs then obtain e c j where ecR: "(e,c) \<in> set (\<rho> p)" and jD:"j \<in> {1 .. c*?d}"
  3.4187      and px: "Ifm (a#bs) (\<sigma> p c (Add e (C j)))" (is "?sp c e j") by blast
  3.4188    from ecR have "(Inum (a#bs) e,c) \<in> (\<lambda>(b,k). (Inum (a#bs) b,k)) ` set (\<rho> p)" by auto
  3.4189    hence "(Inum (a#bs) e,c) \<in> (\<lambda>(b,k). (Inum (a#bs) b,k)) ` R" using RR by simp
  3.4190 @@ -5273,30 +5273,30 @@
  3.4191    (rule_tac x="j" in bexI, simp_all add: cc'[symmetric])
  3.4192  qed
  3.4193  
  3.4194 -lemma rl_thm': 
  3.4195 -  assumes lp: "iszlfm p (real_of_int (i::int)#bs)" 
  3.4196 +lemma rl_thm':
  3.4197 +  assumes lp: "iszlfm p (real_of_int (i::int)#bs)"
  3.4198    and R: "(\<lambda>(b,k). (Inum (a#bs) b,k)) ` R =  (\<lambda>(b,k). (Inum (a#bs) b,k)) ` set (\<rho> p)"
  3.4199    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> R. \<exists> j\<in> {1.. c*(\<delta> p)}. Ifm (a#bs) (\<sigma> p c (Add e (C j)))))"
  3.4200 -  using rl_thm[OF lp] \<rho>_cong[OF iszlfm_gen[OF lp, rule_format, where y="a"] R] by simp 
  3.4201 +  using rl_thm[OF lp] \<rho>_cong[OF iszlfm_gen[OF lp, rule_format, where y="a"] R] by simp
  3.4202  
  3.4203  definition chooset :: "fm \<Rightarrow> fm \<times> ((num\<times>int) list) \<times> int" where
  3.4204    "chooset p \<equiv> (let q = zlfm p ; d = \<delta> q;
  3.4205 -             B = remdups (map (\<lambda> (t,k). (simpnum t,k)) (\<rho> q)) ; 
  3.4206 +             B = remdups (map (\<lambda> (t,k). (simpnum t,k)) (\<rho> q)) ;
  3.4207               a = remdups (map (\<lambda> (t,k). (simpnum t,k)) (\<alpha>_\<rho> q))
  3.4208               in if length B \<le> length a then (q,B,d) else (mirror q, a,d))"
  3.4209  
  3.4210  lemma chooset: assumes qf: "qfree p"
  3.4211 -  shows "\<And> q B d. chooset p = (q,B,d) \<Longrightarrow> 
  3.4212 -     ((\<exists> (x::int). Ifm (real_of_int x#bs) p) = 
  3.4213 -      (\<exists> (x::int). Ifm (real_of_int x#bs) q)) \<and> 
  3.4214 +  shows "\<And> q B d. chooset p = (q,B,d) \<Longrightarrow>
  3.4215 +     ((\<exists> (x::int). Ifm (real_of_int x#bs) p) =
  3.4216 +      (\<exists> (x::int). Ifm (real_of_int x#bs) q)) \<and>
  3.4217        ((\<lambda>(t,k). (Inum (real_of_int i#bs) t,k)) ` set B = (\<lambda>(t,k). (Inum (real_of_int i#bs) t,k)) ` set (\<rho> q)) \<and>
  3.4218        (\<delta> q = d) \<and> d >0 \<and> iszlfm q (real_of_int (i::int)#bs) \<and> (\<forall> (e,c)\<in> set B. numbound0 e \<and> c>0)"
  3.4219  proof-
  3.4220 -  fix q B d 
  3.4221 +  fix q B d
  3.4222    assume qBd: "chooset p = (q,B,d)"
  3.4223 -  let ?thes = "((\<exists> (x::int). Ifm (real_of_int x#bs) p) = 
  3.4224 -             (\<exists> (x::int). Ifm (real_of_int x#bs) q)) \<and> ((\<lambda>(t,k). (Inum (real_of_int i#bs) t,k)) ` set B = (\<lambda>(t,k). (Inum (real_of_int i#bs) t,k)) ` set (\<rho> q)) \<and> 
  3.4225 -             (\<delta> q = d) \<and> d >0 \<and> iszlfm q (real_of_int (i::int)#bs) \<and> (\<forall> (e,c)\<in> set B. numbound0 e \<and> c>0)" 
  3.4226 +  let ?thes = "((\<exists> (x::int). Ifm (real_of_int x#bs) p) =
  3.4227 +             (\<exists> (x::int). Ifm (real_of_int x#bs) q)) \<and> ((\<lambda>(t,k). (Inum (real_of_int i#bs) t,k)) ` set B = (\<lambda>(t,k). (Inum (real_of_int i#bs) t,k)) ` set (\<rho> q)) \<and>
  3.4228 +             (\<delta> q = d) \<and> d >0 \<and> iszlfm q (real_of_int (i::int)#bs) \<and> (\<forall> (e,c)\<in> set B. numbound0 e \<and> c>0)"
  3.4229    let ?I = "\<lambda> (x::int) p. Ifm (real_of_int x#bs) p"
  3.4230    let ?q = "zlfm p"
  3.4231    let ?d = "\<delta> ?q"
  3.4232 @@ -5305,20 +5305,20 @@
  3.4233    let ?B'= "remdups (map ?f (\<rho> ?q))"
  3.4234    let ?A = "set (\<alpha>_\<rho> ?q)"
  3.4235    let ?A'= "remdups (map ?f (\<alpha>_\<rho> ?q))"
  3.4236 -  from conjunct1[OF zlfm_I[OF qf, where bs="bs"]] 
  3.4237 +  from conjunct1[OF zlfm_I[OF qf, where bs="bs"]]
  3.4238    have pp': "\<forall> i. ?I i ?q = ?I i p" by auto
  3.4239 -  hence pq_ex:"(\<exists> (x::int). ?I x p) = (\<exists> x. ?I x ?q)" by simp 
  3.4240 +  hence pq_ex:"(\<exists> (x::int). ?I x p) = (\<exists> x. ?I x ?q)" by simp
  3.4241    from iszlfm_gen[OF conjunct2[OF zlfm_I[OF qf, where bs="bs" and i="i"]], rule_format, where y="real_of_int i"]
  3.4242 -  have lq: "iszlfm ?q (real_of_int (i::int)#bs)" . 
  3.4243 +  have lq: "iszlfm ?q (real_of_int (i::int)#bs)" .
  3.4244    from \<delta>[OF lq] have dp:"?d >0" by blast
  3.4245    let ?N = "\<lambda> (t,c). (Inum (real_of_int (i::int)#bs) t,c)"
  3.4246    have "?N ` set ?B' = ((?N o ?f) ` ?B)" by (simp add: split_def image_comp)
  3.4247    also have "\<dots> = ?N ` ?B"
  3.4248      by(simp add: split_def image_comp simpnum_ci[where bs="real_of_int i #bs"] image_def)
  3.4249    finally have BB': "?N ` set ?B' = ?N ` ?B" .
  3.4250 -  have "?N ` set ?A' = ((?N o ?f) ` ?A)" by (simp add: split_def image_comp) 
  3.4251 +  have "?N ` set ?A' = ((?N o ?f) ` ?A)" by (simp add: split_def image_comp)
  3.4252    also have "\<dots> = ?N ` ?A" using simpnum_ci[where bs="real_of_int i #bs"]
  3.4253 -    by(simp add: split_def image_comp simpnum_ci[where bs="real_of_int i #bs"] image_def) 
  3.4254 +    by(simp add: split_def image_comp simpnum_ci[where bs="real_of_int i #bs"] image_def)
  3.4255    finally have AA': "?N ` set ?A' = ?N ` ?A" .
  3.4256    from \<rho>_l[OF lq] have B_nb:"\<forall> (e,c)\<in> set ?B'. numbound0 e \<and> c > 0"
  3.4257      by (simp add: split_def)
  3.4258 @@ -5327,16 +5327,16 @@
  3.4259      {assume "length ?B' \<le> length ?A'"
  3.4260      hence q:"q=?q" and "B = ?B'" and d:"d = ?d"
  3.4261        using qBd by (auto simp add: Let_def chooset_def)
  3.4262 -    with BB' B_nb have b: "?N ` (set B) = ?N ` set (\<rho> q)" 
  3.4263 +    with BB' B_nb have b: "?N ` (set B) = ?N ` set (\<rho> q)"
  3.4264        and bn: "\<forall>(e,c)\<in> set B. numbound0 e \<and> c > 0" by auto
  3.4265    with pq_ex dp lq q d have ?thes by simp}
  3.4266 -  moreover 
  3.4267 +  moreover
  3.4268    {assume "\<not> (length ?B' \<le> length ?A')"
  3.4269      hence q:"q=mirror ?q" and "B = ?A'" and d:"d = ?d"
  3.4270        using qBd by (auto simp add: Let_def chooset_def)
  3.4271 -    with AA' mirror_\<alpha>_\<rho>[OF lq] A_nb have b:"?N ` (set B) = ?N ` set (\<rho> q)" 
  3.4272 -      and bn: "\<forall>(e,c)\<in> set B. numbound0 e \<and> c > 0" by auto 
  3.4273 -    from mirror_ex[OF lq] pq_ex q 
  3.4274 +    with AA' mirror_\<alpha>_\<rho>[OF lq] A_nb have b:"?N ` (set B) = ?N ` set (\<rho> q)"
  3.4275 +      and bn: "\<forall>(e,c)\<in> set B. numbound0 e \<and> c > 0" by auto
  3.4276 +    from mirror_ex[OF lq] pq_ex q
  3.4277      have pqm_eq:"(\<exists> (x::int). ?I x p) = (\<exists> (x::int). ?I x q)" by simp
  3.4278      from lq q mirror_l [where p="?q" and bs="bs" and a="real_of_int i"]
  3.4279      have lq': "iszlfm q (real_of_int i#bs)" by auto
  3.4280 @@ -5366,7 +5366,7 @@
  3.4281  qed
  3.4282  
  3.4283  definition redlove :: "fm \<Rightarrow> fm" where
  3.4284 -  "redlove p \<equiv> 
  3.4285 +  "redlove p \<equiv>
  3.4286    (let (q,B,d) = chooset p;
  3.4287         mq = simpfm (minusinf q);
  3.4288         md = evaldjf (\<lambda> j. simpfm (subst0 (C j) mq)) [1..d]
  3.4289 @@ -5375,7 +5375,7 @@
  3.4290       in decr (disj md qd)))"
  3.4291  
  3.4292  lemma redlove: assumes qf: "qfree p"
  3.4293 -  shows "((\<exists> (x::int). Ifm (real_of_int x#bs) p) = (Ifm bs (redlove p))) \<and> qfree (redlove p)" 
  3.4294 +  shows "((\<exists> (x::int). Ifm (real_of_int x#bs) p) = (Ifm bs (redlove p))) \<and> qfree (redlove p)"
  3.4295    (is "(?lhs = ?rhs) \<and> _")
  3.4296  proof-
  3.4297  
  3.4298 @@ -5391,53 +5391,53 @@
  3.4299    let ?N = "\<lambda> (t,k). (Inum (real_of_int (i::int)#bs) t,k)"
  3.4300    let ?qd = "evaldjf (stage ?q ?d) ?B"
  3.4301    have qbf:"chooset p = (?q,?B,?d)" by simp
  3.4302 -  from chooset[OF qf qbf] have pq_ex: "(\<exists>(x::int). ?I x p) = (\<exists> (x::int). ?I x ?q)" and 
  3.4303 -    B:"?N ` set ?B = ?N ` set (\<rho> ?q)" and dd: "\<delta> ?q = ?d" and dp: "?d > 0" and 
  3.4304 -    lq: "iszlfm ?q (real_of_int i#bs)" and 
  3.4305 +  from chooset[OF qf qbf] have pq_ex: "(\<exists>(x::int). ?I x p) = (\<exists> (x::int). ?I x ?q)" and
  3.4306 +    B:"?N ` set ?B = ?N ` set (\<rho> ?q)" and dd: "\<delta> ?q = ?d" and dp: "?d > 0" and
  3.4307 +    lq: "iszlfm ?q (real_of_int i#bs)" and
  3.4308      Bn: "\<forall> (e,c)\<in> set ?B. numbound0 e \<and> c > 0" by auto
  3.4309    from zlin_qfree[OF lq] have qfq: "qfree ?q" .
  3.4310    from simpfm_qf[OF minusinf_qfree[OF qfq]] have qfmq: "qfree ?smq".
  3.4311    have jsnb: "\<forall> j \<in> set ?js. numbound0 (C j)" by simp
  3.4312 -  hence "\<forall> j\<in> set ?js. bound0 (subst0 (C j) ?smq)" 
  3.4313 +  hence "\<forall> j\<in> set ?js. bound0 (subst0 (C j) ?smq)"
  3.4314      by (auto simp only: subst0_bound0[OF qfmq])
  3.4315    hence th: "\<forall> j\<in> set ?js. bound0 (simpfm (subst0 (C j) ?smq))"
  3.4316      by auto
  3.4317 -  from evaldjf_bound0[OF th] have mdb: "bound0 ?md" by simp 
  3.4318 +  from evaldjf_bound0[OF th] have mdb: "bound0 ?md" by simp
  3.4319    from Bn stage_nb[OF lq] have th:"\<forall> x \<in> set ?B. bound0 (stage ?q ?d x)" by auto
  3.4320    from evaldjf_bound0[OF th]  have qdb: "bound0 ?qd" .
  3.4321 -  from mdb qdb 
  3.4322 +  from mdb qdb
  3.4323    have mdqdb: "bound0 (disj ?md ?qd)" by (simp only: disj_def, cases "?md=T \<or> ?qd=T", simp_all)
  3.4324    from trans [OF pq_ex rl_thm'[OF lq B]] dd
  3.4325    have "?lhs = ((\<exists> j\<in> {1.. ?d}. ?I j ?mq) \<or> (\<exists> (e,c)\<in> set ?B. \<exists> j\<in> {1 .. c*?d}. Ifm (real_of_int i#bs) (\<sigma> ?q c (Add e (C j)))))" by auto
  3.4326 -  also have "\<dots> = ((\<exists> j\<in> {1.. ?d}. ?I j ?smq) \<or> (\<exists> (e,c)\<in> set ?B. ?I i (stage ?q ?d (e,c) )))" 
  3.4327 +  also have "\<dots> = ((\<exists> j\<in> {1.. ?d}. ?I j ?smq) \<or> (\<exists> (e,c)\<in> set ?B. ?I i (stage ?q ?d (e,c) )))"
  3.4328      by (simp add: stage split_def)
  3.4329    also have "\<dots> = ((\<exists> j\<in> {1 .. ?d}. ?I i (subst0 (C j) ?smq))  \<or> ?I i ?qd)"
  3.4330      by (simp add: evaldjf_ex subst0_I[OF qfmq])
  3.4331 -  finally have mdqd:"?lhs = (?I i ?md \<or> ?I i ?qd)" by (simp only: evaldjf_ex set_upto simpfm) 
  3.4332 +  finally have mdqd:"?lhs = (?I i ?md \<or> ?I i ?qd)" by (simp only: evaldjf_ex set_upto simpfm)
  3.4333    also have "\<dots> = (?I i (disj ?md ?qd))" by simp
  3.4334 -  also have "\<dots> = (Ifm bs (decr (disj ?md ?qd)))" by (simp only: decr [OF mdqdb]) 
  3.4335 -  finally have mdqd2: "?lhs = (Ifm bs (decr (disj ?md ?qd)))" . 
  3.4336 +  also have "\<dots> = (Ifm bs (decr (disj ?md ?qd)))" by (simp only: decr [OF mdqdb])
  3.4337 +  finally have mdqd2: "?lhs = (Ifm bs (decr (disj ?md ?qd)))" .
  3.4338    {assume mdT: "?md = T"
  3.4339      hence cT:"redlove p = T" by (simp add: redlove_def Let_def chooset_def split_def)
  3.4340 -    from mdT have lhs:"?lhs" using mdqd by simp 
  3.4341 +    from mdT have lhs:"?lhs" using mdqd by simp
  3.4342      from mdT have "?rhs" by (simp add: redlove_def chooset_def split_def)
  3.4343      with lhs cT have ?thesis by simp }
  3.4344    moreover
  3.4345 -  {assume mdT: "?md \<noteq> T" hence "redlove p = decr (disj ?md ?qd)" 
  3.4346 +  {assume mdT: "?md \<noteq> T" hence "redlove p = decr (disj ?md ?qd)"
  3.4347        by (simp add: redlove_def chooset_def split_def Let_def)
  3.4348      with mdqd2 decr_qf[OF mdqdb] have ?thesis by simp }
  3.4349    ultimately show ?thesis by blast
  3.4350  qed
  3.4351  
  3.4352 -lemma DJredlove: 
  3.4353 +lemma DJredlove:
  3.4354    assumes qf: "qfree p"
  3.4355    shows "((\<exists> (x::int). Ifm (real_of_int x#bs) p) = (Ifm bs (DJ redlove p))) \<and> qfree (DJ redlove p)"
  3.4356  proof-
  3.4357    from redlove have cqf: "\<forall> p. qfree p \<longrightarrow> qfree (redlove p)" by  blast
  3.4358    from DJ_qf[OF cqf] qf have thqf:"qfree (DJ redlove p)" by blast
  3.4359 -  have "Ifm bs (DJ redlove p) = (\<exists> q\<in> set (disjuncts p). Ifm bs (redlove q))" 
  3.4360 +  have "Ifm bs (DJ redlove p) = (\<exists> q\<in> set (disjuncts p). Ifm bs (redlove q))"
  3.4361       by (simp add: DJ_def evaldjf_ex)
  3.4362 -  also have "\<dots> = (\<exists> q \<in> set(disjuncts p). \<exists> (x::int). Ifm (real_of_int x#bs)  q)" 
  3.4363 +  also have "\<dots> = (\<exists> q \<in> set(disjuncts p). \<exists> (x::int). Ifm (real_of_int x#bs)  q)"
  3.4364      using redlove disjuncts_qf[OF qf] by blast
  3.4365    also have "\<dots> = (\<exists> (x::int). Ifm (real_of_int x#bs) p)" by (induct p rule: disjuncts.induct, auto)
  3.4366    finally show ?thesis using thqf by blast
  3.4367 @@ -5461,13 +5461,13 @@
  3.4368    show "qfree (mircfr p)\<and>(Ifm bs (mircfr p) = Ifm bs (E p))" (is "_ \<and> (?lhs = ?rhs)")
  3.4369    proof-
  3.4370      let ?es = "(And (And (Ge (CN 0 1 (C 0))) (Lt (CN 0 1 (C (- 1))))) (simpfm (exsplit p)))"
  3.4371 -    have "?rhs = (\<exists> (i::int). \<exists> x. Ifm (x#real_of_int i#bs) ?es)" 
  3.4372 +    have "?rhs = (\<exists> (i::int). \<exists> x. Ifm (x#real_of_int i#bs) ?es)"
  3.4373        using splitex[OF qf] by simp
  3.4374      with ferrack01[OF simpfm_qf[OF exsplit_qf[OF qf]]] have th1: "?rhs = (\<exists> (i::int). Ifm (real_of_int i#bs) (ferrack01 (simpfm (exsplit p))))" and qf':"qfree (ferrack01 (simpfm (exsplit p)))" by simp+
  3.4375      with DJcooper[OF qf'] show ?thesis by (simp add: mircfr_def)
  3.4376    qed
  3.4377  qed
  3.4378 -  
  3.4379 +
  3.4380  lemma mirlfr: "\<forall> bs p. qfree p \<longrightarrow> qfree(mirlfr p) \<and> Ifm bs (mirlfr p) = Ifm bs (E p)"
  3.4381  proof(clarsimp simp del: Ifm.simps)
  3.4382    fix bs p
  3.4383 @@ -5475,13 +5475,13 @@
  3.4384    show "qfree (mirlfr p)\<and>(Ifm bs (mirlfr p) = Ifm bs (E p))" (is "_ \<and> (?lhs = ?rhs)")
  3.4385    proof-
  3.4386      let ?es = "(And (And (Ge (CN 0 1 (C 0))) (Lt (CN 0 1 (C (- 1))))) (simpfm (exsplit p)))"
  3.4387 -    have "?rhs = (\<exists> (i::int). \<exists> x. Ifm (x#real_of_int i#bs) ?es)" 
  3.4388 +    have "?rhs = (\<exists> (i::int). \<exists> x. Ifm (x#real_of_int i#bs) ?es)"
  3.4389        using splitex[OF qf] by simp
  3.4390      with ferrack01[OF simpfm_qf[OF exsplit_qf[OF qf]]] have th1: "?rhs = (\<exists> (i::int). Ifm (real_of_int i#bs) (ferrack01 (simpfm (exsplit p))))" and qf':"qfree (ferrack01 (simpfm (exsplit p)))" by simp+
  3.4391      with DJredlove[OF qf'] show ?thesis by (simp add: mirlfr_def)
  3.4392    qed
  3.4393  qed
  3.4394 -  
  3.4395 +
  3.4396  definition mircfrqe:: "fm \<Rightarrow> fm" where
  3.4397    "mircfrqe p = qelim (prep p) mircfr"
  3.4398  
  3.4399 @@ -5566,7 +5566,7 @@
  3.4400    | fm_of_term vs (@{term "op \<le> :: real \<Rightarrow> real \<Rightarrow> bool"} $ t1 $ t2) =
  3.4401        @{code Le} (@{code Sub} (num_of_term vs t1, num_of_term vs t2))
  3.4402    | fm_of_term vs (@{term "op = :: real \<Rightarrow> real \<Rightarrow> bool"} $ t1 $ t2) =
  3.4403 -      @{code Eq} (@{code Sub} (num_of_term vs t1, num_of_term vs t2)) 
  3.4404 +      @{code Eq} (@{code Sub} (num_of_term vs t1, num_of_term vs t2))
  3.4405    | fm_of_term vs (@{term "op rdvd"} $ (@{term "of_int :: int \<Rightarrow> real"} $ (@{term "numeral :: _ \<Rightarrow> int"} $ t1)) $ t2) =
  3.4406        mk_Dvd (HOLogic.dest_num t1, num_of_term vs t2)
  3.4407    | fm_of_term vs (@{term "op rdvd"} $ (@{term "of_int :: int \<Rightarrow> real"} $ (@{term "- numeral :: _ \<Rightarrow> int"} $ t1)) $ t2) =
  3.4408 @@ -5606,7 +5606,7 @@
  3.4409    | term_of_num vs (@{code CN} (n, i, t)) = term_of_num vs (@{code Add} (@{code Mul} (i, @{code Bound} n), t))
  3.4410    | term_of_num vs (@{code CF} (c, t, s)) = term_of_num vs (@{code Add} (@{code Mul} (c, @{code Floor} t), s));
  3.4411  
  3.4412 -fun term_of_fm vs @{code T} = @{term True} 
  3.4413 +fun term_of_fm vs @{code T} = @{term True}
  3.4414    | term_of_fm vs @{code F} = @{term False}
  3.4415    | term_of_fm vs (@{code Lt} t) =
  3.4416        @{term "op < :: real \<Rightarrow> real \<Rightarrow> bool"} $ term_of_num vs t $ @{term "0::real"}
  3.4417 @@ -5637,7 +5637,7 @@
  3.4418  
  3.4419  in
  3.4420    fn (ctxt, t) =>
  3.4421 -  let 
  3.4422 +  let
  3.4423      val fs = Misc_Legacy.term_frees t;
  3.4424      val vs = map_index swap fs;
  3.4425      (*If quick_and_dirty then run without proof generation as oracle*)
  3.4426 @@ -5647,8 +5647,8 @@
  3.4427  end;
  3.4428  \<close>
  3.4429  
  3.4430 -lemmas iff_real_of_int = of_int_eq_iff [where 'a = real, symmetric] 
  3.4431 -                         of_int_less_iff [where 'a = real, symmetric] 
  3.4432 +lemmas iff_real_of_int = of_int_eq_iff [where 'a = real, symmetric]
  3.4433 +                         of_int_less_iff [where 'a = real, symmetric]
  3.4434                           of_int_le_iff [where 'a = real, symmetric]
  3.4435  
  3.4436  ML_file "mir_tac.ML"
  3.4437 @@ -5665,7 +5665,7 @@
  3.4438    by mir
  3.4439  
  3.4440  lemma "\<forall>x::real. 2*\<lfloor>x\<rfloor> \<le> \<lfloor>2*x\<rfloor> \<and> \<lfloor>2*x\<rfloor> \<le> 2*\<lfloor>x+1\<rfloor>"
  3.4441 -  by mir 
  3.4442 +  by mir
  3.4443  
  3.4444  lemma "\<forall>x::real. \<exists>y \<le> x. (\<lfloor>x\<rfloor> = \<lceil>y\<rceil>)"
  3.4445    by mir
     4.1 --- a/src/HOL/Decision_Procs/cooper_tac.ML	Tue Nov 17 12:01:19 2015 +0100
     4.2 +++ b/src/HOL/Decision_Procs/cooper_tac.ML	Tue Nov 17 12:32:08 2015 +0000
     4.3 @@ -61,8 +61,8 @@
     4.4      (* Simp rules for changing (n::int) to int n *)
     4.5      val simpset1 =
     4.6        put_simpset HOL_basic_ss ctxt
     4.7 -      addsimps @{thms zdvd_int} @
     4.8 -        map (fn r => r RS sym) @{thms int_numeral int_int_eq zle_int zless_int zadd_int zmult_int}
     4.9 +      addsimps @{thms zdvd_int} @ [@{thm "of_nat_add"}, @{thm "of_nat_mult"}] @
    4.10 +        map (fn r => r RS sym) @{thms int_numeral int_int_eq zle_int zless_int}
    4.11        |> Splitter.add_split @{thm zdiff_int_split}
    4.12      (*simp rules for elimination of int n*)
    4.13  
     5.1 --- a/src/HOL/Decision_Procs/mir_tac.ML	Tue Nov 17 12:01:19 2015 +0100
     5.2 +++ b/src/HOL/Decision_Procs/mir_tac.ML	Tue Nov 17 12:32:08 2015 +0000
     5.3 @@ -19,7 +19,7 @@
     5.4  
     5.5    val comp_arith = [@{thm "Let_def"}, @{thm "if_False"}, @{thm "if_True"}, @{thm "add_0"},
     5.6                   @{thm "add_Suc"}, @{thm add_numeral_left}, @{thm mult_numeral_left(1)}] @
     5.7 -                 (map (fn th => th RS sym) [@{thm "numeral_1_eq_1"}])
     5.8 +                 (map (fn th => th RS sym) [@{thm "numeral_One"}])
     5.9                   @ @{thms arith_simps} @ nat_arith @ @{thms rel_simps} 
    5.10    val ths = [@{thm "mult_numeral_1"}, @{thm "mult_numeral_1_right"}, 
    5.11               @{thm of_nat_numeral},
    5.12 @@ -87,9 +87,8 @@
    5.13              @{thm "split_min"}, @{thm "split_max"}]
    5.14      (* Simp rules for changing (n::int) to int n *)
    5.15      val simpset1 = put_simpset HOL_basic_ss ctxt
    5.16 -      addsimps [@{thm "zdvd_int"}] @ map (fn r => r RS sym)
    5.17 -        [@{thm "int_int_eq"}, @{thm "zle_int"}, @{thm "zless_int"}, @{thm "zadd_int"}, 
    5.18 -         @{thm nat_numeral}, @{thm "zmult_int"}]
    5.19 +      addsimps [@{thm "zdvd_int"}, @{thm "of_nat_add"}, @{thm "of_nat_mult"}] @ 
    5.20 +          map (fn r => r RS sym) [@{thm "int_int_eq"}, @{thm "zle_int"}, @{thm "zless_int"}, @{thm nat_numeral}]
    5.21        |> Splitter.add_split @{thm "zdiff_int_split"}
    5.22      (*simp rules for elimination of int n*)
    5.23  
     6.1 --- a/src/HOL/Inequalities.thy	Tue Nov 17 12:01:19 2015 +0100
     6.2 +++ b/src/HOL/Inequalities.thy	Tue Nov 17 12:32:08 2015 +0000
     6.3 @@ -34,7 +34,7 @@
     6.4      by (auto simp: Setsum_Icc_int[transferred, OF assms] zdiv_int int_mult simp del: of_nat_setsum
     6.5            split: zdiff_int_split)
     6.6    thus ?thesis
     6.7 -    using int_int_eq by blast
     6.8 +    using of_nat_eq_iff by blast
     6.9  qed
    6.10  
    6.11  lemma Setsum_Ico_nat: assumes "(m::nat) \<le> n"
     7.1 --- a/src/HOL/Int.thy	Tue Nov 17 12:01:19 2015 +0100
     7.2 +++ b/src/HOL/Int.thy	Tue Nov 17 12:32:08 2015 +0000
     7.3 @@ -524,9 +524,6 @@
     7.4  lemma zadd_int_left: "int m + (int n + z) = int (m + n) + z"
     7.5  by simp
     7.6  
     7.7 -lemma int_Suc0_eq_1: "int (Suc 0) = 1"
     7.8 -by simp
     7.9 -
    7.10  text\<open>This version is proved for all ordered rings, not just integers!
    7.11        It is proved here because attribute @{text arith_split} is not available
    7.12        in theory @{text Rings}.
    7.13 @@ -843,7 +840,6 @@
    7.14  
    7.15  lemmas zle_int = of_nat_le_iff [where 'a=int]
    7.16  lemmas int_int_eq = of_nat_eq_iff [where 'a=int]
    7.17 -lemmas numeral_1_eq_1 = numeral_One
    7.18  
    7.19  subsection \<open>Setting up simplification procedures\<close>
    7.20  
    7.21 @@ -1678,7 +1674,6 @@
    7.22  lemmas inj_int = inj_of_nat [where 'a=int]
    7.23  lemmas zadd_int = of_nat_add [where 'a=int, symmetric]
    7.24  lemmas int_mult = of_nat_mult [where 'a=int]
    7.25 -lemmas zmult_int = of_nat_mult [where 'a=int, symmetric]
    7.26  lemmas int_eq_0_conv = of_nat_eq_0_iff [where 'a=int and m="n"] for n
    7.27  lemmas zless_int = of_nat_less_iff [where 'a=int]
    7.28  lemmas int_less_0_conv = of_nat_less_0_iff [where 'a=int and m="k"] for k
     8.1 --- a/src/HOL/Library/Convex.thy	Tue Nov 17 12:01:19 2015 +0100
     8.2 +++ b/src/HOL/Library/Convex.thy	Tue Nov 17 12:32:08 2015 +0000
     8.3 @@ -884,19 +884,19 @@
     8.4    assume t: "t > 0" "t < 1" and xy: "x \<in> A" "y \<in> A" "x < y"
     8.5    def z \<equiv> "(1 - t) * x + t * y"
     8.6    with \<open>connected A\<close> and xy have ivl: "{x..y} \<subseteq> A" using connected_contains_Icc by blast
     8.7 -  
     8.8 +
     8.9    from xy t have xz: "z > x" by (simp add: z_def algebra_simps)
    8.10    have "y - z = (1 - t) * (y - x)" by (simp add: z_def algebra_simps)
    8.11    also from xy t have "... > 0" by (intro mult_pos_pos) simp_all
    8.12    finally have yz: "z < y" by simp
    8.13 -    
    8.14 +
    8.15    from assms xz yz ivl t have "\<exists>\<xi>. \<xi> > x \<and> \<xi> < z \<and> f z - f x = (z - x) * f' \<xi>"
    8.16      by (intro MVT2) (auto intro!: assms(2))
    8.17    then obtain \<xi> where \<xi>: "\<xi> > x" "\<xi> < z" "f' \<xi> = (f z - f x) / (z - x)" by auto
    8.18    from assms xz yz ivl t have "\<exists>\<eta>. \<eta> > z \<and> \<eta> < y \<and> f y - f z = (y - z) * f' \<eta>"
    8.19      by (intro MVT2) (auto intro!: assms(2))
    8.20    then obtain \<eta> where \<eta>: "\<eta> > z" "\<eta> < y" "f' \<eta> = (f y - f z) / (y - z)" by auto
    8.21 -  
    8.22 +
    8.23    from \<eta>(3) have "(f y - f z) / (y - z) = f' \<eta>" ..
    8.24    also from \<xi> \<eta> ivl have "\<xi> \<in> A" "\<eta> \<in> A" by auto
    8.25    with \<xi> \<eta> have "f' \<eta> \<ge> f' \<xi>" by (intro assms(3)) auto
    8.26 @@ -926,11 +926,11 @@
    8.27  proof (cases y x rule: linorder_cases)
    8.28    assume less: "x < y"
    8.29    hence d: "d > 0" by (simp add: d_def)
    8.30 -  from assms(2) less have A: "0 \<le> (c - x) / d" "(c - x) / d \<le> 1" 
    8.31 +  from assms(2) less have A: "0 \<le> (c - x) / d" "(c - x) / d \<le> 1"
    8.32      by (simp_all add: d_def divide_simps)
    8.33    have "f c = f (x + (c - x) * 1)" by simp
    8.34    also from less have "1 = ((y - x) / d)" by (simp add: d_def)
    8.35 -  also from d have "x + (c - x) * \<dots> = (1 - (c - x) / d) *\<^sub>R x + ((c - x) / d) *\<^sub>R y" 
    8.36 +  also from d have "x + (c - x) * \<dots> = (1 - (c - x) / d) *\<^sub>R x + ((c - x) / d) *\<^sub>R y"
    8.37      by (simp add: field_simps)
    8.38    also have "f \<dots> \<le> (1 - (c - x) / d) * f x + (c - x) / d * f y" using assms less
    8.39      by (intro convex_onD_Icc) simp_all
    8.40 @@ -945,11 +945,11 @@
    8.41  proof (cases y x rule: linorder_cases)
    8.42    assume less: "x < y"
    8.43    hence d: "d > 0" by (simp add: d_def)
    8.44 -  from assms(2) less have A: "0 \<le> (y - c) / d" "(y - c) / d \<le> 1" 
    8.45 +  from assms(2) less have A: "0 \<le> (y - c) / d" "(y - c) / d \<le> 1"
    8.46      by (simp_all add: d_def divide_simps)
    8.47    have "f c = f (y - (y - c) * 1)" by simp
    8.48    also from less have "1 = ((y - x) / d)" by (simp add: d_def)
    8.49 -  also from d have "y - (y - c) * \<dots> = (1 - (1 - (y - c) / d)) *\<^sub>R x + (1 - (y - c) / d) *\<^sub>R y" 
    8.50 +  also from d have "y - (y - c) * \<dots> = (1 - (1 - (y - c) / d)) *\<^sub>R x + (1 - (y - c) / d) *\<^sub>R y"
    8.51      by (simp add: field_simps)
    8.52    also have "f \<dots> \<le> (1 - (1 - (y - c) / d)) * f x + (1 - (y - c) / d) * f y" using assms less
    8.53      by (intro convex_onD_Icc) (simp_all add: field_simps)
     9.1 --- a/src/HOL/Limits.thy	Tue Nov 17 12:01:19 2015 +0100
     9.2 +++ b/src/HOL/Limits.thy	Tue Nov 17 12:32:08 2015 +0000
     9.3 @@ -635,6 +635,9 @@
     9.4    shows "continuous_on s f \<Longrightarrow> continuous_on s g \<Longrightarrow> continuous_on s (\<lambda>x. f x - g x)"
     9.5    unfolding continuous_on_def by (auto intro: tendsto_diff)
     9.6  
     9.7 +lemma continuous_on_op_minus: "continuous_on (s::'a::real_normed_vector set) (op - x)"
     9.8 +  by (rule continuous_intros | simp)+
     9.9 +
    9.10  lemma tendsto_setsum [tendsto_intros]:
    9.11    fixes f :: "'a \<Rightarrow> 'b \<Rightarrow> 'c::real_normed_vector"
    9.12    assumes "\<And>i. i \<in> S \<Longrightarrow> (f i ---> a i) F"
    10.1 --- a/src/HOL/Matrix_LP/ComputeNumeral.thy	Tue Nov 17 12:01:19 2015 +0100
    10.2 +++ b/src/HOL/Matrix_LP/ComputeNumeral.thy	Tue Nov 17 12:32:08 2015 +0000
    10.3 @@ -28,11 +28,11 @@
    10.4  lemmas compute_natarith =
    10.5    arith_simps rel_simps
    10.6    diff_nat_numeral nat_numeral nat_0 nat_neg_numeral
    10.7 -  numeral_1_eq_1 [symmetric]
    10.8 +  numeral_One [symmetric]
    10.9    numeral_1_eq_Suc_0 [symmetric]
   10.10    Suc_numeral natfac.simps
   10.11  
   10.12 -lemmas number_norm = numeral_1_eq_1[symmetric]
   10.13 +lemmas number_norm = numeral_One[symmetric]
   10.14  
   10.15  lemmas compute_numberarith =
   10.16    arith_simps rel_simps number_norm
    11.1 --- a/src/HOL/Multivariate_Analysis/Cauchy_Integral_Thm.thy	Tue Nov 17 12:01:19 2015 +0100
    11.2 +++ b/src/HOL/Multivariate_Analysis/Cauchy_Integral_Thm.thy	Tue Nov 17 12:32:08 2015 +0000
    11.3 @@ -3997,7 +3997,7 @@
    11.4          apply (rule power_strict_mono)
    11.5          using `pe>0` by auto
    11.6        then have pe2: "pe^2 < 4 * cmod (w - x) ^ 2"
    11.7 -        by auto
    11.8 +        by (simp add: power_divide)
    11.9        have "8 * L * cmod (w - z) < e * pe\<^sup>2"
   11.10          using w `L>0` by (simp add: field_simps)
   11.11        also have "... < e * 4 * cmod (w - x) * cmod (w - x)"
    12.1 --- a/src/HOL/Multivariate_Analysis/Complex_Transcendental.thy	Tue Nov 17 12:01:19 2015 +0100
    12.2 +++ b/src/HOL/Multivariate_Analysis/Complex_Transcendental.thy	Tue Nov 17 12:32:08 2015 +0000
    12.3 @@ -400,7 +400,7 @@
    12.4      "norm(cos z) ^ 2 = cos(Re z) ^ 2 + (exp(Im z) - inverse(exp(Im z))) ^ 2 / 4"
    12.5    apply (cases z)
    12.6    apply (simp add: cos_add cmod_power2 cos_of_real sin_of_real)
    12.7 -  apply (simp add: cos_exp_eq sin_exp_eq exp_minus exp_of_real Re_divide Im_divide)
    12.8 +  apply (simp add: cos_exp_eq sin_exp_eq exp_minus exp_of_real Re_divide Im_divide power_divide)
    12.9    apply (simp only: left_diff_distrib [symmetric] power_mult_distrib)
   12.10    apply (simp add: sin_squared_eq)
   12.11    apply (simp add: power2_eq_square algebra_simps divide_simps)
   12.12 @@ -410,7 +410,7 @@
   12.13      "norm(sin z) ^ 2 = (exp(2 * Im z) + inverse(exp(2 * Im z)) - 2 * cos(2 * Re z)) / 4"
   12.14    apply (cases z)
   12.15    apply (simp add: sin_add cmod_power2 cos_of_real sin_of_real cos_double_cos exp_double)
   12.16 -  apply (simp add: cos_exp_eq sin_exp_eq exp_minus exp_of_real Re_divide Im_divide)
   12.17 +  apply (simp add: cos_exp_eq sin_exp_eq exp_minus exp_of_real Re_divide Im_divide power_divide)
   12.18    apply (simp only: left_diff_distrib [symmetric] power_mult_distrib)
   12.19    apply (simp add: cos_squared_eq)
   12.20    apply (simp add: power2_eq_square algebra_simps divide_simps)
   12.21 @@ -2140,7 +2140,7 @@
   12.22        shows "Arcsin(sin z) = z"
   12.23  proof -
   12.24    have "Arcsin(sin z) = - (\<i> * Ln (csqrt (1 - (\<i> * (exp (\<i>*z) - inverse (exp (\<i>*z))))\<^sup>2 / 4) - (inverse (exp (\<i>*z)) - exp (\<i>*z)) / 2))"
   12.25 -    by (simp add: sin_exp_eq Arcsin_def exp_minus)
   12.26 +    by (simp add: sin_exp_eq Arcsin_def exp_minus power_divide)
   12.27    also have "... = - (\<i> * Ln (csqrt (((exp (\<i>*z) + inverse (exp (\<i>*z)))/2)\<^sup>2) - (inverse (exp (\<i>*z)) - exp (\<i>*z)) / 2))"
   12.28      by (simp add: field_simps power2_eq_square)
   12.29    also have "... = - (\<i> * Ln (((exp (\<i>*z) + inverse (exp (\<i>*z)))/2) - (inverse (exp (\<i>*z)) - exp (\<i>*z)) / 2))"
   12.30 @@ -2308,7 +2308,7 @@
   12.31      by (simp add: field_simps power2_eq_square)
   12.32    then have "Arccos(cos z) = - (\<i> * Ln ((exp (\<i> * z) + inverse (exp (\<i> * z))) / 2 +
   12.33                             \<i> * csqrt (((\<i> - (exp (\<i> * z))\<^sup>2 * \<i>) / (2 * exp (\<i> * z)))\<^sup>2)))"
   12.34 -    by (simp add: cos_exp_eq Arccos_def exp_minus)
   12.35 +    by (simp add: cos_exp_eq Arccos_def exp_minus power_divide)
   12.36    also have "... = - (\<i> * Ln ((exp (\<i> * z) + inverse (exp (\<i> * z))) / 2 +
   12.37                                \<i> * ((\<i> - (exp (\<i> * z))\<^sup>2 * \<i>) / (2 * exp (\<i> * z)))))"
   12.38      apply (subst csqrt_square)
    13.1 --- a/src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy	Tue Nov 17 12:01:19 2015 +0100
    13.2 +++ b/src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy	Tue Nov 17 12:32:08 2015 +0000
    13.3 @@ -130,6 +130,10 @@
    13.4  lemma setsum_not_0: "setsum f A \<noteq> 0 \<Longrightarrow> \<exists>a \<in> A. f a \<noteq> 0"
    13.5    by (rule ccontr) auto
    13.6  
    13.7 +lemma subset_translation_eq [simp]:
    13.8 +    fixes a :: "'a::real_vector" shows "op + a ` s \<subseteq> op + a ` t \<longleftrightarrow> s \<subseteq> t"
    13.9 +  by auto
   13.10 +
   13.11  lemma translate_inj_on:
   13.12    fixes A :: "'a::ab_group_add set"
   13.13    shows "inj_on (\<lambda>x. a + x) A"
   13.14 @@ -160,6 +164,9 @@
   13.15    apply auto
   13.16    done
   13.17  
   13.18 +lemma convex_translation_eq [simp]: "convex ((\<lambda>x. a + x) ` s) \<longleftrightarrow> convex s"
   13.19 +  by (metis convex_translation translation_galois)
   13.20 +
   13.21  lemma translation_inverse_subset:
   13.22    assumes "((\<lambda>x. - a + x) ` V) \<le> (S :: 'n::ab_group_add set)"
   13.23    shows "V \<le> ((\<lambda>x. a + x) ` S)"
   13.24 @@ -178,6 +185,11 @@
   13.25    then show ?thesis by auto
   13.26  qed
   13.27  
   13.28 +lemma convex_linear_image_eq [simp]:
   13.29 +    fixes f :: "'a::real_vector \<Rightarrow> 'b::real_vector"
   13.30 +    shows "\<lbrakk>linear f; inj f\<rbrakk> \<Longrightarrow> convex (f ` s) \<longleftrightarrow> convex s"
   13.31 +    by (metis (no_types) convex_linear_image convex_linear_vimage inj_vimage_image_eq)
   13.32 +
   13.33  lemma basis_to_basis_subspace_isomorphism:
   13.34    assumes s: "subspace (S:: ('n::euclidean_space) set)"
   13.35      and t: "subspace (T :: ('m::euclidean_space) set)"
   13.36 @@ -7254,7 +7266,7 @@
   13.37      using subset_rel_interior[of "convex hull insert 0 B" S] ** by auto
   13.38  qed
   13.39  
   13.40 -lemma rel_interior_convex_nonempty:
   13.41 +lemma rel_interior_eq_empty:
   13.42    fixes S :: "'n::euclidean_space set"
   13.43    assumes "convex S"
   13.44    shows "rel_interior S = {} \<longleftrightarrow> S = {}"
   13.45 @@ -7313,7 +7325,7 @@
   13.46    proof (cases "S = {}")
   13.47      case False
   13.48      then obtain a where a: "a \<in> rel_interior S"
   13.49 -      using rel_interior_convex_nonempty assms by auto
   13.50 +      using rel_interior_eq_empty assms by auto
   13.51      { fix x
   13.52        assume x: "x \<in> closure S"
   13.53        {
   13.54 @@ -7421,7 +7433,7 @@
   13.55  proof (cases "S = {}")
   13.56    case True
   13.57    then show ?thesis
   13.58 -    using assms rel_interior_convex_nonempty by auto
   13.59 +    using assms rel_interior_eq_empty by auto
   13.60  next
   13.61    case False
   13.62    have "rel_interior (closure S) \<supseteq> rel_interior S"
   13.63 @@ -7432,7 +7444,7 @@
   13.64      fix z
   13.65      assume z: "z \<in> rel_interior (closure S)"
   13.66      obtain x where x: "x \<in> rel_interior S"
   13.67 -      using \<open>S \<noteq> {}\<close> assms rel_interior_convex_nonempty by auto
   13.68 +      using \<open>S \<noteq> {}\<close> assms rel_interior_eq_empty by auto
   13.69      have "z \<in> rel_interior S"
   13.70      proof (cases "x = z")
   13.71        case True
   13.72 @@ -7566,7 +7578,7 @@
   13.73         apply auto
   13.74         done
   13.75      obtain a where a: "a \<in> rel_interior S1"
   13.76 -      using \<open>S1 \<noteq> {}\<close> rel_interior_convex_nonempty assms by auto
   13.77 +      using \<open>S1 \<noteq> {}\<close> rel_interior_eq_empty assms by auto
   13.78      obtain T where T: "open T" "a \<in> T \<inter> S1" "T \<inter> affine hull S1 \<subseteq> S1"
   13.79         using mem_rel_interior[of a S1] a by auto
   13.80      then have "a \<in> T \<inter> closure S2"
   13.81 @@ -7668,7 +7680,7 @@
   13.82    shows "z \<in> rel_interior S"
   13.83  proof -
   13.84    obtain x where x: "x \<in> rel_interior S"
   13.85 -    using rel_interior_convex_nonempty assms by auto
   13.86 +    using rel_interior_eq_empty assms by auto
   13.87    then have "x \<in> S"
   13.88      using rel_interior_subset by auto
   13.89    then obtain e where e: "e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S"
   13.90 @@ -8085,7 +8097,7 @@
   13.91  proof (cases "S = {}")
   13.92    case True
   13.93    then show ?thesis
   13.94 -    using assms rel_interior_empty rel_interior_convex_nonempty by auto
   13.95 +    using assms rel_interior_empty rel_interior_eq_empty by auto
   13.96  next
   13.97    case False
   13.98    have *: "f ` (rel_interior S) \<subseteq> f ` S"
   13.99 @@ -8219,7 +8231,7 @@
  13.100    {
  13.101      assume "S \<noteq> {}" "T \<noteq> {}"
  13.102      then have ri: "rel_interior S \<noteq> {}" "rel_interior T \<noteq> {}"
  13.103 -      using rel_interior_convex_nonempty assms by auto
  13.104 +      using rel_interior_eq_empty assms by auto
  13.105      then have "fst -` rel_interior S \<noteq> {}"
  13.106        using fst_vimage_eq_Times[of "rel_interior S"] by auto
  13.107      then have "rel_interior ((fst :: 'n * 'm \<Rightarrow> 'n) -` S) = fst -` rel_interior S"
    14.1 --- a/src/HOL/Multivariate_Analysis/Ordered_Euclidean_Space.thy	Tue Nov 17 12:01:19 2015 +0100
    14.2 +++ b/src/HOL/Multivariate_Analysis/Ordered_Euclidean_Space.thy	Tue Nov 17 12:32:08 2015 +0000
    14.3 @@ -211,15 +211,6 @@
    14.4    using convex_box[of a b]
    14.5    by (metis interval_cbox)
    14.6  
    14.7 -lemma image_affinity_interval: fixes m::real
    14.8 -  fixes a b c :: "'a::ordered_euclidean_space"
    14.9 -  shows "(\<lambda>x. m *\<^sub>R x + c) ` {a..b} =
   14.10 -    (if {a..b} = {} then {}
   14.11 -     else (if 0 \<le> m then {m *\<^sub>R a + c .. m *\<^sub>R b + c}
   14.12 -     else {m *\<^sub>R b + c .. m *\<^sub>R a + c}))"
   14.13 -  using image_affinity_cbox[of m c a b]
   14.14 -  by (simp add: cbox_interval)
   14.15 -
   14.16  lemma image_smult_interval:"(\<lambda>x. m *\<^sub>R (x::_::ordered_euclidean_space)) ` {a .. b} =
   14.17    (if {a .. b} = {} then {} else if 0 \<le> m then {m *\<^sub>R a .. m *\<^sub>R b} else {m *\<^sub>R b .. m *\<^sub>R a})"
   14.18    using image_smult_cbox[of m a b]
    15.1 --- a/src/HOL/Multivariate_Analysis/Path_Connected.thy	Tue Nov 17 12:01:19 2015 +0100
    15.2 +++ b/src/HOL/Multivariate_Analysis/Path_Connected.thy	Tue Nov 17 12:32:08 2015 +0000
    15.3 @@ -428,9 +428,6 @@
    15.4  lemma path_image_subset_reversepath: "path_image(reversepath g) \<le> path_image g"
    15.5    by (auto simp: path_image_def reversepath_def)
    15.6  
    15.7 -lemma continuous_on_op_minus: "continuous_on (s::real set) (op - x)"
    15.8 -  by (rule continuous_intros | simp)+
    15.9 -
   15.10  lemma path_imp_reversepath: "path g \<Longrightarrow> path(reversepath g)"
   15.11    apply (auto simp: path_def reversepath_def)
   15.12    using continuous_on_compose [of "{0..1}" "\<lambda>x. 1 - x" g]
   15.13 @@ -1141,7 +1138,7 @@
   15.14    unfolding path_connected_def path_component_def by auto
   15.15  
   15.16  lemma path_connected_component_set: "path_connected s \<longleftrightarrow> (\<forall>x\<in>s. path_component_set s x = s)"
   15.17 -  unfolding path_connected_component path_component_subset 
   15.18 +  unfolding path_connected_component path_component_subset
   15.19    using path_component_mem by blast
   15.20  
   15.21  lemma path_component_maximal:
   15.22 @@ -2455,4 +2452,461 @@
   15.23    apply (metis cobounded_unique_unbounded_components connected_outside double_compl outside_bounded_nonempty outside_in_components unbounded_outside)
   15.24    by (simp add: connected_outside outside_bounded_nonempty outside_in_components unbounded_outside)
   15.25  
   15.26 +section\<open> Homotopy of maps p,q : X=>Y with property P of all intermediate maps.\<close>
   15.27 +
   15.28 +text\<open> We often just want to require that it fixes some subset, but to take in
   15.29 +  the case of a loop homotopy, it's convenient to have a general property P.\<close>
   15.30 +
   15.31 +definition homotopic_with ::
   15.32 +  "[('a::topological_space \<Rightarrow> 'b::topological_space) \<Rightarrow> bool, 'a set, 'b set, 'a \<Rightarrow> 'b, 'a \<Rightarrow> 'b] \<Rightarrow> bool"
   15.33 +where
   15.34 + "homotopic_with P X Y p q \<equiv>
   15.35 +   (\<exists>h:: real \<times> 'a \<Rightarrow> 'b.
   15.36 +       continuous_on ({0..1} \<times> X) h \<and>
   15.37 +       h ` ({0..1} \<times> X) \<subseteq> Y \<and>
   15.38 +       (\<forall>x. h(0, x) = p x) \<and>
   15.39 +       (\<forall>x. h(1, x) = q x) \<and>
   15.40 +       (\<forall>t \<in> {0..1}. P(\<lambda>x. h(t, x))))"
   15.41 +
   15.42 +
   15.43 +text\<open> We often want to just localize the ending function equality or whatever.\<close>
   15.44 +proposition homotopic_with:
   15.45 +  fixes X :: "'a::topological_space set" and Y :: "'b::topological_space set"
   15.46 +  assumes "\<And>h k. (\<And>x. x \<in> X \<Longrightarrow> h x = k x) \<Longrightarrow> (P h \<longleftrightarrow> P k)"
   15.47 +  shows "homotopic_with P X Y p q \<longleftrightarrow>
   15.48 +           (\<exists>h :: real \<times> 'a \<Rightarrow> 'b.
   15.49 +              continuous_on ({0..1} \<times> X) h \<and>
   15.50 +              h ` ({0..1} \<times> X) \<subseteq> Y \<and>
   15.51 +              (\<forall>x \<in> X. h(0,x) = p x) \<and>
   15.52 +              (\<forall>x \<in> X. h(1,x) = q x) \<and>
   15.53 +              (\<forall>t \<in> {0..1}. P(\<lambda>x. h(t, x))))"
   15.54 +  unfolding homotopic_with_def
   15.55 +  apply (rule iffI, blast, clarify)
   15.56 +  apply (rule_tac x="\<lambda>(u,v). if v \<in> X then h(u,v) else if u = 0 then p v else q v" in exI)
   15.57 +  apply (auto simp:)
   15.58 +  apply (force elim: continuous_on_eq)
   15.59 +  apply (drule_tac x=t in bspec, force)
   15.60 +  apply (subst assms; simp)
   15.61 +  done
   15.62 +
   15.63 +proposition homotopic_with_eq:
   15.64 +   assumes h: "homotopic_with P X Y f g"
   15.65 +       and f': "\<And>x. x \<in> X \<Longrightarrow> f' x = f x"
   15.66 +       and g': "\<And>x. x \<in> X \<Longrightarrow> g' x = g x"
   15.67 +       and P:  "(\<And>h k. (\<And>x. x \<in> X \<Longrightarrow> h x = k x) \<Longrightarrow> (P h \<longleftrightarrow> P k))"
   15.68 +   shows "homotopic_with P X Y f' g'"
   15.69 +  using h unfolding homotopic_with_def
   15.70 +  apply safe
   15.71 +  apply (rule_tac x="\<lambda>(u,v). if v \<in> X then h(u,v) else if u = 0 then f' v else g' v" in exI)
   15.72 +  apply (simp add: f' g', safe)
   15.73 +  apply (fastforce intro: continuous_on_eq)
   15.74 +  apply fastforce
   15.75 +  apply (subst P; fastforce)
   15.76 +  done
   15.77 +
   15.78 +proposition homotopic_with_equal:
   15.79 +   assumes contf: "continuous_on X f" and fXY: "f ` X \<subseteq> Y"
   15.80 +       and gf: "\<And>x. x \<in> X \<Longrightarrow> g x = f x"
   15.81 +       and P:  "P f" "P g"
   15.82 +   shows "homotopic_with P X Y f g"
   15.83 +  unfolding homotopic_with_def
   15.84 +  apply (rule_tac x="\<lambda>(u,v). if u = 1 then g v else f v" in exI)
   15.85 +  using assms
   15.86 +  apply (intro conjI)
   15.87 +  apply (rule continuous_on_eq [where f = "f o snd"])
   15.88 +  apply (rule continuous_intros | force)+
   15.89 +  apply clarify
   15.90 +  apply (case_tac "t=1"; force)
   15.91 +  done
   15.92 +
   15.93 +
   15.94 +lemma image_Pair_const: "(\<lambda>x. (x, c)) ` A = A \<times> {c}"
   15.95 +  by (auto simp:)
   15.96 +
   15.97 +lemma homotopic_constant_maps:
   15.98 +   "homotopic_with (\<lambda>x. True) s t (\<lambda>x. a) (\<lambda>x. b) \<longleftrightarrow> s = {} \<or> path_component t a b"
   15.99 +proof (cases "s = {} \<or> t = {}")
  15.100 +  case True with continuous_on_const show ?thesis
  15.101 +    by (auto simp: homotopic_with path_component_def)
  15.102 +next
  15.103 +  case False
  15.104 +  then obtain c where "c \<in> s" by blast
  15.105 +  show ?thesis
  15.106 +  proof
  15.107 +    assume "homotopic_with (\<lambda>x. True) s t (\<lambda>x. a) (\<lambda>x. b)"
  15.108 +    then obtain h :: "real \<times> 'a \<Rightarrow> 'b"
  15.109 +        where conth: "continuous_on ({0..1} \<times> s) h"
  15.110 +          and h: "h ` ({0..1} \<times> s) \<subseteq> t" "(\<forall>x\<in>s. h (0, x) = a)" "(\<forall>x\<in>s. h (1, x) = b)"
  15.111 +      by (auto simp: homotopic_with)
  15.112 +    have "continuous_on {0..1} (h \<circ> (\<lambda>t. (t, c)))"
  15.113 +      apply (rule continuous_intros conth | simp add: image_Pair_const)+
  15.114 +      apply (blast intro:  \<open>c \<in> s\<close> continuous_on_subset [OF conth] )
  15.115 +      done
  15.116 +    with \<open>c \<in> s\<close> h show "s = {} \<or> path_component t a b"
  15.117 +      apply (simp_all add: homotopic_with path_component_def)
  15.118 +      apply (auto simp:)
  15.119 +      apply (drule_tac x="h o (\<lambda>t. (t, c))" in spec)
  15.120 +      apply (auto simp: pathstart_def pathfinish_def path_image_def path_def)
  15.121 +      done
  15.122 +  next
  15.123 +    assume "s = {} \<or> path_component t a b"
  15.124 +    with False show "homotopic_with (\<lambda>x. True) s t (\<lambda>x. a) (\<lambda>x. b)"
  15.125 +      apply (clarsimp simp: homotopic_with path_component_def pathstart_def pathfinish_def path_image_def path_def)
  15.126 +      apply (rule_tac x="g o fst" in exI)
  15.127 +      apply (rule conjI continuous_intros | force)+
  15.128 +      done
  15.129 +  qed
  15.130 +qed
  15.131 +
  15.132 +
  15.133 +subsection\<open> Trivial properties.\<close>
  15.134 +
  15.135 +lemma homotopic_with_imp_property: "homotopic_with P X Y f g \<Longrightarrow> P f \<and> P g"
  15.136 +  unfolding homotopic_with_def Ball_def
  15.137 +  apply clarify
  15.138 +  apply (frule_tac x=0 in spec)
  15.139 +  apply (drule_tac x=1 in spec)
  15.140 +  apply (auto simp:)
  15.141 +  done
  15.142 +
  15.143 +lemma continuous_on_o_Pair: "\<lbrakk>continuous_on (T \<times> X) h; t \<in> T\<rbrakk> \<Longrightarrow> continuous_on X (h o Pair t)"
  15.144 +  by (fast intro: continuous_intros elim!: continuous_on_subset)
  15.145 +
  15.146 +lemma homotopic_with_imp_continuous:
  15.147 +    assumes "homotopic_with P X Y f g"
  15.148 +    shows "continuous_on X f \<and> continuous_on X g"
  15.149 +proof -
  15.150 +  obtain h :: "real \<times> 'a \<Rightarrow> 'b"
  15.151 +    where conth: "continuous_on ({0..1} \<times> X) h"
  15.152 +      and h: "\<forall>x. h (0, x) = f x" "\<forall>x. h (1, x) = g x"
  15.153 +    using assms by (auto simp: homotopic_with_def)
  15.154 +  have *: "t \<in> {0..1} \<Longrightarrow> continuous_on X (h o (\<lambda>x. (t,x)))" for t
  15.155 +    by (rule continuous_intros continuous_on_subset [OF conth] | force)+
  15.156 +  show ?thesis
  15.157 +    using h *[of 0] *[of 1] by auto
  15.158 +qed
  15.159 +
  15.160 +proposition homotopic_with_imp_subset1:
  15.161 +     "homotopic_with P X Y f g \<Longrightarrow> f ` X \<subseteq> Y"
  15.162 +  by (simp add: homotopic_with_def image_subset_iff) (metis atLeastAtMost_iff order_refl zero_le_one)
  15.163 +
  15.164 +proposition homotopic_with_imp_subset2:
  15.165 +     "homotopic_with P X Y f g \<Longrightarrow> g ` X \<subseteq> Y"
  15.166 +  by (simp add: homotopic_with_def image_subset_iff) (metis atLeastAtMost_iff order_refl zero_le_one)
  15.167 +
  15.168 +proposition homotopic_with_mono:
  15.169 +    assumes hom: "homotopic_with P X Y f g"
  15.170 +        and Q: "\<And>h. \<lbrakk>continuous_on X h; image h X \<subseteq> Y \<and> P h\<rbrakk> \<Longrightarrow> Q h"
  15.171 +      shows "homotopic_with Q X Y f g"
  15.172 +  using hom
  15.173 +  apply (simp add: homotopic_with_def)
  15.174 +  apply (erule ex_forward)
  15.175 +  apply (force simp: intro!: Q dest: continuous_on_o_Pair)
  15.176 +  done
  15.177 +
  15.178 +proposition homotopic_with_subset_left:
  15.179 +     "\<lbrakk>homotopic_with P X Y f g; Z \<subseteq> X\<rbrakk> \<Longrightarrow> homotopic_with P Z Y f g"
  15.180 +  apply (simp add: homotopic_with_def)
  15.181 +  apply (fast elim!: continuous_on_subset ex_forward)
  15.182 +  done
  15.183 +
  15.184 +proposition homotopic_with_subset_right:
  15.185 +     "\<lbrakk>homotopic_with P X Y f g; Y \<subseteq> Z\<rbrakk> \<Longrightarrow> homotopic_with P X Z f g"
  15.186 +  apply (simp add: homotopic_with_def)
  15.187 +  apply (fast elim!: continuous_on_subset ex_forward)
  15.188 +  done
  15.189 +
  15.190 +proposition homotopic_with_compose_continuous_right:
  15.191 +    "\<lbrakk>homotopic_with (\<lambda>f. p (f \<circ> h)) X Y f g; continuous_on W h; h ` W \<subseteq> X\<rbrakk>
  15.192 +     \<Longrightarrow> homotopic_with p W Y (f o h) (g o h)"
  15.193 +  apply (clarsimp simp add: homotopic_with_def)
  15.194 +  apply (rename_tac k)
  15.195 +  apply (rule_tac x="k o (\<lambda>y. (fst y, h (snd y)))" in exI)
  15.196 +  apply (rule conjI continuous_intros continuous_on_compose [where f=snd and g=h, unfolded o_def] | simp)+
  15.197 +  apply (erule continuous_on_subset)
  15.198 +  apply (fastforce simp: o_def)+
  15.199 +  done
  15.200 +
  15.201 +proposition homotopic_compose_continuous_right:
  15.202 +     "\<lbrakk>homotopic_with (\<lambda>f. True) X Y f g; continuous_on W h; h ` W \<subseteq> X\<rbrakk>
  15.203 +      \<Longrightarrow> homotopic_with (\<lambda>f. True) W Y (f o h) (g o h)"
  15.204 +  using homotopic_with_compose_continuous_right by fastforce
  15.205 +
  15.206 +proposition homotopic_with_compose_continuous_left:
  15.207 +     "\<lbrakk>homotopic_with (\<lambda>f. p (h \<circ> f)) X Y f g; continuous_on Y h; h ` Y \<subseteq> Z\<rbrakk>
  15.208 +      \<Longrightarrow> homotopic_with p X Z (h o f) (h o g)"
  15.209 +  apply (clarsimp simp add: homotopic_with_def)
  15.210 +  apply (rename_tac k)
  15.211 +  apply (rule_tac x="h o k" in exI)
  15.212 +  apply (rule conjI continuous_intros continuous_on_compose [where f=snd and g=h, unfolded o_def] | simp)+
  15.213 +  apply (erule continuous_on_subset)
  15.214 +  apply (fastforce simp: o_def)+
  15.215 +  done
  15.216 +
  15.217 +proposition homotopic_compose_continuous_left:
  15.218 +   "homotopic_with (\<lambda>f. True) X Y f g \<and>
  15.219 +        continuous_on Y h \<and> image h Y \<subseteq> Z
  15.220 +        \<Longrightarrow> homotopic_with (\<lambda>f. True) X Z (h o f) (h o g)"
  15.221 +  using homotopic_with_compose_continuous_left by fastforce
  15.222 +
  15.223 +proposition homotopic_with_Pair:
  15.224 +   assumes hom: "homotopic_with p s t f g" "homotopic_with p' s' t' f' g'"
  15.225 +       and q: "\<And>f g. \<lbrakk>p f; p' g\<rbrakk> \<Longrightarrow> q(\<lambda>(x,y). (f x, g y))"
  15.226 +     shows "homotopic_with q (s \<times> s') (t \<times> t')
  15.227 +                  (\<lambda>(x,y). (f x, f' y)) (\<lambda>(x,y). (g x, g' y))"
  15.228 +  using hom
  15.229 +  apply (clarsimp simp add: homotopic_with_def)
  15.230 +  apply (rename_tac k k')
  15.231 +  apply (rule_tac x="\<lambda>z. ((k o (\<lambda>x. (fst x, fst (snd x)))) z, (k' o (\<lambda>x. (fst x, snd (snd x)))) z)" in exI)
  15.232 +  apply (rule conjI continuous_intros | erule continuous_on_subset | clarsimp)+
  15.233 +  apply (auto intro!: q [unfolded case_prod_unfold])
  15.234 +  done
  15.235 +
  15.236 +lemma homotopic_on_empty: "homotopic_with (\<lambda>x. True) {} t f g"
  15.237 +  by (metis continuous_on_def empty_iff homotopic_with_equal image_subset_iff)
  15.238 +
  15.239 +
  15.240 +text\<open>Homotopy with P is an equivalence relation (on continuous functions mapping X into Y that satisfy P,
  15.241 +     though this only affects reflexivity.\<close>
  15.242 +
  15.243 +
  15.244 +proposition homotopic_with_refl:
  15.245 +   "homotopic_with P X Y f f \<longleftrightarrow> continuous_on X f \<and> image f X \<subseteq> Y \<and> P f"
  15.246 +  apply (rule iffI)
  15.247 +  using homotopic_with_imp_continuous homotopic_with_imp_property homotopic_with_imp_subset2 apply blast
  15.248 +  apply (simp add: homotopic_with_def)
  15.249 +  apply (rule_tac x="f o snd" in exI)
  15.250 +  apply (rule conjI continuous_intros | force)+
  15.251 +  done
  15.252 +
  15.253 +lemma homotopic_with_symD:
  15.254 +  fixes X :: "'a::real_normed_vector set"
  15.255 +    assumes "homotopic_with P X Y f g"
  15.256 +      shows "homotopic_with P X Y g f"
  15.257 +  using assms
  15.258 +  apply (clarsimp simp add: homotopic_with_def)
  15.259 +  apply (rename_tac h)
  15.260 +  apply (rule_tac x="h o (\<lambda>y. (1 - fst y, snd y))" in exI)
  15.261 +  apply (rule conjI continuous_intros | erule continuous_on_subset | force simp add: image_subset_iff)+
  15.262 +  done
  15.263 +
  15.264 +proposition homotopic_with_sym:
  15.265 +    fixes X :: "'a::real_normed_vector set"
  15.266 +    shows "homotopic_with P X Y f g \<longleftrightarrow> homotopic_with P X Y g f"
  15.267 +  using homotopic_with_symD by blast
  15.268 +
  15.269 +lemma split_01_prod: "{0..1::real} \<times> X = ({0..1/2} \<times> X) \<union> ({1/2..1} \<times> X)"
  15.270 +  by force
  15.271 +
  15.272 +proposition homotopic_with_trans:
  15.273 +    fixes X :: "'a::real_normed_vector set"
  15.274 +    assumes "homotopic_with P X Y f g" and "homotopic_with P X Y g h"
  15.275 +      shows "homotopic_with P X Y f h"
  15.276 +proof -
  15.277 +  have clo1: "closedin (subtopology euclidean ({0..1/2} \<times> X \<union> {1/2..1} \<times> X)) ({0..1/2::real} \<times> X)"
  15.278 +    apply (simp add: closedin_closed split_01_prod [symmetric])
  15.279 +    apply (rule_tac x="{0..1/2} \<times> UNIV" in exI)
  15.280 +    apply (force simp add: closed_Times)
  15.281 +    done
  15.282 +  have clo2: "closedin (subtopology euclidean ({0..1/2} \<times> X \<union> {1/2..1} \<times> X)) ({1/2..1::real} \<times> X)"
  15.283 +    apply (simp add: closedin_closed split_01_prod [symmetric])
  15.284 +    apply (rule_tac x="{1/2..1} \<times> UNIV" in exI)
  15.285 +    apply (force simp add: closed_Times)
  15.286 +    done
  15.287 +  { fix k1 k2:: "real \<times> 'a \<Rightarrow> 'b"
  15.288 +    assume cont: "continuous_on ({0..1} \<times> X) k1" "continuous_on ({0..1} \<times> X) k2"
  15.289 +       and Y: "k1 ` ({0..1} \<times> X) \<subseteq> Y" "k2 ` ({0..1} \<times> X) \<subseteq> Y"
  15.290 +       and geq: "\<forall>x. k1 (1, x) = g x" "\<forall>x. k2 (0, x) = g x"
  15.291 +       and k12: "\<forall>x. k1 (0, x) = f x" "\<forall>x. k2 (1, x) = h x"
  15.292 +       and P:   "\<forall>t\<in>{0..1}. P (\<lambda>x. k1 (t, x))" "\<forall>t\<in>{0..1}. P (\<lambda>x. k2 (t, x))"
  15.293 +    def k \<equiv> "\<lambda>y. if fst y \<le> 1 / 2 then (k1 o (\<lambda>x. (2 *\<^sub>R fst x, snd x))) y
  15.294 +                                   else (k2 o (\<lambda>x. (2 *\<^sub>R fst x -1, snd x))) y"
  15.295 +    have keq: "k1 (2 * u, v) = k2 (2 * u - 1, v)" if "u = 1/2"  for u v
  15.296 +      by (simp add: geq that)
  15.297 +    have "continuous_on ({0..1} \<times> X) k"
  15.298 +      using cont
  15.299 +      apply (simp add: split_01_prod k_def)
  15.300 +      apply (rule clo1 clo2 continuous_on_cases_local continuous_intros | erule continuous_on_subset | simp add: linear image_subset_iff)+
  15.301 +      apply (force simp add: keq)
  15.302 +      done
  15.303 +    moreover have "k ` ({0..1} \<times> X) \<subseteq> Y"
  15.304 +      using Y by (force simp add: k_def)
  15.305 +    moreover have "\<forall>x. k (0, x) = f x"
  15.306 +      by (simp add: k_def k12)
  15.307 +    moreover have "(\<forall>x. k (1, x) = h x)"
  15.308 +      by (simp add: k_def k12)
  15.309 +    moreover have "\<forall>t\<in>{0..1}. P (\<lambda>x. k (t, x))"
  15.310 +      using P
  15.311 +      apply (clarsimp simp add: k_def)
  15.312 +      apply (case_tac "t \<le> 1/2")
  15.313 +      apply (auto simp:)
  15.314 +      done
  15.315 +    ultimately have *: "\<exists>k :: real \<times> 'a \<Rightarrow> 'b.
  15.316 +                       continuous_on ({0..1} \<times> X) k \<and> k ` ({0..1} \<times> X) \<subseteq> Y \<and>
  15.317 +                       (\<forall>x. k (0, x) = f x) \<and> (\<forall>x. k (1, x) = h x) \<and> (\<forall>t\<in>{0..1}. P (\<lambda>x. k (t, x)))"
  15.318 +      by blast
  15.319 +  } note * = this
  15.320 +  show ?thesis
  15.321 +    using assms by (auto intro: * simp add: homotopic_with_def)
  15.322 +qed
  15.323 +
  15.324 +proposition homotopic_compose:
  15.325 +      fixes s :: "'a::real_normed_vector set"
  15.326 +      shows "\<lbrakk>homotopic_with (\<lambda>x. True) s t f f'; homotopic_with (\<lambda>x. True) t u g g'\<rbrakk>
  15.327 +             \<Longrightarrow> homotopic_with (\<lambda>x. True) s u (g o f) (g' o f')"
  15.328 +  apply (rule homotopic_with_trans [where g = "g o f'"])
  15.329 +  apply (metis homotopic_compose_continuous_left homotopic_with_imp_continuous homotopic_with_imp_subset1)
  15.330 +  by (metis homotopic_compose_continuous_right homotopic_with_imp_continuous homotopic_with_imp_subset2)
  15.331 +
  15.332 +
  15.333 +subsection\<open>Homotopy of paths, maintaining the same endpoints.\<close>
  15.334 +
  15.335 +
  15.336 +definition homotopic_paths :: "['a set, real \<Rightarrow> 'a, real \<Rightarrow> 'a::topological_space] \<Rightarrow> bool"
  15.337 +  where
  15.338 +     "homotopic_paths s p q \<equiv>
  15.339 +       homotopic_with (\<lambda>r. pathstart r = pathstart p \<and> pathfinish r = pathfinish p) {0..1} s p q"
  15.340 +
  15.341 +lemma homotopic_paths:
  15.342 +   "homotopic_paths s p q \<longleftrightarrow>
  15.343 +      (\<exists>h. continuous_on ({0..1} \<times> {0..1}) h \<and>
  15.344 +          h ` ({0..1} \<times> {0..1}) \<subseteq> s \<and>
  15.345 +          (\<forall>x \<in> {0..1}. h(0,x) = p x) \<and>
  15.346 +          (\<forall>x \<in> {0..1}. h(1,x) = q x) \<and>
  15.347 +          (\<forall>t \<in> {0..1::real}. pathstart(h o Pair t) = pathstart p \<and>
  15.348 +                        pathfinish(h o Pair t) = pathfinish p))"
  15.349 +  by (auto simp: homotopic_paths_def homotopic_with pathstart_def pathfinish_def)
  15.350 +
  15.351 +proposition homotopic_paths_imp_pathstart:
  15.352 +     "homotopic_paths s p q \<Longrightarrow> pathstart p = pathstart q"
  15.353 +  by (metis (mono_tags, lifting) homotopic_paths_def homotopic_with_imp_property)
  15.354 +
  15.355 +proposition homotopic_paths_imp_pathfinish:
  15.356 +     "homotopic_paths s p q \<Longrightarrow> pathfinish p = pathfinish q"
  15.357 +  by (metis (mono_tags, lifting) homotopic_paths_def homotopic_with_imp_property)
  15.358 +
  15.359 +lemma homotopic_paths_imp_path:
  15.360 +     "homotopic_paths s p q \<Longrightarrow> path p \<and> path q"
  15.361 +  using homotopic_paths_def homotopic_with_imp_continuous path_def by blast
  15.362 +
  15.363 +lemma homotopic_paths_imp_subset:
  15.364 +     "homotopic_paths s p q \<Longrightarrow> path_image p \<subseteq> s \<and> path_image q \<subseteq> s"
  15.365 +  by (simp add: homotopic_paths_def homotopic_with_imp_subset1 homotopic_with_imp_subset2 path_image_def)
  15.366 +
  15.367 +proposition homotopic_paths_refl [simp]: "homotopic_paths s p p \<longleftrightarrow> path p \<and> path_image p \<subseteq> s"
  15.368 +by (simp add: homotopic_paths_def homotopic_with_refl path_def path_image_def)
  15.369 +
  15.370 +proposition homotopic_paths_sym: "homotopic_paths s p q \<longleftrightarrow> homotopic_paths s q p"
  15.371 +  by (metis (mono_tags) homotopic_paths_def homotopic_paths_imp_pathfinish homotopic_paths_imp_pathstart homotopic_with_symD)+
  15.372 +
  15.373 +proposition homotopic_paths_trans:
  15.374 +     "\<lbrakk>homotopic_paths s p q; homotopic_paths s q r\<rbrakk> \<Longrightarrow> homotopic_paths s p r"
  15.375 +  apply (simp add: homotopic_paths_def)
  15.376 +  apply (rule homotopic_with_trans, assumption)
  15.377 +  by (metis (mono_tags, lifting) homotopic_with_imp_property homotopic_with_mono)
  15.378 +
  15.379 +proposition homotopic_paths_eq:
  15.380 +     "\<lbrakk>path p; path_image p \<subseteq> s; \<And>t. t \<in> {0..1} \<Longrightarrow> p t = q t\<rbrakk> \<Longrightarrow> homotopic_paths s p q"
  15.381 +  apply (simp add: homotopic_paths_def)
  15.382 +  apply (rule homotopic_with_eq)
  15.383 +  apply (auto simp: path_def homotopic_with_refl pathstart_def pathfinish_def path_image_def elim: continuous_on_eq)
  15.384 +  done
  15.385 +
  15.386 +proposition homotopic_paths_reparametrize:
  15.387 +  assumes "path p"
  15.388 +      and pips: "path_image p \<subseteq> s"
  15.389 +      and contf: "continuous_on {0..1} f"
  15.390 +      and f01:"f ` {0..1} \<subseteq> {0..1}"
  15.391 +      and [simp]: "f(0) = 0" "f(1) = 1"
  15.392 +      and q: "\<And>t. t \<in> {0..1} \<Longrightarrow> q(t) = p(f t)"
  15.393 +    shows "homotopic_paths s p q"
  15.394 +proof -
  15.395 +  have contp: "continuous_on {0..1} p"
  15.396 +    by (metis \<open>path p\<close> path_def)
  15.397 +  then have "continuous_on {0..1} (p o f)"
  15.398 +    using contf continuous_on_compose continuous_on_subset f01 by blast
  15.399 +  then have "path q"
  15.400 +    by (simp add: path_def) (metis q continuous_on_cong)
  15.401 +  have piqs: "path_image q \<subseteq> s"
  15.402 +    by (metis (no_types, hide_lams) pips f01 image_subset_iff path_image_def q)
  15.403 +  have fb0: "\<And>a b. \<lbrakk>0 \<le> a; a \<le> 1; 0 \<le> b; b \<le> 1\<rbrakk> \<Longrightarrow> 0 \<le> (1 - a) * f b + a * b"
  15.404 +    using f01 by force
  15.405 +  have fb1: "\<lbrakk>0 \<le> a; a \<le> 1; 0 \<le> b; b \<le> 1\<rbrakk> \<Longrightarrow> (1 - a) * f b + a * b \<le> 1" for a b
  15.406 +    using f01 [THEN subsetD, of "f b"] by (simp add: convex_bound_le)
  15.407 +  have "homotopic_paths s q p"
  15.408 +  proof (rule homotopic_paths_trans)
  15.409 +    show "homotopic_paths s q (p \<circ> f)"
  15.410 +      using q by (force intro: homotopic_paths_eq [OF  \<open>path q\<close> piqs])
  15.411 +  next
  15.412 +    show "homotopic_paths s (p \<circ> f) p"
  15.413 +      apply (simp add: homotopic_paths_def homotopic_with_def)
  15.414 +      apply (rule_tac x="p o (\<lambda>y. (1 - (fst y)) *\<^sub>R ((f o snd) y) + (fst y) *\<^sub>R snd y)"  in exI)
  15.415 +      apply (rule conjI contf continuous_intros continuous_on_subset [OF contp] | simp)+
  15.416 +      using pips [unfolded path_image_def]
  15.417 +      apply (auto simp: fb0 fb1 pathstart_def pathfinish_def)
  15.418 +      done
  15.419 +  qed
  15.420 +  then show ?thesis
  15.421 +    by (simp add: homotopic_paths_sym)
  15.422 +qed
  15.423 +
  15.424 +lemma homotopic_paths_subset: "\<lbrakk>homotopic_paths s p q; s \<subseteq> t\<rbrakk> \<Longrightarrow> homotopic_paths t p q"
  15.425 +  using homotopic_paths_def homotopic_with_subset_right by blast
  15.426 +
  15.427 +
  15.428 +text\<open> A slightly ad-hoc but useful lemma in constructing homotopies.\<close>
  15.429 +lemma homotopic_join_lemma:
  15.430 +  fixes q :: "[real,real] \<Rightarrow> 'a::topological_space"
  15.431 +  assumes p: "continuous_on ({0..1} \<times> {0..1}) (\<lambda>y. p (fst y) (snd y))"
  15.432 +      and q: "continuous_on ({0..1} \<times> {0..1}) (\<lambda>y. q (fst y) (snd y))"
  15.433 +      and pf: "\<And>t. t \<in> {0..1} \<Longrightarrow> pathfinish(p t) = pathstart(q t)"
  15.434 +    shows "continuous_on ({0..1} \<times> {0..1}) (\<lambda>y. (p(fst y) +++ q(fst y)) (snd y))"
  15.435 +proof -
  15.436 +  have 1: "(\<lambda>y. p (fst y) (2 * snd y)) = (\<lambda>y. p (fst y) (snd y)) o (\<lambda>y. (fst y, 2 * snd y))"
  15.437 +    by (rule ext) (simp )
  15.438 +  have 2: "(\<lambda>y. q (fst y) (2 * snd y - 1)) = (\<lambda>y. q (fst y) (snd y)) o (\<lambda>y. (fst y, 2 * snd y - 1))"
  15.439 +    by (rule ext) (simp )
  15.440 +  show ?thesis
  15.441 +    apply (simp add: joinpaths_def)
  15.442 +    apply (rule continuous_on_cases_le)
  15.443 +    apply (simp_all only: 1 2)
  15.444 +    apply (rule continuous_intros continuous_on_subset [OF p] continuous_on_subset [OF q] | force)+
  15.445 +    using pf
  15.446 +    apply (auto simp: mult.commute pathstart_def pathfinish_def)
  15.447 +    done
  15.448 +qed
  15.449 +
  15.450 +text\<open> Congruence properties of homotopy w.r.t. path-combining operations.\<close>
  15.451 +
  15.452 +lemma homotopic_paths_reversepath_D:
  15.453 +      assumes "homotopic_paths s p q"
  15.454 +      shows   "homotopic_paths s (reversepath p) (reversepath q)"
  15.455 +  using assms
  15.456 +  apply (simp add: homotopic_paths_def homotopic_with_def, clarify)
  15.457 +  apply (rule_tac x="h o (\<lambda>x. (fst x, 1 - snd x))" in exI)
  15.458 +  apply (rule conjI continuous_intros)+
  15.459 +  apply (auto simp: reversepath_def pathstart_def pathfinish_def elim!: continuous_on_subset)
  15.460 +  done
  15.461 +
  15.462 +proposition homotopic_paths_reversepath:
  15.463 +     "homotopic_paths s (reversepath p) (reversepath q) \<longleftrightarrow> homotopic_paths s p q"
  15.464 +  using homotopic_paths_reversepath_D by force
  15.465 +
  15.466 +
  15.467 +proposition homotopic_paths_join:
  15.468 +    "\<lbrakk>homotopic_paths s p p'; homotopic_paths s q q'; pathfinish p = pathstart q\<rbrakk> \<Longrightarrow> homotopic_paths s (p +++ q) (p' +++ q')"
  15.469 +  apply (simp add: homotopic_paths_def homotopic_with_def, clarify)
  15.470 +  apply (rename_tac k1 k2)
  15.471 +  apply (rule_tac x="(\<lambda>y. ((k1 o Pair (fst y)) +++ (k2 o Pair (fst y))) (snd y))" in exI)
  15.472 +  apply (rule conjI continuous_intros homotopic_join_lemma)+
  15.473 +  apply (auto simp: joinpaths_def pathstart_def pathfinish_def path_image_def)
  15.474 +  done
  15.475 +
  15.476 +proposition homotopic_paths_continuous_image:
  15.477 +    "\<lbrakk>homotopic_paths s f g; continuous_on s h; h ` s \<subseteq> t\<rbrakk> \<Longrightarrow> homotopic_paths t (h o f) (h o g)"
  15.478 +  unfolding homotopic_paths_def
  15.479 +  apply (rule homotopic_with_compose_continuous_left [of _ _ _ s])
  15.480 +  apply (auto simp: pathstart_def pathfinish_def elim!: homotopic_with_mono)
  15.481 +  done
  15.482 +
  15.483  end
    16.1 --- a/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy	Tue Nov 17 12:01:19 2015 +0100
    16.2 +++ b/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy	Tue Nov 17 12:32:08 2015 +0000
    16.3 @@ -888,7 +888,7 @@
    16.4    apply (metis zero_le_dist order_trans dist_self)
    16.5    done
    16.6  
    16.7 -lemma ball_empty[intro]: "e \<le> 0 \<Longrightarrow> ball x e = {}" by simp
    16.8 +lemma ball_empty: "e \<le> 0 \<Longrightarrow> ball x e = {}" by simp
    16.9  
   16.10  lemma euclidean_dist_l2:
   16.11    fixes x y :: "'a :: euclidean_space"
   16.12 @@ -6856,6 +6856,38 @@
   16.13        \<Longrightarrow> continuous_on (s \<union> t) (\<lambda>x. if P x then f x else g x)"
   16.14    by (rule continuous_on_union_local) (auto intro: continuous_on_eq)
   16.15  
   16.16 +lemma continuous_on_cases_le:
   16.17 +  fixes h :: "'a :: topological_space \<Rightarrow> real"
   16.18 +  assumes "continuous_on {t \<in> s. h t \<le> a} f"
   16.19 +      and "continuous_on {t \<in> s. a \<le> h t} g"
   16.20 +      and h: "continuous_on s h"
   16.21 +      and "\<And>t. \<lbrakk>t \<in> s; h t = a\<rbrakk> \<Longrightarrow> f t = g t"
   16.22 +    shows "continuous_on s (\<lambda>t. if h t \<le> a then f(t) else g(t))"
   16.23 +proof -
   16.24 +  have s: "s = {t \<in> s. h t \<in> atMost a} \<union> {t \<in> s. h t \<in> atLeast a}"
   16.25 +    by force
   16.26 +  have 1: "closedin (subtopology euclidean s) {t \<in> s. h t \<in> atMost a}"
   16.27 +    by (rule continuous_closedin_preimage [OF h closed_atMost])
   16.28 +  have 2: "closedin (subtopology euclidean s) {t \<in> s. h t \<in> atLeast a}"
   16.29 +    by (rule continuous_closedin_preimage [OF h closed_atLeast])
   16.30 +  show ?thesis
   16.31 +    apply (rule continuous_on_subset [of s, OF _ order_refl])
   16.32 +    apply (subst s)
   16.33 +    apply (rule continuous_on_cases_local)
   16.34 +    using 1 2 s assms apply auto
   16.35 +    done
   16.36 +qed
   16.37 +
   16.38 +lemma continuous_on_cases_1:
   16.39 +  fixes s :: "real set"
   16.40 +  assumes "continuous_on {t \<in> s. t \<le> a} f"
   16.41 +      and "continuous_on {t \<in> s. a \<le> t} g"
   16.42 +      and "continuous_on s h"
   16.43 +      and "a \<in> s \<Longrightarrow> f a = g a"
   16.44 +    shows "continuous_on s (\<lambda>t. if t \<le> a then f(t) else g(t))"
   16.45 +using assms
   16.46 +by (auto simp: continuous_on_id intro: continuous_on_cases_le [where h = id, simplified])
   16.47 +
   16.48  text\<open>Some more convenient intermediate-value theorem formulations.\<close>
   16.49  
   16.50  lemma connected_ivt_hyperplane:
   16.51 @@ -8136,6 +8168,216 @@
   16.52    ultimately show "\<exists>!x\<in>s. g x = x" using \<open>a \<in> s\<close> by blast
   16.53  qed
   16.54  
   16.55 +
   16.56 +lemma cball_subset_cball_iff:
   16.57 +  fixes a :: "'a :: euclidean_space"
   16.58 +  shows "cball a r \<subseteq> cball a' r' \<longleftrightarrow> dist a a' + r \<le> r' \<or> r < 0"
   16.59 +        (is "?lhs = ?rhs")
   16.60 +proof
   16.61 +  assume ?lhs 
   16.62 +  then show ?rhs 
   16.63 +  proof (cases "r < 0")
   16.64 +    case True then show ?rhs by simp
   16.65 +  next
   16.66 +    case False
   16.67 +    then have [simp]: "r \<ge> 0" by simp
   16.68 +    have "norm (a - a') + r \<le> r'"
   16.69 +    proof (cases "a = a'")
   16.70 +      case True then show ?thesis
   16.71 +        using subsetD [where c = "a + r *\<^sub>R (SOME i. i \<in> Basis)", OF \<open>?lhs\<close>]  subsetD [where c = "a", OF \<open>?lhs\<close>]
   16.72 +        by (force simp add: SOME_Basis dist_norm)
   16.73 +    next
   16.74 +      case False
   16.75 +      have "norm (a' - (a + (r / norm (a - a')) *\<^sub>R (a - a'))) = norm (a' - a - (r / norm (a - a')) *\<^sub>R (a - a'))"
   16.76 +        by (simp add: algebra_simps)
   16.77 +      also have "... = norm ((-1 - (r / norm (a - a'))) *\<^sub>R (a - a'))"
   16.78 +        by (simp add: algebra_simps)
   16.79 +      also have "... = \<bar>- norm (a - a') - r\<bar>"
   16.80 +        using  \<open>a \<noteq> a'\<close> by (simp add: abs_mult_pos field_simps)
   16.81 +      finally have [simp]: "norm (a' - (a + (r / norm (a - a')) *\<^sub>R (a - a'))) = \<bar>norm (a - a') + r\<bar>" by linarith
   16.82 +      show ?thesis
   16.83 +        using subsetD [where c = "a' + (1 + r / norm(a - a')) *\<^sub>R (a - a')", OF \<open>?lhs\<close>] \<open>a \<noteq> a'\<close> 
   16.84 +        by (simp add: dist_norm scaleR_add_left)
   16.85 +    qed
   16.86 +    then show ?rhs by (simp add: dist_norm)
   16.87 +  qed
   16.88 +next
   16.89 +  assume ?rhs then show ?lhs 
   16.90 +    apply (auto simp: ball_def dist_norm )
   16.91 +    apply (metis add.commute add_le_cancel_right dist_norm dist_triangle_alt order_trans)
   16.92 +    using le_less_trans apply fastforce
   16.93 +    done
   16.94 +qed
   16.95 +
   16.96 +lemma cball_subset_ball_iff:
   16.97 +  fixes a :: "'a :: euclidean_space"
   16.98 +  shows "cball a r \<subseteq> ball a' r' \<longleftrightarrow> dist a a' + r < r' \<or> r < 0"
   16.99 +        (is "?lhs = ?rhs")
  16.100 +proof
  16.101 +  assume ?lhs 
  16.102 +  then show ?rhs 
  16.103 +  proof (cases "r < 0")
  16.104 +    case True then show ?rhs by simp
  16.105 +  next
  16.106 +    case False
  16.107 +    then have [simp]: "r \<ge> 0" by simp
  16.108 +    have "norm (a - a') + r < r'"
  16.109 +    proof (cases "a = a'")
  16.110 +      case True then show ?thesis
  16.111 +        using subsetD [where c = "a + r *\<^sub>R (SOME i. i \<in> Basis)", OF \<open>?lhs\<close>]  subsetD [where c = "a", OF \<open>?lhs\<close>]
  16.112 +        by (force simp add: SOME_Basis dist_norm)
  16.113 +    next
  16.114 +      case False
  16.115 +      { assume "norm (a - a') + r \<ge> r'"
  16.116 +        then have "\<bar>r' - norm (a - a')\<bar> \<le> r"
  16.117 +          apply (simp split: abs_split)
  16.118 +          by (metis \<open>0 \<le> r\<close> \<open>?lhs\<close> centre_in_cball dist_commute dist_norm less_asym mem_ball subset_eq)
  16.119 +        then have False
  16.120 +        using subsetD [where c = "a + (r' / norm(a - a') - 1) *\<^sub>R (a - a')", OF \<open>?lhs\<close>] \<open>a \<noteq> a'\<close>
  16.121 +        apply (simp add: dist_norm field_simps)
  16.122 +        apply (simp add: diff_divide_distrib scaleR_left_diff_distrib)
  16.123 +        done
  16.124 +      }
  16.125 +      then show ?thesis by force
  16.126 +    qed
  16.127 +    then show ?rhs by (simp add: dist_norm)
  16.128 +  qed
  16.129 +next
  16.130 +  assume ?rhs then show ?lhs 
  16.131 +    apply (auto simp: ball_def dist_norm )
  16.132 +    apply (metis add.commute add_le_cancel_right dist_norm dist_triangle_alt le_less_trans)
  16.133 +    using le_less_trans apply fastforce
  16.134 +    done
  16.135 +qed
  16.136 +
  16.137 +lemma ball_subset_cball_iff:
  16.138 +  fixes a :: "'a :: euclidean_space"
  16.139 +  shows "ball a r \<subseteq> cball a' r' \<longleftrightarrow> dist a a' + r \<le> r' \<or> r \<le> 0"
  16.140 +        (is "?lhs = ?rhs")
  16.141 +proof (cases "r \<le> 0")
  16.142 +  case True then show ?thesis   
  16.143 +    using dist_not_less_zero less_le_trans by force
  16.144 +next
  16.145 +  case False show ?thesis  
  16.146 +  proof
  16.147 +    assume ?lhs
  16.148 +    then have "(cball a r \<subseteq> cball a' r')"
  16.149 +      by (metis False closed_cball closure_ball closure_closed closure_mono not_less)
  16.150 +    then show ?rhs
  16.151 +      using False cball_subset_cball_iff by fastforce
  16.152 +  next
  16.153 +    assume ?rhs with False show ?lhs
  16.154 +      using ball_subset_cball cball_subset_cball_iff by blast 
  16.155 +  qed
  16.156 +qed
  16.157 +
  16.158 +lemma ball_subset_ball_iff:
  16.159 +  fixes a :: "'a :: euclidean_space"
  16.160 +  shows "ball a r \<subseteq> ball a' r' \<longleftrightarrow> dist a a' + r \<le> r' \<or> r \<le> 0"
  16.161 +        (is "?lhs = ?rhs")
  16.162 +proof (cases "r \<le> 0")
  16.163 +  case True then show ?thesis   
  16.164 +    using dist_not_less_zero less_le_trans by force
  16.165 +next
  16.166 +  case False show ?thesis  
  16.167 +  proof
  16.168 +    assume ?lhs
  16.169 +    then have "0 < r'"
  16.170 +      by (metis (no_types) False \<open>?lhs\<close> centre_in_ball dist_norm le_less_trans mem_ball norm_ge_zero not_less set_mp)
  16.171 +    then have "(cball a r \<subseteq> cball a' r')"
  16.172 +      by (metis False\<open>?lhs\<close> closure_ball closure_mono not_less)
  16.173 +    then show ?rhs
  16.174 +      using False cball_subset_cball_iff by fastforce
  16.175 +  next
  16.176 +  assume ?rhs then show ?lhs
  16.177 +    apply (auto simp: ball_def)
  16.178 +    apply (metis add.commute add_le_cancel_right dist_commute dist_triangle_lt not_le order_trans)
  16.179 +    using dist_not_less_zero order.strict_trans2 apply blast
  16.180 +    done
  16.181 +  qed
  16.182 +qed
  16.183 +
  16.184 +
  16.185 +lemma ball_eq_ball_iff:
  16.186 +  fixes x :: "'a :: euclidean_space"
  16.187 +  shows "ball x d = ball y e \<longleftrightarrow> d \<le> 0 \<and> e \<le> 0 \<or> x=y \<and> d=e"
  16.188 +        (is "?lhs = ?rhs")
  16.189 +proof
  16.190 +  assume ?lhs 
  16.191 +  then show ?rhs 
  16.192 +  proof (cases "d \<le> 0 \<or> e \<le> 0")
  16.193 +    case True 
  16.194 +      with \<open>?lhs\<close> show ?rhs
  16.195 +        by safe (simp_all only: ball_eq_empty [of y e, symmetric] ball_eq_empty [of x d, symmetric])
  16.196 +  next
  16.197 +    case False
  16.198 +    with \<open>?lhs\<close> show ?rhs 
  16.199 +      apply (auto simp add: set_eq_subset ball_subset_ball_iff dist_norm norm_minus_commute algebra_simps)
  16.200 +      apply (metis add_le_same_cancel1 le_add_same_cancel1 norm_ge_zero norm_pths(2) order_trans)
  16.201 +      apply (metis add_increasing2 add_le_imp_le_right eq_iff norm_ge_zero)
  16.202 +      done
  16.203 +  qed
  16.204 +next
  16.205 +  assume ?rhs then show ?lhs 
  16.206 +    by (auto simp add: set_eq_subset ball_subset_ball_iff)
  16.207 +qed
  16.208 +
  16.209 +lemma cball_eq_cball_iff:
  16.210 +  fixes x :: "'a :: euclidean_space"
  16.211 +  shows "cball x d = cball y e \<longleftrightarrow> d < 0 \<and> e < 0 \<or> x=y \<and> d=e"
  16.212 +        (is "?lhs = ?rhs")
  16.213 +proof
  16.214 +  assume ?lhs 
  16.215 +  then show ?rhs 
  16.216 +  proof (cases "d < 0 \<or> e < 0")
  16.217 +    case True 
  16.218 +      with \<open>?lhs\<close> show ?rhs
  16.219 +        by safe (simp_all only: cball_eq_empty [of y e, symmetric] cball_eq_empty [of x d, symmetric])
  16.220 +  next
  16.221 +    case False
  16.222 +    with \<open>?lhs\<close> show ?rhs 
  16.223 +      apply (auto simp add: set_eq_subset cball_subset_cball_iff dist_norm norm_minus_commute algebra_simps)
  16.224 +      apply (metis add_le_same_cancel1 le_add_same_cancel1 norm_ge_zero norm_pths(2) order_trans)
  16.225 +      apply (metis add_increasing2 add_le_imp_le_right eq_iff norm_ge_zero)
  16.226 +      done
  16.227 +  qed
  16.228 +next
  16.229 +  assume ?rhs then show ?lhs 
  16.230 +    by (auto simp add: set_eq_subset cball_subset_cball_iff)
  16.231 +qed
  16.232 +
  16.233 +lemma ball_eq_cball_iff:
  16.234 +  fixes x :: "'a :: euclidean_space"
  16.235 +  shows "ball x d = cball y e \<longleftrightarrow> d \<le> 0 \<and> e < 0" (is "?lhs = ?rhs")
  16.236 +proof
  16.237 +  assume ?lhs 
  16.238 +  then show ?rhs
  16.239 +    apply (auto simp add: set_eq_subset ball_subset_cball_iff cball_subset_ball_iff algebra_simps)
  16.240 +    apply (metis add_increasing2 add_le_cancel_right add_less_same_cancel1 dist_not_less_zero less_le_trans zero_le_dist)
  16.241 +    apply (metis add_less_same_cancel1 dist_not_less_zero less_le_trans not_le)
  16.242 +    using \<open>?lhs\<close> ball_eq_empty cball_eq_empty apply blast+
  16.243 +    done
  16.244 +next
  16.245 +  assume ?rhs then show ?lhs 
  16.246 +    by (auto simp add: set_eq_subset ball_subset_cball_iff cball_subset_ball_iff)
  16.247 +qed
  16.248 +
  16.249 +lemma cball_eq_ball_iff:
  16.250 +  fixes x :: "'a :: euclidean_space"
  16.251 +  shows "cball x d = ball y e \<longleftrightarrow> d < 0 \<and> e \<le> 0" (is "?lhs = ?rhs")
  16.252 +proof
  16.253 +  assume ?lhs 
  16.254 +  then show ?rhs
  16.255 +    apply (auto simp add: set_eq_subset ball_subset_cball_iff cball_subset_ball_iff algebra_simps)
  16.256 +    apply (metis add_increasing2 add_le_cancel_right add_less_same_cancel1 dist_not_less_zero less_le_trans zero_le_dist)
  16.257 +    apply (metis add_less_same_cancel1 dist_not_less_zero less_le_trans not_le)
  16.258 +    using \<open>?lhs\<close> ball_eq_empty cball_eq_empty apply blast+
  16.259 +    done
  16.260 +next
  16.261 +  assume ?rhs then show ?lhs 
  16.262 +    by (auto simp add: set_eq_subset ball_subset_cball_iff cball_subset_ball_iff)
  16.263 +qed
  16.264 +
  16.265  no_notation
  16.266    eucl_less (infix "<e" 50)
  16.267  
    17.1 --- a/src/HOL/Multivariate_Analysis/ex/Approximations.thy	Tue Nov 17 12:01:19 2015 +0100
    17.2 +++ b/src/HOL/Multivariate_Analysis/ex/Approximations.thy	Tue Nov 17 12:32:08 2015 +0000
    17.3 @@ -28,10 +28,10 @@
    17.4    apply (simp only: abs_diff_le_iff)
    17.5    apply (rule sin_pi6_straddle, simp_all)
    17.6     using Taylor_sin [of "1686629713/3221225472" 11]
    17.7 -  apply (simp add: in_Reals_norm sin_coeff_def Re_sin atMost_nat_numeral fact_numeral)
    17.8 +  apply (simp add: in_Reals_norm sin_coeff_def Re_sin atMost_nat_numeral fact_numeral power_divide)
    17.9     apply (simp only: pos_le_divide_eq [symmetric])
   17.10    using Taylor_sin [of "6746518853/12884901888" 11]
   17.11 -  apply (simp add: in_Reals_norm sin_coeff_def Re_sin atMost_nat_numeral fact_numeral)
   17.12 +  apply (simp add: in_Reals_norm sin_coeff_def Re_sin atMost_nat_numeral fact_numeral power_divide)
   17.13    apply (simp only: pos_le_divide_eq [symmetric] pos_divide_le_eq [symmetric])
   17.14    done
   17.15  
    18.1 --- a/src/HOL/Old_Number_Theory/Fib.thy	Tue Nov 17 12:01:19 2015 +0100
    18.2 +++ b/src/HOL/Old_Number_Theory/Fib.thy	Tue Nov 17 12:32:08 2015 +0000
    18.3 @@ -85,7 +85,7 @@
    18.4   "fib (Suc (Suc n)) * fib n =
    18.5    (if n mod 2 = 0 then fib (Suc n) * fib (Suc n) - 1
    18.6     else fib (Suc n) * fib (Suc n) + 1)"
    18.7 -  apply (rule int_int_eq [THEN iffD1]) 
    18.8 +  apply (rule of_nat_eq_iff [where 'a = int, THEN iffD1]) 
    18.9    using fib_Cassini_int apply (auto simp add: Suc_leI fib_Suc_gr_0 of_nat_diff)
   18.10    done
   18.11  
    19.1 --- a/src/HOL/Old_Number_Theory/WilsonRuss.thy	Tue Nov 17 12:01:19 2015 +0100
    19.2 +++ b/src/HOL/Old_Number_Theory/WilsonRuss.thy	Tue Nov 17 12:32:08 2015 +0000
    19.3 @@ -29,7 +29,7 @@
    19.4  text \<open>\medskip @{term [source] inv}\<close>
    19.5  
    19.6  lemma inv_is_inv_aux: "1 < m ==> Suc (nat (m - 2)) = nat (m - 1)"
    19.7 -  by (subst int_int_eq [symmetric]) auto
    19.8 +  by simp
    19.9  
   19.10  lemma inv_is_inv:
   19.11      "zprime p \<Longrightarrow> 0 < a \<Longrightarrow> a < p ==> [a * inv p a = 1] (mod p)"
   19.12 @@ -38,10 +38,7 @@
   19.13    apply (subst mod_mult_right_eq [symmetric])
   19.14    apply (subst zcong_zmod [symmetric])
   19.15    apply (subst power_Suc [symmetric])
   19.16 -  apply (subst inv_is_inv_aux)
   19.17 -   apply (erule_tac [2] Little_Fermat)
   19.18 -   apply (erule_tac [2] zdvd_not_zless)
   19.19 -   apply (unfold zprime_def, auto)
   19.20 +  using Little_Fermat inv_is_inv_aux zdvd_not_zless apply auto
   19.21    done
   19.22  
   19.23  lemma inv_distinct:
   19.24 @@ -116,8 +113,7 @@
   19.25  
   19.26  lemma inv_inv_aux: "5 \<le> p ==>
   19.27      nat (p - 2) * nat (p - 2) = Suc (nat (p - 1) * nat (p - 3))"
   19.28 -  apply (subst int_int_eq [symmetric])
   19.29 -  apply (simp add: of_nat_mult)
   19.30 +  apply (subst of_nat_eq_iff [where 'a = int, symmetric])
   19.31    apply (simp add: left_diff_distrib right_diff_distrib)
   19.32    done
   19.33  
    20.1 --- a/src/HOL/Power.thy	Tue Nov 17 12:01:19 2015 +0100
    20.2 +++ b/src/HOL/Power.thy	Tue Nov 17 12:32:08 2015 +0000
    20.3 @@ -391,8 +391,6 @@
    20.4    "(a / b) ^ n = a ^ n / b ^ n"
    20.5    by (induct n) simp_all
    20.6  
    20.7 -declare power_divide [where b = "numeral w" for w, simp]
    20.8 -
    20.9  end
   20.10  
   20.11  
    21.1 --- a/src/HOL/Probability/Projective_Limit.thy	Tue Nov 17 12:01:19 2015 +0100
    21.2 +++ b/src/HOL/Probability/Projective_Limit.thy	Tue Nov 17 12:32:08 2015 +0000
    21.3 @@ -298,7 +298,7 @@
    21.4      also have "\<dots> < ereal (1 * real_of_ereal ?a)" unfolding less_ereal.simps
    21.5      proof (rule mult_strict_right_mono)
    21.6        have "(\<Sum>i = 1..n. 2 powr - real i) = (\<Sum>i = 1..<Suc n. (1/2) ^ i)"
    21.7 -        by (rule setsum.cong) (auto simp: powr_realpow powr_divide powr_minus_divide)  
    21.8 +        by (rule setsum.cong) (auto simp: powr_realpow powr_divide power_divide powr_minus_divide)  
    21.9        also have "{1..<Suc n} = {..<Suc n} - {0}" by auto
   21.10        also have "setsum (op ^ (1 / 2::real)) ({..<Suc n} - {0}) =
   21.11          setsum (op ^ (1 / 2)) ({..<Suc n}) - 1" by (auto simp: setsum_diff1)
    22.1 --- a/src/HOL/Real.thy	Tue Nov 17 12:01:19 2015 +0100
    22.2 +++ b/src/HOL/Real.thy	Tue Nov 17 12:32:08 2015 +0000
    22.3 @@ -1044,7 +1044,7 @@
    22.4    have "(0::real) \<le> 1"
    22.5      by (metis less_eq_real_def zero_less_one)
    22.6    thus ?thesis
    22.7 -    by (metis floor_unique less_add_one less_imp_le not_less of_int_le_iff order_trans)
    22.8 +    by (metis floor_of_int less_floor_iff)
    22.9  qed
   22.10  
   22.11  lemma int_le_real_less: "(n \<le> m) = (real_of_int n < real_of_int m + 1)"
   22.12 @@ -1509,29 +1509,23 @@
   22.13  lemma floor_minus_divide_eq_div_numeral[simp]: "\<lfloor>- (numeral a / numeral b)::real\<rfloor> = - numeral a div numeral b"
   22.14    by (metis divide_minus_left floor_divide_of_int_eq of_int_neg_numeral of_int_numeral)
   22.15  
   22.16 -lemma real_of_int_ceiling_cancel [simp]:
   22.17 -     "(real_of_int (ceiling x) = x) = (\<exists>n::int. x = real_of_int n)"
   22.18 +lemma of_int_ceiling_cancel [simp]:
   22.19 +     "(of_int (ceiling x) = x) = (\<exists>n::int. x = of_int n)"
   22.20    using ceiling_of_int by metis
   22.21  
   22.22 -lemma ceiling_eq: "[| real_of_int n < x; x < real_of_int n + 1 |] ==> ceiling x = n + 1"
   22.23 -  by linarith
   22.24 +lemma ceiling_eq: "[| of_int n < x; x \<le> of_int n + 1 |] ==> ceiling x = n + 1"
   22.25 +  by (simp add: ceiling_unique)
   22.26  
   22.27 -lemma ceiling_eq2: "[| real_of_int n < x; x \<le> real_of_int n + 1 |] ==> ceiling x = n + 1"
   22.28 +lemma of_int_ceiling_diff_one_le [simp]: "of_int (ceiling r) - 1 \<le> r"
   22.29    by linarith
   22.30  
   22.31 -lemma real_of_int_ceiling_diff_one_le [simp]: "real_of_int (ceiling r) - 1 \<le> r"
   22.32 -  by linarith
   22.33 -
   22.34 -lemma real_of_int_ceiling_le_add_one [simp]: "real_of_int (ceiling r) \<le> r + 1"
   22.35 +lemma of_int_ceiling_le_add_one [simp]: "of_int (ceiling r) \<le> r + 1"
   22.36    by linarith
   22.37  
   22.38 -lemma ceiling_le: "x <= real_of_int a ==> ceiling x <= a"
   22.39 -  by linarith
   22.40 +lemma ceiling_le: "x <= of_int a ==> ceiling x <= a"
   22.41 +  by (simp add: ceiling_le_iff)
   22.42  
   22.43 -lemma ceiling_le_real: "ceiling x <= a ==> x <= real_of_int a"
   22.44 -  by linarith
   22.45 -
   22.46 -lemma ceiling_divide_eq_div: "\<lceil>real_of_int a / real_of_int b\<rceil> = - (- a div b)"
   22.47 +lemma ceiling_divide_eq_div: "\<lceil>of_int a / of_int b\<rceil> = - (- a div b)"
   22.48    by (metis ceiling_def floor_divide_of_int_eq minus_divide_left of_int_minus)
   22.49  
   22.50  lemma ceiling_divide_eq_div_numeral [simp]:
   22.51 @@ -1574,25 +1568,13 @@
   22.52  subsection \<open>Exponentiation with floor\<close>
   22.53  
   22.54  lemma floor_power:
   22.55 -  assumes "x = real_of_int (floor x)"
   22.56 +  assumes "x = of_int (floor x)"
   22.57    shows "floor (x ^ n) = floor x ^ n"
   22.58  proof -
   22.59 -  have "x ^ n = real_of_int (floor x ^ n)"
   22.60 +  have "x ^ n = of_int (floor x ^ n)"
   22.61      using assms by (induct n arbitrary: x) simp_all
   22.62 -  then show ?thesis  by linarith
   22.63 +  then show ?thesis by (metis floor_of_int) 
   22.64  qed
   22.65 -(*
   22.66 -lemma natfloor_power:
   22.67 -  assumes "x = real (natfloor x)"
   22.68 -  shows "natfloor (x ^ n) = natfloor x ^ n"
   22.69 -proof -
   22.70 -  from assms have "0 \<le> floor x" by auto
   22.71 -  note assms[unfolded natfloor_def of_nat_nat[OF `0 \<le> floor x`]]
   22.72 -  from floor_power[OF this]
   22.73 -  show ?thesis unfolding natfloor_def nat_power_eq[OF `0 \<le> floor x`, symmetric]
   22.74 -    by simp
   22.75 -qed
   22.76 -*)
   22.77  
   22.78  lemma floor_numeral_power[simp]:
   22.79    "\<lfloor>numeral x ^ n\<rfloor> = numeral x ^ n"
    23.1 --- a/src/HOL/Tools/Qelim/cooper.ML	Tue Nov 17 12:01:19 2015 +0100
    23.2 +++ b/src/HOL/Tools/Qelim/cooper.ML	Tue Nov 17 12:32:08 2015 +0000
    23.3 @@ -810,10 +810,9 @@
    23.4  local
    23.5  val ss1 =
    23.6    simpset_of (put_simpset comp_ss @{context}
    23.7 -    addsimps @{thms simp_thms} @ [@{thm "nat_numeral"} RS sym, @{thm "zdvd_int"}] 
    23.8 -        @ map (fn r => r RS sym) 
    23.9 -          [@{thm "int_int_eq"}, @{thm "zle_int"}, @{thm "zless_int"}, @{thm "zadd_int"}, 
   23.10 -           @{thm "zmult_int"}]
   23.11 +    addsimps @{thms simp_thms} @ 
   23.12 +            [@{thm "nat_numeral"} RS sym, @{thm "zdvd_int"}, @{thm "of_nat_add"}, @{thm "of_nat_mult"}] 
   23.13 +        @ map (fn r => r RS sym) [@{thm "int_int_eq"}, @{thm "zle_int"}, @{thm "zless_int"}]
   23.14      |> Splitter.add_split @{thm "zdiff_int_split"})
   23.15  
   23.16  val ss2 =
    24.1 --- a/src/HOL/Tools/nat_numeral_simprocs.ML	Tue Nov 17 12:01:19 2015 +0100
    24.2 +++ b/src/HOL/Tools/nat_numeral_simprocs.ML	Tue Nov 17 12:32:08 2015 +0000
    24.3 @@ -26,7 +26,7 @@
    24.4  struct
    24.5  
    24.6  (*Maps n to #n for n = 1, 2*)
    24.7 -val numeral_syms = [@{thm numeral_1_eq_1} RS sym, @{thm numeral_2_eq_2} RS sym];
    24.8 +val numeral_syms = [@{thm numeral_One} RS sym, @{thm numeral_2_eq_2} RS sym];
    24.9  val numeral_sym_ss =
   24.10    simpset_of (put_simpset HOL_basic_ss @{context} addsimps numeral_syms);
   24.11  
   24.12 @@ -59,7 +59,7 @@
   24.13  (** Other simproc items **)
   24.14  
   24.15  val bin_simps =
   24.16 -     [@{thm numeral_1_eq_1} RS sym,
   24.17 +     [@{thm numeral_One} RS sym,
   24.18        @{thm numeral_plus_numeral}, @{thm add_numeral_left},
   24.19        @{thm diff_nat_numeral}, @{thm diff_0_eq_0}, @{thm diff_0},
   24.20        @{thm numeral_times_numeral}, @{thm mult_numeral_left(1)},
    25.1 --- a/src/HOL/Tools/numeral_simprocs.ML	Tue Nov 17 12:01:19 2015 +0100
    25.2 +++ b/src/HOL/Tools/numeral_simprocs.ML	Tue Nov 17 12:32:08 2015 +0000
    25.3 @@ -169,7 +169,7 @@
    25.4      |> Simplifier.set_termless numtermless);
    25.5  
    25.6  (*Maps 1 to Numeral1 so that arithmetic isn't complicated by the abstract 1.*)
    25.7 -val numeral_syms = [@{thm numeral_1_eq_1} RS sym];
    25.8 +val numeral_syms = [@{thm numeral_One} RS sym];
    25.9  
   25.10  (*Simplify 0+n, n+0, Numeral1*n, n*Numeral1, 1*x, x*1, x/1 *)
   25.11  val add_0s =  @{thms add_0_left add_0_right};
   25.12 @@ -177,7 +177,7 @@
   25.13  
   25.14  (* For post-simplification of the rhs of simproc-generated rules *)
   25.15  val post_simps =
   25.16 -    [@{thm numeral_1_eq_1},
   25.17 +    [@{thm numeral_One},
   25.18       @{thm add_0_left}, @{thm add_0_right},
   25.19       @{thm mult_zero_left}, @{thm mult_zero_right},
   25.20       @{thm mult_1_left}, @{thm mult_1_right},
   25.21 @@ -192,7 +192,7 @@
   25.22  (*To perform binary arithmetic.  The "left" rewriting handles patterns
   25.23    created by the Numeral_Simprocs, such as 3 * (5 * x). *)
   25.24  val simps =
   25.25 -    [@{thm numeral_1_eq_1} RS sym] @
   25.26 +    [@{thm numeral_One} RS sym] @
   25.27      @{thms add_numeral_left} @
   25.28      @{thms add_neg_numeral_left} @
   25.29      @{thms mult_numeral_left} @
   25.30 @@ -475,7 +475,7 @@
   25.31  
   25.32  (** Final simplification for the CancelFactor simprocs **)
   25.33  val simplify_one = Arith_Data.simplify_meta_eq
   25.34 -  [@{thm mult_1_left}, @{thm mult_1_right}, @{thm div_by_1}, @{thm numeral_1_eq_1}];
   25.35 +  [@{thm mult_1_left}, @{thm mult_1_right}, @{thm div_by_1}, @{thm numeral_One}];
   25.36  
   25.37  fun cancel_simplify_meta_eq ctxt cancel_th th =
   25.38      simplify_one ctxt (([th, cancel_th]) MRS trans);
   25.39 @@ -739,7 +739,7 @@
   25.40  fun field_comp_conv ctxt =
   25.41    Simplifier.rewrite (put_simpset field_comp_ss ctxt)
   25.42    then_conv
   25.43 -  Simplifier.rewrite (put_simpset HOL_basic_ss ctxt addsimps [@{thm numeral_1_eq_1}])
   25.44 +  Simplifier.rewrite (put_simpset HOL_basic_ss ctxt addsimps [@{thm numeral_One}])
   25.45  
   25.46  end
   25.47  
    26.1 --- a/src/HOL/Tools/semiring_normalizer.ML	Tue Nov 17 12:01:19 2015 +0100
    26.2 +++ b/src/HOL/Tools/semiring_normalizer.ML	Tue Nov 17 12:32:08 2015 +0000
    26.3 @@ -122,7 +122,7 @@
    26.4        (case Rat.quotient_of_rat x of (i, 1) => i | _ => error "int_of_rat: bad int")),
    26.5      conv = (fn ctxt =>
    26.6        Simplifier.rewrite (put_simpset semiring_norm_ss ctxt)
    26.7 -      then_conv Simplifier.rewrite (put_simpset HOL_basic_ss ctxt addsimps @{thms numeral_1_eq_1}))};
    26.8 +      then_conv Simplifier.rewrite (put_simpset HOL_basic_ss ctxt addsimps @{thms numeral_One}))};
    26.9  
   26.10  val divide_const = Thm.cterm_of @{context} (Logic.varify_global @{term "op /"});
   26.11  val [divide_tvar] = Term.add_tvars (Thm.term_of divide_const) [];
   26.12 @@ -257,10 +257,10 @@
   26.13  val is_number = can dest_number;
   26.14  
   26.15  fun numeral01_conv ctxt =
   26.16 -  Simplifier.rewrite (put_simpset HOL_basic_ss ctxt addsimps [@{thm numeral_1_eq_1}]);
   26.17 +  Simplifier.rewrite (put_simpset HOL_basic_ss ctxt addsimps [@{thm numeral_One}]);
   26.18  
   26.19  fun zero1_numeral_conv ctxt =
   26.20 -  Simplifier.rewrite (put_simpset HOL_basic_ss ctxt addsimps [@{thm numeral_1_eq_1} RS sym]);
   26.21 +  Simplifier.rewrite (put_simpset HOL_basic_ss ctxt addsimps [@{thm numeral_One} RS sym]);
   26.22  
   26.23  fun zerone_conv ctxt cv =
   26.24    zero1_numeral_conv ctxt then_conv cv then_conv numeral01_conv ctxt;
    27.1 --- a/src/HOL/Transcendental.thy	Tue Nov 17 12:01:19 2015 +0100
    27.2 +++ b/src/HOL/Transcendental.thy	Tue Nov 17 12:32:08 2015 +0000
    27.3 @@ -256,6 +256,7 @@
    27.4  qed
    27.5  
    27.6  subsection \<open>Alternating series test / Leibniz formula\<close>
    27.7 +text\<open>FIXME: generalise these results from the reals via type classes?\<close>
    27.8  
    27.9  lemma sums_alternating_upper_lower:
   27.10    fixes a :: "nat \<Rightarrow> real"
   27.11 @@ -3549,82 +3550,80 @@
   27.12      done
   27.13  qed
   27.14  
   27.15 -
   27.16 -lemma reals_Archimedean4:
   27.17 -  assumes "0 < y" "0 \<le> x"
   27.18 -  obtains n where "real n * y \<le> x" "x < real (Suc n) * y"
   27.19 -  using floor_correct [of "x/y"] assms
   27.20 -  apply (auto simp: field_simps intro!: that [of "nat (floor (x/y))"])
   27.21 -by (metis (no_types, hide_lams)  divide_inverse divide_self_if floor_correct mult.left_commute mult.right_neutral mult_eq_0_iff order_refl order_trans real_mult_le_cancel_iff2)
   27.22 -
   27.23  lemma cos_zero_lemma:
   27.24 -     "\<lbrakk>0 \<le> x; cos x = 0\<rbrakk> \<Longrightarrow>
   27.25 -      \<exists>n::nat. odd n & x = real n * (pi/2)"
   27.26 -apply (erule reals_Archimedean4 [OF pi_gt_zero])
   27.27 -apply (auto simp: )
   27.28 -apply (subgoal_tac "0 \<le> x - real n * pi &
   27.29 -                    (x - real n * pi) \<le> pi & (cos (x - real n * pi) = 0) ")
   27.30 -apply (auto simp: algebra_simps of_nat_Suc)
   27.31 - prefer 2 apply (simp add: cos_diff)
   27.32 -apply (simp add: cos_diff)
   27.33 -apply (subgoal_tac "EX! x. 0 \<le> x & x \<le> pi & cos x = 0")
   27.34 -apply (rule_tac [2] cos_total, safe)
   27.35 -apply (drule_tac x = "x - real n * pi" in spec)
   27.36 -apply (drule_tac x = "pi/2" in spec)
   27.37 -apply (simp add: cos_diff)
   27.38 -apply (rule_tac x = "Suc (2 * n)" in exI)
   27.39 -apply (simp add: of_nat_Suc algebra_simps, auto)
   27.40 -done
   27.41 +  assumes "0 \<le> x" "cos x = 0"
   27.42 +  shows "\<exists>n. odd n \<and> x = of_nat n * (pi/2) \<and> n > 0"
   27.43 +proof -
   27.44 +  have xle: "x < (1 + real_of_int \<lfloor>x/pi\<rfloor>) * pi"
   27.45 +    using floor_correct [of "x/pi"]
   27.46 +    by (simp add: add.commute divide_less_eq)
   27.47 +  obtain n where "real n * pi \<le> x" "x < real (Suc n) * pi"
   27.48 +    apply (rule that [of "nat (floor (x/pi))"] )
   27.49 +    using assms
   27.50 +    apply (simp_all add: xle)
   27.51 +    apply (metis floor_less_iff less_irrefl mult_imp_div_pos_less not_le pi_gt_zero)
   27.52 +    done
   27.53 +  then have x: "0 \<le> x - n * pi" "(x - n * pi) \<le> pi" "cos (x - n * pi) = 0"
   27.54 +    by (auto simp: algebra_simps cos_diff assms)
   27.55 +  then have "\<exists>!x. 0 \<le> x \<and> x \<le> pi \<and> cos x = 0"
   27.56 +    by (auto simp: intro!: cos_total)
   27.57 +  then obtain \<theta> where \<theta>: "0 \<le> \<theta>" "\<theta> \<le> pi" "cos \<theta> = 0" 
   27.58 +                  and uniq: "\<And>\<phi>. \<lbrakk>0 \<le> \<phi>; \<phi> \<le> pi; cos \<phi> = 0\<rbrakk> \<Longrightarrow> \<phi> = \<theta>"
   27.59 +    by blast
   27.60 +  then have "x - real n * pi = \<theta>"
   27.61 +    using x by blast
   27.62 +  moreover have "pi/2 = \<theta>"
   27.63 +    using pi_half_ge_zero uniq by fastforce 
   27.64 +  ultimately show ?thesis
   27.65 +    by (rule_tac x = "Suc (2 * n)" in exI) (simp add: algebra_simps)
   27.66 +qed
   27.67  
   27.68  lemma sin_zero_lemma:
   27.69 -     "\<lbrakk>0 \<le> x; sin x = 0\<rbrakk> \<Longrightarrow>
   27.70 -      \<exists>n::nat. even n & x = real n * (pi/2)"
   27.71 -apply (subgoal_tac "\<exists>n::nat. ~ even n & x + pi/2 = real n * (pi/2) ")
   27.72 - apply (clarify, rule_tac x = "n - 1" in exI)
   27.73 - apply (auto elim!: oddE simp add: of_nat_Suc field_simps)[1]
   27.74 - apply (rule cos_zero_lemma)
   27.75 - apply (auto simp: cos_add)
   27.76 -done
   27.77 +     "\<lbrakk>0 \<le> x; sin x = 0\<rbrakk> \<Longrightarrow> \<exists>n::nat. even n & x = real n * (pi/2)"
   27.78 +  using cos_zero_lemma [of "x + pi/2"]
   27.79 +  apply (clarsimp simp add: cos_add)
   27.80 +  apply (rule_tac x = "n - 1" in exI)
   27.81 +  apply (simp add: algebra_simps of_nat_diff)
   27.82 +  done
   27.83  
   27.84  lemma cos_zero_iff:
   27.85 -     "(cos x = 0) =
   27.86 -      ((\<exists>n::nat. odd n & (x = real n * (pi/2))) |
   27.87 -       (\<exists>n::nat. odd n & (x = -(real n * (pi/2)))))"
   27.88 +     "(cos x = 0) \<longleftrightarrow>
   27.89 +      ((\<exists>n. odd n & (x = real n * (pi/2))) \<or> (\<exists>n. odd n & (x = -(real n * (pi/2)))))"
   27.90 +      (is "?lhs = ?rhs")
   27.91  proof -
   27.92    { fix n :: nat
   27.93      assume "odd n"
   27.94      then obtain m where "n = 2 * m + 1" ..
   27.95      then have "cos (real n * pi / 2) = 0"
   27.96 -      by (simp add: field_simps of_nat_Suc) (simp add: cos_add add_divide_distrib)
   27.97 +      by (simp add: field_simps) (simp add: cos_add add_divide_distrib)
   27.98    } note * = this
   27.99    show ?thesis
  27.100 -  apply (rule iffI)
  27.101 -  apply (cut_tac linorder_linear [of 0 x], safe)
  27.102 -  apply (drule cos_zero_lemma, assumption+)
  27.103 -  apply (cut_tac x="-x" in cos_zero_lemma, simp, simp)
  27.104 -  apply (auto dest: *)
  27.105 -  done
  27.106 +  proof
  27.107 +    assume "cos x = 0" then show ?rhs
  27.108 +      using cos_zero_lemma [of x] cos_zero_lemma [of "-x"] by force
  27.109 +  next
  27.110 +    assume ?rhs then show "cos x = 0" 
  27.111 +    by (auto dest: * simp del: eq_divide_eq_numeral1)
  27.112 +  qed
  27.113  qed
  27.114  
  27.115 -(* ditto: but to a lesser extent *)
  27.116  lemma sin_zero_iff:
  27.117 -     "(sin x = 0) =
  27.118 -      ((\<exists>n::nat. even n & (x = real n * (pi/2))) |
  27.119 -       (\<exists>n::nat. even n & (x = -(real n * (pi/2)))))"
  27.120 -apply (rule iffI)
  27.121 -apply (cut_tac linorder_linear [of 0 x], safe)
  27.122 -apply (drule sin_zero_lemma, assumption+)
  27.123 -apply (cut_tac x="-x" in sin_zero_lemma, simp, simp, safe)
  27.124 -apply (force simp add: minus_equation_iff [of x])
  27.125 -apply (auto elim: evenE)
  27.126 -done
  27.127 -
  27.128 +     "(sin x = 0) \<longleftrightarrow>
  27.129 +      ((\<exists>n. even n & (x = real n * (pi/2))) \<or> (\<exists>n. even n & (x = -(real n * (pi/2)))))"
  27.130 +      (is "?lhs = ?rhs")
  27.131 +proof
  27.132 +  assume "sin x = 0" then show ?rhs
  27.133 +    using sin_zero_lemma [of x] sin_zero_lemma [of "-x"] by force
  27.134 +next
  27.135 +  assume ?rhs then show "sin x = 0" 
  27.136 +    by (auto elim: evenE)
  27.137 +qed
  27.138  
  27.139  lemma cos_zero_iff_int:
  27.140 -     "cos x = 0 \<longleftrightarrow> (\<exists>n::int. odd n \<and> x = of_int n * (pi/2))"
  27.141 +     "cos x = 0 \<longleftrightarrow> (\<exists>n. odd n \<and> x = of_int n * (pi/2))"
  27.142  proof safe
  27.143    assume "cos x = 0"
  27.144 -  then show "\<exists>n::int. odd n & x = of_int n * (pi/2)"
  27.145 +  then show "\<exists>n. odd n & x = of_int n * (pi/2)"
  27.146      apply (simp add: cos_zero_iff, safe)
  27.147      apply (metis even_int_iff of_int_of_nat_eq)
  27.148      apply (rule_tac x="- (int n)" in exI, simp)
  27.149 @@ -3634,18 +3633,16 @@
  27.150    assume "odd n"
  27.151    then show "cos (of_int n * (pi / 2)) = 0"
  27.152      apply (simp add: cos_zero_iff)
  27.153 -    apply (case_tac n rule: int_cases2, simp)
  27.154 -    apply (rule disjI2)
  27.155 -    apply (rule_tac x="nat (-n)" in exI, simp)
  27.156 +    apply (case_tac n rule: int_cases2, simp_all)
  27.157      done
  27.158  qed
  27.159  
  27.160  lemma sin_zero_iff_int:
  27.161 -     "sin x = 0 \<longleftrightarrow> (\<exists>n::int. even n & (x = of_int n * (pi/2)))"
  27.162 +     "sin x = 0 \<longleftrightarrow> (\<exists>n. even n & (x = of_int n * (pi/2)))"
  27.163  proof safe
  27.164    assume "sin x = 0"
  27.165 -  then show "\<exists>n::int. even n \<and> x = of_int n * (pi / 2)"
  27.166 -    apply (simp add: sin_zero_iff, safe)
  27.167 +  then show "\<exists>n. even n \<and> x = of_int n * (pi / 2)"
  27.168 +    apply (simp add: sin_zero_iff, safe)    
  27.169      apply (metis even_int_iff of_int_of_nat_eq)
  27.170      apply (rule_tac x="- (int n)" in exI, simp)
  27.171      done
  27.172 @@ -3654,9 +3651,7 @@
  27.173    assume "even n"
  27.174    then show "sin (of_int n * (pi / 2)) = 0"
  27.175      apply (simp add: sin_zero_iff)
  27.176 -    apply (case_tac n rule: int_cases2, simp)
  27.177 -    apply (rule disjI2)
  27.178 -    apply (rule_tac x="nat (-n)" in exI, simp)
  27.179 +    apply (case_tac n rule: int_cases2, simp_all)
  27.180      done
  27.181  qed
  27.182  
  27.183 @@ -4907,20 +4902,16 @@
  27.184  lemma machin_Euler: "5 * arctan(1/7) + 2 * arctan(3/79) = pi/4"
  27.185  proof -
  27.186    have 17: "\<bar>1/7\<bar> < (1 :: real)" by auto
  27.187 -  with arctan_double
  27.188 -  have "2 * arctan (1/7) = arctan (7/24)"  by auto
  27.189 -  moreover
  27.190 -  have "\<bar>7/24\<bar> < (1 :: real)" by auto
  27.191 -  with arctan_double
  27.192 -  have "2 * arctan (7/24) = arctan (336/527)"  by auto
  27.193 -  moreover
  27.194 -  have "\<bar>336/527\<bar> < (1 :: real)" by auto
  27.195 +  with arctan_double have "2 * arctan (1/7) = arctan (7/24)" 
  27.196 +    by simp (simp add: field_simps)
  27.197 +  moreover have "\<bar>7/24\<bar> < (1 :: real)" by auto
  27.198 +  with arctan_double have "2 * arctan (7/24) = arctan (336/527)"  by simp (simp add: field_simps)
  27.199 +  moreover have "\<bar>336/527\<bar> < (1 :: real)" by auto
  27.200    from arctan_add[OF less_imp_le[OF 17] this]
  27.201    have "arctan(1/7) + arctan (336/527) = arctan (2879/3353)"  by auto
  27.202    ultimately have I: "5 * arctan(1/7) = arctan (2879/3353)"  by auto
  27.203    have 379: "\<bar>3/79\<bar> < (1 :: real)" by auto
  27.204 -  with arctan_double
  27.205 -  have II: "2 * arctan (3/79) = arctan (237/3116)"  by auto
  27.206 +  with arctan_double have II: "2 * arctan (3/79) = arctan (237/3116)"  by simp (simp add: field_simps)
  27.207    have *: "\<bar>2879/3353\<bar> < (1 :: real)" by auto
  27.208    have "\<bar>237/3116\<bar> < (1 :: real)" by auto
  27.209    from arctan_add[OF less_imp_le[OF *] this]
  27.210 @@ -5011,9 +5002,8 @@
  27.211    qed
  27.212  qed
  27.213  
  27.214 -text\<open>FIXME: generalise from the reals via type classes?\<close>
  27.215  lemma summable_arctan_series:
  27.216 -  fixes x :: real and n :: nat
  27.217 +  fixes n :: nat
  27.218    assumes "\<bar>x\<bar> \<le> 1"
  27.219    shows "summable (\<lambda> k. (-1)^k * (1 / real (k*2+1) * x ^ (k*2+1)))"
  27.220    (is "summable (?c x)")
  27.221 @@ -5467,7 +5457,7 @@
  27.222    shows "(\<Sum>i\<le>m. (a i) * x ^ i) * (\<Sum>j\<le>n. (b j) * x ^ j) =
  27.223           (\<Sum>r\<le>m + n. (\<Sum>k\<le>r. (a k) * (b (r - k))) * x ^ r)"
  27.224    using polynomial_product [of m a n b x] assms
  27.225 -  by (simp only: of_nat_mult [symmetric] of_nat_power [symmetric] int_int_eq Int.int_setsum [symmetric])
  27.226 +  by (simp only: of_nat_mult [symmetric] of_nat_power [symmetric] of_nat_eq_iff Int.int_setsum [symmetric])
  27.227  
  27.228  lemma polyfun_diff: (*COMPLEX_SUB_POLYFUN in HOL Light*)
  27.229      fixes x :: "'a::idom"
    28.1 --- a/src/HOL/ex/Sum_of_Powers.thy	Tue Nov 17 12:01:19 2015 +0100
    28.2 +++ b/src/HOL/ex/Sum_of_Powers.thy	Tue Nov 17 12:32:08 2015 +0000
    28.3 @@ -189,7 +189,7 @@
    28.4      by (auto simp add: sum_of_powers)
    28.5    also have "... = ((n ^ 2 + n) / 2) ^ 2"
    28.6      by (simp add: unroll algebra_simps power2_eq_square power4_eq power3_eq_cube)
    28.7 -  finally show ?thesis by simp
    28.8 +  finally show ?thesis by (simp add: power_divide)
    28.9  qed
   28.10                         
   28.11  lemma sum_of_cubes_nat: "(\<Sum>k\<le>n::nat. k ^ 3) = (n ^ 2 + n) ^ 2 div 4"