author | wenzelm |
Wed, 12 Mar 2025 11:39:00 +0100 | |
changeset 82265 | 4b875a4c83b0 |
parent 81763 | 2cf8f8e4c1fd |
child 82299 | a0693649e9c6 |
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 |
|
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
6 |
Author: Manuel Eberl, TU München |
41983 | 7 |
*) |
41973 | 8 |
|
60500 | 9 |
section \<open>Extended real number line\<close> |
41973 | 10 |
|
43920 | 11 |
theory Extended_Real |
60636
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents:
60580
diff
changeset
|
12 |
imports Complex_Main Extended_Nat Liminf_Limsup |
41973 | 13 |
begin |
14 |
||
68484 | 15 |
text \<open> |
69593 | 16 |
This should be part of \<^theory>\<open>HOL-Library.Extended_Nat\<close> or \<^theory>\<open>HOL-Library.Order_Continuity\<close>, but then the AFP-entry \<open>Jinja_Thread\<close> fails, as it does overload |
17 |
certain named from \<^theory>\<open>Complex_Main\<close>. |
|
68484 | 18 |
\<close> |
62376
85f38d5f8807
Rename ordered_comm_monoid_add to ordered_cancel_comm_monoid_add. Introduce ordreed_comm_monoid_add, canonically_ordered_comm_monoid and dioid. Setup nat, entat and ennreal as dioids.
hoelzl
parents:
62371
diff
changeset
|
19 |
|
64267 | 20 |
lemma incseq_sumI2: |
62376
85f38d5f8807
Rename ordered_comm_monoid_add to ordered_cancel_comm_monoid_add. Introduce ordreed_comm_monoid_add, canonically_ordered_comm_monoid and dioid. Setup nat, entat and ennreal as dioids.
hoelzl
parents:
62371
diff
changeset
|
21 |
fixes f :: "'i \<Rightarrow> nat \<Rightarrow> 'a::ordered_comm_monoid_add" |
85f38d5f8807
Rename ordered_comm_monoid_add to ordered_cancel_comm_monoid_add. Introduce ordreed_comm_monoid_add, canonically_ordered_comm_monoid and dioid. Setup nat, entat and ennreal as dioids.
hoelzl
parents:
62371
diff
changeset
|
22 |
shows "(\<And>n. n \<in> A \<Longrightarrow> mono (f n)) \<Longrightarrow> mono (\<lambda>i. \<Sum>n\<in>A. f n i)" |
64267 | 23 |
unfolding incseq_def by (auto intro: sum_mono) |
24 |
||
25 |
lemma incseq_sumI: |
|
62376
85f38d5f8807
Rename ordered_comm_monoid_add to ordered_cancel_comm_monoid_add. Introduce ordreed_comm_monoid_add, canonically_ordered_comm_monoid and dioid. Setup nat, entat and ennreal as dioids.
hoelzl
parents:
62371
diff
changeset
|
26 |
fixes f :: "nat \<Rightarrow> 'a::ordered_comm_monoid_add" |
85f38d5f8807
Rename ordered_comm_monoid_add to ordered_cancel_comm_monoid_add. Introduce ordreed_comm_monoid_add, canonically_ordered_comm_monoid and dioid. Setup nat, entat and ennreal as dioids.
hoelzl
parents:
62371
diff
changeset
|
27 |
assumes "\<And>i. 0 \<le> f i" |
64267 | 28 |
shows "incseq (\<lambda>i. sum f {..< i})" |
62376
85f38d5f8807
Rename ordered_comm_monoid_add to ordered_cancel_comm_monoid_add. Introduce ordreed_comm_monoid_add, canonically_ordered_comm_monoid and dioid. Setup nat, entat and ennreal as dioids.
hoelzl
parents:
62371
diff
changeset
|
29 |
proof (intro incseq_SucI) |
85f38d5f8807
Rename ordered_comm_monoid_add to ordered_cancel_comm_monoid_add. Introduce ordreed_comm_monoid_add, canonically_ordered_comm_monoid and dioid. Setup nat, entat and ennreal as dioids.
hoelzl
parents:
62371
diff
changeset
|
30 |
fix n |
64267 | 31 |
have "sum f {..< n} + 0 \<le> sum f {..<n} + f n" |
62376
85f38d5f8807
Rename ordered_comm_monoid_add to ordered_cancel_comm_monoid_add. Introduce ordreed_comm_monoid_add, canonically_ordered_comm_monoid and dioid. Setup nat, entat and ennreal as dioids.
hoelzl
parents:
62371
diff
changeset
|
32 |
using assms by (rule add_left_mono) |
64267 | 33 |
then show "sum f {..< n} \<le> sum f {..< Suc n}" |
62376
85f38d5f8807
Rename ordered_comm_monoid_add to ordered_cancel_comm_monoid_add. Introduce ordreed_comm_monoid_add, canonically_ordered_comm_monoid and dioid. Setup nat, entat and ennreal as dioids.
hoelzl
parents:
62371
diff
changeset
|
34 |
by auto |
85f38d5f8807
Rename ordered_comm_monoid_add to ordered_cancel_comm_monoid_add. Introduce ordreed_comm_monoid_add, canonically_ordered_comm_monoid and dioid. Setup nat, entat and ennreal as dioids.
hoelzl
parents:
62371
diff
changeset
|
35 |
qed |
85f38d5f8807
Rename ordered_comm_monoid_add to ordered_cancel_comm_monoid_add. Introduce ordreed_comm_monoid_add, canonically_ordered_comm_monoid and dioid. Setup nat, entat and ennreal as dioids.
hoelzl
parents:
62371
diff
changeset
|
36 |
|
60172
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
37 |
lemma continuous_at_left_imp_sup_continuous: |
62378
85ed00c1fe7c
generalize more theorems to support enat and ennreal
hoelzl
parents:
62376
diff
changeset
|
38 |
fixes f :: "'a::{complete_linorder, linorder_topology} \<Rightarrow> 'b::{complete_linorder, linorder_topology}" |
60172
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
39 |
assumes "mono f" "\<And>x. continuous (at_left x) f" |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
40 |
shows "sup_continuous f" |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
41 |
unfolding sup_continuous_def |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
42 |
proof safe |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
43 |
fix M :: "nat \<Rightarrow> 'a" assume "incseq M" then show "f (SUP i. M i) = (SUP i. f (M i))" |
69861
62e47f06d22c
avoid context-sensitive simp rules whose context-free form (image_comp) is not simp by default
haftmann
parents:
69661
diff
changeset
|
44 |
using continuous_at_Sup_mono [OF assms, of "range M"] by (simp add: image_comp) |
60172
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
45 |
qed |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
46 |
|
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
47 |
lemma sup_continuous_at_left: |
62378
85ed00c1fe7c
generalize more theorems to support enat and ennreal
hoelzl
parents:
62376
diff
changeset
|
48 |
fixes f :: "'a::{complete_linorder, linorder_topology, first_countable_topology} \<Rightarrow> |
85ed00c1fe7c
generalize more theorems to support enat and ennreal
hoelzl
parents:
62376
diff
changeset
|
49 |
'b::{complete_linorder, linorder_topology}" |
60172
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
50 |
assumes f: "sup_continuous f" |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
51 |
shows "continuous (at_left x) f" |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
52 |
proof cases |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
53 |
assume "x = bot" then show ?thesis |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
54 |
by (simp add: trivial_limit_at_left_bot) |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
55 |
next |
61738
c4f6031f1310
New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents:
61631
diff
changeset
|
56 |
assume x: "x \<noteq> bot" |
60172
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
57 |
show ?thesis |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
58 |
unfolding continuous_within |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
59 |
proof (intro tendsto_at_left_sequentially[of bot]) |
61969 | 60 |
fix S :: "nat \<Rightarrow> 'a" assume S: "incseq S" and S_x: "S \<longlonglongrightarrow> x" |
60172
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
61 |
from S_x have x_eq: "x = (SUP i. S i)" |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
62 |
by (rule LIMSEQ_unique) (intro LIMSEQ_SUP S) |
61969 | 63 |
show "(\<lambda>n. f (S n)) \<longlonglongrightarrow> f x" |
60172
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
64 |
unfolding x_eq sup_continuousD[OF f S] |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
65 |
using S sup_continuous_mono[OF f] by (intro LIMSEQ_SUP) (auto simp: mono_def) |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
66 |
qed (insert x, auto simp: bot_less) |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
67 |
qed |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
68 |
|
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
69 |
lemma sup_continuous_iff_at_left: |
62378
85ed00c1fe7c
generalize more theorems to support enat and ennreal
hoelzl
parents:
62376
diff
changeset
|
70 |
fixes f :: "'a::{complete_linorder, linorder_topology, first_countable_topology} \<Rightarrow> |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
71 |
'b::{complete_linorder, linorder_topology}" |
60172
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
72 |
shows "sup_continuous f \<longleftrightarrow> (\<forall>x. continuous (at_left x) f) \<and> mono f" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
73 |
using continuous_at_left_imp_sup_continuous sup_continuous_at_left sup_continuous_mono |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
74 |
by blast |
61738
c4f6031f1310
New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents:
61631
diff
changeset
|
75 |
|
60172
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
76 |
lemma continuous_at_right_imp_inf_continuous: |
62378
85ed00c1fe7c
generalize more theorems to support enat and ennreal
hoelzl
parents:
62376
diff
changeset
|
77 |
fixes f :: "'a::{complete_linorder, linorder_topology} \<Rightarrow> 'b::{complete_linorder, linorder_topology}" |
60172
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
78 |
assumes "mono f" "\<And>x. continuous (at_right x) f" |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
79 |
shows "inf_continuous f" |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
80 |
unfolding inf_continuous_def |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
81 |
proof safe |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
82 |
fix M :: "nat \<Rightarrow> 'a" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
83 |
assume "decseq M" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
84 |
then show "f (INF i. M i) = (INF i. f (M i))" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
85 |
using continuous_at_Inf_mono [OF assms, of "range M"] |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
86 |
by (simp add: image_comp) |
60172
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
87 |
qed |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
88 |
|
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
89 |
lemma inf_continuous_at_right: |
62378
85ed00c1fe7c
generalize more theorems to support enat and ennreal
hoelzl
parents:
62376
diff
changeset
|
90 |
fixes f :: "'a::{complete_linorder, linorder_topology, first_countable_topology} \<Rightarrow> |
85ed00c1fe7c
generalize more theorems to support enat and ennreal
hoelzl
parents:
62376
diff
changeset
|
91 |
'b::{complete_linorder, linorder_topology}" |
60172
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
92 |
assumes f: "inf_continuous f" |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
93 |
shows "continuous (at_right x) f" |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
94 |
proof cases |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
95 |
assume "x = top" then show ?thesis |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
96 |
by (simp add: trivial_limit_at_right_top) |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
97 |
next |
61738
c4f6031f1310
New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents:
61631
diff
changeset
|
98 |
assume x: "x \<noteq> top" |
60172
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
99 |
show ?thesis |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
100 |
unfolding continuous_within |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
101 |
proof (intro tendsto_at_right_sequentially[of _ top]) |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
102 |
fix S :: "nat \<Rightarrow> 'a" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
103 |
assume S: "decseq S" and S_x: "S \<longlonglongrightarrow> x" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
104 |
then have x_eq: "x = (INF i. S i)" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
105 |
using INF_Lim by blast |
61969 | 106 |
show "(\<lambda>n. f (S n)) \<longlonglongrightarrow> f x" |
60172
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
107 |
unfolding x_eq inf_continuousD[OF f S] |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
108 |
using S inf_continuous_mono[OF f] by (intro LIMSEQ_INF) (auto simp: mono_def antimono_def) |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
109 |
qed (insert x, auto simp: less_top) |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
110 |
qed |
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
111 |
|
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
112 |
lemma inf_continuous_iff_at_right: |
62378
85ed00c1fe7c
generalize more theorems to support enat and ennreal
hoelzl
parents:
62376
diff
changeset
|
113 |
fixes f :: "'a::{complete_linorder, linorder_topology, first_countable_topology} \<Rightarrow> |
85ed00c1fe7c
generalize more theorems to support enat and ennreal
hoelzl
parents:
62376
diff
changeset
|
114 |
'b::{complete_linorder, linorder_topology}" |
60172
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
115 |
shows "inf_continuous f \<longleftrightarrow> (\<forall>x. continuous (at_right x) f) \<and> mono f" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
116 |
using continuous_at_right_imp_inf_continuous inf_continuous_at_right inf_continuous_mono |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
117 |
by blast |
60172
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents:
60060
diff
changeset
|
118 |
|
59115
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
119 |
instantiation enat :: linorder_topology |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
120 |
begin |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
121 |
|
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
122 |
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
|
123 |
"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
|
124 |
|
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
125 |
instance |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
126 |
proof qed (rule open_enat_def) |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
127 |
|
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
128 |
end |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
129 |
|
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
130 |
lemma open_enat: "open {enat n}" |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
131 |
proof (cases n) |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
132 |
case 0 |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
133 |
then have "{enat n} = {..< eSuc 0}" |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
134 |
by (auto simp: enat_0) |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
135 |
then show ?thesis |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
136 |
by simp |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
137 |
next |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
138 |
case (Suc n') |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
139 |
then have "{enat n} = {enat n' <..< enat (Suc n)}" |
72236 | 140 |
using enat_iless by (fastforce simp: set_eq_iff) |
59115
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
141 |
then show ?thesis |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
142 |
by simp |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
143 |
qed |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
144 |
|
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
145 |
lemma open_enat_iff: |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
146 |
fixes A :: "enat set" |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
147 |
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
|
148 |
proof safe |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
149 |
assume "\<infinity> \<notin> A" |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
150 |
then have "A = (\<Union>n\<in>{n. enat n \<in> A}. {enat n})" |
72236 | 151 |
by (simp add: set_eq_iff) (metis not_enat_eq) |
59115
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
152 |
moreover have "open \<dots>" |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
153 |
by (auto intro: open_enat) |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
154 |
ultimately show "open A" |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
155 |
by simp |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
156 |
next |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
157 |
fix n assume "{enat n <..} \<subseteq> A" |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
158 |
then have "A = (\<Union>n\<in>{n. enat n \<in> A}. {enat n}) \<union> {enat n <..}" |
72236 | 159 |
using enat_ile leI by (simp add: set_eq_iff) blast |
59115
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
160 |
moreover have "open \<dots>" |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
161 |
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
|
162 |
ultimately show "open A" |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
163 |
by simp |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
164 |
next |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
165 |
assume "open A" "\<infinity> \<in> A" |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
166 |
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
|
167 |
unfolding open_enat_def by auto |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
168 |
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
|
169 |
proof induction |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
170 |
case (Int A B) |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
171 |
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
|
172 |
by auto |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
173 |
then have "{enat (max n m) <..} \<subseteq> A \<inter> B" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
174 |
by (auto simp: subset_eq Ball_def max_def simp flip: enat_ord_code(1)) |
59115
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
175 |
then show ?case |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
176 |
by auto |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
177 |
next |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
178 |
case (UN K) |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
179 |
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
|
180 |
by auto |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
181 |
with UN.IH[OF this] show ?case |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
182 |
by auto |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
183 |
qed auto |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
184 |
qed |
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
185 |
|
62369 | 186 |
lemma nhds_enat: "nhds x = (if x = \<infinity> then INF i. principal {enat i..} else principal {x})" |
187 |
proof auto |
|
188 |
show "nhds \<infinity> = (INF i. principal {enat i..})" |
|
72236 | 189 |
proof (rule antisym) |
190 |
show "nhds \<infinity> \<le> (INF i. principal {enat i..})" |
|
191 |
unfolding nhds_def |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
192 |
using Ioi_le_Ico by (intro INF_greatest INF_lower) (auto simp: open_enat_iff) |
72236 | 193 |
show "(INF i. principal {enat i..}) \<le> nhds \<infinity>" |
194 |
unfolding nhds_def |
|
195 |
by (intro INF_greatest) (force intro: INF_lower2[of "Suc _"] simp add: open_enat_iff Suc_ile_eq) |
|
196 |
qed |
|
62369 | 197 |
show "nhds (enat i) = principal {enat i}" for i |
198 |
by (simp add: nhds_discrete_open open_enat) |
|
199 |
qed |
|
200 |
||
201 |
instance enat :: topological_comm_monoid_add |
|
202 |
proof |
|
203 |
have [simp]: "enat i \<le> aa \<Longrightarrow> enat i \<le> aa + ba" for aa ba i |
|
204 |
by (rule order_trans[OF _ add_mono[of aa aa 0 ba]]) auto |
|
205 |
then have [simp]: "enat i \<le> ba \<Longrightarrow> enat i \<le> aa + ba" for aa ba i |
|
206 |
by (metis add.commute) |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
207 |
fix a b :: enat |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
208 |
have "\<forall>\<^sub>F x in INF m n. principal ({enat n..} \<times> {enat m..}). enat i \<le> fst x + snd x" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
209 |
"\<forall>\<^sub>F x in INF n. principal ({enat n..} \<times> {enat j}). enat i \<le> fst x + snd x" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
210 |
"\<forall>\<^sub>F x in INF n. principal ({enat j} \<times> {enat n..}). enat i \<le> fst x + snd x" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
211 |
for i j |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
212 |
by (auto intro!: eventually_INF1[of i] simp: eventually_principal) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
213 |
then show "((\<lambda>x. fst x + snd x) \<longlongrightarrow> a + b) (nhds a \<times>\<^sub>F nhds b)" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
214 |
by (auto simp: nhds_enat filterlim_INF prod_filter_INF1 prod_filter_INF2 |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
215 |
filterlim_principal principal_prod_principal eventually_principal) |
62369 | 216 |
qed |
59115
f65ac77f7e07
move topology on enat to Extended_Real, otherwise Jinja_Threads fails
hoelzl
parents:
59023
diff
changeset
|
217 |
|
60500 | 218 |
text \<open> |
63680 | 219 |
For more lemmas about the extended real numbers see |
220 |
\<^file>\<open>~~/src/HOL/Analysis/Extended_Real_Limits.thy\<close>. |
|
60500 | 221 |
\<close> |
222 |
||
223 |
subsection \<open>Definition and basic properties\<close> |
|
41973 | 224 |
|
58310 | 225 |
datatype ereal = ereal real | PInfty | MInfty |
41973 | 226 |
|
43920 | 227 |
instantiation ereal :: uminus |
41973 | 228 |
begin |
53873 | 229 |
|
230 |
fun uminus_ereal where |
|
231 |
"- (ereal r) = ereal (- r)" |
|
232 |
| "- PInfty = MInfty" |
|
233 |
| "- MInfty = PInfty" |
|
234 |
||
235 |
instance .. |
|
236 |
||
41973 | 237 |
end |
238 |
||
43923 | 239 |
instantiation ereal :: infinity |
240 |
begin |
|
53873 | 241 |
|
242 |
definition "(\<infinity>::ereal) = PInfty" |
|
243 |
instance .. |
|
244 |
||
43923 | 245 |
end |
41973 | 246 |
|
43923 | 247 |
declare [[coercion "ereal :: real \<Rightarrow> ereal"]] |
41973 | 248 |
|
43920 | 249 |
lemma ereal_uminus_uminus[simp]: |
53873 | 250 |
fixes a :: ereal |
251 |
shows "- (- a) = a" |
|
41973 | 252 |
by (cases a) simp_all |
253 |
||
43923 | 254 |
lemma |
255 |
shows PInfty_eq_infinity[simp]: "PInfty = \<infinity>" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
256 |
and MInfty_eq_minfinity[simp]: "MInfty = -\<infinity>" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
257 |
and MInfty_neq_PInfty[simp]: "\<infinity> \<noteq> - (\<infinity>::ereal)" "-\<infinity> \<noteq> (\<infinity>::ereal)" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
258 |
and MInfty_neq_ereal[simp]: "ereal r \<noteq> -\<infinity>" "-\<infinity> \<noteq> ereal r" |
43923 | 259 |
and PInfty_neq_ereal[simp]: "ereal r \<noteq> \<infinity>" "\<infinity> \<noteq> ereal r" |
260 |
and PInfty_cases[simp]: "(case \<infinity> of ereal r \<Rightarrow> f r | PInfty \<Rightarrow> y | MInfty \<Rightarrow> z) = y" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
261 |
and MInfty_cases[simp]: "(case -\<infinity> of ereal r \<Rightarrow> f r | PInfty \<Rightarrow> y | MInfty \<Rightarrow> z) = z" |
43923 | 262 |
by (simp_all add: infinity_ereal_def) |
41973 | 263 |
|
43933 | 264 |
declare |
265 |
PInfty_eq_infinity[code_post] |
|
266 |
MInfty_eq_minfinity[code_post] |
|
267 |
||
268 |
lemma [code_unfold]: |
|
269 |
"\<infinity> = PInfty" |
|
53873 | 270 |
"- PInfty = MInfty" |
43933 | 271 |
by simp_all |
272 |
||
43923 | 273 |
lemma inj_ereal[simp]: "inj_on ereal A" |
274 |
unfolding inj_on_def by auto |
|
41973 | 275 |
|
55913 | 276 |
lemma ereal_cases[cases type: ereal]: |
277 |
obtains (real) r where "x = ereal r" |
|
278 |
| (PInf) "x = \<infinity>" |
|
279 |
| (MInf) "x = -\<infinity>" |
|
63092 | 280 |
by (cases x) auto |
41973 | 281 |
|
43920 | 282 |
lemmas ereal2_cases = ereal_cases[case_product ereal_cases] |
283 |
lemmas ereal3_cases = ereal2_cases[case_product ereal_cases] |
|
41973 | 284 |
|
57447
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents:
57025
diff
changeset
|
285 |
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
|
286 |
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
|
287 |
|
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents:
57025
diff
changeset
|
288 |
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
|
289 |
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
|
290 |
|
43920 | 291 |
lemma ereal_uminus_eq_iff[simp]: |
53873 | 292 |
fixes a b :: ereal |
293 |
shows "-a = -b \<longleftrightarrow> a = b" |
|
43920 | 294 |
by (cases rule: ereal2_cases[of a b]) simp_all |
41973 | 295 |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
296 |
function real_of_ereal :: "ereal \<Rightarrow> real" where |
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
297 |
"real_of_ereal (ereal r) = r" |
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
298 |
| "real_of_ereal \<infinity> = 0" |
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
299 |
| "real_of_ereal (-\<infinity>) = 0" |
43920 | 300 |
by (auto intro: ereal_cases) |
60679 | 301 |
termination by standard (rule wf_empty) |
41973 | 302 |
|
43920 | 303 |
lemma real_of_ereal[simp]: |
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
304 |
"real_of_ereal (- x :: ereal) = - (real_of_ereal x)" |
58042
ffa9e39763e3
introduce real_of typeclass for real :: 'a => real
hoelzl
parents:
57512
diff
changeset
|
305 |
by (cases x) simp_all |
41973 | 306 |
|
43920 | 307 |
lemma range_ereal[simp]: "range ereal = UNIV - {\<infinity>, -\<infinity>}" |
41973 | 308 |
proof safe |
53873 | 309 |
fix x |
310 |
assume "x \<notin> range ereal" "x \<noteq> \<infinity>" |
|
311 |
then show "x = -\<infinity>" |
|
312 |
by (cases x) auto |
|
41973 | 313 |
qed auto |
314 |
||
43920 | 315 |
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
|
316 |
proof safe |
53873 | 317 |
fix x :: ereal |
318 |
show "x \<in> range uminus" |
|
319 |
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
|
320 |
qed auto |
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
321 |
|
43920 | 322 |
instantiation ereal :: abs |
41976 | 323 |
begin |
53873 | 324 |
|
325 |
function abs_ereal where |
|
326 |
"\<bar>ereal r\<bar> = ereal \<bar>r\<bar>" |
|
327 |
| "\<bar>-\<infinity>\<bar> = (\<infinity>::ereal)" |
|
328 |
| "\<bar>\<infinity>\<bar> = (\<infinity>::ereal)" |
|
329 |
by (auto intro: ereal_cases) |
|
330 |
termination proof qed (rule wf_empty) |
|
331 |
||
332 |
instance .. |
|
333 |
||
41976 | 334 |
end |
335 |
||
53873 | 336 |
lemma abs_eq_infinity_cases[elim!]: |
337 |
fixes x :: ereal |
|
338 |
assumes "\<bar>x\<bar> = \<infinity>" |
|
339 |
obtains "x = \<infinity>" | "x = -\<infinity>" |
|
340 |
using assms by (cases x) auto |
|
41976 | 341 |
|
53873 | 342 |
lemma abs_neq_infinity_cases[elim!]: |
343 |
fixes x :: ereal |
|
344 |
assumes "\<bar>x\<bar> \<noteq> \<infinity>" |
|
345 |
obtains r where "x = ereal r" |
|
346 |
using assms by (cases x) auto |
|
347 |
||
348 |
lemma abs_ereal_uminus[simp]: |
|
349 |
fixes x :: ereal |
|
350 |
shows "\<bar>- x\<bar> = \<bar>x\<bar>" |
|
41976 | 351 |
by (cases x) auto |
352 |
||
53873 | 353 |
lemma ereal_infinity_cases: |
354 |
fixes a :: ereal |
|
355 |
shows "a \<noteq> \<infinity> \<Longrightarrow> a \<noteq> -\<infinity> \<Longrightarrow> \<bar>a\<bar> \<noteq> \<infinity>" |
|
356 |
by auto |
|
41976 | 357 |
|
41973 | 358 |
subsubsection "Addition" |
359 |
||
54408 | 360 |
instantiation ereal :: "{one,comm_monoid_add,zero_neq_one}" |
41973 | 361 |
begin |
362 |
||
43920 | 363 |
definition "0 = ereal 0" |
51351 | 364 |
definition "1 = ereal 1" |
41973 | 365 |
|
43920 | 366 |
function plus_ereal where |
53873 | 367 |
"ereal r + ereal p = ereal (r + p)" |
368 |
| "\<infinity> + a = (\<infinity>::ereal)" |
|
369 |
| "a + \<infinity> = (\<infinity>::ereal)" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
370 |
| "ereal r + -\<infinity> = -\<infinity>" |
53873 | 371 |
| "-\<infinity> + ereal p = -(\<infinity>::ereal)" |
372 |
| "-\<infinity> + -\<infinity> = -(\<infinity>::ereal)" |
|
61166
5976fe402824
renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents:
61120
diff
changeset
|
373 |
proof goal_cases |
60580 | 374 |
case prems: (1 P x) |
53873 | 375 |
then obtain a b where "x = (a, b)" |
376 |
by (cases x) auto |
|
60580 | 377 |
with prems show P |
43920 | 378 |
by (cases rule: ereal2_cases[of a b]) auto |
41973 | 379 |
qed auto |
60679 | 380 |
termination by standard (rule wf_empty) |
41973 | 381 |
|
382 |
lemma Infty_neq_0[simp]: |
|
43923 | 383 |
"(\<infinity>::ereal) \<noteq> 0" "0 \<noteq> (\<infinity>::ereal)" |
384 |
"-(\<infinity>::ereal) \<noteq> 0" "0 \<noteq> -(\<infinity>::ereal)" |
|
43920 | 385 |
by (simp_all add: zero_ereal_def) |
41973 | 386 |
|
43920 | 387 |
lemma ereal_eq_0[simp]: |
388 |
"ereal r = 0 \<longleftrightarrow> r = 0" |
|
389 |
"0 = ereal r \<longleftrightarrow> r = 0" |
|
390 |
unfolding zero_ereal_def by simp_all |
|
41973 | 391 |
|
54416 | 392 |
lemma ereal_eq_1[simp]: |
393 |
"ereal r = 1 \<longleftrightarrow> r = 1" |
|
394 |
"1 = ereal r \<longleftrightarrow> r = 1" |
|
395 |
unfolding one_ereal_def by simp_all |
|
396 |
||
41973 | 397 |
instance |
398 |
proof |
|
47082 | 399 |
fix a b c :: ereal |
400 |
show "0 + a = a" |
|
43920 | 401 |
by (cases a) (simp_all add: zero_ereal_def) |
47082 | 402 |
show "a + b = b + a" |
43920 | 403 |
by (cases rule: ereal2_cases[of a b]) simp_all |
47082 | 404 |
show "a + b + c = a + (b + c)" |
43920 | 405 |
by (cases rule: ereal3_cases[of a b c]) simp_all |
54408 | 406 |
show "0 \<noteq> (1::ereal)" |
407 |
by (simp add: one_ereal_def zero_ereal_def) |
|
41973 | 408 |
qed |
53873 | 409 |
|
41973 | 410 |
end |
411 |
||
60060 | 412 |
lemma ereal_0_plus [simp]: "ereal 0 + x = x" |
413 |
and plus_ereal_0 [simp]: "x + ereal 0 = x" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
414 |
by(simp_all flip: zero_ereal_def) |
60060 | 415 |
|
51351 | 416 |
instance ereal :: numeral .. |
417 |
||
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
418 |
lemma real_of_ereal_0[simp]: "real_of_ereal (0::ereal) = 0" |
58042
ffa9e39763e3
introduce real_of typeclass for real :: 'a => real
hoelzl
parents:
57512
diff
changeset
|
419 |
unfolding zero_ereal_def by simp |
42950
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
hoelzl
parents:
42600
diff
changeset
|
420 |
|
43920 | 421 |
lemma abs_ereal_zero[simp]: "\<bar>0\<bar> = (0::ereal)" |
422 |
unfolding zero_ereal_def abs_ereal.simps by simp |
|
41976 | 423 |
|
53873 | 424 |
lemma ereal_uminus_zero[simp]: "- 0 = (0::ereal)" |
43920 | 425 |
by (simp add: zero_ereal_def) |
41973 | 426 |
|
43920 | 427 |
lemma ereal_uminus_zero_iff[simp]: |
53873 | 428 |
fixes a :: ereal |
429 |
shows "-a = 0 \<longleftrightarrow> a = 0" |
|
41973 | 430 |
by (cases a) simp_all |
431 |
||
43920 | 432 |
lemma ereal_plus_eq_PInfty[simp]: |
53873 | 433 |
fixes a b :: ereal |
434 |
shows "a + b = \<infinity> \<longleftrightarrow> a = \<infinity> \<or> b = \<infinity>" |
|
43920 | 435 |
by (cases rule: ereal2_cases[of a b]) auto |
41973 | 436 |
|
43920 | 437 |
lemma ereal_plus_eq_MInfty[simp]: |
53873 | 438 |
fixes a b :: ereal |
439 |
shows "a + b = -\<infinity> \<longleftrightarrow> (a = -\<infinity> \<or> b = -\<infinity>) \<and> a \<noteq> \<infinity> \<and> b \<noteq> \<infinity>" |
|
43920 | 440 |
by (cases rule: ereal2_cases[of a b]) auto |
41973 | 441 |
|
43920 | 442 |
lemma ereal_add_cancel_left: |
53873 | 443 |
fixes a b :: ereal |
444 |
assumes "a \<noteq> -\<infinity>" |
|
445 |
shows "a + b = a + c \<longleftrightarrow> a = \<infinity> \<or> b = c" |
|
43920 | 446 |
using assms by (cases rule: ereal3_cases[of a b c]) auto |
41973 | 447 |
|
43920 | 448 |
lemma ereal_add_cancel_right: |
53873 | 449 |
fixes a b :: ereal |
450 |
assumes "a \<noteq> -\<infinity>" |
|
451 |
shows "b + a = c + a \<longleftrightarrow> a = \<infinity> \<or> b = c" |
|
43920 | 452 |
using assms by (cases rule: ereal3_cases[of a b c]) auto |
41973 | 453 |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
454 |
lemma ereal_real: "ereal (real_of_ereal x) = (if \<bar>x\<bar> = \<infinity> then 0 else x)" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
455 |
by auto |
41973 | 456 |
|
43920 | 457 |
lemma real_of_ereal_add: |
458 |
fixes a b :: ereal |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
459 |
shows "real_of_ereal (a + b) = |
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
460 |
(if (\<bar>a\<bar> = \<infinity>) \<and> (\<bar>b\<bar> = \<infinity>) \<or> (\<bar>a\<bar> \<noteq> \<infinity>) \<and> (\<bar>b\<bar> \<noteq> \<infinity>) then real_of_ereal a + real_of_ereal b else 0)" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
461 |
by auto |
41979
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
462 |
|
53873 | 463 |
|
69593 | 464 |
subsubsection "Linear order on \<^typ>\<open>ereal\<close>" |
41973 | 465 |
|
43920 | 466 |
instantiation ereal :: linorder |
41973 | 467 |
begin |
468 |
||
47082 | 469 |
function less_ereal |
470 |
where |
|
471 |
" ereal x < ereal y \<longleftrightarrow> x < y" |
|
472 |
| "(\<infinity>::ereal) < a \<longleftrightarrow> False" |
|
473 |
| " a < -(\<infinity>::ereal) \<longleftrightarrow> False" |
|
474 |
| "ereal x < \<infinity> \<longleftrightarrow> True" |
|
475 |
| " -\<infinity> < ereal r \<longleftrightarrow> True" |
|
476 |
| " -\<infinity> < (\<infinity>::ereal) \<longleftrightarrow> True" |
|
61166
5976fe402824
renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents:
61120
diff
changeset
|
477 |
proof goal_cases |
60580 | 478 |
case prems: (1 P x) |
53374
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents:
53216
diff
changeset
|
479 |
then obtain a b where "x = (a,b)" by (cases x) auto |
60580 | 480 |
with prems show P by (cases rule: ereal2_cases[of a b]) auto |
41973 | 481 |
qed simp_all |
482 |
termination by (relation "{}") simp |
|
483 |
||
43920 | 484 |
definition "x \<le> (y::ereal) \<longleftrightarrow> x < y \<or> x = y" |
41973 | 485 |
|
43920 | 486 |
lemma ereal_infty_less[simp]: |
43923 | 487 |
fixes x :: ereal |
488 |
shows "x < \<infinity> \<longleftrightarrow> (x \<noteq> \<infinity>)" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
489 |
"-\<infinity> < x \<longleftrightarrow> (x \<noteq> -\<infinity>)" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
490 |
by (cases x, simp_all)+ |
41973 | 491 |
|
43920 | 492 |
lemma ereal_infty_less_eq[simp]: |
43923 | 493 |
fixes x :: ereal |
494 |
shows "\<infinity> \<le> x \<longleftrightarrow> x = \<infinity>" |
|
53873 | 495 |
and "x \<le> -\<infinity> \<longleftrightarrow> x = -\<infinity>" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
496 |
by (auto simp: less_eq_ereal_def) |
41973 | 497 |
|
43920 | 498 |
lemma ereal_less[simp]: |
499 |
"ereal r < 0 \<longleftrightarrow> (r < 0)" |
|
500 |
"0 < ereal r \<longleftrightarrow> (0 < r)" |
|
54416 | 501 |
"ereal r < 1 \<longleftrightarrow> (r < 1)" |
502 |
"1 < ereal r \<longleftrightarrow> (1 < r)" |
|
43923 | 503 |
"0 < (\<infinity>::ereal)" |
504 |
"-(\<infinity>::ereal) < 0" |
|
54416 | 505 |
by (simp_all add: zero_ereal_def one_ereal_def) |
41973 | 506 |
|
43920 | 507 |
lemma ereal_less_eq[simp]: |
43923 | 508 |
"x \<le> (\<infinity>::ereal)" |
509 |
"-(\<infinity>::ereal) \<le> x" |
|
43920 | 510 |
"ereal r \<le> ereal p \<longleftrightarrow> r \<le> p" |
511 |
"ereal r \<le> 0 \<longleftrightarrow> r \<le> 0" |
|
512 |
"0 \<le> ereal r \<longleftrightarrow> 0 \<le> r" |
|
54416 | 513 |
"ereal r \<le> 1 \<longleftrightarrow> r \<le> 1" |
514 |
"1 \<le> ereal r \<longleftrightarrow> 1 \<le> r" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
515 |
by (auto simp: less_eq_ereal_def zero_ereal_def one_ereal_def) |
41973 | 516 |
|
43920 | 517 |
lemma ereal_infty_less_eq2: |
43923 | 518 |
"a \<le> b \<Longrightarrow> a = \<infinity> \<Longrightarrow> b = (\<infinity>::ereal)" |
519 |
"a \<le> b \<Longrightarrow> b = -\<infinity> \<Longrightarrow> a = -(\<infinity>::ereal)" |
|
41973 | 520 |
by simp_all |
521 |
||
522 |
instance |
|
523 |
proof |
|
47082 | 524 |
fix x y z :: ereal |
525 |
show "x \<le> x" |
|
41973 | 526 |
by (cases x) simp_all |
47082 | 527 |
show "x < y \<longleftrightarrow> x \<le> y \<and> \<not> y \<le> x" |
43920 | 528 |
by (cases rule: ereal2_cases[of x y]) auto |
41973 | 529 |
show "x \<le> y \<or> y \<le> x " |
43920 | 530 |
by (cases rule: ereal2_cases[of x y]) auto |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
531 |
assume "x \<le> y" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
532 |
then show "y \<le> x \<Longrightarrow> x = y" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
533 |
by (cases rule: ereal2_cases[of x y]) auto |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
534 |
show "y \<le> z \<Longrightarrow> x \<le> z" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
535 |
using \<open>x \<le> y\<close> |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
536 |
by (cases rule: ereal3_cases[of x y z]) auto |
41973 | 537 |
qed |
47082 | 538 |
|
41973 | 539 |
end |
540 |
||
51329
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
hoelzl
parents:
51328
diff
changeset
|
541 |
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
|
542 |
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
|
543 |
|
53216 | 544 |
instance ereal :: dense_linorder |
60679 | 545 |
by standard (blast dest: ereal_dense2) |
51329
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
hoelzl
parents:
51328
diff
changeset
|
546 |
|
62376
85f38d5f8807
Rename ordered_comm_monoid_add to ordered_cancel_comm_monoid_add. Introduce ordreed_comm_monoid_add, canonically_ordered_comm_monoid and dioid. Setup nat, entat and ennreal as dioids.
hoelzl
parents:
62371
diff
changeset
|
547 |
instance ereal :: ordered_comm_monoid_add |
41978 | 548 |
proof |
53873 | 549 |
fix a b c :: ereal |
550 |
assume "a \<le> b" |
|
551 |
then show "c + a \<le> c + b" |
|
43920 | 552 |
by (cases rule: ereal3_cases[of a b c]) auto |
41978 | 553 |
qed |
554 |
||
62648 | 555 |
lemma ereal_one_not_less_zero_ereal[simp]: "\<not> 1 < (0::ereal)" |
556 |
by (simp add: zero_ereal_def) |
|
557 |
||
43920 | 558 |
lemma real_of_ereal_positive_mono: |
53873 | 559 |
fixes x y :: ereal |
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
560 |
shows "0 \<le> x \<Longrightarrow> x \<le> y \<Longrightarrow> y \<noteq> \<infinity> \<Longrightarrow> real_of_ereal x \<le> real_of_ereal y" |
43920 | 561 |
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
|
562 |
|
43920 | 563 |
lemma ereal_MInfty_lessI[intro, simp]: |
53873 | 564 |
fixes a :: ereal |
565 |
shows "a \<noteq> -\<infinity> \<Longrightarrow> -\<infinity> < a" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
566 |
by simp |
41973 | 567 |
|
43920 | 568 |
lemma ereal_less_PInfty[intro, simp]: |
53873 | 569 |
fixes a :: ereal |
570 |
shows "a \<noteq> \<infinity> \<Longrightarrow> a < \<infinity>" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
571 |
by simp |
41973 | 572 |
|
43920 | 573 |
lemma ereal_less_ereal_Ex: |
574 |
fixes a b :: ereal |
|
575 |
shows "x < ereal r \<longleftrightarrow> x = -\<infinity> \<or> (\<exists>p. p < r \<and> x = ereal p)" |
|
41973 | 576 |
by (cases x) auto |
577 |
||
43920 | 578 |
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
|
579 |
proof (cases x) |
53873 | 580 |
case (real r) |
581 |
then show ?thesis |
|
41980
28b51effc5ed
split Extended_Reals into parts for Library and Multivariate_Analysis
hoelzl
parents:
41979
diff
changeset
|
582 |
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
|
583 |
qed simp_all |
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
584 |
|
68752 | 585 |
lemma ereal_add_strict_mono2: |
53873 | 586 |
fixes a b c d :: ereal |
72236 | 587 |
assumes "a < b" and "c < d" |
68752 | 588 |
shows "a + c < b + d" |
72236 | 589 |
using assms |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
590 |
by (cases a; force simp: elim: less_ereal.elims) |
41973 | 591 |
|
43920 | 592 |
lemma ereal_minus_le_minus[simp]: |
53873 | 593 |
fixes a b :: ereal |
594 |
shows "- a \<le> - b \<longleftrightarrow> b \<le> a" |
|
43920 | 595 |
by (cases rule: ereal2_cases[of a b]) auto |
41973 | 596 |
|
43920 | 597 |
lemma ereal_minus_less_minus[simp]: |
53873 | 598 |
fixes a b :: ereal |
599 |
shows "- a < - b \<longleftrightarrow> b < a" |
|
43920 | 600 |
by (cases rule: ereal2_cases[of a b]) auto |
41973 | 601 |
|
43920 | 602 |
lemma ereal_le_real_iff: |
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
603 |
"x \<le> real_of_ereal y \<longleftrightarrow> (\<bar>y\<bar> \<noteq> \<infinity> \<longrightarrow> ereal x \<le> y) \<and> (\<bar>y\<bar> = \<infinity> \<longrightarrow> x \<le> 0)" |
41973 | 604 |
by (cases y) auto |
605 |
||
43920 | 606 |
lemma real_le_ereal_iff: |
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
607 |
"real_of_ereal y \<le> x \<longleftrightarrow> (\<bar>y\<bar> \<noteq> \<infinity> \<longrightarrow> y \<le> ereal x) \<and> (\<bar>y\<bar> = \<infinity> \<longrightarrow> 0 \<le> x)" |
41973 | 608 |
by (cases y) auto |
609 |
||
43920 | 610 |
lemma ereal_less_real_iff: |
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
611 |
"x < real_of_ereal y \<longleftrightarrow> (\<bar>y\<bar> \<noteq> \<infinity> \<longrightarrow> ereal x < y) \<and> (\<bar>y\<bar> = \<infinity> \<longrightarrow> x < 0)" |
41973 | 612 |
by (cases y) auto |
613 |
||
43920 | 614 |
lemma real_less_ereal_iff: |
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
615 |
"real_of_ereal y < x \<longleftrightarrow> (\<bar>y\<bar> \<noteq> \<infinity> \<longrightarrow> y < ereal x) \<and> (\<bar>y\<bar> = \<infinity> \<longrightarrow> 0 < x)" |
41973 | 616 |
by (cases y) auto |
617 |
||
68356 | 618 |
text \<open> |
619 |
To help with inferences like \<^prop>\<open>a < ereal x \<Longrightarrow> x < y \<Longrightarrow> a < ereal y\<close>, |
|
68095
4fa3e63ecc7e
starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents:
67727
diff
changeset
|
620 |
where x and y are real. |
68356 | 621 |
\<close> |
68095
4fa3e63ecc7e
starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents:
67727
diff
changeset
|
622 |
|
4fa3e63ecc7e
starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents:
67727
diff
changeset
|
623 |
lemma le_ereal_le: "a \<le> ereal x \<Longrightarrow> x \<le> y \<Longrightarrow> a \<le> ereal y" |
4fa3e63ecc7e
starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents:
67727
diff
changeset
|
624 |
using ereal_less_eq(3) order.trans by blast |
4fa3e63ecc7e
starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents:
67727
diff
changeset
|
625 |
|
4fa3e63ecc7e
starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents:
67727
diff
changeset
|
626 |
lemma le_ereal_less: "a \<le> ereal x \<Longrightarrow> x < y \<Longrightarrow> a < ereal y" |
4fa3e63ecc7e
starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents:
67727
diff
changeset
|
627 |
by (simp add: le_less_trans) |
4fa3e63ecc7e
starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents:
67727
diff
changeset
|
628 |
|
4fa3e63ecc7e
starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents:
67727
diff
changeset
|
629 |
lemma less_ereal_le: "a < ereal x \<Longrightarrow> x \<le> y \<Longrightarrow> a < ereal y" |
4fa3e63ecc7e
starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents:
67727
diff
changeset
|
630 |
using ereal_less_ereal_Ex by auto |
4fa3e63ecc7e
starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents:
67727
diff
changeset
|
631 |
|
4fa3e63ecc7e
starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents:
67727
diff
changeset
|
632 |
lemma ereal_le_le: "ereal y \<le> a \<Longrightarrow> x \<le> y \<Longrightarrow> ereal x \<le> a" |
4fa3e63ecc7e
starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents:
67727
diff
changeset
|
633 |
by (simp add: order_subst2) |
4fa3e63ecc7e
starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents:
67727
diff
changeset
|
634 |
|
4fa3e63ecc7e
starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents:
67727
diff
changeset
|
635 |
lemma ereal_le_less: "ereal y \<le> a \<Longrightarrow> x < y \<Longrightarrow> ereal x < a" |
4fa3e63ecc7e
starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents:
67727
diff
changeset
|
636 |
by (simp add: dual_order.strict_trans1) |
4fa3e63ecc7e
starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents:
67727
diff
changeset
|
637 |
|
4fa3e63ecc7e
starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents:
67727
diff
changeset
|
638 |
lemma ereal_less_le: "ereal y < a \<Longrightarrow> x \<le> y \<Longrightarrow> ereal x < a" |
4fa3e63ecc7e
starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents:
67727
diff
changeset
|
639 |
using ereal_less_eq(3) le_less_trans by blast |
4fa3e63ecc7e
starting to tidy up Interval_Integral.thy
paulson <lp15@cam.ac.uk>
parents:
67727
diff
changeset
|
640 |
|
43920 | 641 |
lemma real_of_ereal_pos: |
53873 | 642 |
fixes x :: ereal |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
643 |
shows "0 \<le> x \<Longrightarrow> 0 \<le> real_of_ereal x" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
644 |
by (cases x) auto |
41979
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
645 |
|
43920 | 646 |
lemmas real_of_ereal_ord_simps = |
647 |
ereal_le_real_iff real_le_ereal_iff ereal_less_real_iff real_less_ereal_iff |
|
41973 | 648 |
|
43920 | 649 |
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
|
650 |
by (cases x) auto |
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
hoelzl
parents:
42600
diff
changeset
|
651 |
|
43920 | 652 |
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
|
653 |
by (cases x) auto |
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
hoelzl
parents:
42600
diff
changeset
|
654 |
|
43920 | 655 |
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
|
656 |
by (cases x) auto |
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
hoelzl
parents:
42600
diff
changeset
|
657 |
|
61631
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
658 |
lemma ereal_abs_leI: |
61738
c4f6031f1310
New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents:
61631
diff
changeset
|
659 |
fixes x y :: ereal |
61631
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
660 |
shows "\<lbrakk> x \<le> y; -x \<le> y \<rbrakk> \<Longrightarrow> \<bar>x\<bar> \<le> y" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
661 |
by(cases x y rule: ereal2_cases)(simp_all) |
61631
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
662 |
|
68752 | 663 |
lemma ereal_abs_add: |
664 |
fixes a b::ereal |
|
665 |
shows "abs(a+b) \<le> abs a + abs b" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
666 |
by (cases rule: ereal2_cases[of a b]) (auto) |
68752 | 667 |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
668 |
lemma real_of_ereal_le_0[simp]: "real_of_ereal (x :: ereal) \<le> 0 \<longleftrightarrow> x \<le> 0 \<or> x = \<infinity>" |
43923 | 669 |
by (cases x) auto |
42950
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
hoelzl
parents:
42600
diff
changeset
|
670 |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
671 |
lemma abs_real_of_ereal[simp]: "\<bar>real_of_ereal (x :: ereal)\<bar> = real_of_ereal \<bar>x\<bar>" |
43923 | 672 |
by (cases x) auto |
42950
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
hoelzl
parents:
42600
diff
changeset
|
673 |
|
43923 | 674 |
lemma zero_less_real_of_ereal: |
53873 | 675 |
fixes x :: ereal |
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
676 |
shows "0 < real_of_ereal x \<longleftrightarrow> 0 < x \<and> x \<noteq> \<infinity>" |
43923 | 677 |
by (cases x) auto |
42950
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
hoelzl
parents:
42600
diff
changeset
|
678 |
|
43920 | 679 |
lemma ereal_0_le_uminus_iff[simp]: |
53873 | 680 |
fixes a :: ereal |
681 |
shows "0 \<le> - a \<longleftrightarrow> a \<le> 0" |
|
43920 | 682 |
by (cases rule: ereal2_cases[of a]) auto |
42950
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
hoelzl
parents:
42600
diff
changeset
|
683 |
|
43920 | 684 |
lemma ereal_uminus_le_0_iff[simp]: |
53873 | 685 |
fixes a :: ereal |
686 |
shows "- a \<le> 0 \<longleftrightarrow> 0 \<le> a" |
|
43920 | 687 |
by (cases rule: ereal2_cases[of a]) auto |
42950
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
hoelzl
parents:
42600
diff
changeset
|
688 |
|
43920 | 689 |
lemma ereal_add_strict_mono: |
690 |
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
|
691 |
assumes "a \<le> b" |
53873 | 692 |
and "0 \<le> a" |
693 |
and "a \<noteq> \<infinity>" |
|
694 |
and "c < d" |
|
41979
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
695 |
shows "a + c < b + d" |
53873 | 696 |
using assms |
697 |
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
|
698 |
|
53873 | 699 |
lemma ereal_less_add: |
700 |
fixes a b c :: ereal |
|
701 |
shows "\<bar>a\<bar> \<noteq> \<infinity> \<Longrightarrow> c < b \<Longrightarrow> a + c < a + b" |
|
43920 | 702 |
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
|
703 |
|
53873 | 704 |
lemma ereal_uminus_eq_reorder: "- a = b \<longleftrightarrow> a = (-b::ereal)" |
705 |
by auto |
|
41979
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
706 |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
707 |
lemma ereal_uminus_less_reorder: "- a < b \<longleftrightarrow> -b < a" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
708 |
and ereal_less_uminus_reorder: "a < - b \<longleftrightarrow> b < - a" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
709 |
and ereal_uminus_le_reorder: "- a \<le> b \<longleftrightarrow> -b \<le> a" for a::ereal |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
710 |
using ereal_minus_le_minus ereal_minus_less_minus by fastforce+ |
41979
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
711 |
|
43920 | 712 |
lemmas ereal_uminus_reorder = |
713 |
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
|
714 |
|
43920 | 715 |
lemma ereal_bot: |
53873 | 716 |
fixes x :: ereal |
717 |
assumes "\<And>B. x \<le> ereal B" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
718 |
shows "x = -\<infinity>" |
41979
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
719 |
proof (cases x) |
53873 | 720 |
case (real r) |
721 |
with assms[of "r - 1"] show ?thesis |
|
722 |
by auto |
|
47082 | 723 |
next |
53873 | 724 |
case PInf |
725 |
with assms[of 0] show ?thesis |
|
726 |
by auto |
|
47082 | 727 |
next |
53873 | 728 |
case MInf |
729 |
then show ?thesis |
|
730 |
by simp |
|
41979
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
731 |
qed |
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
732 |
|
43920 | 733 |
lemma ereal_top: |
53873 | 734 |
fixes x :: ereal |
735 |
assumes "\<And>B. x \<ge> ereal B" |
|
736 |
shows "x = \<infinity>" |
|
41979
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
737 |
proof (cases x) |
53873 | 738 |
case (real r) |
739 |
with assms[of "r + 1"] show ?thesis |
|
740 |
by auto |
|
47082 | 741 |
next |
53873 | 742 |
case MInf |
743 |
with assms[of 0] show ?thesis |
|
744 |
by auto |
|
47082 | 745 |
next |
53873 | 746 |
case PInf |
747 |
then show ?thesis |
|
748 |
by simp |
|
41979
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
749 |
qed |
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
750 |
|
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
751 |
lemma |
43920 | 752 |
shows ereal_max[simp]: "ereal (max x y) = max (ereal x) (ereal y)" |
753 |
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
|
754 |
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
|
755 |
|
43920 | 756 |
lemma ereal_max_0: "max 0 (ereal r) = ereal (max 0 r)" |
757 |
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
|
758 |
|
41978 | 759 |
lemma |
43920 | 760 |
fixes f :: "nat \<Rightarrow> ereal" |
54416 | 761 |
shows ereal_incseq_uminus[simp]: "incseq (\<lambda>x. - f x) \<longleftrightarrow> decseq f" |
762 |
and ereal_decseq_uminus[simp]: "decseq (\<lambda>x. - f x) \<longleftrightarrow> incseq f" |
|
41978 | 763 |
unfolding decseq_def incseq_def by auto |
764 |
||
43920 | 765 |
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
|
766 |
unfolding incseq_def by auto |
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
hoelzl
parents:
42600
diff
changeset
|
767 |
|
64267 | 768 |
lemma sum_ereal[simp]: "(\<Sum>x\<in>A. ereal (f x)) = ereal (\<Sum>x\<in>A. f x)" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
769 |
by (induction A rule: infinite_finite_induct) auto |
59000 | 770 |
|
63882
018998c00003
renamed listsum -> sum_list, listprod ~> prod_list
nipkow
parents:
63680
diff
changeset
|
771 |
lemma sum_list_ereal [simp]: "sum_list (map (\<lambda>x. ereal (f x)) xs) = ereal (sum_list (map f xs))" |
63099
af0e964aad7b
Moved material from AFP/Randomised_Social_Choice to distribution
eberlm
parents:
63092
diff
changeset
|
772 |
by (induction xs) simp_all |
af0e964aad7b
Moved material from AFP/Randomised_Social_Choice to distribution
eberlm
parents:
63092
diff
changeset
|
773 |
|
64267 | 774 |
lemma sum_Pinfty: |
59000 | 775 |
fixes f :: "'a \<Rightarrow> ereal" |
776 |
shows "(\<Sum>x\<in>P. f x) = \<infinity> \<longleftrightarrow> finite P \<and> (\<exists>i\<in>P. f i = \<infinity>)" |
|
777 |
proof safe |
|
64267 | 778 |
assume *: "sum f P = \<infinity>" |
59000 | 779 |
show "finite P" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
780 |
by (metis "*" Infty_neq_0(2) sum.infinite) |
59000 | 781 |
show "\<exists>i\<in>P. f i = \<infinity>" |
782 |
proof (rule ccontr) |
|
783 |
assume "\<not> ?thesis" |
|
784 |
then have "\<And>i. i \<in> P \<Longrightarrow> f i \<noteq> \<infinity>" |
|
785 |
by auto |
|
64267 | 786 |
with \<open>finite P\<close> have "sum f P \<noteq> \<infinity>" |
59000 | 787 |
by induct auto |
788 |
with * show False |
|
789 |
by auto |
|
790 |
qed |
|
791 |
next |
|
792 |
fix i |
|
793 |
assume "finite P" and "i \<in> P" and "f i = \<infinity>" |
|
64267 | 794 |
then show "sum f P = \<infinity>" |
59000 | 795 |
proof induct |
796 |
case (insert x A) |
|
797 |
show ?case using insert by (cases "x = i") auto |
|
798 |
qed simp |
|
799 |
qed |
|
800 |
||
64267 | 801 |
lemma sum_Inf: |
59000 | 802 |
fixes f :: "'a \<Rightarrow> ereal" |
64267 | 803 |
shows "\<bar>sum f A\<bar> = \<infinity> \<longleftrightarrow> finite A \<and> (\<exists>i\<in>A. \<bar>f i\<bar> = \<infinity>)" |
59000 | 804 |
proof |
64267 | 805 |
assume *: "\<bar>sum f A\<bar> = \<infinity>" |
59000 | 806 |
have "finite A" |
807 |
by (rule ccontr) (insert *, auto) |
|
808 |
moreover have "\<exists>i\<in>A. \<bar>f i\<bar> = \<infinity>" |
|
809 |
proof (rule ccontr) |
|
810 |
assume "\<not> ?thesis" |
|
811 |
then have "\<forall>i\<in>A. \<exists>r. f i = ereal r" |
|
812 |
by auto |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
813 |
then obtain r where "\<forall>x\<in>A. f x = ereal (r x)" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
814 |
by metis |
59000 | 815 |
with * show False |
816 |
by auto |
|
817 |
qed |
|
818 |
ultimately show "finite A \<and> (\<exists>i\<in>A. \<bar>f i\<bar> = \<infinity>)" |
|
819 |
by auto |
|
820 |
next |
|
821 |
assume "finite A \<and> (\<exists>i\<in>A. \<bar>f i\<bar> = \<infinity>)" |
|
822 |
then obtain i where "finite A" "i \<in> A" and "\<bar>f i\<bar> = \<infinity>" |
|
823 |
by auto |
|
64267 | 824 |
then show "\<bar>sum f A\<bar> = \<infinity>" |
59000 | 825 |
proof induct |
826 |
case (insert j A) |
|
827 |
then show ?case |
|
64267 | 828 |
by (cases rule: ereal3_cases[of "f i" "f j" "sum f A"]) auto |
59000 | 829 |
qed simp |
830 |
qed |
|
831 |
||
64267 | 832 |
lemma sum_real_of_ereal: |
59000 | 833 |
fixes f :: "'i \<Rightarrow> ereal" |
834 |
assumes "\<And>x. x \<in> S \<Longrightarrow> \<bar>f x\<bar> \<noteq> \<infinity>" |
|
64267 | 835 |
shows "(\<Sum>x\<in>S. real_of_ereal (f x)) = real_of_ereal (sum f S)" |
59000 | 836 |
proof - |
837 |
have "\<forall>x\<in>S. \<exists>r. f x = ereal r" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
838 |
using assms by blast |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
839 |
then obtain r where "\<forall>x\<in>S. f x = ereal (r x)" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
840 |
by metis |
59000 | 841 |
then show ?thesis |
842 |
by simp |
|
843 |
qed |
|
844 |
||
41973 | 845 |
subsubsection "Multiplication" |
846 |
||
53873 | 847 |
instantiation ereal :: "{comm_monoid_mult,sgn}" |
41973 | 848 |
begin |
849 |
||
51351 | 850 |
function sgn_ereal :: "ereal \<Rightarrow> ereal" where |
43920 | 851 |
"sgn (ereal r) = ereal (sgn r)" |
43923 | 852 |
| "sgn (\<infinity>::ereal) = 1" |
853 |
| "sgn (-\<infinity>::ereal) = -1" |
|
43920 | 854 |
by (auto intro: ereal_cases) |
60679 | 855 |
termination by standard (rule wf_empty) |
41976 | 856 |
|
43920 | 857 |
function times_ereal where |
53873 | 858 |
"ereal r * ereal p = ereal (r * p)" |
859 |
| "ereal r * \<infinity> = (if r = 0 then 0 else if r > 0 then \<infinity> else -\<infinity>)" |
|
860 |
| "\<infinity> * ereal r = (if r = 0 then 0 else if r > 0 then \<infinity> else -\<infinity>)" |
|
861 |
| "ereal r * -\<infinity> = (if r = 0 then 0 else if r > 0 then -\<infinity> else \<infinity>)" |
|
862 |
| "-\<infinity> * ereal r = (if r = 0 then 0 else if r > 0 then -\<infinity> else \<infinity>)" |
|
863 |
| "(\<infinity>::ereal) * \<infinity> = \<infinity>" |
|
864 |
| "-(\<infinity>::ereal) * \<infinity> = -\<infinity>" |
|
865 |
| "(\<infinity>::ereal) * -\<infinity> = -\<infinity>" |
|
866 |
| "-(\<infinity>::ereal) * -\<infinity> = \<infinity>" |
|
61166
5976fe402824
renamed method "goals" to "goal_cases" to emphasize its meaning;
wenzelm
parents:
61120
diff
changeset
|
867 |
proof goal_cases |
60580 | 868 |
case prems: (1 P x) |
53873 | 869 |
then obtain a b where "x = (a, b)" |
870 |
by (cases x) auto |
|
60580 | 871 |
with prems show P |
53873 | 872 |
by (cases rule: ereal2_cases[of a b]) auto |
41973 | 873 |
qed simp_all |
874 |
termination by (relation "{}") simp |
|
875 |
||
876 |
instance |
|
877 |
proof |
|
53873 | 878 |
fix a b c :: ereal |
879 |
show "1 * a = a" |
|
43920 | 880 |
by (cases a) (simp_all add: one_ereal_def) |
47082 | 881 |
show "a * b = b * a" |
43920 | 882 |
by (cases rule: ereal2_cases[of a b]) simp_all |
47082 | 883 |
show "a * b * c = a * (b * c)" |
43920 | 884 |
by (cases rule: ereal3_cases[of a b c]) |
885 |
(simp_all add: zero_ereal_def zero_less_mult_iff) |
|
41973 | 886 |
qed |
53873 | 887 |
|
41973 | 888 |
end |
889 |
||
61738
c4f6031f1310
New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents:
61631
diff
changeset
|
890 |
lemma [simp]: |
61631
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
891 |
shows ereal_1_times: "ereal 1 * x = x" |
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
892 |
and times_ereal_1: "x * ereal 1 = x" |
68406 | 893 |
by(simp_all flip: one_ereal_def) |
61631
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
894 |
|
59000 | 895 |
lemma one_not_le_zero_ereal[simp]: "\<not> (1 \<le> (0::ereal))" |
896 |
by (simp add: one_ereal_def zero_ereal_def) |
|
897 |
||
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
898 |
lemma real_ereal_1[simp]: "real_of_ereal (1::ereal) = 1" |
50104 | 899 |
unfolding one_ereal_def by simp |
900 |
||
43920 | 901 |
lemma real_of_ereal_le_1: |
53873 | 902 |
fixes a :: ereal |
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
903 |
shows "a \<le> 1 \<Longrightarrow> real_of_ereal a \<le> 1" |
43920 | 904 |
by (cases a) (auto simp: one_ereal_def) |
42950
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
hoelzl
parents:
42600
diff
changeset
|
905 |
|
43920 | 906 |
lemma abs_ereal_one[simp]: "\<bar>1\<bar> = (1::ereal)" |
907 |
unfolding one_ereal_def by simp |
|
41976 | 908 |
|
43920 | 909 |
lemma ereal_mult_zero[simp]: |
53873 | 910 |
fixes a :: ereal |
911 |
shows "a * 0 = 0" |
|
43920 | 912 |
by (cases a) (simp_all add: zero_ereal_def) |
41973 | 913 |
|
43920 | 914 |
lemma ereal_zero_mult[simp]: |
53873 | 915 |
fixes a :: ereal |
916 |
shows "0 * a = 0" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
917 |
by (metis ereal_mult_zero mult.commute) |
41973 | 918 |
|
53873 | 919 |
lemma ereal_m1_less_0[simp]: "-(1::ereal) < 0" |
43920 | 920 |
by (simp add: zero_ereal_def one_ereal_def) |
41973 | 921 |
|
43920 | 922 |
lemma ereal_times[simp]: |
43923 | 923 |
"1 \<noteq> (\<infinity>::ereal)" "(\<infinity>::ereal) \<noteq> 1" |
924 |
"1 \<noteq> -(\<infinity>::ereal)" "-(\<infinity>::ereal) \<noteq> 1" |
|
61120 | 925 |
by (auto simp: one_ereal_def) |
41973 | 926 |
|
43920 | 927 |
lemma ereal_plus_1[simp]: |
53873 | 928 |
"1 + ereal r = ereal (r + 1)" |
929 |
"ereal r + 1 = ereal (r + 1)" |
|
930 |
"1 + -(\<infinity>::ereal) = -\<infinity>" |
|
931 |
"-(\<infinity>::ereal) + 1 = -\<infinity>" |
|
43920 | 932 |
unfolding one_ereal_def by auto |
41973 | 933 |
|
43920 | 934 |
lemma ereal_zero_times[simp]: |
53873 | 935 |
fixes a b :: ereal |
936 |
shows "a * b = 0 \<longleftrightarrow> a = 0 \<or> b = 0" |
|
43920 | 937 |
by (cases rule: ereal2_cases[of a b]) auto |
41973 | 938 |
|
43920 | 939 |
lemma ereal_mult_eq_PInfty[simp]: |
53873 | 940 |
"a * b = (\<infinity>::ereal) \<longleftrightarrow> |
41973 | 941 |
(a = \<infinity> \<and> b > 0) \<or> (a > 0 \<and> b = \<infinity>) \<or> (a = -\<infinity> \<and> b < 0) \<or> (a < 0 \<and> b = -\<infinity>)" |
43920 | 942 |
by (cases rule: ereal2_cases[of a b]) auto |
41973 | 943 |
|
43920 | 944 |
lemma ereal_mult_eq_MInfty[simp]: |
53873 | 945 |
"a * b = -(\<infinity>::ereal) \<longleftrightarrow> |
41973 | 946 |
(a = \<infinity> \<and> b < 0) \<or> (a < 0 \<and> b = \<infinity>) \<or> (a = -\<infinity> \<and> b > 0) \<or> (a > 0 \<and> b = -\<infinity>)" |
43920 | 947 |
by (cases rule: ereal2_cases[of a b]) auto |
41973 | 948 |
|
54416 | 949 |
lemma ereal_abs_mult: "\<bar>x * y :: ereal\<bar> = \<bar>x\<bar> * \<bar>y\<bar>" |
950 |
by (cases x y rule: ereal2_cases) (auto simp: abs_mult) |
|
951 |
||
43920 | 952 |
lemma ereal_0_less_1[simp]: "0 < (1::ereal)" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
953 |
by (simp add: zero_ereal_def one_ereal_def) |
41973 | 954 |
|
43920 | 955 |
lemma ereal_mult_minus_left[simp]: |
53873 | 956 |
fixes a b :: ereal |
957 |
shows "-a * b = - (a * b)" |
|
43920 | 958 |
by (cases rule: ereal2_cases[of a b]) auto |
41973 | 959 |
|
43920 | 960 |
lemma ereal_mult_minus_right[simp]: |
53873 | 961 |
fixes a b :: ereal |
962 |
shows "a * -b = - (a * b)" |
|
43920 | 963 |
by (cases rule: ereal2_cases[of a b]) auto |
41973 | 964 |
|
43920 | 965 |
lemma ereal_mult_infty[simp]: |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
966 |
"a * (\<infinity>::ereal) = (if a = 0 then 0 else if 0 < a then \<infinity> else -\<infinity>)" |
41973 | 967 |
by (cases a) auto |
968 |
||
43920 | 969 |
lemma ereal_infty_mult[simp]: |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
970 |
"(\<infinity>::ereal) * a = (if a = 0 then 0 else if 0 < a then \<infinity> else -\<infinity>)" |
41973 | 971 |
by (cases a) auto |
972 |
||
43920 | 973 |
lemma ereal_mult_strict_right_mono: |
53873 | 974 |
assumes "a < b" |
975 |
and "0 < c" |
|
976 |
and "c < (\<infinity>::ereal)" |
|
41973 | 977 |
shows "a * c < b * c" |
978 |
using assms |
|
53873 | 979 |
by (cases rule: ereal3_cases[of a b c]) (auto simp: zero_le_mult_iff) |
41973 | 980 |
|
43920 | 981 |
lemma ereal_mult_strict_left_mono: |
53873 | 982 |
"a < b \<Longrightarrow> 0 < c \<Longrightarrow> c < (\<infinity>::ereal) \<Longrightarrow> c * a < c * b" |
983 |
using ereal_mult_strict_right_mono |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57447
diff
changeset
|
984 |
by (simp add: mult.commute[of c]) |
41973 | 985 |
|
43920 | 986 |
lemma ereal_mult_right_mono: |
53873 | 987 |
fixes a b c :: ereal |
72236 | 988 |
assumes "a \<le> b" "0 \<le> c" |
989 |
shows "a * c \<le> b * c" |
|
990 |
proof (cases "c = 0") |
|
991 |
case False |
|
992 |
with assms show ?thesis |
|
993 |
by (cases rule: ereal3_cases[of a b c]) auto |
|
994 |
qed auto |
|
41973 | 995 |
|
43920 | 996 |
lemma ereal_mult_left_mono: |
53873 | 997 |
fixes a b c :: ereal |
998 |
shows "a \<le> b \<Longrightarrow> 0 \<le> c \<Longrightarrow> c * a \<le> c * b" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
999 |
by (simp add: ereal_mult_right_mono mult.commute) |
41973 | 1000 |
|
68752 | 1001 |
lemma ereal_mult_mono: |
1002 |
fixes a b c d::ereal |
|
1003 |
assumes "b \<ge> 0" "c \<ge> 0" "a \<le> b" "c \<le> d" |
|
1004 |
shows "a * c \<le> b * d" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1005 |
by (metis ereal_mult_right_mono mult.commute order_trans assms) |
68752 | 1006 |
|
1007 |
lemma ereal_mult_mono': |
|
1008 |
fixes a b c d::ereal |
|
1009 |
assumes "a \<ge> 0" "c \<ge> 0" "a \<le> b" "c \<le> d" |
|
1010 |
shows "a * c \<le> b * d" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1011 |
by (metis ereal_mult_right_mono mult.commute order_trans assms) |
68752 | 1012 |
|
1013 |
lemma ereal_mult_mono_strict: |
|
1014 |
fixes a b c d::ereal |
|
1015 |
assumes "b > 0" "c > 0" "a < b" "c < d" |
|
1016 |
shows "a * c < b * d" |
|
1017 |
proof - |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1018 |
have "c < \<infinity>" using \<open>c < d\<close> |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1019 |
by auto |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1020 |
then have "a * c < b * c" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1021 |
by (metis ereal_mult_strict_left_mono[OF assms(3) assms(2)] mult.commute) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1022 |
moreover have "b * c \<le> b * d" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1023 |
using assms(1,4) ereal_mult_left_mono by force |
68752 | 1024 |
ultimately show ?thesis by simp |
1025 |
qed |
|
1026 |
||
1027 |
lemma ereal_mult_mono_strict': |
|
1028 |
fixes a b c d::ereal |
|
1029 |
assumes "a > 0" "c > 0" "a < b" "c < d" |
|
1030 |
shows "a * c < b * d" |
|
72236 | 1031 |
using assms ereal_mult_mono_strict by auto |
68752 | 1032 |
|
43920 | 1033 |
lemma zero_less_one_ereal[simp]: "0 \<le> (1::ereal)" |
1034 |
by (simp add: one_ereal_def zero_ereal_def) |
|
41978 | 1035 |
|
43920 | 1036 |
lemma ereal_0_le_mult[simp]: "0 \<le> a \<Longrightarrow> 0 \<le> b \<Longrightarrow> 0 \<le> a * (b :: ereal)" |
56536 | 1037 |
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
|
1038 |
|
43920 | 1039 |
lemma ereal_right_distrib: |
53873 | 1040 |
fixes r a b :: ereal |
1041 |
shows "0 \<le> a \<Longrightarrow> 0 \<le> b \<Longrightarrow> r * (a + b) = r * a + r * b" |
|
43920 | 1042 |
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
|
1043 |
|
43920 | 1044 |
lemma ereal_left_distrib: |
53873 | 1045 |
fixes r a b :: ereal |
1046 |
shows "0 \<le> a \<Longrightarrow> 0 \<le> b \<Longrightarrow> (a + b) * r = a * r + b * r" |
|
43920 | 1047 |
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
|
1048 |
|
43920 | 1049 |
lemma ereal_mult_le_0_iff: |
1050 |
fixes a b :: ereal |
|
41979
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
1051 |
shows "a * b \<le> 0 \<longleftrightarrow> (0 \<le> a \<and> b \<le> 0) \<or> (a \<le> 0 \<and> 0 \<le> b)" |
43920 | 1052 |
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
|
1053 |
|
43920 | 1054 |
lemma ereal_zero_le_0_iff: |
1055 |
fixes a b :: ereal |
|
41979
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
1056 |
shows "0 \<le> a * b \<longleftrightarrow> (0 \<le> a \<and> 0 \<le> b) \<or> (a \<le> 0 \<and> b \<le> 0)" |
43920 | 1057 |
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
|
1058 |
|
43920 | 1059 |
lemma ereal_mult_less_0_iff: |
1060 |
fixes a b :: ereal |
|
41979
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
1061 |
shows "a * b < 0 \<longleftrightarrow> (0 < a \<and> b < 0) \<or> (a < 0 \<and> 0 < b)" |
43920 | 1062 |
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
|
1063 |
|
43920 | 1064 |
lemma ereal_zero_less_0_iff: |
1065 |
fixes a b :: ereal |
|
41979
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
1066 |
shows "0 < a * b \<longleftrightarrow> (0 < a \<and> 0 < b) \<or> (a < 0 \<and> b < 0)" |
43920 | 1067 |
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
|
1068 |
|
50104 | 1069 |
lemma ereal_left_mult_cong: |
1070 |
fixes a b c :: ereal |
|
59002
2c8b2fb54b88
cleaning up some theorem names; remove unnecessary assumptions; more complete pmf theory
hoelzl
parents:
59000
diff
changeset
|
1071 |
shows "c = d \<Longrightarrow> (d \<noteq> 0 \<Longrightarrow> a = b) \<Longrightarrow> a * c = b * d" |
50104 | 1072 |
by (cases "c = 0") simp_all |
1073 |
||
61738
c4f6031f1310
New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents:
61631
diff
changeset
|
1074 |
lemma ereal_right_mult_cong: |
59002
2c8b2fb54b88
cleaning up some theorem names; remove unnecessary assumptions; more complete pmf theory
hoelzl
parents:
59000
diff
changeset
|
1075 |
fixes a b c :: ereal |
59000 | 1076 |
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
|
1077 |
by (cases "c = 0") simp_all |
50104 | 1078 |
|
43920 | 1079 |
lemma ereal_distrib: |
1080 |
fixes a b c :: ereal |
|
53873 | 1081 |
assumes "a \<noteq> \<infinity> \<or> b \<noteq> -\<infinity>" |
1082 |
and "a \<noteq> -\<infinity> \<or> b \<noteq> \<infinity>" |
|
1083 |
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
|
1084 |
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
|
1085 |
using assms |
43920 | 1086 |
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
|
1087 |
|
47108
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
47082
diff
changeset
|
1088 |
lemma numeral_eq_ereal [simp]: "numeral w = ereal (numeral w)" |
72236 | 1089 |
proof (induct w rule: num_induct) |
1090 |
case One |
|
1091 |
then show ?case |
|
1092 |
by simp |
|
1093 |
next |
|
1094 |
case (inc x) |
|
1095 |
then show ?case |
|
1096 |
by (simp add: inc numeral_inc) |
|
1097 |
qed |
|
47108
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
47082
diff
changeset
|
1098 |
|
61631
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
1099 |
lemma distrib_left_ereal_nn: |
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
1100 |
"c \<ge> 0 \<Longrightarrow> (x + y) * ereal c = x * ereal c + y * ereal c" |
72236 | 1101 |
by(cases x y rule: ereal2_cases)(simp_all add: ring_distribs) |
61631
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
1102 |
|
64267 | 1103 |
lemma sum_ereal_right_distrib: |
59000 | 1104 |
fixes f :: "'a \<Rightarrow> ereal" |
64267 | 1105 |
shows "(\<And>i. i \<in> A \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> r * sum f A = (\<Sum>n\<in>A. r * f n)" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1106 |
by (induct A rule: infinite_finite_induct) (auto simp: ereal_right_distrib sum_nonneg) |
64267 | 1107 |
|
1108 |
lemma sum_ereal_left_distrib: |
|
1109 |
"(\<And>i. i \<in> A \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> sum f A * r = (\<Sum>n\<in>A. f n * r :: ereal)" |
|
1110 |
using sum_ereal_right_distrib[of A f r] by (simp add: mult_ac) |
|
1111 |
||
1112 |
lemma sum_distrib_right_ereal: |
|
1113 |
"c \<ge> 0 \<Longrightarrow> sum f A * ereal c = (\<Sum>x\<in>A. f x * c :: ereal)" |
|
1114 |
by(subst sum_comp_morphism[where h="\<lambda>x. x * ereal c", symmetric])(simp_all add: distrib_left_ereal_nn) |
|
61631
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
1115 |
|
43920 | 1116 |
lemma ereal_le_epsilon: |
1117 |
fixes x y :: ereal |
|
72236 | 1118 |
assumes "\<And>e. 0 < e \<Longrightarrow> x \<le> y + e" |
53873 | 1119 |
shows "x \<le> y" |
72236 | 1120 |
proof (cases "x = -\<infinity> \<or> x = \<infinity> \<or> y = -\<infinity> \<or> y = \<infinity>") |
1121 |
case True |
|
1122 |
then show ?thesis |
|
1123 |
using assms[of 1] by auto |
|
1124 |
next |
|
1125 |
case False |
|
1126 |
then obtain p q where "x = ereal p" "y = ereal q" |
|
1127 |
by (metis MInfty_eq_minfinity ereal.distinct(3) uminus_ereal.elims) |
|
81332 | 1128 |
then show ?thesis |
72236 | 1129 |
by (metis assms field_le_epsilon ereal_less(2) ereal_less_eq(3) plus_ereal.simps(1)) |
41979
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
1130 |
qed |
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
1131 |
|
43920 | 1132 |
lemma ereal_le_epsilon2: |
1133 |
fixes x y :: ereal |
|
72236 | 1134 |
assumes "\<And>e::real. 0 < e \<Longrightarrow> x \<le> y + ereal e" |
53873 | 1135 |
shows "x \<le> y" |
72236 | 1136 |
proof (rule ereal_le_epsilon) |
1137 |
show "\<And>\<epsilon>::ereal. 0 < \<epsilon> \<Longrightarrow> x \<le> y + \<epsilon>" |
|
1138 |
using assms less_ereal.elims(2) zero_less_real_of_ereal by fastforce |
|
41979
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
1139 |
qed |
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
1140 |
|
43920 | 1141 |
lemma ereal_le_real: |
1142 |
fixes x y :: ereal |
|
72236 | 1143 |
assumes "\<And>z. x \<le> ereal z \<Longrightarrow> y \<le> ereal z" |
53873 | 1144 |
shows "y \<le> x" |
1145 |
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
|
1146 |
|
64272 | 1147 |
lemma prod_ereal_0: |
43920 | 1148 |
fixes f :: "'a \<Rightarrow> ereal" |
53873 | 1149 |
shows "(\<Prod>i\<in>A. f i) = 0 \<longleftrightarrow> finite A \<and> (\<exists>i\<in>A. f i = 0)" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1150 |
by (induction A rule: infinite_finite_induct) auto |
42950
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
hoelzl
parents:
42600
diff
changeset
|
1151 |
|
64272 | 1152 |
lemma prod_ereal_pos: |
53873 | 1153 |
fixes f :: "'a \<Rightarrow> ereal" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1154 |
assumes "\<And>i. i \<in> I \<Longrightarrow> 0 \<le> f i" |
53873 | 1155 |
shows "0 \<le> (\<Prod>i\<in>I. f i)" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1156 |
using assms |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1157 |
by (induction I rule: infinite_finite_induct) auto |
42950
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
hoelzl
parents:
42600
diff
changeset
|
1158 |
|
64272 | 1159 |
lemma prod_PInf: |
43923 | 1160 |
fixes f :: "'a \<Rightarrow> ereal" |
42950
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
hoelzl
parents:
42600
diff
changeset
|
1161 |
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
|
1162 |
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)" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1163 |
using assms |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1164 |
proof (induction I rule: infinite_finite_induct) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1165 |
case (insert i I) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1166 |
then have pos: "0 \<le> f i" "0 \<le> prod f I" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1167 |
by (auto intro!: prod_ereal_pos) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1168 |
from insert have "(\<Prod>j\<in>insert i I. f j) = \<infinity> \<longleftrightarrow> prod f I * f i = \<infinity>" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1169 |
by auto |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1170 |
also have "\<dots> \<longleftrightarrow> (prod f I = \<infinity> \<or> f i = \<infinity>) \<and> f i \<noteq> 0 \<and> prod f I \<noteq> 0" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1171 |
using prod_ereal_pos[of I f] pos |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1172 |
by (cases rule: ereal2_cases[of "f i" "prod f I"]) auto |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1173 |
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)" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1174 |
using insert by (auto simp: prod_ereal_0) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1175 |
finally show ?case . |
72236 | 1176 |
qed auto |
42950
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
hoelzl
parents:
42600
diff
changeset
|
1177 |
|
64272 | 1178 |
lemma prod_ereal: "(\<Prod>i\<in>A. ereal (f i)) = ereal (prod f A)" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1179 |
by (induction A rule: infinite_finite_induct) (auto simp: one_ereal_def) |
53873 | 1180 |
|
42950
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
hoelzl
parents:
42600
diff
changeset
|
1181 |
|
60500 | 1182 |
subsubsection \<open>Power\<close> |
41978 | 1183 |
|
43920 | 1184 |
lemma ereal_power[simp]: "(ereal x) ^ n = ereal (x^n)" |
1185 |
by (induct n) (auto simp: one_ereal_def) |
|
41978 | 1186 |
|
43923 | 1187 |
lemma ereal_power_PInf[simp]: "(\<infinity>::ereal) ^ n = (if n = 0 then 1 else \<infinity>)" |
43920 | 1188 |
by (induct n) (auto simp: one_ereal_def) |
41978 | 1189 |
|
43920 | 1190 |
lemma ereal_power_uminus[simp]: |
1191 |
fixes x :: ereal |
|
41978 | 1192 |
shows "(- x) ^ n = (if even n then x ^ n else - (x^n))" |
43920 | 1193 |
by (induct n) (auto simp: one_ereal_def) |
41978 | 1194 |
|
47108
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
47082
diff
changeset
|
1195 |
lemma ereal_power_numeral[simp]: |
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
47082
diff
changeset
|
1196 |
"(numeral num :: ereal) ^ n = ereal (numeral num ^ n)" |
43920 | 1197 |
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
|
1198 |
|
43920 | 1199 |
lemma zero_le_power_ereal[simp]: |
53873 | 1200 |
fixes a :: ereal |
1201 |
assumes "0 \<le> a" |
|
41979
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
1202 |
shows "0 \<le> a ^ n" |
43920 | 1203 |
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
|
1204 |
|
53873 | 1205 |
|
60500 | 1206 |
subsubsection \<open>Subtraction\<close> |
41973 | 1207 |
|
43920 | 1208 |
lemma ereal_minus_minus_image[simp]: |
1209 |
fixes S :: "ereal set" |
|
41973 | 1210 |
shows "uminus ` uminus ` S = S" |
1211 |
by (auto simp: image_iff) |
|
1212 |
||
43920 | 1213 |
lemma ereal_uminus_lessThan[simp]: |
53873 | 1214 |
fixes a :: ereal |
1215 |
shows "uminus ` {..<a} = {-a<..}" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1216 |
by (force simp: ereal_uminus_less_reorder) |
41973 | 1217 |
|
53873 | 1218 |
lemma ereal_uminus_greaterThan[simp]: "uminus ` {(a::ereal)<..} = {..<-a}" |
1219 |
by (metis ereal_uminus_lessThan ereal_uminus_uminus ereal_minus_minus_image) |
|
41973 | 1220 |
|
43920 | 1221 |
instantiation ereal :: minus |
41973 | 1222 |
begin |
53873 | 1223 |
|
43920 | 1224 |
definition "x - y = x + -(y::ereal)" |
41973 | 1225 |
instance .. |
53873 | 1226 |
|
41973 | 1227 |
end |
1228 |
||
43920 | 1229 |
lemma ereal_minus[simp]: |
1230 |
"ereal r - ereal p = ereal (r - p)" |
|
1231 |
"-\<infinity> - ereal r = -\<infinity>" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1232 |
"ereal r -\<infinity> = -\<infinity>" |
43923 | 1233 |
"(\<infinity>::ereal) - x = \<infinity>" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1234 |
"-(\<infinity>::ereal) -\<infinity> = -\<infinity>" |
41973 | 1235 |
"x - -y = x + y" |
1236 |
"x - 0 = x" |
|
1237 |
"0 - x = -x" |
|
43920 | 1238 |
by (simp_all add: minus_ereal_def) |
41973 | 1239 |
|
53873 | 1240 |
lemma ereal_x_minus_x[simp]: "x - x = (if \<bar>x\<bar> = \<infinity> then \<infinity> else 0::ereal)" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1241 |
by auto |
41973 | 1242 |
|
43920 | 1243 |
lemma ereal_eq_minus_iff: |
1244 |
fixes x y z :: ereal |
|
41973 | 1245 |
shows "x = z - y \<longleftrightarrow> |
41976 | 1246 |
(\<bar>y\<bar> \<noteq> \<infinity> \<longrightarrow> x + y = z) \<and> |
41973 | 1247 |
(y = -\<infinity> \<longrightarrow> x = \<infinity>) \<and> |
1248 |
(y = \<infinity> \<longrightarrow> z = \<infinity> \<longrightarrow> x = \<infinity>) \<and> |
|
1249 |
(y = \<infinity> \<longrightarrow> z \<noteq> \<infinity> \<longrightarrow> x = -\<infinity>)" |
|
43920 | 1250 |
by (cases rule: ereal3_cases[of x y z]) auto |
41973 | 1251 |
|
43920 | 1252 |
lemma ereal_eq_minus: |
1253 |
fixes x y z :: ereal |
|
41976 | 1254 |
shows "\<bar>y\<bar> \<noteq> \<infinity> \<Longrightarrow> x = z - y \<longleftrightarrow> x + y = z" |
43920 | 1255 |
by (auto simp: ereal_eq_minus_iff) |
41973 | 1256 |
|
43920 | 1257 |
lemma ereal_less_minus_iff: |
1258 |
fixes x y z :: ereal |
|
41973 | 1259 |
shows "x < z - y \<longleftrightarrow> |
1260 |
(y = \<infinity> \<longrightarrow> z = \<infinity> \<and> x \<noteq> \<infinity>) \<and> |
|
1261 |
(y = -\<infinity> \<longrightarrow> x \<noteq> \<infinity>) \<and> |
|
41976 | 1262 |
(\<bar>y\<bar> \<noteq> \<infinity>\<longrightarrow> x + y < z)" |
43920 | 1263 |
by (cases rule: ereal3_cases[of x y z]) auto |
41973 | 1264 |
|
43920 | 1265 |
lemma ereal_less_minus: |
1266 |
fixes x y z :: ereal |
|
41976 | 1267 |
shows "\<bar>y\<bar> \<noteq> \<infinity> \<Longrightarrow> x < z - y \<longleftrightarrow> x + y < z" |
43920 | 1268 |
by (auto simp: ereal_less_minus_iff) |
41973 | 1269 |
|
43920 | 1270 |
lemma ereal_le_minus_iff: |
1271 |
fixes x y z :: ereal |
|
53873 | 1272 |
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 | 1273 |
by (cases rule: ereal3_cases[of x y z]) auto |
41973 | 1274 |
|
43920 | 1275 |
lemma ereal_le_minus: |
1276 |
fixes x y z :: ereal |
|
41976 | 1277 |
shows "\<bar>y\<bar> \<noteq> \<infinity> \<Longrightarrow> x \<le> z - y \<longleftrightarrow> x + y \<le> z" |
43920 | 1278 |
by (auto simp: ereal_le_minus_iff) |
41973 | 1279 |
|
43920 | 1280 |
lemma ereal_minus_less_iff: |
1281 |
fixes x y z :: ereal |
|
53873 | 1282 |
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 | 1283 |
by (cases rule: ereal3_cases[of x y z]) auto |
41973 | 1284 |
|
43920 | 1285 |
lemma ereal_minus_less: |
1286 |
fixes x y z :: ereal |
|
41976 | 1287 |
shows "\<bar>y\<bar> \<noteq> \<infinity> \<Longrightarrow> x - y < z \<longleftrightarrow> x < z + y" |
43920 | 1288 |
by (auto simp: ereal_minus_less_iff) |
41973 | 1289 |
|
43920 | 1290 |
lemma ereal_minus_le_iff: |
1291 |
fixes x y z :: ereal |
|
41973 | 1292 |
shows "x - y \<le> z \<longleftrightarrow> |
1293 |
(y = -\<infinity> \<longrightarrow> z = \<infinity>) \<and> |
|
1294 |
(y = \<infinity> \<longrightarrow> x = \<infinity> \<longrightarrow> z = \<infinity>) \<and> |
|
41976 | 1295 |
(\<bar>y\<bar> \<noteq> \<infinity> \<longrightarrow> x \<le> z + y)" |
43920 | 1296 |
by (cases rule: ereal3_cases[of x y z]) auto |
41973 | 1297 |
|
43920 | 1298 |
lemma ereal_minus_le: |
1299 |
fixes x y z :: ereal |
|
41976 | 1300 |
shows "\<bar>y\<bar> \<noteq> \<infinity> \<Longrightarrow> x - y \<le> z \<longleftrightarrow> x \<le> z + y" |
43920 | 1301 |
by (auto simp: ereal_minus_le_iff) |
41973 | 1302 |
|
43920 | 1303 |
lemma ereal_minus_eq_minus_iff: |
1304 |
fixes a b c :: ereal |
|
41973 | 1305 |
shows "a - b = a - c \<longleftrightarrow> |
1306 |
b = c \<or> a = \<infinity> \<or> (a = -\<infinity> \<and> b \<noteq> -\<infinity> \<and> c \<noteq> -\<infinity>)" |
|
43920 | 1307 |
by (cases rule: ereal3_cases[of a b c]) auto |
41973 | 1308 |
|
43920 | 1309 |
lemma ereal_add_le_add_iff: |
43923 | 1310 |
fixes a b c :: ereal |
1311 |
shows "c + a \<le> c + b \<longleftrightarrow> |
|
41973 | 1312 |
a \<le> b \<or> c = \<infinity> \<or> (c = -\<infinity> \<and> a \<noteq> \<infinity> \<and> b \<noteq> \<infinity>)" |
43920 | 1313 |
by (cases rule: ereal3_cases[of a b c]) (simp_all add: field_simps) |
41973 | 1314 |
|
59023 | 1315 |
lemma ereal_add_le_add_iff2: |
1316 |
fixes a b c :: ereal |
|
1317 |
shows "a + c \<le> b + c \<longleftrightarrow> a \<le> b \<or> c = \<infinity> \<or> (c = -\<infinity> \<and> a \<noteq> \<infinity> \<and> b \<noteq> \<infinity>)" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1318 |
by (metis (no_types, lifting) add.commute ereal_add_le_add_iff) |
59023 | 1319 |
|
43920 | 1320 |
lemma ereal_mult_le_mult_iff: |
43923 | 1321 |
fixes a b c :: ereal |
1322 |
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 | 1323 |
by (cases rule: ereal3_cases[of a b c]) (simp_all add: mult_le_cancel_left) |
41973 | 1324 |
|
43920 | 1325 |
lemma ereal_minus_mono: |
1326 |
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
|
1327 |
shows "A - C \<le> B - D" |
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
1328 |
using assms |
43920 | 1329 |
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
|
1330 |
|
62648 | 1331 |
lemma ereal_mono_minus_cancel: |
1332 |
fixes a b c :: ereal |
|
1333 |
shows "c - a \<le> c - b \<Longrightarrow> 0 \<le> c \<Longrightarrow> c < \<infinity> \<Longrightarrow> b \<le> a" |
|
1334 |
by (cases a b c rule: ereal3_cases) auto |
|
1335 |
||
43920 | 1336 |
lemma real_of_ereal_minus: |
43923 | 1337 |
fixes a b :: ereal |
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
1338 |
shows "real_of_ereal (a - b) = (if \<bar>a\<bar> = \<infinity> \<or> \<bar>b\<bar> = \<infinity> then 0 else real_of_ereal a - real_of_ereal b)" |
43920 | 1339 |
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
|
1340 |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
1341 |
lemma real_of_ereal_minus': "\<bar>x\<bar> = \<infinity> \<longleftrightarrow> \<bar>y\<bar> = \<infinity> \<Longrightarrow> real_of_ereal x - real_of_ereal y = real_of_ereal (x - y :: ereal)" |
60060 | 1342 |
by(subst real_of_ereal_minus) auto |
1343 |
||
43920 | 1344 |
lemma ereal_diff_positive: |
1345 |
fixes a b :: ereal shows "a \<le> b \<Longrightarrow> 0 \<le> b - a" |
|
1346 |
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
|
1347 |
|
43920 | 1348 |
lemma ereal_between: |
1349 |
fixes x e :: ereal |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1350 |
assumes "\<bar>x\<bar> \<noteq> \<infinity>" and "0 < e" |
53873 | 1351 |
shows "x - e < x" |
1352 |
and "x < x + e" |
|
72236 | 1353 |
using assms by (cases x, cases e, auto)+ |
41973 | 1354 |
|
50104 | 1355 |
lemma ereal_minus_eq_PInfty_iff: |
53873 | 1356 |
fixes x y :: ereal |
1357 |
shows "x - y = \<infinity> \<longleftrightarrow> y = -\<infinity> \<or> x = \<infinity>" |
|
50104 | 1358 |
by (cases x y rule: ereal2_cases) simp_all |
1359 |
||
61631
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
1360 |
lemma ereal_diff_add_eq_diff_diff_swap: |
61738
c4f6031f1310
New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents:
61631
diff
changeset
|
1361 |
fixes x y z :: ereal |
61631
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
1362 |
shows "\<bar>y\<bar> \<noteq> \<infinity> \<Longrightarrow> x - (y + z) = x - y - z" |
72236 | 1363 |
by(cases x y z rule: ereal3_cases) simp_all |
61631
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
1364 |
|
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
1365 |
lemma ereal_diff_add_assoc2: |
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
1366 |
fixes x y z :: ereal |
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
1367 |
shows "x + y - z = x - z + y" |
72236 | 1368 |
by(cases x y z rule: ereal3_cases) simp_all |
61631
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
1369 |
|
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
1370 |
lemma ereal_add_uminus_conv_diff: fixes x y z :: ereal shows "- x + y = y - x" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1371 |
by (simp add: add.commute minus_ereal_def) |
61631
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
1372 |
|
61738
c4f6031f1310
New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents:
61631
diff
changeset
|
1373 |
lemma ereal_minus_diff_eq: |
c4f6031f1310
New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents:
61631
diff
changeset
|
1374 |
fixes x y :: ereal |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1375 |
shows "\<lbrakk> x = \<infinity> \<longrightarrow> y \<noteq> \<infinity>; x = -\<infinity> \<longrightarrow> y \<noteq> -\<infinity> \<rbrakk> \<Longrightarrow> - (x - y) = y - x" |
72236 | 1376 |
by(cases x y rule: ereal2_cases) simp_all |
61631
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
1377 |
|
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
1378 |
lemma ediff_le_self [simp]: "x - y \<le> (x :: enat)" |
72236 | 1379 |
by(cases x y rule: enat.exhaust[case_product enat.exhaust]) simp_all |
53873 | 1380 |
|
68752 | 1381 |
lemma ereal_abs_diff: |
1382 |
fixes a b::ereal |
|
1383 |
shows "abs(a-b) \<le> abs a + abs b" |
|
72236 | 1384 |
by (cases rule: ereal2_cases[of a b]) (auto) |
68752 | 1385 |
|
1386 |
||
60500 | 1387 |
subsubsection \<open>Division\<close> |
41973 | 1388 |
|
43920 | 1389 |
instantiation ereal :: inverse |
41973 | 1390 |
begin |
1391 |
||
43920 | 1392 |
function inverse_ereal where |
53873 | 1393 |
"inverse (ereal r) = (if r = 0 then \<infinity> else ereal (inverse r))" |
1394 |
| "inverse (\<infinity>::ereal) = 0" |
|
1395 |
| "inverse (-\<infinity>::ereal) = 0" |
|
43920 | 1396 |
by (auto intro: ereal_cases) |
41973 | 1397 |
termination by (relation "{}") simp |
1398 |
||
60429
d3d1e185cd63
uniform _ div _ as infix syntax for ring division
haftmann
parents:
60352
diff
changeset
|
1399 |
definition "x div y = x * inverse (y :: ereal)" |
41973 | 1400 |
|
47082 | 1401 |
instance .. |
53873 | 1402 |
|
41973 | 1403 |
end |
1404 |
||
43920 | 1405 |
lemma real_of_ereal_inverse[simp]: |
1406 |
fixes a :: ereal |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
1407 |
shows "real_of_ereal (inverse a) = 1 / real_of_ereal a" |
42950
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
hoelzl
parents:
42600
diff
changeset
|
1408 |
by (cases a) (auto simp: inverse_eq_divide) |
6e5c2a3c69da
move lemmas to Extended_Reals and Extended_Real_Limits
hoelzl
parents:
42600
diff
changeset
|
1409 |
|
43920 | 1410 |
lemma ereal_inverse[simp]: |
43923 | 1411 |
"inverse (0::ereal) = \<infinity>" |
43920 | 1412 |
"inverse (1::ereal) = 1" |
1413 |
by (simp_all add: one_ereal_def zero_ereal_def) |
|
41973 | 1414 |
|
43920 | 1415 |
lemma ereal_divide[simp]: |
1416 |
"ereal r / ereal p = (if p = 0 then ereal r * \<infinity> else ereal (r / p))" |
|
1417 |
unfolding divide_ereal_def by (auto simp: divide_real_def) |
|
41973 | 1418 |
|
43920 | 1419 |
lemma ereal_divide_same[simp]: |
53873 | 1420 |
fixes x :: ereal |
1421 |
shows "x / x = (if \<bar>x\<bar> = \<infinity> \<or> x = 0 then 0 else 1)" |
|
1422 |
by (cases x) (simp_all add: divide_real_def divide_ereal_def one_ereal_def) |
|
41973 | 1423 |
|
43920 | 1424 |
lemma ereal_inv_inv[simp]: |
53873 | 1425 |
fixes x :: ereal |
1426 |
shows "inverse (inverse x) = (if x \<noteq> -\<infinity> then x else \<infinity>)" |
|
41973 | 1427 |
by (cases x) auto |
1428 |
||
43920 | 1429 |
lemma ereal_inverse_minus[simp]: |
53873 | 1430 |
fixes x :: ereal |
1431 |
shows "inverse (- x) = (if x = 0 then \<infinity> else -inverse x)" |
|
41973 | 1432 |
by (cases x) simp_all |
1433 |
||
43920 | 1434 |
lemma ereal_uminus_divide[simp]: |
53873 | 1435 |
fixes x y :: ereal |
1436 |
shows "- x / y = - (x / y)" |
|
43920 | 1437 |
unfolding divide_ereal_def by simp |
41973 | 1438 |
|
43920 | 1439 |
lemma ereal_divide_Infty[simp]: |
53873 | 1440 |
fixes x :: ereal |
1441 |
shows "x / \<infinity> = 0" "x / -\<infinity> = 0" |
|
43920 | 1442 |
unfolding divide_ereal_def by simp_all |
41973 | 1443 |
|
53873 | 1444 |
lemma ereal_divide_one[simp]: "x / 1 = (x::ereal)" |
43920 | 1445 |
unfolding divide_ereal_def by simp |
41973 | 1446 |
|
53873 | 1447 |
lemma ereal_divide_ereal[simp]: "\<infinity> / ereal r = (if 0 \<le> r then \<infinity> else -\<infinity>)" |
43920 | 1448 |
unfolding divide_ereal_def by simp |
41973 | 1449 |
|
59000 | 1450 |
lemma ereal_inverse_nonneg_iff: "0 \<le> inverse (x :: ereal) \<longleftrightarrow> 0 \<le> x \<or> x = -\<infinity>" |
1451 |
by (cases x) auto |
|
1452 |
||
61631
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
1453 |
lemma inverse_ereal_ge0I: "0 \<le> (x :: ereal) \<Longrightarrow> 0 \<le> inverse x" |
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
1454 |
by(cases x) simp_all |
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
1455 |
|
43920 | 1456 |
lemma zero_le_divide_ereal[simp]: |
53873 | 1457 |
fixes a :: ereal |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1458 |
assumes "0 \<le> a" and "0 \<le> b" |
41978 | 1459 |
shows "0 \<le> a / b" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1460 |
by (simp add: assms divide_ereal_def ereal_inverse_nonneg_iff) |
41978 | 1461 |
|
43920 | 1462 |
lemma ereal_le_divide_pos: |
53873 | 1463 |
fixes x y z :: ereal |
1464 |
shows "x > 0 \<Longrightarrow> x \<noteq> \<infinity> \<Longrightarrow> y \<le> z / x \<longleftrightarrow> x * y \<le> z" |
|
43920 | 1465 |
by (cases rule: ereal3_cases[of x y z]) (auto simp: field_simps) |
41973 | 1466 |
|
43920 | 1467 |
lemma ereal_divide_le_pos: |
53873 | 1468 |
fixes x y z :: ereal |
1469 |
shows "x > 0 \<Longrightarrow> x \<noteq> \<infinity> \<Longrightarrow> z / x \<le> y \<longleftrightarrow> z \<le> x * y" |
|
43920 | 1470 |
by (cases rule: ereal3_cases[of x y z]) (auto simp: field_simps) |
41973 | 1471 |
|
43920 | 1472 |
lemma ereal_le_divide_neg: |
53873 | 1473 |
fixes x y z :: ereal |
1474 |
shows "x < 0 \<Longrightarrow> x \<noteq> -\<infinity> \<Longrightarrow> y \<le> z / x \<longleftrightarrow> z \<le> x * y" |
|
43920 | 1475 |
by (cases rule: ereal3_cases[of x y z]) (auto simp: field_simps) |
41973 | 1476 |
|
43920 | 1477 |
lemma ereal_divide_le_neg: |
53873 | 1478 |
fixes x y z :: ereal |
1479 |
shows "x < 0 \<Longrightarrow> x \<noteq> -\<infinity> \<Longrightarrow> z / x \<le> y \<longleftrightarrow> x * y \<le> z" |
|
43920 | 1480 |
by (cases rule: ereal3_cases[of x y z]) (auto simp: field_simps) |
41973 | 1481 |
|
43920 | 1482 |
lemma ereal_inverse_antimono_strict: |
1483 |
fixes x y :: ereal |
|
41973 | 1484 |
shows "0 \<le> x \<Longrightarrow> x < y \<Longrightarrow> inverse y < inverse x" |
43920 | 1485 |
by (cases rule: ereal2_cases[of x y]) auto |
41973 | 1486 |
|
43920 | 1487 |
lemma ereal_inverse_antimono: |
1488 |
fixes x y :: ereal |
|
53873 | 1489 |
shows "0 \<le> x \<Longrightarrow> x \<le> y \<Longrightarrow> inverse y \<le> inverse x" |
43920 | 1490 |
by (cases rule: ereal2_cases[of x y]) auto |
41973 | 1491 |
|
1492 |
lemma inverse_inverse_Pinfty_iff[simp]: |
|
53873 | 1493 |
fixes x :: ereal |
1494 |
shows "inverse x = \<infinity> \<longleftrightarrow> x = 0" |
|
41973 | 1495 |
by (cases x) auto |
1496 |
||
43920 | 1497 |
lemma ereal_inverse_eq_0: |
53873 | 1498 |
fixes x :: ereal |
1499 |
shows "inverse x = 0 \<longleftrightarrow> x = \<infinity> \<or> x = -\<infinity>" |
|
41973 | 1500 |
by (cases x) auto |
1501 |
||
43920 | 1502 |
lemma ereal_0_gt_inverse: |
53873 | 1503 |
fixes x :: ereal |
1504 |
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
|
1505 |
by (cases x) auto |
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
1506 |
|
60060 | 1507 |
lemma ereal_inverse_le_0_iff: |
1508 |
fixes x :: ereal |
|
1509 |
shows "inverse x \<le> 0 \<longleftrightarrow> x < 0 \<or> x = \<infinity>" |
|
1510 |
by(cases x) auto |
|
1511 |
||
1512 |
lemma ereal_divide_eq_0_iff: "x / y = 0 \<longleftrightarrow> x = 0 \<or> \<bar>y :: ereal\<bar> = \<infinity>" |
|
1513 |
by(cases x y rule: ereal2_cases) simp_all |
|
1514 |
||
43920 | 1515 |
lemma ereal_mult_less_right: |
43923 | 1516 |
fixes a b c :: ereal |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1517 |
assumes "b * a < c * a" "0 < a" "a < \<infinity>" |
41973 | 1518 |
shows "b < c" |
1519 |
using assms |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1520 |
by (metis order.asym ereal_mult_strict_left_mono linorder_neqE mult.commute) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1521 |
|
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1522 |
lemma ereal_mult_divide: |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1523 |
fixes a b :: ereal |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1524 |
shows "0 < b \<Longrightarrow> b < \<infinity> \<Longrightarrow> b * (a / b) = a" |
59000 | 1525 |
by (cases a b rule: ereal2_cases) auto |
1526 |
||
43920 | 1527 |
lemma ereal_power_divide: |
53873 | 1528 |
fixes x y :: ereal |
1529 |
shows "y \<noteq> 0 \<Longrightarrow> (x / y) ^ n = x^n / y^n" |
|
58787 | 1530 |
by (cases rule: ereal2_cases [of x y]) |
1531 |
(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
|
1532 |
|
43920 | 1533 |
lemma ereal_le_mult_one_interval: |
1534 |
fixes x y :: ereal |
|
41979
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
1535 |
assumes y: "y \<noteq> -\<infinity>" |
53873 | 1536 |
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
|
1537 |
shows "x \<le> y" |
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
1538 |
proof (cases x) |
53873 | 1539 |
case PInf |
1540 |
with z[of "1 / 2"] show "x \<le> y" |
|
1541 |
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
|
1542 |
next |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1543 |
case r: (real r) |
41979
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
1544 |
show "x \<le> y" |
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
1545 |
proof (cases y) |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1546 |
case p: (real p) |
41979
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
1547 |
have "r \<le> p" |
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
1548 |
proof (rule field_le_mult_one_interval) |
53873 | 1549 |
fix z :: real |
1550 |
assume "0 < z" and "z < 1" |
|
1551 |
with z[of "ereal z"] show "z * r \<le> p" |
|
1552 |
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
|
1553 |
qed |
53873 | 1554 |
then show "x \<le> y" |
1555 |
using p r by simp |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1556 |
qed (use y in simp_all) |
41979
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
1557 |
qed simp |
41978 | 1558 |
|
45934 | 1559 |
lemma ereal_divide_right_mono[simp]: |
1560 |
fixes x y z :: ereal |
|
53873 | 1561 |
assumes "x \<le> y" |
1562 |
and "0 < z" |
|
1563 |
shows "x / z \<le> y / z" |
|
1564 |
using assms by (cases x y z rule: ereal3_cases) (auto intro: divide_right_mono) |
|
45934 | 1565 |
|
1566 |
lemma ereal_divide_left_mono[simp]: |
|
1567 |
fixes x y z :: ereal |
|
53873 | 1568 |
assumes "y \<le> x" |
1569 |
and "0 < z" |
|
1570 |
and "0 < x * y" |
|
45934 | 1571 |
shows "z / x \<le> z / y" |
53873 | 1572 |
using assms |
1573 |
by (cases x y z rule: ereal3_cases) |
|
62390 | 1574 |
(auto intro: divide_left_mono simp: field_simps zero_less_mult_iff mult_less_0_iff split: if_split_asm) |
45934 | 1575 |
|
1576 |
lemma ereal_divide_zero_left[simp]: |
|
1577 |
fixes a :: ereal |
|
1578 |
shows "0 / a = 0" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1579 |
using ereal_divide_eq_0_iff by blast |
45934 | 1580 |
|
1581 |
lemma ereal_times_divide_eq_left[simp]: |
|
1582 |
fixes a b c :: ereal |
|
1583 |
shows "b / c * a = b * a / c" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1584 |
by (metis divide_ereal_def mult.assoc mult.commute) |
45934 | 1585 |
|
59000 | 1586 |
lemma ereal_times_divide_eq: "a * (b / c :: ereal) = a * b / c" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1587 |
by (metis ereal_times_divide_eq_left mult.commute) |
53873 | 1588 |
|
70724 | 1589 |
lemma ereal_inverse_real [simp]: "\<bar>z\<bar> \<noteq> \<infinity> \<Longrightarrow> z \<noteq> 0 \<Longrightarrow> ereal (inverse (real_of_ereal z)) = inverse z" |
1590 |
by auto |
|
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
1591 |
|
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
1592 |
lemma ereal_inverse_mult: |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
1593 |
"a \<noteq> 0 \<Longrightarrow> b \<noteq> 0 \<Longrightarrow> inverse (a * (b::ereal)) = inverse a * inverse b" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
1594 |
by (cases a; cases b) auto |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
1595 |
|
70724 | 1596 |
lemma inverse_eq_infinity_iff_eq_zero [simp]: |
1597 |
"1/(x::ereal) = \<infinity> \<longleftrightarrow> x = 0" |
|
1598 |
by (simp add: divide_ereal_def) |
|
1599 |
||
1600 |
lemma ereal_distrib_left: |
|
1601 |
fixes a b c :: ereal |
|
1602 |
assumes "a \<noteq> \<infinity> \<or> b \<noteq> -\<infinity>" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1603 |
and "a \<noteq> -\<infinity> \<or> b \<noteq> \<infinity>" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1604 |
and "\<bar>c\<bar> \<noteq> \<infinity>" |
70724 | 1605 |
shows "c * (a + b) = c * a + c * b" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1606 |
by (metis assms ereal_distrib mult.commute) |
70724 | 1607 |
|
1608 |
lemma ereal_distrib_minus_left: |
|
1609 |
fixes a b c :: ereal |
|
1610 |
assumes "a \<noteq> \<infinity> \<or> b \<noteq> \<infinity>" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1611 |
and "a \<noteq> -\<infinity> \<or> b \<noteq> -\<infinity>" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1612 |
and "\<bar>c\<bar> \<noteq> \<infinity>" |
70724 | 1613 |
shows "c * (a - b) = c * a - c * b" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1614 |
using assms ereal_distrib_left ereal_uminus_eq_reorder minus_ereal_def by auto |
70724 | 1615 |
|
1616 |
lemma ereal_distrib_minus_right: |
|
1617 |
fixes a b c :: ereal |
|
1618 |
assumes "a \<noteq> \<infinity> \<or> b \<noteq> \<infinity>" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1619 |
and "a \<noteq> -\<infinity> \<or> b \<noteq> -\<infinity>" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1620 |
and "\<bar>c\<bar> \<noteq> \<infinity>" |
70724 | 1621 |
shows "(a - b) * c = a * c - b * c" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1622 |
by (metis assms ereal_distrib_minus_left mult.commute) |
70724 | 1623 |
|
62369 | 1624 |
|
41973 | 1625 |
subsection "Complete lattice" |
1626 |
||
43920 | 1627 |
instantiation ereal :: lattice |
41973 | 1628 |
begin |
53873 | 1629 |
|
43920 | 1630 |
definition [simp]: "sup x y = (max x y :: ereal)" |
1631 |
definition [simp]: "inf x y = (min x y :: ereal)" |
|
60679 | 1632 |
instance by standard simp_all |
53873 | 1633 |
|
41973 | 1634 |
end |
1635 |
||
43920 | 1636 |
instantiation ereal :: complete_lattice |
41973 | 1637 |
begin |
1638 |
||
43923 | 1639 |
definition "bot = (-\<infinity>::ereal)" |
1640 |
definition "top = (\<infinity>::ereal)" |
|
41973 | 1641 |
|
51329
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
hoelzl
parents:
51328
diff
changeset
|
1642 |
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
|
1643 |
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 | 1644 |
|
43920 | 1645 |
lemma ereal_complete_Sup: |
51329
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
hoelzl
parents:
51328
diff
changeset
|
1646 |
fixes S :: "ereal set" |
41973 | 1647 |
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 | 1648 |
proof (cases "\<exists>x. \<forall>a\<in>S. a \<le> ereal x") |
1649 |
case True |
|
63060 | 1650 |
then obtain y where y: "a \<le> ereal y" if "a\<in>S" for a |
53873 | 1651 |
by auto |
1652 |
then have "\<infinity> \<notin> S" |
|
1653 |
by force |
|
41973 | 1654 |
show ?thesis |
53873 | 1655 |
proof (cases "S \<noteq> {-\<infinity>} \<and> S \<noteq> {}") |
1656 |
case True |
|
60500 | 1657 |
with \<open>\<infinity> \<notin> S\<close> obtain x where x: "x \<in> S" "\<bar>x\<bar> \<noteq> \<infinity>" |
53873 | 1658 |
by auto |
63060 | 1659 |
obtain s where s: "\<forall>x\<in>ereal -` S. x \<le> s" "(\<forall>x\<in>ereal -` S. x \<le> z) \<Longrightarrow> s \<le> z" for z |
51329
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
hoelzl
parents:
51328
diff
changeset
|
1660 |
proof (atomize_elim, rule complete_real) |
53873 | 1661 |
show "\<exists>x. x \<in> ereal -` S" |
1662 |
using x by auto |
|
1663 |
show "\<exists>z. \<forall>x\<in>ereal -` S. x \<le> z" |
|
1664 |
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
|
1665 |
qed |
41973 | 1666 |
show ?thesis |
43920 | 1667 |
proof (safe intro!: exI[of _ "ereal s"]) |
53873 | 1668 |
fix y |
1669 |
assume "y \<in> S" |
|
60500 | 1670 |
with s \<open>\<infinity> \<notin> S\<close> show "y \<le> ereal s" |
51329
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
hoelzl
parents:
51328
diff
changeset
|
1671 |
by (cases y) auto |
41973 | 1672 |
next |
53873 | 1673 |
fix z |
1674 |
assume "\<forall>y\<in>S. y \<le> z" |
|
60500 | 1675 |
with \<open>S \<noteq> {-\<infinity>} \<and> S \<noteq> {}\<close> show "ereal s \<le> z" |
51329
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
hoelzl
parents:
51328
diff
changeset
|
1676 |
by (cases z) (auto intro!: s) |
41973 | 1677 |
qed |
53873 | 1678 |
next |
1679 |
case False |
|
1680 |
then show ?thesis |
|
1681 |
by (auto intro!: exI[of _ "-\<infinity>"]) |
|
1682 |
qed |
|
1683 |
next |
|
1684 |
case False |
|
1685 |
then show ?thesis |
|
1686 |
by (fastforce intro!: exI[of _ \<infinity>] ereal_top intro: order_trans dest: less_imp_le simp: not_le) |
|
1687 |
qed |
|
41973 | 1688 |
|
43920 | 1689 |
lemma ereal_complete_uminus_eq: |
1690 |
fixes S :: "ereal set" |
|
41973 | 1691 |
shows "(\<forall>y\<in>uminus`S. y \<le> x) \<and> (\<forall>z. (\<forall>y\<in>uminus`S. y \<le> z) \<longrightarrow> x \<le> z) |
1692 |
\<longleftrightarrow> (\<forall>y\<in>S. -x \<le> y) \<and> (\<forall>z. (\<forall>y\<in>S. z \<le> y) \<longrightarrow> z \<le> -x)" |
|
43920 | 1693 |
by simp (metis ereal_minus_le_minus ereal_uminus_uminus) |
41973 | 1694 |
|
51329
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
hoelzl
parents:
51328
diff
changeset
|
1695 |
lemma ereal_complete_Inf: |
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
hoelzl
parents:
51328
diff
changeset
|
1696 |
"\<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 | 1697 |
using ereal_complete_Sup[of "uminus ` S"] |
1698 |
unfolding ereal_complete_uminus_eq |
|
1699 |
by auto |
|
41973 | 1700 |
|
1701 |
instance |
|
52729
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
haftmann
parents:
51775
diff
changeset
|
1702 |
proof |
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
haftmann
parents:
51775
diff
changeset
|
1703 |
show "Sup {} = (bot::ereal)" |
72236 | 1704 |
using ereal_bot by (auto simp: bot_ereal_def Sup_ereal_def) |
52729
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
haftmann
parents:
51775
diff
changeset
|
1705 |
show "Inf {} = (top::ereal)" |
72236 | 1706 |
unfolding top_ereal_def Inf_ereal_def |
1707 |
using ereal_infty_less_eq(1) ereal_less_eq(1) by blast |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1708 |
show "\<And>x::ereal. \<And>A. x \<in> A \<Longrightarrow> Inf A \<le> x" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1709 |
"\<And>A z. (\<And>x::ereal. x \<in> A \<Longrightarrow> z \<le> x) \<Longrightarrow> z \<le> Inf A" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1710 |
by (auto intro: someI2_ex ereal_complete_Inf simp: Inf_ereal_def) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1711 |
show "\<And>x::ereal. \<And>A. x \<in> A \<Longrightarrow> x \<le> Sup A" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1712 |
"\<And>A z. (\<And>x::ereal. x \<in> A \<Longrightarrow> x \<le> z) \<Longrightarrow> Sup A \<le> z" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1713 |
by (auto intro: someI2_ex ereal_complete_Sup simp: Sup_ereal_def) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1714 |
qed |
43941 | 1715 |
|
41973 | 1716 |
end |
1717 |
||
43941 | 1718 |
instance ereal :: complete_linorder .. |
1719 |
||
51775
408d937c9486
revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
hoelzl
parents:
51774
diff
changeset
|
1720 |
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
|
1721 |
proof |
408d937c9486
revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
hoelzl
parents:
51774
diff
changeset
|
1722 |
show "\<exists>a b::ereal. a \<noteq> b" |
54416 | 1723 |
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
|
1724 |
qed |
60720 | 1725 |
|
67452 | 1726 |
lemma min_PInf [simp]: "min (\<infinity>::ereal) x = x" |
72236 | 1727 |
by (metis min_top top_ereal_def) |
67452 | 1728 |
|
1729 |
lemma min_PInf2 [simp]: "min x (\<infinity>::ereal) = x" |
|
72236 | 1730 |
by (metis min_top2 top_ereal_def) |
67452 | 1731 |
|
1732 |
lemma max_PInf [simp]: "max (\<infinity>::ereal) x = \<infinity>" |
|
72236 | 1733 |
by (metis max_top top_ereal_def) |
67452 | 1734 |
|
1735 |
lemma max_PInf2 [simp]: "max x (\<infinity>::ereal) = \<infinity>" |
|
72236 | 1736 |
by (metis max_top2 top_ereal_def) |
67452 | 1737 |
|
1738 |
lemma min_MInf [simp]: "min (-\<infinity>::ereal) x = -\<infinity>" |
|
72236 | 1739 |
by (metis min_bot bot_ereal_def) |
67452 | 1740 |
|
1741 |
lemma min_MInf2 [simp]: "min x (-\<infinity>::ereal) = -\<infinity>" |
|
72236 | 1742 |
by (metis min_bot2 bot_ereal_def) |
67452 | 1743 |
|
1744 |
lemma max_MInf [simp]: "max (-\<infinity>::ereal) x = x" |
|
72236 | 1745 |
by (metis max_bot bot_ereal_def) |
67452 | 1746 |
|
1747 |
lemma max_MInf2 [simp]: "max x (-\<infinity>::ereal) = x" |
|
72236 | 1748 |
by (metis max_bot2 bot_ereal_def) |
67452 | 1749 |
|
67685
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1750 |
subsection \<open>Extended real intervals\<close> |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1751 |
|
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1752 |
lemma real_greaterThanLessThan_infinity_eq: |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1753 |
"real_of_ereal ` {N::ereal<..<\<infinity>} = |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1754 |
(if N = \<infinity> then {} else if N = -\<infinity> then UNIV else {real_of_ereal N<..})" |
72236 | 1755 |
by (force simp: real_less_ereal_iff intro!: image_eqI[where x="ereal _"] elim!: less_ereal.elims) |
67685
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1756 |
|
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1757 |
lemma real_greaterThanLessThan_minus_infinity_eq: |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1758 |
"real_of_ereal ` {-\<infinity><..<N::ereal} = |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1759 |
(if N = \<infinity> then UNIV else if N = -\<infinity> then {} else {..<real_of_ereal N})" |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1760 |
proof - |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1761 |
have "real_of_ereal ` {-\<infinity><..<N::ereal} = uminus ` real_of_ereal ` {-N<..<\<infinity>}" |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1762 |
by (auto simp: ereal_uminus_less_reorder intro!: image_eqI[where x="-x" for x]) |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1763 |
also note real_greaterThanLessThan_infinity_eq |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1764 |
finally show ?thesis by (auto intro!: image_eqI[where x="-x" for x]) |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1765 |
qed |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1766 |
|
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1767 |
lemma real_greaterThanLessThan_inter: |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1768 |
"real_of_ereal ` {N<..<M::ereal} = real_of_ereal ` {-\<infinity><..<M} \<inter> real_of_ereal ` {N<..<\<infinity>}" |
72236 | 1769 |
by (force elim!: less_ereal.elims) |
67685
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1770 |
|
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1771 |
lemma real_atLeastGreaterThan_eq: "real_of_ereal ` {N<..<M::ereal} = |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1772 |
(if N = \<infinity> then {} else |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1773 |
if N = -\<infinity> then |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1774 |
(if M = \<infinity> then UNIV |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1775 |
else if M = -\<infinity> then {} |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1776 |
else {..< real_of_ereal M}) |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1777 |
else if M = -\<infinity> then {} |
67685
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1778 |
else if M = \<infinity> then {real_of_ereal N<..} |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1779 |
else {real_of_ereal N <..< real_of_ereal M})" |
72236 | 1780 |
proof (cases "M = -\<infinity> \<or> M = \<infinity> \<or> N = -\<infinity> \<or> N = \<infinity>") |
1781 |
case True |
|
1782 |
then show ?thesis |
|
1783 |
by (auto simp: real_greaterThanLessThan_minus_infinity_eq real_greaterThanLessThan_infinity_eq ) |
|
1784 |
next |
|
1785 |
case False |
|
1786 |
then obtain p q where "M = ereal p" "N = ereal q" |
|
1787 |
by (metis MInfty_eq_minfinity ereal.distinct(3) uminus_ereal.elims) |
|
1788 |
moreover have "\<And>x. \<lbrakk>q < x; x < p\<rbrakk> \<Longrightarrow> x \<in> real_of_ereal ` {ereal q<..<ereal p}" |
|
1789 |
by (metis greaterThanLessThan_iff imageI less_ereal.simps(1) real_of_ereal.simps(1)) |
|
81332 | 1790 |
ultimately show ?thesis |
72236 | 1791 |
by (auto elim!: less_ereal.elims) |
1792 |
qed |
|
67685
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1793 |
|
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1794 |
lemma real_image_ereal_ivl: |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1795 |
fixes a b::ereal |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1796 |
shows |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1797 |
"real_of_ereal ` {a<..<b} = |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1798 |
(if a < b then (if a = -\<infinity> then if b = \<infinity> then UNIV else {..<real_of_ereal b} |
67685
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1799 |
else if b = \<infinity> then {real_of_ereal a<..} else {real_of_ereal a <..< real_of_ereal b}) else {})" |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1800 |
by (cases a; cases b; simp add: real_atLeastGreaterThan_eq not_less) |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1801 |
|
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1802 |
lemma fixes a b c::ereal |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1803 |
shows not_inftyI: "a < b \<Longrightarrow> b < c \<Longrightarrow> abs b \<noteq> \<infinity>" |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1804 |
by force |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1805 |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1806 |
context |
67685
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1807 |
fixes r s t::real |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1808 |
begin |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1809 |
|
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1810 |
lemma interval_Ioo_neq_Ioi: "{r<..<s} \<noteq> {t<..}" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1811 |
by (simp add: set_eq_iff) (meson linordered_field_no_ub nless_le order_less_trans) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1812 |
|
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1813 |
lemma interval_Ioo_neq_Iio: "{r<..<s} \<noteq> {..<t}" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1814 |
by (simp add: set_eq_iff) (meson linordered_field_no_lb order_less_irrefl order_less_trans) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1815 |
|
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1816 |
lemma interval_neq_ioo_UNIV: "{r<..<s} \<noteq> UNIV" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1817 |
and interval_Ioi_neq_UNIV: "{r<..} \<noteq> UNIV" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1818 |
and interval_Iio_neq_UNIV: "{..<r} \<noteq> UNIV" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1819 |
by auto |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1820 |
|
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1821 |
lemma interval_Ioi_neq_Iio: "{r<..} \<noteq> {..<s}" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1822 |
by (simp add: set_eq_iff) (meson lt_ex order_less_irrefl order_less_trans) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1823 |
|
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1824 |
lemma interval_empty_neq_Ioi: "{} \<noteq> {r<..}" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1825 |
and interval_empty_neq_Iio: "{} \<noteq> {..<r}" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1826 |
by (auto simp: set_eq_iff linordered_field_no_ub linordered_field_no_lb) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1827 |
|
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1828 |
end |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1829 |
|
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1830 |
lemmas interval_neqs = interval_Ioo_neq_Ioi interval_Ioo_neq_Iio |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1831 |
interval_neq_ioo_UNIV interval_Ioi_neq_Iio |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1832 |
interval_Ioi_neq_UNIV interval_Iio_neq_UNIV |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1833 |
interval_empty_neq_Ioi interval_empty_neq_Iio |
67685
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1834 |
|
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1835 |
lemma greaterThanLessThan_eq_iff: |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1836 |
fixes r s t u::real |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1837 |
shows "({r<..<s} = {t<..<u}) = (r \<ge> s \<and> u \<le> t \<or> r = t \<and> s = u)" |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1838 |
by (metis cInf_greaterThanLessThan cSup_greaterThanLessThan greaterThanLessThan_empty_iff not_le) |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1839 |
|
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1840 |
lemma real_of_ereal_image_greaterThanLessThan_iff: |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1841 |
"real_of_ereal ` {a <..< b} = real_of_ereal ` {c <..< d} \<longleftrightarrow> (a \<ge> b \<and> c \<ge> d \<or> a = c \<and> b = d)" |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1842 |
unfolding real_atLeastGreaterThan_eq |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1843 |
by (cases a; cases b; cases c; cases d; |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1844 |
simp add: greaterThanLessThan_eq_iff interval_neqs interval_neqs[symmetric]) |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1845 |
|
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1846 |
lemma uminus_image_real_of_ereal_image_greaterThanLessThan: |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1847 |
"uminus ` real_of_ereal ` {l <..< u} = real_of_ereal ` {-u <..< -l}" |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1848 |
by (force simp: algebra_simps ereal_less_uminus_reorder |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1849 |
ereal_uminus_less_reorder intro: image_eqI[where x="-x" for x]) |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1850 |
|
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1851 |
lemma add_image_real_of_ereal_image_greaterThanLessThan: |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1852 |
"(+) c ` real_of_ereal ` {l <..< u} = real_of_ereal ` {c + l <..< c + u}" |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1853 |
apply safe |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1854 |
subgoal for x |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1855 |
using ereal_less_add[of c] |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1856 |
by (force simp: real_of_ereal_add add.commute) |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1857 |
subgoal for _ x |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1858 |
by (force simp: add.commute real_of_ereal_minus ereal_minus_less ereal_less_minus |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1859 |
intro: image_eqI[where x="x - c"]) |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1860 |
done |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1861 |
|
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1862 |
lemma add2_image_real_of_ereal_image_greaterThanLessThan: |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1863 |
"(\<lambda>x. x + c) ` real_of_ereal ` {l <..< u} = real_of_ereal ` {l + c <..< u + c}" |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1864 |
using add_image_real_of_ereal_image_greaterThanLessThan[of c l u] |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1865 |
by (metis add.commute image_cong) |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1866 |
|
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1867 |
lemma minus_image_real_of_ereal_image_greaterThanLessThan: |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1868 |
"(-) c ` real_of_ereal ` {l <..< u} = real_of_ereal ` {c - u <..< c - l}" |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1869 |
(is "?l = ?r") |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1870 |
proof - |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1871 |
have "?l = (+) c ` uminus ` real_of_ereal ` {l <..< u}" by auto |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1872 |
also note uminus_image_real_of_ereal_image_greaterThanLessThan |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1873 |
also note add_image_real_of_ereal_image_greaterThanLessThan |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1874 |
finally show ?thesis by (simp add: minus_ereal_def) |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1875 |
qed |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1876 |
|
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1877 |
lemma real_ereal_bound_lemma_up: |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1878 |
assumes "s \<in> real_of_ereal ` {a<..<b}" |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1879 |
assumes "t \<notin> real_of_ereal ` {a<..<b}" |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1880 |
assumes "s \<le> t" |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1881 |
shows "b \<noteq> \<infinity>" |
72236 | 1882 |
proof (cases b) |
1883 |
case PInf |
|
1884 |
then show ?thesis |
|
1885 |
using assms |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1886 |
by (metis UNIV_I empty_iff greaterThan_iff order_less_le_trans real_image_ereal_ivl) |
72236 | 1887 |
qed auto |
67685
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1888 |
|
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1889 |
lemma real_ereal_bound_lemma_down: |
72236 | 1890 |
assumes s: "s \<in> real_of_ereal ` {a<..<b}" |
1891 |
and t: "t \<notin> real_of_ereal ` {a<..<b}" |
|
1892 |
and "t \<le> s" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1893 |
shows "a \<noteq> -\<infinity>" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1894 |
by (metis UNIV_I assms empty_iff lessThan_iff order_le_less_trans |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1895 |
real_greaterThanLessThan_minus_infinity_eq) |
67685
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1896 |
|
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1897 |
|
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
1898 |
subsection "Topological space" |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1899 |
|
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1900 |
instantiation ereal :: linear_continuum_topology |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1901 |
begin |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1902 |
|
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1903 |
definition "open_ereal" :: "ereal set \<Rightarrow> bool" where |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1904 |
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
|
1905 |
|
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1906 |
instance |
60679 | 1907 |
by standard (simp add: open_ereal_generated) |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1908 |
|
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1909 |
end |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1910 |
|
60720 | 1911 |
lemma continuous_on_ereal[continuous_intros]: |
1912 |
assumes f: "continuous_on s f" shows "continuous_on s (\<lambda>x. ereal (f x))" |
|
61738
c4f6031f1310
New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents:
61631
diff
changeset
|
1913 |
by (rule continuous_on_compose2 [OF continuous_onI_mono[of ereal UNIV] f]) auto |
60720 | 1914 |
|
61973 | 1915 |
lemma tendsto_ereal[tendsto_intros, simp, intro]: "(f \<longlongrightarrow> x) F \<Longrightarrow> ((\<lambda>x. ereal (f x)) \<longlongrightarrow> ereal x) F" |
60720 | 1916 |
using isCont_tendsto_compose[of x ereal f F] continuous_on_ereal[of UNIV "\<lambda>x. x"] |
1917 |
by (simp add: continuous_on_eq_continuous_at) |
|
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1918 |
|
72236 | 1919 |
lemma tendsto_uminus_ereal[tendsto_intros, simp, intro]: |
1920 |
assumes "(f \<longlongrightarrow> x) F" |
|
1921 |
shows "((\<lambda>x. - f x::ereal) \<longlongrightarrow> - x) F" |
|
1922 |
proof (rule tendsto_compose[OF order_tendstoI assms]) |
|
1923 |
show "\<And>a. a < - x \<Longrightarrow> \<forall>\<^sub>F x in at x. a < - x" |
|
1924 |
by (metis ereal_less_uminus_reorder eventually_at_topological lessThan_iff open_lessThan) |
|
1925 |
show "\<And>a. - x < a \<Longrightarrow> \<forall>\<^sub>F x in at x. - x < a" |
|
1926 |
by (metis ereal_uminus_reorder(2) eventually_at_topological greaterThan_iff open_greaterThan) |
|
1927 |
qed |
|
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1928 |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1929 |
|
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1930 |
|
61245 | 1931 |
lemma at_infty_ereal_eq_at_top: "at \<infinity> = filtermap ereal at_top" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1932 |
proof - |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1933 |
have "\<And>P b. \<forall>z. b \<le> z \<and> b \<noteq> z \<longrightarrow> P (ereal z) \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. P (ereal n)" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1934 |
by (metis gt_ex order_less_le order_less_le_trans) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1935 |
then show ?thesis |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1936 |
unfolding filter_eq_iff eventually_at_filter eventually_at_top_linorder eventually_filtermap |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1937 |
top_ereal_def[symmetric] |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1938 |
apply (subst eventually_nhds_top[of 0]) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1939 |
apply (auto simp: top_ereal_def less_le ereal_all_split ereal_ex_split) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1940 |
done |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1941 |
qed |
61245 | 1942 |
|
61973 | 1943 |
lemma ereal_Lim_uminus: "(f \<longlongrightarrow> f0) net \<longleftrightarrow> ((\<lambda>x. - f x::ereal) \<longlongrightarrow> - f0) net" |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1944 |
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
|
1945 |
by auto |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1946 |
|
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1947 |
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
|
1948 |
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
|
1949 |
|
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1950 |
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
|
1951 |
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
|
1952 |
|
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1953 |
lemma tendsto_cmult_ereal[tendsto_intros, simp, intro]: |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1954 |
assumes c: "\<bar>c\<bar> \<noteq> \<infinity>" and f: "(f \<longlongrightarrow> x) F" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1955 |
shows "((\<lambda>x. c * f x::ereal) \<longlongrightarrow> c * x) F" |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1956 |
proof - |
81332 | 1957 |
have *: "((\<lambda>x. c * f x::ereal) \<longlongrightarrow> c * x) F" if "0 < c" "c < \<infinity>" for c :: ereal |
1958 |
using that |
|
1959 |
apply (intro tendsto_compose[OF _ f]) |
|
1960 |
apply (auto intro!: order_tendstoI simp: eventually_at_topological) |
|
1961 |
apply (rule_tac x="{a/c <..}" in exI) |
|
1962 |
apply (auto split: ereal.split simp: ereal_divide_less_iff mult.commute) [] |
|
1963 |
apply (rule_tac x="{..< a/c}" in exI) |
|
1964 |
apply (auto split: ereal.split simp: ereal_less_divide_iff mult.commute) [] |
|
1965 |
done |
|
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1966 |
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
|
1967 |
using c by (cases c) auto |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1968 |
then show ?thesis |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1969 |
proof (elim disjE conjE) |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1970 |
assume "-\<infinity> < c" "c < 0" |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1971 |
then have "0 < - c" "- c < \<infinity>" |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1972 |
by (auto simp: ereal_uminus_reorder ereal_less_uminus_reorder[of 0]) |
61973 | 1973 |
then have "((\<lambda>x. (- c) * f x) \<longlongrightarrow> (- c) * x) F" |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1974 |
by (rule *) |
61738
c4f6031f1310
New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents:
61631
diff
changeset
|
1975 |
from tendsto_uminus_ereal[OF this] show ?thesis |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1976 |
by simp |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1977 |
qed (auto intro!: *) |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1978 |
qed |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1979 |
|
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1980 |
lemma tendsto_cmult_ereal_not_0[tendsto_intros, simp, intro]: |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1981 |
assumes "x \<noteq> 0" and f: "(f \<longlongrightarrow> x) F" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1982 |
shows "((\<lambda>x. c * f x::ereal) \<longlongrightarrow> c * x) F" |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1983 |
proof cases |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1984 |
assume "\<bar>c\<bar> = \<infinity>" |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1985 |
show ?thesis |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1986 |
proof (rule filterlim_cong[THEN iffD1, OF refl refl _ tendsto_const]) |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1987 |
have "0 < x \<or> x < 0" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1988 |
using \<open>x \<noteq> 0\<close> by (auto simp: neq_iff) |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1989 |
then show "eventually (\<lambda>x'. c * x = c * f x') F" |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1990 |
proof |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1991 |
assume "0 < x" from order_tendstoD(1)[OF f this] show ?thesis |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1992 |
by eventually_elim (use \<open>0<x\<close> \<open>\<bar>c\<bar> = \<infinity>\<close> in auto) |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1993 |
next |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1994 |
assume "x < 0" from order_tendstoD(2)[OF f this] show ?thesis |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
1995 |
by eventually_elim (use \<open>x<0\<close> \<open>\<bar>c\<bar> = \<infinity>\<close> in auto) |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1996 |
qed |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1997 |
qed |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1998 |
qed (rule tendsto_cmult_ereal[OF _ f]) |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
1999 |
|
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2000 |
lemma tendsto_cadd_ereal[tendsto_intros, simp, intro]: |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2001 |
assumes c: "y \<noteq> -\<infinity>" "x \<noteq> -\<infinity>" and f: "(f \<longlongrightarrow> x) F" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2002 |
shows "((\<lambda>x. f x + y::ereal) \<longlongrightarrow> x + y) F" |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2003 |
apply (intro tendsto_compose[OF _ f]) |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2004 |
apply (auto intro!: order_tendstoI simp: eventually_at_topological) |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2005 |
apply (rule_tac x="{a - y <..}" in exI) |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2006 |
apply (auto split: ereal.split simp: ereal_minus_less_iff c) [] |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2007 |
apply (rule_tac x="{..< a - y}" in exI) |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2008 |
apply (auto split: ereal.split simp: ereal_less_minus_iff c) [] |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2009 |
done |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2010 |
|
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2011 |
lemma tendsto_add_left_ereal[tendsto_intros, simp, intro]: |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2012 |
assumes c: "\<bar>y\<bar> \<noteq> \<infinity>" and f: "(f \<longlongrightarrow> x) F" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2013 |
shows "((\<lambda>x. f x + y::ereal) \<longlongrightarrow> x + y) F" |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2014 |
apply (intro tendsto_compose[OF _ f]) |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2015 |
apply (auto intro!: order_tendstoI simp: eventually_at_topological) |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2016 |
apply (rule_tac x="{a - y <..}" in exI) |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2017 |
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
|
2018 |
apply (rule_tac x="{..< a - y}" in exI) |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2019 |
apply (auto split: ereal.split simp: ereal_less_minus_iff c) [] |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2020 |
done |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2021 |
|
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2022 |
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
|
2023 |
unfolding continuous_def by auto |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2024 |
|
59425 | 2025 |
lemma ereal_Sup: |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2026 |
assumes *: "\<bar>SUP a\<in>A. ereal a\<bar> \<noteq> \<infinity>" |
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2027 |
shows "ereal (Sup A) = (SUP a\<in>A. ereal a)" |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2028 |
proof (rule continuous_at_Sup_mono) |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2029 |
obtain r where r: "ereal r = (SUP a\<in>A. ereal a)" "A \<noteq> {}" |
59425 | 2030 |
using * by (force simp: bot_ereal_def) |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2031 |
then show "bdd_above A" "A \<noteq> {}" |
68406 | 2032 |
by (auto intro!: SUP_upper bdd_aboveI[of _ r] simp flip: ereal_less_eq) |
60762 | 2033 |
qed (auto simp: mono_def continuous_at_imp_continuous_at_within continuous_at_ereal) |
59425 | 2034 |
|
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2035 |
lemma ereal_SUP: "\<bar>SUP a\<in>A. ereal (f a)\<bar> \<noteq> \<infinity> \<Longrightarrow> ereal (SUP a\<in>A. f a) = (SUP a\<in>A. ereal (f a))" |
69861
62e47f06d22c
avoid context-sensitive simp rules whose context-free form (image_comp) is not simp by default
haftmann
parents:
69661
diff
changeset
|
2036 |
by (simp add: ereal_Sup image_comp) |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2037 |
|
59425 | 2038 |
lemma ereal_Inf: |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2039 |
assumes *: "\<bar>INF a\<in>A. ereal a\<bar> \<noteq> \<infinity>" |
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2040 |
shows "ereal (Inf A) = (INF a\<in>A. ereal a)" |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2041 |
proof (rule continuous_at_Inf_mono) |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2042 |
obtain r where r: "ereal r = (INF a\<in>A. ereal a)" "A \<noteq> {}" |
59425 | 2043 |
using * by (force simp: top_ereal_def) |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2044 |
then show "bdd_below A" "A \<noteq> {}" |
68406 | 2045 |
by (auto intro!: INF_lower bdd_belowI[of _ r] simp flip: ereal_less_eq) |
60762 | 2046 |
qed (auto simp: mono_def continuous_at_imp_continuous_at_within continuous_at_ereal) |
59425 | 2047 |
|
62083 | 2048 |
lemma ereal_Inf': |
2049 |
assumes *: "bdd_below A" "A \<noteq> {}" |
|
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2050 |
shows "ereal (Inf A) = (INF a\<in>A. ereal a)" |
62083 | 2051 |
proof (rule ereal_Inf) |
63060 | 2052 |
from * obtain l u where "x \<in> A \<Longrightarrow> l \<le> x" "u \<in> A" for x |
62083 | 2053 |
by (auto simp: bdd_below_def) |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2054 |
then have "l \<le> (INF x\<in>A. ereal x)" "(INF x\<in>A. ereal x) \<le> u" |
62083 | 2055 |
by (auto intro!: INF_greatest INF_lower) |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2056 |
then show "\<bar>INF a\<in>A. ereal a\<bar> \<noteq> \<infinity>" |
62083 | 2057 |
by auto |
2058 |
qed |
|
2059 |
||
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2060 |
lemma ereal_INF: "\<bar>INF a\<in>A. ereal (f a)\<bar> \<noteq> \<infinity> \<Longrightarrow> ereal (INF a\<in>A. f a) = (INF a\<in>A. ereal (f a))" |
69861
62e47f06d22c
avoid context-sensitive simp rules whose context-free form (image_comp) is not simp by default
haftmann
parents:
69661
diff
changeset
|
2061 |
by (simp add: ereal_Inf image_comp) |
59425 | 2062 |
|
51329
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
hoelzl
parents:
51328
diff
changeset
|
2063 |
lemma ereal_Sup_uminus_image_eq: "Sup (uminus ` S::ereal set) = - Inf S" |
56166 | 2064 |
by (auto intro!: SUP_eqI |
51329
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
hoelzl
parents:
51328
diff
changeset
|
2065 |
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
|
2066 |
intro!: complete_lattice_class.Inf_lower2) |
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
hoelzl
parents:
51328
diff
changeset
|
2067 |
|
56166 | 2068 |
lemma ereal_SUP_uminus_eq: |
2069 |
fixes f :: "'a \<Rightarrow> ereal" |
|
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2070 |
shows "(SUP x\<in>S. uminus (f x)) = - (INF x\<in>S. f x)" |
69861
62e47f06d22c
avoid context-sensitive simp rules whose context-free form (image_comp) is not simp by default
haftmann
parents:
69661
diff
changeset
|
2071 |
using ereal_Sup_uminus_image_eq [of "f ` S"] by (simp add: image_comp) |
56166 | 2072 |
|
51329
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
hoelzl
parents:
51328
diff
changeset
|
2073 |
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
|
2074 |
by (auto intro!: inj_onI) |
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
hoelzl
parents:
51328
diff
changeset
|
2075 |
|
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
hoelzl
parents:
51328
diff
changeset
|
2076 |
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
|
2077 |
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
|
2078 |
|
56166 | 2079 |
lemma ereal_INF_uminus_eq: |
2080 |
fixes f :: "'a \<Rightarrow> ereal" |
|
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2081 |
shows "(INF x\<in>S. - f x) = - (SUP x\<in>S. f x)" |
69861
62e47f06d22c
avoid context-sensitive simp rules whose context-free form (image_comp) is not simp by default
haftmann
parents:
69661
diff
changeset
|
2082 |
using ereal_Inf_uminus_image_eq [of "f ` S"] by (simp add: image_comp) |
56166 | 2083 |
|
54416 | 2084 |
lemma ereal_SUP_not_infty: |
2085 |
fixes f :: "_ \<Rightarrow> ereal" |
|
69313 | 2086 |
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>Sup (f ` A)\<bar> \<noteq> \<infinity>" |
54416 | 2087 |
using SUP_upper2[of _ A l f] SUP_least[of A f u] |
69313 | 2088 |
by (cases "Sup (f ` A)") auto |
54416 | 2089 |
|
2090 |
lemma ereal_INF_not_infty: |
|
2091 |
fixes f :: "_ \<Rightarrow> ereal" |
|
69313 | 2092 |
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>Inf (f ` A)\<bar> \<noteq> \<infinity>" |
54416 | 2093 |
using INF_lower2[of _ A f u] INF_greatest[of A l f] |
69313 | 2094 |
by (cases "Inf (f ` A)") auto |
54416 | 2095 |
|
43920 | 2096 |
lemma ereal_image_uminus_shift: |
53873 | 2097 |
fixes X Y :: "ereal set" |
2098 |
shows "uminus ` X = Y \<longleftrightarrow> X = uminus ` Y" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2099 |
by (metis ereal_minus_minus_image) |
41973 | 2100 |
|
2101 |
lemma Sup_eq_MInfty: |
|
53873 | 2102 |
fixes S :: "ereal set" |
2103 |
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
|
2104 |
unfolding bot_ereal_def[symmetric] by auto |
41973 | 2105 |
|
2106 |
lemma Inf_eq_PInfty: |
|
53873 | 2107 |
fixes S :: "ereal set" |
2108 |
shows "Inf S = \<infinity> \<longleftrightarrow> S = {} \<or> S = {\<infinity>}" |
|
41973 | 2109 |
using Sup_eq_MInfty[of "uminus`S"] |
43920 | 2110 |
unfolding ereal_Sup_uminus_image_eq ereal_image_uminus_shift by simp |
41973 | 2111 |
|
53873 | 2112 |
lemma Inf_eq_MInfty: |
2113 |
fixes S :: "ereal set" |
|
2114 |
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
|
2115 |
unfolding bot_ereal_def[symmetric] by auto |
41973 | 2116 |
|
43923 | 2117 |
lemma Sup_eq_PInfty: |
53873 | 2118 |
fixes S :: "ereal set" |
2119 |
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
|
2120 |
unfolding top_ereal_def[symmetric] by auto |
41973 | 2121 |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2122 |
lemma not_MInfty_nonneg[simp]: "0 \<le> (x::ereal) \<Longrightarrow> x \<noteq> -\<infinity>" |
60771 | 2123 |
by auto |
2124 |
||
43920 | 2125 |
lemma Sup_ereal_close: |
2126 |
fixes e :: ereal |
|
53873 | 2127 |
assumes "0 < e" |
2128 |
and S: "\<bar>Sup S\<bar> \<noteq> \<infinity>" "S \<noteq> {}" |
|
41973 | 2129 |
shows "\<exists>x\<in>S. Sup S - e < x" |
41976 | 2130 |
using assms by (cases e) (auto intro!: less_Sup_iff[THEN iffD1]) |
41973 | 2131 |
|
43920 | 2132 |
lemma Inf_ereal_close: |
53873 | 2133 |
fixes e :: ereal |
2134 |
assumes "\<bar>Inf X\<bar> \<noteq> \<infinity>" |
|
2135 |
and "0 < e" |
|
41973 | 2136 |
shows "\<exists>x\<in>X. x < Inf X + e" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2137 |
by (meson Inf_less_iff assms ereal_between(2)) |
41973 | 2138 |
|
59425 | 2139 |
lemma SUP_PInfty: |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2140 |
"(\<And>n::nat. \<exists>i\<in>A. ereal (real n) \<le> f i) \<Longrightarrow> (SUP i\<in>A. f i :: ereal) = \<infinity>" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2141 |
by (meson SUP_upper2 less_PInf_Ex_of_nat linorder_not_less) |
59425 | 2142 |
|
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2143 |
lemma SUP_nat_Infty: "(SUP i. ereal (real i)) = \<infinity>" |
59425 | 2144 |
by (rule SUP_PInfty) auto |
41973 | 2145 |
|
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2146 |
lemma SUP_ereal_add_left: |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2147 |
assumes "I \<noteq> {}" "c \<noteq> -\<infinity>" |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2148 |
shows "(SUP i\<in>I. f i + c :: ereal) = (SUP i\<in>I. f i) + c" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2149 |
proof (cases "(SUP i\<in>I. f i) = -\<infinity>") |
63540 | 2150 |
case True |
2151 |
then have "\<And>i. i \<in> I \<Longrightarrow> f i = -\<infinity>" |
|
62343
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents:
62101
diff
changeset
|
2152 |
unfolding Sup_eq_MInfty by auto |
63540 | 2153 |
with True show ?thesis |
60500 | 2154 |
by (cases c) (auto simp: \<open>I \<noteq> {}\<close>) |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2155 |
next |
63540 | 2156 |
case False |
2157 |
then show ?thesis |
|
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2158 |
by (subst continuous_at_Sup_mono[where f="\<lambda>x. x + c"]) |
69861
62e47f06d22c
avoid context-sensitive simp rules whose context-free form (image_comp) is not simp by default
haftmann
parents:
69661
diff
changeset
|
2159 |
(auto simp: continuous_at_imp_continuous_at_within continuous_at mono_def add_mono \<open>I \<noteq> {}\<close> |
62e47f06d22c
avoid context-sensitive simp rules whose context-free form (image_comp) is not simp by default
haftmann
parents:
69661
diff
changeset
|
2160 |
\<open>c \<noteq> -\<infinity>\<close> image_comp) |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2161 |
qed |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2162 |
|
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2163 |
lemma SUP_ereal_add_right: |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2164 |
fixes c :: ereal |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2165 |
shows "I \<noteq> {} \<Longrightarrow> c \<noteq> -\<infinity> \<Longrightarrow> (SUP i\<in>I. c + f i) = c + (SUP i\<in>I. f i)" |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2166 |
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
|
2167 |
|
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2168 |
lemma SUP_ereal_minus_right: |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2169 |
assumes "I \<noteq> {}" "c \<noteq> -\<infinity>" |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2170 |
shows "(SUP i\<in>I. c - f i :: ereal) = c - (INF i\<in>I. f i)" |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2171 |
using SUP_ereal_add_right[OF assms, of "\<lambda>i. - f i"] |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2172 |
by (simp add: ereal_SUP_uminus_eq minus_ereal_def) |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2173 |
|
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2174 |
lemma SUP_ereal_minus_left: |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2175 |
assumes "I \<noteq> {}" "c \<noteq> \<infinity>" |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2176 |
shows "(SUP i\<in>I. f i - c:: ereal) = (SUP i\<in>I. f i) - c" |
60500 | 2177 |
using SUP_ereal_add_left[OF \<open>I \<noteq> {}\<close>, of "-c" f] by (simp add: \<open>c \<noteq> \<infinity>\<close> minus_ereal_def) |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2178 |
|
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2179 |
lemma INF_ereal_minus_right: |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2180 |
assumes "I \<noteq> {}" and "\<bar>c\<bar> \<noteq> \<infinity>" |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2181 |
shows "(INF i\<in>I. c - f i) = c - (SUP i\<in>I. f i::ereal)" |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2182 |
proof - |
81332 | 2183 |
have *: "(- c) + b = - (c - b)" for b |
2184 |
using \<open>\<bar>c\<bar> \<noteq> \<infinity>\<close> by (cases c b rule: ereal2_cases) auto |
|
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2185 |
show ?thesis |
60500 | 2186 |
using SUP_ereal_add_right[OF \<open>I \<noteq> {}\<close>, of "-c" f] \<open>\<bar>c\<bar> \<noteq> \<infinity>\<close> |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2187 |
by (auto simp: * ereal_SUP_uminus_eq) |
41973 | 2188 |
qed |
2189 |
||
43920 | 2190 |
lemma SUP_ereal_le_addI: |
43923 | 2191 |
fixes f :: "'i \<Rightarrow> ereal" |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2192 |
assumes "\<And>i. f i + y \<le> z" and "y \<noteq> -\<infinity>" |
69313 | 2193 |
shows "Sup (f ` UNIV) + y \<le> z" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2194 |
by (metis SUP_ereal_add_left SUP_least UNIV_not_empty assms) |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2195 |
|
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2196 |
lemma SUP_combine: |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2197 |
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
|
2198 |
assumes mono: "\<And>a b c d. a \<le> b \<Longrightarrow> c \<le> d \<Longrightarrow> f a c \<le> f b d" |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2199 |
shows "(SUP i\<in>UNIV. SUP j\<in>UNIV. f i j) = (SUP i. f i i)" |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2200 |
proof (rule antisym) |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2201 |
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
|
2202 |
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
|
2203 |
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
|
2204 |
by (rule SUP_least SUP_upper2 UNIV_I mono order_refl)+ |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2205 |
qed |
41978 | 2206 |
|
56212
3253aaf73a01
consolidated theorem names containing INFI and SUPR: have INF and SUP instead uniformly
haftmann
parents:
56166
diff
changeset
|
2207 |
lemma SUP_ereal_add: |
43920 | 2208 |
fixes f g :: "nat \<Rightarrow> ereal" |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2209 |
assumes inc: "incseq f" "incseq g" |
53873 | 2210 |
and pos: "\<And>i. f i \<noteq> -\<infinity>" "\<And>i. g i \<noteq> -\<infinity>" |
69313 | 2211 |
shows "(SUP i. f i + g i) = Sup (f ` UNIV) + Sup (g ` UNIV)" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2212 |
proof - |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2213 |
have "\<And>i j k l. \<lbrakk>i \<le> j; k \<le> l\<rbrakk> \<Longrightarrow> f i + g k \<le> f j + g l" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2214 |
by (meson add_mono inc incseq_def) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2215 |
then have "(SUP i. f i + g i) = (SUP i j. f i + g j)" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2216 |
by (simp add: SUP_combine) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2217 |
also have "... = (SUP i j. g j + f i)" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2218 |
by (simp add: add.commute) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2219 |
also have "... = (SUP i. Sup (range g) + f i)" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2220 |
by (simp add: SUP_ereal_add_left pos(1)) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2221 |
also have "... = (SUP i. f i + Sup (range g))" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2222 |
by (simp add: add.commute) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2223 |
also have "... = Sup (f ` UNIV) + Sup (g ` UNIV)" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2224 |
by (simp add: SUP_eq_iff SUP_ereal_add_left pos(2)) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2225 |
finally show ?thesis . |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2226 |
qed |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2227 |
|
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2228 |
lemma INF_eq_minf: "(INF i\<in>I. f i::ereal) \<noteq> -\<infinity> \<longleftrightarrow> (\<exists>b>-\<infinity>. \<forall>i\<in>I. b \<le> f i)" |
63968
4359400adfe7
HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents:
63952
diff
changeset
|
2229 |
unfolding bot_ereal_def[symmetric] INF_eq_bot_iff by (auto simp: not_less) |
4359400adfe7
HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents:
63952
diff
changeset
|
2230 |
|
4359400adfe7
HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents:
63952
diff
changeset
|
2231 |
lemma INF_ereal_add_left: |
4359400adfe7
HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents:
63952
diff
changeset
|
2232 |
assumes "I \<noteq> {}" "c \<noteq> -\<infinity>" "\<And>x. x \<in> I \<Longrightarrow> 0 \<le> f x" |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2233 |
shows "(INF i\<in>I. f i + c :: ereal) = (INF i\<in>I. f i) + c" |
63968
4359400adfe7
HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents:
63952
diff
changeset
|
2234 |
proof - |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2235 |
have "(INF i\<in>I. f i) \<noteq> -\<infinity>" |
63968
4359400adfe7
HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents:
63952
diff
changeset
|
2236 |
unfolding INF_eq_minf using assms by (intro exI[of _ 0]) auto |
4359400adfe7
HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents:
63952
diff
changeset
|
2237 |
then show ?thesis |
4359400adfe7
HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents:
63952
diff
changeset
|
2238 |
by (subst continuous_at_Inf_mono[where f="\<lambda>x. x + c"]) |
69861
62e47f06d22c
avoid context-sensitive simp rules whose context-free form (image_comp) is not simp by default
haftmann
parents:
69661
diff
changeset
|
2239 |
(auto simp: mono_def add_mono \<open>I \<noteq> {}\<close> \<open>c \<noteq> -\<infinity>\<close> continuous_at_imp_continuous_at_within |
62e47f06d22c
avoid context-sensitive simp rules whose context-free form (image_comp) is not simp by default
haftmann
parents:
69661
diff
changeset
|
2240 |
continuous_at image_comp) |
63968
4359400adfe7
HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents:
63952
diff
changeset
|
2241 |
qed |
4359400adfe7
HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents:
63952
diff
changeset
|
2242 |
|
4359400adfe7
HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents:
63952
diff
changeset
|
2243 |
lemma INF_ereal_add_right: |
4359400adfe7
HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents:
63952
diff
changeset
|
2244 |
assumes "I \<noteq> {}" "c \<noteq> -\<infinity>" "\<And>x. x \<in> I \<Longrightarrow> 0 \<le> f x" |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2245 |
shows "(INF i\<in>I. c + f i :: ereal) = c + (INF i\<in>I. f i)" |
63968
4359400adfe7
HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents:
63952
diff
changeset
|
2246 |
using INF_ereal_add_left[OF assms] by (simp add: ac_simps) |
4359400adfe7
HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents:
63952
diff
changeset
|
2247 |
|
4359400adfe7
HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents:
63952
diff
changeset
|
2248 |
lemma INF_ereal_add_directed: |
4359400adfe7
HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents:
63952
diff
changeset
|
2249 |
fixes f g :: "'a \<Rightarrow> ereal" |
4359400adfe7
HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents:
63952
diff
changeset
|
2250 |
assumes nonneg: "\<And>i. i \<in> I \<Longrightarrow> 0 \<le> f i" "\<And>i. i \<in> I \<Longrightarrow> 0 \<le> g i" |
4359400adfe7
HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents:
63952
diff
changeset
|
2251 |
assumes directed: "\<And>i j. i \<in> I \<Longrightarrow> j \<in> I \<Longrightarrow> \<exists>k\<in>I. f i + g j \<ge> f k + g k" |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2252 |
shows "(INF i\<in>I. f i + g i) = (INF i\<in>I. f i) + (INF i\<in>I. g i)" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2253 |
proof (cases "I = {}") |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2254 |
case False |
63968
4359400adfe7
HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents:
63952
diff
changeset
|
2255 |
show ?thesis |
4359400adfe7
HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents:
63952
diff
changeset
|
2256 |
proof (rule antisym) |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2257 |
show "(INF i\<in>I. f i) + (INF i\<in>I. g i) \<le> (INF i\<in>I. f i + g i)" |
68752 | 2258 |
by (rule INF_greatest; intro add_mono INF_lower) |
63968
4359400adfe7
HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents:
63952
diff
changeset
|
2259 |
next |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2260 |
have "(INF i\<in>I. f i + g i) \<le> (INF i\<in>I. (INF j\<in>I. f i + g j))" |
63968
4359400adfe7
HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents:
63952
diff
changeset
|
2261 |
using directed by (intro INF_greatest) (blast intro: INF_lower2) |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2262 |
also have "\<dots> = (INF i\<in>I. f i + (INF i\<in>I. g i))" |
69661 | 2263 |
using nonneg \<open>I \<noteq> {}\<close> by (auto simp: INF_ereal_add_right) |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2264 |
also have "\<dots> = (INF i\<in>I. f i) + (INF i\<in>I. g i)" |
63968
4359400adfe7
HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents:
63952
diff
changeset
|
2265 |
using nonneg by (intro INF_ereal_add_left \<open>I \<noteq> {}\<close>) (auto simp: INF_eq_minf intro!: exI[of _ 0]) |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2266 |
finally show "(INF i\<in>I. f i + g i) \<le> (INF i\<in>I. f i) + (INF i\<in>I. g i)" . |
63968
4359400adfe7
HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents:
63952
diff
changeset
|
2267 |
qed |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2268 |
qed (simp add: top_ereal_def) |
63968
4359400adfe7
HOL-Analysis: the image of a negligible set under a Lipschitz continuous function is negligible (based on HOL Light proof ported by L. C. Paulson)
hoelzl
parents:
63952
diff
changeset
|
2269 |
|
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2270 |
lemma INF_ereal_add: |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2271 |
fixes f :: "nat \<Rightarrow> ereal" |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2272 |
assumes "decseq f" "decseq g" |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2273 |
and fin: "\<And>i. f i \<noteq> \<infinity>" "\<And>i. g i \<noteq> \<infinity>" |
69313 | 2274 |
shows "(INF i. f i + g i) = Inf (f ` UNIV) + Inf (g ` UNIV)" |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2275 |
proof - |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2276 |
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
|
2277 |
using assms unfolding INF_less_iff by auto |
81332 | 2278 |
have *: "- ((- a) + (- b)) = a + b" if "a \<noteq> \<infinity>" "b \<noteq> \<infinity>" for a b :: ereal |
2279 |
using that by (cases a b rule: ereal2_cases) auto |
|
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2280 |
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
|
2281 |
by (simp add: fin *) |
69313 | 2282 |
also have "\<dots> = Inf (f ` UNIV) + Inf (g ` UNIV)" |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2283 |
unfolding ereal_INF_uminus_eq |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2284 |
using assms INF_less |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2285 |
by (subst SUP_ereal_add) (auto simp: ereal_SUP_uminus_eq fin *) |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2286 |
finally show ?thesis . |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2287 |
qed |
41978 | 2288 |
|
56212
3253aaf73a01
consolidated theorem names containing INFI and SUPR: have INF and SUP instead uniformly
haftmann
parents:
56166
diff
changeset
|
2289 |
lemma SUP_ereal_add_pos: |
43920 | 2290 |
fixes f g :: "nat \<Rightarrow> ereal" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2291 |
assumes "incseq f" "incseq g" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2292 |
and "\<And>i. 0 \<le> f i" "\<And>i. 0 \<le> g i" |
69313 | 2293 |
shows "(SUP i. f i + g i) = Sup (f ` UNIV) + Sup (g ` UNIV)" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2294 |
by (simp add: SUP_ereal_add assms) |
41979
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
2295 |
|
64267 | 2296 |
lemma SUP_ereal_sum: |
43920 | 2297 |
fixes f g :: "'a \<Rightarrow> nat \<Rightarrow> ereal" |
53873 | 2298 |
assumes "\<And>n. n \<in> A \<Longrightarrow> incseq (f n)" |
2299 |
and pos: "\<And>n i. n \<in> A \<Longrightarrow> 0 \<le> f n i" |
|
69313 | 2300 |
shows "(SUP i. \<Sum>n\<in>A. f n i) = (\<Sum>n\<in>A. Sup ((f n) ` UNIV))" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2301 |
using assms |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2302 |
by (induction A rule: infinite_finite_induct) (auto simp: incseq_sumI2 sum_nonneg SUP_ereal_add_pos) |
41979
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
2303 |
|
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2304 |
lemma SUP_ereal_mult_left: |
59000 | 2305 |
fixes f :: "'a \<Rightarrow> ereal" |
2306 |
assumes "I \<noteq> {}" |
|
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2307 |
assumes f: "\<And>i. i \<in> I \<Longrightarrow> 0 \<le> f i" and c: "0 \<le> c" |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2308 |
shows "(SUP i\<in>I. c * f i) = c * (SUP i\<in>I. f i)" |
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2309 |
proof (cases "(SUP i \<in> I. f i) = 0") |
63540 | 2310 |
case True |
2311 |
then have "\<And>i. i \<in> I \<Longrightarrow> f i = 0" |
|
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2312 |
by (metis SUP_upper f antisym) |
63540 | 2313 |
with True show ?thesis |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2314 |
by simp |
59000 | 2315 |
next |
63540 | 2316 |
case False |
2317 |
then show ?thesis |
|
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2318 |
by (subst continuous_at_Sup_mono[where f="\<lambda>x. c * x"]) |
69861
62e47f06d22c
avoid context-sensitive simp rules whose context-free form (image_comp) is not simp by default
haftmann
parents:
69661
diff
changeset
|
2319 |
(auto simp: mono_def continuous_at continuous_at_imp_continuous_at_within \<open>I \<noteq> {}\<close> image_comp |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2320 |
intro!: ereal_mult_left_mono c) |
59000 | 2321 |
qed |
2322 |
||
61738
c4f6031f1310
New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents:
61631
diff
changeset
|
2323 |
lemma countable_approach: |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2324 |
fixes x :: ereal |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2325 |
assumes "x \<noteq> -\<infinity>" |
61969 | 2326 |
shows "\<exists>f. incseq f \<and> (\<forall>i::nat. f i < x) \<and> (f \<longlonglongrightarrow> x)" |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2327 |
proof (cases x) |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2328 |
case (real r) |
61969 | 2329 |
moreover have "(\<lambda>n. r - inverse (real (Suc n))) \<longlonglongrightarrow> r - 0" |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2330 |
by (intro tendsto_intros LIMSEQ_inverse_real_of_nat) |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2331 |
ultimately show ?thesis |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2332 |
by (intro exI[of _ "\<lambda>n. x - inverse (Suc n)"]) (auto simp: incseq_def) |
61738
c4f6031f1310
New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents:
61631
diff
changeset
|
2333 |
next |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2334 |
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
|
2335 |
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
|
2336 |
qed (simp add: assms) |
59000 | 2337 |
|
56212
3253aaf73a01
consolidated theorem names containing INFI and SUPR: have INF and SUP instead uniformly
haftmann
parents:
56166
diff
changeset
|
2338 |
lemma Sup_countable_SUP: |
41979
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
2339 |
assumes "A \<noteq> {}" |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2340 |
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
|
2341 |
proof cases |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2342 |
assume "Sup A = -\<infinity>" |
60500 | 2343 |
with \<open>A \<noteq> {}\<close> have "A = {-\<infinity>}" |
53873 | 2344 |
by (auto simp: Sup_eq_MInfty) |
2345 |
then show ?thesis |
|
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2346 |
by (auto intro!: exI[of _ "\<lambda>_. -\<infinity>"] simp: bot_ereal_def) |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2347 |
next |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2348 |
assume "Sup A \<noteq> -\<infinity>" |
63060 | 2349 |
then obtain l where "incseq l" and l: "l i < Sup A" and l_Sup: "l \<longlonglongrightarrow> Sup A" for i :: nat |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2350 |
by (auto dest: countable_approach) |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2351 |
|
74325 | 2352 |
have "\<exists>f. \<forall>n. (f n \<in> A \<and> l n \<le> f n) \<and> (f n \<le> f (Suc n))" (is "\<exists>f. ?P f") |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2353 |
proof (rule dependent_nat_choice) |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2354 |
show "\<exists>x. x \<in> A \<and> l 0 \<le> x" |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2355 |
using l[of 0] by (auto simp: less_Sup_iff) |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2356 |
next |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2357 |
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
|
2358 |
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
|
2359 |
by (auto simp: less_Sup_iff) |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2360 |
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
|
2361 |
by (auto intro!: exI[of _ "max x y"] split: split_max) |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2362 |
qed |
74325 | 2363 |
then obtain f where f: "?P f" .. |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2364 |
then have "range f \<subseteq> A" "incseq f" |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2365 |
by (auto simp: incseq_Suc_iff) |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2366 |
then have "(SUP i. f i) = Sup A" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2367 |
by (meson LIMSEQ_SUP LIMSEQ_le Sup_subset_mono f l_Sup |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2368 |
order_class.order_eq_iff) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2369 |
then show ?thesis |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2370 |
by (metis \<open>incseq f\<close> \<open>range f \<subseteq> A\<close>) |
41979
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
2371 |
qed |
b10ec1f5e9d5
lemmas about addition, SUP on countable sets and infinite sums for extreal
hoelzl
parents:
41978
diff
changeset
|
2372 |
|
63940
0d82c4c94014
prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents:
63918
diff
changeset
|
2373 |
lemma Inf_countable_INF: |
0d82c4c94014
prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents:
63918
diff
changeset
|
2374 |
assumes "A \<noteq> {}" shows "\<exists>f::nat \<Rightarrow> ereal. decseq f \<and> range f \<subseteq> A \<and> Inf A = (INF i. f i)" |
0d82c4c94014
prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents:
63918
diff
changeset
|
2375 |
proof - |
0d82c4c94014
prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents:
63918
diff
changeset
|
2376 |
obtain f where "incseq f" "range f \<subseteq> uminus`A" "Sup (uminus`A) = (SUP i. f i)" |
0d82c4c94014
prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents:
63918
diff
changeset
|
2377 |
using Sup_countable_SUP[of "uminus ` A"] \<open>A \<noteq> {}\<close> by auto |
0d82c4c94014
prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents:
63918
diff
changeset
|
2378 |
then show ?thesis |
0d82c4c94014
prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents:
63918
diff
changeset
|
2379 |
by (intro exI[of _ "\<lambda>x. - f x"]) |
0d82c4c94014
prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents:
63918
diff
changeset
|
2380 |
(auto simp: ereal_Sup_uminus_image_eq ereal_INF_uminus_eq eq_commute[of "- _"]) |
0d82c4c94014
prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents:
63918
diff
changeset
|
2381 |
qed |
0d82c4c94014
prove HK-integrable implies Lebesgue measurable; prove HK-integral equals Lebesgue integral for nonneg functions
hoelzl
parents:
63918
diff
changeset
|
2382 |
|
56212
3253aaf73a01
consolidated theorem names containing INFI and SUPR: have INF and SUP instead uniformly
haftmann
parents:
56166
diff
changeset
|
2383 |
lemma SUP_countable_SUP: |
69313 | 2384 |
"A \<noteq> {} \<Longrightarrow> \<exists>f::nat \<Rightarrow> ereal. range f \<subseteq> g`A \<and> Sup (g ` A) = Sup (f ` UNIV)" |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2385 |
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
|
2386 |
|
69593 | 2387 |
subsection "Relation to \<^typ>\<open>enat\<close>" |
45934 | 2388 |
|
2389 |
definition "ereal_of_enat n = (case n of enat n \<Rightarrow> ereal (real n) | \<infinity> \<Rightarrow> \<infinity>)" |
|
2390 |
||
2391 |
declare [[coercion "ereal_of_enat :: enat \<Rightarrow> ereal"]] |
|
2392 |
declare [[coercion "(\<lambda>n. ereal (real n)) :: nat \<Rightarrow> ereal"]] |
|
2393 |
||
2394 |
lemma ereal_of_enat_simps[simp]: |
|
2395 |
"ereal_of_enat (enat n) = ereal n" |
|
2396 |
"ereal_of_enat \<infinity> = \<infinity>" |
|
2397 |
by (simp_all add: ereal_of_enat_def) |
|
2398 |
||
53873 | 2399 |
lemma ereal_of_enat_le_iff[simp]: "ereal_of_enat m \<le> ereal_of_enat n \<longleftrightarrow> m \<le> n" |
2400 |
by (cases m n rule: enat2_cases) auto |
|
45934 | 2401 |
|
53873 | 2402 |
lemma ereal_of_enat_less_iff[simp]: "ereal_of_enat m < ereal_of_enat n \<longleftrightarrow> m < n" |
2403 |
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
|
2404 |
|
53873 | 2405 |
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
|
2406 |
by (cases n) (auto) |
45934 | 2407 |
|
53873 | 2408 |
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
|
2409 |
by (cases n) auto |
50819
5601ae592679
added some ereal_of_enat_* lemmas (from $AFP/thys/Girth_Chromatic)
noschinl
parents:
50104
diff
changeset
|
2410 |
|
53873 | 2411 |
lemma ereal_of_enat_ge_zero_cancel_iff[simp]: "0 \<le> ereal_of_enat n \<longleftrightarrow> 0 \<le> n" |
68406 | 2412 |
by (cases n) (auto simp flip: enat_0) |
45934 | 2413 |
|
53873 | 2414 |
lemma ereal_of_enat_gt_zero_cancel_iff[simp]: "0 < ereal_of_enat n \<longleftrightarrow> 0 < n" |
68406 | 2415 |
by (cases n) (auto simp flip: enat_0) |
45934 | 2416 |
|
53873 | 2417 |
lemma ereal_of_enat_zero[simp]: "ereal_of_enat 0 = 0" |
68406 | 2418 |
by (auto simp flip: enat_0) |
45934 | 2419 |
|
53873 | 2420 |
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
|
2421 |
by (cases n) auto |
5601ae592679
added some ereal_of_enat_* lemmas (from $AFP/thys/Girth_Chromatic)
noschinl
parents:
50104
diff
changeset
|
2422 |
|
53873 | 2423 |
lemma ereal_of_enat_add: "ereal_of_enat (m + n) = ereal_of_enat m + ereal_of_enat n" |
2424 |
by (cases m n rule: enat2_cases) auto |
|
45934 | 2425 |
|
2426 |
lemma ereal_of_enat_sub: |
|
53873 | 2427 |
assumes "n \<le> m" |
2428 |
shows "ereal_of_enat (m - n) = ereal_of_enat m - ereal_of_enat n " |
|
2429 |
using assms by (cases m n rule: enat2_cases) auto |
|
45934 | 2430 |
|
2431 |
lemma ereal_of_enat_mult: |
|
2432 |
"ereal_of_enat (m * n) = ereal_of_enat m * ereal_of_enat n" |
|
53873 | 2433 |
by (cases m n rule: enat2_cases) auto |
45934 | 2434 |
|
2435 |
lemmas ereal_of_enat_pushin = ereal_of_enat_add ereal_of_enat_sub ereal_of_enat_mult |
|
2436 |
lemmas ereal_of_enat_pushout = ereal_of_enat_pushin[symmetric] |
|
2437 |
||
61631
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
2438 |
lemma ereal_of_enat_nonneg: "ereal_of_enat n \<ge> 0" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2439 |
by simp |
61631
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
2440 |
|
60637 | 2441 |
lemma ereal_of_enat_Sup: |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2442 |
assumes "A \<noteq> {}" shows "ereal_of_enat (Sup A) = (SUP a \<in> A. ereal_of_enat a)" |
60637 | 2443 |
proof (intro antisym mono_Sup) |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2444 |
show "ereal_of_enat (Sup A) \<le> (SUP a \<in> A. ereal_of_enat a)" |
60637 | 2445 |
proof cases |
2446 |
assume "finite A" |
|
61188 | 2447 |
with \<open>A \<noteq> {}\<close> obtain a where "a \<in> A" "ereal_of_enat (Sup A) = ereal_of_enat a" |
60637 | 2448 |
using Max_in[of A] by (auto simp: Sup_enat_def simp del: Max_in) |
2449 |
then show ?thesis |
|
2450 |
by (auto intro: SUP_upper) |
|
2451 |
next |
|
2452 |
assume "\<not> finite A" |
|
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2453 |
have [simp]: "(SUP a \<in> A. ereal_of_enat a) = top" |
60637 | 2454 |
unfolding SUP_eq_top_iff |
2455 |
proof safe |
|
2456 |
fix x :: ereal assume "x < top" |
|
2457 |
then obtain n :: nat where "x < n" |
|
2458 |
using less_PInf_Ex_of_nat top_ereal_def by auto |
|
2459 |
obtain a where "a \<in> A - enat ` {.. n}" |
|
61188 | 2460 |
by (metis \<open>\<not> finite A\<close> all_not_in_conv finite_Diff2 finite_atMost finite_imageI finite.emptyI) |
60637 | 2461 |
then have "a \<in> A" "ereal n \<le> ereal_of_enat a" |
2462 |
by (auto simp: image_iff Ball_def) |
|
2463 |
(metis enat_iless enat_ord_simps(1) ereal_of_enat_less_iff ereal_of_enat_simps(1) less_le not_less) |
|
61188 | 2464 |
with \<open>x < n\<close> show "\<exists>i\<in>A. x < ereal_of_enat i" |
60637 | 2465 |
by (auto intro!: bexI[of _ a]) |
2466 |
qed |
|
2467 |
show ?thesis |
|
2468 |
by simp |
|
2469 |
qed |
|
2470 |
qed (simp add: mono_def) |
|
2471 |
||
2472 |
lemma ereal_of_enat_SUP: |
|
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
2473 |
"A \<noteq> {} \<Longrightarrow> ereal_of_enat (SUP a\<in>A. f a) = (SUP a \<in> A. ereal_of_enat (f a))" |
69861
62e47f06d22c
avoid context-sensitive simp rules whose context-free form (image_comp) is not simp by default
haftmann
parents:
69661
diff
changeset
|
2474 |
by (simp add: ereal_of_enat_Sup image_comp) |
62e47f06d22c
avoid context-sensitive simp rules whose context-free form (image_comp) is not simp by default
haftmann
parents:
69661
diff
changeset
|
2475 |
|
45934 | 2476 |
|
69593 | 2477 |
subsection "Limits on \<^typ>\<open>ereal\<close>" |
41973 | 2478 |
|
43920 | 2479 |
lemma open_PInfty: "open A \<Longrightarrow> \<infinity> \<in> A \<Longrightarrow> (\<exists>x. {ereal x<..} \<subseteq> A)" |
51000 | 2480 |
unfolding open_ereal_generated |
2481 |
proof (induct rule: generate_topology.induct) |
|
2482 |
case (Int A B) |
|
53374
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents:
53216
diff
changeset
|
2483 |
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
|
2484 |
by auto |
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents:
53216
diff
changeset
|
2485 |
with Int show ?case |
51000 | 2486 |
by (intro exI[of _ "max x z"]) fastforce |
2487 |
next |
|
53873 | 2488 |
case (Basis S) |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2489 |
moreover have "x \<noteq> \<infinity> \<Longrightarrow> \<exists>t. x \<le> ereal t" for x |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2490 |
by (cases x) auto |
51000 | 2491 |
ultimately show ?case |
2492 |
by (auto split: ereal.split) |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2493 |
qed (fastforce simp: vimage_Union)+ |
41973 | 2494 |
|
43920 | 2495 |
lemma open_MInfty: "open A \<Longrightarrow> -\<infinity> \<in> A \<Longrightarrow> (\<exists>x. {..<ereal x} \<subseteq> A)" |
51000 | 2496 |
unfolding open_ereal_generated |
2497 |
proof (induct rule: generate_topology.induct) |
|
2498 |
case (Int A B) |
|
53374
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents:
53216
diff
changeset
|
2499 |
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
|
2500 |
by auto |
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents:
53216
diff
changeset
|
2501 |
with Int show ?case |
51000 | 2502 |
by (intro exI[of _ "min x z"]) fastforce |
2503 |
next |
|
53873 | 2504 |
case (Basis S) |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2505 |
moreover have "x \<noteq> -\<infinity> \<Longrightarrow> \<exists>t. ereal t \<le> x" for x |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2506 |
by (cases x) auto |
51000 | 2507 |
ultimately show ?case |
2508 |
by (auto split: ereal.split) |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2509 |
qed (fastforce simp: vimage_Union)+ |
51000 | 2510 |
|
2511 |
lemma open_ereal_vimage: "open S \<Longrightarrow> open (ereal -` S)" |
|
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2512 |
by (intro open_vimage continuous_intros) |
51000 | 2513 |
|
2514 |
lemma open_ereal: "open S \<Longrightarrow> open (ereal ` S)" |
|
2515 |
unfolding open_generated_order[where 'a=real] |
|
2516 |
proof (induct rule: generate_topology.induct) |
|
2517 |
case (Basis S) |
|
72236 | 2518 |
moreover have "\<And>x. ereal ` {..< x} = { -\<infinity> <..< ereal x }" |
2519 |
using ereal_less_ereal_Ex by auto |
|
2520 |
moreover have "\<And>x. ereal ` {x <..} = { ereal x <..< \<infinity> }" |
|
2521 |
using less_ereal.elims(2) by fastforce |
|
51000 | 2522 |
ultimately show ?case |
72236 | 2523 |
by auto |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2524 |
qed (auto simp: image_Union image_Int) |
51000 | 2525 |
|
67685
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
2526 |
lemma open_image_real_of_ereal: |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
2527 |
fixes X::"ereal set" |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
2528 |
assumes "open X" |
72236 | 2529 |
assumes infty: "\<infinity> \<notin> X" "-\<infinity> \<notin> X" |
67685
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
2530 |
shows "open (real_of_ereal ` X)" |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
2531 |
proof - |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
2532 |
have "real_of_ereal ` X = ereal -` X" |
72236 | 2533 |
using infty ereal_real by (force simp: set_eq_iff) |
67685
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
2534 |
thus ?thesis |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
2535 |
by (auto intro!: open_ereal_vimage assms) |
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents:
67452
diff
changeset
|
2536 |
qed |
56993
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents:
56927
diff
changeset
|
2537 |
|
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents:
56927
diff
changeset
|
2538 |
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
|
2539 |
fixes x :: ereal |
61973 | 2540 |
assumes "\<bar>x\<bar> \<noteq> \<infinity>" "(f \<longlongrightarrow> x) F" |
56993
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents:
56927
diff
changeset
|
2541 |
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
|
2542 |
proof - |
61973 | 2543 |
have "(f \<longlongrightarrow> ereal (real_of_ereal x)) F" |
56993
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents:
56927
diff
changeset
|
2544 |
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
|
2545 |
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
|
2546 |
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
|
2547 |
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
|
2548 |
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
|
2549 |
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
|
2550 |
qed |
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents:
56927
diff
changeset
|
2551 |
|
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents:
56927
diff
changeset
|
2552 |
|
53873 | 2553 |
lemma open_ereal_def: |
2554 |
"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 | 2555 |
(is "open A \<longleftrightarrow> ?rhs") |
2556 |
proof |
|
53873 | 2557 |
assume "open A" |
2558 |
then show ?rhs |
|
51000 | 2559 |
using open_PInfty open_MInfty open_ereal_vimage by auto |
2560 |
next |
|
2561 |
assume "?rhs" |
|
2562 |
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" |
|
2563 |
by auto |
|
2564 |
have *: "A = ereal ` (ereal -` A) \<union> (if \<infinity> \<in> A then {ereal x<..} else {}) \<union> (if -\<infinity> \<in> A then {..< ereal y} else {})" |
|
2565 |
using A(2,3) by auto |
|
2566 |
from open_ereal[OF A(1)] show "open A" |
|
2567 |
by (subst *) (auto simp: open_Un) |
|
2568 |
qed |
|
41973 | 2569 |
|
53873 | 2570 |
lemma open_PInfty2: |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2571 |
assumes "open A" and "\<infinity> \<in> A" |
53873 | 2572 |
obtains x where "{ereal x<..} \<subseteq> A" |
41973 | 2573 |
using open_PInfty[OF assms] by auto |
2574 |
||
53873 | 2575 |
lemma open_MInfty2: |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2576 |
assumes "open A" and "-\<infinity> \<in> A" |
53873 | 2577 |
obtains x where "{..<ereal x} \<subseteq> A" |
41973 | 2578 |
using open_MInfty[OF assms] by auto |
2579 |
||
53873 | 2580 |
lemma ereal_openE: |
2581 |
assumes "open A" |
|
2582 |
obtains x y where "open (ereal -` A)" |
|
2583 |
and "\<infinity> \<in> A \<Longrightarrow> {ereal x<..} \<subseteq> A" |
|
2584 |
and "-\<infinity> \<in> A \<Longrightarrow> {..<ereal y} \<subseteq> A" |
|
43920 | 2585 |
using assms open_ereal_def by auto |
41973 | 2586 |
|
51000 | 2587 |
lemmas open_ereal_lessThan = open_lessThan[where 'a=ereal] |
2588 |
lemmas open_ereal_greaterThan = open_greaterThan[where 'a=ereal] |
|
2589 |
lemmas ereal_open_greaterThanLessThan = open_greaterThanLessThan[where 'a=ereal] |
|
2590 |
lemmas closed_ereal_atLeast = closed_atLeast[where 'a=ereal] |
|
2591 |
lemmas closed_ereal_atMost = closed_atMost[where 'a=ereal] |
|
2592 |
lemmas closed_ereal_atLeastAtMost = closed_atLeastAtMost[where 'a=ereal] |
|
2593 |
lemmas closed_ereal_singleton = closed_singleton[where 'a=ereal] |
|
53873 | 2594 |
|
43920 | 2595 |
lemma ereal_open_cont_interval: |
43923 | 2596 |
fixes S :: "ereal set" |
53873 | 2597 |
assumes "open S" |
2598 |
and "x \<in> S" |
|
2599 |
and "\<bar>x\<bar> \<noteq> \<infinity>" |
|
2600 |
obtains e where "e > 0" and "{x-e <..< x+e} \<subseteq> S" |
|
2601 |
proof - |
|
60500 | 2602 |
from \<open>open S\<close> |
53873 | 2603 |
have "open (ereal -` S)" |
2604 |
by (rule ereal_openE) |
|
63060 | 2605 |
then obtain e where "e > 0" and e: "dist y (real_of_ereal x) < e \<Longrightarrow> ereal y \<in> S" for y |
41980
28b51effc5ed
split Extended_Reals into parts for Library and Multivariate_Analysis
hoelzl
parents:
41979
diff
changeset
|
2606 |
using assms unfolding open_dist by force |
41975 | 2607 |
show thesis |
2608 |
proof (intro that subsetI) |
|
53873 | 2609 |
show "0 < ereal e" |
60500 | 2610 |
using \<open>0 < e\<close> by auto |
53873 | 2611 |
fix y |
2612 |
assume "y \<in> {x - ereal e<..<x + ereal e}" |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
2613 |
with assms obtain t where "y = ereal t" "dist t (real_of_ereal x) < e" |
53873 | 2614 |
by (cases y) (auto simp: dist_real_def) |
2615 |
then show "y \<in> S" |
|
2616 |
using e[of t] by auto |
|
41975 | 2617 |
qed |
41973 | 2618 |
qed |
2619 |
||
43920 | 2620 |
lemma ereal_open_cont_interval2: |
43923 | 2621 |
fixes S :: "ereal set" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2622 |
assumes "open S" and "x \<in> S" and "\<bar>x\<bar> \<noteq> \<infinity>" |
53873 | 2623 |
obtains a b where "a < x" and "x < b" and "{a <..< b} \<subseteq> S" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2624 |
by (meson assms ereal_between ereal_open_cont_interval) |
41973 | 2625 |
|
60500 | 2626 |
subsubsection \<open>Convergent sequences\<close> |
41973 | 2627 |
|
43920 | 2628 |
lemma lim_real_of_ereal[simp]: |
61973 | 2629 |
assumes lim: "(f \<longlongrightarrow> ereal x) net" |
2630 |
shows "((\<lambda>x. real_of_ereal (f x)) \<longlongrightarrow> x) net" |
|
41973 | 2631 |
proof (intro topological_tendstoI) |
53873 | 2632 |
fix S |
2633 |
assume "open S" and "x \<in> S" |
|
43920 | 2634 |
then have S: "open S" "ereal x \<in> ereal ` S" |
41973 | 2635 |
by (simp_all add: inj_image_mem_iff) |
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
2636 |
show "eventually (\<lambda>x. real_of_ereal (f x) \<in> S) net" |
61810 | 2637 |
by (auto intro: eventually_mono [OF lim[THEN topological_tendstoD, OF open_ereal, OF S]]) |
41973 | 2638 |
qed |
2639 |
||
61973 | 2640 |
lemma lim_ereal[simp]: "((\<lambda>n. ereal (f n)) \<longlongrightarrow> ereal x) net \<longleftrightarrow> (f \<longlongrightarrow> x) net" |
59452
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2641 |
by (auto dest!: lim_real_of_ereal) |
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
hoelzl
parents:
59425
diff
changeset
|
2642 |
|
61880
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents:
61810
diff
changeset
|
2643 |
lemma convergent_real_imp_convergent_ereal: |
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents:
61810
diff
changeset
|
2644 |
assumes "convergent a" |
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents:
61810
diff
changeset
|
2645 |
shows "convergent (\<lambda>n. ereal (a n))" and "lim (\<lambda>n. ereal (a n)) = ereal (lim a)" |
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents:
61810
diff
changeset
|
2646 |
proof - |
61969 | 2647 |
from assms obtain L where L: "a \<longlonglongrightarrow> L" unfolding convergent_def .. |
2648 |
hence lim: "(\<lambda>n. ereal (a n)) \<longlonglongrightarrow> ereal L" using lim_ereal by auto |
|
61880
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents:
61810
diff
changeset
|
2649 |
thus "convergent (\<lambda>n. ereal (a n))" unfolding convergent_def .. |
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents:
61810
diff
changeset
|
2650 |
thus "lim (\<lambda>n. ereal (a n)) = ereal (lim a)" using lim L limI by metis |
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents:
61810
diff
changeset
|
2651 |
qed |
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents:
61810
diff
changeset
|
2652 |
|
61973 | 2653 |
lemma tendsto_PInfty: "(f \<longlongrightarrow> \<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
|
2654 |
proof - |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2655 |
{ fix l :: ereal |
53873 | 2656 |
assume "\<forall>r. eventually (\<lambda>x. ereal r < f x) F" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2657 |
from this[THEN spec, of "real_of_ereal l"] |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2658 |
have "l \<noteq> \<infinity> \<Longrightarrow> eventually (\<lambda>x. l < f x) F" |
61810 | 2659 |
by (cases l) (auto elim: eventually_mono) |
53873 | 2660 |
} |
51022
78de6c7e8a58
replace open_interval with the rule open_tendstoI; generalize Liminf/Limsup rules
hoelzl
parents:
51000
diff
changeset
|
2661 |
then show ?thesis |
78de6c7e8a58
replace open_interval with the rule open_tendstoI; generalize Liminf/Limsup rules
hoelzl
parents:
51000
diff
changeset
|
2662 |
by (auto simp: order_tendsto_iff) |
41973 | 2663 |
qed |
2664 |
||
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2665 |
lemma tendsto_PInfty': "(f \<longlongrightarrow> \<infinity>) F = (\<forall>r>c. eventually (\<lambda>x. ereal r < f x) F)" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2666 |
proof - |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2667 |
{ fix r :: real |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2668 |
assume "\<forall>r>c. eventually (\<lambda>x. ereal r < f x) F" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2669 |
then have "eventually (\<lambda>x. ereal r < f x) F" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2670 |
if "r > c" for r using that by blast |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2671 |
then have "eventually (\<lambda>x. ereal r < f x) F" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2672 |
by (smt (verit, del_insts) ereal_less_le eventually_mono gt_ex) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2673 |
} then show ?thesis |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2674 |
using tendsto_PInfty by blast |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2675 |
qed |
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2676 |
|
57025 | 2677 |
lemma tendsto_PInfty_eq_at_top: |
61973 | 2678 |
"((\<lambda>z. ereal (f z)) \<longlongrightarrow> \<infinity>) F \<longleftrightarrow> (LIM z F. f z :> at_top)" |
57025 | 2679 |
unfolding tendsto_PInfty filterlim_at_top_dense by simp |
2680 |
||
61973 | 2681 |
lemma tendsto_MInfty: "(f \<longlongrightarrow> -\<infinity>) F \<longleftrightarrow> (\<forall>r. eventually (\<lambda>x. f x < ereal r) F)" |
51000 | 2682 |
unfolding tendsto_def |
2683 |
proof safe |
|
53381 | 2684 |
fix S :: "ereal set" |
2685 |
assume "open S" "-\<infinity> \<in> S" |
|
2686 |
from open_MInfty[OF this] obtain B where "{..<ereal B} \<subseteq> S" .. |
|
51000 | 2687 |
moreover |
2688 |
assume "\<forall>r::real. eventually (\<lambda>z. f z < r) F" |
|
53873 | 2689 |
then have "eventually (\<lambda>z. f z \<in> {..< B}) F" |
2690 |
by auto |
|
2691 |
ultimately show "eventually (\<lambda>z. f z \<in> S) F" |
|
61810 | 2692 |
by (auto elim!: eventually_mono) |
51000 | 2693 |
next |
53873 | 2694 |
fix x |
2695 |
assume "\<forall>S. open S \<longrightarrow> -\<infinity> \<in> S \<longrightarrow> eventually (\<lambda>x. f x \<in> S) F" |
|
2696 |
from this[rule_format, of "{..< ereal x}"] show "eventually (\<lambda>y. f y < ereal x) F" |
|
2697 |
by auto |
|
41973 | 2698 |
qed |
2699 |
||
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2700 |
lemma tendsto_MInfty': "(f \<longlongrightarrow> -\<infinity>) F = (\<forall>r<c. eventually (\<lambda>x. ereal r > f x) F)" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2701 |
proof (subst tendsto_MInfty, intro iffI allI impI) |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2702 |
assume A: "\<forall>r<c. eventually (\<lambda>x. ereal r > f x) F" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2703 |
fix r :: real |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2704 |
from A have A: "eventually (\<lambda>x. ereal r > f x) F" if "r < c" for r using that by blast |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2705 |
show "eventually (\<lambda>x. ereal r > f x) F" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2706 |
proof (cases "r < c") |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2707 |
case False |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2708 |
hence B: "ereal r \<ge> ereal (c - 1)" by simp |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2709 |
have "c > c - 1" by simp |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2710 |
from A[OF this] show "eventually (\<lambda>x. ereal r > f x) F" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2711 |
by eventually_elim (erule less_le_trans[OF _ B]) |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2712 |
qed (simp add: A) |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2713 |
qed simp |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2714 |
|
61969 | 2715 |
lemma Lim_PInfty: "f \<longlonglongrightarrow> \<infinity> \<longleftrightarrow> (\<forall>B. \<exists>N. \<forall>n\<ge>N. f n \<ge> ereal B)" |
51000 | 2716 |
unfolding tendsto_PInfty eventually_sequentially |
2717 |
proof safe |
|
53873 | 2718 |
fix r |
2719 |
assume "\<forall>r. \<exists>N. \<forall>n\<ge>N. ereal r \<le> f n" |
|
2720 |
then obtain N where "\<forall>n\<ge>N. ereal (r + 1) \<le> f n" |
|
2721 |
by blast |
|
2722 |
moreover have "ereal r < ereal (r + 1)" |
|
2723 |
by auto |
|
51000 | 2724 |
ultimately show "\<exists>N. \<forall>n\<ge>N. ereal r < f n" |
2725 |
by (blast intro: less_le_trans) |
|
2726 |
qed (blast intro: less_imp_le) |
|
41973 | 2727 |
|
61969 | 2728 |
lemma Lim_MInfty: "f \<longlonglongrightarrow> -\<infinity> \<longleftrightarrow> (\<forall>B. \<exists>N. \<forall>n\<ge>N. ereal B \<ge> f n)" |
51000 | 2729 |
unfolding tendsto_MInfty eventually_sequentially |
2730 |
proof safe |
|
53873 | 2731 |
fix r |
2732 |
assume "\<forall>r. \<exists>N. \<forall>n\<ge>N. f n \<le> ereal r" |
|
2733 |
then obtain N where "\<forall>n\<ge>N. f n \<le> ereal (r - 1)" |
|
2734 |
by blast |
|
2735 |
moreover have "ereal (r - 1) < ereal r" |
|
2736 |
by auto |
|
51000 | 2737 |
ultimately show "\<exists>N. \<forall>n\<ge>N. f n < ereal r" |
2738 |
by (blast intro: le_less_trans) |
|
2739 |
qed (blast intro: less_imp_le) |
|
41973 | 2740 |
|
61969 | 2741 |
lemma Lim_bounded_PInfty: "f \<longlonglongrightarrow> l \<Longrightarrow> (\<And>n. f n \<le> ereal B) \<Longrightarrow> l \<noteq> \<infinity>" |
51000 | 2742 |
using LIMSEQ_le_const2[of f l "ereal B"] by auto |
41973 | 2743 |
|
61969 | 2744 |
lemma Lim_bounded_MInfty: "f \<longlonglongrightarrow> l \<Longrightarrow> (\<And>n. ereal B \<le> f n) \<Longrightarrow> l \<noteq> -\<infinity>" |
51000 | 2745 |
using LIMSEQ_le_const[of f l "ereal B"] by auto |
41973 | 2746 |
|
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2747 |
lemma tendsto_zero_erealI: |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2748 |
assumes "\<And>e. e > 0 \<Longrightarrow> eventually (\<lambda>x. \<bar>f x\<bar> < ereal e) F" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2749 |
shows "(f \<longlongrightarrow> 0) F" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2750 |
proof (subst filterlim_cong[OF refl refl]) |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2751 |
from assms[OF zero_less_one] show "eventually (\<lambda>x. f x = ereal (real_of_ereal (f x))) F" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2752 |
by eventually_elim (auto simp: ereal_real) |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2753 |
hence "eventually (\<lambda>x. abs (real_of_ereal (f x)) < e) F" if "e > 0" for e using assms[OF that] |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2754 |
by eventually_elim (simp add: real_less_ereal_iff that) |
62369 | 2755 |
hence "((\<lambda>x. real_of_ereal (f x)) \<longlongrightarrow> 0) F" unfolding tendsto_iff |
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2756 |
by (auto simp: tendsto_iff dist_real_def) |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2757 |
thus "((\<lambda>x. ereal (real_of_ereal (f x))) \<longlongrightarrow> 0) F" by (simp add: zero_ereal_def) |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2758 |
qed |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2759 |
|
61969 | 2760 |
lemma Lim_bounded_PInfty2: "f \<longlonglongrightarrow> l \<Longrightarrow> \<forall>n\<ge>N. f n \<le> ereal B \<Longrightarrow> l \<noteq> \<infinity>" |
51000 | 2761 |
using LIMSEQ_le_const2[of f l "ereal B"] by fastforce |
41973 | 2762 |
|
43920 | 2763 |
lemma real_of_ereal_mult[simp]: |
53873 | 2764 |
fixes a b :: ereal |
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
2765 |
shows "real_of_ereal (a * b) = real_of_ereal a * real_of_ereal b" |
43920 | 2766 |
by (cases rule: ereal2_cases[of a b]) auto |
41973 | 2767 |
|
43920 | 2768 |
lemma real_of_ereal_eq_0: |
53873 | 2769 |
fixes x :: ereal |
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
2770 |
shows "real_of_ereal x = 0 \<longleftrightarrow> x = \<infinity> \<or> x = -\<infinity> \<or> x = 0" |
41973 | 2771 |
by (cases x) auto |
2772 |
||
43920 | 2773 |
lemma tendsto_ereal_realD: |
2774 |
fixes f :: "'a \<Rightarrow> ereal" |
|
53873 | 2775 |
assumes "x \<noteq> 0" |
61973 | 2776 |
and tendsto: "((\<lambda>x. ereal (real_of_ereal (f x))) \<longlongrightarrow> x) net" |
2777 |
shows "(f \<longlongrightarrow> x) net" |
|
41973 | 2778 |
proof (intro topological_tendstoI) |
53873 | 2779 |
fix S |
2780 |
assume S: "open S" "x \<in> S" |
|
60500 | 2781 |
with \<open>x \<noteq> 0\<close> have "open (S - {0})" "x \<in> S - {0}" |
53873 | 2782 |
by auto |
41973 | 2783 |
from tendsto[THEN topological_tendstoD, OF this] |
2784 |
show "eventually (\<lambda>x. f x \<in> S) net" |
|
44142 | 2785 |
by (rule eventually_rev_mp) (auto simp: ereal_real) |
41973 | 2786 |
qed |
2787 |
||
43920 | 2788 |
lemma tendsto_ereal_realI: |
2789 |
fixes f :: "'a \<Rightarrow> ereal" |
|
61973 | 2790 |
assumes x: "\<bar>x\<bar> \<noteq> \<infinity>" and tendsto: "(f \<longlongrightarrow> x) net" |
2791 |
shows "((\<lambda>x. ereal (real_of_ereal (f x))) \<longlongrightarrow> x) net" |
|
41973 | 2792 |
proof (intro topological_tendstoI) |
53873 | 2793 |
fix S |
2794 |
assume "open S" and "x \<in> S" |
|
2795 |
with x have "open (S - {\<infinity>, -\<infinity>})" "x \<in> S - {\<infinity>, -\<infinity>}" |
|
2796 |
by auto |
|
41973 | 2797 |
from tendsto[THEN topological_tendstoD, OF this] |
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
2798 |
show "eventually (\<lambda>x. ereal (real_of_ereal (f x)) \<in> S) net" |
61810 | 2799 |
by (elim eventually_mono) (auto simp: ereal_real) |
41973 | 2800 |
qed |
2801 |
||
43920 | 2802 |
lemma ereal_mult_cancel_left: |
53873 | 2803 |
fixes a b c :: ereal |
2804 |
shows "a * b = a * c \<longleftrightarrow> (\<bar>a\<bar> = \<infinity> \<and> 0 < b * c) \<or> a = 0 \<or> b = c" |
|
2805 |
by (cases rule: ereal3_cases[of a b c]) (simp_all add: zero_less_mult_iff) |
|
41973 | 2806 |
|
56993
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents:
56927
diff
changeset
|
2807 |
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
|
2808 |
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
|
2809 |
assumes x: "\<bar>x\<bar> \<noteq> \<infinity>" and y: "\<bar>y\<bar> \<noteq> \<infinity>" |
61973 | 2810 |
assumes f: "(f \<longlongrightarrow> x) F" and g: "(g \<longlongrightarrow> y) F" |
2811 |
shows "((\<lambda>x. f x + g x) \<longlongrightarrow> x + y) F" |
|
56993
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents:
56927
diff
changeset
|
2812 |
proof - |
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents:
56927
diff
changeset
|
2813 |
from x obtain r where x': "x = ereal r" by (cases x) auto |
61973 | 2814 |
with f have "((\<lambda>i. real_of_ereal (f i)) \<longlongrightarrow> r) F" by simp |
56993
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents:
56927
diff
changeset
|
2815 |
moreover |
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents:
56927
diff
changeset
|
2816 |
from y obtain p where y': "y = ereal p" by (cases y) auto |
61973 | 2817 |
with g have "((\<lambda>i. real_of_ereal (g i)) \<longlongrightarrow> p) F" by simp |
2818 |
ultimately have "((\<lambda>i. real_of_ereal (f i) + real_of_ereal (g i)) \<longlongrightarrow> r + p) F" |
|
56993
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents:
56927
diff
changeset
|
2819 |
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
|
2820 |
moreover |
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents:
56927
diff
changeset
|
2821 |
from eventually_finite[OF x f] eventually_finite[OF y g] |
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
2822 |
have "eventually (\<lambda>x. f x + g x = ereal (real_of_ereal (f x) + real_of_ereal (g x))) F" |
56993
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents:
56927
diff
changeset
|
2823 |
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
|
2824 |
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
|
2825 |
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
|
2826 |
qed |
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
hoelzl
parents:
56927
diff
changeset
|
2827 |
|
62371 | 2828 |
lemma tendsto_add_ereal_nonneg: |
2829 |
fixes x y :: "ereal" |
|
2830 |
assumes "x \<noteq> -\<infinity>" "y \<noteq> -\<infinity>" "(f \<longlongrightarrow> x) F" "(g \<longlongrightarrow> y) F" |
|
2831 |
shows "((\<lambda>x. f x + g x) \<longlongrightarrow> x + y) F" |
|
81332 | 2832 |
proof (cases "x = \<infinity> \<or> y = \<infinity>") |
2833 |
case True |
|
62371 | 2834 |
moreover |
2835 |
{ fix y :: ereal and f g :: "'a \<Rightarrow> ereal" assume "y \<noteq> -\<infinity>" "(f \<longlongrightarrow> \<infinity>) F" "(g \<longlongrightarrow> y) F" |
|
2836 |
then obtain y' where "-\<infinity> < y'" "y' < y" |
|
2837 |
using dense[of "-\<infinity>" y] by auto |
|
2838 |
have "((\<lambda>x. f x + g x) \<longlongrightarrow> \<infinity>) F" |
|
2839 |
proof (rule tendsto_sandwich) |
|
2840 |
have "\<forall>\<^sub>F x in F. y' < g x" |
|
2841 |
using order_tendstoD(1)[OF \<open>(g \<longlongrightarrow> y) F\<close> \<open>y' < y\<close>] by auto |
|
2842 |
then show "\<forall>\<^sub>F x in F. f x + y' \<le> f x + g x" |
|
2843 |
by eventually_elim (auto intro!: add_mono) |
|
2844 |
show "\<forall>\<^sub>F n in F. f n + g n \<le> \<infinity>" "((\<lambda>n. \<infinity>) \<longlongrightarrow> \<infinity>) F" |
|
2845 |
by auto |
|
2846 |
show "((\<lambda>x. f x + y') \<longlongrightarrow> \<infinity>) F" |
|
2847 |
using tendsto_cadd_ereal[of y' \<infinity> f F] \<open>(f \<longlongrightarrow> \<infinity>) F\<close> \<open>-\<infinity> < y'\<close> by auto |
|
2848 |
qed } |
|
2849 |
note this[of y f g] this[of x g f] |
|
2850 |
ultimately show ?thesis |
|
2851 |
using assms by (auto simp: add_ac) |
|
2852 |
next |
|
81332 | 2853 |
case False |
62371 | 2854 |
with assms tendsto_add_ereal[of x y f F g] |
2855 |
show ?thesis |
|
2856 |
by auto |
|
2857 |
qed |
|
2858 |
||
43920 | 2859 |
lemma ereal_inj_affinity: |
43923 | 2860 |
fixes m t :: ereal |
53873 | 2861 |
assumes "\<bar>m\<bar> \<noteq> \<infinity>" |
2862 |
and "m \<noteq> 0" |
|
2863 |
and "\<bar>t\<bar> \<noteq> \<infinity>" |
|
41973 | 2864 |
shows "inj_on (\<lambda>x. m * x + t) A" |
2865 |
using assms |
|
43920 | 2866 |
by (cases rule: ereal2_cases[of m t]) |
2867 |
(auto intro!: inj_onI simp: ereal_add_cancel_right ereal_mult_cancel_left) |
|
41973 | 2868 |
|
43920 | 2869 |
lemma ereal_PInfty_eq_plus[simp]: |
43923 | 2870 |
fixes a b :: ereal |
41973 | 2871 |
shows "\<infinity> = a + b \<longleftrightarrow> a = \<infinity> \<or> b = \<infinity>" |
43920 | 2872 |
by (cases rule: ereal2_cases[of a b]) auto |
41973 | 2873 |
|
43920 | 2874 |
lemma ereal_MInfty_eq_plus[simp]: |
43923 | 2875 |
fixes a b :: ereal |
41973 | 2876 |
shows "-\<infinity> = a + b \<longleftrightarrow> (a = -\<infinity> \<and> b \<noteq> \<infinity>) \<or> (b = -\<infinity> \<and> a \<noteq> \<infinity>)" |
43920 | 2877 |
by (cases rule: ereal2_cases[of a b]) auto |
41973 | 2878 |
|
43920 | 2879 |
lemma ereal_less_divide_pos: |
43923 | 2880 |
fixes x y :: ereal |
2881 |
shows "x > 0 \<Longrightarrow> x \<noteq> \<infinity> \<Longrightarrow> y < z / x \<longleftrightarrow> x * y < z" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2882 |
by (simp add: ereal_less_divide_iff mult.commute) |
41973 | 2883 |
|
43920 | 2884 |
lemma ereal_divide_less_pos: |
43923 | 2885 |
fixes x y z :: ereal |
2886 |
shows "x > 0 \<Longrightarrow> x \<noteq> \<infinity> \<Longrightarrow> y / x < z \<longleftrightarrow> y < x * z" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2887 |
by (simp add: ereal_divide_less_iff mult.commute) |
41973 | 2888 |
|
43920 | 2889 |
lemma ereal_divide_eq: |
43923 | 2890 |
fixes a b c :: ereal |
2891 |
shows "b \<noteq> 0 \<Longrightarrow> \<bar>b\<bar> \<noteq> \<infinity> \<Longrightarrow> a / b = c \<longleftrightarrow> a = b * c" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2892 |
by (metis ereal_divide_same ereal_times_divide_eq mult.commute |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2893 |
mult.right_neutral) |
41973 | 2894 |
|
43923 | 2895 |
lemma ereal_inverse_not_MInfty[simp]: "inverse (a::ereal) \<noteq> -\<infinity>" |
41973 | 2896 |
by (cases a) auto |
2897 |
||
43920 | 2898 |
lemma ereal_mult_m1[simp]: "x * ereal (-1) = -x" |
41973 | 2899 |
by (cases x) auto |
2900 |
||
53873 | 2901 |
lemma ereal_real': |
2902 |
assumes "\<bar>x\<bar> \<noteq> \<infinity>" |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
2903 |
shows "ereal (real_of_ereal x) = x" |
41976 | 2904 |
using assms by auto |
41973 | 2905 |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
2906 |
lemma real_ereal_id: "real_of_ereal \<circ> ereal = id" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2907 |
by auto |
41973 | 2908 |
|
43923 | 2909 |
lemma open_image_ereal: "open(UNIV-{ \<infinity> , (-\<infinity> :: ereal)})" |
53873 | 2910 |
by (metis range_ereal open_ereal open_UNIV) |
41973 | 2911 |
|
43920 | 2912 |
lemma ereal_le_distrib: |
53873 | 2913 |
fixes a b c :: ereal |
2914 |
shows "c * (a + b) \<le> c * a + c * b" |
|
43920 | 2915 |
by (cases rule: ereal3_cases[of a b c]) |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2916 |
(auto simp: field_simps not_le mult_le_0_iff mult_less_0_iff) |
41973 | 2917 |
|
43920 | 2918 |
lemma ereal_pos_distrib: |
53873 | 2919 |
fixes a b c :: ereal |
2920 |
assumes "0 \<le> c" |
|
2921 |
and "c \<noteq> \<infinity>" |
|
2922 |
shows "c * (a + b) = c * a + c * b" |
|
2923 |
using assms |
|
2924 |
by (cases rule: ereal3_cases[of a b c]) |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2925 |
(auto simp: field_simps not_le mult_le_0_iff mult_less_0_iff) |
41973 | 2926 |
|
51000 | 2927 |
lemma ereal_LimI_finite: |
2928 |
fixes x :: ereal |
|
2929 |
assumes "\<bar>x\<bar> \<noteq> \<infinity>" |
|
53873 | 2930 |
and "\<And>r. 0 < r \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. u n < x + r \<and> x < u n + r" |
61969 | 2931 |
shows "u \<longlonglongrightarrow> x" |
51000 | 2932 |
proof (rule topological_tendstoI, unfold eventually_sequentially) |
53873 | 2933 |
obtain rx where rx: "x = ereal rx" |
2934 |
using assms by (cases x) auto |
|
2935 |
fix S |
|
2936 |
assume "open S" and "x \<in> S" |
|
2937 |
then have "open (ereal -` S)" |
|
2938 |
unfolding open_ereal_def by auto |
|
63060 | 2939 |
with \<open>x \<in> S\<close> obtain r where "0 < r" and dist: "dist y rx < r \<Longrightarrow> ereal y \<in> S" for y |
62101 | 2940 |
unfolding open_dist rx by auto |
63060 | 2941 |
then obtain n |
2942 |
where upper: "u N < x + ereal r" |
|
2943 |
and lower: "x < u N + ereal r" |
|
2944 |
if "n \<le> N" for N |
|
53873 | 2945 |
using assms(2)[of "ereal r"] by auto |
2946 |
show "\<exists>N. \<forall>n\<ge>N. u n \<in> S" |
|
51000 | 2947 |
proof (safe intro!: exI[of _ n]) |
53873 | 2948 |
fix N |
2949 |
assume "n \<le> N" |
|
60500 | 2950 |
from upper[OF this] lower[OF this] assms \<open>0 < r\<close> |
53873 | 2951 |
have "u N \<notin> {\<infinity>,(-\<infinity>)}" |
2952 |
by auto |
|
2953 |
then obtain ra where ra_def: "(u N) = ereal ra" |
|
2954 |
by (cases "u N") auto |
|
2955 |
then have "rx < ra + r" and "ra < rx + r" |
|
60500 | 2956 |
using rx assms \<open>0 < r\<close> lower[OF \<open>n \<le> N\<close>] upper[OF \<open>n \<le> N\<close>] |
53873 | 2957 |
by auto |
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
2958 |
then have "dist (real_of_ereal (u N)) rx < r" |
53873 | 2959 |
using rx ra_def |
51000 | 2960 |
by (auto simp: dist_real_def abs_diff_less_iff field_simps) |
53873 | 2961 |
from dist[OF this] show "u N \<in> S" |
60500 | 2962 |
using \<open>u N \<notin> {\<infinity>, -\<infinity>}\<close> |
62390 | 2963 |
by (auto simp: ereal_real split: if_split_asm) |
51000 | 2964 |
qed |
2965 |
qed |
|
2966 |
||
2967 |
lemma tendsto_obtains_N: |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2968 |
assumes "f \<longlonglongrightarrow> f0" "open S" "f0 \<in> S" |
53873 | 2969 |
obtains N where "\<forall>n\<ge>N. f n \<in> S" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2970 |
using assms lim_explicit by blast |
51000 | 2971 |
|
2972 |
lemma ereal_LimI_finite_iff: |
|
2973 |
fixes x :: ereal |
|
2974 |
assumes "\<bar>x\<bar> \<noteq> \<infinity>" |
|
61969 | 2975 |
shows "u \<longlonglongrightarrow> x \<longleftrightarrow> (\<forall>r. 0 < r \<longrightarrow> (\<exists>N. \<forall>n\<ge>N. u n < x + r \<and> x < u n + r))" |
53873 | 2976 |
(is "?lhs \<longleftrightarrow> ?rhs") |
51000 | 2977 |
proof |
61969 | 2978 |
assume lim: "u \<longlonglongrightarrow> x" |
53873 | 2979 |
{ |
2980 |
fix r :: ereal |
|
2981 |
assume "r > 0" |
|
2982 |
then obtain N where "\<forall>n\<ge>N. u n \<in> {x - r <..< x + r}" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2983 |
using lim ereal_between[of x r] assms \<open>r > 0\<close> tendsto_obtains_N[of u x "{x - r <..< x + r}"] |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
2984 |
by auto |
53873 | 2985 |
then have "\<exists>N. \<forall>n\<ge>N. u n < x + r \<and> x < u n + r" |
2986 |
using ereal_minus_less[of r x] |
|
2987 |
by (cases r) auto |
|
2988 |
} |
|
2989 |
then show ?rhs |
|
2990 |
by auto |
|
51000 | 2991 |
next |
53873 | 2992 |
assume ?rhs |
61969 | 2993 |
then show "u \<longlonglongrightarrow> x" |
51000 | 2994 |
using ereal_LimI_finite[of x] assms by auto |
2995 |
qed |
|
2996 |
||
51340
5e6296afe08d
move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents:
51329
diff
changeset
|
2997 |
lemma ereal_Limsup_uminus: |
53873 | 2998 |
fixes f :: "'a \<Rightarrow> ereal" |
2999 |
shows "Limsup net (\<lambda>x. - (f x)) = - Liminf net f" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3000 |
unfolding Limsup_def Liminf_def ereal_SUP_uminus_eq ereal_INF_uminus_eq .. |
51000 | 3001 |
|
51340
5e6296afe08d
move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents:
51329
diff
changeset
|
3002 |
lemma liminf_bounded_iff: |
5e6296afe08d
move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents:
51329
diff
changeset
|
3003 |
fixes x :: "nat \<Rightarrow> ereal" |
53873 | 3004 |
shows "C \<le> liminf x \<longleftrightarrow> (\<forall>B<C. \<exists>N. \<forall>n\<ge>N. B < x n)" |
3005 |
(is "?lhs \<longleftrightarrow> ?rhs") |
|
51340
5e6296afe08d
move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents:
51329
diff
changeset
|
3006 |
unfolding le_Liminf_iff eventually_sequentially .. |
51000 | 3007 |
|
59679 | 3008 |
lemma Liminf_add_le: |
3009 |
fixes f g :: "_ \<Rightarrow> ereal" |
|
3010 |
assumes F: "F \<noteq> bot" |
|
3011 |
assumes ev: "eventually (\<lambda>x. 0 \<le> f x) F" "eventually (\<lambda>x. 0 \<le> g x) F" |
|
3012 |
shows "Liminf F f + Liminf F g \<le> Liminf F (\<lambda>x. f x + g x)" |
|
3013 |
unfolding Liminf_def |
|
3014 |
proof (subst SUP_ereal_add_left[symmetric]) |
|
3015 |
let ?F = "{P. eventually P F}" |
|
69313 | 3016 |
let ?INF = "\<lambda>P g. Inf (g ` (Collect P))" |
59679 | 3017 |
show "?F \<noteq> {}" |
3018 |
by (auto intro: eventually_True) |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3019 |
show "(SUP P\<in>?F. ?INF P g) \<noteq> -\<infinity>" |
59679 | 3020 |
unfolding bot_ereal_def[symmetric] SUP_bot_conv INF_eq_bot_iff |
3021 |
by (auto intro!: exI[of _ 0] ev simp: bot_ereal_def) |
|
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
3022 |
have "(SUP P\<in>?F. ?INF P f + (SUP P\<in>?F. ?INF P g)) \<le> (SUP P\<in>?F. (SUP P'\<in>?F. ?INF P f + ?INF P' g))" |
59679 | 3023 |
proof (safe intro!: SUP_mono bexI[of _ "\<lambda>x. P x \<and> 0 \<le> f x" for P]) |
3024 |
fix P let ?P' = "\<lambda>x. P x \<and> 0 \<le> f x" |
|
3025 |
assume "eventually P F" |
|
3026 |
with ev show "eventually ?P' F" |
|
3027 |
by eventually_elim auto |
|
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
3028 |
have "?INF P f + (SUP P\<in>?F. ?INF P g) \<le> ?INF ?P' f + (SUP P\<in>?F. ?INF P g)" |
68752 | 3029 |
by (intro add_mono INF_mono) auto |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
3030 |
also have "\<dots> = (SUP P'\<in>?F. ?INF ?P' f + ?INF P' g)" |
59679 | 3031 |
proof (rule SUP_ereal_add_right[symmetric]) |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3032 |
show "Inf (f ` {x. P x \<and> 0 \<le> f x}) \<noteq> -\<infinity>" |
59679 | 3033 |
unfolding bot_ereal_def[symmetric] INF_eq_bot_iff |
3034 |
by (auto intro!: exI[of _ 0] ev simp: bot_ereal_def) |
|
3035 |
qed fact |
|
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
3036 |
finally show "?INF P f + (SUP P\<in>?F. ?INF P g) \<le> (SUP P'\<in>?F. ?INF ?P' f + ?INF P' g)" . |
59679 | 3037 |
qed |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
3038 |
also have "\<dots> \<le> (SUP P\<in>?F. INF x\<in>Collect P. f x + g x)" |
59679 | 3039 |
proof (safe intro!: SUP_least) |
3040 |
fix P Q assume *: "eventually P F" "eventually Q F" |
|
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
3041 |
show "?INF P f + ?INF Q g \<le> (SUP P\<in>?F. INF x\<in>Collect P. f x + g x)" |
59679 | 3042 |
proof (rule SUP_upper2) |
3043 |
show "(\<lambda>x. P x \<and> Q x) \<in> ?F" |
|
3044 |
using * by (auto simp: eventually_conj) |
|
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
3045 |
show "?INF P f + ?INF Q g \<le> (INF x\<in>{x. P x \<and> Q x}. f x + g x)" |
68752 | 3046 |
by (intro INF_greatest add_mono) (auto intro: INF_lower) |
59679 | 3047 |
qed |
3048 |
qed |
|
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
3049 |
finally show "(SUP P\<in>?F. ?INF P f + (SUP P\<in>?F. ?INF P g)) \<le> (SUP P\<in>?F. INF x\<in>Collect P. f x + g x)" . |
59679 | 3050 |
qed |
3051 |
||
60060 | 3052 |
lemma Sup_ereal_mult_right': |
3053 |
assumes nonempty: "Y \<noteq> {}" |
|
3054 |
and x: "x \<ge> 0" |
|
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
3055 |
shows "(SUP i\<in>Y. f i) * ereal x = (SUP i\<in>Y. f i * ereal x)" (is "?lhs = ?rhs") |
60060 | 3056 |
proof(cases "x = 0") |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3057 |
case True thus ?thesis by(auto simp: nonempty zero_ereal_def[symmetric]) |
60060 | 3058 |
next |
3059 |
case False |
|
3060 |
show ?thesis |
|
3061 |
proof(rule antisym) |
|
3062 |
show "?rhs \<le> ?lhs" |
|
3063 |
by(rule SUP_least)(simp add: ereal_mult_right_mono SUP_upper x) |
|
3064 |
next |
|
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
3065 |
have "?lhs / ereal x = (SUP i\<in>Y. f i) * (ereal x / ereal x)" by(simp only: ereal_times_divide_eq) |
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
3066 |
also have "\<dots> = (SUP i\<in>Y. f i)" using False by simp |
60060 | 3067 |
also have "\<dots> \<le> ?rhs / x" |
3068 |
proof(rule SUP_least) |
|
3069 |
fix i |
|
3070 |
assume "i \<in> Y" |
|
3071 |
have "f i = f i * (ereal x / ereal x)" using False by simp |
|
3072 |
also have "\<dots> = f i * x / x" by(simp only: ereal_times_divide_eq) |
|
3073 |
also from \<open>i \<in> Y\<close> have "f i * x \<le> ?rhs" by(rule SUP_upper) |
|
3074 |
hence "f i * x / x \<le> ?rhs / x" using x False by simp |
|
3075 |
finally show "f i \<le> ?rhs / x" . |
|
3076 |
qed |
|
3077 |
finally have "(?lhs / x) * x \<le> (?rhs / x) * x" |
|
3078 |
by(rule ereal_mult_right_mono)(simp add: x) |
|
3079 |
also have "\<dots> = ?rhs" using False ereal_divide_eq mult.commute by force |
|
3080 |
also have "(?lhs / x) * x = ?lhs" using False ereal_divide_eq mult.commute by force |
|
3081 |
finally show "?lhs \<le> ?rhs" . |
|
3082 |
qed |
|
3083 |
qed |
|
53873 | 3084 |
|
61631
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
3085 |
lemma Sup_ereal_mult_left': |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
3086 |
"\<lbrakk> Y \<noteq> {}; x \<ge> 0 \<rbrakk> \<Longrightarrow> ereal x * (SUP i\<in>Y. f i) = (SUP i\<in>Y. ereal x * f i)" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3087 |
by (smt (verit) Sup.SUP_cong Sup_ereal_mult_right' mult.commute) |
61631
4f7ef088c4ed
add lemmas for extended nats and reals
Andreas Lochbihler
parents:
61610
diff
changeset
|
3088 |
|
60637 | 3089 |
lemma sup_continuous_add[order_continuous_intros]: |
3090 |
fixes f g :: "'a::complete_lattice \<Rightarrow> ereal" |
|
3091 |
assumes nn: "\<And>x. 0 \<le> f x" "\<And>x. 0 \<le> g x" and cont: "sup_continuous f" "sup_continuous g" |
|
3092 |
shows "sup_continuous (\<lambda>x. f x + g x)" |
|
3093 |
unfolding sup_continuous_def |
|
3094 |
proof safe |
|
3095 |
fix M :: "nat \<Rightarrow> 'a" assume "incseq M" |
|
3096 |
then show "f (SUP i. M i) + g (SUP i. M i) = (SUP i. f (M i) + g (M i))" |
|
3097 |
using SUP_ereal_add_pos[of "\<lambda>i. f (M i)" "\<lambda>i. g (M i)"] nn |
|
3098 |
cont[THEN sup_continuous_mono] cont[THEN sup_continuousD] |
|
3099 |
by (auto simp: mono_def) |
|
3100 |
qed |
|
3101 |
||
3102 |
lemma sup_continuous_mult_right[order_continuous_intros]: |
|
3103 |
"0 \<le> c \<Longrightarrow> c < \<infinity> \<Longrightarrow> sup_continuous f \<Longrightarrow> sup_continuous (\<lambda>x. f x * c :: ereal)" |
|
60636
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents:
60580
diff
changeset
|
3104 |
by (cases c) (auto simp: sup_continuous_def fun_eq_iff Sup_ereal_mult_right') |
ee18efe9b246
add named theorems order_continuous_intros; lfp/gfp_funpow; bounded variant for lfp/gfp transfer
hoelzl
parents:
60580
diff
changeset
|
3105 |
|
60637 | 3106 |
lemma sup_continuous_mult_left[order_continuous_intros]: |
3107 |
"0 \<le> c \<Longrightarrow> c < \<infinity> \<Longrightarrow> sup_continuous f \<Longrightarrow> sup_continuous (\<lambda>x. c * f x :: ereal)" |
|
3108 |
using sup_continuous_mult_right[of c f] by (simp add: mult_ac) |
|
3109 |
||
3110 |
lemma sup_continuous_ereal_of_enat[order_continuous_intros]: |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3111 |
assumes f: "sup_continuous f" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3112 |
shows "sup_continuous (\<lambda>x. ereal_of_enat (f x))" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3113 |
by (metis UNIV_not_empty ereal_of_enat_SUP f sup_continuous_compose |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3114 |
sup_continuous_def) |
60637 | 3115 |
|
60771 | 3116 |
subsubsection \<open>Sums\<close> |
3117 |
||
3118 |
lemma sums_ereal_positive: |
|
3119 |
fixes f :: "nat \<Rightarrow> ereal" |
|
3120 |
assumes "\<And>i. 0 \<le> f i" |
|
3121 |
shows "f sums (SUP n. \<Sum>i<n. f i)" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3122 |
by (simp add: LIMSEQ_SUP assms incseq_sumI sums_def) |
60771 | 3123 |
|
3124 |
lemma summable_ereal_pos: |
|
3125 |
fixes f :: "nat \<Rightarrow> ereal" |
|
3126 |
assumes "\<And>i. 0 \<le> f i" |
|
3127 |
shows "summable f" |
|
3128 |
using sums_ereal_positive[of f, OF assms] |
|
3129 |
unfolding summable_def |
|
3130 |
by auto |
|
3131 |
||
3132 |
lemma sums_ereal: "(\<lambda>x. ereal (f x)) sums ereal x \<longleftrightarrow> f sums x" |
|
3133 |
unfolding sums_def by simp |
|
3134 |
||
3135 |
lemma suminf_ereal_eq_SUP: |
|
3136 |
fixes f :: "nat \<Rightarrow> ereal" |
|
3137 |
assumes "\<And>i. 0 \<le> f i" |
|
3138 |
shows "(\<Sum>x. f x) = (SUP n. \<Sum>i<n. f i)" |
|
3139 |
using sums_ereal_positive[of f, OF assms, THEN sums_unique] |
|
3140 |
by simp |
|
3141 |
||
3142 |
lemma suminf_bound: |
|
3143 |
fixes f :: "nat \<Rightarrow> ereal" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3144 |
assumes "\<forall>N. (\<Sum>n<N. f n) \<le> x" "\<And>n. 0 \<le> f n" |
60771 | 3145 |
shows "suminf f \<le> x" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3146 |
by (simp add: SUP_least assms suminf_ereal_eq_SUP) |
60771 | 3147 |
|
3148 |
lemma suminf_bound_add: |
|
3149 |
fixes f :: "nat \<Rightarrow> ereal" |
|
3150 |
assumes "\<forall>N. (\<Sum>n<N. f n) + y \<le> x" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3151 |
and "\<And>n. 0 \<le> f n" |
60771 | 3152 |
and "y \<noteq> -\<infinity>" |
3153 |
shows "suminf f + y \<le> x" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3154 |
by (simp add: SUP_ereal_le_addI assms suminf_ereal_eq_SUP) |
60771 | 3155 |
|
3156 |
lemma suminf_upper: |
|
3157 |
fixes f :: "nat \<Rightarrow> ereal" |
|
3158 |
assumes "\<And>n. 0 \<le> f n" |
|
3159 |
shows "(\<Sum>n<N. f n) \<le> (\<Sum>n. f n)" |
|
3160 |
unfolding suminf_ereal_eq_SUP [OF assms] |
|
3161 |
by (auto intro: complete_lattice_class.SUP_upper) |
|
3162 |
||
3163 |
lemma suminf_0_le: |
|
3164 |
fixes f :: "nat \<Rightarrow> ereal" |
|
3165 |
assumes "\<And>n. 0 \<le> f n" |
|
3166 |
shows "0 \<le> (\<Sum>n. f n)" |
|
3167 |
using suminf_upper[of f 0, OF assms] |
|
3168 |
by simp |
|
3169 |
||
3170 |
lemma suminf_le_pos: |
|
3171 |
fixes f g :: "nat \<Rightarrow> ereal" |
|
3172 |
assumes "\<And>N. f N \<le> g N" |
|
3173 |
and "\<And>N. 0 \<le> f N" |
|
3174 |
shows "suminf f \<le> suminf g" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3175 |
by (meson assms order_trans suminf_le summable_ereal_pos) |
60771 | 3176 |
|
3177 |
lemma suminf_half_series_ereal: "(\<Sum>n. (1/2 :: ereal) ^ Suc n) = 1" |
|
3178 |
using sums_ereal[THEN iffD2, OF power_half_series, THEN sums_unique, symmetric] |
|
3179 |
by (simp add: one_ereal_def) |
|
3180 |
||
3181 |
lemma suminf_add_ereal: |
|
3182 |
fixes f g :: "nat \<Rightarrow> ereal" |
|
72236 | 3183 |
assumes "\<And>i. 0 \<le> f i" "\<And>i. 0 \<le> g i" |
60771 | 3184 |
shows "(\<Sum>i. f i + g i) = suminf f + suminf g" |
72236 | 3185 |
proof - |
3186 |
have "(SUP n. \<Sum>i<n. f i + g i) = (SUP n. sum f {..<n}) + (SUP n. sum g {..<n})" |
|
3187 |
unfolding sum.distrib |
|
3188 |
by (intro assms add_nonneg_nonneg SUP_ereal_add_pos incseq_sumI sum_nonneg ballI) |
|
3189 |
with assms show ?thesis |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3190 |
by (simp add: suminf_ereal_eq_SUP) |
72236 | 3191 |
qed |
60771 | 3192 |
|
3193 |
lemma suminf_cmult_ereal: |
|
3194 |
fixes f g :: "nat \<Rightarrow> ereal" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3195 |
assumes "\<And>i. 0 \<le> f i" and "0 \<le> a" |
60771 | 3196 |
shows "(\<Sum>i. a * f i) = a * suminf f" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3197 |
by (simp add: assms sum_nonneg suminf_ereal_eq_SUP sum_ereal_right_distrib flip: SUP_ereal_mult_left) |
60771 | 3198 |
|
3199 |
lemma suminf_PInfty: |
|
3200 |
fixes f :: "nat \<Rightarrow> ereal" |
|
3201 |
assumes "\<And>i. 0 \<le> f i" |
|
3202 |
and "suminf f \<noteq> \<infinity>" |
|
3203 |
shows "f i \<noteq> \<infinity>" |
|
3204 |
proof - |
|
3205 |
from suminf_upper[of f "Suc i", OF assms(1)] assms(2) |
|
3206 |
have "(\<Sum>i<Suc i. f i) \<noteq> \<infinity>" |
|
3207 |
by auto |
|
3208 |
then show ?thesis |
|
64267 | 3209 |
unfolding sum_Pinfty by simp |
60771 | 3210 |
qed |
3211 |
||
3212 |
lemma suminf_PInfty_fun: |
|
3213 |
assumes "\<And>i. 0 \<le> f i" |
|
3214 |
and "suminf f \<noteq> \<infinity>" |
|
3215 |
shows "\<exists>f'. f = (\<lambda>x. ereal (f' x))" |
|
3216 |
proof - |
|
3217 |
have "\<forall>i. \<exists>r. f i = ereal r" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3218 |
by (metis abs_ereal_ge0 abs_neq_infinity_cases assms suminf_PInfty) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3219 |
then show ?thesis |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3220 |
by metis |
60771 | 3221 |
qed |
3222 |
||
3223 |
lemma summable_ereal: |
|
3224 |
assumes "\<And>i. 0 \<le> f i" |
|
3225 |
and "(\<Sum>i. ereal (f i)) \<noteq> \<infinity>" |
|
3226 |
shows "summable f" |
|
3227 |
proof - |
|
3228 |
have "0 \<le> (\<Sum>i. ereal (f i))" |
|
3229 |
using assms by (intro suminf_0_le) auto |
|
3230 |
with assms obtain r where r: "(\<Sum>i. ereal (f i)) = ereal r" |
|
3231 |
by (cases "\<Sum>i. ereal (f i)") auto |
|
3232 |
from summable_ereal_pos[of "\<lambda>x. ereal (f x)"] |
|
3233 |
have "summable (\<lambda>x. ereal (f x))" |
|
3234 |
using assms by auto |
|
3235 |
from summable_sums[OF this] |
|
3236 |
have "(\<lambda>x. ereal (f x)) sums (\<Sum>x. ereal (f x))" |
|
3237 |
by auto |
|
3238 |
then show "summable f" |
|
3239 |
unfolding r sums_ereal summable_def .. |
|
3240 |
qed |
|
3241 |
||
3242 |
lemma suminf_ereal: |
|
3243 |
assumes "\<And>i. 0 \<le> f i" |
|
3244 |
and "(\<Sum>i. ereal (f i)) \<noteq> \<infinity>" |
|
3245 |
shows "(\<Sum>i. ereal (f i)) = ereal (suminf f)" |
|
3246 |
proof (rule sums_unique[symmetric]) |
|
3247 |
from summable_ereal[OF assms] |
|
3248 |
show "(\<lambda>x. ereal (f x)) sums (ereal (suminf f))" |
|
3249 |
unfolding sums_ereal |
|
3250 |
using assms |
|
3251 |
by (intro summable_sums summable_ereal) |
|
3252 |
qed |
|
3253 |
||
3254 |
lemma suminf_ereal_minus: |
|
3255 |
fixes f g :: "nat \<Rightarrow> ereal" |
|
3256 |
assumes ord: "\<And>i. g i \<le> f i" "\<And>i. 0 \<le> g i" |
|
3257 |
and fin: "suminf f \<noteq> \<infinity>" "suminf g \<noteq> \<infinity>" |
|
3258 |
shows "(\<Sum>i. f i - g i) = suminf f - suminf g" |
|
3259 |
proof - |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3260 |
have 0: "0 \<le> f i" for i |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3261 |
using ord order_trans by blast |
60771 | 3262 |
moreover |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3263 |
obtain f' where [simp]: "f = (\<lambda>x. ereal (f' x))" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3264 |
using 0 fin(1) suminf_PInfty_fun by presburger |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3265 |
obtain g' where [simp]: "g = (\<lambda>x. ereal (g' x))" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3266 |
using fin(2) ord(2) suminf_PInfty_fun by presburger |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3267 |
have "0 \<le> f i - g i" for i |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3268 |
using ord(1) by auto |
60771 | 3269 |
moreover |
3270 |
have "suminf (\<lambda>i. f i - g i) \<le> suminf f" |
|
3271 |
using assms by (auto intro!: suminf_le_pos simp: field_simps) |
|
3272 |
then have "suminf (\<lambda>i. f i - g i) \<noteq> \<infinity>" |
|
3273 |
using fin by auto |
|
3274 |
ultimately show ?thesis |
|
3275 |
using assms \<open>\<And>i. 0 \<le> f i\<close> |
|
3276 |
apply simp |
|
3277 |
apply (subst (1 2 3) suminf_ereal) |
|
3278 |
apply (auto intro!: suminf_diff[symmetric] summable_ereal) |
|
3279 |
done |
|
3280 |
qed |
|
3281 |
||
3282 |
lemma suminf_ereal_PInf [simp]: "(\<Sum>x. \<infinity>::ereal) = \<infinity>" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3283 |
by (metis ereal_less_eq(1) suminf_PInfty) |
60771 | 3284 |
|
3285 |
lemma summable_real_of_ereal: |
|
3286 |
fixes f :: "nat \<Rightarrow> ereal" |
|
3287 |
assumes f: "\<And>i. 0 \<le> f i" |
|
3288 |
and fin: "(\<Sum>i. f i) \<noteq> \<infinity>" |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
3289 |
shows "summable (\<lambda>i. real_of_ereal (f i))" |
60771 | 3290 |
proof (rule summable_def[THEN iffD2]) |
3291 |
have "0 \<le> (\<Sum>i. f i)" |
|
3292 |
using assms by (auto intro: suminf_0_le) |
|
3293 |
with fin obtain r where r: "ereal r = (\<Sum>i. f i)" |
|
3294 |
by (cases "(\<Sum>i. f i)") auto |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3295 |
have fin: "\<bar>f i\<bar> \<noteq> \<infinity>" for i |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3296 |
by (simp add: assms(2) f suminf_PInfty) |
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
3297 |
have "(\<lambda>i. ereal (real_of_ereal (f i))) sums (\<Sum>i. ereal (real_of_ereal (f i)))" |
60771 | 3298 |
using f |
3299 |
by (auto intro!: summable_ereal_pos simp: ereal_le_real_iff zero_ereal_def) |
|
3300 |
also have "\<dots> = ereal r" |
|
3301 |
using fin r by (auto simp: ereal_real) |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
3302 |
finally show "\<exists>r. (\<lambda>i. real_of_ereal (f i)) sums r" |
60771 | 3303 |
by (auto simp: sums_ereal) |
3304 |
qed |
|
3305 |
||
3306 |
lemma suminf_SUP_eq: |
|
3307 |
fixes f :: "nat \<Rightarrow> nat \<Rightarrow> ereal" |
|
3308 |
assumes "\<And>i. incseq (\<lambda>n. f n i)" |
|
3309 |
and "\<And>n i. 0 \<le> f n i" |
|
3310 |
shows "(\<Sum>i. SUP n. f n i) = (SUP n. \<Sum>i. f n i)" |
|
3311 |
proof - |
|
72236 | 3312 |
have *: "\<And>n. (\<Sum>i<n. SUP k. f k i) = (SUP k. \<Sum>i<n. f k i)" |
3313 |
using assms |
|
3314 |
by (auto intro!: SUP_ereal_sum [symmetric]) |
|
60771 | 3315 |
show ?thesis |
3316 |
using assms |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3317 |
by (auto simp: suminf_ereal_eq_SUP SUP_upper2 * intro!: SUP_commute) |
60771 | 3318 |
qed |
3319 |
||
64267 | 3320 |
lemma suminf_sum_ereal: |
60771 | 3321 |
fixes f :: "_ \<Rightarrow> _ \<Rightarrow> ereal" |
3322 |
assumes nonneg: "\<And>i a. a \<in> A \<Longrightarrow> 0 \<le> f i a" |
|
3323 |
shows "(\<Sum>i. \<Sum>a\<in>A. f i a) = (\<Sum>a\<in>A. \<Sum>i. f i a)" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3324 |
using nonneg |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3325 |
by (induction A rule: infinite_finite_induct; simp add: suminf_add_ereal sum_nonneg) |
60771 | 3326 |
|
3327 |
lemma suminf_ereal_eq_0: |
|
3328 |
fixes f :: "nat \<Rightarrow> ereal" |
|
3329 |
assumes nneg: "\<And>i. 0 \<le> f i" |
|
3330 |
shows "(\<Sum>i. f i) = 0 \<longleftrightarrow> (\<forall>i. f i = 0)" |
|
3331 |
proof |
|
3332 |
assume "(\<Sum>i. f i) = 0" |
|
3333 |
{ |
|
3334 |
fix i |
|
3335 |
assume "f i \<noteq> 0" |
|
3336 |
with nneg have "0 < f i" |
|
3337 |
by (auto simp: less_le) |
|
3338 |
also have "f i = (\<Sum>j. if j = i then f i else 0)" |
|
3339 |
by (subst suminf_finite[where N="{i}"]) auto |
|
3340 |
also have "\<dots> \<le> (\<Sum>i. f i)" |
|
3341 |
using nneg |
|
3342 |
by (auto intro!: suminf_le_pos) |
|
3343 |
finally have False |
|
3344 |
using \<open>(\<Sum>i. f i) = 0\<close> by auto |
|
3345 |
} |
|
3346 |
then show "\<forall>i. f i = 0" |
|
3347 |
by auto |
|
3348 |
qed simp |
|
3349 |
||
3350 |
lemma suminf_ereal_offset_le: |
|
3351 |
fixes f :: "nat \<Rightarrow> ereal" |
|
3352 |
assumes f: "\<And>i. 0 \<le> f i" |
|
3353 |
shows "(\<Sum>i. f (i + k)) \<le> suminf f" |
|
3354 |
proof - |
|
61969 | 3355 |
have "(\<lambda>n. \<Sum>i<n. f (i + k)) \<longlonglongrightarrow> (\<Sum>i. f (i + k))" |
66936 | 3356 |
using summable_sums[OF summable_ereal_pos] |
3357 |
by (simp add: sums_def atLeast0LessThan f) |
|
61969 | 3358 |
moreover have "(\<lambda>n. \<Sum>i<n. f i) \<longlonglongrightarrow> (\<Sum>i. f i)" |
66936 | 3359 |
using summable_sums[OF summable_ereal_pos] |
3360 |
by (simp add: sums_def atLeast0LessThan f) |
|
61969 | 3361 |
then have "(\<lambda>n. \<Sum>i<n + k. f i) \<longlonglongrightarrow> (\<Sum>i. f i)" |
60771 | 3362 |
by (rule LIMSEQ_ignore_initial_segment) |
3363 |
ultimately show ?thesis |
|
3364 |
proof (rule LIMSEQ_le, safe intro!: exI[of _ k]) |
|
3365 |
fix n assume "k \<le> n" |
|
66936 | 3366 |
have "(\<Sum>i<n. f (i + k)) = (\<Sum>i<n. (f \<circ> plus k) i)" |
3367 |
by (simp add: ac_simps) |
|
3368 |
also have "\<dots> = (\<Sum>i\<in>(plus k) ` {..<n}. f i)" |
|
3369 |
by (rule sum.reindex [symmetric]) simp |
|
64267 | 3370 |
also have "\<dots> \<le> sum f {..<n + k}" |
65680
378a2f11bec9
Simplification of some proofs. Also key lemmas using !! rather than ! in premises
paulson <lp15@cam.ac.uk>
parents:
64272
diff
changeset
|
3371 |
by (intro sum_mono2) (auto simp: f) |
64267 | 3372 |
finally show "(\<Sum>i<n. f (i + k)) \<le> sum f {..<n + k}" . |
60771 | 3373 |
qed |
3374 |
qed |
|
3375 |
||
3376 |
lemma sums_suminf_ereal: "f sums x \<Longrightarrow> (\<Sum>i. ereal (f i)) = ereal x" |
|
3377 |
by (metis sums_ereal sums_unique) |
|
3378 |
||
3379 |
lemma suminf_ereal': "summable f \<Longrightarrow> (\<Sum>i. ereal (f i)) = ereal (\<Sum>i. f i)" |
|
3380 |
by (metis sums_ereal sums_unique summable_def) |
|
3381 |
||
3382 |
lemma suminf_ereal_finite: "summable f \<Longrightarrow> (\<Sum>i. ereal (f i)) \<noteq> \<infinity>" |
|
68406 | 3383 |
by (auto simp: summable_def simp flip: sums_ereal sums_unique) |
60771 | 3384 |
|
3385 |
lemma suminf_ereal_finite_neg: |
|
3386 |
assumes "summable f" |
|
3387 |
shows "(\<Sum>x. ereal (f x)) \<noteq> -\<infinity>" |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3388 |
by (simp add: assms suminf_ereal') |
60771 | 3389 |
|
60772 | 3390 |
lemma SUP_ereal_add_directed: |
3391 |
fixes f g :: "'a \<Rightarrow> ereal" |
|
3392 |
assumes nonneg: "\<And>i. i \<in> I \<Longrightarrow> 0 \<le> f i" "\<And>i. i \<in> I \<Longrightarrow> 0 \<le> g i" |
|
3393 |
assumes directed: "\<And>i j. i \<in> I \<Longrightarrow> j \<in> I \<Longrightarrow> \<exists>k\<in>I. f i + g j \<le> f k + g k" |
|
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
3394 |
shows "(SUP i\<in>I. f i + g i) = (SUP i\<in>I. f i) + (SUP i\<in>I. g i)" |
60772 | 3395 |
proof cases |
3396 |
assume "I = {}" then show ?thesis |
|
3397 |
by (simp add: bot_ereal_def) |
|
3398 |
next |
|
3399 |
assume "I \<noteq> {}" |
|
3400 |
show ?thesis |
|
3401 |
proof (rule antisym) |
|
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
3402 |
show "(SUP i\<in>I. f i + g i) \<le> (SUP i\<in>I. f i) + (SUP i\<in>I. g i)" |
68752 | 3403 |
by (rule SUP_least; intro add_mono SUP_upper) |
60772 | 3404 |
next |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
3405 |
have "bot < (SUP i\<in>I. g i)" |
60772 | 3406 |
using \<open>I \<noteq> {}\<close> nonneg(2) by (auto simp: bot_ereal_def less_SUP_iff) |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
3407 |
then have "(SUP i\<in>I. f i) + (SUP i\<in>I. g i) = (SUP i\<in>I. f i + (SUP i\<in>I. g i))" |
60772 | 3408 |
by (intro SUP_ereal_add_left[symmetric] \<open>I \<noteq> {}\<close>) auto |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
3409 |
also have "\<dots> = (SUP i\<in>I. (SUP j\<in>I. f i + g j))" |
69661 | 3410 |
using nonneg(1) \<open>I \<noteq> {}\<close> by (simp add: SUP_ereal_add_right) |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
3411 |
also have "\<dots> \<le> (SUP i\<in>I. f i + g i)" |
60772 | 3412 |
using directed by (intro SUP_least) (blast intro: SUP_upper2) |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
3413 |
finally show "(SUP i\<in>I. f i) + (SUP i\<in>I. g i) \<le> (SUP i\<in>I. f i + g i)" . |
60772 | 3414 |
qed |
3415 |
qed |
|
3416 |
||
64267 | 3417 |
lemma SUP_ereal_sum_directed: |
60772 | 3418 |
fixes f g :: "'a \<Rightarrow> 'b \<Rightarrow> ereal" |
3419 |
assumes "I \<noteq> {}" |
|
3420 |
assumes directed: "\<And>N i j. N \<subseteq> A \<Longrightarrow> i \<in> I \<Longrightarrow> j \<in> I \<Longrightarrow> \<exists>k\<in>I. \<forall>n\<in>N. f n i \<le> f n k \<and> f n j \<le> f n k" |
|
3421 |
assumes nonneg: "\<And>n i. i \<in> I \<Longrightarrow> n \<in> A \<Longrightarrow> 0 \<le> f n i" |
|
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
3422 |
shows "(SUP i\<in>I. \<Sum>n\<in>A. f n i) = (\<Sum>n\<in>A. SUP i\<in>I. f n i)" |
60772 | 3423 |
proof - |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
3424 |
have "N \<subseteq> A \<Longrightarrow> (SUP i\<in>I. \<Sum>n\<in>N. f n i) = (\<Sum>n\<in>N. SUP i\<in>I. f n i)" for N |
60772 | 3425 |
proof (induction N rule: infinite_finite_induct) |
3426 |
case (insert n N) |
|
74325 | 3427 |
have "(SUP i\<in>I. f n i + (\<Sum>l\<in>N. f l i)) = (SUP i\<in>I. f n i) + (SUP i\<in>I. \<Sum>l\<in>N. f l i)" |
60772 | 3428 |
proof (rule SUP_ereal_add_directed) |
3429 |
fix i assume "i \<in> I" then show "0 \<le> f n i" "0 \<le> (\<Sum>l\<in>N. f l i)" |
|
64267 | 3430 |
using insert by (auto intro!: sum_nonneg nonneg) |
60772 | 3431 |
next |
3432 |
fix i j assume "i \<in> I" "j \<in> I" |
|
74325 | 3433 |
from directed[OF insert(4) this] |
3434 |
show "\<exists>k\<in>I. f n i + (\<Sum>l\<in>N. f l j) \<le> f n k + (\<Sum>l\<in>N. f l k)" |
|
3435 |
by (auto intro!: add_mono sum_mono) |
|
60772 | 3436 |
qed |
74325 | 3437 |
with insert show ?case |
60772 | 3438 |
by simp |
3439 |
qed (simp_all add: SUP_constant \<open>I \<noteq> {}\<close>) |
|
3440 |
from this[of A] show ?thesis by simp |
|
3441 |
qed |
|
3442 |
||
3443 |
lemma suminf_SUP_eq_directed: |
|
3444 |
fixes f :: "_ \<Rightarrow> nat \<Rightarrow> ereal" |
|
3445 |
assumes "I \<noteq> {}" |
|
3446 |
assumes directed: "\<And>N i j. i \<in> I \<Longrightarrow> j \<in> I \<Longrightarrow> finite N \<Longrightarrow> \<exists>k\<in>I. \<forall>n\<in>N. f i n \<le> f k n \<and> f j n \<le> f k n" |
|
3447 |
assumes nonneg: "\<And>n i. 0 \<le> f n i" |
|
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
3448 |
shows "(\<Sum>i. SUP n\<in>I. f n i) = (SUP n\<in>I. \<Sum>i. f n i)" |
60772 | 3449 |
proof (subst (1 2) suminf_ereal_eq_SUP) |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
3450 |
show "\<And>n i. 0 \<le> f n i" "\<And>i. 0 \<le> (SUP n\<in>I. f n i)" |
60772 | 3451 |
using \<open>I \<noteq> {}\<close> nonneg by (auto intro: SUP_upper2) |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
3452 |
show "(SUP n. \<Sum>i<n. SUP n\<in>I. f n i) = (SUP n\<in>I. SUP j. \<Sum>i<j. f n i)" |
72236 | 3453 |
by (auto simp: finite_subset SUP_commute SUP_ereal_sum_directed assms) |
60772 | 3454 |
qed |
3455 |
||
60771 | 3456 |
lemma ereal_dense3: |
3457 |
fixes x y :: ereal |
|
3458 |
shows "x < y \<Longrightarrow> \<exists>r::rat. x < real_of_rat r \<and> real_of_rat r < y" |
|
3459 |
proof (cases x y rule: ereal2_cases, simp_all) |
|
3460 |
fix r q :: real |
|
3461 |
assume "r < q" |
|
3462 |
from Rats_dense_in_real[OF this] show "\<exists>x. r < real_of_rat x \<and> real_of_rat x < q" |
|
3463 |
by (fastforce simp: Rats_def) |
|
3464 |
next |
|
3465 |
fix r :: real |
|
3466 |
show "\<exists>x. r < real_of_rat x" "\<exists>x. real_of_rat x < r" |
|
3467 |
using gt_ex[of r] lt_ex[of r] Rats_dense_in_real |
|
3468 |
by (auto simp: Rats_def) |
|
3469 |
qed |
|
3470 |
||
3471 |
lemma continuous_within_ereal[intro, simp]: "x \<in> A \<Longrightarrow> continuous (at x within A) ereal" |
|
3472 |
using continuous_on_eq_continuous_within[of A ereal] |
|
3473 |
by (auto intro: continuous_on_ereal continuous_on_id) |
|
3474 |
||
3475 |
lemma ereal_open_uminus: |
|
3476 |
fixes S :: "ereal set" |
|
3477 |
assumes "open S" |
|
3478 |
shows "open (uminus ` S)" |
|
3479 |
using \<open>open S\<close>[unfolded open_generated_order] |
|
3480 |
proof induct |
|
3481 |
have "range uminus = (UNIV :: ereal set)" |
|
3482 |
by (auto simp: image_iff ereal_uminus_eq_reorder) |
|
3483 |
then show "open (range uminus :: ereal set)" |
|
3484 |
by simp |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3485 |
qed (auto simp: image_Union image_Int) |
60771 | 3486 |
|
3487 |
lemma ereal_uminus_complement: |
|
3488 |
fixes S :: "ereal set" |
|
3489 |
shows "uminus ` (- S) = - uminus ` S" |
|
3490 |
by (auto intro!: bij_image_Compl_eq surjI[of _ uminus] simp: bij_betw_def) |
|
3491 |
||
3492 |
lemma ereal_closed_uminus: |
|
3493 |
fixes S :: "ereal set" |
|
3494 |
assumes "closed S" |
|
3495 |
shows "closed (uminus ` S)" |
|
3496 |
using assms |
|
3497 |
unfolding closed_def ereal_uminus_complement[symmetric] |
|
3498 |
by (rule ereal_open_uminus) |
|
3499 |
||
3500 |
lemma ereal_open_affinity_pos: |
|
3501 |
fixes S :: "ereal set" |
|
3502 |
assumes "open S" |
|
3503 |
and m: "m \<noteq> \<infinity>" "0 < m" |
|
3504 |
and t: "\<bar>t\<bar> \<noteq> \<infinity>" |
|
3505 |
shows "open ((\<lambda>x. m * x + t) ` S)" |
|
3506 |
proof - |
|
72236 | 3507 |
have "continuous_on UNIV (\<lambda>x. inverse m * (x + - t))" |
60771 | 3508 |
using m t |
72236 | 3509 |
by (intro continuous_at_imp_continuous_on ballI continuous_at[THEN iffD2]; force) |
3510 |
then have "open ((\<lambda>x. inverse m * (x + -t)) -` S)" |
|
3511 |
using \<open>open S\<close> open_vimage by blast |
|
60771 | 3512 |
also have "(\<lambda>x. inverse m * (x + -t)) -` S = (\<lambda>x. (x - t) / m) -` S" |
68406 | 3513 |
using m t by (auto simp: divide_ereal_def mult.commute minus_ereal_def |
3514 |
simp flip: uminus_ereal.simps) |
|
60771 | 3515 |
also have "(\<lambda>x. (x - t) / m) -` S = (\<lambda>x. m * x + t) ` S" |
3516 |
using m t |
|
3517 |
by (simp add: set_eq_iff image_iff) |
|
3518 |
(metis abs_ereal_less0 abs_ereal_uminus ereal_divide_eq ereal_eq_minus ereal_minus(7,8) |
|
3519 |
ereal_minus_less_minus ereal_mult_eq_PInfty ereal_uminus_uminus ereal_zero_mult) |
|
3520 |
finally show ?thesis . |
|
3521 |
qed |
|
3522 |
||
3523 |
lemma ereal_open_affinity: |
|
3524 |
fixes S :: "ereal set" |
|
3525 |
assumes "open S" |
|
3526 |
and m: "\<bar>m\<bar> \<noteq> \<infinity>" "m \<noteq> 0" |
|
3527 |
and t: "\<bar>t\<bar> \<noteq> \<infinity>" |
|
3528 |
shows "open ((\<lambda>x. m * x + t) ` S)" |
|
3529 |
proof cases |
|
3530 |
assume "0 < m" |
|
3531 |
then show ?thesis |
|
3532 |
using ereal_open_affinity_pos[OF \<open>open S\<close> _ _ t, of m] m |
|
3533 |
by auto |
|
3534 |
next |
|
3535 |
assume "\<not> 0 < m" then |
|
3536 |
have "0 < -m" |
|
3537 |
using \<open>m \<noteq> 0\<close> |
|
3538 |
by (cases m) auto |
|
3539 |
then have m: "-m \<noteq> \<infinity>" "0 < -m" |
|
3540 |
using \<open>\<bar>m\<bar> \<noteq> \<infinity>\<close> |
|
3541 |
by (auto simp: ereal_uminus_eq_reorder) |
|
3542 |
from ereal_open_affinity_pos[OF ereal_open_uminus[OF \<open>open S\<close>] m t] show ?thesis |
|
3543 |
unfolding image_image by simp |
|
3544 |
qed |
|
3545 |
||
3546 |
lemma open_uminus_iff: |
|
3547 |
fixes S :: "ereal set" |
|
3548 |
shows "open (uminus ` S) \<longleftrightarrow> open S" |
|
3549 |
using ereal_open_uminus[of S] ereal_open_uminus[of "uminus ` S"] |
|
3550 |
by auto |
|
3551 |
||
3552 |
lemma ereal_Liminf_uminus: |
|
3553 |
fixes f :: "'a \<Rightarrow> ereal" |
|
3554 |
shows "Liminf net (\<lambda>x. - (f x)) = - Limsup net f" |
|
3555 |
using ereal_Limsup_uminus[of _ "(\<lambda>x. - (f x))"] by auto |
|
3556 |
||
3557 |
lemma Liminf_PInfty: |
|
3558 |
fixes f :: "'a \<Rightarrow> ereal" |
|
3559 |
assumes "\<not> trivial_limit net" |
|
61973 | 3560 |
shows "(f \<longlongrightarrow> \<infinity>) net \<longleftrightarrow> Liminf net f = \<infinity>" |
60771 | 3561 |
unfolding tendsto_iff_Liminf_eq_Limsup[OF assms] |
3562 |
using Liminf_le_Limsup[OF assms, of f] |
|
3563 |
by auto |
|
3564 |
||
3565 |
lemma Limsup_MInfty: |
|
3566 |
fixes f :: "'a \<Rightarrow> ereal" |
|
3567 |
assumes "\<not> trivial_limit net" |
|
61973 | 3568 |
shows "(f \<longlongrightarrow> -\<infinity>) net \<longleftrightarrow> Limsup net f = -\<infinity>" |
60771 | 3569 |
unfolding tendsto_iff_Liminf_eq_Limsup[OF assms] |
3570 |
using Liminf_le_Limsup[OF assms, of f] |
|
3571 |
by auto |
|
3572 |
||
63145 | 3573 |
lemma convergent_ereal: \<comment> \<open>RENAME\<close> |
60771 | 3574 |
fixes X :: "nat \<Rightarrow> 'a :: {complete_linorder,linorder_topology}" |
3575 |
shows "convergent X \<longleftrightarrow> limsup X = liminf X" |
|
3576 |
using tendsto_iff_Liminf_eq_Limsup[of sequentially] |
|
3577 |
by (auto simp: convergent_def) |
|
3578 |
||
3579 |
lemma limsup_le_liminf_real: |
|
3580 |
fixes X :: "nat \<Rightarrow> real" and L :: real |
|
3581 |
assumes 1: "limsup X \<le> L" and 2: "L \<le> liminf X" |
|
61969 | 3582 |
shows "X \<longlonglongrightarrow> L" |
60771 | 3583 |
proof - |
3584 |
from 1 2 have "limsup X \<le> liminf X" by auto |
|
61738
c4f6031f1310
New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents:
61631
diff
changeset
|
3585 |
hence 3: "limsup X = liminf X" |
72236 | 3586 |
by (simp add: Liminf_le_Limsup order_class.order.antisym) |
60771 | 3587 |
hence 4: "convergent (\<lambda>n. ereal (X n))" |
3588 |
by (subst convergent_ereal) |
|
3589 |
hence "limsup X = lim (\<lambda>n. ereal(X n))" |
|
3590 |
by (rule convergent_limsup_cl) |
|
3591 |
also from 1 2 3 have "limsup X = L" by auto |
|
3592 |
finally have "lim (\<lambda>n. ereal(X n)) = L" .. |
|
61969 | 3593 |
hence "(\<lambda>n. ereal (X n)) \<longlonglongrightarrow> L" |
72236 | 3594 |
using "4" convergent_LIMSEQ_iff by force |
60771 | 3595 |
thus ?thesis by simp |
3596 |
qed |
|
3597 |
||
3598 |
lemma liminf_PInfty: |
|
3599 |
fixes X :: "nat \<Rightarrow> ereal" |
|
61969 | 3600 |
shows "X \<longlonglongrightarrow> \<infinity> \<longleftrightarrow> liminf X = \<infinity>" |
60771 | 3601 |
by (metis Liminf_PInfty trivial_limit_sequentially) |
3602 |
||
3603 |
lemma limsup_MInfty: |
|
3604 |
fixes X :: "nat \<Rightarrow> ereal" |
|
61969 | 3605 |
shows "X \<longlonglongrightarrow> -\<infinity> \<longleftrightarrow> limsup X = -\<infinity>" |
60771 | 3606 |
by (metis Limsup_MInfty trivial_limit_sequentially) |
3607 |
||
3608 |
lemma SUP_eq_LIMSEQ: |
|
3609 |
assumes "mono f" |
|
61969 | 3610 |
shows "(SUP n. ereal (f n)) = ereal x \<longleftrightarrow> f \<longlonglongrightarrow> x" |
60771 | 3611 |
proof |
3612 |
have inc: "incseq (\<lambda>i. ereal (f i))" |
|
3613 |
using \<open>mono f\<close> unfolding mono_def incseq_def by auto |
|
3614 |
{ |
|
61969 | 3615 |
assume "f \<longlonglongrightarrow> x" |
3616 |
then have "(\<lambda>i. ereal (f i)) \<longlonglongrightarrow> ereal x" |
|
60771 | 3617 |
by auto |
68532
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents:
68484
diff
changeset
|
3618 |
from SUP_Lim[OF inc this] show "(SUP n. ereal (f n)) = ereal x" . |
60771 | 3619 |
next |
3620 |
assume "(SUP n. ereal (f n)) = ereal x" |
|
61969 | 3621 |
with LIMSEQ_SUP[OF inc] show "f \<longlonglongrightarrow> x" by auto |
60771 | 3622 |
} |
3623 |
qed |
|
3624 |
||
3625 |
lemma liminf_ereal_cminus: |
|
3626 |
fixes f :: "nat \<Rightarrow> ereal" |
|
3627 |
assumes "c \<noteq> -\<infinity>" |
|
3628 |
shows "liminf (\<lambda>x. c - f x) = c - limsup f" |
|
3629 |
proof (cases c) |
|
3630 |
case PInf |
|
3631 |
then show ?thesis |
|
3632 |
by (simp add: Liminf_const) |
|
3633 |
next |
|
3634 |
case (real r) |
|
3635 |
then show ?thesis |
|
72236 | 3636 |
by (simp add: liminf_SUP_INF limsup_INF_SUP INF_ereal_minus_right SUP_ereal_minus_right) |
3637 |
qed (use \<open>c \<noteq> -\<infinity>\<close> in simp) |
|
60771 | 3638 |
|
3639 |
||
3640 |
subsubsection \<open>Continuity\<close> |
|
3641 |
||
3642 |
lemma continuous_at_of_ereal: |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
3643 |
"\<bar>x0 :: ereal\<bar> \<noteq> \<infinity> \<Longrightarrow> continuous (at x0) real_of_ereal" |
60771 | 3644 |
unfolding continuous_at |
3645 |
by (rule lim_real_of_ereal) (simp add: ereal_real) |
|
3646 |
||
3647 |
lemma nhds_ereal: "nhds (ereal r) = filtermap ereal (nhds r)" |
|
3648 |
by (simp add: filtermap_nhds_open_map open_ereal continuous_at_of_ereal) |
|
3649 |
||
3650 |
lemma at_ereal: "at (ereal r) = filtermap ereal (at r)" |
|
3651 |
by (simp add: filter_eq_iff eventually_at_filter nhds_ereal eventually_filtermap) |
|
3652 |
||
3653 |
lemma at_left_ereal: "at_left (ereal r) = filtermap ereal (at_left r)" |
|
3654 |
by (simp add: filter_eq_iff eventually_at_filter nhds_ereal eventually_filtermap) |
|
3655 |
||
3656 |
lemma at_right_ereal: "at_right (ereal r) = filtermap ereal (at_right r)" |
|
3657 |
by (simp add: filter_eq_iff eventually_at_filter nhds_ereal eventually_filtermap) |
|
3658 |
||
3659 |
lemma |
|
3660 |
shows at_left_PInf: "at_left \<infinity> = filtermap ereal at_top" |
|
3661 |
and at_right_MInf: "at_right (-\<infinity>) = filtermap ereal at_bot" |
|
3662 |
unfolding filter_eq_iff eventually_filtermap eventually_at_top_dense eventually_at_bot_dense |
|
3663 |
eventually_at_left[OF ereal_less(5)] eventually_at_right[OF ereal_less(6)] |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3664 |
by (auto simp: ereal_all_split ereal_ex_split) |
60771 | 3665 |
|
3666 |
lemma ereal_tendsto_simps1: |
|
61973 | 3667 |
"((f \<circ> real_of_ereal) \<longlongrightarrow> y) (at_left (ereal x)) \<longleftrightarrow> (f \<longlongrightarrow> y) (at_left x)" |
3668 |
"((f \<circ> real_of_ereal) \<longlongrightarrow> y) (at_right (ereal x)) \<longleftrightarrow> (f \<longlongrightarrow> y) (at_right x)" |
|
3669 |
"((f \<circ> real_of_ereal) \<longlongrightarrow> y) (at_left (\<infinity>::ereal)) \<longleftrightarrow> (f \<longlongrightarrow> y) at_top" |
|
3670 |
"((f \<circ> real_of_ereal) \<longlongrightarrow> y) (at_right (-\<infinity>::ereal)) \<longleftrightarrow> (f \<longlongrightarrow> y) at_bot" |
|
60771 | 3671 |
unfolding tendsto_compose_filtermap at_left_ereal at_right_ereal at_left_PInf at_right_MInf |
3672 |
by (auto simp: filtermap_filtermap filtermap_ident) |
|
3673 |
||
3674 |
lemma ereal_tendsto_simps2: |
|
61973 | 3675 |
"((ereal \<circ> f) \<longlongrightarrow> ereal a) F \<longleftrightarrow> (f \<longlongrightarrow> a) F" |
3676 |
"((ereal \<circ> f) \<longlongrightarrow> \<infinity>) F \<longleftrightarrow> (LIM x F. f x :> at_top)" |
|
3677 |
"((ereal \<circ> f) \<longlongrightarrow> -\<infinity>) F \<longleftrightarrow> (LIM x F. f x :> at_bot)" |
|
60771 | 3678 |
unfolding tendsto_PInfty filterlim_at_top_dense tendsto_MInfty filterlim_at_bot_dense |
3679 |
using lim_ereal by (simp_all add: comp_def) |
|
3680 |
||
61976 | 3681 |
lemma inverse_infty_ereal_tendsto_0: "inverse \<midarrow>\<infinity>\<rightarrow> (0::ereal)" |
61245 | 3682 |
proof - |
61973 | 3683 |
have **: "((\<lambda>x. ereal (inverse x)) \<longlongrightarrow> ereal 0) at_infinity" |
61245 | 3684 |
by (intro tendsto_intros tendsto_inverse_0) |
72220 | 3685 |
then have "((\<lambda>x. if x = 0 then \<infinity> else ereal (inverse x)) \<longlongrightarrow> 0) at_top" |
3686 |
proof (rule filterlim_mono_eventually) |
|
3687 |
show "nhds (ereal 0) \<le> nhds 0" |
|
3688 |
by (simp add: zero_ereal_def) |
|
3689 |
show "(at_top::real filter) \<le> at_infinity" |
|
3690 |
by (simp add: at_top_le_at_infinity) |
|
3691 |
qed auto |
|
3692 |
then show ?thesis |
|
3693 |
unfolding at_infty_ereal_eq_at_top tendsto_compose_filtermap[symmetric] comp_def by auto |
|
61245 | 3694 |
qed |
3695 |
||
61738
c4f6031f1310
New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents:
61631
diff
changeset
|
3696 |
lemma inverse_ereal_tendsto_pos: |
61245 | 3697 |
fixes x :: ereal assumes "0 < x" |
61976 | 3698 |
shows "inverse \<midarrow>x\<rightarrow> inverse x" |
61245 | 3699 |
proof (cases x) |
3700 |
case (real r) |
|
61976 | 3701 |
with \<open>0 < x\<close> have **: "(\<lambda>x. ereal (inverse x)) \<midarrow>r\<rightarrow> ereal (inverse r)" |
61245 | 3702 |
by (auto intro!: tendsto_inverse) |
3703 |
from real \<open>0 < x\<close> show ?thesis |
|
3704 |
by (auto simp: at_ereal tendsto_compose_filtermap[symmetric] eventually_at_filter |
|
70532
fcf3b891ccb1
new material; rotated premises of Lim_transform_eventually
paulson <lp15@cam.ac.uk>
parents:
70367
diff
changeset
|
3705 |
intro!: Lim_transform_eventually[OF **] t1_space_nhds) |
61245 | 3706 |
qed (insert \<open>0 < x\<close>, auto intro!: inverse_infty_ereal_tendsto_0) |
3707 |
||
61973 | 3708 |
lemma inverse_ereal_tendsto_at_right_0: "(inverse \<longlongrightarrow> \<infinity>) (at_right (0::ereal))" |
61245 | 3709 |
unfolding tendsto_compose_filtermap[symmetric] at_right_ereal zero_ereal_def |
3710 |
by (subst filterlim_cong[OF refl refl, where g="\<lambda>x. ereal (inverse x)"]) |
|
3711 |
(auto simp: eventually_at_filter tendsto_PInfty_eq_at_top filterlim_inverse_at_top_right) |
|
3712 |
||
60771 | 3713 |
lemmas ereal_tendsto_simps = ereal_tendsto_simps1 ereal_tendsto_simps2 |
3714 |
||
3715 |
lemma continuous_at_iff_ereal: |
|
3716 |
fixes f :: "'a::t2_space \<Rightarrow> real" |
|
3717 |
shows "continuous (at x0 within s) f \<longleftrightarrow> continuous (at x0 within s) (ereal \<circ> f)" |
|
3718 |
unfolding continuous_within comp_def lim_ereal .. |
|
3719 |
||
3720 |
lemma continuous_on_iff_ereal: |
|
3721 |
fixes f :: "'a::t2_space => real" |
|
3722 |
assumes "open A" |
|
3723 |
shows "continuous_on A f \<longleftrightarrow> continuous_on A (ereal \<circ> f)" |
|
3724 |
unfolding continuous_on_def comp_def lim_ereal .. |
|
3725 |
||
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
3726 |
lemma continuous_on_real: "continuous_on (UNIV - {\<infinity>, -\<infinity>::ereal}) real_of_ereal" |
60771 | 3727 |
using continuous_at_of_ereal continuous_on_eq_continuous_at open_image_ereal |
3728 |
by auto |
|
3729 |
||
3730 |
lemma continuous_on_iff_real: |
|
3731 |
fixes f :: "'a::t2_space \<Rightarrow> ereal" |
|
72236 | 3732 |
assumes "\<And>x. x \<in> A \<Longrightarrow> \<bar>f x\<bar> \<noteq> \<infinity>" |
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
3733 |
shows "continuous_on A f \<longleftrightarrow> continuous_on A (real_of_ereal \<circ> f)" |
81332 | 3734 |
proof |
72236 | 3735 |
assume L: "continuous_on A f" |
60771 | 3736 |
have "f ` A \<subseteq> UNIV - {\<infinity>, -\<infinity>}" |
3737 |
using assms by force |
|
72236 | 3738 |
then show "continuous_on A (real_of_ereal \<circ> f)" |
3739 |
by (meson L continuous_on_compose continuous_on_real continuous_on_subset) |
|
3740 |
next |
|
3741 |
assume R: "continuous_on A (real_of_ereal \<circ> f)" |
|
3742 |
then have "continuous_on A (ereal \<circ> (real_of_ereal \<circ> f))" |
|
3743 |
by (meson continuous_at_iff_ereal continuous_on_eq_continuous_within) |
|
3744 |
then show "continuous_on A f" |
|
81332 | 3745 |
using assms ereal_real' by auto |
60771 | 3746 |
qed |
3747 |
||
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3748 |
lemma continuous_uminus_ereal [continuous_intros]: "continuous_on (A :: ereal set) uminus" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3749 |
unfolding continuous_on_def |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3750 |
by (intro ballI tendsto_uminus_ereal[of "\<lambda>x. x::ereal"]) simp |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3751 |
|
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3752 |
lemma ereal_uminus_atMost [simp]: "uminus ` {..(a::ereal)} = {-a..}" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3753 |
proof (intro equalityI subsetI) |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3754 |
fix x :: ereal assume "x \<in> {-a..}" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3755 |
hence "-(-x) \<in> uminus ` {..a}" by (intro imageI) (simp add: ereal_uminus_le_reorder) |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3756 |
thus "x \<in> uminus ` {..a}" by simp |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3757 |
qed auto |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3758 |
|
62369 | 3759 |
lemma continuous_on_inverse_ereal [continuous_intros]: |
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3760 |
"continuous_on {0::ereal ..} inverse" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3761 |
unfolding continuous_on_def |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3762 |
proof clarsimp |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3763 |
fix x :: ereal assume "0 \<le> x" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3764 |
moreover have "at 0 within {0 ..} = at_right (0::ereal)" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3765 |
by (auto simp: filter_eq_iff eventually_at_filter le_less) |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3766 |
moreover have "at x within {0 ..} = at x" if "0 < x" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3767 |
using that by (intro at_within_nhd[of _ "{0<..}"]) auto |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3768 |
ultimately show "(inverse \<longlongrightarrow> inverse x) (at x within {0..})" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3769 |
by (auto simp: le_less inverse_ereal_tendsto_at_right_0 inverse_ereal_tendsto_pos) |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3770 |
qed |
62369 | 3771 |
|
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3772 |
lemma continuous_inverse_ereal_nonpos: "continuous_on ({..<0} :: ereal set) inverse" |
62369 | 3773 |
proof (subst continuous_on_cong[OF refl]) |
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3774 |
have "continuous_on {(0::ereal)<..} inverse" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3775 |
by (rule continuous_on_subset[OF continuous_on_inverse_ereal]) auto |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3776 |
thus "continuous_on {..<(0::ereal)} (uminus \<circ> inverse \<circ> uminus)" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3777 |
by (intro continuous_intros) simp_all |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3778 |
qed simp |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3779 |
|
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3780 |
lemma tendsto_inverse_ereal: |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3781 |
assumes "(f \<longlongrightarrow> (c :: ereal)) F" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3782 |
assumes "eventually (\<lambda>x. f x \<ge> 0) F" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3783 |
shows "((\<lambda>x. inverse (f x)) \<longlongrightarrow> inverse c) F" |
62369 | 3784 |
by (cases "F = bot") |
63952
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents:
63940
diff
changeset
|
3785 |
(auto intro!: tendsto_lowerbound assms |
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3786 |
continuous_on_tendsto_compose[OF continuous_on_inverse_ereal]) |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3787 |
|
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3788 |
|
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3789 |
subsubsection \<open>liminf and limsup\<close> |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3790 |
|
62369 | 3791 |
lemma Limsup_ereal_mult_right: |
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3792 |
assumes "F \<noteq> bot" "(c::real) \<ge> 0" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3793 |
shows "Limsup F (\<lambda>n. f n * ereal c) = Limsup F f * ereal c" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3794 |
proof (rule Limsup_compose_continuous_mono) |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3795 |
from assms show "continuous_on UNIV (\<lambda>a. a * ereal c)" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3796 |
using tendsto_cmult_ereal[of "ereal c" "\<lambda>x. x" ] |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3797 |
by (force simp: continuous_on_def mult_ac) |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3798 |
qed (use assms in \<open>auto simp: mono_def ereal_mult_right_mono\<close>) |
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3799 |
|
62369 | 3800 |
lemma Liminf_ereal_mult_right: |
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3801 |
assumes "F \<noteq> bot" "(c::real) \<ge> 0" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3802 |
shows "Liminf F (\<lambda>n. f n * ereal c) = Liminf F f * ereal c" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3803 |
proof (rule Liminf_compose_continuous_mono) |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3804 |
from assms show "continuous_on UNIV (\<lambda>a. a * ereal c)" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3805 |
using tendsto_cmult_ereal[of "ereal c" "\<lambda>x. x" ] |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3806 |
by (force simp: continuous_on_def mult_ac) |
72236 | 3807 |
qed (use assms in \<open>auto simp: mono_def ereal_mult_right_mono\<close>) |
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3808 |
|
70724 | 3809 |
lemma Liminf_ereal_mult_left: |
3810 |
assumes "F \<noteq> bot" "(c::real) \<ge> 0" |
|
3811 |
shows "Liminf F (\<lambda>n. ereal c * f n) = ereal c * Liminf F f" |
|
3812 |
using Liminf_ereal_mult_right[OF assms] by (subst (1 2) mult.commute) |
|
3813 |
||
62369 | 3814 |
lemma Limsup_ereal_mult_left: |
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3815 |
assumes "F \<noteq> bot" "(c::real) \<ge> 0" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3816 |
shows "Limsup F (\<lambda>n. ereal c * f n) = ereal c * Limsup F f" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3817 |
using Limsup_ereal_mult_right[OF assms] by (subst (1 2) mult.commute) |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3818 |
|
62369 | 3819 |
lemma limsup_ereal_mult_right: |
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3820 |
"(c::real) \<ge> 0 \<Longrightarrow> limsup (\<lambda>n. f n * ereal c) = limsup f * ereal c" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3821 |
by (rule Limsup_ereal_mult_right) simp_all |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3822 |
|
62369 | 3823 |
lemma limsup_ereal_mult_left: |
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3824 |
"(c::real) \<ge> 0 \<Longrightarrow> limsup (\<lambda>n. ereal c * f n) = ereal c * limsup f" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3825 |
by (simp add: Limsup_ereal_mult_left) |
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3826 |
|
62369 | 3827 |
lemma Limsup_add_ereal_right: |
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3828 |
"F \<noteq> bot \<Longrightarrow> abs c \<noteq> \<infinity> \<Longrightarrow> Limsup F (\<lambda>n. g n + (c :: ereal)) = Limsup F g + c" |
68752 | 3829 |
by (rule Limsup_compose_continuous_mono) (auto simp: mono_def add_mono continuous_on_def) |
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3830 |
|
62369 | 3831 |
lemma Limsup_add_ereal_left: |
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3832 |
"F \<noteq> bot \<Longrightarrow> abs c \<noteq> \<infinity> \<Longrightarrow> Limsup F (\<lambda>n. (c :: ereal) + g n) = c + Limsup F g" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3833 |
by (subst (1 2) add.commute) (rule Limsup_add_ereal_right) |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3834 |
|
62369 | 3835 |
lemma Liminf_add_ereal_right: |
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3836 |
"F \<noteq> bot \<Longrightarrow> abs c \<noteq> \<infinity> \<Longrightarrow> Liminf F (\<lambda>n. g n + (c :: ereal)) = Liminf F g + c" |
68752 | 3837 |
by (rule Liminf_compose_continuous_mono) (auto simp: mono_def add_mono continuous_on_def) |
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3838 |
|
62369 | 3839 |
lemma Liminf_add_ereal_left: |
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3840 |
"F \<noteq> bot \<Longrightarrow> abs c \<noteq> \<infinity> \<Longrightarrow> Liminf F (\<lambda>n. (c :: ereal) + g n) = c + Liminf F g" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3841 |
by (subst (1 2) add.commute) (rule Liminf_add_ereal_right) |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3842 |
|
62369 | 3843 |
lemma |
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3844 |
assumes "F \<noteq> bot" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3845 |
assumes nonneg: "eventually (\<lambda>x. f x \<ge> (0::ereal)) F" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3846 |
shows Liminf_inverse_ereal: "Liminf F (\<lambda>x. inverse (f x)) = inverse (Limsup F f)" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3847 |
and Limsup_inverse_ereal: "Limsup F (\<lambda>x. inverse (f x)) = inverse (Liminf F f)" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3848 |
proof - |
63040 | 3849 |
define inv where [abs_def]: "inv x = (if x \<le> 0 then \<infinity> else inverse x)" for x :: ereal |
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3850 |
have "continuous_on ({..0} \<union> {0..}) inv" unfolding inv_def |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3851 |
by (intro continuous_on_If) (auto intro!: continuous_intros) |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3852 |
also have "{..0} \<union> {0..} = (UNIV :: ereal set)" by auto |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3853 |
finally have cont: "continuous_on UNIV inv" . |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3854 |
have antimono: "antimono inv" unfolding inv_def antimono_def |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3855 |
by (auto intro!: ereal_inverse_antimono) |
62369 | 3856 |
|
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3857 |
have "Liminf F (\<lambda>x. inverse (f x)) = Liminf F (\<lambda>x. inv (f x))" using nonneg |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3858 |
by (auto intro!: Liminf_eq elim!: eventually_mono simp: inv_def) |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3859 |
also have "... = inv (Limsup F f)" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3860 |
by (simp add: assms(1) Liminf_compose_continuous_antimono[OF cont antimono]) |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3861 |
also from assms have "Limsup F f \<ge> 0" by (intro le_Limsup) simp_all |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3862 |
hence "inv (Limsup F f) = inverse (Limsup F f)" by (simp add: inv_def) |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3863 |
finally show "Liminf F (\<lambda>x. inverse (f x)) = inverse (Limsup F f)" . |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3864 |
|
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3865 |
have "Limsup F (\<lambda>x. inverse (f x)) = Limsup F (\<lambda>x. inv (f x))" using nonneg |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3866 |
by (auto intro!: Limsup_eq elim!: eventually_mono simp: inv_def) |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3867 |
also have "... = inv (Liminf F f)" |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3868 |
by (simp add: assms(1) Limsup_compose_continuous_antimono[OF cont antimono]) |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3869 |
also from assms have "Liminf F f \<ge> 0" by (intro Liminf_bounded) simp_all |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3870 |
hence "inv (Liminf F f) = inverse (Liminf F f)" by (simp add: inv_def) |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3871 |
finally show "Limsup F (\<lambda>x. inverse (f x)) = inverse (Liminf F f)" . |
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
3872 |
qed |
60771 | 3873 |
|
63225
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3874 |
lemma ereal_diff_le_mono_left: "\<lbrakk> x \<le> z; 0 \<le> y \<rbrakk> \<Longrightarrow> x - y \<le> (z :: ereal)" |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3875 |
by(cases x y z rule: ereal3_cases) simp_all |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3876 |
|
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3877 |
lemma neg_0_less_iff_less_erea [simp]: "0 < - a \<longleftrightarrow> (a :: ereal) < 0" |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3878 |
by(cases a) simp_all |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3879 |
|
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3880 |
lemma not_infty_ereal: "\<bar>x\<bar> \<noteq> \<infinity> \<longleftrightarrow> (\<exists>x'. x = ereal x')" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3881 |
by auto |
63225
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3882 |
|
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3883 |
lemma neq_PInf_trans: fixes x y :: ereal shows "\<lbrakk> y \<noteq> \<infinity>; x \<le> y \<rbrakk> \<Longrightarrow> x \<noteq> \<infinity>" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3884 |
by auto |
63225
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3885 |
|
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3886 |
lemma mult_2_ereal: "ereal 2 * x = x + x" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3887 |
by(cases x) simp_all |
63225
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3888 |
|
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3889 |
lemma ereal_diff_le_self: "0 \<le> y \<Longrightarrow> x - y \<le> (x :: ereal)" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3890 |
by(cases x y rule: ereal2_cases) simp_all |
63225
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3891 |
|
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3892 |
lemma ereal_le_add_self: "0 \<le> y \<Longrightarrow> x \<le> x + (y :: ereal)" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3893 |
by(cases x y rule: ereal2_cases) simp_all |
63225
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3894 |
|
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3895 |
lemma ereal_le_add_self2: "0 \<le> y \<Longrightarrow> x \<le> y + (x :: ereal)" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3896 |
by(cases x y rule: ereal2_cases) simp_all |
63225
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3897 |
|
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3898 |
lemma ereal_diff_nonpos: |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3899 |
fixes a b :: ereal shows "\<lbrakk> a \<le> b; a = \<infinity> \<Longrightarrow> b \<noteq> \<infinity>; a = -\<infinity> \<Longrightarrow> b \<noteq> -\<infinity> \<rbrakk> \<Longrightarrow> a - b \<le> 0" |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3900 |
by (cases rule: ereal2_cases[of a b]) auto |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3901 |
|
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3902 |
lemma minus_ereal_0 [simp]: "x - ereal 0 = x" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3903 |
by(simp flip: zero_ereal_def) |
63225
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3904 |
|
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3905 |
lemma ereal_diff_eq_0_iff: fixes a b :: ereal |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3906 |
shows "(\<bar>a\<bar> = \<infinity> \<Longrightarrow> \<bar>b\<bar> \<noteq> \<infinity>) \<Longrightarrow> a - b = 0 \<longleftrightarrow> a = b" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3907 |
by(cases a b rule: ereal2_cases) simp_all |
63225
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3908 |
|
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3909 |
lemma SUP_ereal_eq_0_iff_nonneg: |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3910 |
fixes f :: "_ \<Rightarrow> ereal" and A |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3911 |
assumes nonneg: "\<forall>x\<in>A. f x \<ge> 0" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3912 |
and A:"A \<noteq> {}" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3913 |
shows "(SUP x\<in>A. f x) = 0 \<longleftrightarrow> (\<forall>x\<in>A. f x = 0)" (is "?lhs \<longleftrightarrow> _") |
63225
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3914 |
proof(intro iffI ballI) |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3915 |
fix x |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3916 |
assume "?lhs" "x \<in> A" |
69260
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
haftmann
parents:
68752
diff
changeset
|
3917 |
from \<open>x \<in> A\<close> have "f x \<le> (SUP x\<in>A. f x)" by(rule SUP_upper) |
63225
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3918 |
with \<open>?lhs\<close> show "f x = 0" using nonneg \<open>x \<in> A\<close> by auto |
69661 | 3919 |
qed (simp add: A) |
63225
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3920 |
|
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3921 |
lemma ereal_divide_le_posI: |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3922 |
fixes x y z :: ereal |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3923 |
shows "x > 0 \<Longrightarrow> z \<noteq> -\<infinity> \<Longrightarrow> z \<le> x * y \<Longrightarrow> z / x \<le> y" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3924 |
by (cases rule: ereal3_cases[of x y z])(auto simp: field_simps split: if_split_asm) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3925 |
|
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3926 |
lemma add_diff_eq_ereal: |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3927 |
fixes x y z :: ereal |
63225
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3928 |
shows "x + (y - z) = x + y - z" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3929 |
by(cases x y z rule: ereal3_cases) simp_all |
63225
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3930 |
|
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3931 |
lemma ereal_diff_gr0: |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3932 |
fixes a b :: ereal |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3933 |
shows "a < b \<Longrightarrow> 0 < b - a" |
63225
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3934 |
by (cases rule: ereal2_cases[of a b]) auto |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3935 |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3936 |
lemma ereal_minus_minus: |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3937 |
fixes x y z :: ereal shows |
63225
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3938 |
"(\<bar>y\<bar> = \<infinity> \<Longrightarrow> \<bar>z\<bar> \<noteq> \<infinity>) \<Longrightarrow> x - (y - z) = x + z - y" |
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3939 |
by(cases x y z rule: ereal3_cases) simp_all |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3940 |
|
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3941 |
lemma diff_diff_commute_ereal: |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3942 |
fixes x y z :: ereal |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3943 |
shows "x - y - z = x - z - y" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3944 |
by (metis add_diff_eq_ereal ereal_add_uminus_conv_diff) |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3945 |
|
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3946 |
lemma ereal_diff_eq_MInfty_iff: |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3947 |
fixes x y :: ereal |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3948 |
shows "x - y = -\<infinity> \<longleftrightarrow> x = -\<infinity> \<and> y \<noteq> -\<infinity> \<or> y = \<infinity> \<and> \<bar>x\<bar> \<noteq> \<infinity>" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3949 |
by(cases x y rule: ereal2_cases) simp_all |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3950 |
|
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3951 |
lemma ereal_diff_add_inverse: |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3952 |
fixes x y :: ereal |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3953 |
shows "\<bar>x\<bar> \<noteq> \<infinity> \<Longrightarrow> x + y - x = y" |
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3954 |
by(cases x y rule: ereal2_cases) simp_all |
63225
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3955 |
|
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3956 |
lemma tendsto_diff_ereal: |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3957 |
fixes x y :: ereal |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3958 |
assumes x: "\<bar>x\<bar> \<noteq> \<infinity>" and y: "\<bar>y\<bar> \<noteq> \<infinity>" |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3959 |
assumes f: "(f \<longlongrightarrow> x) F" and g: "(g \<longlongrightarrow> y) F" |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3960 |
shows "((\<lambda>x. f x - g x) \<longlongrightarrow> x - y) F" |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3961 |
proof - |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3962 |
from x obtain r where x': "x = ereal r" by (cases x) auto |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3963 |
with f have "((\<lambda>i. real_of_ereal (f i)) \<longlongrightarrow> r) F" by simp |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3964 |
moreover |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3965 |
from y obtain p where y': "y = ereal p" by (cases y) auto |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3966 |
with g have "((\<lambda>i. real_of_ereal (g i)) \<longlongrightarrow> p) F" by simp |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3967 |
ultimately have "((\<lambda>i. real_of_ereal (f i) - real_of_ereal (g i)) \<longlongrightarrow> r - p) F" |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3968 |
by (rule tendsto_diff) |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3969 |
moreover |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3970 |
from eventually_finite[OF x f] eventually_finite[OF y g] |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3971 |
have "eventually (\<lambda>x. f x - g x = ereal (real_of_ereal (f x) - real_of_ereal (g x))) F" |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3972 |
by eventually_elim auto |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3973 |
ultimately show ?thesis |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3974 |
by (simp add: x' y' cong: filterlim_cong) |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3975 |
qed |
19d2be0e5e9f
move ennreal and ereal theorems from MFMC_Countable
hoelzl
parents:
63145
diff
changeset
|
3976 |
|
67727
ce3e87a51488
moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
immler
parents:
67685
diff
changeset
|
3977 |
lemma continuous_on_diff_ereal: |
ce3e87a51488
moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
immler
parents:
67685
diff
changeset
|
3978 |
"continuous_on A f \<Longrightarrow> continuous_on A g \<Longrightarrow> (\<And>x. x \<in> A \<Longrightarrow> \<bar>f x\<bar> \<noteq> \<infinity>) \<Longrightarrow> (\<And>x. x \<in> A \<Longrightarrow> \<bar>g x\<bar> \<noteq> \<infinity>) \<Longrightarrow> continuous_on A (\<lambda>z. f z - g z::ereal)" |
72236 | 3979 |
by (auto simp: tendsto_diff_ereal continuous_on_def) |
67727
ce3e87a51488
moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
immler
parents:
67685
diff
changeset
|
3980 |
|
ce3e87a51488
moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
immler
parents:
67685
diff
changeset
|
3981 |
|
60500 | 3982 |
subsubsection \<open>Tests for code generator\<close> |
43933 | 3983 |
|
67408 | 3984 |
text \<open>A small list of simple arithmetic expressions.\<close> |
43933 | 3985 |
|
81763
2cf8f8e4c1fd
Simplified a lot of messy proofs
paulson <lp15@cam.ac.uk>
parents:
81332
diff
changeset
|
3986 |
value "-\<infinity> :: ereal" |
56927 | 3987 |
value "\<bar>-\<infinity>\<bar> :: ereal" |
3988 |
value "4 + 5 / 4 - ereal 2 :: ereal" |
|
3989 |
value "ereal 3 < \<infinity>" |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61245
diff
changeset
|
3990 |
value "real_of_ereal (\<infinity>::ereal) = 0" |
43933 | 3991 |
|
41973 | 3992 |
end |