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