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