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