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