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