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