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