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