src/HOL/Decision_Procs/MIR.thy
 changeset 61694 6571c78c9667 parent 61652 90c65a811257 child 61762 d50b993b4fb9
```     1.1 --- a/src/HOL/Decision_Procs/MIR.thy	Tue Nov 17 12:01:19 2015 +0100
1.2 +++ b/src/HOL/Decision_Procs/MIR.thy	Tue Nov 17 12:32:08 2015 +0000
1.3 @@ -28,15 +28,15 @@
1.4  definition rdvd:: "real \<Rightarrow> real \<Rightarrow> bool" (infixl "rdvd" 50)
1.5    where "x rdvd y \<longleftrightarrow> (\<exists>k::int. y = x * real_of_int k)"
1.6
1.7 -lemma int_rdvd_real:
1.8 +lemma int_rdvd_real:
1.9    "real_of_int (i::int) rdvd x = (i dvd (floor x) \<and> real_of_int (floor x) = x)" (is "?l = ?r")
1.10  proof
1.11 -  assume "?l"
1.12 +  assume "?l"
1.13    hence th: "\<exists> k. x=real_of_int (i*k)" by (simp add: rdvd_def)
1.14    hence th': "real_of_int (floor x) = x" by (auto simp del: of_int_mult)
1.15    with th have "\<exists> k. real_of_int (floor x) = real_of_int (i*k)" by simp
1.16    hence "\<exists> k. floor x = i*k" by presburger
1.17 -  thus ?r  using th' by (simp add: dvd_def)
1.18 +  thus ?r  using th' by (simp add: dvd_def)
1.19  next
1.20    assume "?r" hence "(i::int) dvd \<lfloor>x::real\<rfloor>" ..
1.21    hence "\<exists> k. real_of_int (floor x) = real_of_int (i*k)"
1.22 @@ -55,7 +55,7 @@
1.23      by auto
1.24
1.25    from iffD2[OF abs_dvd_iff] d2 have "(abs d) dvd (floor t)" by blast
1.26 -  with ti int_rdvd_real[symmetric] have "real_of_int (abs d) rdvd t" by blast
1.27 +  with ti int_rdvd_real[symmetric] have "real_of_int (abs d) rdvd t" by blast
1.28    thus "abs (real_of_int d) rdvd t" by simp
1.29  next
1.30    assume "abs (real_of_int d) rdvd t" hence "real_of_int (abs d) rdvd t" by simp
1.31 @@ -67,14 +67,14 @@
1.32
1.33  lemma rdvd_minus: "(real_of_int (d::int) rdvd t) = (real_of_int d rdvd -t)"
1.34    apply (auto simp add: rdvd_def)
1.35 -  apply (rule_tac x="-k" in exI, simp)
1.36 +  apply (rule_tac x="-k" in exI, simp)
1.37    apply (rule_tac x="-k" in exI, simp)
1.38    done
1.39
1.40  lemma rdvd_left_0_eq: "(0 rdvd t) = (t=0)"
1.41    by (auto simp add: rdvd_def)
1.42
1.43 -lemma rdvd_mult:
1.44 +lemma rdvd_mult:
1.45    assumes knz: "k\<noteq>0"
1.46    shows "(real_of_int (n::int) * real_of_int (k::int) rdvd x * real_of_int k) = (real_of_int n rdvd x)"
1.47    using knz by (simp add: rdvd_def)
1.48 @@ -83,7 +83,7 @@
1.49    (****                            SHADOW SYNTAX AND SEMANTICS                  ****)
1.50    (*********************************************************************************)
1.51
1.52 -datatype num = C int | Bound nat | CN nat int num | Neg num | Add num num| Sub num num
1.53 +datatype num = C int | Bound nat | CN nat int num | Neg num | Add num num| Sub num num
1.54    | Mul int num | Floor num| CF int num num
1.55
1.56    (* A size for num to make inductive proofs simpler*)
1.57 @@ -132,17 +132,17 @@
1.58  proof-
1.59    let ?I = "\<lambda> t. Inum bs t"
1.60    assume ie: "isint e bs"
1.61 -  hence th: "real_of_int (floor (?I e)) = ?I e" by (simp add: isint_def)
1.62 +  hence th: "real_of_int (floor (?I e)) = ?I e" by (simp add: isint_def)
1.63    have "real_of_int (floor (?I (Neg e))) = real_of_int (floor (- (real_of_int (floor (?I e)))))" by (simp add: th)
1.64    also have "\<dots> = - real_of_int (floor (?I e))" by simp
1.65    finally show "isint (Neg e) bs" by (simp add: isint_def th)
1.66  qed
1.67
1.68 -lemma isint_sub:
1.69 +lemma isint_sub:
1.70    assumes ie: "isint e bs" shows "isint (Sub (C c) e) bs"
1.71  proof-
1.72    let ?I = "\<lambda> t. Inum bs t"
1.73 -  from ie have th: "real_of_int (floor (?I e)) = ?I e" by (simp add: isint_def)
1.74 +  from ie have th: "real_of_int (floor (?I e)) = ?I e" by (simp add: isint_def)
1.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)
1.76    also have "\<dots> = real_of_int (c- floor (?I e))" by simp
1.77    finally show "isint (Sub (C c) e) bs" by (simp add: isint_def th)
1.78 @@ -166,7 +166,7 @@
1.79
1.80
1.81      (* FORMULAE *)
1.82 -datatype fm  =
1.83 +datatype fm  =
1.84    T| F| Lt num| Le num| Gt num| Ge num| Eq num| NEq num| Dvd int num| NDvd int num|
1.85    NOT fm| And fm fm|  Or fm fm| Imp fm fm| Iff fm fm| E fm| A fm
1.86
1.87 @@ -213,7 +213,7 @@
1.88    "prep (E F) = F"
1.89    "prep (E (Or p q)) = Or (prep (E p)) (prep (E q))"
1.90    "prep (E (Imp p q)) = Or (prep (E (NOT p))) (prep (E q))"
1.91 -  "prep (E (Iff p q)) = Or (prep (E (And p q))) (prep (E (And (NOT p) (NOT q))))"
1.92 +  "prep (E (Iff p q)) = Or (prep (E (And p q))) (prep (E (And (NOT p) (NOT q))))"
1.93    "prep (E (NOT (And p q))) = Or (prep (E (NOT p))) (prep (E(NOT q)))"
1.94    "prep (E (NOT (Imp p q))) = prep (E (And p (NOT q)))"
1.95    "prep (E (NOT (Iff p q))) = Or (prep (E (And p (NOT q)))) (prep (E(And (NOT p) q)))"
1.96 @@ -241,10 +241,10 @@
1.97  fun qfree:: "fm \<Rightarrow> bool" where
1.98    "qfree (E p) = False"
1.99    | "qfree (A p) = False"
1.100 -  | "qfree (NOT p) = qfree p"
1.101 -  | "qfree (And p q) = (qfree p \<and> qfree q)"
1.102 -  | "qfree (Or  p q) = (qfree p \<and> qfree q)"
1.103 -  | "qfree (Imp p q) = (qfree p \<and> qfree q)"
1.104 +  | "qfree (NOT p) = qfree p"
1.105 +  | "qfree (And p q) = (qfree p \<and> qfree q)"
1.106 +  | "qfree (Or  p q) = (qfree p \<and> qfree q)"
1.107 +  | "qfree (Imp p q) = (qfree p \<and> qfree q)"
1.108    | "qfree (Iff p q) = (qfree p \<and> qfree q)"
1.109    | "qfree p = True"
1.110
1.111 @@ -255,20 +255,20 @@
1.112    | "numbound0 (CN n i a) = (n > 0 \<and> numbound0 a)"
1.113    | "numbound0 (Neg a) = numbound0 a"
1.114    | "numbound0 (Add a b) = (numbound0 a \<and> numbound0 b)"
1.115 -  | "numbound0 (Sub a b) = (numbound0 a \<and> numbound0 b)"
1.116 +  | "numbound0 (Sub a b) = (numbound0 a \<and> numbound0 b)"
1.117    | "numbound0 (Mul i a) = numbound0 a"
1.118    | "numbound0 (Floor a) = numbound0 a"
1.119 -  | "numbound0 (CF c a b) = (numbound0 a \<and> numbound0 b)"
1.120 +  | "numbound0 (CF c a b) = (numbound0 a \<and> numbound0 b)"
1.121
1.122  lemma numbound0_I:
1.123    assumes nb: "numbound0 a"
1.124    shows "Inum (b#bs) a = Inum (b'#bs) a"
1.125    using nb by (induct a) auto
1.126
1.127 -lemma numbound0_gen:
1.128 +lemma numbound0_gen:
1.129    assumes nb: "numbound0 t" and ti: "isint t (x#bs)"
1.130    shows "\<forall> y. isint t (y#bs)"
1.131 -  using nb ti
1.132 +  using nb ti
1.133  proof(clarify)
1.134    fix y
1.135    from numbound0_I[OF nb, where bs="bs" and b="y" and b'="x"] ti[simplified isint_def]
1.136 @@ -308,7 +308,7 @@
1.137    | "numsubst0 t (CF i a b) = CF i (numsubst0 t a) (numsubst0 t b)"
1.138    | "numsubst0 t (Neg a) = Neg (numsubst0 t a)"
1.139    | "numsubst0 t (Add a b) = Add (numsubst0 t a) (numsubst0 t b)"
1.140 -  | "numsubst0 t (Sub a b) = Sub (numsubst0 t a) (numsubst0 t b)"
1.141 +  | "numsubst0 t (Sub a b) = Sub (numsubst0 t a) (numsubst0 t b)"
1.142    | "numsubst0 t (Mul i a) = Mul i (numsubst0 t a)"
1.143    | "numsubst0 t (Floor a) = Floor (numsubst0 t a)"
1.144
1.145 @@ -358,7 +358,7 @@
1.146  | "decr (NEq a) = NEq (decrnum a)"
1.147  | "decr (Dvd i a) = Dvd i (decrnum a)"
1.148  | "decr (NDvd i a) = NDvd i (decrnum a)"
1.149 -| "decr (NOT p) = NOT (decr p)"
1.150 +| "decr (NOT p) = NOT (decr p)"
1.151  | "decr (And p q) = And (decr p) (decr q)"
1.152  | "decr (Or p q) = Or (decr p) (decr q)"
1.153  | "decr (Imp p q) = Imp (decr p) (decr q)"
1.154 @@ -404,20 +404,20 @@
1.155
1.156
1.157  definition djf:: "('a \<Rightarrow> fm) \<Rightarrow> 'a \<Rightarrow> fm \<Rightarrow> fm" where
1.158 -  "djf f p q = (if q=T then T else if q=F then f p else
1.159 +  "djf f p q = (if q=T then T else if q=F then f p else
1.160    (let fp = f p in case fp of T \<Rightarrow> T | F \<Rightarrow> q | _ \<Rightarrow> Or fp q))"
1.161
1.162  definition evaldjf:: "('a \<Rightarrow> fm) \<Rightarrow> 'a list \<Rightarrow> fm" where
1.163    "evaldjf f ps = foldr (djf f) ps F"
1.164
1.165  lemma djf_Or: "Ifm bs (djf f p q) = Ifm bs (Or (f p) q)"
1.167 -  (cases "f p", simp_all add: Let_def djf_def)
1.169 +  (cases "f p", simp_all add: Let_def djf_def)
1.170
1.171  lemma evaldjf_ex: "Ifm bs (evaldjf f ps) = (\<exists> p \<in> set ps. Ifm bs (f p))"
1.172    by (induct ps) (simp_all add: evaldjf_def djf_Or)
1.173
1.174 -lemma evaldjf_bound0:
1.175 +lemma evaldjf_bound0:
1.176    assumes nb: "\<forall> x\<in> set xs. bound0 (f x)"
1.177    shows "bound0 (evaldjf f xs)"
1.178    using nb
1.179 @@ -427,7 +427,7 @@
1.180    apply auto
1.181    done
1.182
1.183 -lemma evaldjf_qf:
1.184 +lemma evaldjf_qf:
1.185    assumes nb: "\<forall> x\<in> set xs. qfree (f x)"
1.186    shows "qfree (evaldjf f xs)"
1.187    using nb
1.188 @@ -474,12 +474,12 @@
1.189    shows "Ifm bs (DJ f p) = Ifm bs (f p)"
1.190  proof -
1.191    have "Ifm bs (DJ f p) = (\<exists> q \<in> set (disjuncts p). Ifm bs (f q))"
1.192 -    by (simp add: DJ_def evaldjf_ex)
1.193 +    by (simp add: DJ_def evaldjf_ex)
1.194    also have "\<dots> = Ifm bs (f p)" using fdj fF by (induct p rule: disjuncts.induct, auto)
1.195    finally show ?thesis .
1.196  qed
1.197
1.198 -lemma DJ_qf: assumes
1.199 +lemma DJ_qf: assumes
1.200    fqf: "\<forall> p. qfree p \<longrightarrow> qfree (f p)"
1.201    shows "\<forall>p. qfree p \<longrightarrow> qfree (DJ f p) "
1.202  proof(clarify)
1.203 @@ -487,7 +487,7 @@
1.204    have th: "DJ f p = evaldjf f (disjuncts p)" by (simp add: DJ_def)
1.205    from disjuncts_qf[OF qf] have "\<forall> q\<in> set (disjuncts p). qfree q" .
1.206    with fqf have th':"\<forall> q\<in> set (disjuncts p). qfree (f q)" by blast
1.207 -
1.208 +
1.209    from evaldjf_qf[OF th'] th show "qfree (DJ f p)" by simp
1.210  qed
1.211
1.212 @@ -551,7 +551,7 @@
1.213  definition reducecoeff :: "num \<Rightarrow> num"
1.214  where
1.215    "reducecoeff t =
1.216 -    (let g = numgcd t in
1.217 +    (let g = numgcd t in
1.218       if g = 0 then C 0 else if g=1 then t else reducecoeffh t g)"
1.219
1.220  fun dvdnumcoeff:: "num \<Rightarrow> int \<Rightarrow> bool" where
1.221 @@ -560,10 +560,10 @@
1.222  | "dvdnumcoeff (CF c s t) = (\<lambda> g. g dvd c \<and> (dvdnumcoeff t g))"
1.223  | "dvdnumcoeff t = (\<lambda>g. False)"
1.224
1.225 -lemma dvdnumcoeff_trans:
1.226 +lemma dvdnumcoeff_trans:
1.227    assumes gdg: "g dvd g'" and dgt':"dvdnumcoeff t g'"
1.228    shows "dvdnumcoeff t g"
1.229 -  using dgt' gdg
1.230 +  using dgt' gdg
1.231    by (induct t rule: dvdnumcoeff.induct) (simp_all add: gdg dvd_trans[OF gdg])
1.232
1.234 @@ -584,10 +584,10 @@
1.235    by (simp add: numgcd_def numgcdh_pos maxcoeff_pos)
1.236
1.237  lemma reducecoeffh:
1.238 -  assumes gt: "dvdnumcoeff t g" and gp: "g > 0"
1.239 +  assumes gt: "dvdnumcoeff t g" and gp: "g > 0"
1.240    shows "real_of_int g *(Inum bs (reducecoeffh t g)) = Inum bs t"
1.241    using gt
1.242 -proof(induct t rule: reducecoeffh.induct)
1.243 +proof(induct t rule: reducecoeffh.induct)
1.244    case (1 i) hence gd: "g dvd i" by simp
1.245    from assms 1 show ?case by (simp add: real_of_int_div[OF gd])
1.246  next
1.247 @@ -595,7 +595,7 @@
1.248    from assms 2 show ?case by (simp add: real_of_int_div[OF gd] algebra_simps)
1.249  next
1.250    case (3 c s t)  hence gd: "g dvd c" by simp
1.251 -  from assms 3 show ?case by (simp add: real_of_int_div[OF gd] algebra_simps)
1.252 +  from assms 3 show ?case by (simp add: real_of_int_div[OF gd] algebra_simps)
1.253  qed (auto simp add: numgcd_def gp)
1.254
1.255  fun ismaxcoeff:: "num \<Rightarrow> int \<Rightarrow> bool" where
1.256 @@ -614,7 +614,7 @@
1.257    have thh: "maxcoeff t \<le> max (abs c) (maxcoeff t)" by simp
1.258    from ismaxcoeff_mono[OF H thh] show ?case by simp
1.259  next
1.260 -  case (3 c t s)
1.261 +  case (3 c t s)
1.262    hence H1:"ismaxcoeff s (maxcoeff s)" by auto
1.263    have thh1: "maxcoeff s \<le> max \<bar>c\<bar> (maxcoeff s)" by (simp add: max_def)
1.264    from ismaxcoeff_mono[OF H1 thh1] show ?case by simp
1.265 @@ -637,7 +637,7 @@
1.266    shows "dvdnumcoeff t (numgcdh t m)"
1.267  using assms
1.268  proof(induct t rule: numgcdh.induct)
1.269 -  case (2 n c t)
1.270 +  case (2 n c t)
1.271    let ?g = "numgcdh t m"
1.272    from 2 have th:"gcd c ?g > 1" by simp
1.273    from zgcd_gt1[OF th] numgcdh_pos[OF mp, where t="t"]
1.274 @@ -651,11 +651,11 @@
1.275      have th': "gcd c ?g dvd ?g" by simp
1.276      from dvdnumcoeff_trans[OF th' th] have ?case by simp
1.277      hence ?case by simp }
1.278 -  moreover {assume "abs c > 1" and g0:"?g = 0"
1.279 +  moreover {assume "abs c > 1" and g0:"?g = 0"
1.280      from numgcdh0[OF g0] have "m=0". with 2 g0 have ?case by simp }
1.281    ultimately show ?case by blast
1.282  next
1.283 -  case (3 c s t)
1.284 +  case (3 c s t)
1.285    let ?g = "numgcdh t m"
1.286    from 3 have th:"gcd c ?g > 1" by simp
1.287    from zgcd_gt1[OF th] numgcdh_pos[OF mp, where t="t"]
1.288 @@ -669,14 +669,14 @@
1.289      have th': "gcd c ?g dvd ?g" by simp
1.290      from dvdnumcoeff_trans[OF th' th] have ?case by simp
1.291      hence ?case by simp }
1.292 -  moreover {assume "abs c > 1" and g0:"?g = 0"
1.293 +  moreover {assume "abs c > 1" and g0:"?g = 0"
1.294      from numgcdh0[OF g0] have "m=0". with 3 g0 have ?case by simp }
1.295    ultimately show ?case by blast
1.296  qed auto
1.297
1.298  lemma dvdnumcoeff_aux2:
1.299    assumes "numgcd t > 1" shows "dvdnumcoeff t (numgcd t) \<and> numgcd t > 0"
1.300 -  using assms
1.301 +  using assms
1.303    let ?mc = "maxcoeff t"
1.304    let ?g = "numgcdh t ?mc"
1.305 @@ -691,12 +691,12 @@
1.306    let ?g = "numgcd t"
1.307    have "?g \<ge> 0"  by (simp add: numgcd_pos)
1.308    hence "?g = 0 \<or> ?g = 1 \<or> ?g > 1" by auto
1.309 -  moreover {assume "?g = 0" hence ?thesis by (simp add: numgcd0)}
1.310 -  moreover {assume "?g = 1" hence ?thesis by (simp add: reducecoeff_def)}
1.311 +  moreover {assume "?g = 0" hence ?thesis by (simp add: numgcd0)}
1.312 +  moreover {assume "?g = 1" hence ?thesis by (simp add: reducecoeff_def)}
1.313    moreover { assume g1:"?g > 1"
1.314      from dvdnumcoeff_aux2[OF g1] have th1:"dvdnumcoeff t ?g" and g0: "?g > 0" by blast+
1.315 -    from reducecoeffh[OF th1 g0, where bs="bs"] g1 have ?thesis
1.316 -      by (simp add: reducecoeff_def Let_def)}
1.317 +    from reducecoeffh[OF th1 g0, where bs="bs"] g1 have ?thesis
1.318 +      by (simp add: reducecoeff_def Let_def)}
1.319    ultimately show ?thesis by blast
1.320  qed
1.321
1.322 @@ -709,15 +709,15 @@
1.323  consts numadd:: "num \<times> num \<Rightarrow> num"
1.324  recdef numadd "measure (\<lambda> (t,s). size t + size s)"
1.325    "numadd (CN n1 c1 r1,CN n2 c2 r2) =
1.326 -  (if n1=n2 then
1.327 +  (if n1=n2 then
1.328    (let c = c1 + c2
1.329    in (if c=0 then numadd(r1,r2) else CN n1 c (numadd (r1,r2))))
1.330    else if n1 \<le> n2 then CN n1 c1 (numadd (r1,CN n2 c2 r2))
1.331    else (CN n2 c2 (numadd (CN n1 c1 r1,r2))))"
1.332 -  "numadd (CN n1 c1 r1,t) = CN n1 c1 (numadd (r1, t))"
1.333 -  "numadd (t,CN n2 c2 r2) = CN n2 c2 (numadd (t,r2))"
1.334 -  "numadd (CF c1 t1 r1,CF c2 t2 r2) =
1.335 -   (if t1 = t2 then
1.336 +  "numadd (CN n1 c1 r1,t) = CN n1 c1 (numadd (r1, t))"
1.337 +  "numadd (t,CN n2 c2 r2) = CN n2 c2 (numadd (t,r2))"
1.338 +  "numadd (CF c1 t1 r1,CF c2 t2 r2) =
1.339 +   (if t1 = t2 then
1.340      (let c=c1+c2; s= numadd(r1,r2) in (if c=0 then s else CF c t1 s))
1.341     else if lex_bnd t1 t2 then CF c1 t1 (numadd(r1,CF c2 t2 r2))
1.342     else CF c2 t2 (numadd(CF c1 t1 r1,r2)))"
1.343 @@ -775,7 +775,7 @@
1.344  lemma isint_CF: assumes si: "isint s bs" shows "isint (CF c t s) bs"
1.345  proof-
1.346    have cti: "isint (Mul c (Floor t)) bs" by (simp add: isint_Mul isint_Floor)
1.347 -
1.348 +
1.349    have "?thesis = isint (Add (Mul c (Floor t)) s) bs" by (simp add: isint_def)
1.351    finally show ?thesis .
1.352 @@ -783,11 +783,11 @@
1.353
1.354  fun split_int:: "num \<Rightarrow> num \<times> num" where
1.355    "split_int (C c) = (C 0, C c)"
1.356 -| "split_int (CN n c b) =
1.357 -     (let (bv,bi) = split_int b
1.358 +| "split_int (CN n c b) =
1.359 +     (let (bv,bi) = split_int b
1.360         in (CN n c bv, bi))"
1.361 -| "split_int (CF c a b) =
1.362 -     (let (bv,bi) = split_int b
1.363 +| "split_int (CF c a b) =
1.364 +     (let (bv,bi) = split_int b
1.365         in (bv, CF c a bi))"
1.366  | "split_int a = (a,C 0)"
1.367
1.368 @@ -801,7 +801,7 @@
1.369    from 2(2) have tibi: "ti = ?bi" by (simp add: Let_def split_def)
1.370    from 2(2) b[symmetric] bii show ?case by (auto simp add: Let_def split_def)
1.371  next
1.372 -  case (3 c a b tv ti)
1.373 +  case (3 c a b tv ti)
1.374    let ?bv = "fst (split_int b)"
1.375    let ?bi = "snd (split_int b)"
1.376    have "split_int b = (?bv,?bi)" by simp
1.377 @@ -817,8 +817,8 @@
1.378
1.379  definition numfloor:: "num \<Rightarrow> num"
1.380  where
1.381 -  "numfloor t = (let (tv,ti) = split_int t in
1.382 -  (case tv of C i \<Rightarrow> numadd (tv,ti)
1.383 +  "numfloor t = (let (tv,ti) = split_int t in
1.384 +  (case tv of C i \<Rightarrow> numadd (tv,ti)
1.385    | _ \<Rightarrow> numadd(CF 1 tv (C 0),ti)))"
1.386
1.387  lemma numfloor[simp]: "Inum bs (numfloor t) = Inum bs (Floor t)" (is "?n t = ?N (Floor t)")
1.388 @@ -827,17 +827,17 @@
1.389    let ?ti = "snd (split_int t)"
1.390    have tvti:"split_int t = (?tv,?ti)" by simp
1.391    {assume H: "\<forall> v. ?tv \<noteq> C v"
1.392 -    hence th1: "?n t = ?N (Add (Floor ?tv) ?ti)"
1.393 +    hence th1: "?n t = ?N (Add (Floor ?tv) ?ti)"
1.394        by (cases ?tv) (auto simp add: numfloor_def Let_def split_def)
1.395      from split_int[OF tvti] have "?N (Floor t) = ?N (Floor(Add ?tv ?ti))" and tii:"isint ?ti bs" by simp+
1.396 -    hence "?N (Floor t) = real_of_int (floor (?N (Add ?tv ?ti)))" by simp
1.397 +    hence "?N (Floor t) = real_of_int (floor (?N (Add ?tv ?ti)))" by simp
1.398      also have "\<dots> = real_of_int (floor (?N ?tv) + (floor (?N ?ti)))"
1.399        by (simp,subst tii[simplified isint_iff, symmetric]) simp
1.400      also have "\<dots> = ?N (Add (Floor ?tv) ?ti)" by (simp add: tii[simplified isint_iff])
1.401      finally have ?thesis using th1 by simp}
1.402 -  moreover {fix v assume H:"?tv = C v"
1.403 +  moreover {fix v assume H:"?tv = C v"
1.404      from split_int[OF tvti] have "?N (Floor t) = ?N (Floor(Add ?tv ?ti))" and tii:"isint ?ti bs" by simp+
1.405 -    hence "?N (Floor t) = real_of_int (floor (?N (Add ?tv ?ti)))" by simp
1.406 +    hence "?N (Floor t) = real_of_int (floor (?N (Add ?tv ?ti)))" by simp
1.407      also have "\<dots> = real_of_int (floor (?N ?tv) + (floor (?N ?ti)))"
1.408        by (simp,subst tii[simplified isint_iff, symmetric]) simp
1.409      also have "\<dots> = ?N (Add (Floor ?tv) ?ti)" by (simp add: tii[simplified isint_iff])
1.410 @@ -906,7 +906,7 @@
1.411    with cnz have "max (abs c) (maxcoeff t) > 0" by arith
1.412    with 2 show ?case by simp
1.413  next
1.414 -  case (3 c s t)
1.415 +  case (3 c s t)
1.416    hence cnz: "c \<noteq>0" and mx: "max (abs c) (maxcoeff t) = 0" by simp+
1.417    have "max (abs c) (maxcoeff t) \<ge> abs c" by simp
1.418    with cnz have "max (abs c) (maxcoeff t) > 0" by arith
1.419 @@ -922,10 +922,10 @@
1.420
1.421  definition simp_num_pair :: "(num \<times> int) \<Rightarrow> num \<times> int" where
1.422    "simp_num_pair \<equiv> (\<lambda> (t,n). (if n = 0 then (C 0, 0) else
1.423 -   (let t' = simpnum t ; g = numgcd t' in
1.424 -      if g > 1 then (let g' = gcd n g in
1.425 -        if g' = 1 then (t',n)
1.426 -        else (reducecoeffh t' g', n div g'))
1.427 +   (let t' = simpnum t ; g = numgcd t' in
1.428 +      if g > 1 then (let g' = gcd n g in
1.429 +        if g' = 1 then (t',n)
1.430 +        else (reducecoeffh t' g', n div g'))
1.431        else (t',n))))"
1.432
1.433  lemma simp_num_pair_ci:
1.434 @@ -952,7 +952,7 @@
1.435          have gpdg: "?g' dvd ?g" by simp
1.436          have gpdd: "?g' dvd n" by simp
1.437          have gpdgp: "?g' dvd ?g'" by simp
1.438 -        from reducecoeffh[OF dvdnumcoeff_trans[OF gpdg th1] g'p]
1.439 +        from reducecoeffh[OF dvdnumcoeff_trans[OF gpdg th1] g'p]
1.440          have th2:"real_of_int ?g' * ?t = Inum bs ?t'" by simp
1.441          from nnz g1 g'1 have "?lhs = ?t / real_of_int (n div ?g')" by (simp add: simp_num_pair_def Let_def)
1.442          also have "\<dots> = (real_of_int ?g' * ?t) / (real_of_int ?g' * (real_of_int (n div ?g')))" by simp
1.443 @@ -993,7 +993,7 @@
1.444          hence ?thesis using assms g1 g'1
1.445            by(auto simp add: simp_num_pair_def Let_def reducecoeffh_numbound0)}
1.446        ultimately have ?thesis by blast }
1.447 -    ultimately have ?thesis by blast }
1.448 +    ultimately have ?thesis by blast }
1.449    ultimately show ?thesis by blast
1.450  qed
1.451
1.452 @@ -1020,29 +1020,29 @@
1.453    by (induct p) auto
1.454
1.455  definition conj :: "fm \<Rightarrow> fm \<Rightarrow> fm" where
1.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
1.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
1.458     if p = q then p else And p q)"
1.459  lemma conj[simp]: "Ifm bs (conj p q) = Ifm bs (And p q)"
1.460    by (cases "p=F \<or> q=F", simp_all add: conj_def) (cases p, simp_all)
1.461
1.462  lemma conj_qf[simp]: "\<lbrakk>qfree p ; qfree q\<rbrakk> \<Longrightarrow> qfree (conj p q)"
1.463 -  using conj_def by auto
1.464 +  using conj_def by auto
1.465  lemma conj_nb[simp]: "\<lbrakk>bound0 p ; bound0 q\<rbrakk> \<Longrightarrow> bound0 (conj p q)"
1.466 -  using conj_def by auto
1.467 +  using conj_def by auto
1.468
1.469  definition disj :: "fm \<Rightarrow> fm \<Rightarrow> fm" where
1.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
1.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
1.472         else if p=q then p else Or p q)"
1.473
1.474  lemma disj[simp]: "Ifm bs (disj p q) = Ifm bs (Or p q)"
1.475    by (cases "p=T \<or> q=T",simp_all add: disj_def) (cases p,simp_all)
1.476  lemma disj_qf[simp]: "\<lbrakk>qfree p ; qfree q\<rbrakk> \<Longrightarrow> qfree (disj p q)"
1.477 -  using disj_def by auto
1.478 +  using disj_def by auto
1.479  lemma disj_nb[simp]: "\<lbrakk>bound0 p ; bound0 q\<rbrakk> \<Longrightarrow> bound0 (disj p q)"
1.480 -  using disj_def by auto
1.481 +  using disj_def by auto
1.482
1.483  definition imp :: "fm \<Rightarrow> fm \<Rightarrow> fm" where
1.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
1.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
1.486      else Imp p q)"
1.487  lemma imp[simp]: "Ifm bs (imp p q) = Ifm bs (Imp p q)"
1.488    by (cases "p=F \<or> q=T",simp_all add: imp_def)
1.489 @@ -1050,8 +1050,8 @@
1.490    using imp_def by (cases "p=F \<or> q=T",simp_all add: imp_def)
1.491
1.492  definition iff :: "fm \<Rightarrow> fm \<Rightarrow> fm" where
1.493 -  "iff p q \<equiv> (if (p = q) then T else if (p = not q \<or> not p = q) then F else
1.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
1.495 +  "iff p q \<equiv> (if (p = q) then T else if (p = not q \<or> not p = q) then F else
1.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
1.497    Iff p q)"
1.498
1.499  lemma iff[simp]: "Ifm bs (iff p q) = Ifm bs (Iff p q)"
1.500 @@ -1074,7 +1074,7 @@
1.501  lemma rdvd_left1_int: "real_of_int \<lfloor>t\<rfloor> = t \<Longrightarrow> 1 rdvd t"
1.502    by (simp add: rdvd_def,rule_tac x="\<lfloor>t\<rfloor>" in exI) simp
1.503
1.504 -lemma rdvd_reduce:
1.505 +lemma rdvd_reduce:
1.506    assumes gd:"g dvd d" and gc:"g dvd c" and gp: "g > 0"
1.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)"
1.508  proof
1.509 @@ -1095,13 +1095,13 @@
1.510  qed
1.511
1.512  definition simpdvd :: "int \<Rightarrow> num \<Rightarrow> (int \<times> num)" where
1.513 -  "simpdvd d t \<equiv>
1.514 -   (let g = numgcd t in
1.515 -      if g > 1 then (let g' = gcd d g in
1.516 -        if g' = 1 then (d, t)
1.517 -        else (d div g',reducecoeffh t g'))
1.518 +  "simpdvd d t \<equiv>
1.519 +   (let g = numgcd t in
1.520 +      if g > 1 then (let g' = gcd d g in
1.521 +        if g' = 1 then (d, t)
1.522 +        else (d div g',reducecoeffh t g'))
1.523        else (d, t))"
1.524 -lemma simpdvd:
1.525 +lemma simpdvd:
1.526    assumes tnz: "nozerocoeff t" and dnz: "d \<noteq> 0"
1.527    shows "Ifm bs (Dvd (fst (simpdvd d t)) (snd (simpdvd d t))) = Ifm bs (Dvd d t)"
1.528  proof-
1.529 @@ -1121,13 +1121,13 @@
1.530        have gpdg: "?g' dvd ?g" by simp
1.531        have gpdd: "?g' dvd d" by simp
1.532        have gpdgp: "?g' dvd ?g'" by simp
1.533 -      from reducecoeffh[OF dvdnumcoeff_trans[OF gpdg th1] g'p]
1.534 +      from reducecoeffh[OF dvdnumcoeff_trans[OF gpdg th1] g'p]
1.535        have th2:"real_of_int ?g' * ?t = Inum bs t" by simp
1.536        from assms g1 g0 g'1
1.537        have "Ifm bs (Dvd (fst (simpdvd d t)) (snd(simpdvd d t))) = Ifm bs (Dvd (d div ?g') ?tt)"
1.538          by (simp add: simpdvd_def Let_def)
1.539        also have "\<dots> = (real_of_int d rdvd (Inum bs t))"
1.540 -        using rdvd_reduce[OF gpdd gpdgp g'p, where t="?t", simplified div_self[OF gp0]]
1.541 +        using rdvd_reduce[OF gpdd gpdgp g'p, where t="?t", simplified div_self[OF gp0]]
1.542            th2[symmetric] by simp
1.543        finally have ?thesis by simp  }
1.544      ultimately have ?thesis by blast
1.545 @@ -1141,7 +1141,7 @@
1.546  | "simpfm (Imp p q) = imp (simpfm p) (simpfm q)"
1.547  | "simpfm (Iff p q) = iff (simpfm p) (simpfm q)"
1.548  | "simpfm (NOT p) = not (simpfm p)"
1.549 -| "simpfm (Lt a) = (let a' = simpnum a in case a' of C v \<Rightarrow> if (v < 0) then T else F
1.550 +| "simpfm (Lt a) = (let a' = simpnum a in case a' of C v \<Rightarrow> if (v < 0) then T else F
1.551    | _ \<Rightarrow> Lt (reducecoeff a'))"
1.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'))"
1.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'))"
1.554 @@ -1151,7 +1151,7 @@
1.555  | "simpfm (Dvd i a) = (if i=0 then simpfm (Eq a)
1.556               else if (abs i = 1) \<and> check_int a then T
1.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))"
1.558 -| "simpfm (NDvd i a) = (if i=0 then simpfm (NEq a)
1.559 +| "simpfm (NDvd i a) = (if i=0 then simpfm (NEq a)
1.560               else if (abs i = 1) \<and> check_int a then F
1.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))"
1.562  | "simpfm p = p"
1.563 @@ -1265,22 +1265,22 @@
1.564    case (12 i a)  let ?sa = "simpnum a"   have sa: "Inum bs ?sa = Inum bs a" by simp
1.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
1.566    {assume "i=0" hence ?case using "12.hyps" by (simp add: rdvd_left_0_eq Let_def)}
1.567 -  moreover
1.568 -  {assume ai1: "abs i = 1" and ai: "check_int a"
1.569 +  moreover
1.570 +  {assume ai1: "abs i = 1" and ai: "check_int a"
1.571      hence "i=1 \<or> i= - 1" by arith
1.572 -    moreover {assume i1: "i = 1"
1.573 -      from rdvd_left1_int[OF check_int[OF ai, simplified isint_iff]]
1.574 +    moreover {assume i1: "i = 1"
1.575 +      from rdvd_left1_int[OF check_int[OF ai, simplified isint_iff]]
1.576        have ?case using i1 ai by simp }
1.577 -    moreover {assume i1: "i = - 1"
1.578 -      from rdvd_left1_int[OF check_int[OF ai, simplified isint_iff]]
1.579 +    moreover {assume i1: "i = - 1"
1.580 +      from rdvd_left1_int[OF check_int[OF ai, simplified isint_iff]]
1.581          rdvd_abs1[where d="- 1" and t="Inum bs a"]
1.582        have ?case using i1 ai by simp }
1.583      ultimately have ?case by blast}
1.584 -  moreover
1.585 +  moreover
1.586    {assume inz: "i\<noteq>0" and cond: "(abs i \<noteq> 1) \<or> (\<not> check_int a)"
1.587      {fix v assume "?sa = C v" hence ?case using sa[symmetric] inz cond
1.588          by (cases "abs i = 1", auto simp add: int_rdvd_iff) }
1.589 -    moreover {assume H:"\<not> (\<exists> v. ?sa = C v)"
1.590 +    moreover {assume H:"\<not> (\<exists> v. ?sa = C v)"
1.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)
1.592        from simpnum_nz have nz:"nozerocoeff ?sa" by simp
1.593        from simpdvd [OF nz inz] th have ?case using sa by simp}
1.594 @@ -1290,23 +1290,23 @@
1.595    case (13 i a)  let ?sa = "simpnum a"   have sa: "Inum bs ?sa = Inum bs a" by simp
1.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
1.597    {assume "i=0" hence ?case using "13.hyps" by (simp add: rdvd_left_0_eq Let_def)}
1.598 -  moreover
1.599 -  {assume ai1: "abs i = 1" and ai: "check_int a"
1.600 +  moreover
1.601 +  {assume ai1: "abs i = 1" and ai: "check_int a"
1.602      hence "i=1 \<or> i= - 1" by arith
1.603 -    moreover {assume i1: "i = 1"
1.604 -      from rdvd_left1_int[OF check_int[OF ai, simplified isint_iff]]
1.605 +    moreover {assume i1: "i = 1"
1.606 +      from rdvd_left1_int[OF check_int[OF ai, simplified isint_iff]]
1.607        have ?case using i1 ai by simp }
1.608 -    moreover {assume i1: "i = - 1"
1.609 -      from rdvd_left1_int[OF check_int[OF ai, simplified isint_iff]]
1.610 +    moreover {assume i1: "i = - 1"
1.611 +      from rdvd_left1_int[OF check_int[OF ai, simplified isint_iff]]
1.612          rdvd_abs1[where d="- 1" and t="Inum bs a"]
1.613        have ?case using i1 ai by simp }
1.614      ultimately have ?case by blast}
1.615 -  moreover
1.616 +  moreover
1.617    {assume inz: "i\<noteq>0" and cond: "(abs i \<noteq> 1) \<or> (\<not> check_int a)"
1.618      {fix v assume "?sa = C v" hence ?case using sa[symmetric] inz cond
1.619          by (cases "abs i = 1", auto simp add: int_rdvd_iff) }
1.620 -    moreover {assume H:"\<not> (\<exists> v. ?sa = C v)"
1.621 -      hence th: "simpfm (NDvd i a) = NDvd (fst (simpdvd i ?sa)) (snd (simpdvd i ?sa))" using inz cond
1.622 +    moreover {assume H:"\<not> (\<exists> v. ?sa = C v)"
1.623 +      hence th: "simpfm (NDvd i a) = NDvd (fst (simpdvd i ?sa)) (snd (simpdvd i ?sa))" using inz cond
1.624          by (cases ?sa, auto simp add: Let_def split_def)
1.625        from simpnum_nz have nz:"nozerocoeff ?sa" by simp
1.626        from simpdvd [OF nz inz] th have ?case using sa by simp}
1.627 @@ -1371,7 +1371,7 @@
1.628    "CJNB f p \<equiv> (let cjs = conjuncts p ; (yes,no) = List.partition bound0 cjs
1.629                     in conj (decr (list_conj yes)) (f (list_conj no)))"
1.630
1.631 -lemma CJNB_qe:
1.632 +lemma CJNB_qe:
1.633    assumes qe: "\<forall> bs p. qfree p \<longrightarrow> qfree (qe p) \<and> (Ifm bs (qe p) = Ifm bs (E p))"
1.634    shows "\<forall> bs p. qfree p \<longrightarrow> qfree (CJNB qe p) \<and> (Ifm bs ((CJNB qe p)) = Ifm bs (E p))"
1.635  proof(clarify)
1.636 @@ -1383,15 +1383,15 @@
1.637    let ?cno = "list_conj ?no"
1.638    let ?cyes = "list_conj ?yes"
1.639    have part: "List.partition bound0 ?cjs = (?yes,?no)" by simp
1.640 -  from partition_P[OF part] have "\<forall> q\<in> set ?yes. bound0 q" by blast
1.641 -  hence yes_nb: "bound0 ?cyes" by (simp add: list_conj_nb)
1.642 +  from partition_P[OF part] have "\<forall> q\<in> set ?yes. bound0 q" by blast
1.643 +  hence yes_nb: "bound0 ?cyes" by (simp add: list_conj_nb)
1.644    hence yes_qf: "qfree (decr ?cyes )" by (simp add: decr_qf)
1.645 -  from conjuncts_qf[OF qfp] partition_set[OF part]
1.646 +  from conjuncts_qf[OF qfp] partition_set[OF part]
1.647    have " \<forall>q\<in> set ?no. qfree q" by auto
1.648    hence no_qf: "qfree ?cno"by (simp add: list_conj_qf)
1.649 -  with qe have cno_qf:"qfree (qe ?cno )"
1.650 +  with qe have cno_qf:"qfree (qe ?cno )"
1.651      and noE: "Ifm bs (qe ?cno) = Ifm bs (E ?cno)" by blast+
1.652 -  from cno_qf yes_qf have qf: "qfree (CJNB qe p)"
1.653 +  from cno_qf yes_qf have qf: "qfree (CJNB qe p)"
1.654      by (simp add: CJNB_def Let_def split_def)
1.655    {fix bs
1.656      from conjuncts have "Ifm bs p = (\<forall>q\<in> set ?cjs. Ifm bs q)" by blast
1.657 @@ -1405,7 +1405,7 @@
1.658      by (auto simp add: decr[OF yes_nb] simp del: partition_filter_conv)
1.659    also have "\<dots> = (Ifm bs (conj (decr ?cyes) (qe ?cno)))"
1.660      using qe[rule_format, OF no_qf] by auto
1.661 -  finally have "Ifm bs (E p) = Ifm bs (CJNB qe p)"
1.662 +  finally have "Ifm bs (E p) = Ifm bs (CJNB qe p)"
1.663      by (simp add: Let_def CJNB_def split_def)
1.664    with qf show "qfree (CJNB qe p) \<and> Ifm bs (CJNB qe p) = Ifm bs (E p)" by blast
1.665  qed
1.666 @@ -1414,8 +1414,8 @@
1.667    "qelim (E p) = (\<lambda> qe. DJ (CJNB qe) (qelim p qe))"
1.668  | "qelim (A p) = (\<lambda> qe. not (qe ((qelim (NOT p) qe))))"
1.669  | "qelim (NOT p) = (\<lambda> qe. not (qelim p qe))"
1.670 -| "qelim (And p q) = (\<lambda> qe. conj (qelim p qe) (qelim q qe))"
1.671 -| "qelim (Or  p q) = (\<lambda> qe. disj (qelim p qe) (qelim q qe))"
1.672 +| "qelim (And p q) = (\<lambda> qe. conj (qelim p qe) (qelim q qe))"
1.673 +| "qelim (Or  p q) = (\<lambda> qe. disj (qelim p qe) (qelim q qe))"
1.674  | "qelim (Imp p q) = (\<lambda> qe. disj (qelim (NOT p) qe) (qelim q qe))"
1.675  | "qelim (Iff p q) = (\<lambda> qe. iff (qelim p qe) (qelim q qe))"
1.676  | "qelim p = (\<lambda> y. simpfm p)"
1.677 @@ -1425,7 +1425,7 @@
1.678  lemma qelim_ci:
1.679    assumes qe_inv: "\<forall> bs p. qfree p \<longrightarrow> qfree (qe p) \<and> (Ifm bs (qe p) = Ifm bs (E p))"
1.680    shows "\<And> bs. qfree (qelim p qe) \<and> (Ifm bs (qelim p qe) = Ifm bs p)"
1.681 -  using qe_inv DJ_qe[OF CJNB_qe[OF qe_inv]]
1.682 +  using qe_inv DJ_qe[OF CJNB_qe[OF qe_inv]]
1.683    by (induct p rule: qelim.induct) (auto simp del: simpfm.simps)
1.684
1.685
1.686 @@ -1438,11 +1438,11 @@
1.687  | "zsplit0 (CN n c a) = zsplit0 (Add (Mul c (Bound n)) a)"
1.688  | "zsplit0 (CF c a b) = zsplit0 (Add (Mul c (Floor a)) b)"
1.689  | "zsplit0 (Neg a) = (let (i',a') =  zsplit0 a in (-i', Neg a'))"
1.690 -| "zsplit0 (Add a b) = (let (ia,a') =  zsplit0 a ;
1.691 -                            (ib,b') =  zsplit0 b
1.692 +| "zsplit0 (Add a b) = (let (ia,a') =  zsplit0 a ;
1.693 +                            (ib,b') =  zsplit0 b
1.694                              in (ia+ib, Add a' b'))"
1.695 -| "zsplit0 (Sub a b) = (let (ia,a') =  zsplit0 a ;
1.696 -                            (ib,b') =  zsplit0 b
1.697 +| "zsplit0 (Sub a b) = (let (ia,a') =  zsplit0 a ;
1.698 +                            (ib,b') =  zsplit0 b
1.699                              in (ia-ib, Sub a' b'))"
1.700  | "zsplit0 (Mul i a) = (let (i',a') =  zsplit0 a in (i*i', Mul i a'))"
1.701  | "zsplit0 (Floor a) = (let (i',a') =  zsplit0 a in (i',Floor a'))"
1.702 @@ -1453,18 +1453,18 @@
1.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"
1.704    (is "\<And> n a. ?S t = (n,a) \<Longrightarrow> (?I x (CN 0 n a) = ?I x t) \<and> ?N a")
1.705  proof(induct t rule: zsplit0.induct)
1.706 -  case (1 c n a) thus ?case by auto
1.707 +  case (1 c n a) thus ?case by auto
1.708  next
1.709    case (2 m n a) thus ?case by (cases "m=0") auto
1.710  next
1.711    case (3 n i a n a') thus ?case by auto
1.712 -next
1.713 +next
1.714    case (4 c a b n a') thus ?case by auto
1.715  next
1.716    case (5 t n a)
1.717    let ?nt = "fst (zsplit0 t)"
1.718    let ?at = "snd (zsplit0 t)"
1.719 -  have abj: "zsplit0 t = (?nt,?at)" by simp hence th: "a=Neg ?at \<and> n=-?nt" using 5
1.720 +  have abj: "zsplit0 t = (?nt,?at)" by simp hence th: "a=Neg ?at \<and> n=-?nt" using 5
1.721      by (simp add: Let_def split_def)
1.722    from abj 5 have th2: "(?I x (CN 0 ?nt ?at) = ?I x t) \<and> ?N ?at" by blast
1.723    from th2[simplified] th[simplified] show ?case by simp
1.724 @@ -1474,15 +1474,15 @@
1.725    let ?as = "snd (zsplit0 s)"
1.726    let ?nt = "fst (zsplit0 t)"
1.727    let ?at = "snd (zsplit0 t)"
1.728 -  have abjs: "zsplit0 s = (?ns,?as)" by simp
1.729 -  moreover have abjt:  "zsplit0 t = (?nt,?at)" by simp
1.730 +  have abjs: "zsplit0 s = (?ns,?as)" by simp
1.731 +  moreover have abjt:  "zsplit0 t = (?nt,?at)" by simp
1.732    ultimately have th: "a=Add ?as ?at \<and> n=?ns + ?nt" using 6
1.733      by (simp add: Let_def split_def)
1.734    from abjs[symmetric] have bluddy: "\<exists> x y. (x,y) = zsplit0 s" by blast
1.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*)
1.736    with bluddy abjt have th3: "(?I x (CN 0 ?nt ?at) = ?I x t) \<and> ?N ?at" by blast
1.737    from abjs 6  have th2: "(?I x (CN 0 ?ns ?as) = ?I x s) \<and> ?N ?as" by blast
1.738 -  from th3[simplified] th2[simplified] th[simplified] show ?case
1.739 +  from th3[simplified] th2[simplified] th[simplified] show ?case
1.741  next
1.742    case (7 s t n a)
1.743 @@ -1490,15 +1490,15 @@
1.744    let ?as = "snd (zsplit0 s)"
1.745    let ?nt = "fst (zsplit0 t)"
1.746    let ?at = "snd (zsplit0 t)"
1.747 -  have abjs: "zsplit0 s = (?ns,?as)" by simp
1.748 -  moreover have abjt:  "zsplit0 t = (?nt,?at)" by simp
1.749 +  have abjs: "zsplit0 s = (?ns,?as)" by simp
1.750 +  moreover have abjt:  "zsplit0 t = (?nt,?at)" by simp
1.751    ultimately have th: "a=Sub ?as ?at \<and> n=?ns - ?nt" using 7
1.752      by (simp add: Let_def split_def)
1.753    from abjs[symmetric] have bluddy: "\<exists> x y. (x,y) = zsplit0 s" by blast
1.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*)
1.755    with bluddy abjt have th3: "(?I x (CN 0 ?nt ?at) = ?I x t) \<and> ?N ?at" by blast
1.756    from abjs 7 have th2: "(?I x (CN 0 ?ns ?as) = ?I x s) \<and> ?N ?as" by blast
1.757 -  from th3[simplified] th2[simplified] th[simplified] show ?case
1.758 +  from th3[simplified] th2[simplified] th[simplified] show ?case
1.760  next
1.761    case (8 i t n a)
1.762 @@ -1522,8 +1522,8 @@
1.763    have "?I x (Floor t) = ?I x (Floor (CN 0 ?nt ?at))" using th2 by simp
1.764    also have "\<dots> = real_of_int (floor ((real_of_int ?nt)* real_of_int(x) + ?I x ?at))" by simp
1.765    also have "\<dots> = real_of_int (floor (?I x ?at + real_of_int (?nt* x)))" by (simp add: ac_simps)
1.766 -  also have "\<dots> = real_of_int (floor (?I x ?at) + (?nt* x))"
1.767 -    using floor_add_of_int[of "?I x ?at" "?nt* x"] by simp
1.768 +  also have "\<dots> = real_of_int (floor (?I x ?at) + (?nt* x))"
1.769 +    using floor_add_of_int[of "?I x ?at" "?nt* x"] by simp
1.770    also have "\<dots> = real_of_int (?nt)*(real_of_int x) + real_of_int (floor (?I x ?at))" by (simp add: ac_simps)
1.771    finally have "?I x (Floor t) = ?I x (CN 0 n a)" using th by simp
1.772    with na show ?case by simp
1.773 @@ -1533,17 +1533,17 @@
1.774    iszlfm :: "fm \<Rightarrow> real list \<Rightarrow> bool"   (* Linearity test for fm *)
1.775    zlfm :: "fm \<Rightarrow> fm"       (* Linearity transformation for fm *)
1.776  recdef iszlfm "measure size"
1.777 -  "iszlfm (And p q) = (\<lambda> bs. iszlfm p bs \<and> iszlfm q bs)"
1.778 -  "iszlfm (Or p q) = (\<lambda> bs. iszlfm p bs \<and> iszlfm q bs)"
1.779 +  "iszlfm (And p q) = (\<lambda> bs. iszlfm p bs \<and> iszlfm q bs)"
1.780 +  "iszlfm (Or p q) = (\<lambda> bs. iszlfm p bs \<and> iszlfm q bs)"
1.781    "iszlfm (Eq  (CN 0 c e)) = (\<lambda> bs. c>0 \<and> numbound0 e \<and> isint e bs)"
1.782    "iszlfm (NEq (CN 0 c e)) = (\<lambda> bs. c>0 \<and> numbound0 e \<and> isint e bs)"
1.783    "iszlfm (Lt  (CN 0 c e)) = (\<lambda> bs. c>0 \<and> numbound0 e \<and> isint e bs)"
1.784    "iszlfm (Le  (CN 0 c e)) = (\<lambda> bs. c>0 \<and> numbound0 e \<and> isint e bs)"
1.785    "iszlfm (Gt  (CN 0 c e)) = (\<lambda> bs. c>0 \<and> numbound0 e \<and> isint e bs)"
1.786    "iszlfm (Ge  (CN 0 c e)) = (\<lambda> bs. c>0 \<and> numbound0 e \<and> isint e bs)"
1.787 -  "iszlfm (Dvd i (CN 0 c e)) =
1.788 +  "iszlfm (Dvd i (CN 0 c e)) =
1.789                   (\<lambda> bs. c>0 \<and> i>0 \<and> numbound0 e \<and> isint e bs)"
1.790 -  "iszlfm (NDvd i (CN 0 c e))=
1.791 +  "iszlfm (NDvd i (CN 0 c e))=
1.792                   (\<lambda> bs. c>0 \<and> i>0 \<and> numbound0 e \<and> isint e bs)"
1.793    "iszlfm p = (\<lambda> bs. isatom p \<and> (bound0 p))"
1.794
1.795 @@ -1570,39 +1570,39 @@
1.796    "zlfm (Or p q) = disj (zlfm p) (zlfm q)"
1.797    "zlfm (Imp p q) = disj (zlfm (NOT p)) (zlfm q)"
1.798    "zlfm (Iff p q) = disj (conj (zlfm p) (zlfm q)) (conj (zlfm (NOT p)) (zlfm (NOT q)))"
1.799 -  "zlfm (Lt a) = (let (c,r) = zsplit0 a in
1.800 -     if c=0 then Lt r else
1.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)))
1.802 +  "zlfm (Lt a) = (let (c,r) = zsplit0 a in
1.803 +     if c=0 then Lt r else
1.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)))
1.805       else Or (Gt (CN 0 (-c) (Floor(Neg r)))) (And (Eq(CN 0 (-c) (Floor(Neg r)))) (Lt (Add (Floor (Neg r)) r))))"
1.806 -  "zlfm (Le a) = (let (c,r) = zsplit0 a in
1.807 -     if c=0 then Le r else
1.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)))
1.809 +  "zlfm (Le a) = (let (c,r) = zsplit0 a in
1.810 +     if c=0 then Le r else
1.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)))
1.812       else Or (Ge (CN 0 (-c) (Floor(Neg r)))) (And (Eq(CN 0 (-c) (Floor(Neg r)))) (Lt (Add (Floor (Neg r)) r))))"
1.813 -  "zlfm (Gt a) = (let (c,r) = zsplit0 a in
1.814 -     if c=0 then Gt r else
1.815 -     if c>0 then Or (Gt (CN 0 c (Floor r))) (And (Eq (CN 0 c (Floor r))) (Lt (Sub (Floor r) r)))
1.816 +  "zlfm (Gt a) = (let (c,r) = zsplit0 a in
1.817 +     if c=0 then Gt r else
1.818 +     if c>0 then Or (Gt (CN 0 c (Floor r))) (And (Eq (CN 0 c (Floor r))) (Lt (Sub (Floor r) r)))
1.819       else Or (Lt (CN 0 (-c) (Neg (Floor r)))) (And (Eq(CN 0 (-c) (Neg (Floor r)))) (Lt (Sub (Floor r) r))))"
1.820 -  "zlfm (Ge a) = (let (c,r) = zsplit0 a in
1.821 -     if c=0 then Ge r else
1.822 -     if c>0 then Or (Ge (CN 0 c (Floor r))) (And (Eq (CN 0 c (Floor r))) (Lt (Sub (Floor r) r)))
1.823 +  "zlfm (Ge a) = (let (c,r) = zsplit0 a in
1.824 +     if c=0 then Ge r else
1.825 +     if c>0 then Or (Ge (CN 0 c (Floor r))) (And (Eq (CN 0 c (Floor r))) (Lt (Sub (Floor r) r)))
1.826       else Or (Le (CN 0 (-c) (Neg (Floor r)))) (And (Eq(CN 0 (-c) (Neg (Floor r)))) (Lt (Sub (Floor r) r))))"
1.827 -  "zlfm (Eq a) = (let (c,r) = zsplit0 a in
1.828 -              if c=0 then Eq r else
1.829 +  "zlfm (Eq a) = (let (c,r) = zsplit0 a in
1.830 +              if c=0 then Eq r else
1.831        if c>0 then (And (Eq (CN 0 c (Neg (Floor (Neg r))))) (Eq (Add (Floor (Neg r)) r)))
1.832        else (And (Eq (CN 0 (-c) (Floor (Neg r)))) (Eq (Add (Floor (Neg r)) r))))"
1.833 -  "zlfm (NEq a) = (let (c,r) = zsplit0 a in
1.834 -              if c=0 then NEq r else
1.835 +  "zlfm (NEq a) = (let (c,r) = zsplit0 a in
1.836 +              if c=0 then NEq r else
1.837        if c>0 then (Or (NEq (CN 0 c (Neg (Floor (Neg r))))) (NEq (Add (Floor (Neg r)) r)))
1.838        else (Or (NEq (CN 0 (-c) (Floor (Neg r)))) (NEq (Add (Floor (Neg r)) r))))"
1.839 -  "zlfm (Dvd i a) = (if i=0 then zlfm (Eq a)
1.840 -  else (let (c,r) = zsplit0 a in
1.841 -              if c=0 then Dvd (abs i) r else
1.842 -      if c>0 then And (Eq (Sub (Floor r) r)) (Dvd (abs i) (CN 0 c (Floor r)))
1.843 +  "zlfm (Dvd i a) = (if i=0 then zlfm (Eq a)
1.844 +  else (let (c,r) = zsplit0 a in
1.845 +              if c=0 then Dvd (abs i) r else
1.846 +      if c>0 then And (Eq (Sub (Floor r) r)) (Dvd (abs i) (CN 0 c (Floor r)))
1.847        else And (Eq (Sub (Floor r) r)) (Dvd (abs i) (CN 0 (-c) (Neg (Floor r))))))"
1.848 -  "zlfm (NDvd i a) = (if i=0 then zlfm (NEq a)
1.849 -  else (let (c,r) = zsplit0 a in
1.850 -              if c=0 then NDvd (abs i) r else
1.851 -      if c>0 then Or (NEq (Sub (Floor r) r)) (NDvd (abs i) (CN 0 c (Floor r)))
1.852 +  "zlfm (NDvd i a) = (if i=0 then zlfm (NEq a)
1.853 +  else (let (c,r) = zsplit0 a in
1.854 +              if c=0 then NDvd (abs i) r else
1.855 +      if c>0 then Or (NEq (Sub (Floor r) r)) (NDvd (abs i) (CN 0 c (Floor r)))
1.856        else Or (NEq (Sub (Floor r) r)) (NDvd (abs i) (CN 0 (-c) (Neg (Floor r))))))"
1.857    "zlfm (NOT (And p q)) = disj (zlfm (NOT p)) (zlfm (NOT q))"
1.858    "zlfm (NOT (Or p q)) = conj (zlfm (NOT p)) (zlfm (NOT q))"
1.859 @@ -1621,56 +1621,56 @@
1.860    "zlfm (NOT (NDvd i a)) = zlfm (Dvd i a)"
1.861    "zlfm p = p" (hints simp add: fmsize_pos)
1.862
1.863 -lemma split_int_less_real:
1.864 +lemma split_int_less_real:
1.865    "(real_of_int (a::int) < b) = (a < floor b \<or> (a = floor b \<and> real_of_int (floor b) < b))"
1.866  proof( auto)
1.867    assume alb: "real_of_int a < b" and agb: "\<not> a < floor b"
1.868    from agb have "floor b \<le> a" by simp hence th: "b < real_of_int a + 1" by (simp only: floor_le_iff)
1.869 -  from floor_eq[OF alb th] show "a= floor b" by simp
1.870 +  from floor_eq[OF alb th] show "a= floor b" by simp
1.871  next
1.872    assume alb: "a < floor b"
1.873    hence "real_of_int a < real_of_int (floor b)" by simp
1.874 -  moreover have "real_of_int (floor b) \<le> b" by simp ultimately show  "real_of_int a < b" by arith
1.875 +  moreover have "real_of_int (floor b) \<le> b" by simp ultimately show  "real_of_int a < b" by arith
1.876  qed
1.877
1.878 -lemma split_int_less_real':
1.879 +lemma split_int_less_real':
1.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))"
1.881 -proof-
1.882 +proof-
1.883    have "(real_of_int a + b <0) = (real_of_int a < -b)" by arith
1.884 -  with split_int_less_real[where a="a" and b="-b"] show ?thesis by arith
1.885 +  with split_int_less_real[where a="a" and b="-b"] show ?thesis by arith
1.886  qed
1.887
1.888 -lemma split_int_gt_real':
1.889 +lemma split_int_gt_real':
1.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))"
1.891 -proof-
1.892 +proof-
1.893    have th: "(real_of_int a + b >0) = (real_of_int (-a) + (-b)< 0)" by arith
1.894 -  show ?thesis using myless[of _ "real_of_int (floor b)"]
1.895 -    by (simp only:th split_int_less_real'[where a="-a" and b="-b"])
1.896 +  show ?thesis using myless[of _ "real_of_int (floor b)"]
1.897 +    by (simp only:th split_int_less_real'[where a="-a" and b="-b"])
1.899  qed
1.900
1.901 -lemma split_int_le_real:
1.902 +lemma split_int_le_real:
1.903    "(real_of_int (a::int) \<le> b) = (a \<le> floor b \<or> (a = floor b \<and> real_of_int (floor b) < b))"
1.904  proof( auto)
1.905    assume alb: "real_of_int a \<le> b" and agb: "\<not> a \<le> floor b"
1.906 -  from alb have "floor (real_of_int a) \<le> floor b " by (simp only: floor_mono)
1.907 +  from alb have "floor (real_of_int a) \<le> floor b " by (simp only: floor_mono)
1.908    hence "a \<le> floor b" by simp with agb show "False" by simp
1.909  next
1.910    assume alb: "a \<le> floor b"
1.911    hence "real_of_int a \<le> real_of_int (floor b)" by (simp only: floor_mono)
1.912 -  also have "\<dots>\<le> b" by simp  finally show  "real_of_int a \<le> b" .
1.913 +  also have "\<dots>\<le> b" by simp  finally show  "real_of_int a \<le> b" .
1.914  qed
1.915
1.916 -lemma split_int_le_real':
1.917 +lemma split_int_le_real':
1.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))"
1.919 -proof-
1.920 +proof-
1.921    have "(real_of_int a + b \<le>0) = (real_of_int a \<le> -b)" by arith
1.922 -  with split_int_le_real[where a="a" and b="-b"] show ?thesis by arith
1.923 +  with split_int_le_real[where a="a" and b="-b"] show ?thesis by arith
1.924  qed
1.925
1.926 -lemma split_int_ge_real':
1.927 +lemma split_int_ge_real':
1.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))"
1.929 -proof-
1.930 +proof-
1.931    have th: "(real_of_int a + b \<ge>0) = (real_of_int (-a) + (-b) \<le> 0)" by arith
1.932    show ?thesis by (simp only: th split_int_le_real'[where a="-a" and b="-b"])
1.934 @@ -1691,25 +1691,25 @@
1.935    (is "(?I (?l p) = ?I p) \<and> ?L (?l p)")
1.936  using qfp
1.937  proof(induct p rule: zlfm.induct)
1.938 -  case (5 a)
1.939 +  case (5 a)
1.940    let ?c = "fst (zsplit0 a)"
1.941    let ?r = "snd (zsplit0 a)"
1.942    have spl: "zsplit0 a = (?c,?r)" by simp
1.943 -  from zsplit0_I[OF spl, where x="i" and bs="bs"]
1.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
1.945 +  from zsplit0_I[OF spl, where x="i" and bs="bs"]
1.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
1.947    let ?N = "\<lambda> t. Inum (real_of_int i#bs) t"
1.948    have "?c = 0 \<or> (?c >0 \<and> ?c\<noteq>0) \<or> (?c<0 \<and> ?c\<noteq>0)" by arith
1.949    moreover
1.950 -  {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"]
1.951 +  {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"]
1.952        by (cases "?r", simp_all add: Let_def split_def,rename_tac nat a b,case_tac "nat", simp_all)}
1.953    moreover
1.954 -  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Lt a))"
1.955 +  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Lt a))"
1.956        by (simp add: nb Let_def split_def isint_Floor isint_neg)
1.957      have "?I (Lt a) = (real_of_int (?c * i) + (?N ?r) < 0)" using Ia by (simp add: Let_def split_def)
1.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)
1.959      finally have ?case using l by simp}
1.960    moreover
1.961 -  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Lt a))"
1.962 +  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Lt a))"
1.963        by (simp add: nb Let_def split_def isint_Floor isint_neg)
1.964      have "?I (Lt a) = (real_of_int (?c * i) + (?N ?r) < 0)" using Ia by (simp add: Let_def split_def)
1.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)
1.966 @@ -1720,46 +1720,46 @@
1.967    let ?c = "fst (zsplit0 a)"
1.968    let ?r = "snd (zsplit0 a)"
1.969    have spl: "zsplit0 a = (?c,?r)" by simp
1.970 -  from zsplit0_I[OF spl, where x="i" and bs="bs"]
1.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
1.972 +  from zsplit0_I[OF spl, where x="i" and bs="bs"]
1.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
1.974    let ?N = "\<lambda> t. Inum (real_of_int i#bs) t"
1.975    have "?c = 0 \<or> (?c >0 \<and> ?c\<noteq>0) \<or> (?c<0 \<and> ?c\<noteq>0)" by arith
1.976    moreover
1.977 -  {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"]
1.978 +  {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"]
1.979        by (cases "?r", simp_all add: Let_def split_def, rename_tac nat a b, case_tac "nat",simp_all)}
1.980    moreover
1.981 -  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Le a))"
1.982 +  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Le a))"
1.983        by (simp add: nb Let_def split_def isint_Floor isint_neg)
1.984      have "?I (Le a) = (real_of_int (?c * i) + (?N ?r) \<le> 0)" using Ia by (simp add: Let_def split_def)
1.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)
1.986      finally have ?case using l by simp}
1.987    moreover
1.988 -  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Le a))"
1.989 +  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Le a))"
1.990        by (simp add: nb Let_def split_def isint_Floor isint_neg)
1.991      have "?I (Le a) = (real_of_int (?c * i) + (?N ?r) \<le> 0)" using Ia by (simp add: Let_def split_def)
1.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)
1.993      finally have ?case using l by simp}
1.994    ultimately show ?case by blast
1.995  next
1.996 -  case (7 a)
1.997 +  case (7 a)
1.998    let ?c = "fst (zsplit0 a)"
1.999    let ?r = "snd (zsplit0 a)"
1.1000    have spl: "zsplit0 a = (?c,?r)" by simp
1.1001 -  from zsplit0_I[OF spl, where x="i" and bs="bs"]
1.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
1.1003 +  from zsplit0_I[OF spl, where x="i" and bs="bs"]
1.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
1.1005    let ?N = "\<lambda> t. Inum (real_of_int i#bs) t"
1.1006    have "?c = 0 \<or> (?c >0 \<and> ?c\<noteq>0) \<or> (?c<0 \<and> ?c\<noteq>0)" by arith
1.1007    moreover
1.1008 -  {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"]
1.1009 +  {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"]
1.1010        by (cases "?r", simp_all add: Let_def split_def, rename_tac nat a b, case_tac "nat", simp_all)}
1.1011    moreover
1.1012 -  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Gt a))"
1.1013 +  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Gt a))"
1.1014        by (simp add: nb Let_def split_def isint_Floor isint_neg)
1.1015      have "?I (Gt a) = (real_of_int (?c * i) + (?N ?r) > 0)" using Ia by (simp add: Let_def split_def)
1.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)
1.1017      finally have ?case using l by simp}
1.1018    moreover
1.1019 -  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Gt a))"
1.1020 +  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Gt a))"
1.1021        by (simp add: nb Let_def split_def isint_Floor isint_neg)
1.1022      have "?I (Gt a) = (real_of_int (?c * i) + (?N ?r) > 0)" using Ia by (simp add: Let_def split_def)
1.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)
1.1024 @@ -1770,21 +1770,21 @@
1.1025     let ?c = "fst (zsplit0 a)"
1.1026    let ?r = "snd (zsplit0 a)"
1.1027    have spl: "zsplit0 a = (?c,?r)" by simp
1.1028 -  from zsplit0_I[OF spl, where x="i" and bs="bs"]
1.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
1.1030 +  from zsplit0_I[OF spl, where x="i" and bs="bs"]
1.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
1.1032    let ?N = "\<lambda> t. Inum (real_of_int i#bs) t"
1.1033    have "?c = 0 \<or> (?c >0 \<and> ?c\<noteq>0) \<or> (?c<0 \<and> ?c\<noteq>0)" by arith
1.1034    moreover
1.1035 -  {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"]
1.1036 +  {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"]
1.1037        by (cases "?r", simp_all add: Let_def split_def, rename_tac nat a b, case_tac "nat", simp_all)}
1.1038    moreover
1.1039 -  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Ge a))"
1.1040 +  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Ge a))"
1.1041        by (simp add: nb Let_def split_def isint_Floor isint_neg)
1.1042      have "?I (Ge a) = (real_of_int (?c * i) + (?N ?r) \<ge> 0)" using Ia by (simp add: Let_def split_def)
1.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)
1.1044      finally have ?case using l by simp}
1.1045    moreover
1.1046 -  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Ge a))"
1.1047 +  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Ge a))"
1.1048        by (simp add: nb Let_def split_def isint_Floor isint_neg)
1.1049      have "?I (Ge a) = (real_of_int (?c * i) + (?N ?r) \<ge> 0)" using Ia by (simp add: Let_def split_def)
1.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)
1.1051 @@ -1795,21 +1795,21 @@
1.1052    let ?c = "fst (zsplit0 a)"
1.1053    let ?r = "snd (zsplit0 a)"
1.1054    have spl: "zsplit0 a = (?c,?r)" by simp
1.1055 -  from zsplit0_I[OF spl, where x="i" and bs="bs"]
1.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
1.1057 +  from zsplit0_I[OF spl, where x="i" and bs="bs"]
1.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
1.1059    let ?N = "\<lambda> t. Inum (real_of_int i#bs) t"
1.1060    have "?c = 0 \<or> (?c >0 \<and> ?c\<noteq>0) \<or> (?c<0 \<and> ?c\<noteq>0)" by arith
1.1061    moreover
1.1062 -  {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"]
1.1063 +  {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"]
1.1064        by (cases "?r", simp_all add: Let_def split_def, rename_tac nat a b, case_tac "nat", simp_all)}
1.1065    moreover
1.1066 -  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Eq a))"
1.1067 +  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Eq a))"
1.1068        by (simp add: nb Let_def split_def isint_Floor isint_neg)
1.1069      have "?I (Eq a) = (real_of_int (?c * i) + (?N ?r) = 0)" using Ia by (simp add: Let_def split_def)
1.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)
1.1071      finally have ?case using l by simp}
1.1072    moreover
1.1073 -  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Eq a))"
1.1074 +  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (Eq a))"
1.1075        by (simp add: nb Let_def split_def isint_Floor isint_neg)
1.1076      have "?I (Eq a) = (real_of_int (?c * i) + (?N ?r) = 0)" using Ia by (simp add: Let_def split_def)
1.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)
1.1078 @@ -1820,21 +1820,21 @@
1.1079    let ?c = "fst (zsplit0 a)"
1.1080    let ?r = "snd (zsplit0 a)"
1.1081    have spl: "zsplit0 a = (?c,?r)" by simp
1.1082 -  from zsplit0_I[OF spl, where x="i" and bs="bs"]
1.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
1.1084 +  from zsplit0_I[OF spl, where x="i" and bs="bs"]
1.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
1.1086    let ?N = "\<lambda> t. Inum (real_of_int i#bs) t"
1.1087    have "?c = 0 \<or> (?c >0 \<and> ?c\<noteq>0) \<or> (?c<0 \<and> ?c\<noteq>0)" by arith
1.1088    moreover
1.1089 -  {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"]
1.1090 +  {assume "?c=0" hence ?case using zsplit0_I[OF spl, where x="i" and bs="bs"]
1.1091        by (cases "?r", simp_all add: Let_def split_def, rename_tac nat a b, case_tac "nat", simp_all)}
1.1092    moreover
1.1093 -  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (NEq a))"
1.1094 +  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (NEq a))"
1.1095        by (simp add: nb Let_def split_def isint_Floor isint_neg)
1.1096      have "?I (NEq a) = (real_of_int (?c * i) + (?N ?r) \<noteq> 0)" using Ia by (simp add: Let_def split_def)
1.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)
1.1098      finally have ?case using l by simp}
1.1099    moreover
1.1100 -  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (NEq a))"
1.1101 +  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" hence l: "?L (?l (NEq a))"
1.1102        by (simp add: nb Let_def split_def isint_Floor isint_neg)
1.1103      have "?I (NEq a) = (real_of_int (?c * i) + (?N ?r) \<noteq> 0)" using Ia by (simp add: Let_def split_def)
1.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)
1.1105 @@ -1845,44 +1845,44 @@
1.1106    let ?c = "fst (zsplit0 a)"
1.1107    let ?r = "snd (zsplit0 a)"
1.1108    have spl: "zsplit0 a = (?c,?r)" by simp
1.1109 -  from zsplit0_I[OF spl, where x="i" and bs="bs"]
1.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
1.1111 +  from zsplit0_I[OF spl, where x="i" and bs="bs"]
1.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
1.1113    let ?N = "\<lambda> t. Inum (real_of_int i#bs) t"
1.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
1.1115    moreover
1.1116 -  { assume j: "j=0" hence z: "zlfm (Dvd j a) = (zlfm (Eq a))" by (simp add: Let_def)
1.1117 +  { assume j: "j=0" hence z: "zlfm (Dvd j a) = (zlfm (Eq a))" by (simp add: Let_def)
1.1118      hence ?case using 11 j by (simp del: zlfm.simps add: rdvd_left_0_eq)}
1.1119    moreover
1.1120 -  {assume "?c=0" and "j\<noteq>0" hence ?case
1.1121 +  {assume "?c=0" and "j\<noteq>0" hence ?case
1.1122        using zsplit0_I[OF spl, where x="i" and bs="bs"] rdvd_abs1[where d="j"]
1.1123        by (cases "?r", simp_all add: Let_def split_def, rename_tac nat a b, case_tac "nat", simp_all)}
1.1124    moreover
1.1125 -  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" and jnz: "j\<noteq>0" hence l: "?L (?l (Dvd j a))"
1.1126 +  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" and jnz: "j\<noteq>0" hence l: "?L (?l (Dvd j a))"
1.1127        by (simp add: nb Let_def split_def isint_Floor isint_neg)
1.1128 -    have "?I (Dvd j a) = (real_of_int j rdvd (real_of_int (?c * i) + (?N ?r)))"
1.1129 +    have "?I (Dvd j a) = (real_of_int j rdvd (real_of_int (?c * i) + (?N ?r)))"
1.1130        using Ia by (simp add: Let_def split_def)
1.1131 -    also have "\<dots> = (real_of_int (abs j) rdvd real_of_int (?c*i) + (?N ?r))"
1.1132 +    also have "\<dots> = (real_of_int (abs j) rdvd real_of_int (?c*i) + (?N ?r))"
1.1133        by (simp only: rdvd_abs1[where d="j" and t="real_of_int (?c*i) + ?N ?r", symmetric]) simp
1.1134 -    also have "\<dots> = ((abs j) dvd (floor ((?N ?r) + real_of_int (?c*i))) \<and>
1.1135 -       (real_of_int (floor ((?N ?r) + real_of_int (?c*i))) = (real_of_int (?c*i) + (?N ?r))))"
1.1136 +    also have "\<dots> = ((abs j) dvd (floor ((?N ?r) + real_of_int (?c*i))) \<and>
1.1137 +       (real_of_int (floor ((?N ?r) + real_of_int (?c*i))) = (real_of_int (?c*i) + (?N ?r))))"
1.1138        by(simp only: int_rdvd_real[where i="abs j" and x="real_of_int (?c*i) + (?N ?r)"]) (simp only: ac_simps)
1.1139 -    also have "\<dots> = (?I (?l (Dvd j a)))" using cp cnz jnz
1.1140 -      by (simp add: Let_def split_def int_rdvd_iff[symmetric]
1.1141 +    also have "\<dots> = (?I (?l (Dvd j a)))" using cp cnz jnz
1.1142 +      by (simp add: Let_def split_def int_rdvd_iff[symmetric]
1.1143          del: of_int_mult) (auto simp add: ac_simps)
1.1144      finally have ?case using l jnz  by simp }
1.1145    moreover
1.1146 -  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" and jnz: "j\<noteq>0" hence l: "?L (?l (Dvd j a))"
1.1147 +  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" and jnz: "j\<noteq>0" hence l: "?L (?l (Dvd j a))"
1.1148        by (simp add: nb Let_def split_def isint_Floor isint_neg)
1.1149 -    have "?I (Dvd j a) = (real_of_int j rdvd (real_of_int (?c * i) + (?N ?r)))"
1.1150 +    have "?I (Dvd j a) = (real_of_int j rdvd (real_of_int (?c * i) + (?N ?r)))"
1.1151        using Ia by (simp add: Let_def split_def)
1.1152 -    also have "\<dots> = (real_of_int (abs j) rdvd real_of_int (?c*i) + (?N ?r))"
1.1153 +    also have "\<dots> = (real_of_int (abs j) rdvd real_of_int (?c*i) + (?N ?r))"
1.1154        by (simp only: rdvd_abs1[where d="j" and t="real_of_int (?c*i) + ?N ?r", symmetric]) simp
1.1155 -    also have "\<dots> = ((abs j) dvd (floor ((?N ?r) + real_of_int (?c*i))) \<and>
1.1156 -       (real_of_int (floor ((?N ?r) + real_of_int (?c*i))) = (real_of_int (?c*i) + (?N ?r))))"
1.1157 +    also have "\<dots> = ((abs j) dvd (floor ((?N ?r) + real_of_int (?c*i))) \<and>
1.1158 +       (real_of_int (floor ((?N ?r) + real_of_int (?c*i))) = (real_of_int (?c*i) + (?N ?r))))"
1.1159        by(simp only: int_rdvd_real[where i="abs j" and x="real_of_int (?c*i) + (?N ?r)"]) (simp only: ac_simps)
1.1160      also have "\<dots> = (?I (?l (Dvd j a)))" using cn cnz jnz
1.1161        using rdvd_minus [where d="abs j" and t="real_of_int (?c*i + floor (?N ?r))", simplified, symmetric]
1.1162 -      by (simp add: Let_def split_def int_rdvd_iff[symmetric]
1.1163 +      by (simp add: Let_def split_def int_rdvd_iff[symmetric]
1.1164          del: of_int_mult) (auto simp add: ac_simps)
1.1165      finally have ?case using l jnz by blast }
1.1166    ultimately show ?case by blast
1.1167 @@ -1891,44 +1891,44 @@
1.1168    let ?c = "fst (zsplit0 a)"
1.1169    let ?r = "snd (zsplit0 a)"
1.1170    have spl: "zsplit0 a = (?c,?r)" by simp
1.1171 -  from zsplit0_I[OF spl, where x="i" and bs="bs"]
1.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
1.1173 +  from zsplit0_I[OF spl, where x="i" and bs="bs"]
1.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
1.1175    let ?N = "\<lambda> t. Inum (real_of_int i#bs) t"
1.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
1.1177    moreover
1.1178 -  {assume j: "j=0" hence z: "zlfm (NDvd j a) = (zlfm (NEq a))" by (simp add: Let_def)
1.1179 +  {assume j: "j=0" hence z: "zlfm (NDvd j a) = (zlfm (NEq a))" by (simp add: Let_def)
1.1180      hence ?case using 12 j by (simp del: zlfm.simps add: rdvd_left_0_eq)}
1.1181    moreover
1.1182 -  {assume "?c=0" and "j\<noteq>0" hence ?case
1.1183 +  {assume "?c=0" and "j\<noteq>0" hence ?case
1.1184        using zsplit0_I[OF spl, where x="i" and bs="bs"] rdvd_abs1[where d="j"]
1.1185        by (cases "?r", simp_all add: Let_def split_def, rename_tac nat a b, case_tac "nat", simp_all)}
1.1186    moreover
1.1187 -  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" and jnz: "j\<noteq>0" hence l: "?L (?l (NDvd j a))"
1.1188 +  {assume cp: "?c > 0" and cnz: "?c\<noteq>0" and jnz: "j\<noteq>0" hence l: "?L (?l (NDvd j a))"
1.1189        by (simp add: nb Let_def split_def isint_Floor isint_neg)
1.1190 -    have "?I (NDvd j a) = (\<not> (real_of_int j rdvd (real_of_int (?c * i) + (?N ?r))))"
1.1191 +    have "?I (NDvd j a) = (\<not> (real_of_int j rdvd (real_of_int (?c * i) + (?N ?r))))"
1.1192        using Ia by (simp add: Let_def split_def)
1.1193 -    also have "\<dots> = (\<not> (real_of_int (abs j) rdvd real_of_int (?c*i) + (?N ?r)))"
1.1194 +    also have "\<dots> = (\<not> (real_of_int (abs j) rdvd real_of_int (?c*i) + (?N ?r)))"
1.1195        by (simp only: rdvd_abs1[where d="j" and t="real_of_int (?c*i) + ?N ?r", symmetric]) simp
1.1196 -    also have "\<dots> = (\<not> ((abs j) dvd (floor ((?N ?r) + real_of_int (?c*i))) \<and>
1.1197 -       (real_of_int (floor ((?N ?r) + real_of_int (?c*i))) = (real_of_int (?c*i) + (?N ?r)))))"
1.1198 +    also have "\<dots> = (\<not> ((abs j) dvd (floor ((?N ?r) + real_of_int (?c*i))) \<and>
1.1199 +       (real_of_int (floor ((?N ?r) + real_of_int (?c*i))) = (real_of_int (?c*i) + (?N ?r)))))"
1.1200        by(simp only: int_rdvd_real[where i="abs j" and x="real_of_int (?c*i) + (?N ?r)"]) (simp only: ac_simps)
1.1201 -    also have "\<dots> = (?I (?l (NDvd j a)))" using cp cnz jnz
1.1202 -      by (simp add: Let_def split_def int_rdvd_iff[symmetric]
1.1203 +    also have "\<dots> = (?I (?l (NDvd j a)))" using cp cnz jnz
1.1204 +      by (simp add: Let_def split_def int_rdvd_iff[symmetric]
1.1205          del: of_int_mult) (auto simp add: ac_simps)
1.1206      finally have ?case using l jnz  by simp }
1.1207    moreover
1.1208 -  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" and jnz: "j\<noteq>0" hence l: "?L (?l (NDvd j a))"
1.1209 +  {assume cn: "?c < 0" and cnz: "?c\<noteq>0" and jnz: "j\<noteq>0" hence l: "?L (?l (NDvd j a))"
1.1210        by (simp add: nb Let_def split_def isint_Floor isint_neg)
1.1211 -    have "?I (NDvd j a) = (\<not> (real_of_int j rdvd (real_of_int (?c * i) + (?N ?r))))"
1.1212 +    have "?I (NDvd j a) = (\<not> (real_of_int j rdvd (real_of_int (?c * i) + (?N ?r))))"
1.1213        using Ia by (simp add: Let_def split_def)
1.1214 -    also have "\<dots> = (\<not> (real_of_int (abs j) rdvd real_of_int (?c*i) + (?N ?r)))"
1.1215 +    also have "\<dots> = (\<not> (real_of_int (abs j) rdvd real_of_int (?c*i) + (?N ?r)))"
1.1216        by (simp only: rdvd_abs1[where d="j" and t="real_of_int (?c*i) + ?N ?r", symmetric]) simp
1.1217 -    also have "\<dots> = (\<not> ((abs j) dvd (floor ((?N ?r) + real_of_int (?c*i))) \<and>
1.1218 -       (real_of_int (floor ((?N ?r) + real_of_int (?c*i))) = (real_of_int (?c*i) + (?N ?r)))))"
1.1219 +    also have "\<dots> = (\<not> ((abs j) dvd (floor ((?N ?r) + real_of_int (?c*i))) \<and>
1.1220 +       (real_of_int (floor ((?N ?r) + real_of_int (?c*i))) = (real_of_int (?c*i) + (?N ?r)))))"
1.1221        by(simp only: int_rdvd_real[where i="abs j" and x="real_of_int (?c*i) + (?N ?r)"]) (simp only: ac_simps)
1.1222      also have "\<dots> = (?I (?l (NDvd j a)))" using cn cnz jnz
1.1223        using rdvd_minus [where d="abs j" and t="real_of_int (?c*i + floor (?N ?r))", simplified, symmetric]
1.1224 -      by (simp add: Let_def split_def int_rdvd_iff[symmetric]
1.1225 +      by (simp add: Let_def split_def int_rdvd_iff[symmetric]
1.1226          del: of_int_mult) (auto simp add: ac_simps)
1.1227      finally have ?case using l jnz by blast }
1.1228    ultimately show ?case by blast
1.1229 @@ -1940,8 +1940,8 @@
1.1230         \<open>d_\<delta>\<close> checks if a given l divides all the ds above\<close>
1.1231
1.1232  fun minusinf:: "fm \<Rightarrow> fm" where
1.1233 -  "minusinf (And p q) = conj (minusinf p) (minusinf q)"
1.1234 -| "minusinf (Or p q) = disj (minusinf p) (minusinf q)"
1.1235 +  "minusinf (And p q) = conj (minusinf p) (minusinf q)"
1.1236 +| "minusinf (Or p q) = disj (minusinf p) (minusinf q)"
1.1237  | "minusinf (Eq  (CN 0 c e)) = F"
1.1238  | "minusinf (NEq (CN 0 c e)) = T"
1.1239  | "minusinf (Lt  (CN 0 c e)) = T"
1.1240 @@ -1954,8 +1954,8 @@
1.1241    by (induct p rule: minusinf.induct, auto)
1.1242
1.1243  fun plusinf:: "fm \<Rightarrow> fm" where
1.1244 -  "plusinf (And p q) = conj (plusinf p) (plusinf q)"
1.1245 -| "plusinf (Or p q) = disj (plusinf p) (plusinf q)"
1.1246 +  "plusinf (And p q) = conj (plusinf p) (plusinf q)"
1.1247 +| "plusinf (Or p q) = disj (plusinf p) (plusinf q)"
1.1248  | "plusinf (Eq  (CN 0 c e)) = F"
1.1249  | "plusinf (NEq (CN 0 c e)) = T"
1.1250  | "plusinf (Lt  (CN 0 c e)) = F"
1.1251 @@ -1965,20 +1965,20 @@
1.1252  | "plusinf p = p"
1.1253
1.1254  fun \<delta> :: "fm \<Rightarrow> int" where
1.1255 -  "\<delta> (And p q) = lcm (\<delta> p) (\<delta> q)"
1.1256 -| "\<delta> (Or p q) = lcm (\<delta> p) (\<delta> q)"
1.1257 +  "\<delta> (And p q) = lcm (\<delta> p) (\<delta> q)"
1.1258 +| "\<delta> (Or p q) = lcm (\<delta> p) (\<delta> q)"
1.1259  | "\<delta> (Dvd i (CN 0 c e)) = i"
1.1260  | "\<delta> (NDvd i (CN 0 c e)) = i"
1.1261  | "\<delta> p = 1"
1.1262
1.1263  fun d_\<delta> :: "fm \<Rightarrow> int \<Rightarrow> bool" where
1.1264 -  "d_\<delta> (And p q) = (\<lambda> d. d_\<delta> p d \<and> d_\<delta> q d)"
1.1265 -| "d_\<delta> (Or p q) = (\<lambda> d. d_\<delta> p d \<and> d_\<delta> q d)"
1.1266 +  "d_\<delta> (And p q) = (\<lambda> d. d_\<delta> p d \<and> d_\<delta> q d)"
1.1267 +| "d_\<delta> (Or p q) = (\<lambda> d. d_\<delta> p d \<and> d_\<delta> q d)"
1.1268  | "d_\<delta> (Dvd i (CN 0 c e)) = (\<lambda> d. i dvd d)"
1.1269  | "d_\<delta> (NDvd i (CN 0 c e)) = (\<lambda> d. i dvd d)"
1.1270  | "d_\<delta> p = (\<lambda> d. True)"
1.1271
1.1272 -lemma delta_mono:
1.1273 +lemma delta_mono:
1.1274    assumes lin: "iszlfm p bs"
1.1275    and d: "d dvd d'"
1.1276    and ad: "d_\<delta> p d"
1.1277 @@ -1996,17 +1996,17 @@
1.1278    shows "d_\<delta> p (\<delta> p) \<and> \<delta> p >0"
1.1279  using lin
1.1280  proof (induct p rule: iszlfm.induct)
1.1281 -  case (1 p q)
1.1282 +  case (1 p q)
1.1283    let ?d = "\<delta> (And p q)"
1.1284    from 1 lcm_pos_int have dp: "?d >0" by simp
1.1285 -  have d1: "\<delta> p dvd \<delta> (And p q)" using 1 by simp
1.1286 -  hence th: "d_\<delta> p ?d"
1.1287 +  have d1: "\<delta> p dvd \<delta> (And p q)" using 1 by simp
1.1288 +  hence th: "d_\<delta> p ?d"
1.1289      using delta_mono 1 by (simp only: iszlfm.simps) blast
1.1290 -  have "\<delta> q dvd \<delta> (And p q)" using 1 by simp
1.1291 +  have "\<delta> q dvd \<delta> (And p q)" using 1 by simp
1.1292    hence th': "d_\<delta> q ?d" using delta_mono 1 by (simp only: iszlfm.simps) blast
1.1293 -  from th th' dp show ?case by simp
1.1294 +  from th th' dp show ?case by simp
1.1295  next
1.1296 -  case (2 p q)
1.1297 +  case (2 p q)
1.1298    let ?d = "\<delta> (And p q)"
1.1299    from 2 lcm_pos_int have dp: "?d >0" by simp
1.1300    have "\<delta> p dvd \<delta> (And p q)" using 2 by simp
1.1301 @@ -2041,101 +2041,101 @@
1.1302    from z1_def z2_def have "\<forall> x < ?z. ?I x (?M (Or f g)) = ?I x (Or f g)" by simp
1.1303    thus ?case by blast
1.1304  next
1.1305 -  case (3 c e)
1.1306 +  case (3 c e)
1.1307    then have "c > 0" by simp
1.1308    hence rcpos: "real_of_int c > 0" by simp
1.1309    from 3 have nbe: "numbound0 e" by simp
1.1310    fix y
1.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))"
1.1312 -  proof (simp add: less_floor_iff , rule allI, rule impI)
1.1313 +  proof (simp add: less_floor_iff , rule allI, rule impI)
1.1314      fix x :: int
1.1315      assume A: "real_of_int x + 1 \<le> - (Inum (y # bs) e / real_of_int c)"
1.1316      hence th1:"real_of_int x < - (Inum (y # bs) e / real_of_int c)" by simp
1.1317      with rcpos  have "(real_of_int c)*(real_of_int  x) < (real_of_int c)*(- (Inum (y # bs) e / real_of_int c))"
1.1318        by (simp only: mult_strict_left_mono [OF th1 rcpos])
1.1319      hence "real_of_int c * real_of_int x + Inum (y # bs) e \<noteq> 0"using rcpos  by simp
1.1320 -    thus "real_of_int c * real_of_int x + Inum (real_of_int x # bs) e \<noteq> 0"
1.1321 +    thus "real_of_int c * real_of_int x + Inum (real_of_int x # bs) e \<noteq> 0"
1.1322        using numbound0_I[OF nbe, where b="y" and bs="bs" and b'="real_of_int x"]  by simp
1.1323    qed
1.1324    thus ?case by blast
1.1325  next
1.1326 -  case (4 c e)
1.1327 +  case (4 c e)
1.1328    then have "c > 0" by simp hence rcpos: "real_of_int c > 0" by simp
1.1329    from 4 have nbe: "numbound0 e" by simp
1.1330    fix y
1.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))"
1.1332 -  proof (simp add: less_floor_iff , rule allI, rule impI)
1.1333 +  proof (simp add: less_floor_iff , rule allI, rule impI)
1.1334      fix x :: int
1.1335      assume A: "real_of_int x + 1 \<le> - (Inum (y # bs) e / real_of_int c)"
1.1336      hence th1:"real_of_int x < - (Inum (y # bs) e / real_of_int c)" by simp
1.1337      with rcpos  have "(real_of_int c)*(real_of_int x) < (real_of_int c)*(- (Inum (y # bs) e / real_of_int c))"
1.1338        by (simp only: mult_strict_left_mono [OF th1 rcpos])
1.1339      hence "real_of_int c * real_of_int x + Inum (y # bs) e \<noteq> 0"using rcpos  by simp
1.1340 -    thus "real_of_int c * real_of_int x + Inum (real_of_int x # bs) e \<noteq> 0"
1.1341 +    thus "real_of_int c * real_of_int x + Inum (real_of_int x # bs) e \<noteq> 0"
1.1342        using numbound0_I[OF nbe, where b="y" and bs="bs" and b'="real_of_int x"]  by simp
1.1343    qed
1.1344    thus ?case by blast
1.1345  next
1.1346 -  case (5 c e)
1.1347 +  case (5 c e)
1.1348    then have "c > 0" by simp hence rcpos: "real_of_int c > 0" by simp
1.1349    from 5 have nbe: "numbound0 e" by simp
1.1350    fix y
1.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))"
1.1352 -  proof (simp add: less_floor_iff , rule allI, rule impI)
1.1353 +  proof (simp add: less_floor_iff , rule allI, rule impI)
1.1354      fix x :: int
1.1355      assume A: "real_of_int x + 1 \<le> - (Inum (y # bs) e / real_of_int c)"
1.1356      hence th1:"real_of_int x < - (Inum (y # bs) e / real_of_int c)" by simp
1.1357      with rcpos  have "(real_of_int c)*(real_of_int x) < (real_of_int c)*(- (Inum (y # bs) e / real_of_int c))"
1.1358        by (simp only: mult_strict_left_mono [OF th1 rcpos])
1.1359 -    thus "real_of_int c * real_of_int x + Inum (real_of_int x # bs) e < 0"
1.1360 +    thus "real_of_int c * real_of_int x + Inum (real_of_int x # bs) e < 0"
1.1361        using numbound0_I[OF nbe, where b="y" and bs="bs" and b'="real_of_int x"] rcpos by simp
1.1362    qed
1.1363    thus ?case by blast
1.1364  next
1.1365 -  case (6 c e)
1.1366 +  case (6 c e)
1.1367    then have "c > 0" by simp hence rcpos: "real_of_int c > 0" by simp
1.1368    from 6 have nbe: "numbound0 e" by simp
1.1369    fix y
1.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))"
1.1371 -  proof (simp add: less_floor_iff , rule allI, rule impI)
1.1372 +  proof (simp add: less_floor_iff , rule allI, rule impI)
1.1373      fix x :: int
1.1374      assume A: "real_of_int x + 1 \<le> - (Inum (y # bs) e / real_of_int c)"
1.1375      hence th1:"real_of_int x < - (Inum (y # bs) e / real_of_int c)" by simp
1.1376      with rcpos  have "(real_of_int c)*(real_of_int x) < (real_of_int c)*(- (Inum (y # bs) e / real_of_int c))"
1.1377        by (simp only: mult_strict_left_mono [OF th1 rcpos])
1.1378 -    thus "real_of_int c * real_of_int x + Inum (real_of_int x # bs) e \<le> 0"
1.1379 +    thus "real_of_int c * real_of_int x + Inum (real_of_int x # bs) e \<le> 0"
1.1380        using numbound0_I[OF nbe, where b="y" and bs="bs" and b'="real_of_int x"] rcpos by simp
1.1381    qed
1.1382    thus ?case by blast
1.1383  next
1.1384 -  case (7 c e)
1.1385 +  case (7 c e)
1.1386    then have "c > 0" by simp hence rcpos: "real_of_int c > 0" by simp
1.1387    from 7 have nbe: "numbound0 e" by simp
1.1388    fix y
1.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))"
1.1390 -  proof (simp add: less_floor_iff , rule allI, rule impI)
1.1391 +  proof (simp add: less_floor_iff , rule allI, rule impI)
1.1392      fix x :: int
1.1393      assume A: "real_of_int x + 1 \<le> - (Inum (y # bs) e / real_of_int c)"
1.1394      hence th1:"real_of_int x < - (Inum (y # bs) e / real_of_int c)" by simp
1.1395      with rcpos  have "(real_of_int c)*(real_of_int x) < (real_of_int c)*(- (Inum (y # bs) e / real_of_int c))"
1.1396        by (simp only: mult_strict_left_mono [OF th1 rcpos])
1.1397 -    thus "\<not> (real_of_int c * real_of_int x + Inum (real_of_int x # bs) e>0)"
1.1398 +    thus "\<not> (real_of_int c * real_of_int x + Inum (real_of_int x # bs) e>0)"
1.1399        using numbound0_I[OF nbe, where b="y" and bs="bs" and b'="real_of_int x"] rcpos by simp
1.1400    qed
1.1401    thus ?case by blast
1.1402  next
1.1403 -  case (8 c e)
1.1404 +  case (8 c e)
1.1405    then have "c > 0" by simp hence rcpos: "real_of_int c > 0" by simp
1.1406    from 8 have nbe: "numbound0 e" by simp
1.1407    fix y
1.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))"
1.1409 -  proof (simp add: less_floor_iff , rule allI, rule impI)
1.1410 +  proof (simp add: less_floor_iff , rule allI, rule impI)
1.1411      fix x :: int
1.1412      assume A: "real_of_int x + 1 \<le> - (Inum (y # bs) e / real_of_int c)"
1.1413      hence th1:"real_of_int x < - (Inum (y # bs) e / real_of_int c)" by simp
1.1414      with rcpos  have "(real_of_int c)*(real_of_int x) < (real_of_int c)*(- (Inum (y # bs) e / real_of_int c))"
1.1415        by (simp only: mult_strict_left_mono [OF th1 rcpos])
1.1416 -    thus "\<not> real_of_int c * real_of_int x + Inum (real_of_int x # bs) e \<ge> 0"
1.1417 +    thus "\<not> real_of_int c * real_of_int x + Inum (real_of_int x # bs) e \<ge> 0"
1.1418        using numbound0_I[OF nbe, where b="y" and bs="bs" and b'="real_of_int x"] rcpos by simp
1.1419    qed
1.1420    thus ?case by blast
1.1421 @@ -2145,24 +2145,24 @@
1.1422    assumes d: "d_\<delta> p d" and linp: "iszlfm p (a # bs)"
1.1423    shows "Ifm ((real_of_int(x - k*d))#bs) (minusinf p) = Ifm (real_of_int x #bs) (minusinf p)"
1.1424  using linp d
1.1425 -proof(induct p rule: iszlfm.induct)
1.1426 +proof(induct p rule: iszlfm.induct)
1.1427    case (9 i c e) hence nbe: "numbound0 e"  and id: "i dvd d" by simp+
1.1428      hence "\<exists> k. d=i*k" by (simp add: dvd_def)
1.1429      then obtain "di" where di_def: "d=i*di" by blast
1.1430 -    show ?case
1.1431 +    show ?case
1.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)
1.1433 -      assume
1.1434 +      assume
1.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"
1.1436        (is "?ri rdvd ?rc*?rx - ?rc*(?rk*?rd) + ?I x e" is "?ri rdvd ?rt")
1.1437        hence "\<exists> (l::int). ?rt = ?ri * (real_of_int l)" by (simp add: rdvd_def)
1.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))"
1.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))"
1.1440          by (simp add: algebra_simps di_def)
1.1441        hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri*(real_of_int (l + c*k*di))"
1.1443        hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri* (real_of_int l)" by blast
1.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
1.1445      next
1.1446 -      assume
1.1447 +      assume
1.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")
1.1449        hence "\<exists> (l::int). ?rc*?rx+?e = ?ri * (real_of_int l)" by (simp add: rdvd_def)
1.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
1.1451 @@ -2176,20 +2176,20 @@
1.1452    case (10 i c e) hence nbe: "numbound0 e"  and id: "i dvd d" by simp+
1.1453      hence "\<exists> k. d=i*k" by (simp add: dvd_def)
1.1454      then obtain "di" where di_def: "d=i*di" by blast
1.1455 -    show ?case
1.1456 +    show ?case
1.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)
1.1458 -      assume
1.1459 +      assume
1.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"
1.1461        (is "?ri rdvd ?rc*?rx - ?rc*(?rk*?rd) + ?I x e" is "?ri rdvd ?rt")
1.1462        hence "\<exists> (l::int). ?rt = ?ri * (real_of_int l)" by (simp add: rdvd_def)
1.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))"
1.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))"
1.1465          by (simp add: algebra_simps di_def)
1.1466        hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri*(real_of_int (l + c*k*di))"
1.1468        hence "\<exists> (l::int). ?rc*?rx+ ?I x e = ?ri* (real_of_int l)" by blast
1.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
1.1470      next
1.1471 -      assume
1.1472 +      assume
1.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")
1.1474        hence "\<exists> (l::int). ?rc*?rx+?e = ?ri * (real_of_int l)"
1.1476 @@ -2221,7 +2221,7 @@
1.1477
1.1478  lemma minusinf_bex:
1.1479    assumes lin: "iszlfm p (real_of_int (a::int) #bs)"
1.1480 -  shows "(\<exists> (x::int). Ifm (real_of_int x#bs) (minusinf p)) =
1.1481 +  shows "(\<exists> (x::int). Ifm (real_of_int x#bs) (minusinf p)) =
1.1482           (\<exists> (x::int)\<in> {1..\<delta> p}. Ifm (real_of_int x#bs) (minusinf p))"
1.1483    (is "(\<exists> x. ?P x) = _")
1.1484  proof-
1.1485 @@ -2234,7 +2234,7 @@
1.1486
1.1487  lemma dvd1_eq1: "x >0 \<Longrightarrow> (x::int) dvd 1 = (x = 1)" by auto
1.1488
1.1489 -consts
1.1490 +consts
1.1491    a_\<beta> :: "fm \<Rightarrow> int \<Rightarrow> fm" (* adjusts the coeffitients of a formula *)
1.1492    d_\<beta> :: "fm \<Rightarrow> int \<Rightarrow> bool" (* tests if all coeffs c of c divide a given l*)
1.1493    \<zeta>  :: "fm \<Rightarrow> int" (* computes the lcm of all coefficients of x*)
1.1494 @@ -2242,8 +2242,8 @@
1.1495    \<alpha> :: "fm \<Rightarrow> num list"
1.1496
1.1497  recdef a_\<beta> "measure size"
1.1498 -  "a_\<beta> (And p q) = (\<lambda> k. And (a_\<beta> p k) (a_\<beta> q k))"
1.1499 -  "a_\<beta> (Or p q) = (\<lambda> k. Or (a_\<beta> p k) (a_\<beta> q k))"
1.1500 +  "a_\<beta> (And p q) = (\<lambda> k. And (a_\<beta> p k) (a_\<beta> q k))"
1.1501 +  "a_\<beta> (Or p q) = (\<lambda> k. Or (a_\<beta> p k) (a_\<beta> q k))"
1.1502    "a_\<beta> (Eq  (CN 0 c e)) = (\<lambda> k. Eq (CN 0 1 (Mul (k div c) e)))"
1.1503    "a_\<beta> (NEq (CN 0 c e)) = (\<lambda> k. NEq (CN 0 1 (Mul (k div c) e)))"
1.1504    "a_\<beta> (Lt  (CN 0 c e)) = (\<lambda> k. Lt (CN 0 1 (Mul (k div c) e)))"
1.1505 @@ -2255,8 +2255,8 @@
1.1506    "a_\<beta> p = (\<lambda> k. p)"
1.1507
1.1508  recdef d_\<beta> "measure size"
1.1509 -  "d_\<beta> (And p q) = (\<lambda> k. (d_\<beta> p k) \<and> (d_\<beta> q k))"
1.1510 -  "d_\<beta> (Or p q) = (\<lambda> k. (d_\<beta> p k) \<and> (d_\<beta> q k))"
1.1511 +  "d_\<beta> (And p q) = (\<lambda> k. (d_\<beta> p k) \<and> (d_\<beta> q k))"
1.1512 +  "d_\<beta> (Or p q) = (\<lambda> k. (d_\<beta> p k) \<and> (d_\<beta> q k))"
1.1513    "d_\<beta> (Eq  (CN 0 c e)) = (\<lambda> k. c dvd k)"
1.1514    "d_\<beta> (NEq (CN 0 c e)) = (\<lambda> k. c dvd k)"
1.1515    "d_\<beta> (Lt  (CN 0 c e)) = (\<lambda> k. c dvd k)"
1.1516 @@ -2268,8 +2268,8 @@
1.1517    "d_\<beta> p = (\<lambda> k. True)"
1.1518
1.1519  recdef \<zeta> "measure size"
1.1520 -  "\<zeta> (And p q) = lcm (\<zeta> p) (\<zeta> q)"
1.1521 -  "\<zeta> (Or p q) = lcm (\<zeta> p) (\<zeta> q)"
1.1522 +  "\<zeta> (And p q) = lcm (\<zeta> p) (\<zeta> q)"
1.1523 +  "\<zeta> (Or p q) = lcm (\<zeta> p) (\<zeta> q)"
1.1524    "\<zeta> (Eq  (CN 0 c e)) = c"
1.1525    "\<zeta> (NEq (CN 0 c e)) = c"
1.1526    "\<zeta> (Lt  (CN 0 c e)) = c"
1.1527 @@ -2281,8 +2281,8 @@
1.1528    "\<zeta> p = 1"
1.1529
1.1530  recdef \<beta> "measure size"
1.1531 -  "\<beta> (And p q) = (\<beta> p @ \<beta> q)"
1.1532 -  "\<beta> (Or p q) = (\<beta> p @ \<beta> q)"
1.1533 +  "\<beta> (And p q) = (\<beta> p @ \<beta> q)"
1.1534 +  "\<beta> (Or p q) = (\<beta> p @ \<beta> q)"
1.1535    "\<beta> (Eq  (CN 0 c e)) = [Sub (C (- 1)) e]"
1.1536    "\<beta> (NEq (CN 0 c e)) = [Neg e]"
1.1537    "\<beta> (Lt  (CN 0 c e)) = []"
1.1538 @@ -2292,8 +2292,8 @@
1.1539    "\<beta> p = []"
1.1540
1.1541  recdef \<alpha> "measure size"
1.1542 -  "\<alpha> (And p q) = (\<alpha> p @ \<alpha> q)"
1.1543 -  "\<alpha> (Or p q) = (\<alpha> p @ \<alpha> q)"
1.1544 +  "\<alpha> (And p q) = (\<alpha> p @ \<alpha> q)"
1.1545 +  "\<alpha> (Or p q) = (\<alpha> p @ \<alpha> q)"
1.1546    "\<alpha> (Eq  (CN 0 c e)) = [Add (C (- 1)) e]"
1.1547    "\<alpha> (NEq (CN 0 c e)) = [e]"
1.1548    "\<alpha> (Lt  (CN 0 c e)) = [e]"
1.1549 @@ -2303,8 +2303,8 @@
1.1550    "\<alpha> p = []"
1.1551  consts mirror :: "fm \<Rightarrow> fm"
1.1552  recdef mirror "measure size"
1.1553 -  "mirror (And p q) = And (mirror p) (mirror q)"
1.1554 -  "mirror (Or p q) = Or (mirror p) (mirror q)"
1.1555 +  "mirror (And p q) = And (mirror p) (mirror q)"
1.1556 +  "mirror (Or p q) = Or (mirror p) (mirror q)"
1.1557    "mirror (Eq  (CN 0 c e)) = Eq (CN 0 c (Neg e))"
1.1558    "mirror (NEq (CN 0 c e)) = NEq (CN 0 c (Neg e))"
1.1559    "mirror (Lt  (CN 0 c e)) = Gt (CN 0 c (Neg e))"
1.1560 @@ -2320,9 +2320,9 @@
1.1561    shows "(Inum (real_of_int (i::int)#bs)) ` set (\<alpha> p) = (Inum (real_of_int i#bs)) ` set (\<beta> (mirror p))"
1.1562    using lp by (induct p rule: mirror.induct) auto
1.1563
1.1564 -lemma mirror:
1.1565 +lemma mirror:
1.1566    assumes lp: "iszlfm p (a#bs)"
1.1567 -  shows "Ifm (real_of_int (x::int)#bs) (mirror p) = Ifm (real_of_int (- x)#bs) p"
1.1568 +  shows "Ifm (real_of_int (x::int)#bs) (mirror p) = Ifm (real_of_int (- x)#bs) p"
1.1569    using lp
1.1570  proof(induct p rule: iszlfm.induct)
1.1571    case (9 j c e)
1.1572 @@ -2345,7 +2345,7 @@
1.1573  lemma mirror_l: "iszlfm p (a#bs) \<Longrightarrow> iszlfm (mirror p) (a#bs)"
1.1574    by (induct p rule: mirror.induct) (auto simp add: isint_neg)
1.1575
1.1576 -lemma mirror_d_\<beta>: "iszlfm p (a#bs) \<and> d_\<beta> p 1
1.1577 +lemma mirror_d_\<beta>: "iszlfm p (a#bs) \<and> d_\<beta> p 1
1.1578    \<Longrightarrow> iszlfm (mirror p) (a#bs) \<and> d_\<beta> (mirror p) 1"
1.1579    by (induct p rule: mirror.induct) (auto simp add: isint_neg)
1.1580
1.1581 @@ -2353,7 +2353,7 @@
1.1582    by (induct p rule: mirror.induct) auto
1.1583
1.1584
1.1585 -lemma mirror_ex:
1.1586 +lemma mirror_ex:
1.1587    assumes lp: "iszlfm p (real_of_int (i::int)#bs)"
1.1588    shows "(\<exists> (x::int). Ifm (real_of_int x#bs) (mirror p)) = (\<exists> (x::int). Ifm (real_of_int x#bs) p)"
1.1589    (is "(\<exists> x. ?I x ?mp) = (\<exists> x. ?I x p)")
1.1590 @@ -2361,7 +2361,7 @@
1.1591    fix x assume "?I x ?mp" hence "?I (- x) p" using mirror[OF lp] by blast
1.1592    thus "\<exists> x. ?I x p" by blast
1.1593  next
1.1594 -  fix x assume "?I x p" hence "?I (- x) ?mp"
1.1595 +  fix x assume "?I x p" hence "?I (- x) ?mp"
1.1596      using mirror[OF lp, where x="- x", symmetric] by auto
1.1597    thus "\<exists> x. ?I x ?mp" by blast
1.1598  qed
1.1599 @@ -2370,7 +2370,7 @@
1.1600    shows "\<forall> b\<in> set (\<beta> p). numbound0 b"
1.1601    using lp by (induct p rule: \<beta>.induct,auto)
1.1602
1.1603 -lemma d_\<beta>_mono:
1.1604 +lemma d_\<beta>_mono:
1.1605    assumes linp: "iszlfm p (a #bs)"
1.1606    and dr: "d_\<beta> p l"
1.1607    and d: "l dvd l'"
1.1608 @@ -2383,7 +2383,7 @@
1.1609  using lp
1.1611
1.1612 -lemma \<zeta>:
1.1613 +lemma \<zeta>:
1.1614    assumes linp: "iszlfm p (a #bs)"
1.1615    shows "\<zeta> p > 0 \<and> d_\<beta> p (\<zeta> p)"
1.1616  using linp
1.1617 @@ -2391,15 +2391,15 @@
1.1618    case (1 p q)
1.1619    then  have dl1: "\<zeta> p dvd lcm (\<zeta> p) (\<zeta> q)" by simp
1.1620    from 1 have dl2: "\<zeta> q dvd lcm (\<zeta> p) (\<zeta> q)" by simp
1.1621 -  from 1 d_\<beta>_mono[where p = "p" and l="\<zeta> p" and l'="lcm (\<zeta> p) (\<zeta> q)"]
1.1622 -    d_\<beta>_mono[where p = "q" and l="\<zeta> q" and l'="lcm (\<zeta> p) (\<zeta> q)"]
1.1623 +  from 1 d_\<beta>_mono[where p = "p" and l="\<zeta> p" and l'="lcm (\<zeta> p) (\<zeta> q)"]
1.1624 +    d_\<beta>_mono[where p = "q" and l="\<zeta> q" and l'="lcm (\<zeta> p) (\<zeta> q)"]
1.1625      dl1 dl2 show ?case by (auto simp add: lcm_pos_int)
1.1626  next
1.1627    case (2 p q)
1.1628    then have dl1: "\<zeta> p dvd lcm (\<zeta> p) (\<zeta> q)" by simp
1.1629    from 2 have dl2: "\<zeta> q dvd lcm (\<zeta> p) (\<zeta> q)" by simp
1.1630 -  from 2 d_\<beta>_mono[where p = "p" and l="\<zeta> p" and l'="lcm (\<zeta> p) (\<zeta> q)"]
1.1631 -    d_\<beta>_mono[where p = "q" and l="\<zeta> q" and l'="lcm (\<zeta> p) (\<zeta> q)"]
1.1632 +  from 2 d_\<beta>_mono[where p = "p" and l="\<zeta> p" and l'="lcm (\<zeta> p) (\<zeta> q)"]
1.1633 +    d_\<beta>_mono[where p = "q" and l="\<zeta> q" and l'="lcm (\<zeta> p) (\<zeta> q)"]
1.1634      dl1 dl2 show ?case by (auto simp add: lcm_pos_int)
1.1635  qed (auto simp add: lcm_pos_int)
1.1636
1.1637 @@ -2412,10 +2412,10 @@
1.1638      from cp have cnz: "c \<noteq> 0" by simp
1.1639      have "c div c\<le> l div c"
1.1640        by (simp add: zdiv_mono1[OF clel cp])
1.1641 -    then have ldcp:"0 < l div c"
1.1642 +    then have ldcp:"0 < l div c"
1.1643        by (simp add: div_self[OF cnz])
1.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
1.1645 -    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric]
1.1646 +    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric]
1.1647        by simp
1.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)) =
1.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)"
1.1650 @@ -2430,10 +2430,10 @@
1.1651      from cp have cnz: "c \<noteq> 0" by simp
1.1652      have "c div c\<le> l div c"
1.1653        by (simp add: zdiv_mono1[OF clel cp])
1.1654 -    then have ldcp:"0 < l div c"
1.1655 +    then have ldcp:"0 < l div c"
1.1656        by (simp add: div_self[OF cnz])
1.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
1.1658 -    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric]
1.1659 +    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric]
1.1660        by simp
1.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)) =
1.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)"
1.1663 @@ -2448,10 +2448,10 @@
1.1664      from cp have cnz: "c \<noteq> 0" by simp
1.1665      have "c div c\<le> l div c"
1.1666        by (simp add: zdiv_mono1[OF clel cp])
1.1667 -    then have ldcp:"0 < l div c"
1.1668 +    then have ldcp:"0 < l div c"
1.1669        by (simp add: div_self[OF cnz])
1.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
1.1671 -    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric]
1.1672 +    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric]
1.1673        by simp
1.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)) =
1.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)"
1.1676 @@ -2466,10 +2466,10 @@
1.1677      from cp have cnz: "c \<noteq> 0" by simp
1.1678      have "c div c\<le> l div c"
1.1679        by (simp add: zdiv_mono1[OF clel cp])
1.1680 -    then have ldcp:"0 < l div c"
1.1681 +    then have ldcp:"0 < l div c"
1.1682        by (simp add: div_self[OF cnz])
1.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
1.1684 -    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric]
1.1685 +    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric]
1.1686        by simp
1.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)) =
1.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)"
1.1689 @@ -2484,10 +2484,10 @@
1.1690      from cp have cnz: "c \<noteq> 0" by simp
1.1691      have "c div c\<le> l div c"
1.1692        by (simp add: zdiv_mono1[OF clel cp])
1.1693 -    then have ldcp:"0 < l div c"
1.1694 +    then have ldcp:"0 < l div c"
1.1695        by (simp add: div_self[OF cnz])
1.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
1.1697 -    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric]
1.1698 +    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric]
1.1699        by simp
1.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)) =
1.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)"
1.1702 @@ -2502,10 +2502,10 @@
1.1703      from cp have cnz: "c \<noteq> 0" by simp
1.1704      have "c div c\<le> l div c"
1.1705        by (simp add: zdiv_mono1[OF clel cp])
1.1706 -    then have ldcp:"0 < l div c"
1.1707 +    then have ldcp:"0 < l div c"
1.1708        by (simp add: div_self[OF cnz])
1.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
1.1710 -    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric]
1.1711 +    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric]
1.1712        by simp
1.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)) =
1.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)"
1.1715 @@ -2520,27 +2520,27 @@
1.1716      from cp have cnz: "c \<noteq> 0" by simp
1.1717      have "c div c\<le> l div c"
1.1718        by (simp add: zdiv_mono1[OF clel cp])
1.1719 -    then have ldcp:"0 < l div c"
1.1720 +    then have ldcp:"0 < l div c"
1.1721        by (simp add: div_self[OF cnz])
1.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
1.1723 -    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric]
1.1724 +    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric]
1.1725        by simp
1.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
1.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)
1.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)"
1.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
1.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
1.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
1.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
1.1733  next
1.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+
1.1735      from lp cp have clel: "c\<le>l" by (simp add: zdvd_imp_le [OF d' lp])
1.1736      from cp have cnz: "c \<noteq> 0" by simp
1.1737      have "c div c\<le> l div c"
1.1738        by (simp add: zdiv_mono1[OF clel cp])
1.1739 -    then have ldcp:"0 < l div c"
1.1740 +    then have ldcp:"0 < l div c"
1.1741        by (simp add: div_self[OF cnz])
1.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
1.1743 -    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric]
1.1744 +    hence cl:"c * (l div c) =l" using zmod_zdiv_equality[where a="l" and b="c", symmetric]
1.1745        by simp
1.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
1.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)
1.1748 @@ -2557,7 +2557,7 @@
1.1749    have "(\<exists> x. l dvd x \<and> ?P x) = (\<exists> (x::int). ?P (l*x))"
1.1750      using unity_coeff_ex[where l="l" and P="?P", simplified] by simp
1.1751    also have "\<dots> = (\<exists> (x::int). ?P' x)" using a_\<beta>[OF linp d lp] by simp
1.1752 -  finally show ?thesis  .
1.1753 +  finally show ?thesis  .
1.1754  qed
1.1755
1.1756  lemma \<beta>:
1.1757 @@ -2584,40 +2584,40 @@
1.1758    from ie1 have ie: "real_of_int (floor ?e) = ?e" using isint_iff[where n="e" and bs="a#bs"]
1.1759        numbound0_I[OF bn,where b="a" and b'="real_of_int x" and bs="bs"]
1.1761 -    {assume "real_of_int (x-d) +?e > 0" hence ?case using c1
1.1762 +    {assume "real_of_int (x-d) +?e > 0" hence ?case using c1
1.1763        numbound0_I[OF bn,where b="real_of_int (x-d)" and b'="real_of_int x" and bs="bs"]
1.1764          by (simp del: of_int_minus)}
1.1765      moreover
1.1766 -    {assume H: "\<not> real_of_int (x-d) + ?e > 0"
1.1767 +    {assume H: "\<not> real_of_int (x-d) + ?e > 0"
1.1768        let ?v="Neg e"
1.1769        have vb: "?v \<in> set (\<beta> (Gt (CN 0 c e)))" by simp
1.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"]]
1.1771 -      have nob: "\<not> (\<exists> j\<in> {1 ..d}. real_of_int x =  - ?e + real_of_int j)" by auto
1.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"]]
1.1773 +      have nob: "\<not> (\<exists> j\<in> {1 ..d}. real_of_int x =  - ?e + real_of_int j)" by auto
1.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)
1.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"
1.1776          using ie by simp
1.1777        hence "x + floor ?e \<ge> 1 \<and> x + floor ?e \<le> d"  by simp
1.1778        hence "\<exists> (j::int) \<in> {1 .. d}. j = x + floor ?e" by simp
1.1779 -      hence "\<exists> (j::int) \<in> {1 .. d}. real_of_int x = real_of_int (- floor ?e + j)" by force
1.1780 -      hence "\<exists> (j::int) \<in> {1 .. d}. real_of_int x = - ?e + real_of_int j"
1.1781 +      hence "\<exists> (j::int) \<in> {1 .. d}. real_of_int x = real_of_int (- floor ?e + j)" by force
1.1782 +      hence "\<exists> (j::int) \<in> {1 .. d}. real_of_int x = - ?e + real_of_int j"
1.1783          by (simp add: ie[simplified isint_iff])
1.1784        with nob have ?case by auto}
1.1785      ultimately show ?case by blast
1.1786  next
1.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"
1.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"
1.1789      and ie1:"isint e (a #bs)" using dvd1_eq1[where x="c"] by simp+
1.1790      let ?e = "Inum (real_of_int x # bs) e"
1.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"]
1.1793 -    {assume "real_of_int (x-d) +?e \<ge> 0" hence ?case using  c1
1.1794 +    {assume "real_of_int (x-d) +?e \<ge> 0" hence ?case using  c1
1.1795        numbound0_I[OF bn,where b="real_of_int (x-d)" and b'="real_of_int x" and bs="bs"]
1.1796          by (simp del: of_int_minus)}
1.1797      moreover
1.1798 -    {assume H: "\<not> real_of_int (x-d) + ?e \<ge> 0"
1.1799 +    {assume H: "\<not> real_of_int (x-d) + ?e \<ge> 0"
1.1800        let ?v="Sub (C (- 1)) e"
1.1801        have vb: "?v \<in> set (\<beta> (Ge (CN 0 c e)))" by simp
1.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"]]
1.1803 -      have nob: "\<not> (\<exists> j\<in> {1 ..d}. real_of_int x =  - ?e - 1 + real_of_int j)" by auto
1.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"]]
1.1805 +      have nob: "\<not> (\<exists> j\<in> {1 ..d}. real_of_int x =  - ?e - 1 + real_of_int j)" by auto
1.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)
1.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"
1.1808          using ie by simp
1.1809 @@ -2625,12 +2625,12 @@
1.1810        hence "\<exists> (j::int) \<in> {1 .. d}. j = x + floor ?e + 1" by simp
1.1811        hence "\<exists> (j::int) \<in> {1 .. d}. x= - floor ?e - 1 + j" by (simp add: algebra_simps)
1.1812        hence "\<exists> (j::int) \<in> {1 .. d}. real_of_int x= real_of_int (- floor ?e - 1 + j)" by presburger
1.1813 -      hence "\<exists> (j::int) \<in> {1 .. d}. real_of_int x= - ?e - 1 + real_of_int j"
1.1814 +      hence "\<exists> (j::int) \<in> {1 .. d}. real_of_int x= - ?e - 1 + real_of_int j"
1.1815          by (simp add: ie[simplified isint_iff])
1.1816        with nob have ?case by simp }
1.1817      ultimately show ?case by blast
1.1818  next
1.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"
1.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"
1.1821      and bn:"numbound0 e" and ie1: "isint e (a #bs)" using dvd1_eq1[where x="c"] by simp+
1.1822      let ?e = "Inum (real_of_int x # bs) e"
1.1823      let ?v="(Sub (C (- 1)) e)"
1.1824 @@ -2639,12 +2639,12 @@
1.1825        by simp (erule ballE[where x="1"],
1.1826          simp_all add:algebra_simps numbound0_I[OF bn,where b="real_of_int x"and b'="a"and bs="bs"])
1.1827  next
1.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"
1.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"
1.1830      and bn:"numbound0 e" and ie1: "isint e (a #bs)" using dvd1_eq1[where x="c"] by simp+
1.1831      let ?e = "Inum (real_of_int x # bs) e"
1.1832      let ?v="Neg e"
1.1833      have vb: "?v \<in> set (\<beta> (NEq (CN 0 c e)))" by simp
1.1834 -    {assume "real_of_int x - real_of_int d + Inum ((real_of_int (x -d)) # bs) e \<noteq> 0"
1.1835 +    {assume "real_of_int x - real_of_int d + Inum ((real_of_int (x -d)) # bs) e \<noteq> 0"
1.1836        hence ?case by (simp add: c1)}
1.1837      moreover
1.1838      {assume H: "real_of_int x - real_of_int d + Inum ((real_of_int (x -d)) # bs) e = 0"
1.1839 @@ -2653,57 +2653,57 @@
1.1840          by (simp add: numbound0_I[OF bn,where b="real_of_int x - real_of_int d"and b'="a"and bs="bs"])
1.1841         with 4(5) have ?case using dp by simp}
1.1842    ultimately show ?case by blast
1.1843 -next
1.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"
1.1845 +next
1.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"
1.1847      and bn:"numbound0 e" using dvd1_eq1[where x="c"] by simp+
1.1848    let ?e = "Inum (real_of_int x # bs) e"
1.1849 -  from 9 have "isint e (a #bs)"  by simp
1.1850 +  from 9 have "isint e (a #bs)"  by simp
1.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"]
1.1853    from 9 have id: "j dvd d" by simp
1.1854    from c1 ie[symmetric] have "?p x = (real_of_int j rdvd real_of_int (x+ floor ?e))" by simp
1.1855 -  also have "\<dots> = (j dvd x + floor ?e)"
1.1856 +  also have "\<dots> = (j dvd x + floor ?e)"
1.1857      using int_rdvd_real[where i="j" and x="real_of_int (x+ floor ?e)"] by simp
1.1858 -  also have "\<dots> = (j dvd x - d + floor ?e)"
1.1859 +  also have "\<dots> = (j dvd x - d + floor ?e)"
1.1860      using dvd_period[OF id, where x="x" and c="-1" and t="floor ?e"] by simp
1.1861 -  also have "\<dots> = (real_of_int j rdvd real_of_int (x - d + floor ?e))"
1.1862 +  also have "\<dots> = (real_of_int j rdvd real_of_int (x - d + floor ?e))"
1.1863      using int_rdvd_real[where i="j" and x="real_of_int (x-d + floor ?e)",symmetric, simplified]
1.1864        ie by simp
1.1865 -  also have "\<dots> = (real_of_int j rdvd real_of_int x - real_of_int d + ?e)"
1.1866 +  also have "\<dots> = (real_of_int j rdvd real_of_int x - real_of_int d + ?e)"
1.1867      using ie by simp
1.1868 -  finally show ?case
1.1869 +  finally show ?case
1.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
1.1871  next
1.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+
1.1873    let ?e = "Inum (real_of_int x # bs) e"
1.1874 -  from 10 have "isint e (a#bs)"  by simp
1.1875 +  from 10 have "isint e (a#bs)"  by simp
1.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"]
1.1878    from 10 have id: "j dvd d" by simp
1.1879    from c1 ie[symmetric] have "?p x = (\<not> real_of_int j rdvd real_of_int (x+ floor ?e))" by simp
1.1880 -  also have "\<dots> = (\<not> j dvd x + floor ?e)"
1.1881 +  also have "\<dots> = (\<not> j dvd x + floor ?e)"
1.1882      using int_rdvd_real[where i="j" and x="real_of_int (x+ floor ?e)"] by simp
1.1883 -  also have "\<dots> = (\<not> j dvd x - d + floor ?e)"
1.1884 +  also have "\<dots> = (\<not> j dvd x - d + floor ?e)"
1.1885      using dvd_period[OF id, where x="x" and c="-1" and t="floor ?e"] by simp
1.1886 -  also have "\<dots> = (\<not> real_of_int j rdvd real_of_int (x - d + floor ?e))"
1.1887 +  also have "\<dots> = (\<not> real_of_int j rdvd real_of_int (x - d + floor ?e))"
1.1888      using int_rdvd_real[where i="j" and x="real_of_int (x-d + floor ?e)",symmetric, simplified]
1.1889        ie by simp
1.1890 -  also have "\<dots> = (\<not> real_of_int j rdvd real_of_int x - real_of_int d + ?e)"
1.1891 +  also have "\<dots> = (\<not> real_of_int j rdvd real_of_int x - real_of_int d + ?e)"
1.1892      using ie by simp
1.1893    finally show ?case
1.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
1.1895  qed (auto simp add: numbound0_I[where bs="bs" and b="real_of_int (x - d)" and b'="real_of_int x"]
1.1896    simp del: of_int_diff)
1.1897
1.1898 -lemma \<beta>':
1.1899 +lemma \<beta>':
1.1900    assumes lp: "iszlfm p (a #bs)"
1.1901    and u: "d_\<beta> p 1"
1.1902    and d: "d_\<delta> p d"
1.1903    and dp: "d > 0"
1.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)")
1.1905  proof(clarify)
1.1906 -  fix x
1.1907 -  assume nb:"?b" and px: "?P x"
1.1908 +  fix x
1.1909 +  assume nb:"?b" and px: "?P x"
1.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)"
1.1911      by auto
1.1912    from  \<beta>[OF lp u d dp nb2 px] show "?P (x -d )" .
1.1913 @@ -2714,7 +2714,7 @@
1.1914  using lp by (induct p rule: iszlfm.induct) (auto simp add: isint_neg isint_sub)
1.1915
1.1916  lemma cpmi_eq: "0 < D \<Longrightarrow> (EX z::int. ALL x. x < z --> (P x = P1 x))
1.1917 -==> ALL x.~(EX (j::int) : {1..D}. EX (b::int) : B. P(b+j)) --> P (x) --> P (x - D)
1.1918 +==> ALL x.~(EX (j::int) : {1..D}. EX (b::int) : B. P(b+j)) --> P (x) --> P (x - D)
1.1919  ==> (ALL (x::int). ALL (k::int). ((P1 x)= (P1 (x-k*D))))
1.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)))"
1.1921  apply(rule iffI)
1.1922 @@ -2744,18 +2744,18 @@
1.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))"
1.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)))")
1.1925  proof-
1.1926 -  from minusinf_inf[OF lp]
1.1927 +  from minusinf_inf[OF lp]
1.1928    have th: "\<exists>(z::int). \<forall>x<z. ?P (real_of_int x) = ?M x" by blast
1.1929    let ?B' = "{floor (?I b) | b. b\<in> ?B}"
1.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
1.1931 -  from B[rule_format]
1.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))"
1.1933 +  from B[rule_format]
1.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))"
1.1935      by simp
1.1936    also have "\<dots> = (\<exists>j\<in>?D. \<exists>b\<in> ?B. ?P (real_of_int (floor (?I b) + j)))" by simp
1.1937    also have"\<dots> = (\<exists> j \<in> ?D. \<exists> b \<in> ?B'. ?P (real_of_int (b + j)))"  by blast
1.1938 -  finally have BB':
1.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)))"
1.1940 -    by blast
1.1941 +  finally have BB':
1.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)))"
1.1943 +    by blast
1.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
1.1945    from minusinf_repeats[OF d lp]
1.1946    have th3: "\<forall> x k. ?M x = ?M (x-k*d)" by simp
1.1947 @@ -2765,14 +2765,14 @@
1.1948      (* Reddy and Loveland *)
1.1949
1.1950
1.1951 -consts
1.1952 +consts
1.1953    \<rho> :: "fm \<Rightarrow> (num \<times> int) list" (* Compute the Reddy and Loveland Bset*)
1.1954    \<sigma>_\<rho>:: "fm \<Rightarrow> num \<times> int \<Rightarrow> fm" (* Performs the modified substitution of Reddy and Loveland*)
1.1955    \<alpha>_\<rho> :: "fm \<Rightarrow> (num\<times>int) list"
1.1956    a_\<rho> :: "fm \<Rightarrow> int \<Rightarrow> fm"
1.1957  recdef \<rho> "measure size"
1.1958 -  "\<rho> (And p q) = (\<rho> p @ \<rho> q)"
1.1959 -  "\<rho> (Or p q) = (\<rho> p @ \<rho> q)"
1.1960 +  "\<rho> (And p q) = (\<rho> p @ \<rho> q)"
1.1961 +  "\<rho> (Or p q) = (\<rho> p @ \<rho> q)"
1.1962    "\<rho> (Eq  (CN 0 c e)) = [(Sub (C (- 1)) e,c)]"
1.1963    "\<rho> (NEq (CN 0 c e)) = [(Neg e,c)]"
1.1964    "\<rho> (Lt  (CN 0 c e)) = []"
1.1965 @@ -2782,29 +2782,29 @@
1.1966    "\<rho> p = []"
1.1967
1.1968  recdef \<sigma>_\<rho> "measure size"
1.1969 -  "\<sigma>_\<rho> (And p q) = (\<lambda> (t,k). And (\<sigma>_\<rho> p (t,k)) (\<sigma>_\<rho> q (t,k)))"
1.1970 -  "\<sigma>_\<rho> (Or p q) = (\<lambda> (t,k). Or (\<sigma>_\<rho> p (t,k)) (\<sigma>_\<rho> q (t,k)))"
1.1971 -  "\<sigma>_\<rho> (Eq  (CN 0 c e)) = (\<lambda> (t,k). if k dvd c then (Eq (Add (Mul (c div k) t) e))
1.1972 +  "\<sigma>_\<rho> (And p q) = (\<lambda> (t,k). And (\<sigma>_\<rho> p (t,k)) (\<sigma>_\<rho> q (t,k)))"
1.1973 +  "\<sigma>_\<rho> (Or p q) = (\<lambda> (t,k). Or (\<sigma>_\<rho> p (t,k)) (\<sigma>_\<rho> q (t,k)))"
1.1974 +  "\<sigma>_\<rho> (Eq  (CN 0 c e)) = (\<lambda> (t,k). if k dvd c then (Eq (Add (Mul (c div k) t) e))
1.1975                                              else (Eq (Add (Mul c t) (Mul k e))))"
1.1976 -  "\<sigma>_\<rho> (NEq (CN 0 c e)) = (\<lambda> (t,k). if k dvd c then (NEq (Add (Mul (c div k) t) e))
1.1977 +  "\<sigma>_\<rho> (NEq (CN 0 c e)) = (\<lambda> (t,k). if k dvd c then (NEq (Add (Mul (c div k) t) e))
1.1978                                              else (NEq (Add (Mul c t) (Mul k e))))"
1.1979 -  "\<sigma>_\<rho> (Lt  (CN 0 c e)) = (\<lambda> (t,k). if k dvd c then (Lt (Add (Mul (c div k) t) e))
1.1980 +  "\<sigma>_\<rho> (Lt  (CN 0 c e)) = (\<lambda> (t,k). if k dvd c then (Lt (Add (Mul (c div k) t) e))
1.1981                                              else (Lt (Add (Mul c t) (Mul k e))))"
1.1982 -  "\<sigma>_\<rho> (Le  (CN 0 c e)) = (\<lambda> (t,k). if k dvd c then (Le (Add (Mul (c div k) t) e))
1.1983 +  "\<sigma>_\<rho> (Le  (CN 0 c e)) = (\<lambda> (t,k). if k dvd c then (Le (Add (Mul (c div k) t) e))
1.1984                                              else (Le (Add (Mul c t) (Mul k e))))"
1.1985 -  "\<sigma>_\<rho> (Gt  (CN 0 c e)) = (\<lambda> (t,k). if k dvd c then (Gt (Add (Mul (c div k) t) e))
1.1986 +  "\<sigma>_\<rho> (Gt  (CN 0 c e)) = (\<lambda> (t,k). if k dvd c then (Gt (Add (Mul (c div k) t) e))
1.1987                                              else (Gt (Add (Mul c t) (Mul k e))))"
1.1988 -  "\<sigma>_\<rho> (Ge  (CN 0 c e)) = (\<lambda> (t,k). if k dvd c then (Ge (Add (Mul (c div k) t) e))
1.1989 +  "\<sigma>_\<rho> (Ge  (CN 0 c e)) = (\<lambda> (t,k). if k dvd c then (Ge (Add (Mul (c div k) t) e))
1.1990                                              else (Ge (Add (Mul c t) (Mul k e))))"
1.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))
1.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))
1.1993                                              else (Dvd (i*k) (Add (Mul c t) (Mul k e))))"
1.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))
1.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))
1.1996                                              else (NDvd (i*k) (Add (Mul c t) (Mul k e))))"
1.1997    "\<sigma>_\<rho> p = (\<lambda> (t,k). p)"
1.1998
1.1999  recdef \<alpha>_\<rho> "measure size"
1.2000 -  "\<alpha>_\<rho> (And p q) = (\<alpha>_\<rho> p @ \<alpha>_\<rho> q)"
1.2001 -  "\<alpha>_\<rho> (Or p q) = (\<alpha>_\<rho> p @ \<alpha>_\<rho> q)"
1.2002 +  "\<alpha>_\<rho> (And p q) = (\<alpha>_\<rho> p @ \<alpha>_\<rho> q)"
1.2003 +  "\<alpha>_\<rho> (Or p q) = (\<alpha>_\<rho> p @ \<alpha>_\<rho> q)"
1.2004    "\<alpha>_\<rho> (Eq  (CN 0 c e)) = [(Add (C (- 1)) e,c)]"
1.2005    "\<alpha>_\<rho> (NEq (CN 0 c e)) = [(e,c)]"
1.2006    "\<alpha>_\<rho> (Lt  (CN 0 c e)) = [(e,c)]"
1.2007 @@ -2822,19 +2822,19 @@
1.2008    and tnb: "numbound0 t"
1.2009    and tint: "isint t (real_of_int x#bs)"
1.2010    and kdt: "k dvd floor (Inum (b'#bs) t)"
1.2011 -  shows "Ifm (real_of_int x#bs) (\<sigma>_\<rho> p (t,k)) =
1.2012 -  (Ifm ((real_of_int ((floor (Inum (b'#bs) t)) div k))#bs) p)"
1.2013 +  shows "Ifm (real_of_int x#bs) (\<sigma>_\<rho> p (t,k)) =
1.2014 +  (Ifm ((real_of_int ((floor (Inum (b'#bs) t)) div k))#bs) p)"
1.2015    (is "?I (real_of_int x) (?s p) = (?I (real_of_int ((floor (?N b' t)) div k)) p)" is "_ = (?I ?tk p)")
1.2016  using linp kpos tnb
1.2017  proof(induct p rule: \<sigma>_\<rho>.induct)
1.2018 -  case (3 c e)
1.2019 +  case (3 c e)
1.2020    from 3 have cp: "c > 0" and nb: "numbound0 e" by auto
1.2021 -  { assume kdc: "k dvd c"
1.2022 +  { assume kdc: "k dvd c"
1.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
1.2024      from kdc have ?case using real_of_int_div[OF kdc] real_of_int_div[OF kdt]
1.2025        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
1.2026 -      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) }
1.2027 -  moreover
1.2028 +      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) }
1.2029 +  moreover
1.2030    { assume *: "\<not> k dvd c"
1.2031      from kpos have knz': "real_of_int k \<noteq> 0" by simp
1.2032      from tint have ti: "real_of_int (floor (?N (real_of_int x) t)) = ?N (real_of_int x) t"
1.2033 @@ -2851,16 +2851,16 @@
1.2034            numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
1.2036        finally have ?case . }
1.2037 -    ultimately show ?case by blast
1.2038 +    ultimately show ?case by blast
1.2039  next
1.2040 -  case (4 c e)
1.2041 +  case (4 c e)
1.2042    then have cp: "c > 0" and nb: "numbound0 e" by auto
1.2043 -  { assume kdc: "k dvd c"
1.2044 +  { assume kdc: "k dvd c"
1.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
1.2046      from kdc have  ?case using real_of_int_div[OF kdc] real_of_int_div[OF kdt]
1.2047        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
1.2048 -      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) }
1.2049 -  moreover
1.2050 +      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) }
1.2051 +  moreover
1.2052    { assume *: "\<not> k dvd c"
1.2053      from kpos have knz': "real_of_int k \<noteq> 0" by simp
1.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
1.2055 @@ -2876,16 +2876,16 @@
1.2056          numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
1.2058      finally have ?case . }
1.2059 -  ultimately show ?case by blast
1.2060 +  ultimately show ?case by blast
1.2061  next
1.2062 -  case (5 c e)
1.2063 +  case (5 c e)
1.2064    then have cp: "c > 0" and nb: "numbound0 e" by auto
1.2065 -  { assume kdc: "k dvd c"
1.2066 +  { assume kdc: "k dvd c"
1.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
1.2068      from kdc have  ?case using real_of_int_div[OF kdc] real_of_int_div[OF kdt]
1.2069        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
1.2070 -      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) }
1.2071 -  moreover
1.2072 +      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) }
1.2073 +  moreover
1.2074    { assume *: "\<not> k dvd c"
1.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
1.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)"
1.2077 @@ -2900,16 +2900,16 @@
1.2078          numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
1.2080      finally have ?case . }
1.2081 -  ultimately show ?case by blast
1.2082 +  ultimately show ?case by blast
1.2083  next
1.2084    case (6 c e)
1.2085    then have cp: "c > 0" and nb: "numbound0 e" by auto
1.2086 -  { assume kdc: "k dvd c"
1.2087 +  { assume kdc: "k dvd c"
1.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
1.2089      from kdc have  ?case using real_of_int_div[OF kdc] real_of_int_div[OF kdt]
1.2090        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
1.2091 -      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) }
1.2092 -  moreover
1.2093 +      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) }
1.2094 +  moreover
1.2095    { assume *: "\<not> k dvd c"
1.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
1.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)"
1.2098 @@ -2924,16 +2924,16 @@
1.2099          numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
1.2101      finally have ?case . }
1.2102 -  ultimately show ?case by blast
1.2103 +  ultimately show ?case by blast
1.2104  next
1.2105 -  case (7 c e)
1.2106 +  case (7 c e)
1.2107    then have cp: "c > 0" and nb: "numbound0 e" by auto
1.2108 -  { assume kdc: "k dvd c"
1.2109 +  { assume kdc: "k dvd c"
1.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
1.2111      from kdc have  ?case using real_of_int_div[OF kdc] real_of_int_div[OF kdt]
1.2112        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
1.2113 -      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) }
1.2114 -  moreover
1.2115 +      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) }
1.2116 +  moreover
1.2117    { assume *: "\<not> k dvd c"
1.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
1.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)"
1.2120 @@ -2948,16 +2948,16 @@
1.2121          numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
1.2123      finally have ?case . }
1.2124 -  ultimately show ?case by blast
1.2125 +  ultimately show ?case by blast
1.2126  next
1.2127 -  case (8 c e)
1.2128 +  case (8 c e)
1.2129    then have cp: "c > 0" and nb: "numbound0 e" by auto
1.2130 -  { assume kdc: "k dvd c"
1.2131 +  { assume kdc: "k dvd c"
1.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
1.2133      from kdc have  ?case using real_of_int_div[OF kdc] real_of_int_div[OF kdt]
1.2134        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
1.2135 -      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) }
1.2136 -  moreover
1.2137 +      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) }
1.2138 +  moreover
1.2139    { assume *: "\<not> k dvd c"
1.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
1.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)"
1.2142 @@ -2972,16 +2972,16 @@
1.2143          numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
1.2145      finally have ?case . }
1.2146 -  ultimately show ?case by blast
1.2147 +  ultimately show ?case by blast
1.2148  next
1.2149    case (9 i c e)
1.2150    then have cp: "c > 0" and nb: "numbound0 e" by auto
1.2151 -  { assume kdc: "k dvd c"
1.2152 +  { assume kdc: "k dvd c"
1.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
1.2154      from kdc have ?case using real_of_int_div[OF kdc] real_of_int_div[OF kdt]
1.2155        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
1.2156 -      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) }
1.2157 -  moreover
1.2158 +      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) }
1.2159 +  moreover
1.2160    { assume *: "\<not> k dvd c"
1.2161      from kpos have knz: "k\<noteq>0" by simp hence knz': "real_of_int k \<noteq> 0" by simp
1.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
1.2163 @@ -2996,16 +2996,16 @@
1.2164          numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
1.2166      finally have ?case . }
1.2167 -  ultimately show ?case by blast
1.2168 +  ultimately show ?case by blast
1.2169  next
1.2170    case (10 i c e)
1.2171    then have cp: "c > 0" and nb: "numbound0 e" by auto
1.2172 -  { assume kdc: "k dvd c"
1.2173 +  { assume kdc: "k dvd c"
1.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
1.2175      from kdc have  ?case using real_of_int_div[OF kdc] real_of_int_div[OF kdt]
1.2176        numbound0_I[OF tnb, where bs="bs" and b="b'" and b'="real_of_int x"]
1.2177 -      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) }
1.2178 -  moreover
1.2179 +      numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"] by (simp add: ti) }
1.2180 +  moreover
1.2181    { assume *: "\<not> k dvd c"
1.2182      from kpos have knz: "k\<noteq>0" by simp hence knz': "real_of_int k \<noteq> 0" by simp
1.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
1.2184 @@ -3020,7 +3020,7 @@
1.2185          numbound0_I[OF nb, where bs="bs" and b="?tk" and b'="real_of_int x"]
1.2187      finally have ?case . }
1.2188 -  ultimately show ?case by blast
1.2189 +  ultimately show ?case by blast
1.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"]
1.2191    numbound0_I[where bs="bs" and b="real_of_int ((floor (?N b' t)) div k)" and b'="real_of_int x"])
1.2192
1.2193 @@ -3056,7 +3056,7 @@
1.2194    from mult_strict_left_mono[OF dp cp]  have one:"1 \<in> {1 .. c*d}" by auto
1.2195    from nob[rule_format, where j="1", OF one] pi show ?case by simp
1.2196  next
1.2197 -  case (4 c e)
1.2198 +  case (4 c e)
1.2199    hence cp: "c >0" and nb: "numbound0 e" and ei: "isint e (real_of_int i#bs)"
1.2200      and nob: "\<forall> j\<in> {1 .. c*d}. real_of_int (c*i) \<noteq> - ?N i e + real_of_int j"
1.2201      by simp+
1.2202 @@ -3070,18 +3070,18 @@
1.2203    ultimately show ?case by blast
1.2204  next
1.2205    case (5 c e) hence cp: "c > 0" by simp
1.2206 -  from 5 mult_strict_left_mono[OF dp cp, simplified of_int_less_iff[symmetric]
1.2207 +  from 5 mult_strict_left_mono[OF dp cp, simplified of_int_less_iff[symmetric]
1.2208      of_int_mult]
1.2209 -  show ?case using 5 dp
1.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"]
1.2211 +  show ?case using 5 dp
1.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"]
1.2213        algebra_simps del: mult_pos_pos)
1.2215  next
1.2216    case (6 c e) hence cp: "c > 0" by simp
1.2217 -  from 6 mult_strict_left_mono[OF dp cp, simplified of_int_less_iff[symmetric]
1.2218 +  from 6 mult_strict_left_mono[OF dp cp, simplified of_int_less_iff[symmetric]
1.2219      of_int_mult]
1.2220 -  show ?case using 6 dp
1.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"]
1.2222 +  show ?case using 6 dp
1.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"]
1.2224        algebra_simps del: mult_pos_pos)
1.2225        using order_trans by fastforce
1.2226  next
1.2227 @@ -3096,9 +3096,9 @@
1.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
1.2229    moreover
1.2230    {assume "real_of_int (c*i) + ?N i e > real_of_int (c*d)" hence ?case
1.2231 -      by (simp add: algebra_simps
1.2232 -        numbound0_I[OF nb,where bs="bs" and b="real_of_int i - real_of_int d" and b'="real_of_int i"])}
1.2233 -  moreover
1.2234 +      by (simp add: algebra_simps
1.2235 +        numbound0_I[OF nb,where bs="bs" and b="real_of_int i - real_of_int d" and b'="real_of_int i"])}
1.2236 +  moreover
1.2237    {assume H:"real_of_int (c*i) + ?N i e \<le> real_of_int (c*d)"
1.2238      with ei[simplified isint_iff] have "real_of_int (c*i + ?fe) \<le> real_of_int (c*d)" by simp
1.2239      hence pid: "c*i + ?fe \<le> c*d" by (simp only: of_int_le_iff)
1.2240 @@ -3119,9 +3119,9 @@
1.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
1.2242    moreover
1.2243    {assume "real_of_int (c*i) + ?N i e \<ge> real_of_int (c*d)" hence ?case
1.2244 -      by (simp add: algebra_simps
1.2245 -        numbound0_I[OF nb,where bs="bs" and b="real_of_int i - real_of_int d" and b'="real_of_int i"])}
1.2246 -  moreover
1.2247 +      by (simp add: algebra_simps
1.2248 +        numbound0_I[OF nb,where bs="bs" and b="real_of_int i - real_of_int d" and b'="real_of_int i"])}
1.2249 +  moreover
1.2250    {assume H:"real_of_int (c*i) + ?N i e < real_of_int (c*d)"
1.2251      with ei[simplified isint_iff] have "real_of_int (c*i + ?fe) < real_of_int (c*d)" by simp
1.2252      hence pid: "c*i + 1 + ?fe \<le> c*d" by (simp only: of_int_le_iff)
1.2253 @@ -3137,61 +3137,61 @@
1.2254  next
1.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+
1.2256    let ?e = "Inum (real_of_int i # bs) e"
1.2257 -  from 9 have "isint e (real_of_int i #bs)"  by simp
1.2258 +  from 9 have "isint e (real_of_int i #bs)"  by simp
1.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"]
1.2261    from 9 have id: "j dvd d" by simp
1.2262    from ie[symmetric] have "?p i = (real_of_int j rdvd real_of_int (c*i+ floor ?e))" by simp
1.2263 -  also have "\<dots> = (j dvd c*i + floor ?e)"
1.2264 +  also have "\<dots> = (j dvd c*i + floor ?e)"
1.2265      using int_rdvd_iff [where i="j" and t="c*i+ floor ?e"] by simp
1.2266 -  also have "\<dots> = (j dvd c*i - c*d + floor ?e)"
1.2267 +  also have "\<dots> = (j dvd c*i - c*d + floor ?e)"
1.2268      using dvd_period[OF id, where x="c*i" and c="-c" and t="floor ?e"] by simp
1.2269 -  also have "\<dots> = (real_of_int j rdvd real_of_int (c*i - c*d + floor ?e))"
1.2270 +  also have "\<dots> = (real_of_int j rdvd real_of_int (c*i - c*d + floor ?e))"
1.2271      using int_rdvd_iff[where i="j" and t="(c*i - c*d + floor ?e)",symmetric, simplified]
1.2272        ie by simp
1.2273 -  also have "\<dots> = (real_of_int j rdvd real_of_int (c*(i - d)) + ?e)"
1.2274 +  also have "\<dots> = (real_of_int j rdvd real_of_int (c*(i - d)) + ?e)"
1.2275      using ie by (simp add:algebra_simps)
1.2276 -  finally show ?case
1.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
1.2278 +  finally show ?case
1.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
1.2281  next
1.2282    case (10 j c e)
1.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"
1.2284      by simp+
1.2285    let ?e = "Inum (real_of_int i # bs) e"
1.2286 -  from 10 have "isint e (real_of_int i #bs)"  by simp
1.2287 +  from 10 have "isint e (real_of_int i #bs)"  by simp
1.2288    hence ie: "real_of_int (floor ?e) = ?e"
1.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"]
1.2291    from 10 have id: "j dvd d" by simp
1.2292    from ie[symmetric] have "?p i = (\<not> (real_of_int j rdvd real_of_int (c*i+ floor ?e)))" by simp
1.2293 -  also have "\<dots> = Not (j dvd c*i + floor ?e)"
1.2294 +  also have "\<dots> = Not (j dvd c*i + floor ?e)"
1.2295      using int_rdvd_iff [where i="j" and t="c*i+ floor ?e"] by simp
1.2296 -  also have "\<dots> = Not (j dvd c*i - c*d + floor ?e)"
1.2297 +  also have "\<dots> = Not (j dvd c*i - c*d + floor ?e)"
1.2298      using dvd_period[OF id, where x="c*i" and c="-c" and t="floor ?e"] by simp
1.2299 -  also have "\<dots> = Not (real_of_int j rdvd real_of_int (c*i - c*d + floor ?e))"
1.2300 +  also have "\<dots> = Not (real_of_int j rdvd real_of_int (c*i - c*d + floor ?e))"
1.2301      using int_rdvd_iff[where i="j" and t="(c*i - c*d + floor ?e)",symmetric, simplified]
1.2302        ie by simp
1.2303 -  also have "\<dots> = Not (real_of_int j rdvd real_of_int (c*(i - d)) + ?e)"
1.2304 +  also have "\<dots> = Not (real_of_int j rdvd real_of_int (c*(i - d)) + ?e)"
1.2305      using ie by (simp add:algebra_simps)
1.2306 -  finally show ?case
1.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
1.2308 +  finally show ?case
1.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
1.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"])
1.2312
1.2313  lemma \<sigma>_nb: assumes lp: "iszlfm p (a#bs)" and nb: "numbound0 t"
1.2314    shows "bound0 (\<sigma> p k t)"
1.2315    using \<sigma>_\<rho>_nb[OF lp nb] nb by (simp add: \<sigma>_def)
1.2316 -
1.2317 +
1.2318  lemma \<rho>':   assumes lp: "iszlfm p (a #bs)"
1.2319    and d: "d_\<delta> p d"
1.2320    and dp: "d > 0"
1.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)")
1.2322  proof(clarify)
1.2323 -  fix x
1.2324 -  assume nob1:"?b x" and px: "?P x"
1.2325 +  fix x
1.2326 +  assume nob1:"?b x" and px: "?P x"
1.2327    from iszlfm_gen[OF lp, rule_format, where y="real_of_int x"] have lp': "iszlfm p (real_of_int x#bs)".
1.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"
1.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"
1.2330    proof(clarify)
1.2331      fix e c j assume ecR: "(e,c) \<in> set (\<rho> p)" and jD: "j\<in> {1 .. c*d}"
1.2332        and cx: "real_of_int (c*x) = Inum (real_of_int x#bs) e + real_of_int j"
1.2333 @@ -3220,14 +3220,14 @@
1.2334      have "Ifm (a#bs) (\<sigma> p c (Add e (C j)))" by blast
1.2335        with ecR jD nob1    show "False" by blast
1.2336    qed
1.2337 -  from \<rho>[OF lp' px d dp nob] show "?P (x -d )" .
1.2338 +  from \<rho>[OF lp' px d dp nob] show "?P (x -d )" .
1.2339  qed
1.2340
1.2341
1.2342 -lemma rl_thm:
1.2343 +lemma rl_thm:
1.2344    assumes lp: "iszlfm p (real_of_int (i::int)#bs)"
1.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)))))"
1.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))"
1.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))"
1.2348      is "?lhs = (?MD \<or> ?RD)"  is "?lhs = ?rhs")
1.2349  proof-
1.2350    let ?d= "\<delta> p"
1.2351 @@ -3244,9 +3244,9 @@
1.2352      from nb have nb': "numbound0 (Add e (C j))" by simp
1.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"]
1.2354      have spx': "Ifm (real_of_int i # bs) (\<sigma> p c (Add e (C j)))" by blast
1.2355 -    from spx' have rcdej:"real_of_int c rdvd (Inum (real_of_int i#bs) (Add e (C j)))"
1.2356 +    from spx' have rcdej:"real_of_int c rdvd (Inum (real_of_int i#bs) (Add e (C j)))"
1.2357        and sr:"Ifm (real_of_int i#bs) (\<sigma>_\<rho> p (Add e (C j),c))" by (simp add: \<sigma>_def)+
1.2358 -    from rcdej eji[simplified isint_iff]
1.2359 +    from rcdej eji[simplified isint_iff]
1.2360      have "real_of_int c rdvd real_of_int (floor (Inum (real_of_int i#bs) (Add e (C j))))" by simp
1.2361      hence cdej:"c dvd floor (Inum (real_of_int i#bs) (Add e (C j)))" by (simp only: int_rdvd_iff)
1.2362      from cp have cp': "real_of_int c > 0" by simp
1.2363 @@ -3260,7 +3260,7 @@
1.2364      from \<rho>'[OF lp' d dp, rule_format, OF nob] have th:"\<forall> x. ?P x \<longrightarrow> ?P (x - ?d)" by blast
1.2365      from minusinf_inf[OF lp] obtain z where z:"\<forall> x<z. ?MP x = ?P x" by blast
1.2366      have zp: "abs (x - z) + 1 \<ge> 0" by arith
1.2367 -    from decr_lemma[OF dp,where x="x" and z="z"]
1.2368 +    from decr_lemma[OF dp,where x="x" and z="z"]
1.2369        decr_mult_lemma[OF dp th zp, rule_format, OF px] z have th:"\<exists> x. ?MP x" by auto
1.2370      with minusinf_bex[OF lp] px nob have ?thesis by blast}
1.2371    ultimately show ?thesis by blast
1.2372 @@ -3270,15 +3270,15 @@
1.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))"
1.2374    using lp
1.2375    by (induct p rule: mirror.induct) (simp_all add: split_def image_Un)
1.2376 -
1.2377 +
1.2378  text \<open>The \<open>\<real>\<close> part\<close>
1.2379
1.2380  text\<open>Linearity for fm where Bound 0 ranges over \<open>\<real>\<close>\<close>
1.2381  consts
1.2382    isrlfm :: "fm \<Rightarrow> bool"   (* Linearity test for fm *)
1.2383  recdef isrlfm "measure size"
1.2384 -  "isrlfm (And p q) = (isrlfm p \<and> isrlfm q)"
1.2385 -  "isrlfm (Or p q) = (isrlfm p \<and> isrlfm q)"
1.2386 +  "isrlfm (And p q) = (isrlfm p \<and> isrlfm q)"
1.2387 +  "isrlfm (Or p q) = (isrlfm p \<and> isrlfm q)"
1.2388    "isrlfm (Eq  (CN 0 c e)) = (c>0 \<and> numbound0 e)"
1.2389    "isrlfm (NEq (CN 0 c e)) = (c>0 \<and> numbound0 e)"
1.2390    "isrlfm (Lt  (CN 0 c e)) = (c>0 \<and> numbound0 e)"
1.2391 @@ -3288,21 +3288,21 @@
1.2392    "isrlfm p = (isatom p \<and> (bound0 p))"
1.2393
1.2394  definition fp :: "fm \<Rightarrow> int \<Rightarrow> num \<Rightarrow> int \<Rightarrow> fm" where
1.2395 -  "fp p n s j \<equiv> (if n > 0 then
1.2396 +  "fp p n s j \<equiv> (if n > 0 then
1.2397              (And p (And (Ge (CN 0 n (Sub s (Add (Floor s) (C j)))))
1.2398                          (Lt (CN 0 n (Sub s (Add (Floor s) (C (j+1))))))))
1.2399 -            else
1.2400 -            (And p (And (Le (CN 0 (-n) (Add (Neg s) (Add (Floor s) (C j)))))
1.2401 +            else
1.2402 +            (And p (And (Le (CN 0 (-n) (Add (Neg s) (Add (Floor s) (C j)))))
1.2403                          (Gt (CN 0 (-n) (Add (Neg s) (Add (Floor s) (C (j + 1)))))))))"
1.2404
1.2405    (* splits the bounded from the unbounded part*)
1.2406  function (sequential) rsplit0 :: "num \<Rightarrow> (fm \<times> int \<times> num) list" where
1.2407    "rsplit0 (Bound 0) = [(T,1,C 0)]"
1.2408 -| "rsplit0 (Add a b) = (let acs = rsplit0 a ; bcs = rsplit0 b
1.2409 +| "rsplit0 (Add a b) = (let acs = rsplit0 a ; bcs = rsplit0 b
1.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])"
1.2411  | "rsplit0 (Sub a b) = rsplit0 (Add a (Neg b))"
1.2412  | "rsplit0 (Neg a) = map (\<lambda> (p,n,s). (p,-n,Neg s)) (rsplit0 a)"
1.2413 -| "rsplit0 (Floor a) = concat (map
1.2414 +| "rsplit0 (Floor a) = concat (map
1.2415        (\<lambda> (p,n,s). if n=0 then [(p,0,Floor s)]
1.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])))
1.2417         (rsplit0 a))"
1.2418 @@ -3321,22 +3321,22 @@
1.2419
1.2420
1.2421  lemma rsplit0_cs:
1.2422 -  shows "\<forall> (p,n,s) \<in> set (rsplit0 t).
1.2423 -  (Ifm (x#bs) p \<longrightarrow>  (Inum (x#bs) t = Inum (x#bs) (CN 0 n s))) \<and> numbound0 s \<and> isrlfm p"
1.2424 +  shows "\<forall> (p,n,s) \<in> set (rsplit0 t).
1.2425 +  (Ifm (x#bs) p \<longrightarrow>  (Inum (x#bs) t = Inum (x#bs) (CN 0 n s))) \<and> numbound0 s \<and> isrlfm p"
1.2426    (is "\<forall> (p,n,s) \<in> ?SS t. (?I p \<longrightarrow> ?N t = ?N (CN 0 n s)) \<and> _ \<and> _ ")
1.2427  proof(induct t rule: rsplit0.induct)
1.2428 -  case (5 a)
1.2429 +  case (5 a)
1.2430    let ?p = "\<lambda> (p,n,s) j. fp p n s j"
1.2431    let ?f = "(\<lambda> (p,n,s) j. (?p (p,n,s) j, (0::int),Add (Floor s) (C j)))"
1.2432    let ?J = "\<lambda> n. if n>0 then [0..n] else [n..0]"
1.2433    let ?ff=" (\<lambda> (p,n,s). if n= 0 then [(p,0,Floor s)] else map (?f (p,n,s)) (?J n))"
1.2434    have int_cases: "\<forall> (i::int). i= 0 \<or> i < 0 \<or> i > 0" by arith
1.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)))) =
1.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)))) =
1.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
1.2438 -  have U2': "\<forall> (p,n,s) \<in> {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0}.
1.2439 +  have U2': "\<forall> (p,n,s) \<in> {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0}.
1.2440      ?ff (p,n,s) = map (?f(p,n,s)) [0..n]" by auto
1.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)))) =
1.2442 -    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s).
1.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)))) =
1.2444 +    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s).
1.2445      set (map (?f(p,n,s)) [0..n])))"
1.2446    proof-
1.2447      fix M :: "('a\<times>'b\<times>'c) set" and f :: "('a\<times>'b\<times>'c) \<Rightarrow> 'd list" and g
1.2448 @@ -3346,7 +3346,7 @@
1.2449    qed
1.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]"
1.2451      by auto
1.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)))) =
1.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)))) =
1.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])))"
1.2455        proof-
1.2456      fix M :: "('a\<times>'b\<times>'c) set" and f :: "('a\<times>'b\<times>'c) \<Rightarrow> 'd list" and g
1.2457 @@ -3357,29 +3357,29 @@
1.2458    have "?SS (Floor a) = UNION (?SS a) (\<lambda>x. set (?ff x))"
1.2459      by auto
1.2460    also have "\<dots> = UNION (?SS a) (\<lambda> (p,n,s). set (?ff (p,n,s)))" by blast
1.2461 -  also have "\<dots> =
1.2462 -    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). set (?ff (p,n,s)))) Un
1.2463 -    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s). set (?ff (p,n,s)))) Un
1.2464 -    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n<0} (\<lambda> (p,n,s). set (?ff (p,n,s)))))"
1.2465 +  also have "\<dots> =
1.2466 +    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). set (?ff (p,n,s)))) Un
1.2467 +    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s). set (?ff (p,n,s)))) Un
1.2468 +    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n<0} (\<lambda> (p,n,s). set (?ff (p,n,s)))))"
1.2469      using int_cases[rule_format] by blast
1.2470 -  also have "\<dots> =
1.2471 -    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). set [(p,0,Floor s)])) Un
1.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
1.2473 -   (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n<0} (\<lambda> (p,n,s).
1.2474 +  also have "\<dots> =
1.2475 +    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). set [(p,0,Floor s)])) Un
1.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
1.2477 +   (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n<0} (\<lambda> (p,n,s).
1.2478      set (map (?f(p,n,s)) [n..0]))))" by (simp only: U1 U2 U3)
1.2479 -  also have "\<dots> =
1.2480 -    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). {(p,0,Floor s)})) Un
1.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
1.2482 +  also have "\<dots> =
1.2483 +    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). {(p,0,Floor s)})) Un
1.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
1.2485      (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n<0} (\<lambda> (p,n,s). (?f(p,n,s)) ` {n .. 0})))"
1.2486      by (simp only: set_map set_upto list.set)
1.2487 -  also have "\<dots> =
1.2488 -    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). {(p,0,Floor s)})) Un
1.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
1.2490 +  also have "\<dots> =
1.2491 +    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). {(p,0,Floor s)})) Un
1.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
1.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
1.2494 -  finally
1.2495 -  have FS: "?SS (Floor a) =
1.2496 -    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). {(p,0,Floor s)})) Un
1.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
1.2498 +  finally
1.2499 +  have FS: "?SS (Floor a) =
1.2500 +    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). {(p,0,Floor s)})) Un
1.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
1.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
1.2503    show ?case
1.2504    proof(simp only: FS, clarsimp simp del: Ifm.simps Inum.simps, -)
1.2505 @@ -3396,17 +3396,17 @@
1.2506             ac < 0 \<and>
1.2507             (\<exists>j. p = fp ab ac ba j \<and>
1.2508                  n = 0 \<and> s = Add (Floor ba) (C j) \<and> ac \<le> j \<and> j \<le> 0))"
1.2509 -    moreover
1.2510 +    moreover
1.2511      { fix s'
1.2512        assume "(p, 0, s') \<in> ?SS a" and "n = 0" and "s = Floor s'"
1.2513        hence ?ths using 5(1) by auto }
1.2514      moreover
1.2515      { fix p' n' s' j
1.2516 -      assume pns: "(p', n', s') \<in> ?SS a"
1.2517 -        and np: "0 < n'"
1.2518 -        and p_def: "p = ?p (p',n',s') j"
1.2519 -        and n0: "n = 0"
1.2520 -        and s_def: "s = (Add (Floor s') (C j))"
1.2521 +      assume pns: "(p', n', s') \<in> ?SS a"
1.2522 +        and np: "0 < n'"
1.2523 +        and p_def: "p = ?p (p',n',s') j"
1.2524 +        and n0: "n = 0"
1.2525 +        and s_def: "s = (Add (Floor s') (C j))"
1.2526          and jp: "0 \<le> j" and jn: "j \<le> n'"
1.2527        from 5 pns have H:"(Ifm ((x::real) # (bs::real list)) p' \<longrightarrow>
1.2528            Inum (x # bs) a = Inum (x # bs) (CN 0 n' s')) \<and>
1.2529 @@ -3415,9 +3415,9 @@
1.2530        from H have nf: "isrlfm (?p (p',n',s') j)" using fp_def np by simp
1.2531        let ?nxs = "CN 0 n' s'"
1.2532        let ?l = "floor (?N s') + j"
1.2533 -      from H
1.2534 -      have "?I (?p (p',n',s') j) \<longrightarrow>
1.2535 -          (((?N ?nxs \<ge> real_of_int ?l) \<and> (?N ?nxs < real_of_int (?l + 1))) \<and> (?N a = ?N ?nxs ))"
1.2536 +      from H
1.2537 +      have "?I (?p (p',n',s') j) \<longrightarrow>
1.2538 +          (((?N ?nxs \<ge> real_of_int ?l) \<and> (?N ?nxs < real_of_int (?l + 1))) \<and> (?N a = ?N ?nxs ))"
1.2539          by (simp add: fp_def np algebra_simps)
1.2540        also have "\<dots> \<longrightarrow> ((floor (?N ?nxs) = ?l) \<and> (?N a = ?N ?nxs ))"
1.2541          using floor_unique_iff[where x="?N ?nxs" and a="?l"] by simp
1.2542 @@ -3428,11 +3428,11 @@
1.2543        with s_def n0 p_def nb nf have ?ths by auto}
1.2544      moreover
1.2545      { fix p' n' s' j
1.2546 -      assume pns: "(p', n', s') \<in> ?SS a"
1.2547 -        and np: "n' < 0"
1.2548 -        and p_def: "p = ?p (p',n',s') j"
1.2549 -        and n0: "n = 0"
1.2550 -        and s_def: "s = (Add (Floor s') (C j))"
1.2551 +      assume pns: "(p', n', s') \<in> ?SS a"
1.2552 +        and np: "n' < 0"
1.2553 +        and p_def: "p = ?p (p',n',s') j"
1.2554 +        and n0: "n = 0"
1.2555 +        and s_def: "s = (Add (Floor s') (C j))"
1.2556          and jp: "n' \<le> j" and jn: "j \<le> 0"
1.2557        from 5 pns have H:"(Ifm ((x::real) # (bs::real list)) p' \<longrightarrow>
1.2558            Inum (x # bs) a = Inum (x # bs) (CN 0 n' s')) \<and>
1.2559 @@ -3441,9 +3441,9 @@
1.2560        from H have nf: "isrlfm (?p (p',n',s') j)" using fp_def np by simp
1.2561        let ?nxs = "CN 0 n' s'"
1.2562        let ?l = "floor (?N s') + j"
1.2563 -      from H
1.2564 -      have "?I (?p (p',n',s') j) \<longrightarrow>
1.2565 -          (((?N ?nxs \<ge> real_of_int ?l) \<and> (?N ?nxs < real_of_int (?l + 1))) \<and> (?N a = ?N ?nxs ))"
1.2566 +      from H
1.2567 +      have "?I (?p (p',n',s') j) \<longrightarrow>
1.2568 +          (((?N ?nxs \<ge> real_of_int ?l) \<and> (?N ?nxs < real_of_int (?l + 1))) \<and> (?N a = ?N ?nxs ))"
1.2569          by (simp add: np fp_def algebra_simps)
1.2570        also have "\<dots> \<longrightarrow> ((floor (?N ?nxs) = ?l) \<and> (?N a = ?N ?nxs ))"
1.2571          using floor_unique_iff[where x="?N ?nxs" and a="?l"] by simp
1.2572 @@ -3459,18 +3459,18 @@
1.2573      by auto
1.2574  qed (auto simp add: Let_def split_def algebra_simps)
1.2575
1.2576 -lemma real_in_int_intervals:
1.2577 +lemma real_in_int_intervals:
1.2578    assumes xb: "real_of_int m \<le> x \<and> x < real_of_int ((n::int) + 1)"
1.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")
1.2580 -by (rule bexI[where P="?P" and x="floor x" and A="?N"])
1.2581 -(auto simp add: floor_less_iff[where x="x" and z="n+1", simplified]
1.2582 +by (rule bexI[where P="?P" and x="floor x" and A="?N"])
1.2583 +(auto simp add: floor_less_iff[where x="x" and z="n+1", simplified]
1.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"]])
1.2585
1.2586  lemma rsplit0_complete:
1.2587    assumes xp:"0 \<le> x" and x1:"x < 1"
1.2588    shows "\<exists> (p,n,s) \<in> set (rsplit0 t). Ifm (x#bs) p" (is "\<exists> (p,n,s) \<in> ?SS t. ?I p")
1.2589  proof(induct t rule: rsplit0.induct)
1.2590 -  case (2 a b)
1.2591 +  case (2 a b)
1.2592    then have "\<exists> (pa,na,sa) \<in> ?SS a. ?I pa" by auto
1.2593    then obtain "pa" "na" "sa" where pa: "(pa,na,sa)\<in> ?SS a \<and> ?I pa" by blast
1.2594    with 2 have "\<exists> (pb,nb,sb) \<in> ?SS b. ?I pb" by blast
1.2595 @@ -3484,7 +3484,7 @@
1.2596    moreover from pa pb have "?I (And pa pb)" by simp
1.2597    ultimately show ?case by blast
1.2598  next
1.2599 -  case (5 a)
1.2600 +  case (5 a)
1.2601    let ?p = "\<lambda> (p,n,s) j. fp p n s j"
1.2602    let ?f = "(\<lambda> (p,n,s) j. (?p (p,n,s) j, (0::int),(Add (Floor s) (C j))))"
1.2603    let ?J = "\<lambda> n. if n>0 then [0..n] else [n..0]"
1.2604 @@ -3512,30 +3512,30 @@
1.2605
1.2606    have "?SS (Floor a) = UNION (?SS a) (\<lambda>x. set (?ff x))" by auto
1.2607    also have "\<dots> = UNION (?SS a) (\<lambda> (p,n,s). set (?ff (p,n,s)))" by blast
1.2608 -  also have "\<dots> =
1.2609 -    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). set (?ff (p,n,s)))) Un
1.2610 -    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s). set (?ff (p,n,s)))) Un
1.2611 -    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n<0} (\<lambda> (p,n,s). set (?ff (p,n,s)))))"
1.2612 +  also have "\<dots> =
1.2613 +    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). set (?ff (p,n,s)))) Un
1.2614 +    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n>0} (\<lambda> (p,n,s). set (?ff (p,n,s)))) Un
1.2615 +    (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n<0} (\<lambda> (p,n,s). set (?ff (p,n,s)))))"
1.2616      using int_cases[rule_format] by blast
1.2617 -  also have "\<dots> =
1.2618 -    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). set [(p,0,Floor s)])) Un
1.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
1.2620 +  also have "\<dots> =
1.2621 +    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). set [(p,0,Floor s)])) Un
1.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
1.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]))))"
1.2624      by (simp only: U1 U2 U3)
1.2625 -  also have "\<dots> =
1.2626 -    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). {(p,0,Floor s)})) Un
1.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
1.2628 +  also have "\<dots> =
1.2629 +    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). {(p,0,Floor s)})) Un
1.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
1.2631      (UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n<0} (\<lambda> (p,n,s). (?f(p,n,s)) ` {n .. 0})))"
1.2632      by (simp only: set_map set_upto list.set)
1.2633 -  also have "\<dots> =
1.2634 -    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). {(p,0,Floor s)})) Un
1.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
1.2636 +  also have "\<dots> =
1.2637 +    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). {(p,0,Floor s)})) Un
1.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
1.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}})))"
1.2640      by blast
1.2641 -  finally
1.2642 -  have FS: "?SS (Floor a) =
1.2643 -    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). {(p,0,Floor s)})) Un
1.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
1.2645 +  finally
1.2646 +  have FS: "?SS (Floor a) =
1.2647 +    ((UNION {(p,n,s). (p,n,s) \<in> ?SS a \<and> n=0} (\<lambda> (p,n,s). {(p,0,Floor s)})) Un
1.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
1.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}})))"
1.2650      by blast
1.2651    from 5 have "\<exists> (p,n,s) \<in> ?SS a. ?I p" by auto
1.2652 @@ -3543,7 +3543,7 @@
1.2653    let ?N = "\<lambda> t. Inum (x#bs) t"
1.2654    from rsplit0_cs[rule_format] pns have ans:"(?N a = ?N (CN 0 n s)) \<and> numbound0 s \<and> isrlfm p"
1.2655      by auto
1.2656 -
1.2657 +
1.2658    have "n=0 \<or> n >0 \<or> n <0" by arith
1.2659    moreover {assume "n=0" hence ?case using pns by (simp only: FS) auto }
1.2660    moreover
1.2661 @@ -3554,21 +3554,21 @@
1.2662      finally have "?N (Floor s) \<le> real_of_int n * x + ?N s" .
1.2663      moreover
1.2664      {from x1 np have "real_of_int n *x + ?N s < real_of_int n + ?N s" by simp
1.2665 -      also from real_of_int_floor_add_one_gt[where r="?N s"]
1.2666 +      also from real_of_int_floor_add_one_gt[where r="?N s"]
1.2667        have "\<dots> < real_of_int n + ?N (Floor s) + 1" by simp
1.2668        finally have "real_of_int n *x + ?N s < ?N (Floor s) + real_of_int (n+1)" by simp}
1.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
1.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
1.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
1.2672 -
1.2673 +
1.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"
1.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)"])
1.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)"])
1.2677      hence "\<exists> j\<in> {0.. n}. ?I (?p (p,n,s) j)"
1.2678        using pns by (simp add: fp_def np algebra_simps)
1.2679      then obtain "j" where j_def: "j\<in> {0 .. n} \<and> ?I (?p (p,n,s) j)" by blast
1.2680      hence "\<exists>x \<in> {?p (p,n,s) j |j. 0\<le> j \<and> j \<le> n }. ?I x" by auto
1.2681 -    hence ?case using pns
1.2682 -      by (simp only: FS,simp add: bex_Un)
1.2683 +    hence ?case using pns
1.2684 +      by (simp only: FS,simp add: bex_Un)
1.2685      (rule disjI2, rule disjI1,rule exI [where x="p"],
1.2686        rule exI [where x="n"],rule exI [where x="s"],simp_all add: np)
1.2687    }
1.2688 @@ -3576,27 +3576,27 @@
1.2689    { assume nn: "n < 0" hence np: "-n >0" by simp
1.2690      from of_int_floor_le[of "?N s"] have "?N (Floor s) + 1 > ?N s" by simp
1.2691      moreover from mult_left_mono_neg[OF xp] nn have "?N s \<ge> real_of_int n * x + ?N s" by simp
1.2692 -    ultimately have "?N (Floor s) + 1 > real_of_int n * x + ?N s" by arith
1.2693 +    ultimately have "?N (Floor s) + 1 > real_of_int n * x + ?N s" by arith
1.2694      moreover
1.2695      {from x1 nn have "real_of_int n *x + ?N s \<ge> real_of_int n + ?N s" by simp
1.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
1.2697 -      ultimately have "real_of_int n *x + ?N s \<ge> ?N (Floor s) + real_of_int n"
1.2698 +      ultimately have "real_of_int n *x + ?N s \<ge> ?N (Floor s) + real_of_int n"
1.2699          by (simp only: algebra_simps)}
1.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
1.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
1.2702      have th1: "\<forall> (a::real). (- a > 0) = (a < 0)" by auto
1.2703      have th2: "\<forall> (a::real). (0 \<ge> - a) = (a \<ge> 0)" by auto
1.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
1.2705 -
1.2706 +
1.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"
1.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)"])
1.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)"])
1.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])
1.2711      hence "\<exists> j\<in> {n.. 0}. ?I (?p (p,n,s) j)"
1.2712        using pns by (simp add: fp_def nn algebra_simps
1.2713 -        del: diff_less_0_iff_less diff_le_0_iff_le)
1.2714 +        del: diff_less_0_iff_less diff_le_0_iff_le)
1.2715      then obtain "j" where j_def: "j\<in> {n .. 0} \<and> ?I (?p (p,n,s) j)" by blast
1.2716      hence "\<exists>x \<in> {?p (p,n,s) j |j. n\<le> j \<and> j \<le> 0 }. ?I x" by auto
1.2717 -    hence ?case using pns
1.2718 +    hence ?case using pns
1.2719        by (simp only: FS,simp add: bex_Un)
1.2720      (rule disjI2, rule disjI2,rule exI [where x="p"],
1.2721        rule exI [where x="n"],rule exI [where x="s"],simp_all add: nn)
1.2722 @@ -3615,7 +3615,7 @@
1.2723  lemma foldr_conj_map: "Ifm bs (foldr conj (map f xs) T) = (\<forall> x \<in> set xs. Ifm bs (f x))"
1.2724  by(induct xs, simp_all)
1.2725
1.2726 -lemma foldr_disj_map_rlfm:
1.2727 +lemma foldr_disj_map_rlfm:
1.2728    assumes lf: "\<forall> n s. numbound0 s \<longrightarrow> isrlfm (f n s)"
1.2729    and \<phi>: "\<forall> (\<phi>,n,s) \<in> set xs. numbound0 s \<and> isrlfm \<phi>"
1.2730    shows "isrlfm (foldr disj (map (\<lambda> (\<phi>, n, s). conj \<phi> (f n s)) xs) F)"
1.2731 @@ -3631,7 +3631,7 @@
1.2732    from foldr_disj_map_rlfm[OF lf th] rsplit_def show ?thesis by simp
1.2733  qed
1.2734
1.2735 -lemma rsplit:
1.2736 +lemma rsplit:
1.2737    assumes xp: "x \<ge> 0" and x1: "x < 1"
1.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))"
1.2739    shows "Ifm (x#bs) (rsplit f a) = Ifm (x#bs) (g a)"
1.2740 @@ -3642,14 +3642,14 @@
1.2741    hence "\<exists> (\<phi>,n,s) \<in> set (rsplit0 a). ?I x (And \<phi> (f n s))" using rsplit_ex by simp
1.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
1.2743    hence \<phi>: "?I x \<phi>" and fns: "?I x (f n s)" by auto
1.2744 -  from rsplit0_cs[where t="a" and bs="bs" and x="x", rule_format, OF fnsS] \<phi>
1.2745 +  from rsplit0_cs[where t="a" and bs="bs" and x="x", rule_format, OF fnsS] \<phi>
1.2746    have th: "(?N x a = ?N x (CN 0 n s)) \<and> numbound0 s" by auto
1.2747    from f[rule_format, OF th] fns show "?I x (g a)" by simp
1.2748  next
1.2749    let ?I = "\<lambda>x p. Ifm (x#bs) p"
1.2750    let ?N = "\<lambda> x t. Inum (x#bs) t"
1.2751    assume ga: "?I x (g a)"
1.2752 -  from rsplit0_complete[OF xp x1, where bs="bs" and t="a"]
1.2753 +  from rsplit0_complete[OF xp x1, where bs="bs" and t="a"]
1.2754    obtain "\<phi>" "n" "s" where fnsS:"(\<phi>,n,s) \<in> set (rsplit0 a)" and fx: "?I x \<phi>" by blast
1.2755    from rsplit0_cs[where t="a" and x="x" and bs="bs"] fnsS fx
1.2756    have ans: "?N x a = ?N x (CN 0 n s)" and nb: "numbound0 s" by auto
1.2757 @@ -3658,27 +3658,27 @@
1.2758  qed
1.2759
1.2760  definition lt :: "int \<Rightarrow> num \<Rightarrow> fm" where
1.2761 -  lt_def: "lt c t = (if c = 0 then (Lt t) else if c > 0 then (Lt (CN 0 c t))
1.2762 +  lt_def: "lt c t = (if c = 0 then (Lt t) else if c > 0 then (Lt (CN 0 c t))
1.2763                          else (Gt (CN 0 (-c) (Neg t))))"
1.2764
1.2765  definition  le :: "int \<Rightarrow> num \<Rightarrow> fm" where
1.2766 -  le_def: "le c t = (if c = 0 then (Le t) else if c > 0 then (Le (CN 0 c t))
1.2767 +  le_def: "le c t = (if c = 0 then (Le t) else if c > 0 then (Le (CN 0 c t))
1.2768                          else (Ge (CN 0 (-c) (Neg t))))"
1.2769
1.2770  definition  gt :: "int \<Rightarrow> num \<Rightarrow> fm" where
1.2771 -  gt_def: "gt c t = (if c = 0 then (Gt t) else if c > 0 then (Gt (CN 0 c t))
1.2772 +  gt_def: "gt c t = (if c = 0 then (Gt t) else if c > 0 then (Gt (CN 0 c t))
1.2773                          else (Lt (CN 0 (-c) (Neg t))))"
1.2774
1.2775  definition  ge :: "int \<Rightarrow> num \<Rightarrow> fm" where
1.2776 -  ge_def: "ge c t = (if c = 0 then (Ge t) else if c > 0 then (Ge (CN 0 c t))
1.2777 +  ge_def: "ge c t = (if c = 0 then (Ge t) else if c > 0 then (Ge (CN 0 c t))
1.2778                          else (Le (CN 0 (-c) (Neg t))))"
1.2779
1.2780  definition  eq :: "int \<Rightarrow> num \<Rightarrow> fm" where
1.2781 -  eq_def: "eq c t = (if c = 0 then (Eq t) else if c > 0 then (Eq (CN 0 c t))
1.2782 +  eq_def: "eq c t = (if c = 0 then (Eq t) else if c > 0 then (Eq (CN 0 c t))
1.2783                          else (Eq (CN 0 (-c) (Neg t))))"
1.2784
1.2785  definition neq :: "int \<Rightarrow> num \<Rightarrow> fm" where
1.2786 -  neq_def: "neq c t = (if c = 0 then (NEq t) else if c > 0 then (NEq (CN 0 c t))
1.2787 +  neq_def: "neq c t = (if c = 0 then (NEq t) else if c > 0 then (NEq (CN 0 c t))
1.2788                          else (NEq (CN 0 (-c) (Neg t))))"
1.2789
1.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)"
1.2791 @@ -3703,7 +3703,7 @@
1.2792  qed
1.2793
1.2794  lemma le_l: "isrlfm (rsplit le a)"
1.2795 -  by (rule rsplit_l[where f="le" and a="a"], auto simp add: le_def)
1.2796 +  by (rule rsplit_l[where f="le" and a="a"], auto simp add: le_def)
1.2797  (case_tac s, simp_all, rename_tac nat a b, case_tac "nat",simp_all)
1.2798
1.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)")
1.2800 @@ -3714,28 +3714,28 @@
1.2801    (cases "n > 0", simp_all add: gt_def algebra_simps myless[of _ "0"])
1.2802  qed
1.2803  lemma gt_l: "isrlfm (rsplit gt a)"
1.2804 -  by (rule rsplit_l[where f="gt" and a="a"], auto simp add: gt_def)
1.2805 +  by (rule rsplit_l[where f="gt" and a="a"], auto simp add: gt_def)
1.2806  (case_tac s, simp_all, rename_tac nat a b, case_tac "nat", simp_all)
1.2807
1.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)")
1.2809  proof(clarify)
1.2810 -  fix a n s
1.2811 +  fix a n s
1.2812    assume H: "?N a = ?N (CN 0 n s)"
1.2813    show "?I (ge n s) = ?I (Ge a)" using H by (cases "n=0", (simp add: ge_def))
1.2814    (cases "n > 0", simp_all add: ge_def algebra_simps myle[of _ "0"])
1.2815  qed
1.2816  lemma ge_l: "isrlfm (rsplit ge a)"
1.2817 -  by (rule rsplit_l[where f="ge" and a="a"], auto simp add: ge_def)
1.2818 +  by (rule rsplit_l[where f="ge" and a="a"], auto simp add: ge_def)
1.2819  (case_tac s, simp_all, rename_tac nat a b, case_tac "nat", simp_all)
1.2820
1.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)")
1.2822  proof(clarify)
1.2823 -  fix a n s
1.2824 +  fix a n s
1.2825    assume H: "?N a = ?N (CN 0 n s)"
1.2826    show "?I (eq n s) = ?I (Eq a)" using H by (auto simp add: eq_def algebra_simps)
1.2827  qed
1.2828  lemma eq_l: "isrlfm (rsplit eq a)"
1.2829 -  by (rule rsplit_l[where f="eq" and a="a"], auto simp add: eq_def)
1.2830 +  by (rule rsplit_l[where f="eq" and a="a"], auto simp add: eq_def)
1.2831  (case_tac s, simp_all, rename_tac nat a b, case_tac"nat", simp_all)
1.2832
1.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)")
1.2834 @@ -3746,35 +3746,35 @@
1.2835  qed
1.2836
1.2837  lemma neq_l: "isrlfm (rsplit neq a)"
1.2838 -  by (rule rsplit_l[where f="neq" and a="a"], auto simp add: neq_def)
1.2839 +  by (rule rsplit_l[where f="neq" and a="a"], auto simp add: neq_def)
1.2840  (case_tac s, simp_all, rename_tac nat a b, case_tac"nat", simp_all)
1.2841
1.2842 -lemma small_le:
1.2843 +lemma small_le:
1.2844    assumes u0:"0 \<le> u" and u1: "u < 1"
1.2845    shows "(-u \<le> real_of_int (n::int)) = (0 \<le> n)"
1.2846  using u0 u1  by auto
1.2847
1.2848 -lemma small_lt:
1.2849 +lemma small_lt:
1.2850    assumes u0:"0 \<le> u" and u1: "u < 1"
1.2851    shows "(real_of_int (n::int) < real_of_int (m::int) - u) = (n < m)"
1.2852  using u0 u1  by auto
1.2853
1.2854 -lemma rdvd01_cs:
1.2855 +lemma rdvd01_cs:
1.2856    assumes up: "u \<ge> 0" and u1: "u<1" and np: "real_of_int n > 0"
1.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")
1.2858  proof-
1.2859    let ?ss = "s - real_of_int (floor s)"
1.2860 -  from real_of_int_floor_add_one_gt[where r="s", simplified myless[of "s"]]
1.2861 -    of_int_floor_le  have ss0:"?ss \<ge> 0" and ss1:"?ss < 1"
1.2862 +  from real_of_int_floor_add_one_gt[where r="s", simplified myless[of "s"]]
1.2863 +    of_int_floor_le  have ss0:"?ss \<ge> 0" and ss1:"?ss < 1"
1.2864      by (auto simp add: myle[of _ "s", symmetric] myless[of "?ss"])
1.2865    from np have n0: "real_of_int n \<ge> 0" by simp
1.2866 -  from mult_left_mono[OF up n0] mult_strict_left_mono[OF u1 np]
1.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
1.2868 -  from int_rdvd_real[where i="i" and x="real_of_int (n::int) * u - s"]
1.2869 -  have "real_of_int i rdvd real_of_int n * u - s =
1.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 ))"
1.2871 +  from mult_left_mono[OF up n0] mult_strict_left_mono[OF u1 np]
1.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
1.2873 +  from int_rdvd_real[where i="i" and x="real_of_int (n::int) * u - s"]
1.2874 +  have "real_of_int i rdvd real_of_int n * u - s =
1.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 ))"
1.2876      (is "_ = (?DE)" is "_ = (?D \<and> ?E)") by simp
1.2877 -  also have "\<dots> = (?DE \<and> real_of_int(floor (real_of_int n * u - s) + floor s)\<ge> -?ss
1.2878 +  also have "\<dots> = (?DE \<and> real_of_int(floor (real_of_int n * u - s) + floor s)\<ge> -?ss
1.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 < _)")
1.2880      using nu0 nun  by auto
1.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])
1.2882 @@ -3797,43 +3797,43 @@
1.2883  where
1.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)"
1.2885
1.2886 -lemma DVDJ_DVD:
1.2887 +lemma DVDJ_DVD:
1.2888    assumes xp:"x\<ge> 0" and x1: "x < 1" and np:"real_of_int n > 0"
1.2889    shows "Ifm (x#bs) (DVDJ i n s) = Ifm (x#bs) (Dvd i (CN 0 n s))"
1.2890  proof-
1.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))))"
1.2892    let ?s= "Inum (x#bs) s"
1.2893    from foldr_disj_map[where xs="[0..n - 1]" and bs="x#bs" and f="?f"]
1.2894 -  have "Ifm (x#bs) (DVDJ i n s) = (\<exists> j\<in> {0 .. (n - 1)}. Ifm (x#bs) (?f j))"
1.2895 +  have "Ifm (x#bs) (DVDJ i n s) = (\<exists> j\<in> {0 .. (n - 1)}. Ifm (x#bs) (?f j))"
1.2896      by (simp add: np DVDJ_def)
1.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)))"
1.2899 -  also from rdvd01_cs[OF xp x1 np, where i="i" and s="-?s"]
1.2900 +  also from rdvd01_cs[OF xp x1 np, where i="i" and s="-?s"]
1.2901    have "\<dots> = (real_of_int i rdvd real_of_int n * x - (-?s))" by simp
1.2902    finally show ?thesis by simp
1.2903  qed
1.2904
1.2905 -lemma NDVDJ_NDVD:
1.2906 +lemma NDVDJ_NDVD:
1.2907    assumes xp:"x\<ge> 0" and x1: "x < 1" and np:"real_of_int n > 0"
1.2908    shows "Ifm (x#bs) (NDVDJ i n s) = Ifm (x#bs) (NDvd i (CN 0 n s))"
1.2909  proof-
1.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))))"
1.2911    let ?s= "Inum (x#bs) s"
1.2912    from foldr_conj_map[where xs="[0..n - 1]" and bs="x#bs" and f="?f"]
1.2913 -  have "Ifm (x#bs) (NDVDJ i n s) = (\<forall> j\<in> {0 .. (n - 1)}. Ifm (x#bs) (?f j))"
1.2914 +  have "Ifm (x#bs) (NDVDJ i n s) = (\<forall> j\<in> {0 .. (n - 1)}. Ifm (x#bs) (?f j))"
1.2915      by (simp add: np NDVDJ_def)
1.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))))"
1.2918 -  also from rdvd01_cs[OF xp x1 np, where i="i" and s="-?s"]
1.2919 +  also from rdvd01_cs[OF xp x1 np, where i="i" and s="-?s"]
1.2920    have "\<dots> = (\<not> (real_of_int i rdvd real_of_int n * x - (-?s)))" by simp
1.2921    finally show ?thesis by simp
1.2922 -qed
1.2923 -
1.2924 -lemma foldr_disj_map_rlfm2:
1.2925 +qed
1.2926 +
1.2927 +lemma foldr_disj_map_rlfm2:
1.2928    assumes lf: "\<forall> n . isrlfm (f n)"
1.2929    shows "isrlfm (foldr disj (map f xs) F)"
1.2930  using lf by (induct xs, auto)
1.2931 -lemma foldr_And_map_rlfm2:
1.2932 +lemma foldr_And_map_rlfm2:
1.2933    assumes lf: "\<forall> n . isrlfm (f n)"
1.2934    shows "isrlfm (foldr conj (map f xs) T)"
1.2935  using lf by (induct xs, auto)
1.2936 @@ -3844,7 +3844,7 @@
1.2937    let ?f="\<lambda>j. conj (Eq (CN 0 n (Add s (Sub (Floor (Neg s)) (C j)))))
1.2938                           (Dvd i (Sub (C j) (Floor (Neg s))))"
1.2939    have th: "\<forall> j. isrlfm (?f j)" using nb np by auto
1.2940 -  from DVDJ_def foldr_disj_map_rlfm2[OF th] show ?thesis by simp
1.2941 +  from DVDJ_def foldr_disj_map_rlfm2[OF th] show ?thesis by simp
1.2942  qed
1.2943
1.2944  lemma NDVDJ_l: assumes ip: "i >0" and np: "n>0" and nb: "numbound0 s"
1.2945 @@ -3858,58 +3858,58 @@
1.2946
1.2947  definition DVD :: "int \<Rightarrow> int \<Rightarrow> num \<Rightarrow> fm" where
1.2948    DVD_def: "DVD i c t =
1.2949 -  (if i=0 then eq c t else
1.2950 +  (if i=0 then eq c t else
1.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))"
1.2952
1.2953  definition  NDVD :: "int \<Rightarrow> int \<Rightarrow> num \<Rightarrow> fm" where
1.2954    "NDVD i c t =
1.2955 -  (if i=0 then neq c t else
1.2956 +  (if i=0 then neq c t else
1.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))"
1.2958
1.2959 -lemma DVD_mono:
1.2960 -  assumes xp: "0\<le> x" and x1: "x < 1"
1.2961 +lemma DVD_mono:
1.2962 +  assumes xp: "0\<le> x" and x1: "x < 1"
1.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)"
1.2964    (is "\<forall> a n s. ?N a = ?N (CN 0 n s) \<and> _ \<longrightarrow> ?I (DVD i n s) = ?I (Dvd i a)")
1.2965  proof(clarify)
1.2966 -  fix a n s
1.2967 +  fix a n s
1.2968    assume H: "?N a = ?N (CN 0 n s)" and nb: "numbound0 s"
1.2969    let ?th = "?I (DVD i n s) = ?I (Dvd i a)"
1.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
1.2971 -  moreover {assume iz: "i=0" hence ?th using eq_mono[rule_format, OF conjI[OF H nb]]
1.2972 +  moreover {assume iz: "i=0" hence ?th using eq_mono[rule_format, OF conjI[OF H nb]]
1.2973        by (simp add: DVD_def rdvd_left_0_eq)}
1.2974 -  moreover {assume inz: "i\<noteq>0" and "n=0" hence ?th by (simp add: H DVD_def) }
1.2975 -  moreover {assume inz: "i\<noteq>0" and "n<0" hence ?th
1.2976 -      by (simp add: DVD_def H DVDJ_DVD[OF xp x1] rdvd_abs1
1.2977 -        rdvd_minus[where d="i" and t="real_of_int n * x + Inum (x # bs) s"]) }
1.2978 +  moreover {assume inz: "i\<noteq>0" and "n=0" hence ?th by (simp add: H DVD_def) }
1.2979 +  moreover {assume inz: "i\<noteq>0" and "n<0" hence ?th
1.2980 +      by (simp add: DVD_def H DVDJ_DVD[OF xp x1] rdvd_abs1
1.2981 +        rdvd_minus[where d="i" and t="real_of_int n * x + Inum (x # bs) s"]) }
1.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)}
1.2983    ultimately show ?th by blast
1.2984  qed
1.2985
1.2986 -lemma NDVD_mono:   assumes xp: "0\<le> x" and x1: "x < 1"
1.2987 +lemma NDVD_mono:   assumes xp: "0\<le> x" and x1: "x < 1"
1.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)"
1.2989    (is "\<forall> a n s. ?N a = ?N (CN 0 n s) \<and> _ \<longrightarrow> ?I (NDVD i n s) = ?I (NDvd i a)")
1.2990  proof(clarify)
1.2991 -  fix a n s
1.2992 +  fix a n s
1.2993    assume H: "?N a = ?N (CN 0 n s)" and nb: "numbound0 s"
1.2994    let ?th = "?I (NDVD i n s) = ?I (NDvd i a)"
1.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
1.2996 -  moreover {assume iz: "i=0" hence ?th using neq_mono[rule_format, OF conjI[OF H nb]]
1.2997 +  moreover {assume iz: "i=0" hence ?th using neq_mono[rule_format, OF conjI[OF H nb]]
1.2998        by (simp add: NDVD_def rdvd_left_0_eq)}
1.2999 -  moreover {assume inz: "i\<noteq>0" and "n=0" hence ?th by (simp add: H NDVD_def) }
1.3000 -  moreover {assume inz: "i\<noteq>0" and "n<0" hence ?th
1.3001 -      by (simp add: NDVD_def H NDVDJ_NDVD[OF xp x1] rdvd_abs1
1.3002 -        rdvd_minus[where d="i" and t="real_of_int n * x + Inum (x # bs) s"]) }
1.3003 -  moreover {assume inz: "i\<noteq>0" and "n>0" hence ?th
1.3004 +  moreover {assume inz: "i\<noteq>0" and "n=0" hence ?th by (simp add: H NDVD_def) }
1.3005 +  moreover {assume inz: "i\<noteq>0" and "n<0" hence ?th
1.3006 +      by (simp add: NDVD_def H NDVDJ_NDVD[OF xp x1] rdvd_abs1
1.3007 +        rdvd_minus[where d="i" and t="real_of_int n * x + Inum (x # bs) s"]) }
1.3008 +  moreover {assume inz: "i\<noteq>0" and "n>0" hence ?th
1.3009        by (simp add:NDVD_def H NDVDJ_NDVD[OF xp x1] rdvd_abs1)}
1.3010    ultimately show ?th by blast
1.3011  qed
1.3012
1.3013  lemma DVD_l: "isrlfm (rsplit (DVD i) a)"
1.3014 -  by (rule rsplit_l[where f="DVD i" and a="a"], auto simp add: DVD_def eq_def DVDJ_l)
1.3015 +  by (rule rsplit_l[where f="DVD i" and a="a"], auto simp add: DVD_def eq_def DVDJ_l)
1.3016  (case_tac s, simp_all, rename_tac nat a b, case_tac "nat", simp_all)
1.3017
1.3018  lemma NDVD_l: "isrlfm (rsplit (NDVD i) a)"
1.3019 -  by (rule rsplit_l[where f="NDVD i" and a="a"], auto simp add: NDVD_def neq_def NDVDJ_l)
1.3020 +  by (rule rsplit_l[where f="NDVD i" and a="a"], auto simp add: NDVD_def neq_def NDVDJ_l)
1.3021  (case_tac s, simp_all, rename_tac nat a b, case_tac "nat", simp_all)
1.3022
1.3023  consts rlfm :: "fm \<Rightarrow> fm"
1.3024 @@ -3948,20 +3948,20 @@
1.3025
1.3026  lemma simpfm_rl: "isrlfm p \<Longrightarrow> isrlfm (simpfm p)"
1.3027  proof (induct p)
1.3028 -  case (Lt a)
1.3029 +  case (Lt a)
1.3030    hence "bound0 (Lt a) \<or> (\<exists> c e. a = CN 0 c e \<and> c > 0 \<and> numbound0 e)"
1.3031      by (cases a,simp_all, rename_tac nat a b, case_tac "nat", simp_all)
1.3032    moreover
1.3033 -  {assume "bound0 (Lt a)" hence bn:"bound0 (simpfm (Lt a))"
1.3034 +  {assume "bound0 (Lt a)" hence bn:"bound0 (simpfm (Lt a))"
1.3035        using simpfm_bound0 by blast
1.3036      have "isatom (simpfm (Lt a))" by (cases "simpnum a", auto simp add: Let_def)
1.3037      with bn bound0at_l have ?case by blast}
1.3038 -  moreover
1.3039 +  moreover
1.3040    { fix c e assume a: "a = CN 0 c e" and "c>0" and "numbound0 e"
1.3041      { assume cn1:"numgcd (CN 0 c (simpnum e)) \<noteq> 1" and cnz:"numgcd (CN 0 c (simpnum e)) \<noteq> 0"
1.3042        with numgcd_pos[where t="CN 0 c (simpnum e)"]
1.3043        have th1:"numgcd (CN 0 c (simpnum e)) > 0" by simp
1.3044 -      from \<open>c > 0\<close> have th:"numgcd (CN 0 c (simpnum e)) \<le> c"
1.3045 +      from \<open>c > 0\<close> have th:"numgcd (CN 0 c (simpnum e)) \<le> c"
1.3047        from \<open>c > 0\<close> have th': "c\<noteq>0" by auto
1.3048        from \<open>c > 0\<close> have cp: "c \<ge> 0" by simp
1.3049 @@ -3972,20 +3972,20 @@
1.3050        by (simp add: Let_def reducecoeff_def reducecoeffh_numbound0)}
1.3051    ultimately show ?case by blast
1.3052  next
1.3053 -  case (Le a)
1.3054 +  case (Le a)
1.3055    hence "bound0 (Le a) \<or> (\<exists> c e. a = CN 0 c e \<and> c > 0 \<and> numbound0 e)"
1.3056      by (cases a,simp_all, rename_tac nat a b, case_tac "nat", simp_all)
1.3057    moreover
1.3058 -  { assume "bound0 (Le a)" hence bn:"bound0 (simpfm (Le a))"
1.3059 +  { assume "bound0 (Le a)" hence bn:"bound0 (simpfm (Le a))"
1.3060        using simpfm_bound0 by blast
1.3061      have "isatom (simpfm (Le a))" by (cases "simpnum a", auto simp add: Let_def)
1.3062      with bn bound0at_l have ?case by blast}
1.3063 -  moreover
1.3064 +  moreover
1.3065    { fix c e assume a: "a = CN 0 c e" and "c>0" and "numbound0 e"
1.3066      { assume cn1:"numgcd (CN 0 c (simpnum e)) \<noteq> 1" and cnz:"numgcd (CN 0 c (simpnum e)) \<noteq> 0"
1.3067        with numgcd_pos[where t="CN 0 c (simpnum e)"]
1.3068        have th1:"numgcd (CN 0 c (simpnum e)) > 0" by simp
1.3069 -      from \<open>c > 0\<close> have th:"numgcd (CN 0 c (simpnum e)) \<le> c"
1.3070 +      from \<open>c > 0\<close> have th:"numgcd (CN 0 c (simpnum e)) \<le> c"
1.3072        from \<open>c > 0\<close> have th': "c\<noteq>0" by auto
1.3073        from \<open>c > 0\<close> have cp: "c \<ge> 0" by simp
1.3074 @@ -3996,20 +3996,20 @@
1.3075        by (simp add: Let_def reducecoeff_def reducecoeffh_numbound0)}
1.3076    ultimately show ?case by blast
1.3077  next
1.3078 -  case (Gt a)
1.3079 +  case (Gt a)
1.3080    hence "bound0 (Gt a) \<or> (\<exists> c e. a = CN 0 c e \<and> c > 0 \<and> numbound0 e)"
1.3081      by (cases a, simp_all, rename_tac nat a b,case_tac "nat", simp_all)
1.3082    moreover
1.3083 -  {assume "bound0 (Gt a)" hence bn:"bound0 (simpfm (Gt a))"
1.3084 +  {assume "bound0 (Gt a)" hence bn:"bound0 (simpfm (Gt a))"
1.3085        using simpfm_bound0 by blast
1.3086      have "isatom (simpfm (Gt a))" by (cases "simpnum a", auto simp add: Let_def)
1.3087      with bn bound0at_l have ?case by blast}
1.3088 -  moreover
1.3089 +  moreover
1.3090    { fix c e assume a: "a = CN 0 c e" and "c>0" and "numbound0 e"
1.3091      { assume cn1: "numgcd (CN 0 c (simpnum e)) \<noteq> 1" and cnz:"numgcd (CN 0 c (simpnum e)) \<noteq> 0"
1.3092        with numgcd_pos[where t="CN 0 c (simpnum e)"]
1.3093        have th1:"numgcd (CN 0 c (simpnum e)) > 0" by simp
1.3094 -      from \<open>c > 0\<close> have th:"numgcd (CN 0 c (simpnum e)) \<le> c"
1.3095 +      from \<open>c > 0\<close> have th:"numgcd (CN 0 c (simpnum e)) \<le> c"
1.3097        from \<open>c > 0\<close> have th': "c\<noteq>0" by auto
1.3098        from \<open>c > 0\<close> have cp: "c \<ge> 0" by simp
1.3099 @@ -4020,20 +4020,20 @@
1.3100        by (simp add: Let_def reducecoeff_def reducecoeffh_numbound0)}
1.3101    ultimately show ?case by blast
1.3102  next
1.3103 -  case (Ge a)
1.3104 +  case (Ge a)
1.3105    hence "bound0 (Ge a) \<or> (\<exists> c e. a = CN 0 c e \<and> c > 0 \<and> numbound0 e)"
1.3106      by (cases a,simp_all, rename_tac nat a b, case_tac "nat", simp_all)
1.3107    moreover
1.3108 -  { assume "bound0 (Ge a)" hence bn:"bound0 (simpfm (Ge a))"
1.3109 +  { assume "bound0 (Ge a)" hence bn:"bound0 (simpfm (Ge a))"
1.3110        using simpfm_bound0 by blast
1.3111      have "isatom (simpfm (Ge a))" by (cases "simpnum a", auto simp add: Let_def)
1.3112      with bn bound0at_l have ?case by blast}
1.3113 -  moreover
1.3114 +  moreover
1.3115    { fix c e assume a: "a = CN 0 c e" and "c>0" and "numbound0 e"
1.3116      { assume cn1:"numgcd (CN 0 c (simpnum e)) \<noteq> 1" and cnz:"numgcd (CN 0 c (simpnum e)) \<noteq> 0"
1.3117        with numgcd_pos[where t="CN 0 c (simpnum e)"]
1.3118        have th1:"numgcd (CN 0 c (simpnum e)) > 0" by simp
1.3119 -      from \<open>c > 0\<close> have th:"numgcd (CN 0 c (simpnum e)) \<le> c"
1.3120 +      from \<open>c > 0\<close> have th:"numgcd (CN 0 c (simpnum e)) \<le> c"
1.3122        from \<open>c > 0\<close> have th': "c\<noteq>0" by auto
1.3123        from \<open>c > 0\<close> have cp: "c \<ge> 0" by simp
1.3124 @@ -4044,20 +4044,20 @@
1.3125        by (simp add: Let_def reducecoeff_def reducecoeffh_numbound0)}
1.3126    ultimately show ?case by blast
1.3127  next
1.3128 -  case (Eq a)
1.3129 +  case (Eq a)
1.3130    hence "bound0 (Eq a) \<or> (\<exists> c e. a = CN 0 c e \<and> c > 0 \<and> numbound0 e)"
1.3131      by (cases a,simp_all, rename_tac nat a b, case_tac "nat", simp_all)
1.3132    moreover
1.3133 -  { assume "bound0 (Eq a)" hence bn:"bound0 (simpfm (Eq a))"
1.3134 +  { assume "bound0 (Eq a)" hence bn:"bound0 (simpfm (Eq a))"
1.3135        using simpfm_bound0 by blast
1.3136      have "isatom (simpfm (Eq a))" by (cases "simpnum a", auto simp add: Let_def)
1.3137      with bn bound0at_l have ?case by blast}
1.3138 -  moreover
1.3139 +  moreover
1.3140    { fix c e assume a: "a = CN 0 c e" and "c>0" and "numbound0 e"
1.3141      { assume cn1:"numgcd (CN 0 c (simpnum e)) \<noteq> 1" and cnz:"numgcd (CN 0 c (simpnum e)) \<noteq> 0"
1.3142        with numgcd_pos[where t="CN 0 c (simpnum e)"]
1.3143        have th1:"numgcd (CN 0 c (simpnum e)) > 0" by simp
1.3144 -      from \<open>c > 0\<close> have th:"numgcd (CN 0 c (simpnum e)) \<le> c"
1.3145 +      from \<open>c > 0\<close> have th:"numgcd (CN 0 c (simpnum e)) \<le> c"
1.3147        from \<open>c > 0\<close> have th': "c\<noteq>0" by auto
1.3148        from \<open>c > 0\<close> have cp: "c \<ge> 0" by simp
1.3149 @@ -4068,20 +4068,20 @@
1.3150        by (simp add: Let_def reducecoeff_def reducecoeffh_numbound0)}
1.3151    ultimately show ?case by blast
1.3152  next
1.3153 -  case (NEq a)
1.3154 +  case (NEq a)
1.3155    hence "bound0 (NEq a) \<or> (\<exists> c e. a = CN 0 c e \<and> c > 0 \<and> numbound0 e)"
1.3156      by (cases a,simp_all, rename_tac nat a b, case_tac "nat", simp_all)
1.3157    moreover
1.3158 -  {assume "bound0 (NEq a)" hence bn:"bound0 (simpfm (NEq a))"
1.3159 +  {assume "bound0 (NEq a)" hence bn:"bound0 (simpfm (NEq a))"
1.3160        using simpfm_bound0 by blast
1.3161      have "isatom (simpfm (NEq a))" by (cases "simpnum a", auto simp add: Let_def)
1.3162      with bn bound0at_l have ?case by blast}
1.3163 -  moreover
1.3164 +  moreover
1.3165    { fix c e assume a: "a = CN 0 c e" and "c>0" and "numbound0 e"
1.3166      { assume cn1:"numgcd (CN 0 c (simpnum e)) \<noteq> 1" and cnz:"numgcd (CN 0 c (simpnum e)) \<noteq> 0"
1.3167        with numgcd_pos[where t="CN 0 c (simpnum e)"]
1.3168        have th1:"numgcd (CN 0 c (simpnum e)) > 0" by simp
1.3169 -      from \<open>c > 0\<close> have th:"numgcd (CN 0 c (simpnum e)) \<le> c"
1.3170 +      from \<open>c > 0\<close> have th:"numgcd (CN 0 c (simpnum e)) \<le> c"
1.3172        from \<open>c > 0\<close> have th': "c\<noteq>0" by auto
1.3173        from \<open>c > 0\<close> have cp: "c \<ge> 0" by simp
1.3174 @@ -4092,12 +4092,12 @@
1.3175        by (simp add: Let_def reducecoeff_def reducecoeffh_numbound0)}
1.3176    ultimately show ?case by blast
1.3177  next
1.3178 -  case (Dvd i a) hence "bound0 (Dvd i a)" by auto hence bn:"bound0 (simpfm (Dvd i a))"
1.3179 +  case (Dvd i a) hence "bound0 (Dvd i a)" by auto hence bn:"bound0 (simpfm (Dvd i a))"
1.3180      using simpfm_bound0 by blast
1.3181    have "isatom (simpfm (Dvd i a))" by (cases "simpnum a", auto simp add: Let_def split_def)
1.3182    with bn bound0at_l show ?case by blast
1.3183  next
1.3184 -  case (NDvd i a)  hence "bound0 (NDvd i a)" by auto hence bn:"bound0 (simpfm (NDvd i a))"
1.3185 +  case (NDvd i a)  hence "bound0 (NDvd i a)" by auto hence bn:"bound0 (simpfm (NDvd i a))"
1.3186      using simpfm_bound0 by blast
1.3187    have "isatom (simpfm (NDvd i a))" by (cases "simpnum a", auto simp add: Let_def split_def)
1.3188    with bn bound0at_l show ?case by blast
1.3189 @@ -4107,15 +4107,15 @@
1.3190    assumes qfp: "qfree p"
1.3191    and xp: "0 \<le> x" and x1: "x < 1"
1.3192    shows "(Ifm (x#bs) (rlfm p) = Ifm (x# bs) p) \<and> isrlfm (rlfm p)"
1.3193 -  using qfp
1.3194 -by (induct p rule: rlfm.induct)
1.3195 +  using qfp
1.3196 +by (induct p rule: rlfm.induct)
1.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
1.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
1.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)
1.3200  lemma rlfm_l:
1.3201    assumes qfp: "qfree p"
1.3202    shows "isrlfm (rlfm p)"
1.3203 -  using qfp lt_l gt_l ge_l le_l eq_l neq_l DVD_l NDVD_l
1.3204 +  using qfp lt_l gt_l ge_l le_l eq_l neq_l DVD_l NDVD_l
1.3205  by (induct p rule: rlfm.induct) (auto simp add: simpfm_rl)
1.3206
1.3207      (* Operations needed for Ferrante and Rackoff *)
1.3208 @@ -4128,7 +4128,7 @@
1.3209  next
1.3210    case (2 p q) thus ?case by (auto,rule_tac x= "min z za" in exI) auto
1.3211  next
1.3212 -  case (3 c e)
1.3213 +  case (3 c e)
1.3214    from 3 have nb: "numbound0 e" by simp
1.3215    from 3 have cp: "real_of_int c > 0" by simp
1.3216    fix a
1.3217 @@ -4136,8 +4136,8 @@
1.3218    let ?z = "(- ?e) / real_of_int c"
1.3219    {fix x
1.3220      assume xz: "x < ?z"
1.3221 -    hence "(real_of_int c * x < - ?e)"
1.3222 -      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps)
1.3223 +    hence "(real_of_int c * x < - ?e)"
1.3224 +      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps)
1.3225      hence "real_of_int c * x + ?e < 0" by arith
1.3226      hence "real_of_int c * x + ?e \<noteq> 0" by simp
1.3227      with xz have "?P ?z x (Eq (CN 0 c e))"
1.3228 @@ -4145,7 +4145,7 @@
1.3229    hence "\<forall> x < ?z. ?P ?z x (Eq (CN 0 c e))" by simp
1.3230    thus ?case by blast
1.3231  next
1.3232 -  case (4 c e)
1.3233 +  case (4 c e)
1.3234    from 4 have nb: "numbound0 e" by simp
1.3235    from 4 have cp: "real_of_int c > 0" by simp
1.3236    fix a
1.3237 @@ -4153,8 +4153,8 @@
1.3238    let ?z = "(- ?e) / real_of_int c"
1.3239    {fix x
1.3240      assume xz: "x < ?z"
1.3241 -    hence "(real_of_int c * x < - ?e)"
1.3242 -      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps)
1.3243 +    hence "(real_of_int c * x < - ?e)"
1.3244 +      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps)
1.3245      hence "real_of_int c * x + ?e < 0" by arith
1.3246      hence "real_of_int c * x + ?e \<noteq> 0" by simp
1.3247      with xz have "?P ?z x (NEq (CN 0 c e))"
1.3248 @@ -4162,7 +4162,7 @@
1.3249    hence "\<forall> x < ?z. ?P ?z x (NEq (CN 0 c e))" by simp
1.3250    thus ?case by blast
1.3251  next
1.3252 -  case (5 c e)
1.3253 +  case (5 c e)
1.3254    from 5 have nb: "numbound0 e" by simp
1.3255    from 5 have cp: "real_of_int c > 0" by simp
1.3256    fix a
1.3257 @@ -4170,15 +4170,15 @@
1.3258    let ?z = "(- ?e) / real_of_int c"
1.3259    {fix x
1.3260      assume xz: "x < ?z"
1.3261 -    hence "(real_of_int c * x < - ?e)"
1.3262 -      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps)
1.3263 +    hence "(real_of_int c * x < - ?e)"
1.3264 +      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps)
1.3265      hence "real_of_int c * x + ?e < 0" by arith
1.3266      with xz have "?P ?z x (Lt (CN 0 c e))"
1.3267        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"]  by simp }
1.3268    hence "\<forall> x < ?z. ?P ?z x (Lt (CN 0 c e))" by simp
1.3269    thus ?case by blast
1.3270  next
1.3271 -  case (6 c e)
1.3272 +  case (6 c e)
1.3273    from 6 have nb: "numbound0 e" by simp
1.3274    from 6 have cp: "real_of_int c > 0" by simp
1.3275    fix a
1.3276 @@ -4186,15 +4186,15 @@
1.3277    let ?z = "(- ?e) / real_of_int c"
1.3278    {fix x
1.3279      assume xz: "x < ?z"
1.3280 -    hence "(real_of_int c * x < - ?e)"
1.3281 -      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps)
1.3282 +    hence "(real_of_int c * x < - ?e)"
1.3283 +      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps)
1.3284      hence "real_of_int c * x + ?e < 0" by arith
1.3285      with xz have "?P ?z x (Le (CN 0 c e))"
1.3286        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp }
1.3287    hence "\<forall> x < ?z. ?P ?z x (Le (CN 0 c e))" by simp
1.3288    thus ?case by blast
1.3289  next
1.3290 -  case (7 c e)
1.3291 +  case (7 c e)
1.3292    from 7 have nb: "numbound0 e" by simp
1.3293    from 7 have cp: "real_of_int c > 0" by simp
1.3294    fix a
1.3295 @@ -4202,15 +4202,15 @@
1.3296    let ?z = "(- ?e) / real_of_int c"
1.3297    {fix x
1.3298      assume xz: "x < ?z"
1.3299 -    hence "(real_of_int c * x < - ?e)"
1.3300 -      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps)
1.3301 +    hence "(real_of_int c * x < - ?e)"
1.3302 +      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps)
1.3303      hence "real_of_int c * x + ?e < 0" by arith
1.3304      with xz have "?P ?z x (Gt (CN 0 c e))"
1.3305        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp }
1.3306    hence "\<forall> x < ?z. ?P ?z x (Gt (CN 0 c e))" by simp
1.3307    thus ?case by blast
1.3308  next
1.3309 -  case (8 c e)
1.3310 +  case (8 c e)
1.3311    from 8 have nb: "numbound0 e" by simp
1.3312    from 8 have cp: "real_of_int c > 0" by simp
1.3313    fix a
1.3314 @@ -4218,8 +4218,8 @@
1.3315    let ?z = "(- ?e) / real_of_int c"
1.3316    {fix x
1.3317      assume xz: "x < ?z"
1.3318 -    hence "(real_of_int c * x < - ?e)"
1.3319 -      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps)
1.3320 +    hence "(real_of_int c * x < - ?e)"
1.3321 +      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="- ?e"] ac_simps)
1.3322      hence "real_of_int c * x + ?e < 0" by arith
1.3323      with xz have "?P ?z x (Ge (CN 0 c e))"
1.3324        using numbound0_I[OF nb, where b="x" and bs="bs" and b'="a"] by simp }
1.3325 @@ -4236,7 +4236,7 @@
1.3326  next
1.3327    case (2 p q) thus ?case by (auto,rule_tac x= "max z za" in exI) auto
1.3328  next
1.3329 -  case (3 c e)
1.3330 +  case (3 c e)
1.3331    from 3 have nb: "numbound0 e" by simp
1.3332    from 3 have cp: "real_of_int c > 0" by simp
1.3333    fix a
1.3334 @@ -4253,7 +4253,7 @@
1.3335    hence "\<forall> x > ?z. ?P ?z x (Eq (CN 0 c e))" by simp
1.3336    thus ?case by blast
1.3337  next
1.3338 -  case (4 c e)
1.3339 +  case (4 c e)
1.3340    from 4 have nb: "numbound0 e" by simp
1.3341    from 4 have cp: "real_of_int c > 0" by simp
1.3342    fix a
1.3343 @@ -4270,7 +4270,7 @@
1.3344    hence "\<forall> x > ?z. ?P ?z x (NEq (CN 0 c e))" by simp
1.3345    thus ?case by blast
1.3346  next
1.3347 -  case (5 c e)
1.3348 +  case (5 c e)
1.3349    from 5 have nb: "numbound0 e" by simp
1.3350    from 5 have cp: "real_of_int c > 0" by simp
1.3351    fix a
1.3352 @@ -4286,7 +4286,7 @@
1.3353    hence "\<forall> x > ?z. ?P ?z x (Lt (CN 0 c e))" by simp
1.3354    thus ?case by blast
1.3355  next
1.3356 -  case (6 c e)
1.3357 +  case (6 c e)
1.3358    from 6 have nb: "numbound0 e" by simp
1.3359    from 6 have cp: "real_of_int c > 0" by simp
1.3360    fix a
1.3361 @@ -4302,7 +4302,7 @@
1.3362    hence "\<forall> x > ?z. ?P ?z x (Le (CN 0 c e))" by simp
1.3363    thus ?case by blast
1.3364  next
1.3365 -  case (7 c e)
1.3366 +  case (7 c e)
1.3367    from 7 have nb: "numbound0 e" by simp
1.3368    from 7 have cp: "real_of_int c > 0" by simp
1.3369    fix a
1.3370 @@ -4318,7 +4318,7 @@
1.3371    hence "\<forall> x > ?z. ?P ?z x (Gt (CN 0 c e))" by simp
1.3372    thus ?case by blast
1.3373  next
1.3374 -  case (8 c e)
1.3375 +  case (8 c e)
1.3376    from 8 have nb: "numbound0 e" by simp
1.3377    from 8 have cp: "real_of_int c > 0" by simp
1.3378    fix a
1.3379 @@ -4354,7 +4354,7 @@
1.3380  proof-
1.3381    from bound0_I [OF rminusinf_bound0[OF lp], where b="a" and bs ="bs"] ex
1.3382    have th: "\<forall> x. Ifm (x#bs) (minusinf p)" by auto
1.3383 -  from rminusinf_inf[OF lp, where bs="bs"]
1.3384 +  from rminusinf_inf[OF lp, where bs="bs"]
1.3385    obtain z where z_def: "\<forall>x<z. Ifm (x # bs) (minusinf p) = Ifm (x # bs) p" by blast
1.3386    from th have "Ifm ((z - 1)#bs) (minusinf p)" by simp
1.3387    moreover have "z - 1 < z" by simp
1.3388 @@ -4368,19 +4368,19 @@
1.3389  proof-
1.3390    from bound0_I [OF rplusinf_bound0[OF lp], where b="a" and bs ="bs"] ex
1.3391    have th: "\<forall> x. Ifm (x#bs) (plusinf p)" by auto
1.3392 -  from rplusinf_inf[OF lp, where bs="bs"]
1.3393 +  from rplusinf_inf[OF lp, where bs="bs"]
1.3394    obtain z where z_def: "\<forall>x>z. Ifm (x # bs) (plusinf p) = Ifm (x # bs) p" by blast
1.3395    from th have "Ifm ((z + 1)#bs) (plusinf p)" by simp
1.3396    moreover have "z + 1 > z" by simp
1.3397    ultimately show ?thesis using z_def by auto
1.3398  qed
1.3399
1.3400 -consts
1.3401 +consts
1.3402    \<Upsilon>:: "fm \<Rightarrow> (num \<times> int) list"
1.3403    \<upsilon> :: "fm \<Rightarrow> (num \<times> int) \<Rightarrow> fm "
1.3404  recdef \<Upsilon> "measure size"
1.3405 -  "\<Upsilon> (And p q) = (\<Upsilon> p @ \<Upsilon> q)"
1.3406 -  "\<Upsilon> (Or p q) = (\<Upsilon> p @ \<Upsilon> q)"
1.3407 +  "\<Upsilon> (And p q) = (\<Upsilon> p @ \<Upsilon> q)"
1.3408 +  "\<Upsilon> (Or p q) = (\<Upsilon> p @ \<Upsilon> q)"
1.3409    "\<Upsilon> (Eq  (CN 0 c e)) = [(Neg e,c)]"
1.3410    "\<Upsilon> (NEq (CN 0 c e)) = [(Neg e,c)]"
1.3411    "\<Upsilon> (Lt  (CN 0 c e)) = [(Neg e,c)]"
1.3412 @@ -4410,10 +4410,10 @@
1.3413    have "?I ?u (Lt (CN 0 c e)) = (real_of_int c *(?t/?n) + (?N x e) < 0)"
1.3414      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
1.3415    also have "\<dots> = (?n*(real_of_int c *(?t/?n)) + ?n*(?N x e) < 0)"
1.3416 -    by (simp only: pos_less_divide_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)"
1.3417 +    by (simp only: pos_less_divide_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)"
1.3418        and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
1.3419    also have "\<dots> = (real_of_int c *?t + ?n* (?N x e) < 0)"
1.3420 -    using np by simp
1.3421 +    using np by simp
1.3422    finally show ?case using nbt nb by (simp add: algebra_simps)
1.3423  next
1.3424    case (6 c e)
1.3425 @@ -4421,10 +4421,10 @@
1.3426    have "?I ?u (Le (CN 0 c e)) = (real_of_int c *(?t/?n) + (?N x e) \<le> 0)"
1.3427      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
1.3428    also have "\<dots> = (?n*(real_of_int c *(?t/?n)) + ?n*(?N x e) \<le> 0)"
1.3429 -    by (simp only: pos_le_divide_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)"
1.3430 +    by (simp only: pos_le_divide_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)"
1.3431        and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
1.3432    also have "\<dots> = (real_of_int c *?t + ?n* (?N x e) \<le> 0)"
1.3433 -    using np by simp
1.3434 +    using np by simp
1.3435    finally show ?case using nbt nb by (simp add: algebra_simps)
1.3436  next
1.3437    case (7 c e)
1.3438 @@ -4432,10 +4432,10 @@
1.3439    have "?I ?u (Gt (CN 0 c e)) = (real_of_int c *(?t/?n) + (?N x e) > 0)"
1.3440      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
1.3441    also have "\<dots> = (?n*(real_of_int c *(?t/?n)) + ?n*(?N x e) > 0)"
1.3442 -    by (simp only: pos_divide_less_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)"
1.3443 +    by (simp only: pos_divide_less_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)"
1.3444        and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
1.3445    also have "\<dots> = (real_of_int c *?t + ?n* (?N x e) > 0)"
1.3446 -    using np by simp
1.3447 +    using np by simp
1.3448    finally show ?case using nbt nb by (simp add: algebra_simps)
1.3449  next
1.3450    case (8 c e)
1.3451 @@ -4443,10 +4443,10 @@
1.3452    have "?I ?u (Ge (CN 0 c e)) = (real_of_int c *(?t/?n) + (?N x e) \<ge> 0)"
1.3453      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
1.3454    also have "\<dots> = (?n*(real_of_int c *(?t/?n)) + ?n*(?N x e) \<ge> 0)"
1.3455 -    by (simp only: pos_divide_le_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)"
1.3456 +    by (simp only: pos_divide_le_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)"
1.3457        and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
1.3458    also have "\<dots> = (real_of_int c *?t + ?n* (?N x e) \<ge> 0)"
1.3459 -    using np by simp
1.3460 +    using np by simp
1.3461    finally show ?case using nbt nb by (simp add: algebra_simps)
1.3462  next
1.3463    case (3 c e)
1.3464 @@ -4455,10 +4455,10 @@
1.3465    have "?I ?u (Eq (CN 0 c e)) = (real_of_int c *(?t/?n) + (?N x e) = 0)"
1.3466      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
1.3467    also have "\<dots> = (?n*(real_of_int c *(?t/?n)) + ?n*(?N x e) = 0)"
1.3468 -    by (simp only: nonzero_eq_divide_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)"
1.3469 +    by (simp only: nonzero_eq_divide_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)"
1.3470        and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
1.3471    also have "\<dots> = (real_of_int c *?t + ?n* (?N x e) = 0)"
1.3472 -    using np by simp
1.3473 +    using np by simp
1.3474    finally show ?case using nbt nb by (simp add: algebra_simps)
1.3475  next
1.3476    case (4 c e)
1.3477 @@ -4467,10 +4467,10 @@
1.3478    have "?I ?u (NEq (CN 0 c e)) = (real_of_int c *(?t/?n) + (?N x e) \<noteq> 0)"
1.3479      using numbound0_I[OF nb, where bs="bs" and b="?u" and b'="x"] by simp
1.3480    also have "\<dots> = (?n*(real_of_int c *(?t/?n)) + ?n*(?N x e) \<noteq> 0)"
1.3481 -    by (simp only: nonzero_eq_divide_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)"
1.3482 +    by (simp only: nonzero_eq_divide_eq[OF np, where a="real_of_int c *(?t/?n) + (?N x e)"
1.3483        and b="0", simplified divide_zero_left]) (simp only: algebra_simps)
1.3484    also have "\<dots> = (real_of_int c *?t + ?n* (?N x e) \<noteq> 0)"
1.3485 -    using np by simp
1.3486 +    using np by simp
1.3487    finally show ?case using nbt nb by (simp add: algebra_simps)
1.3488  qed(simp_all add: nbt numbound0_I[where bs ="bs" and b="(Inum (x#bs) t)/ real_of_int n" and b'="x"])
1.3489
1.3490 @@ -4491,7 +4491,7 @@
1.3491      by (induct p rule: minusinf.induct, auto simp add:numbound0_I[where bs="bs" and b="a" and b'="x"])
1.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
1.3493    from \<Upsilon>_l[OF lp] smU have mp: "real_of_int m > 0" by auto
1.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"
1.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"
1.3496      by (auto simp add: mult.commute)
1.3497    thus ?thesis using smU by auto
1.3498  qed
1.3499 @@ -4507,14 +4507,14 @@
1.3500      by (induct p rule: minusinf.induct, auto simp add:numbound0_I[where bs="bs" and b="a" and b'="x"])
1.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
1.3502    from \<Upsilon>_l[OF lp] smU have mp: "real_of_int m > 0" by auto
1.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"
1.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"
1.3505      by (auto simp add: mult.commute)
1.3506    thus ?thesis using smU by auto
1.3507  qed
1.3508
1.3509 -lemma lin_dense:
1.3510 +lemma lin_dense:
1.3511    assumes lp: "isrlfm p"
1.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)"
1.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)"
1.3514    (is "\<forall> t. _ \<and> _ \<longrightarrow> t \<notin> (\<lambda> (t,n). ?N x t / real_of_int n ) ` (?U p)")
1.3515    and lx: "l < x" and xu:"x < u" and px:" Ifm (x#bs) p"
1.3516    and ly: "l < y" and yu: "y < u"
1.3517 @@ -4523,7 +4523,7 @@
1.3518  proof (induct p rule: isrlfm.induct)
1.3519    case (5 c e) hence cp: "real_of_int c > 0" and nb: "numbound0 e" by simp_all
1.3520    from 5 have "x * real_of_int c + ?N x e < 0" by (simp add: algebra_simps)
1.3521 -  hence pxc: "x < (- ?N x e) / real_of_int c"
1.3522 +  hence pxc: "x < (- ?N x e) / real_of_int c"
1.3523      by (simp only: pos_less_divide_eq[OF cp, where a="x" and b="-?N x e"])
1.3524    from 5 have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real_of_int c" by auto
1.3525    with ly yu have yne: "y \<noteq> - ?N x e / real_of_int c" by auto
1.3526 @@ -4533,7 +4533,7 @@
1.3527        by (simp add: pos_less_divide_eq[OF cp, where a="y" and b="-?N x e", symmetric])
1.3528      hence "real_of_int c * y + ?N x e < 0" by (simp add: algebra_simps)
1.3529      hence ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] by simp}
1.3530 -  moreover {assume y: "y > (- ?N x e) / real_of_int c"
1.3531 +  moreover {assume y: "y > (- ?N x e) / real_of_int c"
1.3532      with yu have eu: "u > (- ?N x e) / real_of_int c" by auto
1.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)
1.3534      with lx pxc have "False" by auto
1.3535 @@ -4542,7 +4542,7 @@
1.3536  next
1.3537    case (6 c e) hence cp: "real_of_int c > 0" and nb: "numbound0 e" by simp_all
1.3538    from 6 have "x * real_of_int c + ?N x e \<le> 0" by (simp add: algebra_simps)
1.3539 -  hence pxc: "x \<le> (- ?N x e) / real_of_int c"
1.3540 +  hence pxc: "x \<le> (- ?N x e) / real_of_int c"
1.3541      by (simp only: pos_le_divide_eq[OF cp, where a="x" and b="-?N x e"])
1.3542    from 6 have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real_of_int c" by auto
1.3543    with ly yu have yne: "y \<noteq> - ?N x e / real_of_int c" by auto
1.3544 @@ -4552,7 +4552,7 @@
1.3545        by (simp add: pos_less_divide_eq[OF cp, where a="y" and b="-?N x e", symmetric])
1.3546      hence "real_of_int c * y + ?N x e < 0" by (simp add: algebra_simps)
1.3547      hence ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] by simp}
1.3548 -  moreover {assume y: "y > (- ?N x e) / real_of_int c"
1.3549 +  moreover {assume y: "y > (- ?N x e) / real_of_int c"
1.3550      with yu have eu: "u > (- ?N x e) / real_of_int c" by auto
1.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)
1.3552      with lx pxc have "False" by auto
1.3553 @@ -4561,7 +4561,7 @@
1.3554  next
1.3555    case (7 c e) hence cp: "real_of_int c > 0" and nb: "numbound0 e" by simp_all
1.3556    from 7 have "x * real_of_int c + ?N x e > 0" by (simp add: algebra_simps)
1.3557 -  hence pxc: "x > (- ?N x e) / real_of_int c"
1.3558 +  hence pxc: "x > (- ?N x e) / real_of_int c"
1.3559      by (simp only: pos_divide_less_eq[OF cp, where a="x" and b="-?N x e"])
1.3560    from 7 have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real_of_int c" by auto
1.3561    with ly yu have yne: "y \<noteq> - ?N x e / real_of_int c" by auto
1.3562 @@ -4571,7 +4571,7 @@
1.3563        by (simp add: pos_divide_less_eq[OF cp, where a="y" and b="-?N x e", symmetric])
1.3564      hence "real_of_int c * y + ?N x e > 0" by (simp add: algebra_simps)
1.3565      hence ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] by simp}
1.3566 -  moreover {assume y: "y < (- ?N x e) / real_of_int c"
1.3567 +  moreover {assume y: "y < (- ?N x e) / real_of_int c"
1.3568      with ly have eu: "l < (- ?N x e) / real_of_int c" by auto
1.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)
1.3570      with xu pxc have "False" by auto
1.3571 @@ -4580,7 +4580,7 @@
1.3572  next
1.3573    case (8 c e) hence cp: "real_of_int c > 0" and nb: "numbound0 e" by simp_all
1.3574    from 8 have "x * real_of_int c + ?N x e \<ge> 0" by (simp add: algebra_simps)
1.3575 -  hence pxc: "x \<ge> (- ?N x e) / real_of_int c"
1.3576 +  hence pxc: "x \<ge> (- ?N x e) / real_of_int c"
1.3577      by (simp only: pos_divide_le_eq[OF cp, where a="x" and b="-?N x e"])
1.3578    from 8 have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real_of_int c" by auto
1.3579    with ly yu have yne: "y \<noteq> - ?N x e / real_of_int c" by auto
1.3580 @@ -4590,7 +4590,7 @@
1.3581        by (simp add: pos_divide_less_eq[OF cp, where a="y" and b="-?N x e", symmetric])
1.3582      hence "real_of_int c * y + ?N x e > 0" by (simp add: algebra_simps)
1.3583      hence ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"] by simp}
1.3584 -  moreover {assume y: "y < (- ?N x e) / real_of_int c"
1.3585 +  moreover {assume y: "y < (- ?N x e) / real_of_int c"
1.3586      with ly have eu: "l < (- ?N x e) / real_of_int c" by auto
1.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)
1.3588      with xu pxc have "False" by auto
1.3589 @@ -4600,7 +4600,7 @@
1.3590    case (3 c e) hence cp: "real_of_int c > 0" and nb: "numbound0 e" by simp_all
1.3591    from cp have cnz: "real_of_int c \<noteq> 0" by simp
1.3592    from 3 have "x * real_of_int c + ?N x e = 0" by (simp add: algebra_simps)
1.3593 -  hence pxc: "x = (- ?N x e) / real_of_int c"
1.3594 +  hence pxc: "x = (- ?N x e) / real_of_int c"
1.3595      by (simp only: nonzero_eq_divide_eq[OF cnz, where a="x" and b="-?N x e"])
1.3596    from 3 have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real_of_int c" by auto
1.3597    with lx xu have yne: "x \<noteq> - ?N x e / real_of_int c" by auto
1.3598 @@ -4610,10 +4610,10 @@
1.3599    from cp have cnz: "real_of_int c \<noteq> 0" by simp
1.3600    from 4 have noSc:"\<forall> t. l < t \<and> t < u \<longrightarrow> t \<noteq> (- ?N x e) / real_of_int c" by auto
1.3601    with ly yu have yne: "y \<noteq> - ?N x e / real_of_int c" by auto
1.3602 -  hence "y* real_of_int c \<noteq> -?N x e"
1.3603 +  hence "y* real_of_int c \<noteq> -?N x e"
1.3604      by (simp only: nonzero_eq_divide_eq[OF cnz, where a="y" and b="-?N x e"]) simp
1.3605    hence "y* real_of_int c + ?N x e \<noteq> 0" by (simp add: algebra_simps)
1.3606 -  thus ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"]
1.3607 +  thus ?case using numbound0_I[OF nb, where bs="bs" and b="x" and b'="y"]
1.3609  qed (auto simp add: numbound0_I[where bs="bs" and b="y" and b'="x"])
1.3610
1.3611 @@ -4623,7 +4623,7 @@
1.3612    and npi: "\<not> (Ifm (x#bs) (plusinf p))" (is "\<not> (Ifm (x#bs) (?P p))")
1.3613    and ex: "\<exists> x.  Ifm (x#bs) p" (is "\<exists> x. ?I x p")
1.3614    shows "\<exists> (l,n) \<in> set (\<Upsilon> p). \<exists> (s,m) \<in> set (\<Upsilon> p).
1.3615 -    ?I ((Inum (x#bs) l / real_of_int n + Inum (x#bs) s / real_of_int m) / 2) p"
1.3616 +    ?I ((Inum (x#bs) l / real_of_int n + Inum (x#bs) s / real_of_int m) / 2) p"
1.3617  proof-
1.3618    let ?N = "\<lambda> x t. Inum (x#bs) t"
1.3619    let ?U = "set (\<Upsilon> p)"
1.3620 @@ -4636,10 +4636,10 @@
1.3621    proof-
1.3622      let ?M = "(\<lambda> (t,c). ?N a t / real_of_int c) ` ?U"
1.3623      have fM: "finite ?M" by auto
1.3624 -    from rminusinf_\<Upsilon>[OF lp nmi pa] rplusinf_\<Upsilon>[OF lp npi pa]
1.3625 +    from rminusinf_\<Upsilon>[OF lp nmi pa] rplusinf_\<Upsilon>[OF lp npi pa]
1.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
1.3627 -    then obtain "t" "n" "s" "m" where
1.3628 -      tnU: "(t,n) \<in> ?U" and smU: "(s,m) \<in> ?U"
1.3629 +    then obtain "t" "n" "s" "m" where
1.3630 +      tnU: "(t,n) \<in> ?U" and smU: "(s,m) \<in> ?U"
1.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
1.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
1.3633      from tnU have Mne: "?M \<noteq> {}" by auto
1.3634 @@ -4649,23 +4649,23 @@
1.3635      have linM: "?l \<in> ?M" using fM Mne by simp
1.3636      have uinM: "?u \<in> ?M" using fM Mne by simp
1.3637      have tnM: "?N a t / real_of_int n \<in> ?M" using tnU by auto
1.3638 -    have smM: "?N a s / real_of_int m \<in> ?M" using smU by auto
1.3639 +    have smM: "?N a s / real_of_int m \<in> ?M" using smU by auto
1.3640      have lM: "\<forall> t\<in> ?M. ?l \<le> t" using Mne fM by auto
1.3641      have Mu: "\<forall> t\<in> ?M. t \<le> ?u" using Mne fM by auto
1.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
1.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
1.3644      from finite_set_intervals2[where P="\<lambda> x. ?I x p",OF pa lx xu linM uinM fM lM Mu]
1.3645 -    have "(\<exists> s\<in> ?M. ?I s p) \<or>
1.3646 +    have "(\<exists> s\<in> ?M. ?I s p) \<or>
1.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)" .
1.3648      moreover { fix u assume um: "u\<in> ?M" and pu: "?I u p"
1.3649        hence "\<exists> (tu,nu) \<in> ?U. u = ?N a tu / real_of_int nu" by auto
1.3650        then obtain "tu" "nu" where tuU: "(tu,nu) \<in> ?U" and tuu:"u= ?N a tu / real_of_int nu" by blast
1.3651 -      have "(u + u) / 2 = u" by auto with pu tuu
1.3652 +      have "(u + u) / 2 = u" by auto with pu tuu
1.3653        have "?I (((?N a tu / real_of_int nu) + (?N a tu / real_of_int nu)) / 2) p" by simp
1.3654        with tuU have ?thesis by blast}
1.3655      moreover{
1.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"
1.3657 -      then obtain t1 and t2 where t1M: "t1 \<in> ?M" and t2M: "t2\<in> ?M"
1.3658 +      then obtain t1 and t2 where t1M: "t1 \<in> ?M" and t2M: "t2\<in> ?M"
1.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"
1.3660          by blast
1.3661        from t1M have "\<exists> (t1u,t1n) \<in> ?U. t1 = ?N a t1u / real_of_int t1n" by auto
1.3662 @@ -4679,10 +4679,10 @@
1.3663        with t1uU t2uU t1u t2u have ?thesis by blast}
1.3664      ultimately show ?thesis by blast
1.3665    qed
1.3666 -  then obtain "l" "n" "s"  "m" where lnU: "(l,n) \<in> ?U" and smU:"(s,m) \<in> ?U"
1.3667 +  then obtain "l" "n" "s"  "m" where lnU: "(l,n) \<in> ?U" and smU:"(s,m) \<in> ?U"
1.3668      and pu: "?I ((?N a l / real_of_int n + ?N a s / real_of_int m) / 2) p" by blast
1.3669    from lnU smU \<Upsilon>_l[OF lp] have nbl: "numbound0 l" and nbs: "numbound0 s" by auto
1.3670 -  from numbound0_I[OF nbl, where bs="bs" and b="a" and b'="x"]
1.3671 +  from numbound0_I[OF nbl, where bs="bs" and b="a" and b'="x"]
1.3672      numbound0_I[OF nbs, where bs="bs" and b="a" and b'="x"] pu
1.3673    have "?I ((?N x l / real_of_int n + ?N x s / real_of_int m) / 2) p" by simp
1.3674    with lnU smU
1.3675 @@ -4690,7 +4690,7 @@
1.3676  qed
1.3677      (* The Ferrante - Rackoff Theorem *)
1.3678
1.3679 -theorem fr_eq:
1.3680 +theorem fr_eq:
1.3681    assumes lp: "isrlfm p"
1.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))"
1.3683    (is "(\<exists> x. ?I x p) = (?M \<or> ?P \<or> ?F)" is "?E = ?D")
1.3684 @@ -4702,7 +4702,7 @@
1.3685      from rinf_\<Upsilon>[OF lp nmi npi] have "?F" using px by blast hence "?D" by blast}
1.3686    ultimately show "?D" by blast
1.3687  next
1.3688 -  assume "?D"
1.3689 +  assume "?D"
1.3690    moreover {assume m:"?M" from rminusinf_ex[OF lp m] have "?E" .}
1.3691    moreover {assume p: "?P" from rplusinf_ex[OF lp p] have "?E" . }
1.3692    moreover {assume f:"?F" hence "?E" by blast}
1.3693 @@ -4710,7 +4710,7 @@
1.3694  qed
1.3695
1.3696
1.3697 -lemma fr_eq_\<upsilon>:
1.3698 +lemma fr_eq_\<upsilon>:
1.3699    assumes lp: "isrlfm p"
1.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))))"
1.3701    (is "(\<exists> x. ?I x p) = (?M \<or> ?P \<or> ?F)" is "?E = ?D")
1.3702 @@ -4729,15 +4729,15 @@
1.3703        from tnb snb have st_nb: "numbound0 ?st" by simp
1.3704        have st: "(?N t / real_of_int n + ?N s / real_of_int m)/2 = ?N ?st / real_of_int (2*n*m)"
1.3706 -      from \<upsilon>_I[OF lp mnp st_nb, where x="x" and bs="bs"]
1.3707 +      from \<upsilon>_I[OF lp mnp st_nb, where x="x" and bs="bs"]
1.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])}
1.3709      with rinf_\<Upsilon>[OF lp nmi npi px] have "?F" by blast hence "?D" by blast}
1.3710    ultimately show "?D" by blast
1.3711  next
1.3712 -  assume "?D"
1.3713 +  assume "?D"
1.3714    moreover {assume m:"?M" from rminusinf_ex[OF lp m] have "?E" .}
1.3715    moreover {assume p: "?P" from rplusinf_ex[OF lp p] have "?E" . }
1.3716 -  moreover {fix t k s l assume "(t,k) \<in> set (\<Upsilon> p)" and "(s,l) \<in> set (\<Upsilon> p)"
1.3717 +  moreover {fix t k s l assume "(t,k) \<in> set (\<Upsilon> p)" and "(s,l) \<in> set (\<Upsilon> p)"
1.3718      and px:"?I x (\<upsilon> p (Add (Mul l t) (Mul k s), 2*k*l))"
1.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
1.3720      let ?st = "Add (Mul l t) (Mul k s)"
1.3721 @@ -4759,7 +4759,7 @@
1.3722    have "x = real_of_int ?i + ?u" by simp
1.3723    hence "P (real_of_int ?i + ?u)" using Px by simp
1.3724    moreover have "real_of_int ?i \<le> x" using of_int_floor_le by simp hence "0 \<le> ?u" by arith
1.3725 -  moreover have "?u < 1" using real_of_int_floor_add_one_gt[where r="x"] by arith
1.3726 +  moreover have "?u < 1" using real_of_int_floor_add_one_gt[where r="x"] by arith
1.3727    ultimately show "(\<exists> (i::int) (u::real). 0\<le> u \<and> u< 1 \<and> P (real_of_int i + u))" by blast
1.3728  qed
1.3729
1.3730 @@ -4792,11 +4792,11 @@
1.3731  | "exsplit (NOT p) = NOT (exsplit p)"
1.3732  | "exsplit p = p"
1.3733
1.3734 -lemma exsplitnum:
1.3735 +lemma exsplitnum:
1.3736    "Inum (x#y#bs) (exsplitnum t) = Inum ((x+y) #bs) t"
1.3737    by(induct t rule: exsplitnum.induct) (simp_all add: algebra_simps)
1.3738
1.3739 -lemma exsplit:
1.3740 +lemma exsplit:
1.3741    assumes qfp: "qfree p"
1.3742    shows "Ifm (x#y#bs) (exsplit p) = Ifm ((x+y)#bs) p"
1.3743  using qfp exsplitnum[where x="x" and y="y" and bs="bs"]
1.3744 @@ -4810,7 +4810,7 @@
1.3745      by (simp add: myless[of _ "1"] myless[of _ "0"] ac_simps)
1.3746    also have "\<dots> = (\<exists> (i::int). \<exists> x. 0\<le> x \<and> x < 1 \<and> Ifm ((real_of_int i + x) #bs) p)"
1.3747      by (simp only: exsplit[OF qf] ac_simps)
1.3748 -  also have "\<dots> = (\<exists> x. Ifm (x#bs) p)"
1.3749 +  also have "\<dots> = (\<exists> x. Ifm (x#bs) p)"
1.3750      by (simp only: real_ex_int_real01[where P="\<lambda> x. Ifm (x#bs) p"])
1.3751    finally show ?thesis by simp
1.3752  qed
1.3753 @@ -4819,12 +4819,12 @@
1.3754
1.3755  definition ferrack01 :: "fm \<Rightarrow> fm" where
1.3756    "ferrack01 p \<equiv> (let p' = rlfm(And (And (Ge(CN 0 1 (C 0))) (Lt (CN 0 1 (C (- 1))))) p);
1.3757 -                    U = remdups(map simp_num_pair
1.3758 +                    U = remdups(map simp_num_pair
1.3759                       (map (\<lambda> ((t,n),(s,m)). (Add (Mul m t) (Mul n s) , 2*n*m))
1.3760 -                           (alluopairs (\<Upsilon> p'))))
1.3761 +                           (alluopairs (\<Upsilon> p'))))
1.3762    in decr (evaldjf (\<upsilon> p') U ))"
1.3763
1.3764 -lemma fr_eq_01:
1.3765 +lemma fr_eq_01:
1.3766    assumes qf: "qfree p"
1.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)))"
1.3768    (is "(\<exists> x. ?I x ?q) = ?F")
1.3769 @@ -4837,18 +4837,18 @@
1.3770      by (cases "rlfm p = And (Ge (CN 0 1 (C 0))) (Lt (CN 0 1 (C (- 1))))", simp_all)
1.3771    have PF: "?P = False" apply (simp add: Let_def reducecoeff_def numgcd_def rsplit_def ge_def lt_def conj_def disj_def)
1.3772      by (cases "rlfm p = And (Ge (CN 0 1 (C 0))) (Lt (CN 0 1 (C (- 1))))", simp_all)
1.3773 -  have "(\<exists> x. ?I x ?q ) =
1.3774 +  have "(\<exists> x. ?I x ?q ) =
1.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))))"
1.3776      (is "(\<exists> x. ?I x ?q) = (?M \<or> ?P \<or> ?F)" is "?E = ?D")
1.3777    proof
1.3778 -    assume "\<exists> x. ?I x ?q"
1.3779 +    assume "\<exists> x. ?I x ?q"
1.3780      then obtain x where qx: "?I x ?q" by blast
1.3781 -    hence xp: "0\<le> x" and x1: "x< 1" and px: "?I x p"
1.3782 +    hence xp: "0\<le> x" and x1: "x< 1" and px: "?I x p"
1.3783        by (auto simp add: rsplit_def lt_def ge_def rlfm_I[OF qf])
1.3784 -    from qx have "?I x ?rq "
1.3785 +    from qx have "?I x ?rq "
1.3786        by (simp add: rsplit_def lt_def ge_def rlfm_I[OF qf xp x1])
1.3787      hence lqx: "?I x ?rq " using simpfm[where p="?rq" and bs="x#bs"] by auto
1.3788 -    from qf have qfq:"isrlfm ?rq"
1.3789 +    from qf have qfq:"isrlfm ?rq"
1.3790        by (auto simp add: rsplit_def lt_def ge_def rlfm_I[OF qf xp x1])
1.3791      with lqx fr_eq_\<upsilon>[OF qfq] show "?M \<or> ?P \<or> ?F" by blast
1.3792    next
1.3793 @@ -4856,7 +4856,7 @@
1.3794      let ?U = "set (\<Upsilon> ?rq )"
1.3795      from MF PF D have "?F" by auto
1.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
1.3797 -    from qf have lrq:"isrlfm ?rq"using rlfm_l[OF qf]
1.3798 +    from qf have lrq:"isrlfm ?rq"using rlfm_l[OF qf]
1.3799        by (auto simp add: rsplit_def lt_def ge_def)
1.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)
1.3801      let ?st = "Add (Mul m t) (Mul n s)"
1.3802 @@ -4864,7 +4864,7 @@
1.3803      from np mp have mnp: "real_of_int (2*n*m) > 0" by (simp add: mult.commute)
1.3804      from conjunct1[OF \<upsilon>_I[OF lrq mnp stnb, where bs="bs" and x="x"], symmetric] rqx
1.3805      have "\<exists> x. ?I x ?rq" by auto
1.3806 -    thus "?E"
1.3807 +    thus "?E"
1.3808        using rlfm_I[OF qf] by (auto simp add: rsplit_def lt_def ge_def)
1.3809    qed
1.3810    with MF PF show ?thesis by blast
1.3811 @@ -4882,25 +4882,25 @@
1.3812    let ?N = "\<lambda> t. Inum (x#bs) t"
1.3813    let ?st= "Add (Mul m t) (Mul n s)"
1.3814    from Ul th have mnz: "m \<noteq> 0" by auto
1.3815 -  from Ul th have  nnz: "n \<noteq> 0" by auto
1.3816 +  from Ul th have  nnz: "n \<noteq> 0" by auto
1.3817    have st: "(?N t / real_of_int n + ?N s / real_of_int m)/2 = ?N ?st / real_of_int (2*n*m)"
1.3819 -
1.3820 +
1.3821    thus "(real_of_int m *  Inum (x # bs) t + real_of_int n * Inum (x # bs) s) /
1.3822         (2 * real_of_int n * real_of_int m)
1.3823         \<in> (\<lambda>((t, n), s, m).
1.3824               (Inum (x # bs) t / real_of_int n + Inum (x # bs) s / real_of_int m) / 2) `
1.3825 -         (set U \<times> set U)"using mnz nnz th
1.3826 +         (set U \<times> set U)"using mnz nnz th
1.3828 -    by (rule_tac x="(s,m)" in bexI,simp_all)
1.3829 +    by (rule_tac x="(s,m)" in bexI,simp_all)
1.3830    (rule_tac x="(t,n)" in bexI,simp_all add: mult.commute)
1.3831  next
1.3832    fix t n s m
1.3833 -  assume tnU: "(t,n) \<in> set U" and smU:"(s,m) \<in> set U"
1.3834 +  assume tnU: "(t,n) \<in> set U" and smU:"(s,m) \<in> set U"
1.3835    let ?N = "\<lambda> t. Inum (x#bs) t"
1.3836    let ?st= "Add (Mul m t) (Mul n s)"
1.3837    from Ul smU have mnz: "m \<noteq> 0" by auto
1.3838 -  from Ul tnU have  nnz: "n \<noteq> 0" by auto
1.3839 +  from Ul tnU have  nnz: "n \<noteq> 0" by auto
1.3840    have st: "(?N t / real_of_int n + ?N s / real_of_int m)/2 = ?N ?st / real_of_int (2*n*m)"
1.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"
1.3843 @@ -4910,13 +4910,13 @@
1.3844   from alluopairs_ex[OF Pc, where xs="U"] tnU smU
1.3845   have th':"\<exists> ((t',n'),(s',m')) \<in> set (alluopairs U). ?P (t',n') (s',m')"
1.3846     by blast
1.3847 - then obtain t' n' s' m' where ts'_U: "((t',n'),(s',m')) \<in> set (alluopairs U)"
1.3848 + then obtain t' n' s' m' where ts'_U: "((t',n'),(s',m')) \<in> set (alluopairs U)"
1.3849     and Pts': "?P (t',n') (s',m')" by blast
1.3850   from ts'_U Up have mnz': "m' \<noteq> 0" and nnz': "n'\<noteq> 0" by auto
1.3851   let ?st' = "Add (Mul m' t') (Mul n' s')"
1.3852     have st': "(?N t' / real_of_int n' + ?N s' / real_of_int m')/2 = ?N ?st' / real_of_int (2*n'*m')"
1.3854 - from Pts' have
1.3855 + from Pts' have
1.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
1.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')
1.3858   finally show "(Inum (x # bs) t / real_of_int n + Inum (x # bs) s / real_of_int m) / 2
1.3859 @@ -4935,13 +4935,13 @@
1.3860    (is "?lhs = ?rhs")
1.3861  proof
1.3862    assume ?lhs
1.3863 -  then obtain t n s m where tnU: "(t,n) \<in> U" and smU:"(s,m) \<in> U" and
1.3864 +  then obtain t n s m where tnU: "(t,n) \<in> U" and smU:"(s,m) \<in> U" and
1.3865      Pst: "Ifm (x#bs) (\<upsilon> p (Add (Mul m t) (Mul n s),2*n*m))" by blast
1.3866    let ?N = "\<lambda> t. Inum (x#bs) t"
1.3867 -  from tnU smU U have tnb: "numbound0 t" and np: "n > 0"
1.3868 +  from tnU smU U have tnb: "numbound0 t" and np: "n > 0"
1.3869      and snb: "numbound0 s" and mp:"m > 0"  by auto
1.3870    let ?st= "Add (Mul m t) (Mul n s)"
1.3871 -  from np mp have mnp: "real_of_int (2*n*m) > 0"
1.3872 +  from np mp have mnp: "real_of_int (2*n*m) > 0"
1.3873        by (simp add: mult.commute of_int_mult[symmetric] del: of_int_mult)
1.3874      from tnb snb have stnb: "numbound0 ?st" by simp
1.3875    have st: "(?N t / real_of_int n + ?N s / real_of_int m)/2 = ?N ?st / real_of_int (2*n*m)"
1.3876 @@ -4951,25 +4951,25 @@
1.3877      by auto (rule_tac x="(a,b)" in bexI, auto)
1.3878    then obtain t' n' where tnU': "(t',n') \<in> U'" and th: "?g ((t,n),(s,m)) = ?f (t',n')" by blast
1.3879    from U' tnU' have tnb': "numbound0 t'" and np': "real_of_int n' > 0" by auto
1.3880 -  from \<upsilon>_I[OF lp mnp stnb, where bs="bs" and x="x"] Pst
1.3881 +  from \<upsilon>_I[OF lp mnp stnb, where bs="bs" and x="x"] Pst
1.3882    have Pst2: "Ifm (Inum (x # bs) (Add (Mul m t) (Mul n s)) / real_of_int (2 * n * m) # bs) p" by simp
1.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]]
1.3884 -  have "Ifm (x # bs) (\<upsilon> p (t', n')) " by (simp only: st)
1.3885 -  then show ?rhs using tnU' by auto
1.3886 +  have "Ifm (x # bs) (\<upsilon> p (t', n')) " by (simp only: st)
1.3887 +  then show ?rhs using tnU' by auto
1.3888  next
1.3889    assume ?rhs
1.3890 -  then obtain t' n' where tnU': "(t',n') \<in> U'" and Pt': "Ifm (x # bs) (\<upsilon> p (t', n'))"
1.3891 +  then obtain t' n' where tnU': "(t',n') \<in> U'" and Pt': "Ifm (x # bs) (\<upsilon> p (t', n'))"
1.3892      by blast
1.3893    from tnU' UU' have "?f (t',n') \<in> ?g ` (U\<times>U)" by blast
1.3894 -  hence "\<exists> ((t,n),(s,m)) \<in> (U\<times>U). ?f (t',n') = ?g ((t,n),(s,m))"
1.3895 +  hence "\<exists> ((t,n),(s,m)) \<in> (U\<times>U). ?f (t',n') = ?g ((t,n),(s,m))"
1.3896      by auto (rule_tac x="(a,b)" in bexI, auto)
1.3897 -  then obtain t n s m where tnU: "(t,n) \<in> U" and smU:"(s,m) \<in> U" and
1.3898 +  then obtain t n s m where tnU: "(t,n) \<in> U" and smU:"(s,m) \<in> U" and
1.3899      th: "?f (t',n') = ?g((t,n),(s,m)) "by blast
1.3900      let ?N = "\<lambda> t. Inum (x#bs) t"
1.3901 -  from tnU smU U have tnb: "numbound0 t" and np: "n > 0"
1.3902 +  from tnU smU U have tnb: "numbound0 t" and np: "n > 0"
1.3903      and snb: "numbound0 s" and mp:"m > 0"  by auto
1.3904    let ?st= "Add (Mul m t) (Mul n s)"
1.3905 -  from np mp have mnp: "real_of_int (2*n*m) > 0"
1.3906 +  from np mp have mnp: "real_of_int (2*n*m) > 0"
1.3907        by (simp add: mult.commute of_int_mult[symmetric] del: of_int_mult)
1.3908      from tnb snb have stnb: "numbound0 ?st" by simp
1.3909    have st: "(?N t / real_of_int n + ?N s / real_of_int m)/2 = ?N ?st / real_of_int (2*n*m)"
1.3910 @@ -4979,8 +4979,8 @@
1.3911    have Pst2: "Ifm (Inum (x # bs) (Add (Mul m t) (Mul n s)) / real_of_int (2 * n * m) # bs) p" by simp
1.3912    with \<upsilon>_I[OF lp mnp stnb, where x="x" and bs="bs"] tnU smU show ?lhs by blast
1.3913  qed
1.3914 -
1.3915 -lemma ferrack01:
1.3916 +
1.3917 +lemma ferrack01:
1.3918    assumes qf: "qfree p"
1.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> _")
1.3920  proof-
1.3921 @@ -4998,17 +4998,17 @@
1.3922    let ?h = "\<lambda> ((t,n),(s,m)). (?N t/real_of_int n + ?N s/ real_of_int m) /2"
1.3923    let ?F = "\<lambda> p. \<exists> a \<in> set (\<Upsilon> p). \<exists> b \<in> set (\<Upsilon> p). ?I x (\<upsilon> p (?g(a,b)))"
1.3924    let ?ep = "evaldjf (\<upsilon> ?q) ?Y"
1.3925 -  from rlfm_l[OF qf] have lq: "isrlfm ?q"
1.3926 +  from rlfm_l[OF qf] have lq: "isrlfm ?q"
1.3927      by (simp add: rsplit_def lt_def ge_def conj_def disj_def Let_def reducecoeff_def numgcd_def)
1.3928    from alluopairs_set1[where xs="?U"] have UpU: "set ?Up \<le> (set ?U \<times> set ?U)" by simp
1.3929    from \<Upsilon>_l[OF lq] have U_l: "\<forall> (t,n) \<in> set ?U. numbound0 t \<and> n > 0" .
1.3930 -  from U_l UpU
1.3931 +  from U_l UpU
1.3932    have "\<forall> ((t,n),(s,m)) \<in> set ?Up. numbound0 t \<and> n> 0 \<and> numbound0 s \<and> m > 0" by auto
1.3933    hence Snb: "\<forall> (t,n) \<in> set ?S. numbound0 t \<and> n > 0 "
1.3934      by (auto)
1.3935 -  have Y_l: "\<forall> (t,n) \<in> set ?Y. numbound0 t \<and> n > 0"
1.3936 +  have Y_l: "\<forall> (t,n) \<in> set ?Y. numbound0 t \<and> n > 0"
1.3937    proof-
1.3938 -    { fix t n assume tnY: "(t,n) \<in> set ?Y"
1.3939 +    { fix t n assume tnY: "(t,n) \<in> set ?Y"
1.3940        hence "(t,n) \<in> set ?SS" by simp
1.3941        hence "\<exists> (t',n') \<in> set ?S. simp_num_pair (t',n') = (t,n)"
1.3942          by (auto simp add: split_def simp del: map_map)
1.3943 @@ -5022,12 +5022,12 @@
1.3944
1.3945    have YU: "(?f ` set ?Y) = (?h ` (set ?U \<times> set ?U))"
1.3946    proof-
1.3947 -     from simp_num_pair_ci[where bs="x#bs"] have
1.3948 +     from simp_num_pair_ci[where bs="x#bs"] have
1.3949      "\<forall>x. (?f o simp_num_pair) x = ?f x" by auto
1.3950       hence th: "?f o simp_num_pair = ?f" using ext by blast
1.3951      have "(?f ` set ?Y) = ((?f o simp_num_pair) ` set ?S)" by (simp add: image_comp comp_assoc)
1.3952      also have "\<dots> = (?f ` set ?S)" by (simp add: th)
1.3953 -    also have "\<dots> = ((?f o ?g) ` set ?Up)"
1.3954 +    also have "\<dots> = ((?f o ?g) ` set ?Up)"
1.3955        by (simp only: set_map o_def image_comp)
1.3956      also have "\<dots> = (?h ` (set ?U \<times> set ?U))"
1.3957        using \<Upsilon>_cong_aux[OF U_l, where x="x" and bs="bs", simplified set_map image_comp] by blast
1.3958 @@ -5047,8 +5047,8 @@
1.3959    from fr_eq_01[OF qf, where bs="bs" and x="x"] have "?lhs = ?F ?q"
1.3960      by (simp only: split_def fst_conv snd_conv)
1.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]
1.3962 -    by (simp only: split_def fst_conv snd_conv)
1.3963 -  also have "\<dots> = (Ifm (x#bs) ?ep)"
1.3964 +    by (simp only: split_def fst_conv snd_conv)
1.3965 +  also have "\<dots> = (Ifm (x#bs) ?ep)"
1.3966      using evaldjf_ex[where ps="?Y" and bs = "x#bs" and f="\<upsilon> ?q",symmetric]
1.3967      by (simp only: split_def prod.collapse)
1.3968    also have "\<dots> = (Ifm bs (decr ?ep))" using decr[OF ep_nb] by blast
1.3969 @@ -5057,7 +5057,7 @@
1.3970    with lr show ?thesis by blast
1.3971  qed
1.3972
1.3973 -lemma cp_thm':
1.3974 +lemma cp_thm':
1.3975    assumes lp: "iszlfm p (real_of_int (i::int)#bs)"
1.3976    and up: "d_\<beta> p 1" and dd: "d_\<delta> p d" and dp: "d > 0"
1.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))"
1.3978 @@ -5070,12 +5070,12 @@
1.3979
1.3980  lemma unit: assumes qf: "qfree p"
1.3981    shows "\<And> q B d. unit p = (q,B,d) \<Longrightarrow>
1.3982 -      ((\<exists> (x::int). Ifm (real_of_int x#bs) p) =
1.3983 -       (\<exists> (x::int). Ifm (real_of_int x#bs) q)) \<and>
1.3984 -       (Inum (real_of_int i#bs)) ` set B = (Inum (real_of_int i#bs)) ` set (\<beta> q) \<and>
1.3985 +      ((\<exists> (x::int). Ifm (real_of_int x#bs) p) =
1.3986 +       (\<exists> (x::int). Ifm (real_of_int x#bs) q)) \<and>
1.3987 +       (Inum (real_of_int i#bs)) ` set B = (Inum (real_of_int i#bs)) ` set (\<beta> q) \<and>
1.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)"
1.3989  proof-
1.3990 -  fix q B d
1.3991 +  fix q B d
1.3992    assume qBd: "unit p = (q,B,d)"
1.3993    let ?thes = "((\<exists> (x::int). Ifm (real_of_int x#bs) p) = (\<exists> (x::int). Ifm (real_of_int x#bs) q)) \<and>
1.3994      Inum (real_of_int i#bs) ` set B = Inum (real_of_int i#bs) ` set (\<beta> q) \<and>
1.3995 @@ -5089,22 +5089,22 @@
1.3996    let ?B'= "remdups (map simpnum (\<beta> ?q))"
1.3997    let ?A = "set (\<alpha> ?q)"
1.3998    let ?A'= "remdups (map simpnum (\<alpha> ?q))"
1.3999 -  from conjunct1[OF zlfm_I[OF qf, where bs="bs"]]
1.4000 +  from conjunct1[OF zlfm_I[OF qf, where bs="bs"]]
1.4001    have pp': "\<forall> i. ?I i ?p' = ?I i p" by auto
1.4002    from iszlfm_gen[OF conjunct2[OF zlfm_I[OF qf, where bs="bs" and i="i"]]]
1.4003 -  have lp': "\<forall> (i::int). iszlfm ?p' (real_of_int i#bs)" by simp
1.4004 +  have lp': "\<forall> (i::int). iszlfm ?p' (real_of_int i#bs)" by simp
1.4005    hence lp'': "iszlfm ?p' (real_of_int (i::int)#bs)" by simp
1.4006    from lp' \<zeta>[where p="?p'" and bs="bs"] have lp: "?l >0" and dl: "d_\<beta> ?p' ?l" by auto
1.4007    from a_\<beta>_ex[where p="?p'" and l="?l" and bs="bs", OF lp'' dl lp] pp'
1.4008 -  have pq_ex:"(\<exists> (x::int). ?I x p) = (\<exists> x. ?I x ?q)" by (simp add: int_rdvd_iff)
1.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"
1.4010 +  have pq_ex:"(\<exists> (x::int). ?I x p) = (\<exists> x. ?I x ?q)" by (simp add: int_rdvd_iff)
1.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"
1.4012      by (auto simp add: isint_def)
1.4013    from \<delta>[OF lq] have dp:"?d >0" and dd: "d_\<delta> ?q ?d" by blast+
1.4014    let ?N = "\<lambda> t. Inum (real_of_int (i::int)#bs) t"
1.4015 -  have "?N ` set ?B' = ((?N o simpnum) ` ?B)" by (simp add:image_comp)
1.4016 +  have "?N ` set ?B' = ((?N o simpnum) ` ?B)" by (simp add:image_comp)
1.4017    also have "\<dots> = ?N ` ?B" using simpnum_ci[where bs="real_of_int i #bs"] by auto
1.4018    finally have BB': "?N ` set ?B' = ?N ` ?B" .
1.4019 -  have "?N ` set ?A' = ((?N o simpnum) ` ?A)" by (simp add:image_comp)
1.4020 +  have "?N ` set ?A' = ((?N o simpnum) ` ?A)" by (simp add:image_comp)
1.4021    also have "\<dots> = ?N ` ?A" using simpnum_ci[where bs="real_of_int i #bs"] by auto
1.4022    finally have AA': "?N ` set ?A' = ?N ` ?A" .
1.4023    from \<beta>_numbound0[OF lq] have B_nb:"\<forall> b\<in> set ?B'. numbound0 b"
1.4024 @@ -5114,16 +5114,16 @@
1.4025    { assume "length ?B' \<le> length ?A'"
1.4026      hence q:"q=?q" and "B = ?B'" and d:"d = ?d"
1.4027        using qBd by (auto simp add: Let_def unit_def)
1.4028 -    with BB' B_nb have b: "?N ` (set B) = ?N ` set (\<beta> q)"
1.4029 +    with BB' B_nb have b: "?N ` (set B) = ?N ` set (\<beta> q)"
1.4030        and bn: "\<forall>b\<in> set B. numbound0 b" by simp+
1.4031      with pq_ex dp uq dd lq q d have ?thes by simp }
1.4032 -  moreover
1.4033 +  moreover
1.4034    { assume "\<not> (length ?B' \<le> length ?A')"
1.4035      hence q:"q=mirror ?q" and "B = ?A'" and d:"d = ?d"
1.4036        using qBd by (auto simp add: Let_def unit_def)
1.4037 -    with AA' mirror_\<alpha>_\<beta>[OF lq] A_nb have b:"?N ` (set B) = ?N ` set (\<beta> q)"
1.4038 +    with AA' mirror_\<alpha>_\<beta>[OF lq] A_nb have b:"?N ` (set B) = ?N ` set (\<beta> q)"
1.4039        and bn: "\<forall>b\<in> set B. numbound0 b" by simp+
1.4040 -    from mirror_ex[OF lq] pq_ex q
1.4041 +    from mirror_ex[OF lq] pq_ex q
1.4042      have pqm_eq:"(\<exists> (x::int). ?I x p) = (\<exists> (x::int). ?I x q)" by simp
1.4043      from lq uq q mirror_d_\<beta> [where p="?q" and bs="bs" and a="real_of_int i"]
1.4044      have lq': "iszlfm q (real_of_int i#bs)" and uq: "d_\<beta> q 1" by auto
1.4045 @@ -5135,17 +5135,17 @@
1.4046      (* Cooper's Algorithm *)
1.4047
1.4048  definition cooper :: "fm \<Rightarrow> fm" where
1.4049 -  "cooper p \<equiv>
1.4050 +  "cooper p \<equiv>
1.4051    (let (q,B,d) = unit p; js = [1..d];
1.4052         mq = simpfm (minusinf q);
1.4053         md = evaldjf (\<lambda> j. simpfm (subst0 (C j) mq)) js
1.4054     in if md = T then T else
1.4055 -    (let qd = evaldjf (\<lambda> t. simpfm (subst0 t q))
1.4056 -                               (remdups (map (\<lambda> (b,j). simpnum (Add b (C j)))
1.4057 +    (let qd = evaldjf (\<lambda> t. simpfm (subst0 t q))
1.4058 +                               (remdups (map (\<lambda> (b,j). simpnum (Add b (C j)))
1.4059                                              [(b,j). b\<leftarrow>B,j\<leftarrow>js]))
1.4060       in decr (disj md qd)))"
1.4061  lemma cooper: assumes qf: "qfree p"
1.4062 -  shows "((\<exists> (x::int). Ifm (real_of_int x#bs) p) = (Ifm bs (cooper p))) \<and> qfree (cooper p)"
1.4063 +  shows "((\<exists> (x::int). Ifm (real_of_int x#bs) p) = (Ifm bs (cooper p))) \<and> qfree (cooper p)"
1.4064    (is "(?lhs = ?rhs) \<and> _")
1.4065  proof-
1.4066
1.4067 @@ -5163,65 +5163,65 @@
1.4068    let ?sbjs = "map (\<lambda> (b,j). simpnum (Add b (C j))) ?bjs"
1.4069    let ?qd = "evaldjf (\<lambda> t. simpfm (subst0 t ?q)) (remdups ?sbjs)"
1.4070    have qbf:"unit p = (?q,?B,?d)" by simp
1.4071 -  from unit[OF qf qbf] have pq_ex: "(\<exists>(x::int). ?I x p) = (\<exists> (x::int). ?I x ?q)" and
1.4072 -    B:"?N ` set ?B = ?N ` set (\<beta> ?q)" and
1.4073 -    uq:"d_\<beta> ?q 1" and dd: "d_\<delta> ?q ?d" and dp: "?d > 0" and
1.4074 -    lq: "iszlfm ?q (real_of_int i#bs)" and
1.4075 +  from unit[OF qf qbf] have pq_ex: "(\<exists>(x::int). ?I x p) = (\<exists> (x::int). ?I x ?q)" and
1.4076 +    B:"?N ` set ?B = ?N ` set (\<beta> ?q)" and
1.4077 +    uq:"d_\<beta> ?q 1" and dd: "d_\<delta> ?q ?d" and dp: "?d > 0" and
1.4078 +    lq: "iszlfm ?q (real_of_int i#bs)" and
1.4079      Bn: "\<forall> b\<in> set ?B. numbound0 b" by auto
1.4080    from zlin_qfree[OF lq] have qfq: "qfree ?q" .
1.4081    from simpfm_qf[OF minusinf_qfree[OF qfq]] have qfmq: "qfree ?smq".
1.4082    have jsnb: "\<forall> j \<in> set ?js. numbound0 (C j)" by simp
1.4083 -  hence "\<forall> j\<in> set ?js. bound0 (subst0 (C j) ?smq)"
1.4084 +  hence "\<forall> j\<in> set ?js. bound0 (subst0 (C j) ?smq)"
1.4085      by (auto simp only: subst0_bound0[OF qfmq])
1.4086    hence th: "\<forall> j\<in> set ?js. bound0 (simpfm (subst0 (C j) ?smq))"
1.4087      by auto
1.4088 -  from evaldjf_bound0[OF th] have mdb: "bound0 ?md" by simp
1.4089 +  from evaldjf_bound0[OF th] have mdb: "bound0 ?md" by simp
1.4090    from Bn jsnb have "\<forall> (b,j) \<in> set ?bjs. numbound0 (Add b (C j))"
1.4091      by simp
1.4092    hence "\<forall> (b,j) \<in> set ?bjs. numbound0 (simpnum (Add b (C j)))"
1.4093      using simpnum_numbound0 by blast
1.4094    hence "\<forall> t \<in> set ?sbjs. numbound0 t" by simp
1.4095    hence "\<forall> t \<in> set (remdups ?sbjs). bound0 (subst0 t ?q)"
1.4096 -    using subst0_bound0[OF qfq] by auto
1.4097 +    using subst0_bound0[OF qfq] by auto
1.4098    hence th': "\<forall> t \<in> set (remdups ?sbjs). bound0 (simpfm (subst0 t ?q))"
1.4099      using simpfm_bound0 by blast
1.4100    from evaldjf_bound0 [OF th'] have qdb: "bound0 ?qd" by simp
1.4101 -  from mdb qdb
1.4102 +  from mdb qdb
1.4103    have mdqdb: "bound0 (disj ?md ?qd)" by (simp only: disj_def, cases "?md=T \<or> ?qd=T", simp_all)
1.4104    from trans [OF pq_ex cp_thm'[OF lq uq dd dp]] B
1.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
1.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
1.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
1.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)
1.4109 -  also  have "\<dots>= ((\<exists> j\<in> set ?js. ?I j ?smq) \<or> (\<exists> t \<in> set ?sbjs. Ifm (?N t #bs) ?q))"
1.4110 -    by (auto simp add: split_def)
1.4111 +  also  have "\<dots>= ((\<exists> j\<in> set ?js. ?I j ?smq) \<or> (\<exists> t \<in> set ?sbjs. Ifm (?N t #bs) ?q))"
1.4112 +    by (auto simp add: split_def)
1.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))"
1.4114      by (simp only: simpfm subst0_I[OF qfq] Inum.simps subst0_I[OF qfmq] set_remdups)
1.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)
1.4116    finally have mdqd: "?lhs = (?I i (disj ?md ?qd))" by simp
1.4117    hence mdqd2: "?lhs = (Ifm bs (decr (disj ?md ?qd)))" using decr [OF mdqdb] by simp
1.4118    {assume mdT: "?md = T"
1.4119 -    hence cT:"cooper p = T"
1.4120 +    hence cT:"cooper p = T"
1.4121        by (simp only: cooper_def unit_def split_def Let_def if_True) simp
1.4122      from mdT mdqd have lhs:"?lhs" by auto
1.4123      from mdT have "?rhs" by (simp add: cooper_def unit_def split_def)
1.4124      with lhs cT have ?thesis by simp }
1.4125    moreover
1.4126 -  {assume mdT: "?md \<noteq> T" hence "cooper p = decr (disj ?md ?qd)"
1.4127 -      by (simp only: cooper_def unit_def split_def Let_def if_False)
1.4128 +  {assume mdT: "?md \<noteq> T" hence "cooper p = decr (disj ?md ?qd)"
1.4129 +      by (simp only: cooper_def unit_def split_def Let_def if_False)
1.4130      with mdqd2 decr_qf[OF mdqdb] have ?thesis by simp }
1.4131    ultimately show ?thesis by blast
1.4132  qed
1.4133
1.4134 -lemma DJcooper:
1.4135 +lemma DJcooper:
1.4136    assumes qf: "qfree p"
1.4137    shows "((\<exists> (x::int). Ifm (real_of_int x#bs) p) = (Ifm bs (DJ cooper p))) \<and> qfree (DJ cooper p)"
1.4138  proof-
1.4139    from cooper have cqf: "\<forall> p. qfree p \<longrightarrow> qfree (cooper p)" by  blast
1.4140    from DJ_qf[OF cqf] qf have thqf:"qfree (DJ cooper p)" by blast
1.4141 -  have "Ifm bs (DJ cooper p) = (\<exists> q\<in> set (disjuncts p). Ifm bs (cooper q))"
1.4142 +  have "Ifm bs (DJ cooper p) = (\<exists> q\<in> set (disjuncts p). Ifm bs (cooper q))"
1.4143       by (simp add: DJ_def evaldjf_ex)
1.4144 -  also have "\<dots> = (\<exists> q \<in> set(disjuncts p). \<exists> (x::int). Ifm (real_of_int x#bs)  q)"
1.4145 +  also have "\<dots> = (\<exists> q \<in> set(disjuncts p). \<exists> (x::int). Ifm (real_of_int x#bs)  q)"
1.4146      using cooper disjuncts_qf[OF qf] by blast
1.4147    also have "\<dots> = (\<exists> (x::int). Ifm (real_of_int x#bs) p)" by (induct p rule: disjuncts.induct, auto)
1.4148    finally show ?thesis using thqf by blast
1.4149 @@ -5231,20 +5231,20 @@
1.4150
1.4151  lemma \<sigma>_\<rho>_cong: assumes lp: "iszlfm p (a#bs)" and tt': "Inum (a#bs) t = Inum (a#bs) t'"
1.4152    shows "Ifm (a#bs) (\<sigma>_\<rho> p (t,c)) = Ifm (a#bs) (\<sigma>_\<rho> p (t',c))"
1.4153 -  using lp
1.4154 +  using lp
1.4155    by (induct p rule: iszlfm.induct, auto simp add: tt')
1.4156
1.4157  lemma \<sigma>_cong: assumes lp: "iszlfm p (a#bs)" and tt': "Inum (a#bs) t = Inum (a#bs) t'"
1.4158    shows "Ifm (a#bs) (\<sigma> p c t) = Ifm (a#bs) (\<sigma> p c t')"
1.4159    by (simp add: \<sigma>_def tt' \<sigma>_\<rho>_cong[OF lp tt'])
1.4160
1.4161 -lemma \<rho>_cong: assumes lp: "iszlfm p (a#bs)"
1.4162 +lemma \<rho>_cong: assumes lp: "iszlfm p (a#bs)"
1.4163    and RR: "(\<lambda>(b,k). (Inum (a#bs) b,k)) ` R =  (\<lambda>(b,k). (Inum (a#bs) b,k)) ` set (\<rho> p)"
1.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))))"
1.4165    (is "?lhs = ?rhs")
1.4166  proof
1.4167    let ?d = "\<delta> p"
1.4168 -  assume ?lhs then obtain e c j where ecR: "(e,c) \<in> R" and jD:"j \<in> {1 .. c*?d}"
1.4169 +  assume ?lhs then obtain e c j where ecR: "(e,c) \<in> R" and jD:"j \<in> {1 .. c*?d}"
1.4170      and px: "Ifm (a#bs) (\<sigma> p c (Add e (C j)))" (is "?sp c e j") by blast
1.4171    from ecR have "(Inum (a#bs) e,c) \<in> (\<lambda>(b,k). (Inum (a#bs) b,k)) ` R" by auto
1.4172    hence "(Inum (a#bs) e,c) \<in> (\<lambda>(b,k). (Inum (a#bs) b,k)) ` set (\<rho> p)" using RR by simp
1.4173 @@ -5252,14 +5252,14 @@
1.4174    then obtain e' c' where ecRo:"(e',c') \<in> set (\<rho> p)" and ee':"Inum (a#bs) e = Inum (a#bs) e'"
1.4175      and cc':"c = c'" by blast
1.4176    from ee' have tt': "Inum (a#bs) (Add e (C j)) = Inum (a#bs) (Add e' (C j))" by simp
1.4177 -
1.4178 +
1.4179    from \<sigma>_cong[OF lp tt', where c="c"] px have px':"?sp c e' j" by simp
1.4180    from ecRo jD px' show ?rhs apply (auto simp: cc')
1.4181      by (rule_tac x="(e', c')" in bexI,simp_all)
1.4182    (rule_tac x="j" in bexI, simp_all add: cc'[symmetric])
1.4183  next
1.4184    let ?d = "\<delta> p"
1.4185 -  assume ?rhs then obtain e c j where ecR: "(e,c) \<in> set (\<rho> p)" and jD:"j \<in> {1 .. c*?d}"
1.4186 +  assume ?rhs then obtain e c j where ecR: "(e,c) \<in> set (\<rho> p)" and jD:"j \<in> {1 .. c*?d}"
1.4187      and px: "Ifm (a#bs) (\<sigma> p c (Add e (C j)))" (is "?sp c e j") by blast
1.4188    from ecR have "(Inum (a#bs) e,c) \<in> (\<lambda>(b,k). (Inum (a#bs) b,k)) ` set (\<rho> p)" by auto
1.4189    hence "(Inum (a#bs) e,c) \<in> (\<lambda>(b,k). (Inum (a#bs) b,k)) ` R" using RR by simp
1.4190 @@ -5273,30 +5273,30 @@
1.4191    (rule_tac x="j" in bexI, simp_all add: cc'[symmetric])
1.4192  qed
1.4193
1.4194 -lemma rl_thm':
1.4195 -  assumes lp: "iszlfm p (real_of_int (i::int)#bs)"
1.4196 +lemma rl_thm':
1.4197 +  assumes lp: "iszlfm p (real_of_int (i::int)#bs)"
1.4198    and R: "(\<lambda>(b,k). (Inum (a#bs) b,k)) ` R =  (\<lambda>(b,k). (Inum (a#bs) b,k)) ` set (\<rho> p)"
1.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)))))"
1.4200 -  using rl_thm[OF lp] \<rho>_cong[OF iszlfm_gen[OF lp, rule_format, where y="a"] R] by simp
1.4201 +  using rl_thm[OF lp] \<rho>_cong[OF iszlfm_gen[OF lp, rule_format, where y="a"] R] by simp
1.4202
1.4203  definition chooset :: "fm \<Rightarrow> fm \<times> ((num\<times>int) list) \<times> int" where
1.4204    "chooset p \<equiv> (let q = zlfm p ; d = \<delta> q;
1.4205 -             B = remdups (map (\<lambda> (t,k). (simpnum t,k)) (\<rho> q)) ;
1.4206 +             B = remdups (map (\<lambda> (t,k). (simpnum t,k)) (\<rho> q)) ;
1.4207               a = remdups (map (\<lambda> (t,k). (simpnum t,k)) (\<alpha>_\<rho> q))
1.4208               in if length B \<le> length a then (q,B,d) else (mirror q, a,d))"
1.4209
1.4210  lemma chooset: assumes qf: "qfree p"
1.4211 -  shows "\<And> q B d. chooset p = (q,B,d) \<Longrightarrow>
1.4212 -     ((\<exists> (x::int). Ifm (real_of_int x#bs) p) =
1.4213 -      (\<exists> (x::int). Ifm (real_of_int x#bs) q)) \<and>
1.4214 +  shows "\<And> q B d. chooset p = (q,B,d) \<Longrightarrow>
1.4215 +     ((\<exists> (x::int). Ifm (real_of_int x#bs) p) =
1.4216 +      (\<exists> (x::int). Ifm (real_of_int x#bs) q)) \<and>
1.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>
1.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)"
1.4219  proof-
1.4220 -  fix q B d
1.4221 +  fix q B d
1.4222    assume qBd: "chooset p = (q,B,d)"
1.4223 -  let ?thes = "((\<exists> (x::int). Ifm (real_of_int x#bs) p) =
1.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>
1.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)"
1.4226 +  let ?thes = "((\<exists> (x::int). Ifm (real_of_int x#bs) p) =
1.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>
1.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)"
1.4229    let ?I = "\<lambda> (x::int) p. Ifm (real_of_int x#bs) p"
1.4230    let ?q = "zlfm p"
1.4231    let ?d = "\<delta> ?q"
1.4232 @@ -5305,20 +5305,20 @@
1.4233    let ?B'= "remdups (map ?f (\<rho> ?q))"
1.4234    let ?A = "set (\<alpha>_\<rho> ?q)"
1.4235    let ?A'= "remdups (map ?f (\<alpha>_\<rho> ?q))"
1.4236 -  from conjunct1[OF zlfm_I[OF qf, where bs="bs"]]
1.4237 +  from conjunct1[OF zlfm_I[OF qf, where bs="bs"]]
1.4238    have pp': "\<forall> i. ?I i ?q = ?I i p" by auto
1.4239 -  hence pq_ex:"(\<exists> (x::int). ?I x p) = (\<exists> x. ?I x ?q)" by simp
1.4240 +  hence pq_ex:"(\<exists> (x::int). ?I x p) = (\<exists> x. ?I x ?q)" by simp
1.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"]
1.4242 -  have lq: "iszlfm ?q (real_of_int (i::int)#bs)" .
1.4243 +  have lq: "iszlfm ?q (real_of_int (i::int)#bs)" .
1.4244    from \<delta>[OF lq] have dp:"?d >0" by blast
1.4245    let ?N = "\<lambda> (t,c). (Inum (real_of_int (i::int)#bs) t,c)"
1.4246    have "?N ` set ?B' = ((?N o ?f) ` ?B)" by (simp add: split_def image_comp)
1.4247    also have "\<dots> = ?N ` ?B"
1.4248      by(simp add: split_def image_comp simpnum_ci[where bs="real_of_int i #bs"] image_def)
1.4249    finally have BB': "?N ` set ?B' = ?N ` ?B" .
1.4250 -  have "?N ` set ?A' = ((?N o ?f) ` ?A)" by (simp add: split_def image_comp)
1.4251 +  have "?N ` set ?A' = ((?N o ?f) ` ?A)" by (simp add: split_def image_comp)
1.4252    also have "\<dots> = ?N ` ?A" using simpnum_ci[where bs="real_of_int i #bs"]
1.4253 -    by(simp add: split_def image_comp simpnum_ci[where bs="real_of_int i #bs"] image_def)
1.4254 +    by(simp add: split_def image_comp simpnum_ci[where bs="real_of_int i #bs"] image_def)
1.4255    finally have AA': "?N ` set ?A' = ?N ` ?A" .
1.4256    from \<rho>_l[OF lq] have B_nb:"\<forall> (e,c)\<in> set ?B'. numbound0 e \<and> c > 0"
1.4258 @@ -5327,16 +5327,16 @@
1.4259      {assume "length ?B' \<le> length ?A'"
1.4260      hence q:"q=?q" and "B = ?B'" and d:"d = ?d"
1.4261        using qBd by (auto simp add: Let_def chooset_def)
1.4262 -    with BB' B_nb have b: "?N ` (set B) = ?N ` set (\<rho> q)"
1.4263 +    with BB' B_nb have b: "?N ` (set B) = ?N ` set (\<rho> q)"
1.4264        and bn: "\<forall>(e,c)\<in> set B. numbound0 e \<and> c > 0" by auto
1.4265    with pq_ex dp lq q d have ?thes by simp}
1.4266 -  moreover
1.4267 +  moreover
1.4268    {assume "\<not> (length ?B' \<le> length ?A')"
1.4269      hence q:"q=mirror ?q" and "B = ?A'" and d:"d = ?d"
1.4270        using qBd by (auto simp add: Let_def chooset_def)
1.4271 -    with AA' mirror_\<alpha>_\<rho>[OF lq] A_nb have b:"?N ` (set B) = ?N ` set (\<rho> q)"
1.4272 -      and bn: "\<forall>(e,c)\<in> set B. numbound0 e \<and> c > 0" by auto
1.4273 -    from mirror_ex[OF lq] pq_ex q
1.4274 +    with AA' mirror_\<alpha>_\<rho>[OF lq] A_nb have b:"?N ` (set B) = ?N ` set (\<rho> q)"
1.4275 +      and bn: "\<forall>(e,c)\<in> set B. numbound0 e \<and> c > 0" by auto
1.4276 +    from mirror_ex[OF lq] pq_ex q
1.4277      have pqm_eq:"(\<exists> (x::int). ?I x p) = (\<exists> (x::int). ?I x q)" by simp
1.4278      from lq q mirror_l [where p="?q" and bs="bs" and a="real_of_int i"]
1.4279      have lq': "iszlfm q (real_of_int i#bs)" by auto
1.4280 @@ -5366,7 +5366,7 @@
1.4281  qed
1.4282
1.4283  definition redlove :: "fm \<Rightarrow> fm" where
1.4284 -  "redlove p \<equiv>
1.4285 +  "redlove p \<equiv>
1.4286    (let (q,B,d) = chooset p;
1.4287         mq = simpfm (minusinf q);
1.4288         md = evaldjf (\<lambda> j. simpfm (subst0 (C j) mq)) [1..d]
1.4289 @@ -5375,7 +5375,7 @@
1.4290       in decr (disj md qd)))"
1.4291
1.4292  lemma redlove: assumes qf: "qfree p"
1.4293 -  shows "((\<exists> (x::int). Ifm (real_of_int x#bs) p) = (Ifm bs (redlove p))) \<and> qfree (redlove p)"
1.4294 +  shows "((\<exists> (x::int). Ifm (real_of_int x#bs) p) = (Ifm bs (redlove p))) \<and> qfree (redlove p)"
1.4295    (is "(?lhs = ?rhs) \<and> _")
1.4296  proof-
1.4297
1.4298 @@ -5391,53 +5391,53 @@
1.4299    let ?N = "\<lambda> (t,k). (Inum (real_of_int (i::int)#bs) t,k)"
1.4300    let ?qd = "evaldjf (stage ?q ?d) ?B"
1.4301    have qbf:"chooset p = (?q,?B,?d)" by simp
1.4302 -  from chooset[OF qf qbf] have pq_ex: "(\<exists>(x::int). ?I x p) = (\<exists> (x::int). ?I x ?q)" and
1.4303 -    B:"?N ` set ?B = ?N ` set (\<rho> ?q)" and dd: "\<delta> ?q = ?d" and dp: "?d > 0" and
1.4304 -    lq: "iszlfm ?q (real_of_int i#bs)" and
1.4305 +  from chooset[OF qf qbf] have pq_ex: "(\<exists>(x::int). ?I x p) = (\<exists> (x::int). ?I x ?q)" and
1.4306 +    B:"?N ` set ?B = ?N ` set (\<rho> ?q)" and dd: "\<delta> ?q = ?d" and dp: "?d > 0" and
1.4307 +    lq: "iszlfm ?q (real_of_int i#bs)" and
1.4308      Bn: "\<forall> (e,c)\<in> set ?B. numbound0 e \<and> c > 0" by auto
1.4309    from zlin_qfree[OF lq] have qfq: "qfree ?q" .
1.4310    from simpfm_qf[OF minusinf_qfree[OF qfq]] have qfmq: "qfree ?smq".
1.4311    have jsnb: "\<forall> j \<in> set ?js. numbound0 (C j)" by simp
1.4312 -  hence "\<forall> j\<in> set ?js. bound0 (subst0 (C j) ?smq)"
1.4313 +  hence "\<forall> j\<in> set ?js. bound0 (subst0 (C j) ?smq)"
1.4314      by (auto simp only: subst0_bound0[OF qfmq])
1.4315    hence th: "\<forall> j\<in> set ?js. bound0 (simpfm (subst0 (C j) ?smq))"
1.4316      by auto
1.4317 -  from evaldjf_bound0[OF th] have mdb: "bound0 ?md" by simp
1.4318 +  from evaldjf_bound0[OF th] have mdb: "bound0 ?md" by simp
1.4319    from Bn stage_nb[OF lq] have th:"\<forall> x \<in> set ?B. bound0 (stage ?q ?d x)" by auto
1.4320    from evaldjf_bound0[OF th]  have qdb: "bound0 ?qd" .
1.4321 -  from mdb qdb
1.4322 +  from mdb qdb
1.4323    have mdqdb: "bound0 (disj ?md ?qd)" by (simp only: disj_def, cases "?md=T \<or> ?qd=T", simp_all)
1.4324    from trans [OF pq_ex rl_thm'[OF lq B]] dd
1.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
1.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) )))"
1.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) )))"
1.4328      by (simp add: stage split_def)
1.4329    also have "\<dots> = ((\<exists> j\<in> {1 .. ?d}. ?I i (subst0 (C j) ?smq))  \<or> ?I i ?qd)"
1.4330      by (simp add: evaldjf_ex subst0_I[OF qfmq])
1.4331 -  finally have mdqd:"?lhs = (?I i ?md \<or> ?I i ?qd)" by (simp only: evaldjf_ex set_upto simpfm)
1.4332 +  finally have mdqd:"?lhs = (?I i ?md \<or> ?I i ?qd)" by (simp only: evaldjf_ex set_upto simpfm)
1.4333    also have "\<dots> = (?I i (disj ?md ?qd))" by simp
1.4334 -  also have "\<dots> = (Ifm bs (decr (disj ?md ?qd)))" by (simp only: decr [OF mdqdb])
1.4335 -  finally have mdqd2: "?lhs = (Ifm bs (decr (disj ?md ?qd)))" .
1.4336 +  also have "\<dots> = (Ifm bs (decr (disj ?md ?qd)))" by (simp only: decr [OF mdqdb])
1.4337 +  finally have mdqd2: "?lhs = (Ifm bs (decr (disj ?md ?qd)))" .
1.4338    {assume mdT: "?md = T"
1.4339      hence cT:"redlove p = T" by (simp add: redlove_def Let_def chooset_def split_def)
1.4340 -    from mdT have lhs:"?lhs" using mdqd by simp
1.4341 +    from mdT have lhs:"?lhs" using mdqd by simp
1.4342      from mdT have "?rhs" by (simp add: redlove_def chooset_def split_def)
1.4343      with lhs cT have ?thesis by simp }
1.4344    moreover
1.4345 -  {assume mdT: "?md \<noteq> T" hence "redlove p = decr (disj ?md ?qd)"
1.4346 +  {assume mdT: "?md \<noteq> T" hence "redlove p = decr (disj ?md ?qd)"
1.4347        by (simp add: redlove_def chooset_def split_def Let_def)
1.4348      with mdqd2 decr_qf[OF mdqdb] have ?thesis by simp }
1.4349    ultimately show ?thesis by blast
1.4350  qed
1.4351
1.4352 -lemma DJredlove:
1.4353 +lemma DJredlove:
1.4354    assumes qf: "qfree p"
1.4355    shows "((\<exists> (x::int). Ifm (real_of_int x#bs) p) = (Ifm bs (DJ redlove p))) \<and> qfree (DJ redlove p)"
1.4356  proof-
1.4357    from redlove have cqf: "\<forall> p. qfree p \<longrightarrow> qfree (redlove p)" by  blast
1.4358    from DJ_qf[OF cqf] qf have thqf:"qfree (DJ redlove p)" by blast
1.4359 -  have "Ifm bs (DJ redlove p) = (\<exists> q\<in> set (disjuncts p). Ifm bs (redlove q))"
1.4360 +  have "Ifm bs (DJ redlove p) = (\<exists> q\<in> set (disjuncts p). Ifm bs (redlove q))"
1.4361       by (simp add: DJ_def evaldjf_ex)
1.4362 -  also have "\<dots> = (\<exists> q \<in> set(disjuncts p). \<exists> (x::int). Ifm (real_of_int x#bs)  q)"
1.4363 +  also have "\<dots> = (\<exists> q \<in> set(disjuncts p). \<exists> (x::int). Ifm (real_of_int x#bs)  q)"
1.4364      using redlove disjuncts_qf[OF qf] by blast
1.4365    also have "\<dots> = (\<exists> (x::int). Ifm (real_of_int x#bs) p)" by (induct p rule: disjuncts.induct, auto)
1.4366    finally show ?thesis using thqf by blast
1.4367 @@ -5461,13 +5461,13 @@
1.4368    show "qfree (mircfr p)\<and>(Ifm bs (mircfr p) = Ifm bs (E p))" (is "_ \<and> (?lhs = ?rhs)")
1.4369    proof-
1.4370      let ?es = "(And (And (Ge (CN 0 1 (C 0))) (Lt (CN 0 1 (C (- 1))))) (simpfm (exsplit p)))"
1.4371 -    have "?rhs = (\<exists> (i::int). \<exists> x. Ifm (x#real_of_int i#bs) ?es)"
1.4372 +    have "?rhs = (\<exists> (i::int). \<exists> x. Ifm (x#real_of_int i#bs) ?es)"
1.4373        using splitex[OF qf] by simp
1.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+
1.4375      with DJcooper[OF qf'] show ?thesis by (simp add: mircfr_def)
1.4376    qed
1.4377  qed
1.4378 -
1.4379 +
1.4380  lemma mirlfr: "\<forall> bs p. qfree p \<longrightarrow> qfree(mirlfr p) \<and> Ifm bs (mirlfr p) = Ifm bs (E p)"
1.4381  proof(clarsimp simp del: Ifm.simps)
1.4382    fix bs p
1.4383 @@ -5475,13 +5475,13 @@
1.4384    show "qfree (mirlfr p)\<and>(Ifm bs (mirlfr p) = Ifm bs (E p))" (is "_ \<and> (?lhs = ?rhs)")
1.4385    proof-
1.4386      let ?es = "(And (And (Ge (CN 0 1 (C 0))) (Lt (CN 0 1 (C (- 1))))) (simpfm (exsplit p)))"
1.4387 -    have "?rhs = (\<exists> (i::int). \<exists> x. Ifm (x#real_of_int i#bs) ?es)"
1.4388 +    have "?rhs = (\<exists> (i::int). \<exists> x. Ifm (x#real_of_int i#bs) ?es)"
1.4389        using splitex[OF qf] by simp
1.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+
1.4391      with DJredlove[OF qf'] show ?thesis by (simp add: mirlfr_def)
1.4392    qed
1.4393  qed
1.4394 -
1.4395 +
1.4396  definition mircfrqe:: "fm \<Rightarrow> fm" where
1.4397    "mircfrqe p = qelim (prep p) mircfr"
1.4398
1.4399 @@ -5566,7 +5566,7 @@
1.4400    | fm_of_term vs (@{term "op \<le> :: real \<Rightarrow> real \<Rightarrow> bool"} \$ t1 \$ t2) =
1.4401        @{code Le} (@{code Sub} (num_of_term vs t1, num_of_term vs t2))
1.4402    | fm_of_term vs (@{term "op = :: real \<Rightarrow> real \<Rightarrow> bool"} \$ t1 \$ t2) =
1.4403 -      @{code Eq} (@{code Sub} (num_of_term vs t1, num_of_term vs t2))
1.4404 +      @{code Eq} (@{code Sub} (num_of_term vs t1, num_of_term vs t2))
1.4405    | fm_of_term vs (@{term "op rdvd"} \$ (@{term "of_int :: int \<Rightarrow> real"} \$ (@{term "numeral :: _ \<Rightarrow> int"} \$ t1)) \$ t2) =
1.4406        mk_Dvd (HOLogic.dest_num t1, num_of_term vs t2)
1.4407    | fm_of_term vs (@{term "op rdvd"} \$ (@{term "of_int :: int \<Rightarrow> real"} \$ (@{term "- numeral :: _ \<Rightarrow> int"} \$ t1)) \$ t2) =
1.4408 @@ -5606,7 +5606,7 @@
1.4409    | term_of_num vs (@{code CN} (n, i, t)) = term_of_num vs (@{code Add} (@{code Mul} (i, @{code Bound} n), t))
1.4410    | term_of_num vs (@{code CF} (c, t, s)) = term_of_num vs (@{code Add} (@{code Mul} (c, @{code Floor} t), s));
1.4411
1.4412 -fun term_of_fm vs @{code T} = @{term True}
1.4413 +fun term_of_fm vs @{code T} = @{term True}
1.4414    | term_of_fm vs @{code F} = @{term False}
1.4415    | term_of_fm vs (@{code Lt} t) =
1.4416        @{term "op < :: real \<Rightarrow> real \<Rightarrow> bool"} \$ term_of_num vs t \$ @{term "0::real"}
1.4417 @@ -5637,7 +5637,7 @@
1.4418
1.4419  in
1.4420    fn (ctxt, t) =>
1.4421 -  let
1.4422 +  let
1.4423      val fs = Misc_Legacy.term_frees t;
1.4424      val vs = map_index swap fs;
1.4425      (*If quick_and_dirty then run without proof generation as oracle*)
1.4426 @@ -5647,8 +5647,8 @@
1.4427  end;
1.4428  \<close>
1.4429
1.4430 -lemmas iff_real_of_int = of_int_eq_iff [where 'a = real, symmetric]
1.4431 -                         of_int_less_iff [where 'a = real, symmetric]
1.4432 +lemmas iff_real_of_int = of_int_eq_iff [where 'a = real, symmetric]
1.4433 +                         of_int_less_iff [where 'a = real, symmetric]
1.4434                           of_int_le_iff [where 'a = real, symmetric]
1.4435
1.4436  ML_file "mir_tac.ML"
1.4437 @@ -5665,7 +5665,7 @@
1.4438    by mir
1.4439
1.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>"
1.4441 -  by mir
1.4442 +  by mir
1.4443
1.4444  lemma "\<forall>x::real. \<exists>y \<le> x. (\<lfloor>x\<rfloor> = \<lceil>y\<rceil>)"
1.4445    by mir
```