author wenzelm Thu Mar 20 15:38:49 2014 +0100 (2014-03-20) changeset 56228 0f6dc7512023 parent 56225 00112abe9b25 child 56229 f61eaab6bec3
tuned proofs;
```     1.1 --- a/src/HOL/Library/Lattice_Algebras.thy	Thu Mar 20 12:43:48 2014 +0000
1.2 +++ b/src/HOL/Library/Lattice_Algebras.thy	Thu Mar 20 15:38:49 2014 +0100
1.3 @@ -18,9 +18,10 @@
1.4
1.5  lemma add_inf_distrib_right: "inf a b + c = inf (a + c) (b + c)"
1.6  proof -
1.7 -  have "c + inf a b = inf (c+a) (c+b)"
1.8 +  have "c + inf a b = inf (c + a) (c + b)"
1.11 +  then show ?thesis
1.13  qed
1.14
1.15  end
1.16 @@ -37,10 +38,12 @@
1.18    done
1.19
1.20 -lemma add_sup_distrib_right: "sup a b + c = sup (a+c) (b+c)"
1.21 +lemma add_sup_distrib_right: "sup a b + c = sup (a + c) (b + c)"
1.22  proof -
1.23 -  have "c + sup a b = sup (c+a) (c+b)" by (simp add: add_sup_distrib_left)
1.25 +  have "c + sup a b = sup (c+a) (c+b)"
1.27 +  then show ?thesis
1.29  qed
1.30
1.31  end
1.32 @@ -54,10 +57,10 @@
1.35
1.36 -lemma inf_eq_neg_sup: "inf a b = - sup (-a) (-b)"
1.37 +lemma inf_eq_neg_sup: "inf a b = - sup (- a) (- b)"
1.38  proof (rule inf_unique)
1.39    fix a b c :: 'a
1.40 -  show "- sup (-a) (-b) \<le> a"
1.41 +  show "- sup (- a) (- b) \<le> a"
1.42      by (rule add_le_imp_le_right [of _ "sup (uminus a) (uminus b)"])
1.44    show "- sup (-a) (-b) \<le> b"
1.45 @@ -68,26 +71,27 @@
1.46      by (subst neg_le_iff_le [symmetric]) (simp add: le_supI)
1.47  qed
1.48
1.49 -lemma sup_eq_neg_inf: "sup a b = - inf (-a) (-b)"
1.50 +lemma sup_eq_neg_inf: "sup a b = - inf (- a) (- b)"
1.51  proof (rule sup_unique)
1.52    fix a b c :: 'a
1.53 -  show "a \<le> - inf (-a) (-b)"
1.54 +  show "a \<le> - inf (- a) (- b)"
1.55      by (rule add_le_imp_le_right [of _ "inf (uminus a) (uminus b)"])
1.57 -  show "b \<le> - inf (-a) (-b)"
1.58 +  show "b \<le> - inf (- a) (- b)"
1.59      by (rule add_le_imp_le_right [of _ "inf (uminus a) (uminus b)"])
1.61    assume "a \<le> c" "b \<le> c"
1.62 -  then show "- inf (-a) (-b) \<le> c" by (subst neg_le_iff_le [symmetric]) (simp add: le_infI)
1.63 +  then show "- inf (- a) (- b) \<le> c"
1.64 +    by (subst neg_le_iff_le [symmetric]) (simp add: le_infI)
1.65  qed
1.66
1.67 -lemma neg_inf_eq_sup: "- inf a b = sup (-a) (-b)"
1.68 +lemma neg_inf_eq_sup: "- inf a b = sup (- a) (- b)"
1.70
1.71  lemma diff_inf_eq_sup: "a - inf b c = a + sup (- b) (- c)"
1.72    using neg_inf_eq_sup [of b c, symmetric] by simp
1.73
1.74 -lemma neg_sup_eq_inf: "- sup a b = inf (-a) (-b)"
1.75 +lemma neg_sup_eq_inf: "- sup a b = inf (- a) (- b)"
1.77
1.78  lemma diff_sup_eq_inf: "a - sup b c = a + inf (- b) (- c)"
1.79 @@ -95,13 +99,14 @@
1.80
1.81  lemma add_eq_inf_sup: "a + b = sup a b + inf a b"
1.82  proof -
1.83 -  have "0 = - inf 0 (a-b) + inf (a-b) 0"
1.84 +  have "0 = - inf 0 (a - b) + inf (a - b) 0"
1.86 -  hence "0 = sup 0 (b-a) + inf (a-b) 0"
1.87 +  then have "0 = sup 0 (b - a) + inf (a - b) 0"
1.89 -  hence "0 = (-a + sup a b) + (inf a b + (-b))"
1.90 +  then have "0 = (- a + sup a b) + (inf a b + (- b))"
1.92 -  then show ?thesis by (simp add: algebra_simps)
1.93 +  then show ?thesis
1.94 +    by (simp add: algebra_simps)
1.95  qed
1.96
1.97
1.98 @@ -115,10 +120,13 @@
1.99
1.100  lemma pprt_neg: "pprt (- x) = - nprt x"
1.101  proof -
1.102 -  have "sup (- x) 0 = sup (- x) (- 0)" unfolding minus_zero ..
1.103 -  also have "\<dots> = - inf x 0" unfolding neg_inf_eq_sup ..
1.104 +  have "sup (- x) 0 = sup (- x) (- 0)"
1.105 +    unfolding minus_zero ..
1.106 +  also have "\<dots> = - inf x 0"
1.107 +    unfolding neg_inf_eq_sup ..
1.108    finally have "sup (- x) 0 = - inf x 0" .
1.109 -  then show ?thesis unfolding pprt_def nprt_def .
1.110 +  then show ?thesis
1.111 +    unfolding pprt_def nprt_def .
1.112  qed
1.113
1.114  lemma nprt_neg: "nprt (- x) = - pprt x"
1.115 @@ -172,20 +180,26 @@
1.116  lemma sup_0_imp_0: "sup a (- a) = 0 \<Longrightarrow> a = 0"
1.117  proof -
1.118    {
1.119 -    fix a::'a
1.120 -    assume hyp: "sup a (-a) = 0"
1.121 -    hence "sup a (-a) + a = a" by (simp)
1.122 -    hence "sup (a+a) 0 = a" by (simp add: add_sup_distrib_right)
1.123 -    hence "sup (a+a) 0 <= a" by (simp)
1.124 -    hence "0 <= a" by (blast intro: order_trans inf_sup_ord)
1.125 +    fix a :: 'a
1.126 +    assume hyp: "sup a (- a) = 0"
1.127 +    then have "sup a (- a) + a = a"
1.128 +      by simp
1.129 +    then have "sup (a + a) 0 = a"
1.131 +    then have "sup (a + a) 0 \<le> a"
1.132 +      by simp
1.133 +    then have "0 \<le> a"
1.134 +      by (blast intro: order_trans inf_sup_ord)
1.135    }
1.136    note p = this
1.137    assume hyp:"sup a (-a) = 0"
1.138 -  hence hyp2:"sup (-a) (-(-a)) = 0" by (simp add: sup_commute)
1.139 -  from p[OF hyp] p[OF hyp2] show "a = 0" by simp
1.140 +  then have hyp2:"sup (-a) (-(-a)) = 0"
1.141 +    by (simp add: sup_commute)
1.142 +  from p[OF hyp] p[OF hyp2] show "a = 0"
1.143 +    by simp
1.144  qed
1.145
1.146 -lemma inf_0_imp_0: "inf a (-a) = 0 \<Longrightarrow> a = 0"
1.147 +lemma inf_0_imp_0: "inf a (- a) = 0 \<Longrightarrow> a = 0"
1.150    apply (erule sup_0_imp_0)
1.151 @@ -206,24 +220,32 @@
1.153    "0 \<le> a + a \<longleftrightarrow> 0 \<le> a"
1.154  proof
1.155 -  assume "0 <= a + a"
1.156 -  hence a:"inf (a+a) 0 = 0" by (simp add: inf_commute inf_absorb1)
1.157 -  have "(inf a 0)+(inf a 0) = inf (inf (a+a) 0) a" (is "?l=_")
1.158 +  assume "0 \<le> a + a"
1.159 +  then have a: "inf (a + a) 0 = 0"
1.160 +    by (simp add: inf_commute inf_absorb1)
1.161 +  have "inf a 0 + inf a 0 = inf (inf (a + a) 0) a"  (is "?l=_")
1.163 -  hence "?l = 0 + inf a 0" by (simp add: a, simp add: inf_commute)
1.164 -  hence "inf a 0 = 0" by (simp only: add_right_cancel)
1.165 -  then show "0 <= a" unfolding le_iff_inf by (simp add: inf_commute)
1.166 +  then have "?l = 0 + inf a 0"
1.168 +  then have "inf a 0 = 0"
1.169 +    by (simp only: add_right_cancel)
1.170 +  then show "0 \<le> a"
1.171 +    unfolding le_iff_inf by (simp add: inf_commute)
1.172  next
1.173 -  assume a: "0 <= a"
1.174 -  show "0 <= a + a" by (simp add: add_mono[OF a a, simplified])
1.175 +  assume a: "0 \<le> a"
1.176 +  show "0 \<le> a + a"
1.178  qed
1.179
1.180  lemma double_zero [simp]: "a + a = 0 \<longleftrightarrow> a = 0"
1.181  proof
1.182    assume assm: "a + a = 0"
1.183 -  then have "a + a + - a = - a" by simp
1.184 -  then have "a + (a + - a) = - a" by (simp only: add_assoc)
1.185 -  then have a: "- a = a" by simp
1.186 +  then have "a + a + - a = - a"
1.187 +    by simp
1.188 +  then have "a + (a + - a) = - a"
1.189 +    by (simp only: add_assoc)
1.190 +  then have a: "- a = a"
1.191 +    by simp
1.192    show "a = 0"
1.193      apply (rule antisym)
1.194      apply (unfold neg_le_iff_le [symmetric, of a])
1.195 @@ -236,7 +258,8 @@
1.196      done
1.197  next
1.198    assume "a = 0"
1.199 -  then show "a + a = 0" by simp
1.200 +  then show "a + a = 0"
1.201 +    by simp
1.202  qed
1.203
1.204  lemma zero_less_double_add_iff_zero_less_single_add [simp]: "0 < a + a \<longleftrightarrow> 0 < a"
1.205 @@ -261,19 +284,23 @@
1.207    "a + a \<le> 0 \<longleftrightarrow> a \<le> 0"
1.208  proof -
1.209 -  have "a + a \<le> 0 \<longleftrightarrow> 0 \<le> - (a + a)" by (subst le_minus_iff, simp)
1.210 +  have "a + a \<le> 0 \<longleftrightarrow> 0 \<le> - (a + a)"
1.211 +    by (subst le_minus_iff, simp)
1.212    moreover have "\<dots> \<longleftrightarrow> a \<le> 0"
1.214 -  ultimately show ?thesis by blast
1.215 +  ultimately show ?thesis
1.216 +    by blast
1.217  qed
1.218
1.220    "a + a < 0 \<longleftrightarrow> a < 0"
1.221  proof -
1.222 -  have "a + a < 0 \<longleftrightarrow> 0 < - (a + a)" by (subst less_minus_iff, simp)
1.223 +  have "a + a < 0 \<longleftrightarrow> 0 < - (a + a)"
1.224 +    by (subst less_minus_iff) simp
1.225    moreover have "\<dots> \<longleftrightarrow> a < 0"
1.227 -  ultimately show ?thesis by blast
1.228 +  ultimately show ?thesis
1.229 +    by blast
1.230  qed
1.231
1.232  declare neg_inf_eq_sup [simp] neg_sup_eq_inf [simp] diff_inf_eq_sup [simp] diff_sup_eq_inf [simp]
1.233 @@ -281,17 +308,19 @@
1.234  lemma le_minus_self_iff: "a \<le> - a \<longleftrightarrow> a \<le> 0"
1.235  proof -
1.236    from add_le_cancel_left [of "uminus a" "plus a a" zero]
1.237 -  have "(a <= -a) = (a+a <= 0)"
1.238 +  have "a \<le> - a \<longleftrightarrow> a + a \<le> 0"
1.240 -  thus ?thesis by simp
1.241 +  then show ?thesis
1.242 +    by simp
1.243  qed
1.244
1.245  lemma minus_le_self_iff: "- a \<le> a \<longleftrightarrow> 0 \<le> a"
1.246  proof -
1.247    from add_le_cancel_left [of "uminus a" zero "plus a a"]
1.248 -  have "(-a <= a) = (0 <= a+a)"
1.249 +  have "- a \<le> a \<longleftrightarrow> 0 \<le> a + a"
1.251 -  thus ?thesis by simp
1.252 +  then show ?thesis
1.253 +    by simp
1.254  qed
1.255
1.256  lemma zero_le_iff_zero_nprt: "0 \<le> a \<longleftrightarrow> nprt a = 0"
1.257 @@ -314,7 +343,8 @@
1.258
1.259  end
1.260
1.264
1.265
1.267 @@ -325,11 +355,15 @@
1.268  proof -
1.269    have "0 \<le> \<bar>a\<bar>"
1.270    proof -
1.271 -    have a: "a \<le> \<bar>a\<bar>" and b: "- a \<le> \<bar>a\<bar>" by (auto simp add: abs_lattice)
1.272 -    show ?thesis by (rule add_mono [OF a b, simplified])
1.273 +    have a: "a \<le> \<bar>a\<bar>" and b: "- a \<le> \<bar>a\<bar>"
1.274 +      by (auto simp add: abs_lattice)
1.275 +    show ?thesis
1.276 +      by (rule add_mono [OF a b, simplified])
1.277    qed
1.278 -  then have "0 \<le> sup a (- a)" unfolding abs_lattice .
1.279 -  then have "sup (sup a (- a)) 0 = sup a (- a)" by (rule sup_absorb1)
1.280 +  then have "0 \<le> sup a (- a)"
1.281 +    unfolding abs_lattice .
1.282 +  then have "sup (sup a (- a)) 0 = sup a (- a)"
1.283 +    by (rule sup_absorb1)
1.284    then show ?thesis
1.286  qed
1.287 @@ -347,7 +381,8 @@
1.288    have abs_leI: "\<And>a b. a \<le> b \<Longrightarrow> - a \<le> b \<Longrightarrow> \<bar>a\<bar> \<le> b"
1.289      by (simp add: abs_lattice le_supI)
1.290    fix a b
1.291 -  show "0 \<le> \<bar>a\<bar>" by simp
1.292 +  show "0 \<le> \<bar>a\<bar>"
1.293 +    by simp
1.294    show "a \<le> \<bar>a\<bar>"
1.295      by (auto simp add: abs_lattice)
1.296    show "\<bar>-a\<bar> = \<bar>a\<bar>"
1.297 @@ -359,14 +394,20 @@
1.298    }
1.299    show "\<bar>a + b\<bar> \<le> \<bar>a\<bar> + \<bar>b\<bar>"
1.300    proof -
1.301 -    have g:"abs a + abs b = sup (a+b) (sup (-a-b) (sup (-a+b) (a + (-b))))" (is "_=sup ?m ?n")
1.302 +    have g: "\<bar>a\<bar> + \<bar>b\<bar> = sup (a + b) (sup (- a - b) (sup (- a + b) (a + (- b))))"
1.303 +      (is "_=sup ?m ?n")
1.305 -    have a: "a + b <= sup ?m ?n" by simp
1.306 -    have b: "- a - b <= ?n" by simp
1.307 -    have c: "?n <= sup ?m ?n" by simp
1.308 -    from b c have d: "-a-b <= sup ?m ?n" by (rule order_trans)
1.309 -    have e:"-a-b = -(a+b)" by simp
1.310 -    from a d e have "abs(a+b) <= sup ?m ?n"
1.311 +    have a: "a + b \<le> sup ?m ?n"
1.312 +      by simp
1.313 +    have b: "- a - b \<le> ?n"
1.314 +      by simp
1.315 +    have c: "?n \<le> sup ?m ?n"
1.316 +      by simp
1.317 +    from b c have d: "- a - b \<le> sup ?m ?n"
1.318 +      by (rule order_trans)
1.319 +    have e: "- a - b = - (a + b)"
1.320 +      by simp
1.321 +    from a d e have "\<bar>a + b\<bar> \<le> sup ?m ?n"
1.322        apply -
1.323        apply (drule abs_leI)
1.324        apply (simp_all only: algebra_simps ac_simps minus_add)
1.325 @@ -379,7 +420,7 @@
1.326  end
1.327
1.328  lemma sup_eq_if:
1.329 -  fixes a :: "'a\<Colon>{lattice_ab_group_add, linorder}"
1.330 +  fixes a :: "'a::{lattice_ab_group_add, linorder}"
1.331    shows "sup a (- a) = (if a < 0 then - a else a)"
1.332  proof -
1.333    note add_le_cancel_right [of a a "- a", symmetric, simplified]
1.334 @@ -388,18 +429,23 @@
1.335  qed
1.336
1.337  lemma abs_if_lattice:
1.338 -  fixes a :: "'a\<Colon>{lattice_ab_group_add_abs, linorder}"
1.339 +  fixes a :: "'a::{lattice_ab_group_add_abs, linorder}"
1.340    shows "\<bar>a\<bar> = (if a < 0 then - a else a)"
1.341    by auto
1.342
1.343  lemma estimate_by_abs:
1.344 -  "a + b <= (c::'a::lattice_ab_group_add_abs) \<Longrightarrow> a <= c + abs b"
1.345 +  fixes a b c :: "'a::lattice_ab_group_add_abs"
1.346 +  shows "a + b \<le> c \<Longrightarrow> a \<le> c + \<bar>b\<bar>"
1.347  proof -
1.348 -  assume "a+b <= c"
1.349 -  then have "a <= c+(-b)" by (simp add: algebra_simps)
1.350 -  have "(-b) <= abs b" by (rule abs_ge_minus_self)
1.351 -  then have "c + (- b) \<le> c + \<bar>b\<bar>" by (rule add_left_mono)
1.352 -  with `a \<le> c + (- b)` show ?thesis by (rule order_trans)
1.353 +  assume "a + b \<le> c"
1.354 +  then have "a \<le> c + (- b)"
1.355 +    by (simp add: algebra_simps)
1.356 +  have "- b \<le> \<bar>b\<bar>"
1.357 +    by (rule abs_ge_minus_self)
1.358 +  then have "c + (- b) \<le> c + \<bar>b\<bar>"
1.360 +  with `a \<le> c + (- b)` show ?thesis
1.361 +    by (rule order_trans)
1.362  qed
1.363
1.364  class lattice_ring = ordered_ring + lattice_ab_group_add_abs
1.365 @@ -410,15 +456,17 @@
1.366
1.367  end
1.368
1.369 -lemma abs_le_mult: "abs (a * b) \<le> (abs a) * (abs (b::'a::lattice_ring))"
1.370 +lemma abs_le_mult:
1.371 +  fixes a b :: "'a::lattice_ring"
1.372 +  shows "\<bar>a * b\<bar> \<le> \<bar>a\<bar> * \<bar>b\<bar>"
1.373  proof -
1.374    let ?x = "pprt a * pprt b - pprt a * nprt b - nprt a * pprt b + nprt a * nprt b"
1.375    let ?y = "pprt a * pprt b + pprt a * nprt b + nprt a * pprt b + nprt a * nprt b"
1.376 -  have a: "(abs a) * (abs b) = ?x"
1.377 +  have a: "\<bar>a\<bar> * \<bar>b\<bar> = ?x"
1.378      by (simp only: abs_prts[of a] abs_prts[of b] algebra_simps)
1.379    {
1.380      fix u v :: 'a
1.381 -    have bh: "\<lbrakk>u = a; v = b\<rbrakk> \<Longrightarrow>
1.382 +    have bh: "u = a \<Longrightarrow> v = b \<Longrightarrow>
1.383                u * v = pprt a * pprt b + pprt a * nprt b +
1.384                        nprt a * pprt b + nprt a * nprt b"
1.385        apply (subst prts[of u], subst prts[of v])
1.386 @@ -426,16 +474,22 @@
1.387        done
1.388    }
1.389    note b = this[OF refl[of a] refl[of b]]
1.390 -  have xy: "- ?x <= ?y"
1.391 +  have xy: "- ?x \<le> ?y"
1.392      apply simp
1.396 +      mult_nonpos_nonpos nprt_le_zero zero_le_pprt)
1.397      done
1.398 -  have yx: "?y <= ?x"
1.399 +  have yx: "?y \<le> ?x"
1.400      apply simp
1.404 +      mult_nonpos_nonneg nprt_le_zero zero_le_pprt)
1.405      done
1.406 -  have i1: "a*b <= abs a * abs b" by (simp only: a b yx)
1.407 -  have i2: "- (abs a * abs b) <= a*b" by (simp only: a b xy)
1.408 +  have i1: "a * b \<le> \<bar>a\<bar> * \<bar>b\<bar>"
1.409 +    by (simp only: a b yx)
1.410 +  have i2: "- (\<bar>a\<bar> * \<bar>b\<bar>) \<le> a * b"
1.411 +    by (simp only: a b xy)
1.412    show ?thesis
1.413      apply (rule abs_leI)
1.415 @@ -445,37 +499,38 @@
1.416
1.417  instance lattice_ring \<subseteq> ordered_ring_abs
1.418  proof
1.419 -  fix a b :: "'a\<Colon> lattice_ring"
1.420 +  fix a b :: "'a::lattice_ring"
1.421    assume a: "(0 \<le> a \<or> a \<le> 0) \<and> (0 \<le> b \<or> b \<le> 0)"
1.422 -  show "abs (a*b) = abs a * abs b"
1.423 +  show "\<bar>a * b\<bar> = \<bar>a\<bar> * \<bar>b\<bar>"
1.424    proof -
1.425 -    have s: "(0 <= a*b) | (a*b <= 0)"
1.426 -      apply (auto)
1.427 +    have s: "(0 \<le> a * b) \<or> (a * b \<le> 0)"
1.428 +      apply auto
1.429        apply (rule_tac split_mult_pos_le)
1.430 -      apply (rule_tac contrapos_np[of "a*b <= 0"])
1.431 -      apply (simp)
1.432 +      apply (rule_tac contrapos_np[of "a * b \<le> 0"])
1.433 +      apply simp
1.434        apply (rule_tac split_mult_neg_le)
1.435 -      apply (insert a)
1.436 -      apply (blast)
1.437 +      using a
1.438 +      apply blast
1.439        done
1.440      have mulprts: "a * b = (pprt a + nprt a) * (pprt b + nprt b)"
1.442      show ?thesis
1.443 -    proof cases
1.444 -      assume "0 <= a * b"
1.445 +    proof (cases "0 \<le> a * b")
1.446 +      case True
1.447        then show ?thesis
1.448          apply (simp_all add: mulprts abs_prts)
1.449 -        apply (insert a)
1.450 +        using a
1.452            algebra_simps
1.453            iffD1[OF zero_le_iff_zero_nprt] iffD1[OF le_zero_iff_zero_pprt]
1.454            iffD1[OF le_zero_iff_pprt_id] iffD1[OF zero_le_iff_nprt_id])
1.455 -          apply(drule (1) mult_nonneg_nonpos[of a b], simp)
1.456 -          apply(drule (1) mult_nonneg_nonpos2[of b a], simp)
1.457 +        apply(drule (1) mult_nonneg_nonpos[of a b], simp)
1.458 +        apply(drule (1) mult_nonneg_nonpos2[of b a], simp)
1.459          done
1.460      next
1.461 -      assume "~(0 <= a*b)"
1.462 -      with s have "a*b <= 0" by simp
1.463 +      case False
1.464 +      with s have "a * b \<le> 0"
1.465 +        by simp
1.466        then show ?thesis
1.467          apply (simp_all add: mulprts abs_prts)
1.468          apply (insert a)
1.469 @@ -488,11 +543,12 @@
1.470  qed
1.471
1.472  lemma mult_le_prts:
1.473 -  assumes "a1 <= (a::'a::lattice_ring)"
1.474 -    and "a <= a2"
1.475 -    and "b1 <= b"
1.476 -    and "b <= b2"
1.477 -  shows "a * b <=
1.478 +  fixes a b :: "'a::lattice_ring"
1.479 +  assumes "a1 \<le> a"
1.480 +    and "a \<le> a2"
1.481 +    and "b1 \<le> b"
1.482 +    and "b \<le> b2"
1.483 +  shows "a * b \<le>
1.484      pprt a2 * pprt b2 + pprt a1 * nprt b2 + nprt a2 * pprt b1 + nprt a1 * nprt b1"
1.485  proof -
1.486    have "a * b = (pprt a + nprt a) * (pprt b + nprt b)"
1.487 @@ -501,31 +557,31 @@
1.488      done
1.489    then have "a * b = pprt a * pprt b + pprt a * nprt b + nprt a * pprt b + nprt a * nprt b"
1.491 -  moreover have "pprt a * pprt b <= pprt a2 * pprt b2"
1.492 +  moreover have "pprt a * pprt b \<le> pprt a2 * pprt b2"
1.493      by (simp_all add: assms mult_mono)
1.494 -  moreover have "pprt a * nprt b <= pprt a1 * nprt b2"
1.495 +  moreover have "pprt a * nprt b \<le> pprt a1 * nprt b2"
1.496    proof -
1.497 -    have "pprt a * nprt b <= pprt a * nprt b2"
1.498 +    have "pprt a * nprt b \<le> pprt a * nprt b2"
1.499        by (simp add: mult_left_mono assms)
1.500 -    moreover have "pprt a * nprt b2 <= pprt a1 * nprt b2"
1.501 +    moreover have "pprt a * nprt b2 \<le> pprt a1 * nprt b2"
1.502        by (simp add: mult_right_mono_neg assms)
1.503      ultimately show ?thesis
1.504        by simp
1.505    qed
1.506 -  moreover have "nprt a * pprt b <= nprt a2 * pprt b1"
1.507 +  moreover have "nprt a * pprt b \<le> nprt a2 * pprt b1"
1.508    proof -
1.509 -    have "nprt a * pprt b <= nprt a2 * pprt b"
1.510 +    have "nprt a * pprt b \<le> nprt a2 * pprt b"
1.511        by (simp add: mult_right_mono assms)
1.512 -    moreover have "nprt a2 * pprt b <= nprt a2 * pprt b1"
1.513 +    moreover have "nprt a2 * pprt b \<le> nprt a2 * pprt b1"
1.514        by (simp add: mult_left_mono_neg assms)
1.515      ultimately show ?thesis
1.516        by simp
1.517    qed
1.518 -  moreover have "nprt a * nprt b <= nprt a1 * nprt b1"
1.519 +  moreover have "nprt a * nprt b \<le> nprt a1 * nprt b1"
1.520    proof -
1.521 -    have "nprt a * nprt b <= nprt a * nprt b1"
1.522 +    have "nprt a * nprt b \<le> nprt a * nprt b1"
1.523        by (simp add: mult_left_mono_neg assms)
1.524 -    moreover have "nprt a * nprt b1 <= nprt a1 * nprt b1"
1.525 +    moreover have "nprt a * nprt b1 \<le> nprt a1 * nprt b1"
1.526        by (simp add: mult_right_mono_neg assms)
1.527      ultimately show ?thesis
1.528        by simp
1.529 @@ -537,36 +593,41 @@
1.530  qed
1.531
1.532  lemma mult_ge_prts:
1.533 -  assumes "a1 <= (a::'a::lattice_ring)"
1.534 -    and "a <= a2"
1.535 -    and "b1 <= b"
1.536 -    and "b <= b2"
1.537 -  shows "a * b >=
1.538 +  fixes a b :: "'a::lattice_ring"
1.539 +  assumes "a1 \<le> a"
1.540 +    and "a \<le> a2"
1.541 +    and "b1 \<le> b"
1.542 +    and "b \<le> b2"
1.543 +  shows "a * b \<ge>
1.544      nprt a1 * pprt b2 + nprt a2 * nprt b2 + pprt a1 * pprt b1 + pprt a2 * nprt b1"
1.545  proof -
1.546 -  from assms have a1:"- a2 <= -a"
1.547 +  from assms have a1: "- a2 \<le> -a"
1.548      by auto
1.549 -  from assms have a2: "-a <= -a1"
1.550 +  from assms have a2: "- a \<le> -a1"
1.551      by auto
1.552 -  from mult_le_prts[of "-a2" "-a" "-a1" "b1" b "b2", OF a1 a2 assms(3) assms(4), simplified nprt_neg pprt_neg]
1.553 -  have le: "- (a * b) <= - nprt a1 * pprt b2 + - nprt a2 * nprt b2 + - pprt a1 * pprt b1 + - pprt a2 * nprt b1"
1.554 +  from mult_le_prts[of "- a2" "- a" "- a1" "b1" b "b2",
1.555 +    OF a1 a2 assms(3) assms(4), simplified nprt_neg pprt_neg]
1.556 +  have le: "- (a * b) \<le> - nprt a1 * pprt b2 + - nprt a2 * nprt b2 +
1.557 +    - pprt a1 * pprt b1 + - pprt a2 * nprt b1"
1.558      by simp
1.559 -  then have "-(- nprt a1 * pprt b2 + - nprt a2 * nprt b2 + - pprt a1 * pprt b1 + - pprt a2 * nprt b1) <= a * b"
1.560 +  then have "- (- nprt a1 * pprt b2 + - nprt a2 * nprt b2 +
1.561 +      - pprt a1 * pprt b1 + - pprt a2 * nprt b1) \<le> a * b"
1.562      by (simp only: minus_le_iff)
1.563 -  then show ?thesis by (simp add: algebra_simps)
1.564 +  then show ?thesis
1.565 +    by (simp add: algebra_simps)
1.566  qed
1.567
1.568  instance int :: lattice_ring
1.569  proof
1.570    fix k :: int
1.571 -  show "abs k = sup k (- k)"
1.572 +  show "\<bar>k\<bar> = sup k (- k)"
1.573      by (auto simp add: sup_int_def)
1.574  qed
1.575
1.576  instance real :: lattice_ring
1.577  proof
1.578    fix a :: real
1.579 -  show "abs a = sup a (- a)"
1.580 +  show "\<bar>a\<bar> = sup a (- a)"
1.581      by (auto simp add: sup_real_def)
1.582  qed
1.583
```