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