| author | blanchet | 
| Sat, 12 Jul 2014 11:31:22 +0200 | |
| changeset 57546 | 2b561e7a0512 | 
| parent 57512 | cc97b347b301 | 
| child 58042 | ffa9e39763e3 | 
| permissions | -rw-r--r-- | 
| 43920 | 1 | (* Title: HOL/Library/Extended_Real.thy | 
| 41983 | 2 | Author: Johannes Hölzl, TU München | 
| 3 | Author: Robert Himmelmann, TU München | |
| 4 | Author: Armin Heller, TU München | |
| 5 | Author: Bogdan Grechuk, University of Edinburgh | |
| 6 | *) | |
| 41973 | 7 | |
| 8 | header {* Extended real number line *}
 | |
| 9 | ||
| 43920 | 10 | theory Extended_Real | 
| 51340 
5e6296afe08d
move Liminf / Limsup lemmas on complete_lattices to its own file
 hoelzl parents: 
51329diff
changeset | 11 | imports Complex_Main Extended_Nat Liminf_Limsup | 
| 41973 | 12 | begin | 
| 13 | ||
| 51022 
78de6c7e8a58
replace open_interval with the rule open_tendstoI; generalize Liminf/Limsup rules
 hoelzl parents: 
51000diff
changeset | 14 | text {*
 | 
| 
78de6c7e8a58
replace open_interval with the rule open_tendstoI; generalize Liminf/Limsup rules
 hoelzl parents: 
51000diff
changeset | 15 | |
| 
78de6c7e8a58
replace open_interval with the rule open_tendstoI; generalize Liminf/Limsup rules
 hoelzl parents: 
51000diff
changeset | 16 | For more lemmas about the extended real numbers go to | 
| 
78de6c7e8a58
replace open_interval with the rule open_tendstoI; generalize Liminf/Limsup rules
 hoelzl parents: 
51000diff
changeset | 17 |   @{file "~~/src/HOL/Multivariate_Analysis/Extended_Real_Limits.thy"}
 | 
| 
78de6c7e8a58
replace open_interval with the rule open_tendstoI; generalize Liminf/Limsup rules
 hoelzl parents: 
51000diff
changeset | 18 | |
| 
78de6c7e8a58
replace open_interval with the rule open_tendstoI; generalize Liminf/Limsup rules
 hoelzl parents: 
51000diff
changeset | 19 | *} | 
| 
78de6c7e8a58
replace open_interval with the rule open_tendstoI; generalize Liminf/Limsup rules
 hoelzl parents: 
51000diff
changeset | 20 | |
| 41973 | 21 | subsection {* Definition and basic properties *}
 | 
| 22 | ||
| 43920 | 23 | datatype ereal = ereal real | PInfty | MInfty | 
| 41973 | 24 | |
| 43920 | 25 | instantiation ereal :: uminus | 
| 41973 | 26 | begin | 
| 53873 | 27 | |
| 28 | fun uminus_ereal where | |
| 29 | "- (ereal r) = ereal (- r)" | |
| 30 | | "- PInfty = MInfty" | |
| 31 | | "- MInfty = PInfty" | |
| 32 | ||
| 33 | instance .. | |
| 34 | ||
| 41973 | 35 | end | 
| 36 | ||
| 43923 | 37 | instantiation ereal :: infinity | 
| 38 | begin | |
| 53873 | 39 | |
| 40 | definition "(\<infinity>::ereal) = PInfty" | |
| 41 | instance .. | |
| 42 | ||
| 43923 | 43 | end | 
| 41973 | 44 | |
| 43923 | 45 | declare [[coercion "ereal :: real \<Rightarrow> ereal"]] | 
| 41973 | 46 | |
| 43920 | 47 | lemma ereal_uminus_uminus[simp]: | 
| 53873 | 48 | fixes a :: ereal | 
| 49 | shows "- (- a) = a" | |
| 41973 | 50 | by (cases a) simp_all | 
| 51 | ||
| 43923 | 52 | lemma | 
| 53 | shows PInfty_eq_infinity[simp]: "PInfty = \<infinity>" | |
| 54 | and MInfty_eq_minfinity[simp]: "MInfty = - \<infinity>" | |
| 55 | and MInfty_neq_PInfty[simp]: "\<infinity> \<noteq> - (\<infinity>::ereal)" "- \<infinity> \<noteq> (\<infinity>::ereal)" | |
| 56 | and MInfty_neq_ereal[simp]: "ereal r \<noteq> - \<infinity>" "- \<infinity> \<noteq> ereal r" | |
| 57 | and PInfty_neq_ereal[simp]: "ereal r \<noteq> \<infinity>" "\<infinity> \<noteq> ereal r" | |
| 58 | and PInfty_cases[simp]: "(case \<infinity> of ereal r \<Rightarrow> f r | PInfty \<Rightarrow> y | MInfty \<Rightarrow> z) = y" | |
| 59 | and MInfty_cases[simp]: "(case - \<infinity> of ereal r \<Rightarrow> f r | PInfty \<Rightarrow> y | MInfty \<Rightarrow> z) = z" | |
| 60 | by (simp_all add: infinity_ereal_def) | |
| 41973 | 61 | |
| 43933 | 62 | declare | 
| 63 | PInfty_eq_infinity[code_post] | |
| 64 | MInfty_eq_minfinity[code_post] | |
| 65 | ||
| 66 | lemma [code_unfold]: | |
| 67 | "\<infinity> = PInfty" | |
| 53873 | 68 | "- PInfty = MInfty" | 
| 43933 | 69 | by simp_all | 
| 70 | ||
| 43923 | 71 | lemma inj_ereal[simp]: "inj_on ereal A" | 
| 72 | unfolding inj_on_def by auto | |
| 41973 | 73 | |
| 55913 | 74 | lemma ereal_cases[cases type: ereal]: | 
| 75 | obtains (real) r where "x = ereal r" | |
| 76 | | (PInf) "x = \<infinity>" | |
| 77 | | (MInf) "x = -\<infinity>" | |
| 41973 | 78 | using assms by (cases x) auto | 
| 79 | ||
| 43920 | 80 | lemmas ereal2_cases = ereal_cases[case_product ereal_cases] | 
| 81 | lemmas ereal3_cases = ereal2_cases[case_product ereal_cases] | |
| 41973 | 82 | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57025diff
changeset | 83 | lemma ereal_all_split: "\<And>P. (\<forall>x::ereal. P x) \<longleftrightarrow> P \<infinity> \<and> (\<forall>x. P (ereal x)) \<and> P (-\<infinity>)" | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57025diff
changeset | 84 | by (metis ereal_cases) | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57025diff
changeset | 85 | |
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57025diff
changeset | 86 | lemma ereal_ex_split: "\<And>P. (\<exists>x::ereal. P x) \<longleftrightarrow> P \<infinity> \<or> (\<exists>x. P (ereal x)) \<or> P (-\<infinity>)" | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57025diff
changeset | 87 | by (metis ereal_cases) | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57025diff
changeset | 88 | |
| 43920 | 89 | lemma ereal_uminus_eq_iff[simp]: | 
| 53873 | 90 | fixes a b :: ereal | 
| 91 | shows "-a = -b \<longleftrightarrow> a = b" | |
| 43920 | 92 | by (cases rule: ereal2_cases[of a b]) simp_all | 
| 41973 | 93 | |
| 43920 | 94 | function of_ereal :: "ereal \<Rightarrow> real" where | 
| 53873 | 95 | "of_ereal (ereal r) = r" | 
| 96 | | "of_ereal \<infinity> = 0" | |
| 97 | | "of_ereal (-\<infinity>) = 0" | |
| 43920 | 98 | by (auto intro: ereal_cases) | 
| 53873 | 99 | termination by default (rule wf_empty) | 
| 41973 | 100 | |
| 101 | defs (overloaded) | |
| 43920 | 102 | real_of_ereal_def [code_unfold]: "real \<equiv> of_ereal" | 
| 41973 | 103 | |
| 43920 | 104 | lemma real_of_ereal[simp]: | 
| 53873 | 105 | "real (- x :: ereal) = - (real x)" | 
| 106 | "real (ereal r) = r" | |
| 107 | "real (\<infinity>::ereal) = 0" | |
| 43920 | 108 | by (cases x) (simp_all add: real_of_ereal_def) | 
| 41973 | 109 | |
| 43920 | 110 | lemma range_ereal[simp]: "range ereal = UNIV - {\<infinity>, -\<infinity>}"
 | 
| 41973 | 111 | proof safe | 
| 53873 | 112 | fix x | 
| 113 | assume "x \<notin> range ereal" "x \<noteq> \<infinity>" | |
| 114 | then show "x = -\<infinity>" | |
| 115 | by (cases x) auto | |
| 41973 | 116 | qed auto | 
| 117 | ||
| 43920 | 118 | lemma ereal_range_uminus[simp]: "range uminus = (UNIV::ereal set)" | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 119 | proof safe | 
| 53873 | 120 | fix x :: ereal | 
| 121 | show "x \<in> range uminus" | |
| 122 | by (intro image_eqI[of _ _ "-x"]) auto | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 123 | qed auto | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 124 | |
| 43920 | 125 | instantiation ereal :: abs | 
| 41976 | 126 | begin | 
| 53873 | 127 | |
| 128 | function abs_ereal where | |
| 129 | "\<bar>ereal r\<bar> = ereal \<bar>r\<bar>" | |
| 130 | | "\<bar>-\<infinity>\<bar> = (\<infinity>::ereal)" | |
| 131 | | "\<bar>\<infinity>\<bar> = (\<infinity>::ereal)" | |
| 132 | by (auto intro: ereal_cases) | |
| 133 | termination proof qed (rule wf_empty) | |
| 134 | ||
| 135 | instance .. | |
| 136 | ||
| 41976 | 137 | end | 
| 138 | ||
| 53873 | 139 | lemma abs_eq_infinity_cases[elim!]: | 
| 140 | fixes x :: ereal | |
| 141 | assumes "\<bar>x\<bar> = \<infinity>" | |
| 142 | obtains "x = \<infinity>" | "x = -\<infinity>" | |
| 143 | using assms by (cases x) auto | |
| 41976 | 144 | |
| 53873 | 145 | lemma abs_neq_infinity_cases[elim!]: | 
| 146 | fixes x :: ereal | |
| 147 | assumes "\<bar>x\<bar> \<noteq> \<infinity>" | |
| 148 | obtains r where "x = ereal r" | |
| 149 | using assms by (cases x) auto | |
| 150 | ||
| 151 | lemma abs_ereal_uminus[simp]: | |
| 152 | fixes x :: ereal | |
| 153 | shows "\<bar>- x\<bar> = \<bar>x\<bar>" | |
| 41976 | 154 | by (cases x) auto | 
| 155 | ||
| 53873 | 156 | lemma ereal_infinity_cases: | 
| 157 | fixes a :: ereal | |
| 158 | shows "a \<noteq> \<infinity> \<Longrightarrow> a \<noteq> -\<infinity> \<Longrightarrow> \<bar>a\<bar> \<noteq> \<infinity>" | |
| 159 | by auto | |
| 41976 | 160 | |
| 50104 | 161 | |
| 41973 | 162 | subsubsection "Addition" | 
| 163 | ||
| 54408 | 164 | instantiation ereal :: "{one,comm_monoid_add,zero_neq_one}"
 | 
| 41973 | 165 | begin | 
| 166 | ||
| 43920 | 167 | definition "0 = ereal 0" | 
| 51351 | 168 | definition "1 = ereal 1" | 
| 41973 | 169 | |
| 43920 | 170 | function plus_ereal where | 
| 53873 | 171 | "ereal r + ereal p = ereal (r + p)" | 
| 172 | | "\<infinity> + a = (\<infinity>::ereal)" | |
| 173 | | "a + \<infinity> = (\<infinity>::ereal)" | |
| 174 | | "ereal r + -\<infinity> = - \<infinity>" | |
| 175 | | "-\<infinity> + ereal p = -(\<infinity>::ereal)" | |
| 176 | | "-\<infinity> + -\<infinity> = -(\<infinity>::ereal)" | |
| 41973 | 177 | proof - | 
| 178 | case (goal1 P x) | |
| 53873 | 179 | then obtain a b where "x = (a, b)" | 
| 180 | by (cases x) auto | |
| 53374 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53216diff
changeset | 181 | with goal1 show P | 
| 43920 | 182 | by (cases rule: ereal2_cases[of a b]) auto | 
| 41973 | 183 | qed auto | 
| 53374 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53216diff
changeset | 184 | termination by default (rule wf_empty) | 
| 41973 | 185 | |
| 186 | lemma Infty_neq_0[simp]: | |
| 43923 | 187 | "(\<infinity>::ereal) \<noteq> 0" "0 \<noteq> (\<infinity>::ereal)" | 
| 188 | "-(\<infinity>::ereal) \<noteq> 0" "0 \<noteq> -(\<infinity>::ereal)" | |
| 43920 | 189 | by (simp_all add: zero_ereal_def) | 
| 41973 | 190 | |
| 43920 | 191 | lemma ereal_eq_0[simp]: | 
| 192 | "ereal r = 0 \<longleftrightarrow> r = 0" | |
| 193 | "0 = ereal r \<longleftrightarrow> r = 0" | |
| 194 | unfolding zero_ereal_def by simp_all | |
| 41973 | 195 | |
| 54416 | 196 | lemma ereal_eq_1[simp]: | 
| 197 | "ereal r = 1 \<longleftrightarrow> r = 1" | |
| 198 | "1 = ereal r \<longleftrightarrow> r = 1" | |
| 199 | unfolding one_ereal_def by simp_all | |
| 200 | ||
| 41973 | 201 | instance | 
| 202 | proof | |
| 47082 | 203 | fix a b c :: ereal | 
| 204 | show "0 + a = a" | |
| 43920 | 205 | by (cases a) (simp_all add: zero_ereal_def) | 
| 47082 | 206 | show "a + b = b + a" | 
| 43920 | 207 | by (cases rule: ereal2_cases[of a b]) simp_all | 
| 47082 | 208 | show "a + b + c = a + (b + c)" | 
| 43920 | 209 | by (cases rule: ereal3_cases[of a b c]) simp_all | 
| 54408 | 210 | show "0 \<noteq> (1::ereal)" | 
| 211 | by (simp add: one_ereal_def zero_ereal_def) | |
| 41973 | 212 | qed | 
| 53873 | 213 | |
| 41973 | 214 | end | 
| 215 | ||
| 51351 | 216 | instance ereal :: numeral .. | 
| 217 | ||
| 43920 | 218 | lemma real_of_ereal_0[simp]: "real (0::ereal) = 0" | 
| 219 | unfolding real_of_ereal_def zero_ereal_def by simp | |
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 220 | |
| 43920 | 221 | lemma abs_ereal_zero[simp]: "\<bar>0\<bar> = (0::ereal)" | 
| 222 | unfolding zero_ereal_def abs_ereal.simps by simp | |
| 41976 | 223 | |
| 53873 | 224 | lemma ereal_uminus_zero[simp]: "- 0 = (0::ereal)" | 
| 43920 | 225 | by (simp add: zero_ereal_def) | 
| 41973 | 226 | |
| 43920 | 227 | lemma ereal_uminus_zero_iff[simp]: | 
| 53873 | 228 | fixes a :: ereal | 
| 229 | shows "-a = 0 \<longleftrightarrow> a = 0" | |
| 41973 | 230 | by (cases a) simp_all | 
| 231 | ||
| 43920 | 232 | lemma ereal_plus_eq_PInfty[simp]: | 
| 53873 | 233 | fixes a b :: ereal | 
| 234 | shows "a + b = \<infinity> \<longleftrightarrow> a = \<infinity> \<or> b = \<infinity>" | |
| 43920 | 235 | by (cases rule: ereal2_cases[of a b]) auto | 
| 41973 | 236 | |
| 43920 | 237 | lemma ereal_plus_eq_MInfty[simp]: | 
| 53873 | 238 | fixes a b :: ereal | 
| 239 | shows "a + b = -\<infinity> \<longleftrightarrow> (a = -\<infinity> \<or> b = -\<infinity>) \<and> a \<noteq> \<infinity> \<and> b \<noteq> \<infinity>" | |
| 43920 | 240 | by (cases rule: ereal2_cases[of a b]) auto | 
| 41973 | 241 | |
| 43920 | 242 | lemma ereal_add_cancel_left: | 
| 53873 | 243 | fixes a b :: ereal | 
| 244 | assumes "a \<noteq> -\<infinity>" | |
| 245 | shows "a + b = a + c \<longleftrightarrow> a = \<infinity> \<or> b = c" | |
| 43920 | 246 | using assms by (cases rule: ereal3_cases[of a b c]) auto | 
| 41973 | 247 | |
| 43920 | 248 | lemma ereal_add_cancel_right: | 
| 53873 | 249 | fixes a b :: ereal | 
| 250 | assumes "a \<noteq> -\<infinity>" | |
| 251 | shows "b + a = c + a \<longleftrightarrow> a = \<infinity> \<or> b = c" | |
| 43920 | 252 | using assms by (cases rule: ereal3_cases[of a b c]) auto | 
| 41973 | 253 | |
| 53873 | 254 | lemma ereal_real: "ereal (real x) = (if \<bar>x\<bar> = \<infinity> then 0 else x)" | 
| 41973 | 255 | by (cases x) simp_all | 
| 256 | ||
| 43920 | 257 | lemma real_of_ereal_add: | 
| 258 | fixes a b :: ereal | |
| 47082 | 259 | shows "real (a + b) = | 
| 260 | (if (\<bar>a\<bar> = \<infinity>) \<and> (\<bar>b\<bar> = \<infinity>) \<or> (\<bar>a\<bar> \<noteq> \<infinity>) \<and> (\<bar>b\<bar> \<noteq> \<infinity>) then real a + real b else 0)" | |
| 43920 | 261 | by (cases rule: ereal2_cases[of a b]) auto | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 262 | |
| 53873 | 263 | |
| 43920 | 264 | subsubsection "Linear order on @{typ ereal}"
 | 
| 41973 | 265 | |
| 43920 | 266 | instantiation ereal :: linorder | 
| 41973 | 267 | begin | 
| 268 | ||
| 47082 | 269 | function less_ereal | 
| 270 | where | |
| 271 | " ereal x < ereal y \<longleftrightarrow> x < y" | |
| 272 | | "(\<infinity>::ereal) < a \<longleftrightarrow> False" | |
| 273 | | " a < -(\<infinity>::ereal) \<longleftrightarrow> False" | |
| 274 | | "ereal x < \<infinity> \<longleftrightarrow> True" | |
| 275 | | " -\<infinity> < ereal r \<longleftrightarrow> True" | |
| 276 | | " -\<infinity> < (\<infinity>::ereal) \<longleftrightarrow> True" | |
| 41973 | 277 | proof - | 
| 278 | case (goal1 P x) | |
| 53374 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53216diff
changeset | 279 | then obtain a b where "x = (a,b)" by (cases x) auto | 
| 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53216diff
changeset | 280 | with goal1 show P by (cases rule: ereal2_cases[of a b]) auto | 
| 41973 | 281 | qed simp_all | 
| 282 | termination by (relation "{}") simp
 | |
| 283 | ||
| 43920 | 284 | definition "x \<le> (y::ereal) \<longleftrightarrow> x < y \<or> x = y" | 
| 41973 | 285 | |
| 43920 | 286 | lemma ereal_infty_less[simp]: | 
| 43923 | 287 | fixes x :: ereal | 
| 288 | shows "x < \<infinity> \<longleftrightarrow> (x \<noteq> \<infinity>)" | |
| 289 | "-\<infinity> < x \<longleftrightarrow> (x \<noteq> -\<infinity>)" | |
| 41973 | 290 | by (cases x, simp_all) (cases x, simp_all) | 
| 291 | ||
| 43920 | 292 | lemma ereal_infty_less_eq[simp]: | 
| 43923 | 293 | fixes x :: ereal | 
| 294 | shows "\<infinity> \<le> x \<longleftrightarrow> x = \<infinity>" | |
| 53873 | 295 | and "x \<le> -\<infinity> \<longleftrightarrow> x = -\<infinity>" | 
| 43920 | 296 | by (auto simp add: less_eq_ereal_def) | 
| 41973 | 297 | |
| 43920 | 298 | lemma ereal_less[simp]: | 
| 299 | "ereal r < 0 \<longleftrightarrow> (r < 0)" | |
| 300 | "0 < ereal r \<longleftrightarrow> (0 < r)" | |
| 54416 | 301 | "ereal r < 1 \<longleftrightarrow> (r < 1)" | 
| 302 | "1 < ereal r \<longleftrightarrow> (1 < r)" | |
| 43923 | 303 | "0 < (\<infinity>::ereal)" | 
| 304 | "-(\<infinity>::ereal) < 0" | |
| 54416 | 305 | by (simp_all add: zero_ereal_def one_ereal_def) | 
| 41973 | 306 | |
| 43920 | 307 | lemma ereal_less_eq[simp]: | 
| 43923 | 308 | "x \<le> (\<infinity>::ereal)" | 
| 309 | "-(\<infinity>::ereal) \<le> x" | |
| 43920 | 310 | "ereal r \<le> ereal p \<longleftrightarrow> r \<le> p" | 
| 311 | "ereal r \<le> 0 \<longleftrightarrow> r \<le> 0" | |
| 312 | "0 \<le> ereal r \<longleftrightarrow> 0 \<le> r" | |
| 54416 | 313 | "ereal r \<le> 1 \<longleftrightarrow> r \<le> 1" | 
| 314 | "1 \<le> ereal r \<longleftrightarrow> 1 \<le> r" | |
| 315 | by (auto simp add: less_eq_ereal_def zero_ereal_def one_ereal_def) | |
| 41973 | 316 | |
| 43920 | 317 | lemma ereal_infty_less_eq2: | 
| 43923 | 318 | "a \<le> b \<Longrightarrow> a = \<infinity> \<Longrightarrow> b = (\<infinity>::ereal)" | 
| 319 | "a \<le> b \<Longrightarrow> b = -\<infinity> \<Longrightarrow> a = -(\<infinity>::ereal)" | |
| 41973 | 320 | by simp_all | 
| 321 | ||
| 322 | instance | |
| 323 | proof | |
| 47082 | 324 | fix x y z :: ereal | 
| 325 | show "x \<le> x" | |
| 41973 | 326 | by (cases x) simp_all | 
| 47082 | 327 | show "x < y \<longleftrightarrow> x \<le> y \<and> \<not> y \<le> x" | 
| 43920 | 328 | by (cases rule: ereal2_cases[of x y]) auto | 
| 41973 | 329 | show "x \<le> y \<or> y \<le> x " | 
| 43920 | 330 | by (cases rule: ereal2_cases[of x y]) auto | 
| 53873 | 331 |   {
 | 
| 332 | assume "x \<le> y" "y \<le> x" | |
| 333 | then show "x = y" | |
| 334 | by (cases rule: ereal2_cases[of x y]) auto | |
| 335 | } | |
| 336 |   {
 | |
| 337 | assume "x \<le> y" "y \<le> z" | |
| 338 | then show "x \<le> z" | |
| 339 | by (cases rule: ereal3_cases[of x y z]) auto | |
| 340 | } | |
| 41973 | 341 | qed | 
| 47082 | 342 | |
| 41973 | 343 | end | 
| 344 | ||
| 51329 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 345 | lemma ereal_dense2: "x < y \<Longrightarrow> \<exists>z. x < ereal z \<and> ereal z < y" | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 346 | using lt_ex gt_ex dense by (cases x y rule: ereal2_cases) auto | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 347 | |
| 53216 | 348 | instance ereal :: dense_linorder | 
| 51329 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 349 | by default (blast dest: ereal_dense2) | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 350 | |
| 43920 | 351 | instance ereal :: ordered_ab_semigroup_add | 
| 41978 | 352 | proof | 
| 53873 | 353 | fix a b c :: ereal | 
| 354 | assume "a \<le> b" | |
| 355 | then show "c + a \<le> c + b" | |
| 43920 | 356 | by (cases rule: ereal3_cases[of a b c]) auto | 
| 41978 | 357 | qed | 
| 358 | ||
| 43920 | 359 | lemma real_of_ereal_positive_mono: | 
| 53873 | 360 | fixes x y :: ereal | 
| 361 | shows "0 \<le> x \<Longrightarrow> x \<le> y \<Longrightarrow> y \<noteq> \<infinity> \<Longrightarrow> real x \<le> real y" | |
| 43920 | 362 | by (cases rule: ereal2_cases[of x y]) auto | 
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 363 | |
| 43920 | 364 | lemma ereal_MInfty_lessI[intro, simp]: | 
| 53873 | 365 | fixes a :: ereal | 
| 366 | shows "a \<noteq> -\<infinity> \<Longrightarrow> -\<infinity> < a" | |
| 41973 | 367 | by (cases a) auto | 
| 368 | ||
| 43920 | 369 | lemma ereal_less_PInfty[intro, simp]: | 
| 53873 | 370 | fixes a :: ereal | 
| 371 | shows "a \<noteq> \<infinity> \<Longrightarrow> a < \<infinity>" | |
| 41973 | 372 | by (cases a) auto | 
| 373 | ||
| 43920 | 374 | lemma ereal_less_ereal_Ex: | 
| 375 | fixes a b :: ereal | |
| 376 | shows "x < ereal r \<longleftrightarrow> x = -\<infinity> \<or> (\<exists>p. p < r \<and> x = ereal p)" | |
| 41973 | 377 | by (cases x) auto | 
| 378 | ||
| 43920 | 379 | lemma less_PInf_Ex_of_nat: "x \<noteq> \<infinity> \<longleftrightarrow> (\<exists>n::nat. x < ereal (real n))" | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 380 | proof (cases x) | 
| 53873 | 381 | case (real r) | 
| 382 | then show ?thesis | |
| 41980 
28b51effc5ed
split Extended_Reals into parts for Library and Multivariate_Analysis
 hoelzl parents: 
41979diff
changeset | 383 | using reals_Archimedean2[of r] by simp | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 384 | qed simp_all | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 385 | |
| 43920 | 386 | lemma ereal_add_mono: | 
| 53873 | 387 | fixes a b c d :: ereal | 
| 388 | assumes "a \<le> b" | |
| 389 | and "c \<le> d" | |
| 390 | shows "a + c \<le> b + d" | |
| 41973 | 391 | using assms | 
| 392 | apply (cases a) | |
| 43920 | 393 | apply (cases rule: ereal3_cases[of b c d], auto) | 
| 394 | apply (cases rule: ereal3_cases[of b c d], auto) | |
| 41973 | 395 | done | 
| 396 | ||
| 43920 | 397 | lemma ereal_minus_le_minus[simp]: | 
| 53873 | 398 | fixes a b :: ereal | 
| 399 | shows "- a \<le> - b \<longleftrightarrow> b \<le> a" | |
| 43920 | 400 | by (cases rule: ereal2_cases[of a b]) auto | 
| 41973 | 401 | |
| 43920 | 402 | lemma ereal_minus_less_minus[simp]: | 
| 53873 | 403 | fixes a b :: ereal | 
| 404 | shows "- a < - b \<longleftrightarrow> b < a" | |
| 43920 | 405 | by (cases rule: ereal2_cases[of a b]) auto | 
| 41973 | 406 | |
| 43920 | 407 | lemma ereal_le_real_iff: | 
| 53873 | 408 | "x \<le> real y \<longleftrightarrow> (\<bar>y\<bar> \<noteq> \<infinity> \<longrightarrow> ereal x \<le> y) \<and> (\<bar>y\<bar> = \<infinity> \<longrightarrow> x \<le> 0)" | 
| 41973 | 409 | by (cases y) auto | 
| 410 | ||
| 43920 | 411 | lemma real_le_ereal_iff: | 
| 53873 | 412 | "real y \<le> x \<longleftrightarrow> (\<bar>y\<bar> \<noteq> \<infinity> \<longrightarrow> y \<le> ereal x) \<and> (\<bar>y\<bar> = \<infinity> \<longrightarrow> 0 \<le> x)" | 
| 41973 | 413 | by (cases y) auto | 
| 414 | ||
| 43920 | 415 | lemma ereal_less_real_iff: | 
| 53873 | 416 | "x < real y \<longleftrightarrow> (\<bar>y\<bar> \<noteq> \<infinity> \<longrightarrow> ereal x < y) \<and> (\<bar>y\<bar> = \<infinity> \<longrightarrow> x < 0)" | 
| 41973 | 417 | by (cases y) auto | 
| 418 | ||
| 43920 | 419 | lemma real_less_ereal_iff: | 
| 53873 | 420 | "real y < x \<longleftrightarrow> (\<bar>y\<bar> \<noteq> \<infinity> \<longrightarrow> y < ereal x) \<and> (\<bar>y\<bar> = \<infinity> \<longrightarrow> 0 < x)" | 
| 41973 | 421 | by (cases y) auto | 
| 422 | ||
| 43920 | 423 | lemma real_of_ereal_pos: | 
| 53873 | 424 | fixes x :: ereal | 
| 425 | shows "0 \<le> x \<Longrightarrow> 0 \<le> real x" by (cases x) auto | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 426 | |
| 43920 | 427 | lemmas real_of_ereal_ord_simps = | 
| 428 | ereal_le_real_iff real_le_ereal_iff ereal_less_real_iff real_less_ereal_iff | |
| 41973 | 429 | |
| 43920 | 430 | lemma abs_ereal_ge0[simp]: "0 \<le> x \<Longrightarrow> \<bar>x :: ereal\<bar> = x" | 
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 431 | by (cases x) auto | 
| 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 432 | |
| 43920 | 433 | lemma abs_ereal_less0[simp]: "x < 0 \<Longrightarrow> \<bar>x :: ereal\<bar> = -x" | 
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 434 | by (cases x) auto | 
| 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 435 | |
| 43920 | 436 | lemma abs_ereal_pos[simp]: "0 \<le> \<bar>x :: ereal\<bar>" | 
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 437 | by (cases x) auto | 
| 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 438 | |
| 53873 | 439 | lemma real_of_ereal_le_0[simp]: "real (x :: ereal) \<le> 0 \<longleftrightarrow> x \<le> 0 \<or> x = \<infinity>" | 
| 43923 | 440 | by (cases x) auto | 
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 441 | |
| 43923 | 442 | lemma abs_real_of_ereal[simp]: "\<bar>real (x :: ereal)\<bar> = real \<bar>x\<bar>" | 
| 443 | by (cases x) auto | |
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 444 | |
| 43923 | 445 | lemma zero_less_real_of_ereal: | 
| 53873 | 446 | fixes x :: ereal | 
| 447 | shows "0 < real x \<longleftrightarrow> 0 < x \<and> x \<noteq> \<infinity>" | |
| 43923 | 448 | by (cases x) auto | 
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 449 | |
| 43920 | 450 | lemma ereal_0_le_uminus_iff[simp]: | 
| 53873 | 451 | fixes a :: ereal | 
| 452 | shows "0 \<le> - a \<longleftrightarrow> a \<le> 0" | |
| 43920 | 453 | by (cases rule: ereal2_cases[of a]) auto | 
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 454 | |
| 43920 | 455 | lemma ereal_uminus_le_0_iff[simp]: | 
| 53873 | 456 | fixes a :: ereal | 
| 457 | shows "- a \<le> 0 \<longleftrightarrow> 0 \<le> a" | |
| 43920 | 458 | by (cases rule: ereal2_cases[of a]) auto | 
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 459 | |
| 43920 | 460 | lemma ereal_add_strict_mono: | 
| 461 | fixes a b c d :: ereal | |
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 462 | assumes "a \<le> b" | 
| 53873 | 463 | and "0 \<le> a" | 
| 464 | and "a \<noteq> \<infinity>" | |
| 465 | and "c < d" | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 466 | shows "a + c < b + d" | 
| 53873 | 467 | using assms | 
| 468 | by (cases rule: ereal3_cases[case_product ereal_cases, of a b c d]) auto | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 469 | |
| 53873 | 470 | lemma ereal_less_add: | 
| 471 | fixes a b c :: ereal | |
| 472 | shows "\<bar>a\<bar> \<noteq> \<infinity> \<Longrightarrow> c < b \<Longrightarrow> a + c < a + b" | |
| 43920 | 473 | by (cases rule: ereal2_cases[of b c]) auto | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 474 | |
| 54416 | 475 | lemma ereal_add_nonneg_eq_0_iff: | 
| 476 | fixes a b :: ereal | |
| 477 | shows "0 \<le> a \<Longrightarrow> 0 \<le> b \<Longrightarrow> a + b = 0 \<longleftrightarrow> a = 0 \<and> b = 0" | |
| 478 | by (cases a b rule: ereal2_cases) auto | |
| 479 | ||
| 53873 | 480 | lemma ereal_uminus_eq_reorder: "- a = b \<longleftrightarrow> a = (-b::ereal)" | 
| 481 | by auto | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 482 | |
| 43920 | 483 | lemma ereal_uminus_less_reorder: "- a < b \<longleftrightarrow> -b < (a::ereal)" | 
| 484 | by (subst (3) ereal_uminus_uminus[symmetric]) (simp only: ereal_minus_less_minus) | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 485 | |
| 43920 | 486 | lemma ereal_uminus_le_reorder: "- a \<le> b \<longleftrightarrow> -b \<le> (a::ereal)" | 
| 487 | by (subst (3) ereal_uminus_uminus[symmetric]) (simp only: ereal_minus_le_minus) | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 488 | |
| 43920 | 489 | lemmas ereal_uminus_reorder = | 
| 490 | ereal_uminus_eq_reorder ereal_uminus_less_reorder ereal_uminus_le_reorder | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 491 | |
| 43920 | 492 | lemma ereal_bot: | 
| 53873 | 493 | fixes x :: ereal | 
| 494 | assumes "\<And>B. x \<le> ereal B" | |
| 495 | shows "x = - \<infinity>" | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 496 | proof (cases x) | 
| 53873 | 497 | case (real r) | 
| 498 | with assms[of "r - 1"] show ?thesis | |
| 499 | by auto | |
| 47082 | 500 | next | 
| 53873 | 501 | case PInf | 
| 502 | with assms[of 0] show ?thesis | |
| 503 | by auto | |
| 47082 | 504 | next | 
| 53873 | 505 | case MInf | 
| 506 | then show ?thesis | |
| 507 | by simp | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 508 | qed | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 509 | |
| 43920 | 510 | lemma ereal_top: | 
| 53873 | 511 | fixes x :: ereal | 
| 512 | assumes "\<And>B. x \<ge> ereal B" | |
| 513 | shows "x = \<infinity>" | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 514 | proof (cases x) | 
| 53873 | 515 | case (real r) | 
| 516 | with assms[of "r + 1"] show ?thesis | |
| 517 | by auto | |
| 47082 | 518 | next | 
| 53873 | 519 | case MInf | 
| 520 | with assms[of 0] show ?thesis | |
| 521 | by auto | |
| 47082 | 522 | next | 
| 53873 | 523 | case PInf | 
| 524 | then show ?thesis | |
| 525 | by simp | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 526 | qed | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 527 | |
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 528 | lemma | 
| 43920 | 529 | shows ereal_max[simp]: "ereal (max x y) = max (ereal x) (ereal y)" | 
| 530 | and ereal_min[simp]: "ereal (min x y) = min (ereal x) (ereal y)" | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 531 | by (simp_all add: min_def max_def) | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 532 | |
| 43920 | 533 | lemma ereal_max_0: "max 0 (ereal r) = ereal (max 0 r)" | 
| 534 | by (auto simp: zero_ereal_def) | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 535 | |
| 41978 | 536 | lemma | 
| 43920 | 537 | fixes f :: "nat \<Rightarrow> ereal" | 
| 54416 | 538 | shows ereal_incseq_uminus[simp]: "incseq (\<lambda>x. - f x) \<longleftrightarrow> decseq f" | 
| 539 | and ereal_decseq_uminus[simp]: "decseq (\<lambda>x. - f x) \<longleftrightarrow> incseq f" | |
| 41978 | 540 | unfolding decseq_def incseq_def by auto | 
| 541 | ||
| 43920 | 542 | lemma incseq_ereal: "incseq f \<Longrightarrow> incseq (\<lambda>x. ereal (f x))" | 
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 543 | unfolding incseq_def by auto | 
| 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 544 | |
| 56537 | 545 | lemma ereal_add_nonneg_nonneg[simp]: | 
| 53873 | 546 | fixes a b :: ereal | 
| 547 | shows "0 \<le> a \<Longrightarrow> 0 \<le> b \<Longrightarrow> 0 \<le> a + b" | |
| 41978 | 548 | using add_mono[of 0 a 0 b] by simp | 
| 549 | ||
| 53873 | 550 | lemma image_eqD: "f ` A = B \<Longrightarrow> \<forall>x\<in>A. f x \<in> B" | 
| 41978 | 551 | by auto | 
| 552 | ||
| 553 | lemma incseq_setsumI: | |
| 53873 | 554 |   fixes f :: "nat \<Rightarrow> 'a::{comm_monoid_add,ordered_ab_semigroup_add}"
 | 
| 41978 | 555 | assumes "\<And>i. 0 \<le> f i" | 
| 556 |   shows "incseq (\<lambda>i. setsum f {..< i})"
 | |
| 557 | proof (intro incseq_SucI) | |
| 53873 | 558 | fix n | 
| 559 |   have "setsum f {..< n} + 0 \<le> setsum f {..<n} + f n"
 | |
| 41978 | 560 | using assms by (rule add_left_mono) | 
| 561 |   then show "setsum f {..< n} \<le> setsum f {..< Suc n}"
 | |
| 562 | by auto | |
| 563 | qed | |
| 564 | ||
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 565 | lemma incseq_setsumI2: | 
| 53873 | 566 |   fixes f :: "'i \<Rightarrow> nat \<Rightarrow> 'a::{comm_monoid_add,ordered_ab_semigroup_add}"
 | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 567 | assumes "\<And>n. n \<in> A \<Longrightarrow> incseq (f n)" | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 568 | shows "incseq (\<lambda>i. \<Sum>n\<in>A. f n i)" | 
| 53873 | 569 | using assms | 
| 570 | unfolding incseq_def by (auto intro: setsum_mono) | |
| 571 | ||
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 572 | |
| 41973 | 573 | subsubsection "Multiplication" | 
| 574 | ||
| 53873 | 575 | instantiation ereal :: "{comm_monoid_mult,sgn}"
 | 
| 41973 | 576 | begin | 
| 577 | ||
| 51351 | 578 | function sgn_ereal :: "ereal \<Rightarrow> ereal" where | 
| 43920 | 579 | "sgn (ereal r) = ereal (sgn r)" | 
| 43923 | 580 | | "sgn (\<infinity>::ereal) = 1" | 
| 581 | | "sgn (-\<infinity>::ereal) = -1" | |
| 43920 | 582 | by (auto intro: ereal_cases) | 
| 53873 | 583 | termination by default (rule wf_empty) | 
| 41976 | 584 | |
| 43920 | 585 | function times_ereal where | 
| 53873 | 586 | "ereal r * ereal p = ereal (r * p)" | 
| 587 | | "ereal r * \<infinity> = (if r = 0 then 0 else if r > 0 then \<infinity> else -\<infinity>)" | |
| 588 | | "\<infinity> * ereal r = (if r = 0 then 0 else if r > 0 then \<infinity> else -\<infinity>)" | |
| 589 | | "ereal r * -\<infinity> = (if r = 0 then 0 else if r > 0 then -\<infinity> else \<infinity>)" | |
| 590 | | "-\<infinity> * ereal r = (if r = 0 then 0 else if r > 0 then -\<infinity> else \<infinity>)" | |
| 591 | | "(\<infinity>::ereal) * \<infinity> = \<infinity>" | |
| 592 | | "-(\<infinity>::ereal) * \<infinity> = -\<infinity>" | |
| 593 | | "(\<infinity>::ereal) * -\<infinity> = -\<infinity>" | |
| 594 | | "-(\<infinity>::ereal) * -\<infinity> = \<infinity>" | |
| 41973 | 595 | proof - | 
| 596 | case (goal1 P x) | |
| 53873 | 597 | then obtain a b where "x = (a, b)" | 
| 598 | by (cases x) auto | |
| 599 | with goal1 show P | |
| 600 | by (cases rule: ereal2_cases[of a b]) auto | |
| 41973 | 601 | qed simp_all | 
| 602 | termination by (relation "{}") simp
 | |
| 603 | ||
| 604 | instance | |
| 605 | proof | |
| 53873 | 606 | fix a b c :: ereal | 
| 607 | show "1 * a = a" | |
| 43920 | 608 | by (cases a) (simp_all add: one_ereal_def) | 
| 47082 | 609 | show "a * b = b * a" | 
| 43920 | 610 | by (cases rule: ereal2_cases[of a b]) simp_all | 
| 47082 | 611 | show "a * b * c = a * (b * c)" | 
| 43920 | 612 | by (cases rule: ereal3_cases[of a b c]) | 
| 613 | (simp_all add: zero_ereal_def zero_less_mult_iff) | |
| 41973 | 614 | qed | 
| 53873 | 615 | |
| 41973 | 616 | end | 
| 617 | ||
| 50104 | 618 | lemma real_ereal_1[simp]: "real (1::ereal) = 1" | 
| 619 | unfolding one_ereal_def by simp | |
| 620 | ||
| 43920 | 621 | lemma real_of_ereal_le_1: | 
| 53873 | 622 | fixes a :: ereal | 
| 623 | shows "a \<le> 1 \<Longrightarrow> real a \<le> 1" | |
| 43920 | 624 | by (cases a) (auto simp: one_ereal_def) | 
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 625 | |
| 43920 | 626 | lemma abs_ereal_one[simp]: "\<bar>1\<bar> = (1::ereal)" | 
| 627 | unfolding one_ereal_def by simp | |
| 41976 | 628 | |
| 43920 | 629 | lemma ereal_mult_zero[simp]: | 
| 53873 | 630 | fixes a :: ereal | 
| 631 | shows "a * 0 = 0" | |
| 43920 | 632 | by (cases a) (simp_all add: zero_ereal_def) | 
| 41973 | 633 | |
| 43920 | 634 | lemma ereal_zero_mult[simp]: | 
| 53873 | 635 | fixes a :: ereal | 
| 636 | shows "0 * a = 0" | |
| 43920 | 637 | by (cases a) (simp_all add: zero_ereal_def) | 
| 41973 | 638 | |
| 53873 | 639 | lemma ereal_m1_less_0[simp]: "-(1::ereal) < 0" | 
| 43920 | 640 | by (simp add: zero_ereal_def one_ereal_def) | 
| 41973 | 641 | |
| 43920 | 642 | lemma ereal_times[simp]: | 
| 43923 | 643 | "1 \<noteq> (\<infinity>::ereal)" "(\<infinity>::ereal) \<noteq> 1" | 
| 644 | "1 \<noteq> -(\<infinity>::ereal)" "-(\<infinity>::ereal) \<noteq> 1" | |
| 43920 | 645 | by (auto simp add: times_ereal_def one_ereal_def) | 
| 41973 | 646 | |
| 43920 | 647 | lemma ereal_plus_1[simp]: | 
| 53873 | 648 | "1 + ereal r = ereal (r + 1)" | 
| 649 | "ereal r + 1 = ereal (r + 1)" | |
| 650 | "1 + -(\<infinity>::ereal) = -\<infinity>" | |
| 651 | "-(\<infinity>::ereal) + 1 = -\<infinity>" | |
| 43920 | 652 | unfolding one_ereal_def by auto | 
| 41973 | 653 | |
| 43920 | 654 | lemma ereal_zero_times[simp]: | 
| 53873 | 655 | fixes a b :: ereal | 
| 656 | shows "a * b = 0 \<longleftrightarrow> a = 0 \<or> b = 0" | |
| 43920 | 657 | by (cases rule: ereal2_cases[of a b]) auto | 
| 41973 | 658 | |
| 43920 | 659 | lemma ereal_mult_eq_PInfty[simp]: | 
| 53873 | 660 | "a * b = (\<infinity>::ereal) \<longleftrightarrow> | 
| 41973 | 661 | (a = \<infinity> \<and> b > 0) \<or> (a > 0 \<and> b = \<infinity>) \<or> (a = -\<infinity> \<and> b < 0) \<or> (a < 0 \<and> b = -\<infinity>)" | 
| 43920 | 662 | by (cases rule: ereal2_cases[of a b]) auto | 
| 41973 | 663 | |
| 43920 | 664 | lemma ereal_mult_eq_MInfty[simp]: | 
| 53873 | 665 | "a * b = -(\<infinity>::ereal) \<longleftrightarrow> | 
| 41973 | 666 | (a = \<infinity> \<and> b < 0) \<or> (a < 0 \<and> b = \<infinity>) \<or> (a = -\<infinity> \<and> b > 0) \<or> (a > 0 \<and> b = -\<infinity>)" | 
| 43920 | 667 | by (cases rule: ereal2_cases[of a b]) auto | 
| 41973 | 668 | |
| 54416 | 669 | lemma ereal_abs_mult: "\<bar>x * y :: ereal\<bar> = \<bar>x\<bar> * \<bar>y\<bar>" | 
| 670 | by (cases x y rule: ereal2_cases) (auto simp: abs_mult) | |
| 671 | ||
| 43920 | 672 | lemma ereal_0_less_1[simp]: "0 < (1::ereal)" | 
| 673 | by (simp_all add: zero_ereal_def one_ereal_def) | |
| 41973 | 674 | |
| 43920 | 675 | lemma ereal_mult_minus_left[simp]: | 
| 53873 | 676 | fixes a b :: ereal | 
| 677 | shows "-a * b = - (a * b)" | |
| 43920 | 678 | by (cases rule: ereal2_cases[of a b]) auto | 
| 41973 | 679 | |
| 43920 | 680 | lemma ereal_mult_minus_right[simp]: | 
| 53873 | 681 | fixes a b :: ereal | 
| 682 | shows "a * -b = - (a * b)" | |
| 43920 | 683 | by (cases rule: ereal2_cases[of a b]) auto | 
| 41973 | 684 | |
| 43920 | 685 | lemma ereal_mult_infty[simp]: | 
| 43923 | 686 | "a * (\<infinity>::ereal) = (if a = 0 then 0 else if 0 < a then \<infinity> else - \<infinity>)" | 
| 41973 | 687 | by (cases a) auto | 
| 688 | ||
| 43920 | 689 | lemma ereal_infty_mult[simp]: | 
| 43923 | 690 | "(\<infinity>::ereal) * a = (if a = 0 then 0 else if 0 < a then \<infinity> else - \<infinity>)" | 
| 41973 | 691 | by (cases a) auto | 
| 692 | ||
| 43920 | 693 | lemma ereal_mult_strict_right_mono: | 
| 53873 | 694 | assumes "a < b" | 
| 695 | and "0 < c" | |
| 696 | and "c < (\<infinity>::ereal)" | |
| 41973 | 697 | shows "a * c < b * c" | 
| 698 | using assms | |
| 53873 | 699 | by (cases rule: ereal3_cases[of a b c]) (auto simp: zero_le_mult_iff) | 
| 41973 | 700 | |
| 43920 | 701 | lemma ereal_mult_strict_left_mono: | 
| 53873 | 702 | "a < b \<Longrightarrow> 0 < c \<Longrightarrow> c < (\<infinity>::ereal) \<Longrightarrow> c * a < c * b" | 
| 703 | using ereal_mult_strict_right_mono | |
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
57447diff
changeset | 704 | by (simp add: mult.commute[of c]) | 
| 41973 | 705 | |
| 43920 | 706 | lemma ereal_mult_right_mono: | 
| 53873 | 707 | fixes a b c :: ereal | 
| 708 | shows "a \<le> b \<Longrightarrow> 0 \<le> c \<Longrightarrow> a * c \<le> b * c" | |
| 41973 | 709 | using assms | 
| 53873 | 710 | apply (cases "c = 0") | 
| 711 | apply simp | |
| 712 | apply (cases rule: ereal3_cases[of a b c]) | |
| 713 | apply (auto simp: zero_le_mult_iff) | |
| 714 | done | |
| 41973 | 715 | |
| 43920 | 716 | lemma ereal_mult_left_mono: | 
| 53873 | 717 | fixes a b c :: ereal | 
| 718 | shows "a \<le> b \<Longrightarrow> 0 \<le> c \<Longrightarrow> c * a \<le> c * b" | |
| 719 | using ereal_mult_right_mono | |
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
57447diff
changeset | 720 | by (simp add: mult.commute[of c]) | 
| 41973 | 721 | |
| 43920 | 722 | lemma zero_less_one_ereal[simp]: "0 \<le> (1::ereal)" | 
| 723 | by (simp add: one_ereal_def zero_ereal_def) | |
| 41978 | 724 | |
| 43920 | 725 | lemma ereal_0_le_mult[simp]: "0 \<le> a \<Longrightarrow> 0 \<le> b \<Longrightarrow> 0 \<le> a * (b :: ereal)" | 
| 56536 | 726 | by (cases rule: ereal2_cases[of a b]) auto | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 727 | |
| 43920 | 728 | lemma ereal_right_distrib: | 
| 53873 | 729 | fixes r a b :: ereal | 
| 730 | shows "0 \<le> a \<Longrightarrow> 0 \<le> b \<Longrightarrow> r * (a + b) = r * a + r * b" | |
| 43920 | 731 | by (cases rule: ereal3_cases[of r a b]) (simp_all add: field_simps) | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 732 | |
| 43920 | 733 | lemma ereal_left_distrib: | 
| 53873 | 734 | fixes r a b :: ereal | 
| 735 | shows "0 \<le> a \<Longrightarrow> 0 \<le> b \<Longrightarrow> (a + b) * r = a * r + b * r" | |
| 43920 | 736 | by (cases rule: ereal3_cases[of r a b]) (simp_all add: field_simps) | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 737 | |
| 43920 | 738 | lemma ereal_mult_le_0_iff: | 
| 739 | fixes a b :: ereal | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 740 | shows "a * b \<le> 0 \<longleftrightarrow> (0 \<le> a \<and> b \<le> 0) \<or> (a \<le> 0 \<and> 0 \<le> b)" | 
| 43920 | 741 | by (cases rule: ereal2_cases[of a b]) (simp_all add: mult_le_0_iff) | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 742 | |
| 43920 | 743 | lemma ereal_zero_le_0_iff: | 
| 744 | fixes a b :: ereal | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 745 | shows "0 \<le> a * b \<longleftrightarrow> (0 \<le> a \<and> 0 \<le> b) \<or> (a \<le> 0 \<and> b \<le> 0)" | 
| 43920 | 746 | by (cases rule: ereal2_cases[of a b]) (simp_all add: zero_le_mult_iff) | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 747 | |
| 43920 | 748 | lemma ereal_mult_less_0_iff: | 
| 749 | fixes a b :: ereal | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 750 | shows "a * b < 0 \<longleftrightarrow> (0 < a \<and> b < 0) \<or> (a < 0 \<and> 0 < b)" | 
| 43920 | 751 | by (cases rule: ereal2_cases[of a b]) (simp_all add: mult_less_0_iff) | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 752 | |
| 43920 | 753 | lemma ereal_zero_less_0_iff: | 
| 754 | fixes a b :: ereal | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 755 | shows "0 < a * b \<longleftrightarrow> (0 < a \<and> 0 < b) \<or> (a < 0 \<and> b < 0)" | 
| 43920 | 756 | by (cases rule: ereal2_cases[of a b]) (simp_all add: zero_less_mult_iff) | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 757 | |
| 50104 | 758 | lemma ereal_left_mult_cong: | 
| 759 | fixes a b c :: ereal | |
| 760 | shows "(c \<noteq> 0 \<Longrightarrow> a = b) \<Longrightarrow> c * a = c * b" | |
| 761 | by (cases "c = 0") simp_all | |
| 762 | ||
| 763 | lemma ereal_right_mult_cong: | |
| 764 | fixes a b c :: ereal | |
| 765 | shows "(c \<noteq> 0 \<Longrightarrow> a = b) \<Longrightarrow> a * c = b * c" | |
| 766 | by (cases "c = 0") simp_all | |
| 767 | ||
| 43920 | 768 | lemma ereal_distrib: | 
| 769 | fixes a b c :: ereal | |
| 53873 | 770 | assumes "a \<noteq> \<infinity> \<or> b \<noteq> -\<infinity>" | 
| 771 | and "a \<noteq> -\<infinity> \<or> b \<noteq> \<infinity>" | |
| 772 | and "\<bar>c\<bar> \<noteq> \<infinity>" | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 773 | shows "(a + b) * c = a * c + b * c" | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 774 | using assms | 
| 43920 | 775 | by (cases rule: ereal3_cases[of a b c]) (simp_all add: field_simps) | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 776 | |
| 47108 
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
 huffman parents: 
47082diff
changeset | 777 | lemma numeral_eq_ereal [simp]: "numeral w = ereal (numeral w)" | 
| 
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
 huffman parents: 
47082diff
changeset | 778 | apply (induct w rule: num_induct) | 
| 
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
 huffman parents: 
47082diff
changeset | 779 | apply (simp only: numeral_One one_ereal_def) | 
| 
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
 huffman parents: 
47082diff
changeset | 780 | apply (simp only: numeral_inc ereal_plus_1) | 
| 
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
 huffman parents: 
47082diff
changeset | 781 | done | 
| 
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
 huffman parents: 
47082diff
changeset | 782 | |
| 43920 | 783 | lemma ereal_le_epsilon: | 
| 784 | fixes x y :: ereal | |
| 53873 | 785 | assumes "\<forall>e. 0 < e \<longrightarrow> x \<le> y + e" | 
| 786 | shows "x \<le> y" | |
| 787 | proof - | |
| 788 |   {
 | |
| 789 | assume a: "\<exists>r. y = ereal r" | |
| 790 | then obtain r where r_def: "y = ereal r" | |
| 791 | by auto | |
| 792 |     {
 | |
| 793 | assume "x = -\<infinity>" | |
| 794 | then have ?thesis by auto | |
| 795 | } | |
| 796 | moreover | |
| 797 |     {
 | |
| 798 | assume "x \<noteq> -\<infinity>" | |
| 799 | then obtain p where p_def: "x = ereal p" | |
| 800 | using a assms[rule_format, of 1] | |
| 801 | by (cases x) auto | |
| 802 |       {
 | |
| 803 | fix e | |
| 804 | have "0 < e \<longrightarrow> p \<le> r + e" | |
| 805 | using assms[rule_format, of "ereal e"] p_def r_def by auto | |
| 806 | } | |
| 807 | then have "p \<le> r" | |
| 808 | apply (subst field_le_epsilon) | |
| 809 | apply auto | |
| 810 | done | |
| 811 | then have ?thesis | |
| 812 | using r_def p_def by auto | |
| 813 | } | |
| 814 | ultimately have ?thesis | |
| 815 | by blast | |
| 816 | } | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 817 | moreover | 
| 53873 | 818 |   {
 | 
| 819 | assume "y = -\<infinity> | y = \<infinity>" | |
| 820 | then have ?thesis | |
| 821 | using assms[rule_format, of 1] by (cases x) auto | |
| 822 | } | |
| 823 | ultimately show ?thesis | |
| 824 | by (cases y) auto | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 825 | qed | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 826 | |
| 43920 | 827 | lemma ereal_le_epsilon2: | 
| 828 | fixes x y :: ereal | |
| 53873 | 829 | assumes "\<forall>e. 0 < e \<longrightarrow> x \<le> y + ereal e" | 
| 830 | shows "x \<le> y" | |
| 831 | proof - | |
| 832 |   {
 | |
| 833 | fix e :: ereal | |
| 834 | assume "e > 0" | |
| 835 |     {
 | |
| 836 | assume "e = \<infinity>" | |
| 837 | then have "x \<le> y + e" | |
| 838 | by auto | |
| 839 | } | |
| 840 | moreover | |
| 841 |     {
 | |
| 842 | assume "e \<noteq> \<infinity>" | |
| 843 | then obtain r where "e = ereal r" | |
| 844 | using `e > 0` by (cases e) auto | |
| 845 | then have "x \<le> y + e" | |
| 846 | using assms[rule_format, of r] `e>0` by auto | |
| 847 | } | |
| 848 | ultimately have "x \<le> y + e" | |
| 849 | by blast | |
| 850 | } | |
| 851 | then show ?thesis | |
| 852 | using ereal_le_epsilon by auto | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 853 | qed | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 854 | |
| 43920 | 855 | lemma ereal_le_real: | 
| 856 | fixes x y :: ereal | |
| 53873 | 857 | assumes "\<forall>z. x \<le> ereal z \<longrightarrow> y \<le> ereal z" | 
| 858 | shows "y \<le> x" | |
| 859 | by (metis assms ereal_bot ereal_cases ereal_infty_less_eq(2) ereal_less_eq(1) linorder_le_cases) | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 860 | |
| 43920 | 861 | lemma setprod_ereal_0: | 
| 862 | fixes f :: "'a \<Rightarrow> ereal" | |
| 53873 | 863 | shows "(\<Prod>i\<in>A. f i) = 0 \<longleftrightarrow> finite A \<and> (\<exists>i\<in>A. f i = 0)" | 
| 864 | proof (cases "finite A") | |
| 865 | case True | |
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 866 | then show ?thesis by (induct A) auto | 
| 53873 | 867 | next | 
| 868 | case False | |
| 869 | then show ?thesis by auto | |
| 870 | qed | |
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 871 | |
| 43920 | 872 | lemma setprod_ereal_pos: | 
| 53873 | 873 | fixes f :: "'a \<Rightarrow> ereal" | 
| 874 | assumes pos: "\<And>i. i \<in> I \<Longrightarrow> 0 \<le> f i" | |
| 875 | shows "0 \<le> (\<Prod>i\<in>I. f i)" | |
| 876 | proof (cases "finite I") | |
| 877 | case True | |
| 878 | from this pos show ?thesis | |
| 879 | by induct auto | |
| 880 | next | |
| 881 | case False | |
| 882 | then show ?thesis by simp | |
| 883 | qed | |
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 884 | |
| 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 885 | lemma setprod_PInf: | 
| 43923 | 886 | fixes f :: "'a \<Rightarrow> ereal" | 
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 887 | assumes "\<And>i. i \<in> I \<Longrightarrow> 0 \<le> f i" | 
| 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 888 | shows "(\<Prod>i\<in>I. f i) = \<infinity> \<longleftrightarrow> finite I \<and> (\<exists>i\<in>I. f i = \<infinity>) \<and> (\<forall>i\<in>I. f i \<noteq> 0)" | 
| 53873 | 889 | proof (cases "finite I") | 
| 890 | case True | |
| 891 | from this assms show ?thesis | |
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 892 | proof (induct I) | 
| 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 893 | case (insert i I) | 
| 53873 | 894 | then have pos: "0 \<le> f i" "0 \<le> setprod f I" | 
| 895 | by (auto intro!: setprod_ereal_pos) | |
| 896 | from insert have "(\<Prod>j\<in>insert i I. f j) = \<infinity> \<longleftrightarrow> setprod f I * f i = \<infinity>" | |
| 897 | by auto | |
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 898 | also have "\<dots> \<longleftrightarrow> (setprod f I = \<infinity> \<or> f i = \<infinity>) \<and> f i \<noteq> 0 \<and> setprod f I \<noteq> 0" | 
| 43920 | 899 | using setprod_ereal_pos[of I f] pos | 
| 900 | by (cases rule: ereal2_cases[of "f i" "setprod f I"]) auto | |
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 901 | also have "\<dots> \<longleftrightarrow> finite (insert i I) \<and> (\<exists>j\<in>insert i I. f j = \<infinity>) \<and> (\<forall>j\<in>insert i I. f j \<noteq> 0)" | 
| 43920 | 902 | using insert by (auto simp: setprod_ereal_0) | 
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 903 | finally show ?case . | 
| 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 904 | qed simp | 
| 53873 | 905 | next | 
| 906 | case False | |
| 907 | then show ?thesis by simp | |
| 908 | qed | |
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 909 | |
| 43920 | 910 | lemma setprod_ereal: "(\<Prod>i\<in>A. ereal (f i)) = ereal (setprod f A)" | 
| 53873 | 911 | proof (cases "finite A") | 
| 912 | case True | |
| 913 | then show ?thesis | |
| 43920 | 914 | by induct (auto simp: one_ereal_def) | 
| 53873 | 915 | next | 
| 916 | case False | |
| 917 | then show ?thesis | |
| 918 | by (simp add: one_ereal_def) | |
| 919 | qed | |
| 920 | ||
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 921 | |
| 41978 | 922 | subsubsection {* Power *}
 | 
| 923 | ||
| 43920 | 924 | lemma ereal_power[simp]: "(ereal x) ^ n = ereal (x^n)" | 
| 925 | by (induct n) (auto simp: one_ereal_def) | |
| 41978 | 926 | |
| 43923 | 927 | lemma ereal_power_PInf[simp]: "(\<infinity>::ereal) ^ n = (if n = 0 then 1 else \<infinity>)" | 
| 43920 | 928 | by (induct n) (auto simp: one_ereal_def) | 
| 41978 | 929 | |
| 43920 | 930 | lemma ereal_power_uminus[simp]: | 
| 931 | fixes x :: ereal | |
| 41978 | 932 | shows "(- x) ^ n = (if even n then x ^ n else - (x^n))" | 
| 43920 | 933 | by (induct n) (auto simp: one_ereal_def) | 
| 41978 | 934 | |
| 47108 
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
 huffman parents: 
47082diff
changeset | 935 | lemma ereal_power_numeral[simp]: | 
| 
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
 huffman parents: 
47082diff
changeset | 936 | "(numeral num :: ereal) ^ n = ereal (numeral num ^ n)" | 
| 43920 | 937 | by (induct n) (auto simp: one_ereal_def) | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 938 | |
| 43920 | 939 | lemma zero_le_power_ereal[simp]: | 
| 53873 | 940 | fixes a :: ereal | 
| 941 | assumes "0 \<le> a" | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 942 | shows "0 \<le> a ^ n" | 
| 43920 | 943 | using assms by (induct n) (auto simp: ereal_zero_le_0_iff) | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 944 | |
| 53873 | 945 | |
| 41973 | 946 | subsubsection {* Subtraction *}
 | 
| 947 | ||
| 43920 | 948 | lemma ereal_minus_minus_image[simp]: | 
| 949 | fixes S :: "ereal set" | |
| 41973 | 950 | shows "uminus ` uminus ` S = S" | 
| 951 | by (auto simp: image_iff) | |
| 952 | ||
| 43920 | 953 | lemma ereal_uminus_lessThan[simp]: | 
| 53873 | 954 | fixes a :: ereal | 
| 955 |   shows "uminus ` {..<a} = {-a<..}"
 | |
| 47082 | 956 | proof - | 
| 957 |   {
 | |
| 53873 | 958 | fix x | 
| 959 | assume "-a < x" | |
| 960 | then have "- x < - (- a)" | |
| 961 | by (simp del: ereal_uminus_uminus) | |
| 962 | then have "- x < a" | |
| 963 | by simp | |
| 47082 | 964 | } | 
| 53873 | 965 | then show ?thesis | 
| 54416 | 966 | by force | 
| 47082 | 967 | qed | 
| 41973 | 968 | |
| 53873 | 969 | lemma ereal_uminus_greaterThan[simp]: "uminus ` {(a::ereal)<..} = {..<-a}"
 | 
| 970 | by (metis ereal_uminus_lessThan ereal_uminus_uminus ereal_minus_minus_image) | |
| 41973 | 971 | |
| 43920 | 972 | instantiation ereal :: minus | 
| 41973 | 973 | begin | 
| 53873 | 974 | |
| 43920 | 975 | definition "x - y = x + -(y::ereal)" | 
| 41973 | 976 | instance .. | 
| 53873 | 977 | |
| 41973 | 978 | end | 
| 979 | ||
| 43920 | 980 | lemma ereal_minus[simp]: | 
| 981 | "ereal r - ereal p = ereal (r - p)" | |
| 982 | "-\<infinity> - ereal r = -\<infinity>" | |
| 983 | "ereal r - \<infinity> = -\<infinity>" | |
| 43923 | 984 | "(\<infinity>::ereal) - x = \<infinity>" | 
| 985 | "-(\<infinity>::ereal) - \<infinity> = -\<infinity>" | |
| 41973 | 986 | "x - -y = x + y" | 
| 987 | "x - 0 = x" | |
| 988 | "0 - x = -x" | |
| 43920 | 989 | by (simp_all add: minus_ereal_def) | 
| 41973 | 990 | |
| 53873 | 991 | lemma ereal_x_minus_x[simp]: "x - x = (if \<bar>x\<bar> = \<infinity> then \<infinity> else 0::ereal)" | 
| 41973 | 992 | by (cases x) simp_all | 
| 993 | ||
| 43920 | 994 | lemma ereal_eq_minus_iff: | 
| 995 | fixes x y z :: ereal | |
| 41973 | 996 | shows "x = z - y \<longleftrightarrow> | 
| 41976 | 997 | (\<bar>y\<bar> \<noteq> \<infinity> \<longrightarrow> x + y = z) \<and> | 
| 41973 | 998 | (y = -\<infinity> \<longrightarrow> x = \<infinity>) \<and> | 
| 999 | (y = \<infinity> \<longrightarrow> z = \<infinity> \<longrightarrow> x = \<infinity>) \<and> | |
| 1000 | (y = \<infinity> \<longrightarrow> z \<noteq> \<infinity> \<longrightarrow> x = -\<infinity>)" | |
| 43920 | 1001 | by (cases rule: ereal3_cases[of x y z]) auto | 
| 41973 | 1002 | |
| 43920 | 1003 | lemma ereal_eq_minus: | 
| 1004 | fixes x y z :: ereal | |
| 41976 | 1005 | shows "\<bar>y\<bar> \<noteq> \<infinity> \<Longrightarrow> x = z - y \<longleftrightarrow> x + y = z" | 
| 43920 | 1006 | by (auto simp: ereal_eq_minus_iff) | 
| 41973 | 1007 | |
| 43920 | 1008 | lemma ereal_less_minus_iff: | 
| 1009 | fixes x y z :: ereal | |
| 41973 | 1010 | shows "x < z - y \<longleftrightarrow> | 
| 1011 | (y = \<infinity> \<longrightarrow> z = \<infinity> \<and> x \<noteq> \<infinity>) \<and> | |
| 1012 | (y = -\<infinity> \<longrightarrow> x \<noteq> \<infinity>) \<and> | |
| 41976 | 1013 | (\<bar>y\<bar> \<noteq> \<infinity>\<longrightarrow> x + y < z)" | 
| 43920 | 1014 | by (cases rule: ereal3_cases[of x y z]) auto | 
| 41973 | 1015 | |
| 43920 | 1016 | lemma ereal_less_minus: | 
| 1017 | fixes x y z :: ereal | |
| 41976 | 1018 | shows "\<bar>y\<bar> \<noteq> \<infinity> \<Longrightarrow> x < z - y \<longleftrightarrow> x + y < z" | 
| 43920 | 1019 | by (auto simp: ereal_less_minus_iff) | 
| 41973 | 1020 | |
| 43920 | 1021 | lemma ereal_le_minus_iff: | 
| 1022 | fixes x y z :: ereal | |
| 53873 | 1023 | shows "x \<le> z - y \<longleftrightarrow> (y = \<infinity> \<longrightarrow> z \<noteq> \<infinity> \<longrightarrow> x = -\<infinity>) \<and> (\<bar>y\<bar> \<noteq> \<infinity> \<longrightarrow> x + y \<le> z)" | 
| 43920 | 1024 | by (cases rule: ereal3_cases[of x y z]) auto | 
| 41973 | 1025 | |
| 43920 | 1026 | lemma ereal_le_minus: | 
| 1027 | fixes x y z :: ereal | |
| 41976 | 1028 | shows "\<bar>y\<bar> \<noteq> \<infinity> \<Longrightarrow> x \<le> z - y \<longleftrightarrow> x + y \<le> z" | 
| 43920 | 1029 | by (auto simp: ereal_le_minus_iff) | 
| 41973 | 1030 | |
| 43920 | 1031 | lemma ereal_minus_less_iff: | 
| 1032 | fixes x y z :: ereal | |
| 53873 | 1033 | shows "x - y < z \<longleftrightarrow> y \<noteq> -\<infinity> \<and> (y = \<infinity> \<longrightarrow> x \<noteq> \<infinity> \<and> z \<noteq> -\<infinity>) \<and> (y \<noteq> \<infinity> \<longrightarrow> x < z + y)" | 
| 43920 | 1034 | by (cases rule: ereal3_cases[of x y z]) auto | 
| 41973 | 1035 | |
| 43920 | 1036 | lemma ereal_minus_less: | 
| 1037 | fixes x y z :: ereal | |
| 41976 | 1038 | shows "\<bar>y\<bar> \<noteq> \<infinity> \<Longrightarrow> x - y < z \<longleftrightarrow> x < z + y" | 
| 43920 | 1039 | by (auto simp: ereal_minus_less_iff) | 
| 41973 | 1040 | |
| 43920 | 1041 | lemma ereal_minus_le_iff: | 
| 1042 | fixes x y z :: ereal | |
| 41973 | 1043 | shows "x - y \<le> z \<longleftrightarrow> | 
| 1044 | (y = -\<infinity> \<longrightarrow> z = \<infinity>) \<and> | |
| 1045 | (y = \<infinity> \<longrightarrow> x = \<infinity> \<longrightarrow> z = \<infinity>) \<and> | |
| 41976 | 1046 | (\<bar>y\<bar> \<noteq> \<infinity> \<longrightarrow> x \<le> z + y)" | 
| 43920 | 1047 | by (cases rule: ereal3_cases[of x y z]) auto | 
| 41973 | 1048 | |
| 43920 | 1049 | lemma ereal_minus_le: | 
| 1050 | fixes x y z :: ereal | |
| 41976 | 1051 | shows "\<bar>y\<bar> \<noteq> \<infinity> \<Longrightarrow> x - y \<le> z \<longleftrightarrow> x \<le> z + y" | 
| 43920 | 1052 | by (auto simp: ereal_minus_le_iff) | 
| 41973 | 1053 | |
| 43920 | 1054 | lemma ereal_minus_eq_minus_iff: | 
| 1055 | fixes a b c :: ereal | |
| 41973 | 1056 | shows "a - b = a - c \<longleftrightarrow> | 
| 1057 | b = c \<or> a = \<infinity> \<or> (a = -\<infinity> \<and> b \<noteq> -\<infinity> \<and> c \<noteq> -\<infinity>)" | |
| 43920 | 1058 | by (cases rule: ereal3_cases[of a b c]) auto | 
| 41973 | 1059 | |
| 43920 | 1060 | lemma ereal_add_le_add_iff: | 
| 43923 | 1061 | fixes a b c :: ereal | 
| 1062 | shows "c + a \<le> c + b \<longleftrightarrow> | |
| 41973 | 1063 | a \<le> b \<or> c = \<infinity> \<or> (c = -\<infinity> \<and> a \<noteq> \<infinity> \<and> b \<noteq> \<infinity>)" | 
| 43920 | 1064 | by (cases rule: ereal3_cases[of a b c]) (simp_all add: field_simps) | 
| 41973 | 1065 | |
| 43920 | 1066 | lemma ereal_mult_le_mult_iff: | 
| 43923 | 1067 | fixes a b c :: ereal | 
| 1068 | shows "\<bar>c\<bar> \<noteq> \<infinity> \<Longrightarrow> c * a \<le> c * b \<longleftrightarrow> (0 < c \<longrightarrow> a \<le> b) \<and> (c < 0 \<longrightarrow> b \<le> a)" | |
| 43920 | 1069 | by (cases rule: ereal3_cases[of a b c]) (simp_all add: mult_le_cancel_left) | 
| 41973 | 1070 | |
| 43920 | 1071 | lemma ereal_minus_mono: | 
| 1072 | fixes A B C D :: ereal assumes "A \<le> B" "D \<le> C" | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1073 | shows "A - C \<le> B - D" | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1074 | using assms | 
| 43920 | 1075 | by (cases rule: ereal3_cases[case_product ereal_cases, of A B C D]) simp_all | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1076 | |
| 43920 | 1077 | lemma real_of_ereal_minus: | 
| 43923 | 1078 | fixes a b :: ereal | 
| 1079 | shows "real (a - b) = (if \<bar>a\<bar> = \<infinity> \<or> \<bar>b\<bar> = \<infinity> then 0 else real a - real b)" | |
| 43920 | 1080 | by (cases rule: ereal2_cases[of a b]) auto | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1081 | |
| 43920 | 1082 | lemma ereal_diff_positive: | 
| 1083 | fixes a b :: ereal shows "a \<le> b \<Longrightarrow> 0 \<le> b - a" | |
| 1084 | by (cases rule: ereal2_cases[of a b]) auto | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1085 | |
| 43920 | 1086 | lemma ereal_between: | 
| 1087 | fixes x e :: ereal | |
| 53873 | 1088 | assumes "\<bar>x\<bar> \<noteq> \<infinity>" | 
| 1089 | and "0 < e" | |
| 1090 | shows "x - e < x" | |
| 1091 | and "x < x + e" | |
| 1092 | using assms | |
| 1093 | apply (cases x, cases e) | |
| 1094 | apply auto | |
| 1095 | using assms | |
| 1096 | apply (cases x, cases e) | |
| 1097 | apply auto | |
| 1098 | done | |
| 41973 | 1099 | |
| 50104 | 1100 | lemma ereal_minus_eq_PInfty_iff: | 
| 53873 | 1101 | fixes x y :: ereal | 
| 1102 | shows "x - y = \<infinity> \<longleftrightarrow> y = -\<infinity> \<or> x = \<infinity>" | |
| 50104 | 1103 | by (cases x y rule: ereal2_cases) simp_all | 
| 1104 | ||
| 53873 | 1105 | |
| 41973 | 1106 | subsubsection {* Division *}
 | 
| 1107 | ||
| 43920 | 1108 | instantiation ereal :: inverse | 
| 41973 | 1109 | begin | 
| 1110 | ||
| 43920 | 1111 | function inverse_ereal where | 
| 53873 | 1112 | "inverse (ereal r) = (if r = 0 then \<infinity> else ereal (inverse r))" | 
| 1113 | | "inverse (\<infinity>::ereal) = 0" | |
| 1114 | | "inverse (-\<infinity>::ereal) = 0" | |
| 43920 | 1115 | by (auto intro: ereal_cases) | 
| 41973 | 1116 | termination by (relation "{}") simp
 | 
| 1117 | ||
| 43920 | 1118 | definition "x / y = x * inverse (y :: ereal)" | 
| 41973 | 1119 | |
| 47082 | 1120 | instance .. | 
| 53873 | 1121 | |
| 41973 | 1122 | end | 
| 1123 | ||
| 43920 | 1124 | lemma real_of_ereal_inverse[simp]: | 
| 1125 | fixes a :: ereal | |
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 1126 | shows "real (inverse a) = 1 / real a" | 
| 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 1127 | by (cases a) (auto simp: inverse_eq_divide) | 
| 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 1128 | |
| 43920 | 1129 | lemma ereal_inverse[simp]: | 
| 43923 | 1130 | "inverse (0::ereal) = \<infinity>" | 
| 43920 | 1131 | "inverse (1::ereal) = 1" | 
| 1132 | by (simp_all add: one_ereal_def zero_ereal_def) | |
| 41973 | 1133 | |
| 43920 | 1134 | lemma ereal_divide[simp]: | 
| 1135 | "ereal r / ereal p = (if p = 0 then ereal r * \<infinity> else ereal (r / p))" | |
| 1136 | unfolding divide_ereal_def by (auto simp: divide_real_def) | |
| 41973 | 1137 | |
| 43920 | 1138 | lemma ereal_divide_same[simp]: | 
| 53873 | 1139 | fixes x :: ereal | 
| 1140 | shows "x / x = (if \<bar>x\<bar> = \<infinity> \<or> x = 0 then 0 else 1)" | |
| 1141 | by (cases x) (simp_all add: divide_real_def divide_ereal_def one_ereal_def) | |
| 41973 | 1142 | |
| 43920 | 1143 | lemma ereal_inv_inv[simp]: | 
| 53873 | 1144 | fixes x :: ereal | 
| 1145 | shows "inverse (inverse x) = (if x \<noteq> -\<infinity> then x else \<infinity>)" | |
| 41973 | 1146 | by (cases x) auto | 
| 1147 | ||
| 43920 | 1148 | lemma ereal_inverse_minus[simp]: | 
| 53873 | 1149 | fixes x :: ereal | 
| 1150 | shows "inverse (- x) = (if x = 0 then \<infinity> else -inverse x)" | |
| 41973 | 1151 | by (cases x) simp_all | 
| 1152 | ||
| 43920 | 1153 | lemma ereal_uminus_divide[simp]: | 
| 53873 | 1154 | fixes x y :: ereal | 
| 1155 | shows "- x / y = - (x / y)" | |
| 43920 | 1156 | unfolding divide_ereal_def by simp | 
| 41973 | 1157 | |
| 43920 | 1158 | lemma ereal_divide_Infty[simp]: | 
| 53873 | 1159 | fixes x :: ereal | 
| 1160 | shows "x / \<infinity> = 0" "x / -\<infinity> = 0" | |
| 43920 | 1161 | unfolding divide_ereal_def by simp_all | 
| 41973 | 1162 | |
| 53873 | 1163 | lemma ereal_divide_one[simp]: "x / 1 = (x::ereal)" | 
| 43920 | 1164 | unfolding divide_ereal_def by simp | 
| 41973 | 1165 | |
| 53873 | 1166 | lemma ereal_divide_ereal[simp]: "\<infinity> / ereal r = (if 0 \<le> r then \<infinity> else -\<infinity>)" | 
| 43920 | 1167 | unfolding divide_ereal_def by simp | 
| 41973 | 1168 | |
| 43920 | 1169 | lemma zero_le_divide_ereal[simp]: | 
| 53873 | 1170 | fixes a :: ereal | 
| 1171 | assumes "0 \<le> a" | |
| 1172 | and "0 \<le> b" | |
| 41978 | 1173 | shows "0 \<le> a / b" | 
| 43920 | 1174 | using assms by (cases rule: ereal2_cases[of a b]) (auto simp: zero_le_divide_iff) | 
| 41978 | 1175 | |
| 43920 | 1176 | lemma ereal_le_divide_pos: | 
| 53873 | 1177 | fixes x y z :: ereal | 
| 1178 | shows "x > 0 \<Longrightarrow> x \<noteq> \<infinity> \<Longrightarrow> y \<le> z / x \<longleftrightarrow> x * y \<le> z" | |
| 43920 | 1179 | by (cases rule: ereal3_cases[of x y z]) (auto simp: field_simps) | 
| 41973 | 1180 | |
| 43920 | 1181 | lemma ereal_divide_le_pos: | 
| 53873 | 1182 | fixes x y z :: ereal | 
| 1183 | shows "x > 0 \<Longrightarrow> x \<noteq> \<infinity> \<Longrightarrow> z / x \<le> y \<longleftrightarrow> z \<le> x * y" | |
| 43920 | 1184 | by (cases rule: ereal3_cases[of x y z]) (auto simp: field_simps) | 
| 41973 | 1185 | |
| 43920 | 1186 | lemma ereal_le_divide_neg: | 
| 53873 | 1187 | fixes x y z :: ereal | 
| 1188 | shows "x < 0 \<Longrightarrow> x \<noteq> -\<infinity> \<Longrightarrow> y \<le> z / x \<longleftrightarrow> z \<le> x * y" | |
| 43920 | 1189 | by (cases rule: ereal3_cases[of x y z]) (auto simp: field_simps) | 
| 41973 | 1190 | |
| 43920 | 1191 | lemma ereal_divide_le_neg: | 
| 53873 | 1192 | fixes x y z :: ereal | 
| 1193 | shows "x < 0 \<Longrightarrow> x \<noteq> -\<infinity> \<Longrightarrow> z / x \<le> y \<longleftrightarrow> x * y \<le> z" | |
| 43920 | 1194 | by (cases rule: ereal3_cases[of x y z]) (auto simp: field_simps) | 
| 41973 | 1195 | |
| 43920 | 1196 | lemma ereal_inverse_antimono_strict: | 
| 1197 | fixes x y :: ereal | |
| 41973 | 1198 | shows "0 \<le> x \<Longrightarrow> x < y \<Longrightarrow> inverse y < inverse x" | 
| 43920 | 1199 | by (cases rule: ereal2_cases[of x y]) auto | 
| 41973 | 1200 | |
| 43920 | 1201 | lemma ereal_inverse_antimono: | 
| 1202 | fixes x y :: ereal | |
| 53873 | 1203 | shows "0 \<le> x \<Longrightarrow> x \<le> y \<Longrightarrow> inverse y \<le> inverse x" | 
| 43920 | 1204 | by (cases rule: ereal2_cases[of x y]) auto | 
| 41973 | 1205 | |
| 1206 | lemma inverse_inverse_Pinfty_iff[simp]: | |
| 53873 | 1207 | fixes x :: ereal | 
| 1208 | shows "inverse x = \<infinity> \<longleftrightarrow> x = 0" | |
| 41973 | 1209 | by (cases x) auto | 
| 1210 | ||
| 43920 | 1211 | lemma ereal_inverse_eq_0: | 
| 53873 | 1212 | fixes x :: ereal | 
| 1213 | shows "inverse x = 0 \<longleftrightarrow> x = \<infinity> \<or> x = -\<infinity>" | |
| 41973 | 1214 | by (cases x) auto | 
| 1215 | ||
| 43920 | 1216 | lemma ereal_0_gt_inverse: | 
| 53873 | 1217 | fixes x :: ereal | 
| 1218 | shows "0 < inverse x \<longleftrightarrow> x \<noteq> \<infinity> \<and> 0 \<le> x" | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1219 | by (cases x) auto | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1220 | |
| 43920 | 1221 | lemma ereal_mult_less_right: | 
| 43923 | 1222 | fixes a b c :: ereal | 
| 53873 | 1223 | assumes "b * a < c * a" | 
| 1224 | and "0 < a" | |
| 1225 | and "a < \<infinity>" | |
| 41973 | 1226 | shows "b < c" | 
| 1227 | using assms | |
| 43920 | 1228 | by (cases rule: ereal3_cases[of a b c]) | 
| 41973 | 1229 | (auto split: split_if_asm simp: zero_less_mult_iff zero_le_mult_iff) | 
| 1230 | ||
| 43920 | 1231 | lemma ereal_power_divide: | 
| 53873 | 1232 | fixes x y :: ereal | 
| 1233 | shows "y \<noteq> 0 \<Longrightarrow> (x / y) ^ n = x^n / y^n" | |
| 43920 | 1234 | by (cases rule: ereal2_cases[of x y]) | 
| 1235 | (auto simp: one_ereal_def zero_ereal_def power_divide not_le | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1236 | power_less_zero_eq zero_le_power_iff) | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1237 | |
| 43920 | 1238 | lemma ereal_le_mult_one_interval: | 
| 1239 | fixes x y :: ereal | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1240 | assumes y: "y \<noteq> -\<infinity>" | 
| 53873 | 1241 | assumes z: "\<And>z. 0 < z \<Longrightarrow> z < 1 \<Longrightarrow> z * x \<le> y" | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1242 | shows "x \<le> y" | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1243 | proof (cases x) | 
| 53873 | 1244 | case PInf | 
| 1245 | with z[of "1 / 2"] show "x \<le> y" | |
| 1246 | by (simp add: one_ereal_def) | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1247 | next | 
| 53873 | 1248 | case (real r) | 
| 1249 | note r = this | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1250 | show "x \<le> y" | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1251 | proof (cases y) | 
| 53873 | 1252 | case (real p) | 
| 1253 | note p = this | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1254 | have "r \<le> p" | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1255 | proof (rule field_le_mult_one_interval) | 
| 53873 | 1256 | fix z :: real | 
| 1257 | assume "0 < z" and "z < 1" | |
| 1258 | with z[of "ereal z"] show "z * r \<le> p" | |
| 1259 | using p r by (auto simp: zero_le_mult_iff one_ereal_def) | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1260 | qed | 
| 53873 | 1261 | then show "x \<le> y" | 
| 1262 | using p r by simp | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1263 | qed (insert y, simp_all) | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1264 | qed simp | 
| 41978 | 1265 | |
| 45934 | 1266 | lemma ereal_divide_right_mono[simp]: | 
| 1267 | fixes x y z :: ereal | |
| 53873 | 1268 | assumes "x \<le> y" | 
| 1269 | and "0 < z" | |
| 1270 | shows "x / z \<le> y / z" | |
| 1271 | using assms by (cases x y z rule: ereal3_cases) (auto intro: divide_right_mono) | |
| 45934 | 1272 | |
| 1273 | lemma ereal_divide_left_mono[simp]: | |
| 1274 | fixes x y z :: ereal | |
| 53873 | 1275 | assumes "y \<le> x" | 
| 1276 | and "0 < z" | |
| 1277 | and "0 < x * y" | |
| 45934 | 1278 | shows "z / x \<le> z / y" | 
| 53873 | 1279 | using assms | 
| 1280 | by (cases x y z rule: ereal3_cases) | |
| 54416 | 1281 | (auto intro: divide_left_mono simp: field_simps zero_less_mult_iff mult_less_0_iff split: split_if_asm) | 
| 45934 | 1282 | |
| 1283 | lemma ereal_divide_zero_left[simp]: | |
| 1284 | fixes a :: ereal | |
| 1285 | shows "0 / a = 0" | |
| 1286 | by (cases a) (auto simp: zero_ereal_def) | |
| 1287 | ||
| 1288 | lemma ereal_times_divide_eq_left[simp]: | |
| 1289 | fixes a b c :: ereal | |
| 1290 | shows "b / c * a = b * a / c" | |
| 54416 | 1291 | by (cases a b c rule: ereal3_cases) (auto simp: field_simps zero_less_mult_iff mult_less_0_iff) | 
| 45934 | 1292 | |
| 53873 | 1293 | |
| 41973 | 1294 | subsection "Complete lattice" | 
| 1295 | ||
| 43920 | 1296 | instantiation ereal :: lattice | 
| 41973 | 1297 | begin | 
| 53873 | 1298 | |
| 43920 | 1299 | definition [simp]: "sup x y = (max x y :: ereal)" | 
| 1300 | definition [simp]: "inf x y = (min x y :: ereal)" | |
| 47082 | 1301 | instance by default simp_all | 
| 53873 | 1302 | |
| 41973 | 1303 | end | 
| 1304 | ||
| 43920 | 1305 | instantiation ereal :: complete_lattice | 
| 41973 | 1306 | begin | 
| 1307 | ||
| 43923 | 1308 | definition "bot = (-\<infinity>::ereal)" | 
| 1309 | definition "top = (\<infinity>::ereal)" | |
| 41973 | 1310 | |
| 51329 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 1311 | definition "Sup S = (SOME x :: ereal. (\<forall>y\<in>S. y \<le> x) \<and> (\<forall>z. (\<forall>y\<in>S. y \<le> z) \<longrightarrow> x \<le> z))" | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 1312 | definition "Inf S = (SOME x :: ereal. (\<forall>y\<in>S. x \<le> y) \<and> (\<forall>z. (\<forall>y\<in>S. z \<le> y) \<longrightarrow> z \<le> x))" | 
| 41973 | 1313 | |
| 43920 | 1314 | lemma ereal_complete_Sup: | 
| 51329 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 1315 | fixes S :: "ereal set" | 
| 41973 | 1316 | shows "\<exists>x. (\<forall>y\<in>S. y \<le> x) \<and> (\<forall>z. (\<forall>y\<in>S. y \<le> z) \<longrightarrow> x \<le> z)" | 
| 53873 | 1317 | proof (cases "\<exists>x. \<forall>a\<in>S. a \<le> ereal x") | 
| 1318 | case True | |
| 1319 | then obtain y where y: "\<And>a. a\<in>S \<Longrightarrow> a \<le> ereal y" | |
| 1320 | by auto | |
| 1321 | then have "\<infinity> \<notin> S" | |
| 1322 | by force | |
| 41973 | 1323 | show ?thesis | 
| 53873 | 1324 |   proof (cases "S \<noteq> {-\<infinity>} \<and> S \<noteq> {}")
 | 
| 1325 | case True | |
| 1326 | with `\<infinity> \<notin> S` obtain x where x: "x \<in> S" "\<bar>x\<bar> \<noteq> \<infinity>" | |
| 1327 | by auto | |
| 51329 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 1328 | obtain s where s: "\<forall>x\<in>ereal -` S. x \<le> s" "\<And>z. (\<forall>x\<in>ereal -` S. x \<le> z) \<Longrightarrow> s \<le> z" | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 1329 | proof (atomize_elim, rule complete_real) | 
| 53873 | 1330 | show "\<exists>x. x \<in> ereal -` S" | 
| 1331 | using x by auto | |
| 1332 | show "\<exists>z. \<forall>x\<in>ereal -` S. x \<le> z" | |
| 1333 | by (auto dest: y intro!: exI[of _ y]) | |
| 51329 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 1334 | qed | 
| 41973 | 1335 | show ?thesis | 
| 43920 | 1336 | proof (safe intro!: exI[of _ "ereal s"]) | 
| 53873 | 1337 | fix y | 
| 1338 | assume "y \<in> S" | |
| 1339 | with s `\<infinity> \<notin> S` show "y \<le> ereal s" | |
| 51329 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 1340 | by (cases y) auto | 
| 41973 | 1341 | next | 
| 53873 | 1342 | fix z | 
| 1343 | assume "\<forall>y\<in>S. y \<le> z" | |
| 1344 |       with `S \<noteq> {-\<infinity>} \<and> S \<noteq> {}` show "ereal s \<le> z"
 | |
| 51329 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 1345 | by (cases z) (auto intro!: s) | 
| 41973 | 1346 | qed | 
| 53873 | 1347 | next | 
| 1348 | case False | |
| 1349 | then show ?thesis | |
| 1350 | by (auto intro!: exI[of _ "-\<infinity>"]) | |
| 1351 | qed | |
| 1352 | next | |
| 1353 | case False | |
| 1354 | then show ?thesis | |
| 1355 | by (fastforce intro!: exI[of _ \<infinity>] ereal_top intro: order_trans dest: less_imp_le simp: not_le) | |
| 1356 | qed | |
| 41973 | 1357 | |
| 43920 | 1358 | lemma ereal_complete_uminus_eq: | 
| 1359 | fixes S :: "ereal set" | |
| 41973 | 1360 | shows "(\<forall>y\<in>uminus`S. y \<le> x) \<and> (\<forall>z. (\<forall>y\<in>uminus`S. y \<le> z) \<longrightarrow> x \<le> z) | 
| 1361 | \<longleftrightarrow> (\<forall>y\<in>S. -x \<le> y) \<and> (\<forall>z. (\<forall>y\<in>S. z \<le> y) \<longrightarrow> z \<le> -x)" | |
| 43920 | 1362 | by simp (metis ereal_minus_le_minus ereal_uminus_uminus) | 
| 41973 | 1363 | |
| 51329 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 1364 | lemma ereal_complete_Inf: | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 1365 | "\<exists>x. (\<forall>y\<in>S::ereal set. x \<le> y) \<and> (\<forall>z. (\<forall>y\<in>S. z \<le> y) \<longrightarrow> z \<le> x)" | 
| 53873 | 1366 | using ereal_complete_Sup[of "uminus ` S"] | 
| 1367 | unfolding ereal_complete_uminus_eq | |
| 1368 | by auto | |
| 41973 | 1369 | |
| 1370 | instance | |
| 52729 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
51775diff
changeset | 1371 | proof | 
| 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
51775diff
changeset | 1372 |   show "Sup {} = (bot::ereal)"
 | 
| 53873 | 1373 | apply (auto simp: bot_ereal_def Sup_ereal_def) | 
| 1374 | apply (rule some1_equality) | |
| 1375 | apply (metis ereal_bot ereal_less_eq(2)) | |
| 1376 | apply (metis ereal_less_eq(2)) | |
| 1377 | done | |
| 52729 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
51775diff
changeset | 1378 |   show "Inf {} = (top::ereal)"
 | 
| 53873 | 1379 | apply (auto simp: top_ereal_def Inf_ereal_def) | 
| 1380 | apply (rule some1_equality) | |
| 1381 | apply (metis ereal_top ereal_less_eq(1)) | |
| 1382 | apply (metis ereal_less_eq(1)) | |
| 1383 | done | |
| 52729 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
51775diff
changeset | 1384 | qed (auto intro: someI2_ex ereal_complete_Sup ereal_complete_Inf | 
| 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
51775diff
changeset | 1385 | simp: Sup_ereal_def Inf_ereal_def bot_ereal_def top_ereal_def) | 
| 43941 | 1386 | |
| 41973 | 1387 | end | 
| 1388 | ||
| 43941 | 1389 | instance ereal :: complete_linorder .. | 
| 1390 | ||
| 51775 
408d937c9486
revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
 hoelzl parents: 
51774diff
changeset | 1391 | instance ereal :: linear_continuum | 
| 
408d937c9486
revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
 hoelzl parents: 
51774diff
changeset | 1392 | proof | 
| 
408d937c9486
revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
 hoelzl parents: 
51774diff
changeset | 1393 | show "\<exists>a b::ereal. a \<noteq> b" | 
| 54416 | 1394 | using zero_neq_one by blast | 
| 51775 
408d937c9486
revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
 hoelzl parents: 
51774diff
changeset | 1395 | qed | 
| 
408d937c9486
revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
 hoelzl parents: 
51774diff
changeset | 1396 | |
| 51329 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 1397 | lemma ereal_Sup_uminus_image_eq: "Sup (uminus ` S::ereal set) = - Inf S" | 
| 56166 | 1398 | by (auto intro!: SUP_eqI | 
| 51329 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 1399 | simp: Ball_def[symmetric] ereal_uminus_le_reorder le_Inf_iff | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 1400 | intro!: complete_lattice_class.Inf_lower2) | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 1401 | |
| 56166 | 1402 | lemma ereal_SUP_uminus_eq: | 
| 1403 | fixes f :: "'a \<Rightarrow> ereal" | |
| 1404 | shows "(SUP x:S. uminus (f x)) = - (INF x:S. f x)" | |
| 1405 | using ereal_Sup_uminus_image_eq [of "f ` S"] by (simp add: comp_def) | |
| 1406 | ||
| 51329 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 1407 | lemma ereal_inj_on_uminus[intro, simp]: "inj_on uminus (A :: ereal set)" | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 1408 | by (auto intro!: inj_onI) | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 1409 | |
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 1410 | lemma ereal_Inf_uminus_image_eq: "Inf (uminus ` S::ereal set) = - Sup S" | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 1411 | using ereal_Sup_uminus_image_eq[of "uminus ` S"] by simp | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 1412 | |
| 56166 | 1413 | lemma ereal_INF_uminus_eq: | 
| 1414 | fixes f :: "'a \<Rightarrow> ereal" | |
| 1415 | shows "(INF x:S. uminus (f x)) = - (SUP x:S. f x)" | |
| 1416 | using ereal_Inf_uminus_image_eq [of "f ` S"] by (simp add: comp_def) | |
| 1417 | ||
| 54416 | 1418 | lemma ereal_SUP_not_infty: | 
| 1419 | fixes f :: "_ \<Rightarrow> ereal" | |
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56212diff
changeset | 1420 |   shows "A \<noteq> {} \<Longrightarrow> l \<noteq> -\<infinity> \<Longrightarrow> u \<noteq> \<infinity> \<Longrightarrow> \<forall>a\<in>A. l \<le> f a \<and> f a \<le> u \<Longrightarrow> \<bar>SUPREMUM A f\<bar> \<noteq> \<infinity>"
 | 
| 54416 | 1421 | using SUP_upper2[of _ A l f] SUP_least[of A f u] | 
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56212diff
changeset | 1422 | by (cases "SUPREMUM A f") auto | 
| 54416 | 1423 | |
| 1424 | lemma ereal_INF_not_infty: | |
| 1425 | fixes f :: "_ \<Rightarrow> ereal" | |
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56212diff
changeset | 1426 |   shows "A \<noteq> {} \<Longrightarrow> l \<noteq> -\<infinity> \<Longrightarrow> u \<noteq> \<infinity> \<Longrightarrow> \<forall>a\<in>A. l \<le> f a \<and> f a \<le> u \<Longrightarrow> \<bar>INFIMUM A f\<bar> \<noteq> \<infinity>"
 | 
| 54416 | 1427 | using INF_lower2[of _ A f u] INF_greatest[of A l f] | 
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56212diff
changeset | 1428 | by (cases "INFIMUM A f") auto | 
| 54416 | 1429 | |
| 56212 
3253aaf73a01
consolidated theorem names containing INFI and SUPR: have INF and SUP instead uniformly
 haftmann parents: 
56166diff
changeset | 1430 | lemma ereal_SUP_uminus: | 
| 53873 | 1431 | fixes f :: "'a \<Rightarrow> ereal" | 
| 41973 | 1432 | shows "(SUP i : R. -(f i)) = -(INF i : R. f i)" | 
| 43920 | 1433 | using ereal_Sup_uminus_image_eq[of "f`R"] | 
| 56166 | 1434 | by (simp add: image_image) | 
| 41973 | 1435 | |
| 56212 
3253aaf73a01
consolidated theorem names containing INFI and SUPR: have INF and SUP instead uniformly
 haftmann parents: 
56166diff
changeset | 1436 | lemma ereal_INF_uminus: | 
| 53873 | 1437 | fixes f :: "'a \<Rightarrow> ereal" | 
| 1438 | shows "(INF i : R. - f i) = - (SUP i : R. f i)" | |
| 56212 
3253aaf73a01
consolidated theorem names containing INFI and SUPR: have INF and SUP instead uniformly
 haftmann parents: 
56166diff
changeset | 1439 | using ereal_SUP_uminus [of _ "\<lambda>x. - f x"] by simp | 
| 41973 | 1440 | |
| 43920 | 1441 | lemma ereal_image_uminus_shift: | 
| 53873 | 1442 | fixes X Y :: "ereal set" | 
| 1443 | shows "uminus ` X = Y \<longleftrightarrow> X = uminus ` Y" | |
| 41973 | 1444 | proof | 
| 1445 | assume "uminus ` X = Y" | |
| 1446 | then have "uminus ` uminus ` X = uminus ` Y" | |
| 1447 | by (simp add: inj_image_eq_iff) | |
| 53873 | 1448 | then show "X = uminus ` Y" | 
| 1449 | by (simp add: image_image) | |
| 41973 | 1450 | qed (simp add: image_image) | 
| 1451 | ||
| 43920 | 1452 | lemma Inf_ereal_iff: | 
| 1453 | fixes z :: ereal | |
| 53873 | 1454 | shows "(\<And>x. x \<in> X \<Longrightarrow> z \<le> x) \<Longrightarrow> (\<exists>x\<in>X. x < y) \<longleftrightarrow> Inf X < y" | 
| 1455 | by (metis complete_lattice_class.Inf_greatest complete_lattice_class.Inf_lower | |
| 1456 | less_le_not_le linear order_less_le_trans) | |
| 41973 | 1457 | |
| 1458 | lemma Sup_eq_MInfty: | |
| 53873 | 1459 | fixes S :: "ereal set" | 
| 1460 |   shows "Sup S = -\<infinity> \<longleftrightarrow> S = {} \<or> S = {-\<infinity>}"
 | |
| 51329 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 1461 | unfolding bot_ereal_def[symmetric] by auto | 
| 41973 | 1462 | |
| 1463 | lemma Inf_eq_PInfty: | |
| 53873 | 1464 | fixes S :: "ereal set" | 
| 1465 |   shows "Inf S = \<infinity> \<longleftrightarrow> S = {} \<or> S = {\<infinity>}"
 | |
| 41973 | 1466 | using Sup_eq_MInfty[of "uminus`S"] | 
| 43920 | 1467 | unfolding ereal_Sup_uminus_image_eq ereal_image_uminus_shift by simp | 
| 41973 | 1468 | |
| 53873 | 1469 | lemma Inf_eq_MInfty: | 
| 1470 | fixes S :: "ereal set" | |
| 1471 | shows "-\<infinity> \<in> S \<Longrightarrow> Inf S = -\<infinity>" | |
| 51329 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 1472 | unfolding bot_ereal_def[symmetric] by auto | 
| 41973 | 1473 | |
| 43923 | 1474 | lemma Sup_eq_PInfty: | 
| 53873 | 1475 | fixes S :: "ereal set" | 
| 1476 | shows "\<infinity> \<in> S \<Longrightarrow> Sup S = \<infinity>" | |
| 51329 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 1477 | unfolding top_ereal_def[symmetric] by auto | 
| 41973 | 1478 | |
| 43920 | 1479 | lemma Sup_ereal_close: | 
| 1480 | fixes e :: ereal | |
| 53873 | 1481 | assumes "0 < e" | 
| 1482 |     and S: "\<bar>Sup S\<bar> \<noteq> \<infinity>" "S \<noteq> {}"
 | |
| 41973 | 1483 | shows "\<exists>x\<in>S. Sup S - e < x" | 
| 41976 | 1484 | using assms by (cases e) (auto intro!: less_Sup_iff[THEN iffD1]) | 
| 41973 | 1485 | |
| 43920 | 1486 | lemma Inf_ereal_close: | 
| 53873 | 1487 | fixes e :: ereal | 
| 1488 | assumes "\<bar>Inf X\<bar> \<noteq> \<infinity>" | |
| 1489 | and "0 < e" | |
| 41973 | 1490 | shows "\<exists>x\<in>X. x < Inf X + e" | 
| 1491 | proof (rule Inf_less_iff[THEN iffD1]) | |
| 53873 | 1492 | show "Inf X < Inf X + e" | 
| 1493 | using assms by (cases e) auto | |
| 41973 | 1494 | qed | 
| 1495 | ||
| 43920 | 1496 | lemma SUP_nat_Infty: "(SUP i::nat. ereal (real i)) = \<infinity>" | 
| 41973 | 1497 | proof - | 
| 53873 | 1498 |   {
 | 
| 1499 | fix x :: ereal | |
| 1500 | assume "x \<noteq> \<infinity>" | |
| 43920 | 1501 | then have "\<exists>k::nat. x < ereal (real k)" | 
| 41973 | 1502 | proof (cases x) | 
| 53873 | 1503 | case MInf | 
| 1504 | then show ?thesis | |
| 1505 | by (intro exI[of _ 0]) auto | |
| 41973 | 1506 | next | 
| 1507 | case (real r) | |
| 1508 | moreover obtain k :: nat where "r < real k" | |
| 1509 | using ex_less_of_nat by (auto simp: real_eq_of_nat) | |
| 53873 | 1510 | ultimately show ?thesis | 
| 1511 | by auto | |
| 1512 | qed simp | |
| 1513 | } | |
| 41973 | 1514 | then show ?thesis | 
| 43920 | 1515 | using SUP_eq_top_iff[of UNIV "\<lambda>n::nat. ereal (real n)"] | 
| 1516 | by (auto simp: top_ereal_def) | |
| 41973 | 1517 | qed | 
| 1518 | ||
| 1519 | lemma Inf_less: | |
| 43920 | 1520 | fixes x :: ereal | 
| 41973 | 1521 | assumes "(INF i:A. f i) < x" | 
| 53873 | 1522 | shows "\<exists>i. i \<in> A \<and> f i \<le> x" | 
| 1523 | proof (rule ccontr) | |
| 1524 | assume "\<not> ?thesis" | |
| 1525 | then have "\<forall>i\<in>A. f i > x" | |
| 1526 | by auto | |
| 1527 | then have "(INF i:A. f i) \<ge> x" | |
| 1528 | by (subst INF_greatest) auto | |
| 1529 | then show False | |
| 1530 | using assms by auto | |
| 41973 | 1531 | qed | 
| 1532 | ||
| 43920 | 1533 | lemma SUP_ereal_le_addI: | 
| 43923 | 1534 | fixes f :: "'i \<Rightarrow> ereal" | 
| 53873 | 1535 | assumes "\<And>i. f i + y \<le> z" | 
| 1536 | and "y \<noteq> -\<infinity>" | |
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56212diff
changeset | 1537 | shows "SUPREMUM UNIV f + y \<le> z" | 
| 41978 | 1538 | proof (cases y) | 
| 1539 | case (real r) | |
| 53873 | 1540 | then have "\<And>i. f i \<le> z - y" | 
| 1541 | using assms by (simp add: ereal_le_minus_iff) | |
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56212diff
changeset | 1542 | then have "SUPREMUM UNIV f \<le> z - y" | 
| 53873 | 1543 | by (rule SUP_least) | 
| 1544 | then show ?thesis | |
| 1545 | using real by (simp add: ereal_le_minus_iff) | |
| 41978 | 1546 | qed (insert assms, auto) | 
| 1547 | ||
| 56212 
3253aaf73a01
consolidated theorem names containing INFI and SUPR: have INF and SUP instead uniformly
 haftmann parents: 
56166diff
changeset | 1548 | lemma SUP_ereal_add: | 
| 43920 | 1549 | fixes f g :: "nat \<Rightarrow> ereal" | 
| 53873 | 1550 | assumes "incseq f" | 
| 1551 | and "incseq g" | |
| 1552 | and pos: "\<And>i. f i \<noteq> -\<infinity>" "\<And>i. g i \<noteq> -\<infinity>" | |
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56212diff
changeset | 1553 | shows "(SUP i. f i + g i) = SUPREMUM UNIV f + SUPREMUM UNIV g" | 
| 51000 | 1554 | proof (rule SUP_eqI) | 
| 53873 | 1555 | fix y | 
| 1556 | assume *: "\<And>i. i \<in> UNIV \<Longrightarrow> f i + g i \<le> y" | |
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56212diff
changeset | 1557 | have f: "SUPREMUM UNIV f \<noteq> -\<infinity>" | 
| 53873 | 1558 | using pos | 
| 1559 | unfolding SUP_def Sup_eq_MInfty | |
| 1560 | by (auto dest: image_eqD) | |
| 1561 |   {
 | |
| 1562 | fix j | |
| 1563 |     {
 | |
| 1564 | fix i | |
| 41978 | 1565 | have "f i + g j \<le> f i + g (max i j)" | 
| 53873 | 1566 | using `incseq g`[THEN incseqD] | 
| 1567 | by (rule add_left_mono) auto | |
| 41978 | 1568 | also have "\<dots> \<le> f (max i j) + g (max i j)" | 
| 53873 | 1569 | using `incseq f`[THEN incseqD] | 
| 1570 | by (rule add_right_mono) auto | |
| 41978 | 1571 | also have "\<dots> \<le> y" using * by auto | 
| 53873 | 1572 | finally have "f i + g j \<le> y" . | 
| 1573 | } | |
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56212diff
changeset | 1574 | then have "SUPREMUM UNIV f + g j \<le> y" | 
| 43920 | 1575 | using assms(4)[of j] by (intro SUP_ereal_le_addI) auto | 
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56212diff
changeset | 1576 | then have "g j + SUPREMUM UNIV f \<le> y" by (simp add: ac_simps) | 
| 53873 | 1577 | } | 
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56212diff
changeset | 1578 | then have "SUPREMUM UNIV g + SUPREMUM UNIV f \<le> y" | 
| 43920 | 1579 | using f by (rule SUP_ereal_le_addI) | 
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56212diff
changeset | 1580 | then show "SUPREMUM UNIV f + SUPREMUM UNIV g \<le> y" | 
| 53873 | 1581 | by (simp add: ac_simps) | 
| 44928 
7ef6505bde7f
renamed Complete_Lattices lemmas, removed legacy names
 hoelzl parents: 
44918diff
changeset | 1582 | qed (auto intro!: add_mono SUP_upper) | 
| 41978 | 1583 | |
| 56212 
3253aaf73a01
consolidated theorem names containing INFI and SUPR: have INF and SUP instead uniformly
 haftmann parents: 
56166diff
changeset | 1584 | lemma SUP_ereal_add_pos: | 
| 43920 | 1585 | fixes f g :: "nat \<Rightarrow> ereal" | 
| 53873 | 1586 | assumes inc: "incseq f" "incseq g" | 
| 1587 | and pos: "\<And>i. 0 \<le> f i" "\<And>i. 0 \<le> g i" | |
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56212diff
changeset | 1588 | shows "(SUP i. f i + g i) = SUPREMUM UNIV f + SUPREMUM UNIV g" | 
| 56212 
3253aaf73a01
consolidated theorem names containing INFI and SUPR: have INF and SUP instead uniformly
 haftmann parents: 
56166diff
changeset | 1589 | proof (intro SUP_ereal_add inc) | 
| 53873 | 1590 | fix i | 
| 1591 | show "f i \<noteq> -\<infinity>" "g i \<noteq> -\<infinity>" | |
| 1592 | using pos[of i] by auto | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1593 | qed | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1594 | |
| 56212 
3253aaf73a01
consolidated theorem names containing INFI and SUPR: have INF and SUP instead uniformly
 haftmann parents: 
56166diff
changeset | 1595 | lemma SUP_ereal_setsum: | 
| 43920 | 1596 | fixes f g :: "'a \<Rightarrow> nat \<Rightarrow> ereal" | 
| 53873 | 1597 | assumes "\<And>n. n \<in> A \<Longrightarrow> incseq (f n)" | 
| 1598 | and pos: "\<And>n i. n \<in> A \<Longrightarrow> 0 \<le> f n i" | |
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56212diff
changeset | 1599 | shows "(SUP i. \<Sum>n\<in>A. f n i) = (\<Sum>n\<in>A. SUPREMUM UNIV (f n))" | 
| 53873 | 1600 | proof (cases "finite A") | 
| 1601 | case True | |
| 1602 | then show ?thesis using assms | |
| 56212 
3253aaf73a01
consolidated theorem names containing INFI and SUPR: have INF and SUP instead uniformly
 haftmann parents: 
56166diff
changeset | 1603 | by induct (auto simp: incseq_setsumI2 setsum_nonneg SUP_ereal_add_pos) | 
| 53873 | 1604 | next | 
| 1605 | case False | |
| 1606 | then show ?thesis by simp | |
| 1607 | qed | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1608 | |
| 56212 
3253aaf73a01
consolidated theorem names containing INFI and SUPR: have INF and SUP instead uniformly
 haftmann parents: 
56166diff
changeset | 1609 | lemma SUP_ereal_cmult: | 
| 53873 | 1610 | fixes f :: "nat \<Rightarrow> ereal" | 
| 1611 | assumes "\<And>i. 0 \<le> f i" | |
| 1612 | and "0 \<le> c" | |
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56212diff
changeset | 1613 | shows "(SUP i. c * f i) = c * SUPREMUM UNIV f" | 
| 51000 | 1614 | proof (rule SUP_eqI) | 
| 53873 | 1615 | fix i | 
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56212diff
changeset | 1616 | have "f i \<le> SUPREMUM UNIV f" | 
| 53873 | 1617 | by (rule SUP_upper) auto | 
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56212diff
changeset | 1618 | then show "c * f i \<le> c * SUPREMUM UNIV f" | 
| 43920 | 1619 | using `0 \<le> c` by (rule ereal_mult_left_mono) | 
| 41978 | 1620 | next | 
| 53873 | 1621 | fix y | 
| 56248 
67dc9549fa15
generalized and strengthened cong rules on compound operators, similar to 1ed737a98198
 haftmann parents: 
56218diff
changeset | 1622 | assume "\<And>i. i \<in> UNIV \<Longrightarrow> c * f i \<le> y" | 
| 
67dc9549fa15
generalized and strengthened cong rules on compound operators, similar to 1ed737a98198
 haftmann parents: 
56218diff
changeset | 1623 | then have *: "\<And>i. c * f i \<le> y" by simp | 
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56212diff
changeset | 1624 | show "c * SUPREMUM UNIV f \<le> y" | 
| 53873 | 1625 | proof (cases "0 < c \<and> c \<noteq> \<infinity>") | 
| 1626 | case True | |
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56212diff
changeset | 1627 | with * have "SUPREMUM UNIV f \<le> y / c" | 
| 44928 
7ef6505bde7f
renamed Complete_Lattices lemmas, removed legacy names
 hoelzl parents: 
44918diff
changeset | 1628 | by (intro SUP_least) (auto simp: ereal_le_divide_pos) | 
| 53873 | 1629 | with True show ?thesis | 
| 43920 | 1630 | by (auto simp: ereal_le_divide_pos) | 
| 41978 | 1631 | next | 
| 53873 | 1632 | case False | 
| 1633 |     {
 | |
| 1634 | assume "c = \<infinity>" | |
| 1635 | have ?thesis | |
| 1636 | proof (cases "\<forall>i. f i = 0") | |
| 1637 | case True | |
| 1638 |         then have "range f = {0}"
 | |
| 1639 | by auto | |
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56212diff
changeset | 1640 | with True show "c * SUPREMUM UNIV f \<le> y" | 
| 56248 
67dc9549fa15
generalized and strengthened cong rules on compound operators, similar to 1ed737a98198
 haftmann parents: 
56218diff
changeset | 1641 | using * by auto | 
| 41978 | 1642 | next | 
| 53873 | 1643 | case False | 
| 1644 | then obtain i where "f i \<noteq> 0" | |
| 1645 | by auto | |
| 1646 | with *[of i] `c = \<infinity>` `0 \<le> f i` show ?thesis | |
| 1647 | by (auto split: split_if_asm) | |
| 1648 | qed | |
| 1649 | } | |
| 1650 | moreover note False | |
| 1651 | ultimately show ?thesis | |
| 1652 | using * `0 \<le> c` by auto | |
| 41978 | 1653 | qed | 
| 1654 | qed | |
| 1655 | ||
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1656 | lemma SUP_PInfty: | 
| 43920 | 1657 | fixes f :: "'a \<Rightarrow> ereal" | 
| 1658 | assumes "\<And>n::nat. \<exists>i\<in>A. ereal (real n) \<le> f i" | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1659 | shows "(SUP i:A. f i) = \<infinity>" | 
| 44928 
7ef6505bde7f
renamed Complete_Lattices lemmas, removed legacy names
 hoelzl parents: 
44918diff
changeset | 1660 | unfolding SUP_def Sup_eq_top_iff[where 'a=ereal, unfolded top_ereal_def] | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1661 | apply simp | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1662 | proof safe | 
| 53873 | 1663 | fix x :: ereal | 
| 1664 | assume "x \<noteq> \<infinity>" | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1665 | show "\<exists>i\<in>A. x < f i" | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1666 | proof (cases x) | 
| 53873 | 1667 | case PInf | 
| 1668 | with `x \<noteq> \<infinity>` show ?thesis | |
| 1669 | by simp | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1670 | next | 
| 53873 | 1671 | case MInf | 
| 1672 | with assms[of "0"] show ?thesis | |
| 1673 | by force | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1674 | next | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1675 | case (real r) | 
| 53873 | 1676 | with less_PInf_Ex_of_nat[of x] obtain n :: nat where "x < ereal (real n)" | 
| 1677 | by auto | |
| 53381 | 1678 | moreover obtain i where "i \<in> A" "ereal (real n) \<le> f i" | 
| 1679 | using assms .. | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1680 | ultimately show ?thesis | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1681 | by (auto intro!: bexI[of _ i]) | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1682 | qed | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1683 | qed | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1684 | |
| 56212 
3253aaf73a01
consolidated theorem names containing INFI and SUPR: have INF and SUP instead uniformly
 haftmann parents: 
56166diff
changeset | 1685 | lemma Sup_countable_SUP: | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1686 |   assumes "A \<noteq> {}"
 | 
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56212diff
changeset | 1687 | shows "\<exists>f::nat \<Rightarrow> ereal. range f \<subseteq> A \<and> Sup A = SUPREMUM UNIV f" | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1688 | proof (cases "Sup A") | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1689 | case (real r) | 
| 43920 | 1690 | have "\<forall>n::nat. \<exists>x. x \<in> A \<and> Sup A < x + 1 / ereal (real n)" | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1691 | proof | 
| 53873 | 1692 | fix n :: nat | 
| 1693 | have "\<exists>x\<in>A. Sup A - 1 / ereal (real n) < x" | |
| 43920 | 1694 | using assms real by (intro Sup_ereal_close) (auto simp: one_ereal_def) | 
| 53381 | 1695 | then obtain x where "x \<in> A" "Sup A - 1 / ereal (real n) < x" .. | 
| 43920 | 1696 | then show "\<exists>x. x \<in> A \<and> Sup A < x + 1 / ereal (real n)" | 
| 1697 | by (auto intro!: exI[of _ x] simp: ereal_minus_less_iff) | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1698 | qed | 
| 53381 | 1699 | from choice[OF this] obtain f :: "nat \<Rightarrow> ereal" | 
| 1700 | where f: "\<forall>x. f x \<in> A \<and> Sup A < f x + 1 / ereal (real x)" .. | |
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56212diff
changeset | 1701 | have "SUPREMUM UNIV f = Sup A" | 
| 51000 | 1702 | proof (rule SUP_eqI) | 
| 53873 | 1703 | fix i | 
| 1704 | show "f i \<le> Sup A" | |
| 1705 | using f by (auto intro!: complete_lattice_class.Sup_upper) | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1706 | next | 
| 53873 | 1707 | fix y | 
| 1708 | assume bound: "\<And>i. i \<in> UNIV \<Longrightarrow> f i \<le> y" | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1709 | show "Sup A \<le> y" | 
| 43920 | 1710 | proof (rule ereal_le_epsilon, intro allI impI) | 
| 53873 | 1711 | fix e :: ereal | 
| 1712 | assume "0 < e" | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1713 | show "Sup A \<le> y + e" | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1714 | proof (cases e) | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1715 | case (real r) | 
| 53873 | 1716 | then have "0 < r" | 
| 1717 | using `0 < e` by auto | |
| 1718 | then obtain n :: nat where *: "1 / real n < r" "0 < n" | |
| 1719 | using ex_inverse_of_nat_less | |
| 1720 | by (auto simp: real_eq_of_nat inverse_eq_divide) | |
| 1721 | have "Sup A \<le> f n + 1 / ereal (real n)" | |
| 1722 | using f[THEN spec, of n] | |
| 44918 | 1723 | by auto | 
| 53873 | 1724 | also have "1 / ereal (real n) \<le> e" | 
| 1725 | using real * | |
| 1726 | by (auto simp: one_ereal_def ) | |
| 1727 | with bound have "f n + 1 / ereal (real n) \<le> y + e" | |
| 1728 | by (rule add_mono) simp | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1729 | finally show "Sup A \<le> y + e" . | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1730 | qed (insert `0 < e`, auto) | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1731 | qed | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1732 | qed | 
| 53873 | 1733 | with f show ?thesis | 
| 1734 | by (auto intro!: exI[of _ f]) | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1735 | next | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1736 | case PInf | 
| 53873 | 1737 |   from `A \<noteq> {}` obtain x where "x \<in> A"
 | 
| 1738 | by auto | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1739 | show ?thesis | 
| 53873 | 1740 | proof (cases "\<infinity> \<in> A") | 
| 1741 | case True | |
| 1742 | then have "\<infinity> \<le> Sup A" | |
| 1743 | by (intro complete_lattice_class.Sup_upper) | |
| 1744 | with True show ?thesis | |
| 1745 | by (auto intro!: exI[of _ "\<lambda>x. \<infinity>"]) | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1746 | next | 
| 53873 | 1747 | case False | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1748 | have "\<exists>x\<in>A. 0 \<le> x" | 
| 54416 | 1749 | by (metis Infty_neq_0(2) PInf complete_lattice_class.Sup_least ereal_infty_less_eq2(1) linorder_linear) | 
| 53873 | 1750 | then obtain x where "x \<in> A" and "0 \<le> x" | 
| 1751 | by auto | |
| 43920 | 1752 | have "\<forall>n::nat. \<exists>f. f \<in> A \<and> x + ereal (real n) \<le> f" | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1753 | proof (rule ccontr) | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1754 | assume "\<not> ?thesis" | 
| 43920 | 1755 | then have "\<exists>n::nat. Sup A \<le> x + ereal (real n)" | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1756 | by (simp add: Sup_le_iff not_le less_imp_le Ball_def) (metis less_imp_le) | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1757 | then show False using `x \<in> A` `\<infinity> \<notin> A` PInf | 
| 53873 | 1758 | by (cases x) auto | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1759 | qed | 
| 53381 | 1760 | from choice[OF this] obtain f :: "nat \<Rightarrow> ereal" | 
| 1761 | where f: "\<forall>z. f z \<in> A \<and> x + ereal (real z) \<le> f z" .. | |
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56212diff
changeset | 1762 | have "SUPREMUM UNIV f = \<infinity>" | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1763 | proof (rule SUP_PInfty) | 
| 53381 | 1764 | fix n :: nat | 
| 1765 | show "\<exists>i\<in>UNIV. ereal (real n) \<le> f i" | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1766 | using f[THEN spec, of n] `0 \<le> x` | 
| 43920 | 1767 | by (cases rule: ereal2_cases[of "f n" x]) (auto intro!: exI[of _ n]) | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1768 | qed | 
| 53873 | 1769 | then show ?thesis | 
| 1770 | using f PInf by (auto intro!: exI[of _ f]) | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1771 | qed | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1772 | next | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1773 | case MInf | 
| 53873 | 1774 |   with `A \<noteq> {}` have "A = {-\<infinity>}"
 | 
| 1775 | by (auto simp: Sup_eq_MInfty) | |
| 1776 | then show ?thesis | |
| 1777 | using MInf by (auto intro!: exI[of _ "\<lambda>x. -\<infinity>"]) | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1778 | qed | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1779 | |
| 56212 
3253aaf73a01
consolidated theorem names containing INFI and SUPR: have INF and SUP instead uniformly
 haftmann parents: 
56166diff
changeset | 1780 | lemma SUP_countable_SUP: | 
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56212diff
changeset | 1781 |   "A \<noteq> {} \<Longrightarrow> \<exists>f::nat \<Rightarrow> ereal. range f \<subseteq> g`A \<and> SUPREMUM A g = SUPREMUM UNIV f"
 | 
| 56212 
3253aaf73a01
consolidated theorem names containing INFI and SUPR: have INF and SUP instead uniformly
 haftmann parents: 
56166diff
changeset | 1782 | using Sup_countable_SUP [of "g`A"] | 
| 56166 | 1783 | by auto | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1784 | |
| 43920 | 1785 | lemma Sup_ereal_cadd: | 
| 53873 | 1786 | fixes A :: "ereal set" | 
| 1787 |   assumes "A \<noteq> {}"
 | |
| 1788 | and "a \<noteq> -\<infinity>" | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1789 | shows "Sup ((\<lambda>x. a + x) ` A) = a + Sup A" | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1790 | proof (rule antisym) | 
| 43920 | 1791 | have *: "\<And>a::ereal. \<And>A. Sup ((\<lambda>x. a + x) ` A) \<le> a + Sup A" | 
| 56166 | 1792 | by (auto intro!: add_mono complete_lattice_class.SUP_least complete_lattice_class.Sup_upper) | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1793 | then show "Sup ((\<lambda>x. a + x) ` A) \<le> a + Sup A" . | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1794 | show "a + Sup A \<le> Sup ((\<lambda>x. a + x) ` A)" | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1795 | proof (cases a) | 
| 53873 | 1796 |     case PInf with `A \<noteq> {}`
 | 
| 1797 | show ?thesis | |
| 54863 
82acc20ded73
prefer more canonical names for lemmas on min/max
 haftmann parents: 
54416diff
changeset | 1798 | by (auto simp: image_constant max.absorb1) | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1799 | next | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1800 | case (real r) | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1801 | then have **: "op + (- a) ` op + a ` A = A" | 
| 43920 | 1802 | by (auto simp: image_iff ac_simps zero_ereal_def[symmetric]) | 
| 53873 | 1803 | from *[of "-a" "(\<lambda>x. a + x) ` A"] real show ?thesis | 
| 1804 | unfolding ** | |
| 43920 | 1805 | by (cases rule: ereal2_cases[of "Sup A" "Sup (op + a ` A)"]) auto | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1806 | qed (insert `a \<noteq> -\<infinity>`, auto) | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1807 | qed | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1808 | |
| 43920 | 1809 | lemma Sup_ereal_cminus: | 
| 53873 | 1810 | fixes A :: "ereal set" | 
| 1811 |   assumes "A \<noteq> {}"
 | |
| 1812 | and "a \<noteq> -\<infinity>" | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1813 | shows "Sup ((\<lambda>x. a - x) ` A) = a - Inf A" | 
| 56166 | 1814 | using Sup_ereal_cadd [of "uminus ` A" a] assms | 
| 1815 | unfolding image_image minus_ereal_def by (simp add: ereal_SUP_uminus_eq) | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1816 | |
| 56212 
3253aaf73a01
consolidated theorem names containing INFI and SUPR: have INF and SUP instead uniformly
 haftmann parents: 
56166diff
changeset | 1817 | lemma SUP_ereal_cminus: | 
| 43923 | 1818 | fixes f :: "'i \<Rightarrow> ereal" | 
| 53873 | 1819 | fixes A | 
| 1820 |   assumes "A \<noteq> {}"
 | |
| 1821 | and "a \<noteq> -\<infinity>" | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1822 | shows "(SUP x:A. a - f x) = a - (INF x:A. f x)" | 
| 43920 | 1823 | using Sup_ereal_cminus[of "f`A" a] assms | 
| 44928 
7ef6505bde7f
renamed Complete_Lattices lemmas, removed legacy names
 hoelzl parents: 
44918diff
changeset | 1824 | unfolding SUP_def INF_def image_image by auto | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1825 | |
| 43920 | 1826 | lemma Inf_ereal_cminus: | 
| 53873 | 1827 | fixes A :: "ereal set" | 
| 1828 |   assumes "A \<noteq> {}"
 | |
| 1829 | and "\<bar>a\<bar> \<noteq> \<infinity>" | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1830 | shows "Inf ((\<lambda>x. a - x) ` A) = a - Sup A" | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1831 | proof - | 
| 53374 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53216diff
changeset | 1832 |   {
 | 
| 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53216diff
changeset | 1833 | fix x | 
| 53873 | 1834 | have "-a - -x = -(a - x)" | 
| 1835 | using assms by (cases x) auto | |
| 53374 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53216diff
changeset | 1836 | } note * = this | 
| 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53216diff
changeset | 1837 | then have "(\<lambda>x. -a - x)`uminus`A = uminus ` (\<lambda>x. a - x) ` A" | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1838 | by (auto simp: image_image) | 
| 53374 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53216diff
changeset | 1839 | with * show ?thesis | 
| 56166 | 1840 | using Sup_ereal_cminus [of "uminus ` A" "- a"] assms | 
| 1841 | by (auto simp add: ereal_INF_uminus_eq ereal_SUP_uminus_eq) | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1842 | qed | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1843 | |
| 56212 
3253aaf73a01
consolidated theorem names containing INFI and SUPR: have INF and SUP instead uniformly
 haftmann parents: 
56166diff
changeset | 1844 | lemma INF_ereal_cminus: | 
| 53873 | 1845 | fixes a :: ereal | 
| 1846 |   assumes "A \<noteq> {}"
 | |
| 1847 | and "\<bar>a\<bar> \<noteq> \<infinity>" | |
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1848 | shows "(INF x:A. a - f x) = a - (SUP x:A. f x)" | 
| 43920 | 1849 | using Inf_ereal_cminus[of "f`A" a] assms | 
| 44928 
7ef6505bde7f
renamed Complete_Lattices lemmas, removed legacy names
 hoelzl parents: 
44918diff
changeset | 1850 | unfolding SUP_def INF_def image_image | 
| 41979 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1851 | by auto | 
| 
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
 hoelzl parents: 
41978diff
changeset | 1852 | |
| 43920 | 1853 | lemma uminus_ereal_add_uminus_uminus: | 
| 53873 | 1854 | fixes a b :: ereal | 
| 1855 | shows "a \<noteq> \<infinity> \<Longrightarrow> b \<noteq> \<infinity> \<Longrightarrow> - (- a + - b) = a + b" | |
| 43920 | 1856 | by (cases rule: ereal2_cases[of a b]) auto | 
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 1857 | |
| 56212 
3253aaf73a01
consolidated theorem names containing INFI and SUPR: have INF and SUP instead uniformly
 haftmann parents: 
56166diff
changeset | 1858 | lemma INF_ereal_add: | 
| 43923 | 1859 | fixes f :: "nat \<Rightarrow> ereal" | 
| 53873 | 1860 | assumes "decseq f" "decseq g" | 
| 1861 | and fin: "\<And>i. f i \<noteq> \<infinity>" "\<And>i. g i \<noteq> \<infinity>" | |
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56212diff
changeset | 1862 | shows "(INF i. f i + g i) = INFIMUM UNIV f + INFIMUM UNIV g" | 
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 1863 | proof - | 
| 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 1864 | have INF_less: "(INF i. f i) < \<infinity>" "(INF i. g i) < \<infinity>" | 
| 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 1865 | using assms unfolding INF_less_iff by auto | 
| 53873 | 1866 |   {
 | 
| 1867 | fix i | |
| 1868 | from fin[of i] have "- ((- f i) + (- g i)) = f i + g i" | |
| 1869 | by (rule uminus_ereal_add_uminus_uminus) | |
| 1870 | } | |
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 1871 | then have "(INF i. f i + g i) = (INF i. - ((- f i) + (- g i)))" | 
| 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 1872 | by simp | 
| 56218 
1c3f1f2431f9
elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
 haftmann parents: 
56212diff
changeset | 1873 | also have "\<dots> = INFIMUM UNIV f + INFIMUM UNIV g" | 
| 56212 
3253aaf73a01
consolidated theorem names containing INFI and SUPR: have INF and SUP instead uniformly
 haftmann parents: 
56166diff
changeset | 1874 | unfolding ereal_INF_uminus | 
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 1875 | using assms INF_less | 
| 56212 
3253aaf73a01
consolidated theorem names containing INFI and SUPR: have INF and SUP instead uniformly
 haftmann parents: 
56166diff
changeset | 1876 | by (subst SUP_ereal_add) | 
| 
3253aaf73a01
consolidated theorem names containing INFI and SUPR: have INF and SUP instead uniformly
 haftmann parents: 
56166diff
changeset | 1877 | (auto simp: ereal_SUP_uminus intro!: uminus_ereal_add_uminus_uminus) | 
| 42950 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 1878 | finally show ?thesis . | 
| 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 1879 | qed | 
| 
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
 hoelzl parents: 
42600diff
changeset | 1880 | |
| 45934 | 1881 | subsection "Relation to @{typ enat}"
 | 
| 1882 | ||
| 1883 | definition "ereal_of_enat n = (case n of enat n \<Rightarrow> ereal (real n) | \<infinity> \<Rightarrow> \<infinity>)" | |
| 1884 | ||
| 1885 | declare [[coercion "ereal_of_enat :: enat \<Rightarrow> ereal"]] | |
| 1886 | declare [[coercion "(\<lambda>n. ereal (real n)) :: nat \<Rightarrow> ereal"]] | |
| 1887 | ||
| 1888 | lemma ereal_of_enat_simps[simp]: | |
| 1889 | "ereal_of_enat (enat n) = ereal n" | |
| 1890 | "ereal_of_enat \<infinity> = \<infinity>" | |
| 1891 | by (simp_all add: ereal_of_enat_def) | |
| 1892 | ||
| 53873 | 1893 | lemma ereal_of_enat_le_iff[simp]: "ereal_of_enat m \<le> ereal_of_enat n \<longleftrightarrow> m \<le> n" | 
| 1894 | by (cases m n rule: enat2_cases) auto | |
| 45934 | 1895 | |
| 53873 | 1896 | lemma ereal_of_enat_less_iff[simp]: "ereal_of_enat m < ereal_of_enat n \<longleftrightarrow> m < n" | 
| 1897 | by (cases m n rule: enat2_cases) auto | |
| 50819 
5601ae592679
added some ereal_of_enat_* lemmas (from $AFP/thys/Girth_Chromatic)
 noschinl parents: 
50104diff
changeset | 1898 | |
| 53873 | 1899 | lemma numeral_le_ereal_of_enat_iff[simp]: "numeral m \<le> ereal_of_enat n \<longleftrightarrow> numeral m \<le> n" | 
| 1900 | by (cases n) (auto dest: natceiling_le intro: natceiling_le_eq[THEN iffD1]) | |
| 45934 | 1901 | |
| 53873 | 1902 | lemma numeral_less_ereal_of_enat_iff[simp]: "numeral m < ereal_of_enat n \<longleftrightarrow> numeral m < n" | 
| 56889 
48a745e1bde7
avoid the Complex constructor, use the more natural Re/Im view; moved csqrt to Complex.
 hoelzl parents: 
56537diff
changeset | 1903 | by (cases n) auto | 
| 50819 
5601ae592679
added some ereal_of_enat_* lemmas (from $AFP/thys/Girth_Chromatic)
 noschinl parents: 
50104diff
changeset | 1904 | |
| 53873 | 1905 | lemma ereal_of_enat_ge_zero_cancel_iff[simp]: "0 \<le> ereal_of_enat n \<longleftrightarrow> 0 \<le> n" | 
| 1906 | by (cases n) (auto simp: enat_0[symmetric]) | |
| 45934 | 1907 | |
| 53873 | 1908 | lemma ereal_of_enat_gt_zero_cancel_iff[simp]: "0 < ereal_of_enat n \<longleftrightarrow> 0 < n" | 
| 1909 | by (cases n) (auto simp: enat_0[symmetric]) | |
| 45934 | 1910 | |
| 53873 | 1911 | lemma ereal_of_enat_zero[simp]: "ereal_of_enat 0 = 0" | 
| 1912 | by (auto simp: enat_0[symmetric]) | |
| 45934 | 1913 | |
| 53873 | 1914 | lemma ereal_of_enat_inf[simp]: "ereal_of_enat n = \<infinity> \<longleftrightarrow> n = \<infinity>" | 
| 50819 
5601ae592679
added some ereal_of_enat_* lemmas (from $AFP/thys/Girth_Chromatic)
 noschinl parents: 
50104diff
changeset | 1915 | by (cases n) auto | 
| 
5601ae592679
added some ereal_of_enat_* lemmas (from $AFP/thys/Girth_Chromatic)
 noschinl parents: 
50104diff
changeset | 1916 | |
| 53873 | 1917 | lemma ereal_of_enat_add: "ereal_of_enat (m + n) = ereal_of_enat m + ereal_of_enat n" | 
| 1918 | by (cases m n rule: enat2_cases) auto | |
| 45934 | 1919 | |
| 1920 | lemma ereal_of_enat_sub: | |
| 53873 | 1921 | assumes "n \<le> m" | 
| 1922 | shows "ereal_of_enat (m - n) = ereal_of_enat m - ereal_of_enat n " | |
| 1923 | using assms by (cases m n rule: enat2_cases) auto | |
| 45934 | 1924 | |
| 1925 | lemma ereal_of_enat_mult: | |
| 1926 | "ereal_of_enat (m * n) = ereal_of_enat m * ereal_of_enat n" | |
| 53873 | 1927 | by (cases m n rule: enat2_cases) auto | 
| 45934 | 1928 | |
| 1929 | lemmas ereal_of_enat_pushin = ereal_of_enat_add ereal_of_enat_sub ereal_of_enat_mult | |
| 1930 | lemmas ereal_of_enat_pushout = ereal_of_enat_pushin[symmetric] | |
| 1931 | ||
| 1932 | ||
| 43920 | 1933 | subsection "Limits on @{typ ereal}"
 | 
| 41973 | 1934 | |
| 1935 | subsubsection "Topological space" | |
| 1936 | ||
| 51775 
408d937c9486
revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
 hoelzl parents: 
51774diff
changeset | 1937 | instantiation ereal :: linear_continuum_topology | 
| 41973 | 1938 | begin | 
| 1939 | ||
| 51000 | 1940 | definition "open_ereal" :: "ereal set \<Rightarrow> bool" where | 
| 1941 | open_ereal_generated: "open_ereal = generate_topology (range lessThan \<union> range greaterThan)" | |
| 1942 | ||
| 1943 | instance | |
| 1944 | by default (simp add: open_ereal_generated) | |
| 53873 | 1945 | |
| 51000 | 1946 | end | 
| 41973 | 1947 | |
| 43920 | 1948 | lemma open_PInfty: "open A \<Longrightarrow> \<infinity> \<in> A \<Longrightarrow> (\<exists>x. {ereal x<..} \<subseteq> A)"
 | 
| 51000 | 1949 | unfolding open_ereal_generated | 
| 1950 | proof (induct rule: generate_topology.induct) | |
| 1951 | case (Int A B) | |
| 53374 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53216diff
changeset | 1952 |   then obtain x z where "\<infinity> \<in> A \<Longrightarrow> {ereal x <..} \<subseteq> A" "\<infinity> \<in> B \<Longrightarrow> {ereal z <..} \<subseteq> B"
 | 
| 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53216diff
changeset | 1953 | by auto | 
| 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53216diff
changeset | 1954 | with Int show ?case | 
| 51000 | 1955 | by (intro exI[of _ "max x z"]) fastforce | 
| 1956 | next | |
| 53873 | 1957 | case (Basis S) | 
| 1958 |   {
 | |
| 1959 | fix x | |
| 1960 | have "x \<noteq> \<infinity> \<Longrightarrow> \<exists>t. x \<le> ereal t" | |
| 1961 | by (cases x) auto | |
| 1962 | } | |
| 1963 | moreover note Basis | |
| 51000 | 1964 | ultimately show ?case | 
| 1965 | by (auto split: ereal.split) | |
| 1966 | qed (fastforce simp add: vimage_Union)+ | |
| 41973 | 1967 | |
| 43920 | 1968 | lemma open_MInfty: "open A \<Longrightarrow> -\<infinity> \<in> A \<Longrightarrow> (\<exists>x. {..<ereal x} \<subseteq> A)"
 | 
| 51000 | 1969 | unfolding open_ereal_generated | 
| 1970 | proof (induct rule: generate_topology.induct) | |
| 1971 | case (Int A B) | |
| 53374 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53216diff
changeset | 1972 |   then obtain x z where "-\<infinity> \<in> A \<Longrightarrow> {..< ereal x} \<subseteq> A" "-\<infinity> \<in> B \<Longrightarrow> {..< ereal z} \<subseteq> B"
 | 
| 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53216diff
changeset | 1973 | by auto | 
| 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53216diff
changeset | 1974 | with Int show ?case | 
| 51000 | 1975 | by (intro exI[of _ "min x z"]) fastforce | 
| 1976 | next | |
| 53873 | 1977 | case (Basis S) | 
| 1978 |   {
 | |
| 1979 | fix x | |
| 1980 | have "x \<noteq> - \<infinity> \<Longrightarrow> \<exists>t. ereal t \<le> x" | |
| 1981 | by (cases x) auto | |
| 1982 | } | |
| 1983 | moreover note Basis | |
| 51000 | 1984 | ultimately show ?case | 
| 1985 | by (auto split: ereal.split) | |
| 1986 | qed (fastforce simp add: vimage_Union)+ | |
| 1987 | ||
| 1988 | lemma open_ereal_vimage: "open S \<Longrightarrow> open (ereal -` S)" | |
| 1989 | unfolding open_ereal_generated | |
| 1990 | proof (induct rule: generate_topology.induct) | |
| 53873 | 1991 | case (Int A B) | 
| 1992 | then show ?case | |
| 1993 | by auto | |
| 51000 | 1994 | next | 
| 53873 | 1995 | case (Basis S) | 
| 1996 |   {
 | |
| 1997 | fix x have | |
| 51000 | 1998 |       "ereal -` {..<x} = (case x of PInfty \<Rightarrow> UNIV | MInfty \<Rightarrow> {} | ereal r \<Rightarrow> {..<r})"
 | 
| 1999 |       "ereal -` {x<..} = (case x of PInfty \<Rightarrow> {} | MInfty \<Rightarrow> UNIV | ereal r \<Rightarrow> {r<..})"
 | |
| 53873 | 2000 | by (induct x) auto | 
| 2001 | } | |
| 2002 | moreover note Basis | |
| 51000 | 2003 | ultimately show ?case | 
| 2004 | by (auto split: ereal.split) | |
| 2005 | qed (fastforce simp add: vimage_Union)+ | |
| 2006 | ||
| 2007 | lemma open_ereal: "open S \<Longrightarrow> open (ereal ` S)" | |
| 2008 | unfolding open_generated_order[where 'a=real] | |
| 2009 | proof (induct rule: generate_topology.induct) | |
| 2010 | case (Basis S) | |
| 53873 | 2011 |   moreover {
 | 
| 2012 | fix x | |
| 2013 |     have "ereal ` {..< x} = { -\<infinity> <..< ereal x }"
 | |
| 2014 | apply auto | |
| 2015 | apply (case_tac xa) | |
| 2016 | apply auto | |
| 2017 | done | |
| 2018 | } | |
| 2019 |   moreover {
 | |
| 2020 | fix x | |
| 2021 |     have "ereal ` {x <..} = { ereal x <..< \<infinity> }"
 | |
| 2022 | apply auto | |
| 2023 | apply (case_tac xa) | |
| 2024 | apply auto | |
| 2025 | done | |
| 2026 | } | |
| 51000 | 2027 | ultimately show ?case | 
| 2028 | by auto | |
| 2029 | qed (auto simp add: image_Union image_Int) | |
| 2030 | ||
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2031 | |
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2032 | lemma eventually_finite: | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2033 | fixes x :: ereal | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2034 | assumes "\<bar>x\<bar> \<noteq> \<infinity>" "(f ---> x) F" | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2035 | shows "eventually (\<lambda>x. \<bar>f x\<bar> \<noteq> \<infinity>) F" | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2036 | proof - | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2037 | have "(f ---> ereal (real x)) F" | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2038 | using assms by (cases x) auto | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2039 | then have "eventually (\<lambda>x. f x \<in> ereal ` UNIV) F" | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2040 | by (rule topological_tendstoD) (auto intro: open_ereal) | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2041 | also have "(\<lambda>x. f x \<in> ereal ` UNIV) = (\<lambda>x. \<bar>f x\<bar> \<noteq> \<infinity>)" | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2042 | by auto | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2043 | finally show ?thesis . | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2044 | qed | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2045 | |
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2046 | |
| 53873 | 2047 | lemma open_ereal_def: | 
| 2048 |   "open A \<longleftrightarrow> open (ereal -` A) \<and> (\<infinity> \<in> A \<longrightarrow> (\<exists>x. {ereal x <..} \<subseteq> A)) \<and> (-\<infinity> \<in> A \<longrightarrow> (\<exists>x. {..<ereal x} \<subseteq> A))"
 | |
| 51000 | 2049 | (is "open A \<longleftrightarrow> ?rhs") | 
| 2050 | proof | |
| 53873 | 2051 | assume "open A" | 
| 2052 | then show ?rhs | |
| 51000 | 2053 | using open_PInfty open_MInfty open_ereal_vimage by auto | 
| 2054 | next | |
| 2055 | assume "?rhs" | |
| 2056 |   then obtain x y where A: "open (ereal -` A)" "\<infinity> \<in> A \<Longrightarrow> {ereal x<..} \<subseteq> A" "-\<infinity> \<in> A \<Longrightarrow> {..< ereal y} \<subseteq> A"
 | |
| 2057 | by auto | |
| 2058 |   have *: "A = ereal ` (ereal -` A) \<union> (if \<infinity> \<in> A then {ereal x<..} else {}) \<union> (if -\<infinity> \<in> A then {..< ereal y} else {})"
 | |
| 2059 | using A(2,3) by auto | |
| 2060 | from open_ereal[OF A(1)] show "open A" | |
| 2061 | by (subst *) (auto simp: open_Un) | |
| 2062 | qed | |
| 41973 | 2063 | |
| 53873 | 2064 | lemma open_PInfty2: | 
| 2065 | assumes "open A" | |
| 2066 | and "\<infinity> \<in> A" | |
| 2067 |   obtains x where "{ereal x<..} \<subseteq> A"
 | |
| 41973 | 2068 | using open_PInfty[OF assms] by auto | 
| 2069 | ||
| 53873 | 2070 | lemma open_MInfty2: | 
| 2071 | assumes "open A" | |
| 2072 | and "-\<infinity> \<in> A" | |
| 2073 |   obtains x where "{..<ereal x} \<subseteq> A"
 | |
| 41973 | 2074 | using open_MInfty[OF assms] by auto | 
| 2075 | ||
| 53873 | 2076 | lemma ereal_openE: | 
| 2077 | assumes "open A" | |
| 2078 | obtains x y where "open (ereal -` A)" | |
| 2079 |     and "\<infinity> \<in> A \<Longrightarrow> {ereal x<..} \<subseteq> A"
 | |
| 2080 |     and "-\<infinity> \<in> A \<Longrightarrow> {..<ereal y} \<subseteq> A"
 | |
| 43920 | 2081 | using assms open_ereal_def by auto | 
| 41973 | 2082 | |
| 51000 | 2083 | lemmas open_ereal_lessThan = open_lessThan[where 'a=ereal] | 
| 2084 | lemmas open_ereal_greaterThan = open_greaterThan[where 'a=ereal] | |
| 2085 | lemmas ereal_open_greaterThanLessThan = open_greaterThanLessThan[where 'a=ereal] | |
| 2086 | lemmas closed_ereal_atLeast = closed_atLeast[where 'a=ereal] | |
| 2087 | lemmas closed_ereal_atMost = closed_atMost[where 'a=ereal] | |
| 2088 | lemmas closed_ereal_atLeastAtMost = closed_atLeastAtMost[where 'a=ereal] | |
| 2089 | lemmas closed_ereal_singleton = closed_singleton[where 'a=ereal] | |
| 53873 | 2090 | |
| 43920 | 2091 | lemma ereal_open_cont_interval: | 
| 43923 | 2092 | fixes S :: "ereal set" | 
| 53873 | 2093 | assumes "open S" | 
| 2094 | and "x \<in> S" | |
| 2095 | and "\<bar>x\<bar> \<noteq> \<infinity>" | |
| 2096 |   obtains e where "e > 0" and "{x-e <..< x+e} \<subseteq> S"
 | |
| 2097 | proof - | |
| 2098 | from `open S` | |
| 2099 | have "open (ereal -` S)" | |
| 2100 | by (rule ereal_openE) | |
| 2101 | then obtain e where "e > 0" and e: "\<And>y. dist y (real x) < e \<Longrightarrow> ereal y \<in> S" | |
| 41980 
28b51effc5ed
split Extended_Reals into parts for Library and Multivariate_Analysis
 hoelzl parents: 
41979diff
changeset | 2102 | using assms unfolding open_dist by force | 
| 41975 | 2103 | show thesis | 
| 2104 | proof (intro that subsetI) | |
| 53873 | 2105 | show "0 < ereal e" | 
| 2106 | using `0 < e` by auto | |
| 2107 | fix y | |
| 2108 |     assume "y \<in> {x - ereal e<..<x + ereal e}"
 | |
| 43920 | 2109 | with assms obtain t where "y = ereal t" "dist t (real x) < e" | 
| 53873 | 2110 | by (cases y) (auto simp: dist_real_def) | 
| 2111 | then show "y \<in> S" | |
| 2112 | using e[of t] by auto | |
| 41975 | 2113 | qed | 
| 41973 | 2114 | qed | 
| 2115 | ||
| 43920 | 2116 | lemma ereal_open_cont_interval2: | 
| 43923 | 2117 | fixes S :: "ereal set" | 
| 53873 | 2118 | assumes "open S" | 
| 2119 | and "x \<in> S" | |
| 2120 | and x: "\<bar>x\<bar> \<noteq> \<infinity>" | |
| 2121 |   obtains a b where "a < x" and "x < b" and "{a <..< b} \<subseteq> S"
 | |
| 53381 | 2122 | proof - | 
| 2123 |   obtain e where "0 < e" "{x - e<..<x + e} \<subseteq> S"
 | |
| 2124 | using assms by (rule ereal_open_cont_interval) | |
| 53873 | 2125 | with that[of "x - e" "x + e"] ereal_between[OF x, of e] | 
| 2126 | show thesis | |
| 2127 | by auto | |
| 41973 | 2128 | qed | 
| 2129 | ||
| 2130 | subsubsection {* Convergent sequences *}
 | |
| 2131 | ||
| 53873 | 2132 | lemma lim_ereal[simp]: "((\<lambda>n. ereal (f n)) ---> ereal x) net \<longleftrightarrow> (f ---> x) net" | 
| 2133 | (is "?l = ?r") | |
| 41973 | 2134 | proof (intro iffI topological_tendstoI) | 
| 53873 | 2135 | fix S | 
| 2136 | assume "?l" and "open S" and "x \<in> S" | |
| 41973 | 2137 | then show "eventually (\<lambda>x. f x \<in> S) net" | 
| 43920 | 2138 | using `?l`[THEN topological_tendstoD, OF open_ereal, OF `open S`] | 
| 41973 | 2139 | by (simp add: inj_image_mem_iff) | 
| 2140 | next | |
| 53873 | 2141 | fix S | 
| 2142 | assume "?r" and "open S" and "ereal x \<in> S" | |
| 43920 | 2143 | show "eventually (\<lambda>x. ereal (f x) \<in> S) net" | 
| 2144 | using `?r`[THEN topological_tendstoD, OF open_ereal_vimage, OF `open S`] | |
| 53873 | 2145 | using `ereal x \<in> S` | 
| 2146 | by auto | |
| 41973 | 2147 | qed | 
| 2148 | ||
| 43920 | 2149 | lemma lim_real_of_ereal[simp]: | 
| 2150 | assumes lim: "(f ---> ereal x) net" | |
| 41973 | 2151 | shows "((\<lambda>x. real (f x)) ---> x) net" | 
| 2152 | proof (intro topological_tendstoI) | |
| 53873 | 2153 | fix S | 
| 2154 | assume "open S" and "x \<in> S" | |
| 43920 | 2155 | then have S: "open S" "ereal x \<in> ereal ` S" | 
| 41973 | 2156 | by (simp_all add: inj_image_mem_iff) | 
| 53873 | 2157 | have "\<forall>x. f x \<in> ereal ` S \<longrightarrow> real (f x) \<in> S" | 
| 2158 | by auto | |
| 43920 | 2159 | from this lim[THEN topological_tendstoD, OF open_ereal, OF S] | 
| 41973 | 2160 | show "eventually (\<lambda>x. real (f x) \<in> S) net" | 
| 2161 | by (rule eventually_mono) | |
| 2162 | qed | |
| 2163 | ||
| 51000 | 2164 | lemma tendsto_PInfty: "(f ---> \<infinity>) F \<longleftrightarrow> (\<forall>r. eventually (\<lambda>x. ereal r < f x) F)" | 
| 51022 
78de6c7e8a58
replace open_interval with the rule open_tendstoI; generalize Liminf/Limsup rules
 hoelzl parents: 
51000diff
changeset | 2165 | proof - | 
| 53873 | 2166 |   {
 | 
| 2167 | fix l :: ereal | |
| 2168 | assume "\<forall>r. eventually (\<lambda>x. ereal r < f x) F" | |
| 2169 | from this[THEN spec, of "real l"] have "l \<noteq> \<infinity> \<Longrightarrow> eventually (\<lambda>x. l < f x) F" | |
| 2170 | by (cases l) (auto elim: eventually_elim1) | |
| 2171 | } | |
| 51022 
78de6c7e8a58
replace open_interval with the rule open_tendstoI; generalize Liminf/Limsup rules
 hoelzl parents: 
51000diff
changeset | 2172 | then show ?thesis | 
| 
78de6c7e8a58
replace open_interval with the rule open_tendstoI; generalize Liminf/Limsup rules
 hoelzl parents: 
51000diff
changeset | 2173 | by (auto simp: order_tendsto_iff) | 
| 41973 | 2174 | qed | 
| 2175 | ||
| 57025 | 2176 | lemma tendsto_PInfty_eq_at_top: | 
| 2177 | "((\<lambda>z. ereal (f z)) ---> \<infinity>) F \<longleftrightarrow> (LIM z F. f z :> at_top)" | |
| 2178 | unfolding tendsto_PInfty filterlim_at_top_dense by simp | |
| 2179 | ||
| 51000 | 2180 | lemma tendsto_MInfty: "(f ---> -\<infinity>) F \<longleftrightarrow> (\<forall>r. eventually (\<lambda>x. f x < ereal r) F)" | 
| 2181 | unfolding tendsto_def | |
| 2182 | proof safe | |
| 53381 | 2183 | fix S :: "ereal set" | 
| 2184 | assume "open S" "-\<infinity> \<in> S" | |
| 2185 |   from open_MInfty[OF this] obtain B where "{..<ereal B} \<subseteq> S" ..
 | |
| 51000 | 2186 | moreover | 
| 2187 | assume "\<forall>r::real. eventually (\<lambda>z. f z < r) F" | |
| 53873 | 2188 |   then have "eventually (\<lambda>z. f z \<in> {..< B}) F"
 | 
| 2189 | by auto | |
| 2190 | ultimately show "eventually (\<lambda>z. f z \<in> S) F" | |
| 2191 | by (auto elim!: eventually_elim1) | |
| 51000 | 2192 | next | 
| 53873 | 2193 | fix x | 
| 2194 | assume "\<forall>S. open S \<longrightarrow> -\<infinity> \<in> S \<longrightarrow> eventually (\<lambda>x. f x \<in> S) F" | |
| 2195 |   from this[rule_format, of "{..< ereal x}"] show "eventually (\<lambda>y. f y < ereal x) F"
 | |
| 2196 | by auto | |
| 41973 | 2197 | qed | 
| 2198 | ||
| 51000 | 2199 | lemma Lim_PInfty: "f ----> \<infinity> \<longleftrightarrow> (\<forall>B. \<exists>N. \<forall>n\<ge>N. f n \<ge> ereal B)" | 
| 2200 | unfolding tendsto_PInfty eventually_sequentially | |
| 2201 | proof safe | |
| 53873 | 2202 | fix r | 
| 2203 | assume "\<forall>r. \<exists>N. \<forall>n\<ge>N. ereal r \<le> f n" | |
| 2204 | then obtain N where "\<forall>n\<ge>N. ereal (r + 1) \<le> f n" | |
| 2205 | by blast | |
| 2206 | moreover have "ereal r < ereal (r + 1)" | |
| 2207 | by auto | |
| 51000 | 2208 | ultimately show "\<exists>N. \<forall>n\<ge>N. ereal r < f n" | 
| 2209 | by (blast intro: less_le_trans) | |
| 2210 | qed (blast intro: less_imp_le) | |
| 41973 | 2211 | |
| 51000 | 2212 | lemma Lim_MInfty: "f ----> -\<infinity> \<longleftrightarrow> (\<forall>B. \<exists>N. \<forall>n\<ge>N. ereal B \<ge> f n)" | 
| 2213 | unfolding tendsto_MInfty eventually_sequentially | |
| 2214 | proof safe | |
| 53873 | 2215 | fix r | 
| 2216 | assume "\<forall>r. \<exists>N. \<forall>n\<ge>N. f n \<le> ereal r" | |
| 2217 | then obtain N where "\<forall>n\<ge>N. f n \<le> ereal (r - 1)" | |
| 2218 | by blast | |
| 2219 | moreover have "ereal (r - 1) < ereal r" | |
| 2220 | by auto | |
| 51000 | 2221 | ultimately show "\<exists>N. \<forall>n\<ge>N. f n < ereal r" | 
| 2222 | by (blast intro: le_less_trans) | |
| 2223 | qed (blast intro: less_imp_le) | |
| 41973 | 2224 | |
| 51000 | 2225 | lemma Lim_bounded_PInfty: "f ----> l \<Longrightarrow> (\<And>n. f n \<le> ereal B) \<Longrightarrow> l \<noteq> \<infinity>" | 
| 2226 | using LIMSEQ_le_const2[of f l "ereal B"] by auto | |
| 41973 | 2227 | |
| 51000 | 2228 | lemma Lim_bounded_MInfty: "f ----> l \<Longrightarrow> (\<And>n. ereal B \<le> f n) \<Longrightarrow> l \<noteq> -\<infinity>" | 
| 2229 | using LIMSEQ_le_const[of f l "ereal B"] by auto | |
| 41973 | 2230 | |
| 2231 | lemma tendsto_explicit: | |
| 53873 | 2232 | "f ----> f0 \<longleftrightarrow> (\<forall>S. open S \<longrightarrow> f0 \<in> S \<longrightarrow> (\<exists>N. \<forall>n\<ge>N. f n \<in> S))" | 
| 41973 | 2233 | unfolding tendsto_def eventually_sequentially by auto | 
| 2234 | ||
| 53873 | 2235 | lemma Lim_bounded_PInfty2: "f ----> l \<Longrightarrow> \<forall>n\<ge>N. f n \<le> ereal B \<Longrightarrow> l \<noteq> \<infinity>" | 
| 51000 | 2236 | using LIMSEQ_le_const2[of f l "ereal B"] by fastforce | 
| 41973 | 2237 | |
| 53873 | 2238 | lemma Lim_bounded_ereal: "f ----> (l :: 'a::linorder_topology) \<Longrightarrow> \<forall>n\<ge>M. f n \<le> C \<Longrightarrow> l \<le> C" | 
| 51000 | 2239 | by (intro LIMSEQ_le_const2) auto | 
| 41973 | 2240 | |
| 51351 | 2241 | lemma Lim_bounded2_ereal: | 
| 53873 | 2242 | assumes lim:"f ----> (l :: 'a::linorder_topology)" | 
| 2243 | and ge: "\<forall>n\<ge>N. f n \<ge> C" | |
| 2244 | shows "l \<ge> C" | |
| 51351 | 2245 | using ge | 
| 2246 | by (intro tendsto_le[OF trivial_limit_sequentially lim tendsto_const]) | |
| 2247 | (auto simp: eventually_sequentially) | |
| 2248 | ||
| 43920 | 2249 | lemma real_of_ereal_mult[simp]: | 
| 53873 | 2250 | fixes a b :: ereal | 
| 2251 | shows "real (a * b) = real a * real b" | |
| 43920 | 2252 | by (cases rule: ereal2_cases[of a b]) auto | 
| 41973 | 2253 | |
| 43920 | 2254 | lemma real_of_ereal_eq_0: | 
| 53873 | 2255 | fixes x :: ereal | 
| 2256 | shows "real x = 0 \<longleftrightarrow> x = \<infinity> \<or> x = -\<infinity> \<or> x = 0" | |
| 41973 | 2257 | by (cases x) auto | 
| 2258 | ||
| 43920 | 2259 | lemma tendsto_ereal_realD: | 
| 2260 | fixes f :: "'a \<Rightarrow> ereal" | |
| 53873 | 2261 | assumes "x \<noteq> 0" | 
| 2262 | and tendsto: "((\<lambda>x. ereal (real (f x))) ---> x) net" | |
| 41973 | 2263 | shows "(f ---> x) net" | 
| 2264 | proof (intro topological_tendstoI) | |
| 53873 | 2265 | fix S | 
| 2266 | assume S: "open S" "x \<in> S" | |
| 2267 |   with `x \<noteq> 0` have "open (S - {0})" "x \<in> S - {0}"
 | |
| 2268 | by auto | |
| 41973 | 2269 | from tendsto[THEN topological_tendstoD, OF this] | 
| 2270 | show "eventually (\<lambda>x. f x \<in> S) net" | |
| 44142 | 2271 | by (rule eventually_rev_mp) (auto simp: ereal_real) | 
| 41973 | 2272 | qed | 
| 2273 | ||
| 43920 | 2274 | lemma tendsto_ereal_realI: | 
| 2275 | fixes f :: "'a \<Rightarrow> ereal" | |
| 41976 | 2276 | assumes x: "\<bar>x\<bar> \<noteq> \<infinity>" and tendsto: "(f ---> x) net" | 
| 43920 | 2277 | shows "((\<lambda>x. ereal (real (f x))) ---> x) net" | 
| 41973 | 2278 | proof (intro topological_tendstoI) | 
| 53873 | 2279 | fix S | 
| 2280 | assume "open S" and "x \<in> S" | |
| 2281 |   with x have "open (S - {\<infinity>, -\<infinity>})" "x \<in> S - {\<infinity>, -\<infinity>}"
 | |
| 2282 | by auto | |
| 41973 | 2283 | from tendsto[THEN topological_tendstoD, OF this] | 
| 43920 | 2284 | show "eventually (\<lambda>x. ereal (real (f x)) \<in> S) net" | 
| 2285 | by (elim eventually_elim1) (auto simp: ereal_real) | |
| 41973 | 2286 | qed | 
| 2287 | ||
| 43920 | 2288 | lemma ereal_mult_cancel_left: | 
| 53873 | 2289 | fixes a b c :: ereal | 
| 2290 | shows "a * b = a * c \<longleftrightarrow> (\<bar>a\<bar> = \<infinity> \<and> 0 < b * c) \<or> a = 0 \<or> b = c" | |
| 2291 | by (cases rule: ereal3_cases[of a b c]) (simp_all add: zero_less_mult_iff) | |
| 41973 | 2292 | |
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2293 | lemma tendsto_add_ereal: | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2294 | fixes x y :: ereal | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2295 | assumes x: "\<bar>x\<bar> \<noteq> \<infinity>" and y: "\<bar>y\<bar> \<noteq> \<infinity>" | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2296 | assumes f: "(f ---> x) F" and g: "(g ---> y) F" | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2297 | shows "((\<lambda>x. f x + g x) ---> x + y) F" | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2298 | proof - | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2299 | from x obtain r where x': "x = ereal r" by (cases x) auto | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2300 | with f have "((\<lambda>i. real (f i)) ---> r) F" by simp | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2301 | moreover | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2302 | from y obtain p where y': "y = ereal p" by (cases y) auto | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2303 | with g have "((\<lambda>i. real (g i)) ---> p) F" by simp | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2304 | ultimately have "((\<lambda>i. real (f i) + real (g i)) ---> r + p) F" | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2305 | by (rule tendsto_add) | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2306 | moreover | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2307 | from eventually_finite[OF x f] eventually_finite[OF y g] | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2308 | have "eventually (\<lambda>x. f x + g x = ereal (real (f x) + real (g x))) F" | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2309 | by eventually_elim auto | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2310 | ultimately show ?thesis | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2311 | by (simp add: x' y' cong: filterlim_cong) | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2312 | qed | 
| 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
56927diff
changeset | 2313 | |
| 43920 | 2314 | lemma ereal_inj_affinity: | 
| 43923 | 2315 | fixes m t :: ereal | 
| 53873 | 2316 | assumes "\<bar>m\<bar> \<noteq> \<infinity>" | 
| 2317 | and "m \<noteq> 0" | |
| 2318 | and "\<bar>t\<bar> \<noteq> \<infinity>" | |
| 41973 | 2319 | shows "inj_on (\<lambda>x. m * x + t) A" | 
| 2320 | using assms | |
| 43920 | 2321 | by (cases rule: ereal2_cases[of m t]) | 
| 2322 | (auto intro!: inj_onI simp: ereal_add_cancel_right ereal_mult_cancel_left) | |
| 41973 | 2323 | |
| 43920 | 2324 | lemma ereal_PInfty_eq_plus[simp]: | 
| 43923 | 2325 | fixes a b :: ereal | 
| 41973 | 2326 | shows "\<infinity> = a + b \<longleftrightarrow> a = \<infinity> \<or> b = \<infinity>" | 
| 43920 | 2327 | by (cases rule: ereal2_cases[of a b]) auto | 
| 41973 | 2328 | |
| 43920 | 2329 | lemma ereal_MInfty_eq_plus[simp]: | 
| 43923 | 2330 | fixes a b :: ereal | 
| 41973 | 2331 | shows "-\<infinity> = a + b \<longleftrightarrow> (a = -\<infinity> \<and> b \<noteq> \<infinity>) \<or> (b = -\<infinity> \<and> a \<noteq> \<infinity>)" | 
| 43920 | 2332 | by (cases rule: ereal2_cases[of a b]) auto | 
| 41973 | 2333 | |
| 43920 | 2334 | lemma ereal_less_divide_pos: | 
| 43923 | 2335 | fixes x y :: ereal | 
| 2336 | shows "x > 0 \<Longrightarrow> x \<noteq> \<infinity> \<Longrightarrow> y < z / x \<longleftrightarrow> x * y < z" | |
| 43920 | 2337 | by (cases rule: ereal3_cases[of x y z]) (auto simp: field_simps) | 
| 41973 | 2338 | |
| 43920 | 2339 | lemma ereal_divide_less_pos: | 
| 43923 | 2340 | fixes x y z :: ereal | 
| 2341 | shows "x > 0 \<Longrightarrow> x \<noteq> \<infinity> \<Longrightarrow> y / x < z \<longleftrightarrow> y < x * z" | |
| 43920 | 2342 | by (cases rule: ereal3_cases[of x y z]) (auto simp: field_simps) | 
| 41973 | 2343 | |
| 43920 | 2344 | lemma ereal_divide_eq: | 
| 43923 | 2345 | fixes a b c :: ereal | 
| 2346 | shows "b \<noteq> 0 \<Longrightarrow> \<bar>b\<bar> \<noteq> \<infinity> \<Longrightarrow> a / b = c \<longleftrightarrow> a = b * c" | |
| 43920 | 2347 | by (cases rule: ereal3_cases[of a b c]) | 
| 41973 | 2348 | (simp_all add: field_simps) | 
| 2349 | ||
| 43923 | 2350 | lemma ereal_inverse_not_MInfty[simp]: "inverse (a::ereal) \<noteq> -\<infinity>" | 
| 41973 | 2351 | by (cases a) auto | 
| 2352 | ||
| 43920 | 2353 | lemma ereal_mult_m1[simp]: "x * ereal (-1) = -x" | 
| 41973 | 2354 | by (cases x) auto | 
| 2355 | ||
| 53873 | 2356 | lemma ereal_real': | 
| 2357 | assumes "\<bar>x\<bar> \<noteq> \<infinity>" | |
| 2358 | shows "ereal (real x) = x" | |
| 41976 | 2359 | using assms by auto | 
| 41973 | 2360 | |
| 53873 | 2361 | lemma real_ereal_id: "real \<circ> ereal = id" | 
| 2362 | proof - | |
| 2363 |   {
 | |
| 2364 | fix x | |
| 2365 | have "(real o ereal) x = id x" | |
| 2366 | by auto | |
| 2367 | } | |
| 2368 | then show ?thesis | |
| 2369 | using ext by blast | |
| 41973 | 2370 | qed | 
| 2371 | ||
| 43923 | 2372 | lemma open_image_ereal: "open(UNIV-{ \<infinity> , (-\<infinity> :: ereal)})"
 | 
| 53873 | 2373 | by (metis range_ereal open_ereal open_UNIV) | 
| 41973 | 2374 | |
| 43920 | 2375 | lemma ereal_le_distrib: | 
| 53873 | 2376 | fixes a b c :: ereal | 
| 2377 | shows "c * (a + b) \<le> c * a + c * b" | |
| 43920 | 2378 | by (cases rule: ereal3_cases[of a b c]) | 
| 41973 | 2379 | (auto simp add: field_simps not_le mult_le_0_iff mult_less_0_iff) | 
| 2380 | ||
| 43920 | 2381 | lemma ereal_pos_distrib: | 
| 53873 | 2382 | fixes a b c :: ereal | 
| 2383 | assumes "0 \<le> c" | |
| 2384 | and "c \<noteq> \<infinity>" | |
| 2385 | shows "c * (a + b) = c * a + c * b" | |
| 2386 | using assms | |
| 2387 | by (cases rule: ereal3_cases[of a b c]) | |
| 2388 | (auto simp add: field_simps not_le mult_le_0_iff mult_less_0_iff) | |
| 41973 | 2389 | |
| 43920 | 2390 | lemma ereal_pos_le_distrib: | 
| 53873 | 2391 | fixes a b c :: ereal | 
| 2392 | assumes "c \<ge> 0" | |
| 2393 | shows "c * (a + b) \<le> c * a + c * b" | |
| 2394 | using assms | |
| 2395 | by (cases rule: ereal3_cases[of a b c]) (auto simp add: field_simps) | |
| 41973 | 2396 | |
| 53873 | 2397 | lemma ereal_max_mono: "(a::ereal) \<le> b \<Longrightarrow> c \<le> d \<Longrightarrow> max a c \<le> max b d" | 
| 43920 | 2398 | by (metis sup_ereal_def sup_mono) | 
| 41973 | 2399 | |
| 53873 | 2400 | lemma ereal_max_least: "(a::ereal) \<le> x \<Longrightarrow> c \<le> x \<Longrightarrow> max a c \<le> x" | 
| 43920 | 2401 | by (metis sup_ereal_def sup_least) | 
| 41973 | 2402 | |
| 51000 | 2403 | lemma ereal_LimI_finite: | 
| 2404 | fixes x :: ereal | |
| 2405 | assumes "\<bar>x\<bar> \<noteq> \<infinity>" | |
| 53873 | 2406 | and "\<And>r. 0 < r \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. u n < x + r \<and> x < u n + r" | 
| 51000 | 2407 | shows "u ----> x" | 
| 2408 | proof (rule topological_tendstoI, unfold eventually_sequentially) | |
| 53873 | 2409 | obtain rx where rx: "x = ereal rx" | 
| 2410 | using assms by (cases x) auto | |
| 2411 | fix S | |
| 2412 | assume "open S" and "x \<in> S" | |
| 2413 | then have "open (ereal -` S)" | |
| 2414 | unfolding open_ereal_def by auto | |
| 2415 | with `x \<in> S` obtain r where "0 < r" and dist: "\<And>y. dist y rx < r \<Longrightarrow> ereal y \<in> S" | |
| 2416 | unfolding open_real_def rx by auto | |
| 51000 | 2417 | then obtain n where | 
| 53873 | 2418 | upper: "\<And>N. n \<le> N \<Longrightarrow> u N < x + ereal r" and | 
| 2419 | lower: "\<And>N. n \<le> N \<Longrightarrow> x < u N + ereal r" | |
| 2420 | using assms(2)[of "ereal r"] by auto | |
| 2421 | show "\<exists>N. \<forall>n\<ge>N. u n \<in> S" | |
| 51000 | 2422 | proof (safe intro!: exI[of _ n]) | 
| 53873 | 2423 | fix N | 
| 2424 | assume "n \<le> N" | |
| 51000 | 2425 | from upper[OF this] lower[OF this] assms `0 < r` | 
| 53873 | 2426 |     have "u N \<notin> {\<infinity>,(-\<infinity>)}"
 | 
| 2427 | by auto | |
| 2428 | then obtain ra where ra_def: "(u N) = ereal ra" | |
| 2429 | by (cases "u N") auto | |
| 2430 | then have "rx < ra + r" and "ra < rx + r" | |
| 2431 | using rx assms `0 < r` lower[OF `n \<le> N`] upper[OF `n \<le> N`] | |
| 2432 | by auto | |
| 2433 | then have "dist (real (u N)) rx < r" | |
| 2434 | using rx ra_def | |
| 51000 | 2435 | by (auto simp: dist_real_def abs_diff_less_iff field_simps) | 
| 53873 | 2436 | from dist[OF this] show "u N \<in> S" | 
| 2437 |       using `u N  \<notin> {\<infinity>, -\<infinity>}`
 | |
| 51000 | 2438 | by (auto simp: ereal_real split: split_if_asm) | 
| 2439 | qed | |
| 2440 | qed | |
| 2441 | ||
| 2442 | lemma tendsto_obtains_N: | |
| 2443 | assumes "f ----> f0" | |
| 53873 | 2444 | assumes "open S" | 
| 2445 | and "f0 \<in> S" | |
| 2446 | obtains N where "\<forall>n\<ge>N. f n \<in> S" | |
| 51329 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51328diff
changeset | 2447 | using assms using tendsto_def | 
| 51000 | 2448 | using tendsto_explicit[of f f0] assms by auto | 
| 2449 | ||
| 2450 | lemma ereal_LimI_finite_iff: | |
| 2451 | fixes x :: ereal | |
| 2452 | assumes "\<bar>x\<bar> \<noteq> \<infinity>" | |
| 53873 | 2453 | shows "u ----> x \<longleftrightarrow> (\<forall>r. 0 < r \<longrightarrow> (\<exists>N. \<forall>n\<ge>N. u n < x + r \<and> x < u n + r))" | 
| 2454 | (is "?lhs \<longleftrightarrow> ?rhs") | |
| 51000 | 2455 | proof | 
| 2456 | assume lim: "u ----> x" | |
| 53873 | 2457 |   {
 | 
| 2458 | fix r :: ereal | |
| 2459 | assume "r > 0" | |
| 2460 |     then obtain N where "\<forall>n\<ge>N. u n \<in> {x - r <..< x + r}"
 | |
| 51000 | 2461 |        apply (subst tendsto_obtains_N[of u x "{x - r <..< x + r}"])
 | 
| 53873 | 2462 | using lim ereal_between[of x r] assms `r > 0` | 
| 2463 | apply auto | |
| 2464 | done | |
| 2465 | then have "\<exists>N. \<forall>n\<ge>N. u n < x + r \<and> x < u n + r" | |
| 2466 | using ereal_minus_less[of r x] | |
| 2467 | by (cases r) auto | |
| 2468 | } | |
| 2469 | then show ?rhs | |
| 2470 | by auto | |
| 51000 | 2471 | next | 
| 53873 | 2472 | assume ?rhs | 
| 2473 | then show "u ----> x" | |
| 51000 | 2474 | using ereal_LimI_finite[of x] assms by auto | 
| 2475 | qed | |
| 2476 | ||
| 51340 
5e6296afe08d
move Liminf / Limsup lemmas on complete_lattices to its own file
 hoelzl parents: 
51329diff
changeset | 2477 | lemma ereal_Limsup_uminus: | 
| 53873 | 2478 | fixes f :: "'a \<Rightarrow> ereal" | 
| 2479 | shows "Limsup net (\<lambda>x. - (f x)) = - Liminf net f" | |
| 56212 
3253aaf73a01
consolidated theorem names containing INFI and SUPR: have INF and SUP instead uniformly
 haftmann parents: 
56166diff
changeset | 2480 | unfolding Limsup_def Liminf_def ereal_SUP_uminus ereal_INF_uminus .. | 
| 51000 | 2481 | |
| 51340 
5e6296afe08d
move Liminf / Limsup lemmas on complete_lattices to its own file
 hoelzl parents: 
51329diff
changeset | 2482 | lemma liminf_bounded_iff: | 
| 
5e6296afe08d
move Liminf / Limsup lemmas on complete_lattices to its own file
 hoelzl parents: 
51329diff
changeset | 2483 | fixes x :: "nat \<Rightarrow> ereal" | 
| 53873 | 2484 | shows "C \<le> liminf x \<longleftrightarrow> (\<forall>B<C. \<exists>N. \<forall>n\<ge>N. B < x n)" | 
| 2485 | (is "?lhs \<longleftrightarrow> ?rhs") | |
| 51340 
5e6296afe08d
move Liminf / Limsup lemmas on complete_lattices to its own file
 hoelzl parents: 
51329diff
changeset | 2486 | unfolding le_Liminf_iff eventually_sequentially .. | 
| 51000 | 2487 | |
| 53873 | 2488 | |
| 43933 | 2489 | subsubsection {* Tests for code generator *}
 | 
| 2490 | ||
| 2491 | (* A small list of simple arithmetic expressions *) | |
| 2492 | ||
| 56927 | 2493 | value "- \<infinity> :: ereal" | 
| 2494 | value "\<bar>-\<infinity>\<bar> :: ereal" | |
| 2495 | value "4 + 5 / 4 - ereal 2 :: ereal" | |
| 2496 | value "ereal 3 < \<infinity>" | |
| 2497 | value "real (\<infinity>::ereal) = 0" | |
| 43933 | 2498 | |
| 41973 | 2499 | end |