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