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