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