51471
|
1 |
(* Title: HOL/Basic_Topology.thy
|
|
2 |
Author: Brian Huffman
|
|
3 |
Author: Johannes Hölzl
|
|
4 |
*)
|
|
5 |
|
|
6 |
header {* Topological Spaces *}
|
|
7 |
|
|
8 |
theory Topological_Spaces
|
|
9 |
imports Main
|
|
10 |
begin
|
|
11 |
|
|
12 |
subsection {* Topological space *}
|
|
13 |
|
|
14 |
class "open" =
|
|
15 |
fixes "open" :: "'a set \<Rightarrow> bool"
|
|
16 |
|
|
17 |
class topological_space = "open" +
|
|
18 |
assumes open_UNIV [simp, intro]: "open UNIV"
|
|
19 |
assumes open_Int [intro]: "open S \<Longrightarrow> open T \<Longrightarrow> open (S \<inter> T)"
|
|
20 |
assumes open_Union [intro]: "\<forall>S\<in>K. open S \<Longrightarrow> open (\<Union> K)"
|
|
21 |
begin
|
|
22 |
|
|
23 |
definition
|
|
24 |
closed :: "'a set \<Rightarrow> bool" where
|
|
25 |
"closed S \<longleftrightarrow> open (- S)"
|
|
26 |
|
|
27 |
lemma open_empty [intro, simp]: "open {}"
|
|
28 |
using open_Union [of "{}"] by simp
|
|
29 |
|
|
30 |
lemma open_Un [intro]: "open S \<Longrightarrow> open T \<Longrightarrow> open (S \<union> T)"
|
|
31 |
using open_Union [of "{S, T}"] by simp
|
|
32 |
|
|
33 |
lemma open_UN [intro]: "\<forall>x\<in>A. open (B x) \<Longrightarrow> open (\<Union>x\<in>A. B x)"
|
|
34 |
unfolding SUP_def by (rule open_Union) auto
|
|
35 |
|
|
36 |
lemma open_Inter [intro]: "finite S \<Longrightarrow> \<forall>T\<in>S. open T \<Longrightarrow> open (\<Inter>S)"
|
|
37 |
by (induct set: finite) auto
|
|
38 |
|
|
39 |
lemma open_INT [intro]: "finite A \<Longrightarrow> \<forall>x\<in>A. open (B x) \<Longrightarrow> open (\<Inter>x\<in>A. B x)"
|
|
40 |
unfolding INF_def by (rule open_Inter) auto
|
|
41 |
|
|
42 |
lemma closed_empty [intro, simp]: "closed {}"
|
|
43 |
unfolding closed_def by simp
|
|
44 |
|
|
45 |
lemma closed_Un [intro]: "closed S \<Longrightarrow> closed T \<Longrightarrow> closed (S \<union> T)"
|
|
46 |
unfolding closed_def by auto
|
|
47 |
|
|
48 |
lemma closed_UNIV [intro, simp]: "closed UNIV"
|
|
49 |
unfolding closed_def by simp
|
|
50 |
|
|
51 |
lemma closed_Int [intro]: "closed S \<Longrightarrow> closed T \<Longrightarrow> closed (S \<inter> T)"
|
|
52 |
unfolding closed_def by auto
|
|
53 |
|
|
54 |
lemma closed_INT [intro]: "\<forall>x\<in>A. closed (B x) \<Longrightarrow> closed (\<Inter>x\<in>A. B x)"
|
|
55 |
unfolding closed_def by auto
|
|
56 |
|
|
57 |
lemma closed_Inter [intro]: "\<forall>S\<in>K. closed S \<Longrightarrow> closed (\<Inter> K)"
|
|
58 |
unfolding closed_def uminus_Inf by auto
|
|
59 |
|
|
60 |
lemma closed_Union [intro]: "finite S \<Longrightarrow> \<forall>T\<in>S. closed T \<Longrightarrow> closed (\<Union>S)"
|
|
61 |
by (induct set: finite) auto
|
|
62 |
|
|
63 |
lemma closed_UN [intro]: "finite A \<Longrightarrow> \<forall>x\<in>A. closed (B x) \<Longrightarrow> closed (\<Union>x\<in>A. B x)"
|
|
64 |
unfolding SUP_def by (rule closed_Union) auto
|
|
65 |
|
|
66 |
lemma open_closed: "open S \<longleftrightarrow> closed (- S)"
|
|
67 |
unfolding closed_def by simp
|
|
68 |
|
|
69 |
lemma closed_open: "closed S \<longleftrightarrow> open (- S)"
|
|
70 |
unfolding closed_def by simp
|
|
71 |
|
|
72 |
lemma open_Diff [intro]: "open S \<Longrightarrow> closed T \<Longrightarrow> open (S - T)"
|
|
73 |
unfolding closed_open Diff_eq by (rule open_Int)
|
|
74 |
|
|
75 |
lemma closed_Diff [intro]: "closed S \<Longrightarrow> open T \<Longrightarrow> closed (S - T)"
|
|
76 |
unfolding open_closed Diff_eq by (rule closed_Int)
|
|
77 |
|
|
78 |
lemma open_Compl [intro]: "closed S \<Longrightarrow> open (- S)"
|
|
79 |
unfolding closed_open .
|
|
80 |
|
|
81 |
lemma closed_Compl [intro]: "open S \<Longrightarrow> closed (- S)"
|
|
82 |
unfolding open_closed .
|
|
83 |
|
|
84 |
end
|
|
85 |
|
|
86 |
subsection{* Hausdorff and other separation properties *}
|
|
87 |
|
|
88 |
class t0_space = topological_space +
|
|
89 |
assumes t0_space: "x \<noteq> y \<Longrightarrow> \<exists>U. open U \<and> \<not> (x \<in> U \<longleftrightarrow> y \<in> U)"
|
|
90 |
|
|
91 |
class t1_space = topological_space +
|
|
92 |
assumes t1_space: "x \<noteq> y \<Longrightarrow> \<exists>U. open U \<and> x \<in> U \<and> y \<notin> U"
|
|
93 |
|
|
94 |
instance t1_space \<subseteq> t0_space
|
|
95 |
proof qed (fast dest: t1_space)
|
|
96 |
|
|
97 |
lemma separation_t1:
|
|
98 |
fixes x y :: "'a::t1_space"
|
|
99 |
shows "x \<noteq> y \<longleftrightarrow> (\<exists>U. open U \<and> x \<in> U \<and> y \<notin> U)"
|
|
100 |
using t1_space[of x y] by blast
|
|
101 |
|
|
102 |
lemma closed_singleton:
|
|
103 |
fixes a :: "'a::t1_space"
|
|
104 |
shows "closed {a}"
|
|
105 |
proof -
|
|
106 |
let ?T = "\<Union>{S. open S \<and> a \<notin> S}"
|
|
107 |
have "open ?T" by (simp add: open_Union)
|
|
108 |
also have "?T = - {a}"
|
|
109 |
by (simp add: set_eq_iff separation_t1, auto)
|
|
110 |
finally show "closed {a}" unfolding closed_def .
|
|
111 |
qed
|
|
112 |
|
|
113 |
lemma closed_insert [simp]:
|
|
114 |
fixes a :: "'a::t1_space"
|
|
115 |
assumes "closed S" shows "closed (insert a S)"
|
|
116 |
proof -
|
|
117 |
from closed_singleton assms
|
|
118 |
have "closed ({a} \<union> S)" by (rule closed_Un)
|
|
119 |
thus "closed (insert a S)" by simp
|
|
120 |
qed
|
|
121 |
|
|
122 |
lemma finite_imp_closed:
|
|
123 |
fixes S :: "'a::t1_space set"
|
|
124 |
shows "finite S \<Longrightarrow> closed S"
|
|
125 |
by (induct set: finite, simp_all)
|
|
126 |
|
|
127 |
text {* T2 spaces are also known as Hausdorff spaces. *}
|
|
128 |
|
|
129 |
class t2_space = topological_space +
|
|
130 |
assumes hausdorff: "x \<noteq> y \<Longrightarrow> \<exists>U V. open U \<and> open V \<and> x \<in> U \<and> y \<in> V \<and> U \<inter> V = {}"
|
|
131 |
|
|
132 |
instance t2_space \<subseteq> t1_space
|
|
133 |
proof qed (fast dest: hausdorff)
|
|
134 |
|
|
135 |
lemma separation_t2:
|
|
136 |
fixes x y :: "'a::t2_space"
|
|
137 |
shows "x \<noteq> y \<longleftrightarrow> (\<exists>U V. open U \<and> open V \<and> x \<in> U \<and> y \<in> V \<and> U \<inter> V = {})"
|
|
138 |
using hausdorff[of x y] by blast
|
|
139 |
|
|
140 |
lemma separation_t0:
|
|
141 |
fixes x y :: "'a::t0_space"
|
|
142 |
shows "x \<noteq> y \<longleftrightarrow> (\<exists>U. open U \<and> ~(x\<in>U \<longleftrightarrow> y\<in>U))"
|
|
143 |
using t0_space[of x y] by blast
|
|
144 |
|
|
145 |
text {* A perfect space is a topological space with no isolated points. *}
|
|
146 |
|
|
147 |
class perfect_space = topological_space +
|
|
148 |
assumes not_open_singleton: "\<not> open {x}"
|
|
149 |
|
|
150 |
|
|
151 |
subsection {* Generators for toplogies *}
|
|
152 |
|
|
153 |
inductive generate_topology for S where
|
|
154 |
UNIV: "generate_topology S UNIV"
|
|
155 |
| Int: "generate_topology S a \<Longrightarrow> generate_topology S b \<Longrightarrow> generate_topology S (a \<inter> b)"
|
|
156 |
| UN: "(\<And>k. k \<in> K \<Longrightarrow> generate_topology S k) \<Longrightarrow> generate_topology S (\<Union>K)"
|
|
157 |
| Basis: "s \<in> S \<Longrightarrow> generate_topology S s"
|
|
158 |
|
|
159 |
hide_fact (open) UNIV Int UN Basis
|
|
160 |
|
|
161 |
lemma generate_topology_Union:
|
|
162 |
"(\<And>k. k \<in> I \<Longrightarrow> generate_topology S (K k)) \<Longrightarrow> generate_topology S (\<Union>k\<in>I. K k)"
|
|
163 |
unfolding SUP_def by (intro generate_topology.UN) auto
|
|
164 |
|
|
165 |
lemma topological_space_generate_topology:
|
|
166 |
"class.topological_space (generate_topology S)"
|
|
167 |
by default (auto intro: generate_topology.intros)
|
|
168 |
|
|
169 |
subsection {* Order topologies *}
|
|
170 |
|
|
171 |
class order_topology = order + "open" +
|
|
172 |
assumes open_generated_order: "open = generate_topology (range (\<lambda>a. {..< a}) \<union> range (\<lambda>a. {a <..}))"
|
|
173 |
begin
|
|
174 |
|
|
175 |
subclass topological_space
|
|
176 |
unfolding open_generated_order
|
|
177 |
by (rule topological_space_generate_topology)
|
|
178 |
|
|
179 |
lemma open_greaterThan [simp]: "open {a <..}"
|
|
180 |
unfolding open_generated_order by (auto intro: generate_topology.Basis)
|
|
181 |
|
|
182 |
lemma open_lessThan [simp]: "open {..< a}"
|
|
183 |
unfolding open_generated_order by (auto intro: generate_topology.Basis)
|
|
184 |
|
|
185 |
lemma open_greaterThanLessThan [simp]: "open {a <..< b}"
|
|
186 |
unfolding greaterThanLessThan_eq by (simp add: open_Int)
|
|
187 |
|
|
188 |
end
|
|
189 |
|
|
190 |
class linorder_topology = linorder + order_topology
|
|
191 |
|
|
192 |
lemma closed_atMost [simp]: "closed {.. a::'a::linorder_topology}"
|
|
193 |
by (simp add: closed_open)
|
|
194 |
|
|
195 |
lemma closed_atLeast [simp]: "closed {a::'a::linorder_topology ..}"
|
|
196 |
by (simp add: closed_open)
|
|
197 |
|
|
198 |
lemma closed_atLeastAtMost [simp]: "closed {a::'a::linorder_topology .. b}"
|
|
199 |
proof -
|
|
200 |
have "{a .. b} = {a ..} \<inter> {.. b}"
|
|
201 |
by auto
|
|
202 |
then show ?thesis
|
|
203 |
by (simp add: closed_Int)
|
|
204 |
qed
|
|
205 |
|
|
206 |
lemma (in linorder) less_separate:
|
|
207 |
assumes "x < y"
|
|
208 |
shows "\<exists>a b. x \<in> {..< a} \<and> y \<in> {b <..} \<and> {..< a} \<inter> {b <..} = {}"
|
|
209 |
proof cases
|
|
210 |
assume "\<exists>z. x < z \<and> z < y"
|
|
211 |
then guess z ..
|
|
212 |
then have "x \<in> {..< z} \<and> y \<in> {z <..} \<and> {z <..} \<inter> {..< z} = {}"
|
|
213 |
by auto
|
|
214 |
then show ?thesis by blast
|
|
215 |
next
|
|
216 |
assume "\<not> (\<exists>z. x < z \<and> z < y)"
|
|
217 |
with `x < y` have "x \<in> {..< y} \<and> y \<in> {x <..} \<and> {x <..} \<inter> {..< y} = {}"
|
|
218 |
by auto
|
|
219 |
then show ?thesis by blast
|
|
220 |
qed
|
|
221 |
|
|
222 |
instance linorder_topology \<subseteq> t2_space
|
|
223 |
proof
|
|
224 |
fix x y :: 'a
|
|
225 |
from less_separate[of x y] less_separate[of y x]
|
|
226 |
show "x \<noteq> y \<Longrightarrow> \<exists>U V. open U \<and> open V \<and> x \<in> U \<and> y \<in> V \<and> U \<inter> V = {}"
|
|
227 |
by (elim neqE) (metis open_lessThan open_greaterThan Int_commute)+
|
|
228 |
qed
|
|
229 |
|
|
230 |
lemma open_right:
|
|
231 |
fixes S :: "'a :: {no_top, linorder_topology} set"
|
|
232 |
assumes "open S" "x \<in> S" shows "\<exists>b>x. {x ..< b} \<subseteq> S"
|
|
233 |
using assms unfolding open_generated_order
|
|
234 |
proof induction
|
|
235 |
case (Int A B)
|
|
236 |
then obtain a b where "a > x" "{x ..< a} \<subseteq> A" "b > x" "{x ..< b} \<subseteq> B" by auto
|
|
237 |
then show ?case by (auto intro!: exI[of _ "min a b"])
|
|
238 |
next
|
|
239 |
case (Basis S)
|
|
240 |
moreover from gt_ex[of x] guess b ..
|
|
241 |
ultimately show ?case by (fastforce intro: exI[of _ b])
|
|
242 |
qed (fastforce intro: gt_ex)+
|
|
243 |
|
|
244 |
lemma open_left:
|
|
245 |
fixes S :: "'a :: {no_bot, linorder_topology} set"
|
|
246 |
assumes "open S" "x \<in> S" shows "\<exists>b<x. {b <.. x} \<subseteq> S"
|
|
247 |
using assms unfolding open_generated_order
|
|
248 |
proof induction
|
|
249 |
case (Int A B)
|
|
250 |
then obtain a b where "a < x" "{a <.. x} \<subseteq> A" "b < x" "{b <.. x} \<subseteq> B" by auto
|
|
251 |
then show ?case by (auto intro!: exI[of _ "max a b"])
|
|
252 |
next
|
|
253 |
case (Basis S)
|
|
254 |
moreover from lt_ex[of x] guess b ..
|
|
255 |
ultimately show ?case by (fastforce intro: exI[of _ b])
|
|
256 |
next
|
|
257 |
case UN then show ?case by blast
|
|
258 |
qed (fastforce intro: lt_ex)
|
|
259 |
|
|
260 |
subsection {* Filters *}
|
|
261 |
|
|
262 |
text {*
|
|
263 |
This definition also allows non-proper filters.
|
|
264 |
*}
|
|
265 |
|
|
266 |
locale is_filter =
|
|
267 |
fixes F :: "('a \<Rightarrow> bool) \<Rightarrow> bool"
|
|
268 |
assumes True: "F (\<lambda>x. True)"
|
|
269 |
assumes conj: "F (\<lambda>x. P x) \<Longrightarrow> F (\<lambda>x. Q x) \<Longrightarrow> F (\<lambda>x. P x \<and> Q x)"
|
|
270 |
assumes mono: "\<forall>x. P x \<longrightarrow> Q x \<Longrightarrow> F (\<lambda>x. P x) \<Longrightarrow> F (\<lambda>x. Q x)"
|
|
271 |
|
|
272 |
typedef 'a filter = "{F :: ('a \<Rightarrow> bool) \<Rightarrow> bool. is_filter F}"
|
|
273 |
proof
|
|
274 |
show "(\<lambda>x. True) \<in> ?filter" by (auto intro: is_filter.intro)
|
|
275 |
qed
|
|
276 |
|
|
277 |
lemma is_filter_Rep_filter: "is_filter (Rep_filter F)"
|
|
278 |
using Rep_filter [of F] by simp
|
|
279 |
|
|
280 |
lemma Abs_filter_inverse':
|
|
281 |
assumes "is_filter F" shows "Rep_filter (Abs_filter F) = F"
|
|
282 |
using assms by (simp add: Abs_filter_inverse)
|
|
283 |
|
|
284 |
|
|
285 |
subsubsection {* Eventually *}
|
|
286 |
|
|
287 |
definition eventually :: "('a \<Rightarrow> bool) \<Rightarrow> 'a filter \<Rightarrow> bool"
|
|
288 |
where "eventually P F \<longleftrightarrow> Rep_filter F P"
|
|
289 |
|
|
290 |
lemma eventually_Abs_filter:
|
|
291 |
assumes "is_filter F" shows "eventually P (Abs_filter F) = F P"
|
|
292 |
unfolding eventually_def using assms by (simp add: Abs_filter_inverse)
|
|
293 |
|
|
294 |
lemma filter_eq_iff:
|
|
295 |
shows "F = F' \<longleftrightarrow> (\<forall>P. eventually P F = eventually P F')"
|
|
296 |
unfolding Rep_filter_inject [symmetric] fun_eq_iff eventually_def ..
|
|
297 |
|
|
298 |
lemma eventually_True [simp]: "eventually (\<lambda>x. True) F"
|
|
299 |
unfolding eventually_def
|
|
300 |
by (rule is_filter.True [OF is_filter_Rep_filter])
|
|
301 |
|
|
302 |
lemma always_eventually: "\<forall>x. P x \<Longrightarrow> eventually P F"
|
|
303 |
proof -
|
|
304 |
assume "\<forall>x. P x" hence "P = (\<lambda>x. True)" by (simp add: ext)
|
|
305 |
thus "eventually P F" by simp
|
|
306 |
qed
|
|
307 |
|
|
308 |
lemma eventually_mono:
|
|
309 |
"(\<forall>x. P x \<longrightarrow> Q x) \<Longrightarrow> eventually P F \<Longrightarrow> eventually Q F"
|
|
310 |
unfolding eventually_def
|
|
311 |
by (rule is_filter.mono [OF is_filter_Rep_filter])
|
|
312 |
|
|
313 |
lemma eventually_conj:
|
|
314 |
assumes P: "eventually (\<lambda>x. P x) F"
|
|
315 |
assumes Q: "eventually (\<lambda>x. Q x) F"
|
|
316 |
shows "eventually (\<lambda>x. P x \<and> Q x) F"
|
|
317 |
using assms unfolding eventually_def
|
|
318 |
by (rule is_filter.conj [OF is_filter_Rep_filter])
|
|
319 |
|
|
320 |
lemma eventually_Ball_finite:
|
|
321 |
assumes "finite A" and "\<forall>y\<in>A. eventually (\<lambda>x. P x y) net"
|
|
322 |
shows "eventually (\<lambda>x. \<forall>y\<in>A. P x y) net"
|
|
323 |
using assms by (induct set: finite, simp, simp add: eventually_conj)
|
|
324 |
|
|
325 |
lemma eventually_all_finite:
|
|
326 |
fixes P :: "'a \<Rightarrow> 'b::finite \<Rightarrow> bool"
|
|
327 |
assumes "\<And>y. eventually (\<lambda>x. P x y) net"
|
|
328 |
shows "eventually (\<lambda>x. \<forall>y. P x y) net"
|
|
329 |
using eventually_Ball_finite [of UNIV P] assms by simp
|
|
330 |
|
|
331 |
lemma eventually_mp:
|
|
332 |
assumes "eventually (\<lambda>x. P x \<longrightarrow> Q x) F"
|
|
333 |
assumes "eventually (\<lambda>x. P x) F"
|
|
334 |
shows "eventually (\<lambda>x. Q x) F"
|
|
335 |
proof (rule eventually_mono)
|
|
336 |
show "\<forall>x. (P x \<longrightarrow> Q x) \<and> P x \<longrightarrow> Q x" by simp
|
|
337 |
show "eventually (\<lambda>x. (P x \<longrightarrow> Q x) \<and> P x) F"
|
|
338 |
using assms by (rule eventually_conj)
|
|
339 |
qed
|
|
340 |
|
|
341 |
lemma eventually_rev_mp:
|
|
342 |
assumes "eventually (\<lambda>x. P x) F"
|
|
343 |
assumes "eventually (\<lambda>x. P x \<longrightarrow> Q x) F"
|
|
344 |
shows "eventually (\<lambda>x. Q x) F"
|
|
345 |
using assms(2) assms(1) by (rule eventually_mp)
|
|
346 |
|
|
347 |
lemma eventually_conj_iff:
|
|
348 |
"eventually (\<lambda>x. P x \<and> Q x) F \<longleftrightarrow> eventually P F \<and> eventually Q F"
|
|
349 |
by (auto intro: eventually_conj elim: eventually_rev_mp)
|
|
350 |
|
|
351 |
lemma eventually_elim1:
|
|
352 |
assumes "eventually (\<lambda>i. P i) F"
|
|
353 |
assumes "\<And>i. P i \<Longrightarrow> Q i"
|
|
354 |
shows "eventually (\<lambda>i. Q i) F"
|
|
355 |
using assms by (auto elim!: eventually_rev_mp)
|
|
356 |
|
|
357 |
lemma eventually_elim2:
|
|
358 |
assumes "eventually (\<lambda>i. P i) F"
|
|
359 |
assumes "eventually (\<lambda>i. Q i) F"
|
|
360 |
assumes "\<And>i. P i \<Longrightarrow> Q i \<Longrightarrow> R i"
|
|
361 |
shows "eventually (\<lambda>i. R i) F"
|
|
362 |
using assms by (auto elim!: eventually_rev_mp)
|
|
363 |
|
|
364 |
lemma eventually_subst:
|
|
365 |
assumes "eventually (\<lambda>n. P n = Q n) F"
|
|
366 |
shows "eventually P F = eventually Q F" (is "?L = ?R")
|
|
367 |
proof -
|
|
368 |
from assms have "eventually (\<lambda>x. P x \<longrightarrow> Q x) F"
|
|
369 |
and "eventually (\<lambda>x. Q x \<longrightarrow> P x) F"
|
|
370 |
by (auto elim: eventually_elim1)
|
|
371 |
then show ?thesis by (auto elim: eventually_elim2)
|
|
372 |
qed
|
|
373 |
|
|
374 |
ML {*
|
|
375 |
fun eventually_elim_tac ctxt thms thm =
|
|
376 |
let
|
|
377 |
val thy = Proof_Context.theory_of ctxt
|
|
378 |
val mp_thms = thms RL [@{thm eventually_rev_mp}]
|
|
379 |
val raw_elim_thm =
|
|
380 |
(@{thm allI} RS @{thm always_eventually})
|
|
381 |
|> fold (fn thm1 => fn thm2 => thm2 RS thm1) mp_thms
|
|
382 |
|> fold (fn _ => fn thm => @{thm impI} RS thm) thms
|
|
383 |
val cases_prop = prop_of (raw_elim_thm RS thm)
|
|
384 |
val cases = (Rule_Cases.make_common (thy, cases_prop) [(("elim", []), [])])
|
|
385 |
in
|
|
386 |
CASES cases (rtac raw_elim_thm 1) thm
|
|
387 |
end
|
|
388 |
*}
|
|
389 |
|
|
390 |
method_setup eventually_elim = {*
|
|
391 |
Scan.succeed (fn ctxt => METHOD_CASES (eventually_elim_tac ctxt))
|
|
392 |
*} "elimination of eventually quantifiers"
|
|
393 |
|
|
394 |
|
|
395 |
subsubsection {* Finer-than relation *}
|
|
396 |
|
|
397 |
text {* @{term "F \<le> F'"} means that filter @{term F} is finer than
|
|
398 |
filter @{term F'}. *}
|
|
399 |
|
|
400 |
instantiation filter :: (type) complete_lattice
|
|
401 |
begin
|
|
402 |
|
|
403 |
definition le_filter_def:
|
|
404 |
"F \<le> F' \<longleftrightarrow> (\<forall>P. eventually P F' \<longrightarrow> eventually P F)"
|
|
405 |
|
|
406 |
definition
|
|
407 |
"(F :: 'a filter) < F' \<longleftrightarrow> F \<le> F' \<and> \<not> F' \<le> F"
|
|
408 |
|
|
409 |
definition
|
|
410 |
"top = Abs_filter (\<lambda>P. \<forall>x. P x)"
|
|
411 |
|
|
412 |
definition
|
|
413 |
"bot = Abs_filter (\<lambda>P. True)"
|
|
414 |
|
|
415 |
definition
|
|
416 |
"sup F F' = Abs_filter (\<lambda>P. eventually P F \<and> eventually P F')"
|
|
417 |
|
|
418 |
definition
|
|
419 |
"inf F F' = Abs_filter
|
|
420 |
(\<lambda>P. \<exists>Q R. eventually Q F \<and> eventually R F' \<and> (\<forall>x. Q x \<and> R x \<longrightarrow> P x))"
|
|
421 |
|
|
422 |
definition
|
|
423 |
"Sup S = Abs_filter (\<lambda>P. \<forall>F\<in>S. eventually P F)"
|
|
424 |
|
|
425 |
definition
|
|
426 |
"Inf S = Sup {F::'a filter. \<forall>F'\<in>S. F \<le> F'}"
|
|
427 |
|
|
428 |
lemma eventually_top [simp]: "eventually P top \<longleftrightarrow> (\<forall>x. P x)"
|
|
429 |
unfolding top_filter_def
|
|
430 |
by (rule eventually_Abs_filter, rule is_filter.intro, auto)
|
|
431 |
|
|
432 |
lemma eventually_bot [simp]: "eventually P bot"
|
|
433 |
unfolding bot_filter_def
|
|
434 |
by (subst eventually_Abs_filter, rule is_filter.intro, auto)
|
|
435 |
|
|
436 |
lemma eventually_sup:
|
|
437 |
"eventually P (sup F F') \<longleftrightarrow> eventually P F \<and> eventually P F'"
|
|
438 |
unfolding sup_filter_def
|
|
439 |
by (rule eventually_Abs_filter, rule is_filter.intro)
|
|
440 |
(auto elim!: eventually_rev_mp)
|
|
441 |
|
|
442 |
lemma eventually_inf:
|
|
443 |
"eventually P (inf F F') \<longleftrightarrow>
|
|
444 |
(\<exists>Q R. eventually Q F \<and> eventually R F' \<and> (\<forall>x. Q x \<and> R x \<longrightarrow> P x))"
|
|
445 |
unfolding inf_filter_def
|
|
446 |
apply (rule eventually_Abs_filter, rule is_filter.intro)
|
|
447 |
apply (fast intro: eventually_True)
|
|
448 |
apply clarify
|
|
449 |
apply (intro exI conjI)
|
|
450 |
apply (erule (1) eventually_conj)
|
|
451 |
apply (erule (1) eventually_conj)
|
|
452 |
apply simp
|
|
453 |
apply auto
|
|
454 |
done
|
|
455 |
|
|
456 |
lemma eventually_Sup:
|
|
457 |
"eventually P (Sup S) \<longleftrightarrow> (\<forall>F\<in>S. eventually P F)"
|
|
458 |
unfolding Sup_filter_def
|
|
459 |
apply (rule eventually_Abs_filter, rule is_filter.intro)
|
|
460 |
apply (auto intro: eventually_conj elim!: eventually_rev_mp)
|
|
461 |
done
|
|
462 |
|
|
463 |
instance proof
|
|
464 |
fix F F' F'' :: "'a filter" and S :: "'a filter set"
|
|
465 |
{ show "F < F' \<longleftrightarrow> F \<le> F' \<and> \<not> F' \<le> F"
|
|
466 |
by (rule less_filter_def) }
|
|
467 |
{ show "F \<le> F"
|
|
468 |
unfolding le_filter_def by simp }
|
|
469 |
{ assume "F \<le> F'" and "F' \<le> F''" thus "F \<le> F''"
|
|
470 |
unfolding le_filter_def by simp }
|
|
471 |
{ assume "F \<le> F'" and "F' \<le> F" thus "F = F'"
|
|
472 |
unfolding le_filter_def filter_eq_iff by fast }
|
|
473 |
{ show "F \<le> top"
|
|
474 |
unfolding le_filter_def eventually_top by (simp add: always_eventually) }
|
|
475 |
{ show "bot \<le> F"
|
|
476 |
unfolding le_filter_def by simp }
|
|
477 |
{ show "F \<le> sup F F'" and "F' \<le> sup F F'"
|
|
478 |
unfolding le_filter_def eventually_sup by simp_all }
|
|
479 |
{ assume "F \<le> F''" and "F' \<le> F''" thus "sup F F' \<le> F''"
|
|
480 |
unfolding le_filter_def eventually_sup by simp }
|
|
481 |
{ show "inf F F' \<le> F" and "inf F F' \<le> F'"
|
|
482 |
unfolding le_filter_def eventually_inf by (auto intro: eventually_True) }
|
|
483 |
{ assume "F \<le> F'" and "F \<le> F''" thus "F \<le> inf F' F''"
|
|
484 |
unfolding le_filter_def eventually_inf
|
|
485 |
by (auto elim!: eventually_mono intro: eventually_conj) }
|
|
486 |
{ assume "F \<in> S" thus "F \<le> Sup S"
|
|
487 |
unfolding le_filter_def eventually_Sup by simp }
|
|
488 |
{ assume "\<And>F. F \<in> S \<Longrightarrow> F \<le> F'" thus "Sup S \<le> F'"
|
|
489 |
unfolding le_filter_def eventually_Sup by simp }
|
|
490 |
{ assume "F'' \<in> S" thus "Inf S \<le> F''"
|
|
491 |
unfolding le_filter_def Inf_filter_def eventually_Sup Ball_def by simp }
|
|
492 |
{ assume "\<And>F'. F' \<in> S \<Longrightarrow> F \<le> F'" thus "F \<le> Inf S"
|
|
493 |
unfolding le_filter_def Inf_filter_def eventually_Sup Ball_def by simp }
|
|
494 |
qed
|
|
495 |
|
|
496 |
end
|
|
497 |
|
|
498 |
lemma filter_leD:
|
|
499 |
"F \<le> F' \<Longrightarrow> eventually P F' \<Longrightarrow> eventually P F"
|
|
500 |
unfolding le_filter_def by simp
|
|
501 |
|
|
502 |
lemma filter_leI:
|
|
503 |
"(\<And>P. eventually P F' \<Longrightarrow> eventually P F) \<Longrightarrow> F \<le> F'"
|
|
504 |
unfolding le_filter_def by simp
|
|
505 |
|
|
506 |
lemma eventually_False:
|
|
507 |
"eventually (\<lambda>x. False) F \<longleftrightarrow> F = bot"
|
|
508 |
unfolding filter_eq_iff by (auto elim: eventually_rev_mp)
|
|
509 |
|
|
510 |
abbreviation (input) trivial_limit :: "'a filter \<Rightarrow> bool"
|
|
511 |
where "trivial_limit F \<equiv> F = bot"
|
|
512 |
|
|
513 |
lemma trivial_limit_def: "trivial_limit F \<longleftrightarrow> eventually (\<lambda>x. False) F"
|
|
514 |
by (rule eventually_False [symmetric])
|
|
515 |
|
|
516 |
lemma eventually_const: "\<not> trivial_limit net \<Longrightarrow> eventually (\<lambda>x. P) net \<longleftrightarrow> P"
|
|
517 |
by (cases P) (simp_all add: eventually_False)
|
|
518 |
|
|
519 |
|
|
520 |
subsubsection {* Map function for filters *}
|
|
521 |
|
|
522 |
definition filtermap :: "('a \<Rightarrow> 'b) \<Rightarrow> 'a filter \<Rightarrow> 'b filter"
|
|
523 |
where "filtermap f F = Abs_filter (\<lambda>P. eventually (\<lambda>x. P (f x)) F)"
|
|
524 |
|
|
525 |
lemma eventually_filtermap:
|
|
526 |
"eventually P (filtermap f F) = eventually (\<lambda>x. P (f x)) F"
|
|
527 |
unfolding filtermap_def
|
|
528 |
apply (rule eventually_Abs_filter)
|
|
529 |
apply (rule is_filter.intro)
|
|
530 |
apply (auto elim!: eventually_rev_mp)
|
|
531 |
done
|
|
532 |
|
|
533 |
lemma filtermap_ident: "filtermap (\<lambda>x. x) F = F"
|
|
534 |
by (simp add: filter_eq_iff eventually_filtermap)
|
|
535 |
|
|
536 |
lemma filtermap_filtermap:
|
|
537 |
"filtermap f (filtermap g F) = filtermap (\<lambda>x. f (g x)) F"
|
|
538 |
by (simp add: filter_eq_iff eventually_filtermap)
|
|
539 |
|
|
540 |
lemma filtermap_mono: "F \<le> F' \<Longrightarrow> filtermap f F \<le> filtermap f F'"
|
|
541 |
unfolding le_filter_def eventually_filtermap by simp
|
|
542 |
|
|
543 |
lemma filtermap_bot [simp]: "filtermap f bot = bot"
|
|
544 |
by (simp add: filter_eq_iff eventually_filtermap)
|
|
545 |
|
|
546 |
lemma filtermap_sup: "filtermap f (sup F1 F2) = sup (filtermap f F1) (filtermap f F2)"
|
|
547 |
by (auto simp: filter_eq_iff eventually_filtermap eventually_sup)
|
|
548 |
|
|
549 |
subsubsection {* Order filters *}
|
|
550 |
|
|
551 |
definition at_top :: "('a::order) filter"
|
|
552 |
where "at_top = Abs_filter (\<lambda>P. \<exists>k. \<forall>n\<ge>k. P n)"
|
|
553 |
|
|
554 |
lemma eventually_at_top_linorder: "eventually P at_top \<longleftrightarrow> (\<exists>N::'a::linorder. \<forall>n\<ge>N. P n)"
|
|
555 |
unfolding at_top_def
|
|
556 |
proof (rule eventually_Abs_filter, rule is_filter.intro)
|
|
557 |
fix P Q :: "'a \<Rightarrow> bool"
|
|
558 |
assume "\<exists>i. \<forall>n\<ge>i. P n" and "\<exists>j. \<forall>n\<ge>j. Q n"
|
|
559 |
then obtain i j where "\<forall>n\<ge>i. P n" and "\<forall>n\<ge>j. Q n" by auto
|
|
560 |
then have "\<forall>n\<ge>max i j. P n \<and> Q n" by simp
|
|
561 |
then show "\<exists>k. \<forall>n\<ge>k. P n \<and> Q n" ..
|
|
562 |
qed auto
|
|
563 |
|
|
564 |
lemma eventually_ge_at_top:
|
|
565 |
"eventually (\<lambda>x. (c::_::linorder) \<le> x) at_top"
|
|
566 |
unfolding eventually_at_top_linorder by auto
|
|
567 |
|
|
568 |
lemma eventually_at_top_dense: "eventually P at_top \<longleftrightarrow> (\<exists>N::'a::dense_linorder. \<forall>n>N. P n)"
|
|
569 |
unfolding eventually_at_top_linorder
|
|
570 |
proof safe
|
|
571 |
fix N assume "\<forall>n\<ge>N. P n" then show "\<exists>N. \<forall>n>N. P n" by (auto intro!: exI[of _ N])
|
|
572 |
next
|
|
573 |
fix N assume "\<forall>n>N. P n"
|
|
574 |
moreover from gt_ex[of N] guess y ..
|
|
575 |
ultimately show "\<exists>N. \<forall>n\<ge>N. P n" by (auto intro!: exI[of _ y])
|
|
576 |
qed
|
|
577 |
|
|
578 |
lemma eventually_gt_at_top:
|
|
579 |
"eventually (\<lambda>x. (c::_::dense_linorder) < x) at_top"
|
|
580 |
unfolding eventually_at_top_dense by auto
|
|
581 |
|
|
582 |
definition at_bot :: "('a::order) filter"
|
|
583 |
where "at_bot = Abs_filter (\<lambda>P. \<exists>k. \<forall>n\<le>k. P n)"
|
|
584 |
|
|
585 |
lemma eventually_at_bot_linorder:
|
|
586 |
fixes P :: "'a::linorder \<Rightarrow> bool" shows "eventually P at_bot \<longleftrightarrow> (\<exists>N. \<forall>n\<le>N. P n)"
|
|
587 |
unfolding at_bot_def
|
|
588 |
proof (rule eventually_Abs_filter, rule is_filter.intro)
|
|
589 |
fix P Q :: "'a \<Rightarrow> bool"
|
|
590 |
assume "\<exists>i. \<forall>n\<le>i. P n" and "\<exists>j. \<forall>n\<le>j. Q n"
|
|
591 |
then obtain i j where "\<forall>n\<le>i. P n" and "\<forall>n\<le>j. Q n" by auto
|
|
592 |
then have "\<forall>n\<le>min i j. P n \<and> Q n" by simp
|
|
593 |
then show "\<exists>k. \<forall>n\<le>k. P n \<and> Q n" ..
|
|
594 |
qed auto
|
|
595 |
|
|
596 |
lemma eventually_le_at_bot:
|
|
597 |
"eventually (\<lambda>x. x \<le> (c::_::linorder)) at_bot"
|
|
598 |
unfolding eventually_at_bot_linorder by auto
|
|
599 |
|
|
600 |
lemma eventually_at_bot_dense:
|
|
601 |
fixes P :: "'a::dense_linorder \<Rightarrow> bool" shows "eventually P at_bot \<longleftrightarrow> (\<exists>N. \<forall>n<N. P n)"
|
|
602 |
unfolding eventually_at_bot_linorder
|
|
603 |
proof safe
|
|
604 |
fix N assume "\<forall>n\<le>N. P n" then show "\<exists>N. \<forall>n<N. P n" by (auto intro!: exI[of _ N])
|
|
605 |
next
|
|
606 |
fix N assume "\<forall>n<N. P n"
|
|
607 |
moreover from lt_ex[of N] guess y ..
|
|
608 |
ultimately show "\<exists>N. \<forall>n\<le>N. P n" by (auto intro!: exI[of _ y])
|
|
609 |
qed
|
|
610 |
|
|
611 |
lemma eventually_gt_at_bot:
|
|
612 |
"eventually (\<lambda>x. x < (c::_::dense_linorder)) at_bot"
|
|
613 |
unfolding eventually_at_bot_dense by auto
|
|
614 |
|
|
615 |
subsection {* Sequentially *}
|
|
616 |
|
|
617 |
abbreviation sequentially :: "nat filter"
|
|
618 |
where "sequentially == at_top"
|
|
619 |
|
|
620 |
lemma sequentially_def: "sequentially = Abs_filter (\<lambda>P. \<exists>k. \<forall>n\<ge>k. P n)"
|
|
621 |
unfolding at_top_def by simp
|
|
622 |
|
|
623 |
lemma eventually_sequentially:
|
|
624 |
"eventually P sequentially \<longleftrightarrow> (\<exists>N. \<forall>n\<ge>N. P n)"
|
|
625 |
by (rule eventually_at_top_linorder)
|
|
626 |
|
|
627 |
lemma sequentially_bot [simp, intro]: "sequentially \<noteq> bot"
|
|
628 |
unfolding filter_eq_iff eventually_sequentially by auto
|
|
629 |
|
|
630 |
lemmas trivial_limit_sequentially = sequentially_bot
|
|
631 |
|
|
632 |
lemma eventually_False_sequentially [simp]:
|
|
633 |
"\<not> eventually (\<lambda>n. False) sequentially"
|
|
634 |
by (simp add: eventually_False)
|
|
635 |
|
|
636 |
lemma le_sequentially:
|
|
637 |
"F \<le> sequentially \<longleftrightarrow> (\<forall>N. eventually (\<lambda>n. N \<le> n) F)"
|
|
638 |
unfolding le_filter_def eventually_sequentially
|
|
639 |
by (safe, fast, drule_tac x=N in spec, auto elim: eventually_rev_mp)
|
|
640 |
|
|
641 |
lemma eventually_sequentiallyI:
|
|
642 |
assumes "\<And>x. c \<le> x \<Longrightarrow> P x"
|
|
643 |
shows "eventually P sequentially"
|
|
644 |
using assms by (auto simp: eventually_sequentially)
|
|
645 |
|
|
646 |
|
|
647 |
subsubsection {* Standard filters *}
|
|
648 |
|
|
649 |
definition within :: "'a filter \<Rightarrow> 'a set \<Rightarrow> 'a filter" (infixr "within" 70)
|
|
650 |
where "F within S = Abs_filter (\<lambda>P. eventually (\<lambda>x. x \<in> S \<longrightarrow> P x) F)"
|
|
651 |
|
|
652 |
lemma eventually_within:
|
|
653 |
"eventually P (F within S) = eventually (\<lambda>x. x \<in> S \<longrightarrow> P x) F"
|
|
654 |
unfolding within_def
|
|
655 |
by (rule eventually_Abs_filter, rule is_filter.intro)
|
|
656 |
(auto elim!: eventually_rev_mp)
|
|
657 |
|
|
658 |
lemma within_UNIV [simp]: "F within UNIV = F"
|
|
659 |
unfolding filter_eq_iff eventually_within by simp
|
|
660 |
|
|
661 |
lemma within_empty [simp]: "F within {} = bot"
|
|
662 |
unfolding filter_eq_iff eventually_within by simp
|
|
663 |
|
|
664 |
lemma within_within_eq: "(F within S) within T = F within (S \<inter> T)"
|
|
665 |
by (auto simp: filter_eq_iff eventually_within elim: eventually_elim1)
|
|
666 |
|
|
667 |
lemma within_le: "F within S \<le> F"
|
|
668 |
unfolding le_filter_def eventually_within by (auto elim: eventually_elim1)
|
|
669 |
|
|
670 |
lemma le_withinI: "F \<le> F' \<Longrightarrow> eventually (\<lambda>x. x \<in> S) F \<Longrightarrow> F \<le> F' within S"
|
|
671 |
unfolding le_filter_def eventually_within by (auto elim: eventually_elim2)
|
|
672 |
|
|
673 |
lemma le_within_iff: "eventually (\<lambda>x. x \<in> S) F \<Longrightarrow> F \<le> F' within S \<longleftrightarrow> F \<le> F'"
|
|
674 |
by (blast intro: within_le le_withinI order_trans)
|
|
675 |
|
|
676 |
subsubsection {* Topological filters *}
|
|
677 |
|
|
678 |
definition (in topological_space) nhds :: "'a \<Rightarrow> 'a filter"
|
|
679 |
where "nhds a = Abs_filter (\<lambda>P. \<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. P x))"
|
|
680 |
|
|
681 |
definition (in topological_space) at :: "'a \<Rightarrow> 'a filter"
|
|
682 |
where "at a = nhds a within - {a}"
|
|
683 |
|
51473
|
684 |
abbreviation (in order_topology) at_right :: "'a \<Rightarrow> 'a filter" where
|
51471
|
685 |
"at_right x \<equiv> at x within {x <..}"
|
|
686 |
|
51473
|
687 |
abbreviation (in order_topology) at_left :: "'a \<Rightarrow> 'a filter" where
|
51471
|
688 |
"at_left x \<equiv> at x within {..< x}"
|
|
689 |
|
51473
|
690 |
lemma (in topological_space) eventually_nhds:
|
51471
|
691 |
"eventually P (nhds a) \<longleftrightarrow> (\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. P x))"
|
|
692 |
unfolding nhds_def
|
|
693 |
proof (rule eventually_Abs_filter, rule is_filter.intro)
|
51473
|
694 |
have "open UNIV \<and> a \<in> UNIV \<and> (\<forall>x\<in>UNIV. True)" by simp
|
51471
|
695 |
thus "\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. True)" ..
|
|
696 |
next
|
|
697 |
fix P Q
|
|
698 |
assume "\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. P x)"
|
|
699 |
and "\<exists>T. open T \<and> a \<in> T \<and> (\<forall>x\<in>T. Q x)"
|
|
700 |
then obtain S T where
|
|
701 |
"open S \<and> a \<in> S \<and> (\<forall>x\<in>S. P x)"
|
|
702 |
"open T \<and> a \<in> T \<and> (\<forall>x\<in>T. Q x)" by auto
|
|
703 |
hence "open (S \<inter> T) \<and> a \<in> S \<inter> T \<and> (\<forall>x\<in>(S \<inter> T). P x \<and> Q x)"
|
|
704 |
by (simp add: open_Int)
|
|
705 |
thus "\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. P x \<and> Q x)" ..
|
|
706 |
qed auto
|
|
707 |
|
|
708 |
lemma nhds_neq_bot [simp]: "nhds a \<noteq> bot"
|
|
709 |
unfolding trivial_limit_def eventually_nhds by simp
|
|
710 |
|
|
711 |
lemma eventually_at_topological:
|
|
712 |
"eventually P (at a) \<longleftrightarrow> (\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. x \<noteq> a \<longrightarrow> P x))"
|
|
713 |
unfolding at_def eventually_within eventually_nhds by simp
|
|
714 |
|
|
715 |
lemma at_eq_bot_iff: "at a = bot \<longleftrightarrow> open {a}"
|
|
716 |
unfolding trivial_limit_def eventually_at_topological
|
|
717 |
by (safe, case_tac "S = {a}", simp, fast, fast)
|
|
718 |
|
|
719 |
lemma at_neq_bot [simp]: "at (a::'a::perfect_space) \<noteq> bot"
|
|
720 |
by (simp add: at_eq_bot_iff not_open_singleton)
|
|
721 |
|
|
722 |
lemma eventually_at_right:
|
|
723 |
fixes x :: "'a :: {no_top, linorder_topology}"
|
|
724 |
shows "eventually P (at_right x) \<longleftrightarrow> (\<exists>b. x < b \<and> (\<forall>z. x < z \<and> z < b \<longrightarrow> P z))"
|
|
725 |
unfolding eventually_nhds eventually_within at_def
|
|
726 |
proof safe
|
|
727 |
fix S assume "open S" "x \<in> S"
|
|
728 |
note open_right[OF this]
|
|
729 |
moreover assume "\<forall>s\<in>S. s \<in> - {x} \<longrightarrow> s \<in> {x<..} \<longrightarrow> P s"
|
|
730 |
ultimately show "\<exists>b>x. \<forall>z. x < z \<and> z < b \<longrightarrow> P z"
|
|
731 |
by (auto simp: subset_eq Ball_def)
|
|
732 |
next
|
|
733 |
fix b assume "x < b" "\<forall>z. x < z \<and> z < b \<longrightarrow> P z"
|
|
734 |
then show "\<exists>S. open S \<and> x \<in> S \<and> (\<forall>xa\<in>S. xa \<in> - {x} \<longrightarrow> xa \<in> {x<..} \<longrightarrow> P xa)"
|
|
735 |
by (intro exI[of _ "{..< b}"]) auto
|
|
736 |
qed
|
|
737 |
|
|
738 |
lemma eventually_at_left:
|
|
739 |
fixes x :: "'a :: {no_bot, linorder_topology}"
|
|
740 |
shows "eventually P (at_left x) \<longleftrightarrow> (\<exists>b. x > b \<and> (\<forall>z. b < z \<and> z < x \<longrightarrow> P z))"
|
|
741 |
unfolding eventually_nhds eventually_within at_def
|
|
742 |
proof safe
|
|
743 |
fix S assume "open S" "x \<in> S"
|
|
744 |
note open_left[OF this]
|
|
745 |
moreover assume "\<forall>s\<in>S. s \<in> - {x} \<longrightarrow> s \<in> {..<x} \<longrightarrow> P s"
|
|
746 |
ultimately show "\<exists>b<x. \<forall>z. b < z \<and> z < x \<longrightarrow> P z"
|
|
747 |
by (auto simp: subset_eq Ball_def)
|
|
748 |
next
|
|
749 |
fix b assume "b < x" "\<forall>z. b < z \<and> z < x \<longrightarrow> P z"
|
|
750 |
then show "\<exists>S. open S \<and> x \<in> S \<and> (\<forall>xa\<in>S. xa \<in> - {x} \<longrightarrow> xa \<in> {..<x} \<longrightarrow> P xa)"
|
|
751 |
by (intro exI[of _ "{b <..}"]) auto
|
|
752 |
qed
|
|
753 |
|
|
754 |
lemma trivial_limit_at_left_real [simp]:
|
|
755 |
"\<not> trivial_limit (at_left (x::'a::{no_bot, dense_linorder, linorder_topology}))"
|
|
756 |
unfolding trivial_limit_def eventually_at_left by (auto dest: dense)
|
|
757 |
|
|
758 |
lemma trivial_limit_at_right_real [simp]:
|
|
759 |
"\<not> trivial_limit (at_right (x::'a::{no_top, dense_linorder, linorder_topology}))"
|
|
760 |
unfolding trivial_limit_def eventually_at_right by (auto dest: dense)
|
|
761 |
|
|
762 |
lemma at_within_eq: "at x within T = nhds x within (T - {x})"
|
|
763 |
unfolding at_def within_within_eq by (simp add: ac_simps Diff_eq)
|
|
764 |
|
|
765 |
lemma at_eq_sup_left_right: "at (x::'a::linorder_topology) = sup (at_left x) (at_right x)"
|
|
766 |
by (auto simp: eventually_within at_def filter_eq_iff eventually_sup
|
|
767 |
elim: eventually_elim2 eventually_elim1)
|
|
768 |
|
|
769 |
lemma eventually_at_split:
|
|
770 |
"eventually P (at (x::'a::linorder_topology)) \<longleftrightarrow> eventually P (at_left x) \<and> eventually P (at_right x)"
|
|
771 |
by (subst at_eq_sup_left_right) (simp add: eventually_sup)
|
|
772 |
|
|
773 |
subsection {* Limits *}
|
|
774 |
|
|
775 |
definition filterlim :: "('a \<Rightarrow> 'b) \<Rightarrow> 'b filter \<Rightarrow> 'a filter \<Rightarrow> bool" where
|
|
776 |
"filterlim f F2 F1 \<longleftrightarrow> filtermap f F1 \<le> F2"
|
|
777 |
|
|
778 |
syntax
|
|
779 |
"_LIM" :: "pttrns \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> 'a \<Rightarrow> bool" ("(3LIM (_)/ (_)./ (_) :> (_))" [1000, 10, 0, 10] 10)
|
|
780 |
|
|
781 |
translations
|
|
782 |
"LIM x F1. f :> F2" == "CONST filterlim (%x. f) F2 F1"
|
|
783 |
|
|
784 |
lemma filterlim_iff:
|
|
785 |
"(LIM x F1. f x :> F2) \<longleftrightarrow> (\<forall>P. eventually P F2 \<longrightarrow> eventually (\<lambda>x. P (f x)) F1)"
|
|
786 |
unfolding filterlim_def le_filter_def eventually_filtermap ..
|
|
787 |
|
|
788 |
lemma filterlim_compose:
|
|
789 |
"filterlim g F3 F2 \<Longrightarrow> filterlim f F2 F1 \<Longrightarrow> filterlim (\<lambda>x. g (f x)) F3 F1"
|
|
790 |
unfolding filterlim_def filtermap_filtermap[symmetric] by (metis filtermap_mono order_trans)
|
|
791 |
|
|
792 |
lemma filterlim_mono:
|
|
793 |
"filterlim f F2 F1 \<Longrightarrow> F2 \<le> F2' \<Longrightarrow> F1' \<le> F1 \<Longrightarrow> filterlim f F2' F1'"
|
|
794 |
unfolding filterlim_def by (metis filtermap_mono order_trans)
|
|
795 |
|
|
796 |
lemma filterlim_ident: "LIM x F. x :> F"
|
|
797 |
by (simp add: filterlim_def filtermap_ident)
|
|
798 |
|
|
799 |
lemma filterlim_cong:
|
|
800 |
"F1 = F1' \<Longrightarrow> F2 = F2' \<Longrightarrow> eventually (\<lambda>x. f x = g x) F2 \<Longrightarrow> filterlim f F1 F2 = filterlim g F1' F2'"
|
|
801 |
by (auto simp: filterlim_def le_filter_def eventually_filtermap elim: eventually_elim2)
|
|
802 |
|
|
803 |
lemma filterlim_within:
|
|
804 |
"(LIM x F1. f x :> F2 within S) \<longleftrightarrow> (eventually (\<lambda>x. f x \<in> S) F1 \<and> (LIM x F1. f x :> F2))"
|
|
805 |
unfolding filterlim_def
|
|
806 |
proof safe
|
|
807 |
assume "filtermap f F1 \<le> F2 within S" then show "eventually (\<lambda>x. f x \<in> S) F1"
|
|
808 |
by (auto simp: le_filter_def eventually_filtermap eventually_within elim!: allE[of _ "\<lambda>x. x \<in> S"])
|
|
809 |
qed (auto intro: within_le order_trans simp: le_within_iff eventually_filtermap)
|
|
810 |
|
|
811 |
lemma filterlim_filtermap: "filterlim f F1 (filtermap g F2) = filterlim (\<lambda>x. f (g x)) F1 F2"
|
|
812 |
unfolding filterlim_def filtermap_filtermap ..
|
|
813 |
|
|
814 |
lemma filterlim_sup:
|
|
815 |
"filterlim f F F1 \<Longrightarrow> filterlim f F F2 \<Longrightarrow> filterlim f F (sup F1 F2)"
|
|
816 |
unfolding filterlim_def filtermap_sup by auto
|
|
817 |
|
|
818 |
lemma filterlim_Suc: "filterlim Suc sequentially sequentially"
|
|
819 |
by (simp add: filterlim_iff eventually_sequentially) (metis le_Suc_eq)
|
|
820 |
|
|
821 |
subsubsection {* Tendsto *}
|
|
822 |
|
|
823 |
abbreviation (in topological_space)
|
|
824 |
tendsto :: "('b \<Rightarrow> 'a) \<Rightarrow> 'a \<Rightarrow> 'b filter \<Rightarrow> bool" (infixr "--->" 55) where
|
|
825 |
"(f ---> l) F \<equiv> filterlim f (nhds l) F"
|
|
826 |
|
|
827 |
lemma tendsto_eq_rhs: "(f ---> x) F \<Longrightarrow> x = y \<Longrightarrow> (f ---> y) F"
|
|
828 |
by simp
|
|
829 |
|
|
830 |
ML {*
|
|
831 |
|
|
832 |
structure Tendsto_Intros = Named_Thms
|
|
833 |
(
|
|
834 |
val name = @{binding tendsto_intros}
|
|
835 |
val description = "introduction rules for tendsto"
|
|
836 |
)
|
|
837 |
|
|
838 |
*}
|
|
839 |
|
|
840 |
setup {*
|
|
841 |
Tendsto_Intros.setup #>
|
|
842 |
Global_Theory.add_thms_dynamic (@{binding tendsto_eq_intros},
|
|
843 |
map (fn thm => @{thm tendsto_eq_rhs} OF [thm]) o Tendsto_Intros.get o Context.proof_of);
|
|
844 |
*}
|
|
845 |
|
51473
|
846 |
lemma (in topological_space) tendsto_def:
|
|
847 |
"(f ---> l) F \<longleftrightarrow> (\<forall>S. open S \<longrightarrow> l \<in> S \<longrightarrow> eventually (\<lambda>x. f x \<in> S) F)"
|
51471
|
848 |
unfolding filterlim_def
|
|
849 |
proof safe
|
|
850 |
fix S assume "open S" "l \<in> S" "filtermap f F \<le> nhds l"
|
|
851 |
then show "eventually (\<lambda>x. f x \<in> S) F"
|
|
852 |
unfolding eventually_nhds eventually_filtermap le_filter_def
|
|
853 |
by (auto elim!: allE[of _ "\<lambda>x. x \<in> S"] eventually_rev_mp)
|
|
854 |
qed (auto elim!: eventually_rev_mp simp: eventually_nhds eventually_filtermap le_filter_def)
|
|
855 |
|
|
856 |
lemma filterlim_at:
|
|
857 |
"(LIM x F. f x :> at b) \<longleftrightarrow> (eventually (\<lambda>x. f x \<noteq> b) F \<and> (f ---> b) F)"
|
|
858 |
by (simp add: at_def filterlim_within)
|
|
859 |
|
|
860 |
lemma tendsto_mono: "F \<le> F' \<Longrightarrow> (f ---> l) F' \<Longrightarrow> (f ---> l) F"
|
|
861 |
unfolding tendsto_def le_filter_def by fast
|
|
862 |
|
51473
|
863 |
lemma (in topological_space) topological_tendstoI:
|
51471
|
864 |
"(\<And>S. open S \<Longrightarrow> l \<in> S \<Longrightarrow> eventually (\<lambda>x. f x \<in> S) F)
|
|
865 |
\<Longrightarrow> (f ---> l) F"
|
|
866 |
unfolding tendsto_def by auto
|
|
867 |
|
51473
|
868 |
lemma (in topological_space) topological_tendstoD:
|
51471
|
869 |
"(f ---> l) F \<Longrightarrow> open S \<Longrightarrow> l \<in> S \<Longrightarrow> eventually (\<lambda>x. f x \<in> S) F"
|
|
870 |
unfolding tendsto_def by auto
|
|
871 |
|
|
872 |
lemma order_tendstoI:
|
|
873 |
fixes y :: "_ :: order_topology"
|
|
874 |
assumes "\<And>a. a < y \<Longrightarrow> eventually (\<lambda>x. a < f x) F"
|
|
875 |
assumes "\<And>a. y < a \<Longrightarrow> eventually (\<lambda>x. f x < a) F"
|
|
876 |
shows "(f ---> y) F"
|
|
877 |
proof (rule topological_tendstoI)
|
|
878 |
fix S assume "open S" "y \<in> S"
|
|
879 |
then show "eventually (\<lambda>x. f x \<in> S) F"
|
|
880 |
unfolding open_generated_order
|
|
881 |
proof induct
|
|
882 |
case (UN K)
|
|
883 |
then obtain k where "y \<in> k" "k \<in> K" by auto
|
|
884 |
with UN(2)[of k] show ?case
|
|
885 |
by (auto elim: eventually_elim1)
|
|
886 |
qed (insert assms, auto elim: eventually_elim2)
|
|
887 |
qed
|
|
888 |
|
|
889 |
lemma order_tendstoD:
|
|
890 |
fixes y :: "_ :: order_topology"
|
|
891 |
assumes y: "(f ---> y) F"
|
|
892 |
shows "a < y \<Longrightarrow> eventually (\<lambda>x. a < f x) F"
|
|
893 |
and "y < a \<Longrightarrow> eventually (\<lambda>x. f x < a) F"
|
|
894 |
using topological_tendstoD[OF y, of "{..< a}"] topological_tendstoD[OF y, of "{a <..}"] by auto
|
|
895 |
|
|
896 |
lemma order_tendsto_iff:
|
|
897 |
fixes f :: "_ \<Rightarrow> 'a :: order_topology"
|
|
898 |
shows "(f ---> x) F \<longleftrightarrow>(\<forall>l<x. eventually (\<lambda>x. l < f x) F) \<and> (\<forall>u>x. eventually (\<lambda>x. f x < u) F)"
|
|
899 |
by (metis order_tendstoI order_tendstoD)
|
|
900 |
|
|
901 |
lemma tendsto_bot [simp]: "(f ---> a) bot"
|
|
902 |
unfolding tendsto_def by simp
|
|
903 |
|
|
904 |
lemma tendsto_ident_at [tendsto_intros]: "((\<lambda>x. x) ---> a) (at a)"
|
|
905 |
unfolding tendsto_def eventually_at_topological by auto
|
|
906 |
|
|
907 |
lemma tendsto_ident_at_within [tendsto_intros]:
|
|
908 |
"((\<lambda>x. x) ---> a) (at a within S)"
|
|
909 |
unfolding tendsto_def eventually_within eventually_at_topological by auto
|
|
910 |
|
|
911 |
lemma tendsto_const [tendsto_intros]: "((\<lambda>x. k) ---> k) F"
|
|
912 |
by (simp add: tendsto_def)
|
|
913 |
|
|
914 |
lemma tendsto_unique:
|
|
915 |
fixes f :: "'a \<Rightarrow> 'b::t2_space"
|
|
916 |
assumes "\<not> trivial_limit F" and "(f ---> a) F" and "(f ---> b) F"
|
|
917 |
shows "a = b"
|
|
918 |
proof (rule ccontr)
|
|
919 |
assume "a \<noteq> b"
|
|
920 |
obtain U V where "open U" "open V" "a \<in> U" "b \<in> V" "U \<inter> V = {}"
|
|
921 |
using hausdorff [OF `a \<noteq> b`] by fast
|
|
922 |
have "eventually (\<lambda>x. f x \<in> U) F"
|
|
923 |
using `(f ---> a) F` `open U` `a \<in> U` by (rule topological_tendstoD)
|
|
924 |
moreover
|
|
925 |
have "eventually (\<lambda>x. f x \<in> V) F"
|
|
926 |
using `(f ---> b) F` `open V` `b \<in> V` by (rule topological_tendstoD)
|
|
927 |
ultimately
|
|
928 |
have "eventually (\<lambda>x. False) F"
|
|
929 |
proof eventually_elim
|
|
930 |
case (elim x)
|
|
931 |
hence "f x \<in> U \<inter> V" by simp
|
|
932 |
with `U \<inter> V = {}` show ?case by simp
|
|
933 |
qed
|
|
934 |
with `\<not> trivial_limit F` show "False"
|
|
935 |
by (simp add: trivial_limit_def)
|
|
936 |
qed
|
|
937 |
|
|
938 |
lemma tendsto_const_iff:
|
|
939 |
fixes a b :: "'a::t2_space"
|
|
940 |
assumes "\<not> trivial_limit F" shows "((\<lambda>x. a) ---> b) F \<longleftrightarrow> a = b"
|
|
941 |
by (safe intro!: tendsto_const tendsto_unique [OF assms tendsto_const])
|
|
942 |
|
|
943 |
lemma increasing_tendsto:
|
|
944 |
fixes f :: "_ \<Rightarrow> 'a::order_topology"
|
|
945 |
assumes bdd: "eventually (\<lambda>n. f n \<le> l) F"
|
|
946 |
and en: "\<And>x. x < l \<Longrightarrow> eventually (\<lambda>n. x < f n) F"
|
|
947 |
shows "(f ---> l) F"
|
|
948 |
using assms by (intro order_tendstoI) (auto elim!: eventually_elim1)
|
|
949 |
|
|
950 |
lemma decreasing_tendsto:
|
|
951 |
fixes f :: "_ \<Rightarrow> 'a::order_topology"
|
|
952 |
assumes bdd: "eventually (\<lambda>n. l \<le> f n) F"
|
|
953 |
and en: "\<And>x. l < x \<Longrightarrow> eventually (\<lambda>n. f n < x) F"
|
|
954 |
shows "(f ---> l) F"
|
|
955 |
using assms by (intro order_tendstoI) (auto elim!: eventually_elim1)
|
|
956 |
|
|
957 |
lemma tendsto_sandwich:
|
|
958 |
fixes f g h :: "'a \<Rightarrow> 'b::order_topology"
|
|
959 |
assumes ev: "eventually (\<lambda>n. f n \<le> g n) net" "eventually (\<lambda>n. g n \<le> h n) net"
|
|
960 |
assumes lim: "(f ---> c) net" "(h ---> c) net"
|
|
961 |
shows "(g ---> c) net"
|
|
962 |
proof (rule order_tendstoI)
|
|
963 |
fix a show "a < c \<Longrightarrow> eventually (\<lambda>x. a < g x) net"
|
|
964 |
using order_tendstoD[OF lim(1), of a] ev by (auto elim: eventually_elim2)
|
|
965 |
next
|
|
966 |
fix a show "c < a \<Longrightarrow> eventually (\<lambda>x. g x < a) net"
|
|
967 |
using order_tendstoD[OF lim(2), of a] ev by (auto elim: eventually_elim2)
|
|
968 |
qed
|
|
969 |
|
|
970 |
lemma tendsto_le:
|
|
971 |
fixes f g :: "'a \<Rightarrow> 'b::linorder_topology"
|
|
972 |
assumes F: "\<not> trivial_limit F"
|
|
973 |
assumes x: "(f ---> x) F" and y: "(g ---> y) F"
|
|
974 |
assumes ev: "eventually (\<lambda>x. g x \<le> f x) F"
|
|
975 |
shows "y \<le> x"
|
|
976 |
proof (rule ccontr)
|
|
977 |
assume "\<not> y \<le> x"
|
|
978 |
with less_separate[of x y] obtain a b where xy: "x < a" "b < y" "{..<a} \<inter> {b<..} = {}"
|
|
979 |
by (auto simp: not_le)
|
|
980 |
then have "eventually (\<lambda>x. f x < a) F" "eventually (\<lambda>x. b < g x) F"
|
|
981 |
using x y by (auto intro: order_tendstoD)
|
|
982 |
with ev have "eventually (\<lambda>x. False) F"
|
|
983 |
by eventually_elim (insert xy, fastforce)
|
|
984 |
with F show False
|
|
985 |
by (simp add: eventually_False)
|
|
986 |
qed
|
|
987 |
|
|
988 |
lemma tendsto_le_const:
|
|
989 |
fixes f :: "'a \<Rightarrow> 'b::linorder_topology"
|
|
990 |
assumes F: "\<not> trivial_limit F"
|
|
991 |
assumes x: "(f ---> x) F" and a: "eventually (\<lambda>x. a \<le> f x) F"
|
|
992 |
shows "a \<le> x"
|
|
993 |
using F x tendsto_const a by (rule tendsto_le)
|
|
994 |
|
|
995 |
subsection {* Limits to @{const at_top} and @{const at_bot} *}
|
|
996 |
|
|
997 |
lemma filterlim_at_top:
|
|
998 |
fixes f :: "'a \<Rightarrow> ('b::linorder)"
|
|
999 |
shows "(LIM x F. f x :> at_top) \<longleftrightarrow> (\<forall>Z. eventually (\<lambda>x. Z \<le> f x) F)"
|
|
1000 |
by (auto simp: filterlim_iff eventually_at_top_linorder elim!: eventually_elim1)
|
|
1001 |
|
|
1002 |
lemma filterlim_at_top_dense:
|
|
1003 |
fixes f :: "'a \<Rightarrow> ('b::dense_linorder)"
|
|
1004 |
shows "(LIM x F. f x :> at_top) \<longleftrightarrow> (\<forall>Z. eventually (\<lambda>x. Z < f x) F)"
|
|
1005 |
by (metis eventually_elim1[of _ F] eventually_gt_at_top order_less_imp_le
|
|
1006 |
filterlim_at_top[of f F] filterlim_iff[of f at_top F])
|
|
1007 |
|
|
1008 |
lemma filterlim_at_top_ge:
|
|
1009 |
fixes f :: "'a \<Rightarrow> ('b::linorder)" and c :: "'b"
|
|
1010 |
shows "(LIM x F. f x :> at_top) \<longleftrightarrow> (\<forall>Z\<ge>c. eventually (\<lambda>x. Z \<le> f x) F)"
|
|
1011 |
unfolding filterlim_at_top
|
|
1012 |
proof safe
|
|
1013 |
fix Z assume *: "\<forall>Z\<ge>c. eventually (\<lambda>x. Z \<le> f x) F"
|
|
1014 |
with *[THEN spec, of "max Z c"] show "eventually (\<lambda>x. Z \<le> f x) F"
|
|
1015 |
by (auto elim!: eventually_elim1)
|
|
1016 |
qed simp
|
|
1017 |
|
|
1018 |
lemma filterlim_at_top_at_top:
|
|
1019 |
fixes f :: "'a::linorder \<Rightarrow> 'b::linorder"
|
|
1020 |
assumes mono: "\<And>x y. Q x \<Longrightarrow> Q y \<Longrightarrow> x \<le> y \<Longrightarrow> f x \<le> f y"
|
|
1021 |
assumes bij: "\<And>x. P x \<Longrightarrow> f (g x) = x" "\<And>x. P x \<Longrightarrow> Q (g x)"
|
|
1022 |
assumes Q: "eventually Q at_top"
|
|
1023 |
assumes P: "eventually P at_top"
|
|
1024 |
shows "filterlim f at_top at_top"
|
|
1025 |
proof -
|
|
1026 |
from P obtain x where x: "\<And>y. x \<le> y \<Longrightarrow> P y"
|
|
1027 |
unfolding eventually_at_top_linorder by auto
|
|
1028 |
show ?thesis
|
|
1029 |
proof (intro filterlim_at_top_ge[THEN iffD2] allI impI)
|
|
1030 |
fix z assume "x \<le> z"
|
|
1031 |
with x have "P z" by auto
|
|
1032 |
have "eventually (\<lambda>x. g z \<le> x) at_top"
|
|
1033 |
by (rule eventually_ge_at_top)
|
|
1034 |
with Q show "eventually (\<lambda>x. z \<le> f x) at_top"
|
|
1035 |
by eventually_elim (metis mono bij `P z`)
|
|
1036 |
qed
|
|
1037 |
qed
|
|
1038 |
|
|
1039 |
lemma filterlim_at_top_gt:
|
|
1040 |
fixes f :: "'a \<Rightarrow> ('b::dense_linorder)" and c :: "'b"
|
|
1041 |
shows "(LIM x F. f x :> at_top) \<longleftrightarrow> (\<forall>Z>c. eventually (\<lambda>x. Z \<le> f x) F)"
|
|
1042 |
by (metis filterlim_at_top order_less_le_trans gt_ex filterlim_at_top_ge)
|
|
1043 |
|
|
1044 |
lemma filterlim_at_bot:
|
|
1045 |
fixes f :: "'a \<Rightarrow> ('b::linorder)"
|
|
1046 |
shows "(LIM x F. f x :> at_bot) \<longleftrightarrow> (\<forall>Z. eventually (\<lambda>x. f x \<le> Z) F)"
|
|
1047 |
by (auto simp: filterlim_iff eventually_at_bot_linorder elim!: eventually_elim1)
|
|
1048 |
|
|
1049 |
lemma filterlim_at_bot_le:
|
|
1050 |
fixes f :: "'a \<Rightarrow> ('b::linorder)" and c :: "'b"
|
|
1051 |
shows "(LIM x F. f x :> at_bot) \<longleftrightarrow> (\<forall>Z\<le>c. eventually (\<lambda>x. Z \<ge> f x) F)"
|
|
1052 |
unfolding filterlim_at_bot
|
|
1053 |
proof safe
|
|
1054 |
fix Z assume *: "\<forall>Z\<le>c. eventually (\<lambda>x. Z \<ge> f x) F"
|
|
1055 |
with *[THEN spec, of "min Z c"] show "eventually (\<lambda>x. Z \<ge> f x) F"
|
|
1056 |
by (auto elim!: eventually_elim1)
|
|
1057 |
qed simp
|
|
1058 |
|
|
1059 |
lemma filterlim_at_bot_lt:
|
|
1060 |
fixes f :: "'a \<Rightarrow> ('b::dense_linorder)" and c :: "'b"
|
|
1061 |
shows "(LIM x F. f x :> at_bot) \<longleftrightarrow> (\<forall>Z<c. eventually (\<lambda>x. Z \<ge> f x) F)"
|
|
1062 |
by (metis filterlim_at_bot filterlim_at_bot_le lt_ex order_le_less_trans)
|
|
1063 |
|
|
1064 |
lemma filterlim_at_bot_at_right:
|
|
1065 |
fixes f :: "'a::{no_top, linorder_topology} \<Rightarrow> 'b::linorder"
|
|
1066 |
assumes mono: "\<And>x y. Q x \<Longrightarrow> Q y \<Longrightarrow> x \<le> y \<Longrightarrow> f x \<le> f y"
|
|
1067 |
assumes bij: "\<And>x. P x \<Longrightarrow> f (g x) = x" "\<And>x. P x \<Longrightarrow> Q (g x)"
|
|
1068 |
assumes Q: "eventually Q (at_right a)" and bound: "\<And>b. Q b \<Longrightarrow> a < b"
|
|
1069 |
assumes P: "eventually P at_bot"
|
|
1070 |
shows "filterlim f at_bot (at_right a)"
|
|
1071 |
proof -
|
|
1072 |
from P obtain x where x: "\<And>y. y \<le> x \<Longrightarrow> P y"
|
|
1073 |
unfolding eventually_at_bot_linorder by auto
|
|
1074 |
show ?thesis
|
|
1075 |
proof (intro filterlim_at_bot_le[THEN iffD2] allI impI)
|
|
1076 |
fix z assume "z \<le> x"
|
|
1077 |
with x have "P z" by auto
|
|
1078 |
have "eventually (\<lambda>x. x \<le> g z) (at_right a)"
|
|
1079 |
using bound[OF bij(2)[OF `P z`]]
|
|
1080 |
unfolding eventually_at_right by (auto intro!: exI[of _ "g z"])
|
|
1081 |
with Q show "eventually (\<lambda>x. f x \<le> z) (at_right a)"
|
|
1082 |
by eventually_elim (metis bij `P z` mono)
|
|
1083 |
qed
|
|
1084 |
qed
|
|
1085 |
|
|
1086 |
lemma filterlim_at_top_at_left:
|
|
1087 |
fixes f :: "'a::{no_bot, linorder_topology} \<Rightarrow> 'b::linorder"
|
|
1088 |
assumes mono: "\<And>x y. Q x \<Longrightarrow> Q y \<Longrightarrow> x \<le> y \<Longrightarrow> f x \<le> f y"
|
|
1089 |
assumes bij: "\<And>x. P x \<Longrightarrow> f (g x) = x" "\<And>x. P x \<Longrightarrow> Q (g x)"
|
|
1090 |
assumes Q: "eventually Q (at_left a)" and bound: "\<And>b. Q b \<Longrightarrow> b < a"
|
|
1091 |
assumes P: "eventually P at_top"
|
|
1092 |
shows "filterlim f at_top (at_left a)"
|
|
1093 |
proof -
|
|
1094 |
from P obtain x where x: "\<And>y. x \<le> y \<Longrightarrow> P y"
|
|
1095 |
unfolding eventually_at_top_linorder by auto
|
|
1096 |
show ?thesis
|
|
1097 |
proof (intro filterlim_at_top_ge[THEN iffD2] allI impI)
|
|
1098 |
fix z assume "x \<le> z"
|
|
1099 |
with x have "P z" by auto
|
|
1100 |
have "eventually (\<lambda>x. g z \<le> x) (at_left a)"
|
|
1101 |
using bound[OF bij(2)[OF `P z`]]
|
|
1102 |
unfolding eventually_at_left by (auto intro!: exI[of _ "g z"])
|
|
1103 |
with Q show "eventually (\<lambda>x. z \<le> f x) (at_left a)"
|
|
1104 |
by eventually_elim (metis bij `P z` mono)
|
|
1105 |
qed
|
|
1106 |
qed
|
|
1107 |
|
|
1108 |
lemma filterlim_split_at:
|
|
1109 |
"filterlim f F (at_left x) \<Longrightarrow> filterlim f F (at_right x) \<Longrightarrow> filterlim f F (at (x::'a::linorder_topology))"
|
|
1110 |
by (subst at_eq_sup_left_right) (rule filterlim_sup)
|
|
1111 |
|
|
1112 |
lemma filterlim_at_split:
|
|
1113 |
"filterlim f F (at (x::'a::linorder_topology)) \<longleftrightarrow> filterlim f F (at_left x) \<and> filterlim f F (at_right x)"
|
|
1114 |
by (subst at_eq_sup_left_right) (simp add: filterlim_def filtermap_sup)
|
|
1115 |
|
|
1116 |
|
|
1117 |
subsection {* Limits on sequences *}
|
|
1118 |
|
|
1119 |
abbreviation (in topological_space)
|
|
1120 |
LIMSEQ :: "[nat \<Rightarrow> 'a, 'a] \<Rightarrow> bool"
|
|
1121 |
("((_)/ ----> (_))" [60, 60] 60) where
|
|
1122 |
"X ----> L \<equiv> (X ---> L) sequentially"
|
|
1123 |
|
|
1124 |
definition
|
|
1125 |
lim :: "(nat \<Rightarrow> 'a::t2_space) \<Rightarrow> 'a" where
|
|
1126 |
--{*Standard definition of limit using choice operator*}
|
|
1127 |
"lim X = (THE L. X ----> L)"
|
|
1128 |
|
|
1129 |
definition (in topological_space) convergent :: "(nat \<Rightarrow> 'a) \<Rightarrow> bool" where
|
|
1130 |
"convergent X = (\<exists>L. X ----> L)"
|
|
1131 |
|
|
1132 |
subsubsection {* Monotone sequences and subsequences *}
|
|
1133 |
|
|
1134 |
definition
|
|
1135 |
monoseq :: "(nat \<Rightarrow> 'a::order) \<Rightarrow> bool" where
|
|
1136 |
--{*Definition of monotonicity.
|
|
1137 |
The use of disjunction here complicates proofs considerably.
|
|
1138 |
One alternative is to add a Boolean argument to indicate the direction.
|
|
1139 |
Another is to develop the notions of increasing and decreasing first.*}
|
|
1140 |
"monoseq X = ((\<forall>m. \<forall>n\<ge>m. X m \<le> X n) | (\<forall>m. \<forall>n\<ge>m. X n \<le> X m))"
|
|
1141 |
|
|
1142 |
definition
|
|
1143 |
incseq :: "(nat \<Rightarrow> 'a::order) \<Rightarrow> bool" where
|
|
1144 |
--{*Increasing sequence*}
|
|
1145 |
"incseq X \<longleftrightarrow> (\<forall>m. \<forall>n\<ge>m. X m \<le> X n)"
|
|
1146 |
|
|
1147 |
definition
|
|
1148 |
decseq :: "(nat \<Rightarrow> 'a::order) \<Rightarrow> bool" where
|
|
1149 |
--{*Decreasing sequence*}
|
|
1150 |
"decseq X \<longleftrightarrow> (\<forall>m. \<forall>n\<ge>m. X n \<le> X m)"
|
|
1151 |
|
|
1152 |
definition
|
|
1153 |
subseq :: "(nat \<Rightarrow> nat) \<Rightarrow> bool" where
|
|
1154 |
--{*Definition of subsequence*}
|
|
1155 |
"subseq f \<longleftrightarrow> (\<forall>m. \<forall>n>m. f m < f n)"
|
|
1156 |
|
|
1157 |
lemma incseq_mono: "mono f \<longleftrightarrow> incseq f"
|
|
1158 |
unfolding mono_def incseq_def by auto
|
|
1159 |
|
|
1160 |
lemma incseq_SucI:
|
|
1161 |
"(\<And>n. X n \<le> X (Suc n)) \<Longrightarrow> incseq X"
|
|
1162 |
using lift_Suc_mono_le[of X]
|
|
1163 |
by (auto simp: incseq_def)
|
|
1164 |
|
|
1165 |
lemma incseqD: "\<And>i j. incseq f \<Longrightarrow> i \<le> j \<Longrightarrow> f i \<le> f j"
|
|
1166 |
by (auto simp: incseq_def)
|
|
1167 |
|
|
1168 |
lemma incseq_SucD: "incseq A \<Longrightarrow> A i \<le> A (Suc i)"
|
|
1169 |
using incseqD[of A i "Suc i"] by auto
|
|
1170 |
|
|
1171 |
lemma incseq_Suc_iff: "incseq f \<longleftrightarrow> (\<forall>n. f n \<le> f (Suc n))"
|
|
1172 |
by (auto intro: incseq_SucI dest: incseq_SucD)
|
|
1173 |
|
|
1174 |
lemma incseq_const[simp, intro]: "incseq (\<lambda>x. k)"
|
|
1175 |
unfolding incseq_def by auto
|
|
1176 |
|
|
1177 |
lemma decseq_SucI:
|
|
1178 |
"(\<And>n. X (Suc n) \<le> X n) \<Longrightarrow> decseq X"
|
|
1179 |
using order.lift_Suc_mono_le[OF dual_order, of X]
|
|
1180 |
by (auto simp: decseq_def)
|
|
1181 |
|
|
1182 |
lemma decseqD: "\<And>i j. decseq f \<Longrightarrow> i \<le> j \<Longrightarrow> f j \<le> f i"
|
|
1183 |
by (auto simp: decseq_def)
|
|
1184 |
|
|
1185 |
lemma decseq_SucD: "decseq A \<Longrightarrow> A (Suc i) \<le> A i"
|
|
1186 |
using decseqD[of A i "Suc i"] by auto
|
|
1187 |
|
|
1188 |
lemma decseq_Suc_iff: "decseq f \<longleftrightarrow> (\<forall>n. f (Suc n) \<le> f n)"
|
|
1189 |
by (auto intro: decseq_SucI dest: decseq_SucD)
|
|
1190 |
|
|
1191 |
lemma decseq_const[simp, intro]: "decseq (\<lambda>x. k)"
|
|
1192 |
unfolding decseq_def by auto
|
|
1193 |
|
|
1194 |
lemma monoseq_iff: "monoseq X \<longleftrightarrow> incseq X \<or> decseq X"
|
|
1195 |
unfolding monoseq_def incseq_def decseq_def ..
|
|
1196 |
|
|
1197 |
lemma monoseq_Suc:
|
|
1198 |
"monoseq X \<longleftrightarrow> (\<forall>n. X n \<le> X (Suc n)) \<or> (\<forall>n. X (Suc n) \<le> X n)"
|
|
1199 |
unfolding monoseq_iff incseq_Suc_iff decseq_Suc_iff ..
|
|
1200 |
|
|
1201 |
lemma monoI1: "\<forall>m. \<forall> n \<ge> m. X m \<le> X n ==> monoseq X"
|
|
1202 |
by (simp add: monoseq_def)
|
|
1203 |
|
|
1204 |
lemma monoI2: "\<forall>m. \<forall> n \<ge> m. X n \<le> X m ==> monoseq X"
|
|
1205 |
by (simp add: monoseq_def)
|
|
1206 |
|
|
1207 |
lemma mono_SucI1: "\<forall>n. X n \<le> X (Suc n) ==> monoseq X"
|
|
1208 |
by (simp add: monoseq_Suc)
|
|
1209 |
|
|
1210 |
lemma mono_SucI2: "\<forall>n. X (Suc n) \<le> X n ==> monoseq X"
|
|
1211 |
by (simp add: monoseq_Suc)
|
|
1212 |
|
|
1213 |
lemma monoseq_minus:
|
|
1214 |
fixes a :: "nat \<Rightarrow> 'a::ordered_ab_group_add"
|
|
1215 |
assumes "monoseq a"
|
|
1216 |
shows "monoseq (\<lambda> n. - a n)"
|
|
1217 |
proof (cases "\<forall> m. \<forall> n \<ge> m. a m \<le> a n")
|
|
1218 |
case True
|
|
1219 |
hence "\<forall> m. \<forall> n \<ge> m. - a n \<le> - a m" by auto
|
|
1220 |
thus ?thesis by (rule monoI2)
|
|
1221 |
next
|
|
1222 |
case False
|
|
1223 |
hence "\<forall> m. \<forall> n \<ge> m. - a m \<le> - a n" using `monoseq a`[unfolded monoseq_def] by auto
|
|
1224 |
thus ?thesis by (rule monoI1)
|
|
1225 |
qed
|
|
1226 |
|
|
1227 |
text{*Subsequence (alternative definition, (e.g. Hoskins)*}
|
|
1228 |
|
|
1229 |
lemma subseq_Suc_iff: "subseq f = (\<forall>n. (f n) < (f (Suc n)))"
|
|
1230 |
apply (simp add: subseq_def)
|
|
1231 |
apply (auto dest!: less_imp_Suc_add)
|
|
1232 |
apply (induct_tac k)
|
|
1233 |
apply (auto intro: less_trans)
|
|
1234 |
done
|
|
1235 |
|
|
1236 |
text{* for any sequence, there is a monotonic subsequence *}
|
|
1237 |
lemma seq_monosub:
|
|
1238 |
fixes s :: "nat => 'a::linorder"
|
|
1239 |
shows "\<exists>f. subseq f \<and> monoseq (\<lambda> n. (s (f n)))"
|
|
1240 |
proof cases
|
|
1241 |
let "?P p n" = "p > n \<and> (\<forall>m\<ge>p. s m \<le> s p)"
|
|
1242 |
assume *: "\<forall>n. \<exists>p. ?P p n"
|
|
1243 |
def f \<equiv> "nat_rec (SOME p. ?P p 0) (\<lambda>_ n. SOME p. ?P p n)"
|
|
1244 |
have f_0: "f 0 = (SOME p. ?P p 0)" unfolding f_def by simp
|
|
1245 |
have f_Suc: "\<And>i. f (Suc i) = (SOME p. ?P p (f i))" unfolding f_def nat_rec_Suc ..
|
|
1246 |
have P_0: "?P (f 0) 0" unfolding f_0 using *[rule_format] by (rule someI2_ex) auto
|
|
1247 |
have P_Suc: "\<And>i. ?P (f (Suc i)) (f i)" unfolding f_Suc using *[rule_format] by (rule someI2_ex) auto
|
|
1248 |
then have "subseq f" unfolding subseq_Suc_iff by auto
|
|
1249 |
moreover have "monoseq (\<lambda>n. s (f n))" unfolding monoseq_Suc
|
|
1250 |
proof (intro disjI2 allI)
|
|
1251 |
fix n show "s (f (Suc n)) \<le> s (f n)"
|
|
1252 |
proof (cases n)
|
|
1253 |
case 0 with P_Suc[of 0] P_0 show ?thesis by auto
|
|
1254 |
next
|
|
1255 |
case (Suc m)
|
|
1256 |
from P_Suc[of n] Suc have "f (Suc m) \<le> f (Suc (Suc m))" by simp
|
|
1257 |
with P_Suc Suc show ?thesis by simp
|
|
1258 |
qed
|
|
1259 |
qed
|
|
1260 |
ultimately show ?thesis by auto
|
|
1261 |
next
|
|
1262 |
let "?P p m" = "m < p \<and> s m < s p"
|
|
1263 |
assume "\<not> (\<forall>n. \<exists>p>n. (\<forall>m\<ge>p. s m \<le> s p))"
|
|
1264 |
then obtain N where N: "\<And>p. p > N \<Longrightarrow> \<exists>m>p. s p < s m" by (force simp: not_le le_less)
|
|
1265 |
def f \<equiv> "nat_rec (SOME p. ?P p (Suc N)) (\<lambda>_ n. SOME p. ?P p n)"
|
|
1266 |
have f_0: "f 0 = (SOME p. ?P p (Suc N))" unfolding f_def by simp
|
|
1267 |
have f_Suc: "\<And>i. f (Suc i) = (SOME p. ?P p (f i))" unfolding f_def nat_rec_Suc ..
|
|
1268 |
have P_0: "?P (f 0) (Suc N)"
|
|
1269 |
unfolding f_0 some_eq_ex[of "\<lambda>p. ?P p (Suc N)"] using N[of "Suc N"] by auto
|
|
1270 |
{ fix i have "N < f i \<Longrightarrow> ?P (f (Suc i)) (f i)"
|
|
1271 |
unfolding f_Suc some_eq_ex[of "\<lambda>p. ?P p (f i)"] using N[of "f i"] . }
|
|
1272 |
note P' = this
|
|
1273 |
{ fix i have "N < f i \<and> ?P (f (Suc i)) (f i)"
|
|
1274 |
by (induct i) (insert P_0 P', auto) }
|
|
1275 |
then have "subseq f" "monoseq (\<lambda>x. s (f x))"
|
|
1276 |
unfolding subseq_Suc_iff monoseq_Suc by (auto simp: not_le intro: less_imp_le)
|
|
1277 |
then show ?thesis by auto
|
|
1278 |
qed
|
|
1279 |
|
|
1280 |
lemma seq_suble: assumes sf: "subseq f" shows "n \<le> f n"
|
|
1281 |
proof(induct n)
|
|
1282 |
case 0 thus ?case by simp
|
|
1283 |
next
|
|
1284 |
case (Suc n)
|
|
1285 |
from sf[unfolded subseq_Suc_iff, rule_format, of n] Suc.hyps
|
|
1286 |
have "n < f (Suc n)" by arith
|
|
1287 |
thus ?case by arith
|
|
1288 |
qed
|
|
1289 |
|
|
1290 |
lemma eventually_subseq:
|
|
1291 |
"subseq r \<Longrightarrow> eventually P sequentially \<Longrightarrow> eventually (\<lambda>n. P (r n)) sequentially"
|
|
1292 |
unfolding eventually_sequentially by (metis seq_suble le_trans)
|
|
1293 |
|
51473
|
1294 |
lemma not_eventually_sequentiallyD:
|
|
1295 |
assumes P: "\<not> eventually P sequentially"
|
|
1296 |
shows "\<exists>r. subseq r \<and> (\<forall>n. \<not> P (r n))"
|
|
1297 |
proof -
|
|
1298 |
from P have "\<forall>n. \<exists>m\<ge>n. \<not> P m"
|
|
1299 |
unfolding eventually_sequentially by (simp add: not_less)
|
|
1300 |
then obtain r where "\<And>n. r n \<ge> n" "\<And>n. \<not> P (r n)"
|
|
1301 |
by (auto simp: choice_iff)
|
|
1302 |
then show ?thesis
|
|
1303 |
by (auto intro!: exI[of _ "\<lambda>n. r (((Suc \<circ> r) ^^ Suc n) 0)"]
|
|
1304 |
simp: less_eq_Suc_le subseq_Suc_iff)
|
|
1305 |
qed
|
|
1306 |
|
51471
|
1307 |
lemma filterlim_subseq: "subseq f \<Longrightarrow> filterlim f sequentially sequentially"
|
|
1308 |
unfolding filterlim_iff by (metis eventually_subseq)
|
|
1309 |
|
|
1310 |
lemma subseq_o: "subseq r \<Longrightarrow> subseq s \<Longrightarrow> subseq (r \<circ> s)"
|
|
1311 |
unfolding subseq_def by simp
|
|
1312 |
|
|
1313 |
lemma subseq_mono: assumes "subseq r" "m < n" shows "r m < r n"
|
|
1314 |
using assms by (auto simp: subseq_def)
|
|
1315 |
|
|
1316 |
lemma incseq_imp_monoseq: "incseq X \<Longrightarrow> monoseq X"
|
|
1317 |
by (simp add: incseq_def monoseq_def)
|
|
1318 |
|
|
1319 |
lemma decseq_imp_monoseq: "decseq X \<Longrightarrow> monoseq X"
|
|
1320 |
by (simp add: decseq_def monoseq_def)
|
|
1321 |
|
|
1322 |
lemma decseq_eq_incseq:
|
|
1323 |
fixes X :: "nat \<Rightarrow> 'a::ordered_ab_group_add" shows "decseq X = incseq (\<lambda>n. - X n)"
|
|
1324 |
by (simp add: decseq_def incseq_def)
|
|
1325 |
|
|
1326 |
lemma INT_decseq_offset:
|
|
1327 |
assumes "decseq F"
|
|
1328 |
shows "(\<Inter>i. F i) = (\<Inter>i\<in>{n..}. F i)"
|
|
1329 |
proof safe
|
|
1330 |
fix x i assume x: "x \<in> (\<Inter>i\<in>{n..}. F i)"
|
|
1331 |
show "x \<in> F i"
|
|
1332 |
proof cases
|
|
1333 |
from x have "x \<in> F n" by auto
|
|
1334 |
also assume "i \<le> n" with `decseq F` have "F n \<subseteq> F i"
|
|
1335 |
unfolding decseq_def by simp
|
|
1336 |
finally show ?thesis .
|
|
1337 |
qed (insert x, simp)
|
|
1338 |
qed auto
|
|
1339 |
|
|
1340 |
lemma LIMSEQ_const_iff:
|
|
1341 |
fixes k l :: "'a::t2_space"
|
|
1342 |
shows "(\<lambda>n. k) ----> l \<longleftrightarrow> k = l"
|
|
1343 |
using trivial_limit_sequentially by (rule tendsto_const_iff)
|
|
1344 |
|
|
1345 |
lemma LIMSEQ_SUP:
|
|
1346 |
"incseq X \<Longrightarrow> X ----> (SUP i. X i :: 'a :: {complete_linorder, linorder_topology})"
|
|
1347 |
by (intro increasing_tendsto)
|
|
1348 |
(auto simp: SUP_upper less_SUP_iff incseq_def eventually_sequentially intro: less_le_trans)
|
|
1349 |
|
|
1350 |
lemma LIMSEQ_INF:
|
|
1351 |
"decseq X \<Longrightarrow> X ----> (INF i. X i :: 'a :: {complete_linorder, linorder_topology})"
|
|
1352 |
by (intro decreasing_tendsto)
|
|
1353 |
(auto simp: INF_lower INF_less_iff decseq_def eventually_sequentially intro: le_less_trans)
|
|
1354 |
|
|
1355 |
lemma LIMSEQ_ignore_initial_segment:
|
|
1356 |
"f ----> a \<Longrightarrow> (\<lambda>n. f (n + k)) ----> a"
|
|
1357 |
apply (rule topological_tendstoI)
|
|
1358 |
apply (drule (2) topological_tendstoD)
|
|
1359 |
apply (simp only: eventually_sequentially)
|
|
1360 |
apply (erule exE, rename_tac N)
|
|
1361 |
apply (rule_tac x=N in exI)
|
|
1362 |
apply simp
|
|
1363 |
done
|
|
1364 |
|
|
1365 |
lemma LIMSEQ_offset:
|
|
1366 |
"(\<lambda>n. f (n + k)) ----> a \<Longrightarrow> f ----> a"
|
|
1367 |
apply (rule topological_tendstoI)
|
|
1368 |
apply (drule (2) topological_tendstoD)
|
|
1369 |
apply (simp only: eventually_sequentially)
|
|
1370 |
apply (erule exE, rename_tac N)
|
|
1371 |
apply (rule_tac x="N + k" in exI)
|
|
1372 |
apply clarify
|
|
1373 |
apply (drule_tac x="n - k" in spec)
|
|
1374 |
apply (simp add: le_diff_conv2)
|
|
1375 |
done
|
|
1376 |
|
|
1377 |
lemma LIMSEQ_Suc: "f ----> l \<Longrightarrow> (\<lambda>n. f (Suc n)) ----> l"
|
|
1378 |
by (drule_tac k="Suc 0" in LIMSEQ_ignore_initial_segment, simp)
|
|
1379 |
|
|
1380 |
lemma LIMSEQ_imp_Suc: "(\<lambda>n. f (Suc n)) ----> l \<Longrightarrow> f ----> l"
|
|
1381 |
by (rule_tac k="Suc 0" in LIMSEQ_offset, simp)
|
|
1382 |
|
|
1383 |
lemma LIMSEQ_Suc_iff: "(\<lambda>n. f (Suc n)) ----> l = f ----> l"
|
|
1384 |
by (blast intro: LIMSEQ_imp_Suc LIMSEQ_Suc)
|
|
1385 |
|
|
1386 |
lemma LIMSEQ_unique:
|
|
1387 |
fixes a b :: "'a::t2_space"
|
|
1388 |
shows "\<lbrakk>X ----> a; X ----> b\<rbrakk> \<Longrightarrow> a = b"
|
|
1389 |
using trivial_limit_sequentially by (rule tendsto_unique)
|
|
1390 |
|
|
1391 |
lemma LIMSEQ_le_const:
|
|
1392 |
"\<lbrakk>X ----> (x::'a::linorder_topology); \<exists>N. \<forall>n\<ge>N. a \<le> X n\<rbrakk> \<Longrightarrow> a \<le> x"
|
|
1393 |
using tendsto_le_const[of sequentially X x a] by (simp add: eventually_sequentially)
|
|
1394 |
|
|
1395 |
lemma LIMSEQ_le:
|
|
1396 |
"\<lbrakk>X ----> x; Y ----> y; \<exists>N. \<forall>n\<ge>N. X n \<le> Y n\<rbrakk> \<Longrightarrow> x \<le> (y::'a::linorder_topology)"
|
|
1397 |
using tendsto_le[of sequentially Y y X x] by (simp add: eventually_sequentially)
|
|
1398 |
|
|
1399 |
lemma LIMSEQ_le_const2:
|
|
1400 |
"\<lbrakk>X ----> (x::'a::linorder_topology); \<exists>N. \<forall>n\<ge>N. X n \<le> a\<rbrakk> \<Longrightarrow> x \<le> a"
|
|
1401 |
by (rule LIMSEQ_le[of X x "\<lambda>n. a"]) (auto simp: tendsto_const)
|
|
1402 |
|
|
1403 |
lemma convergentD: "convergent X ==> \<exists>L. (X ----> L)"
|
|
1404 |
by (simp add: convergent_def)
|
|
1405 |
|
|
1406 |
lemma convergentI: "(X ----> L) ==> convergent X"
|
|
1407 |
by (auto simp add: convergent_def)
|
|
1408 |
|
|
1409 |
lemma convergent_LIMSEQ_iff: "convergent X = (X ----> lim X)"
|
|
1410 |
by (auto intro: theI LIMSEQ_unique simp add: convergent_def lim_def)
|
|
1411 |
|
|
1412 |
lemma convergent_const: "convergent (\<lambda>n. c)"
|
|
1413 |
by (rule convergentI, rule tendsto_const)
|
|
1414 |
|
|
1415 |
lemma monoseq_le:
|
|
1416 |
"monoseq a \<Longrightarrow> a ----> (x::'a::linorder_topology) \<Longrightarrow>
|
|
1417 |
((\<forall> n. a n \<le> x) \<and> (\<forall>m. \<forall>n\<ge>m. a m \<le> a n)) \<or> ((\<forall> n. x \<le> a n) \<and> (\<forall>m. \<forall>n\<ge>m. a n \<le> a m))"
|
|
1418 |
by (metis LIMSEQ_le_const LIMSEQ_le_const2 decseq_def incseq_def monoseq_iff)
|
|
1419 |
|
|
1420 |
lemma LIMSEQ_subseq_LIMSEQ:
|
|
1421 |
"\<lbrakk> X ----> L; subseq f \<rbrakk> \<Longrightarrow> (X o f) ----> L"
|
|
1422 |
unfolding comp_def by (rule filterlim_compose[of X, OF _ filterlim_subseq])
|
|
1423 |
|
|
1424 |
lemma convergent_subseq_convergent:
|
|
1425 |
"\<lbrakk>convergent X; subseq f\<rbrakk> \<Longrightarrow> convergent (X o f)"
|
|
1426 |
unfolding convergent_def by (auto intro: LIMSEQ_subseq_LIMSEQ)
|
|
1427 |
|
|
1428 |
lemma limI: "X ----> L ==> lim X = L"
|
|
1429 |
apply (simp add: lim_def)
|
|
1430 |
apply (blast intro: LIMSEQ_unique)
|
|
1431 |
done
|
|
1432 |
|
|
1433 |
lemma lim_le: "convergent f \<Longrightarrow> (\<And>n. f n \<le> (x::'a::linorder_topology)) \<Longrightarrow> lim f \<le> x"
|
|
1434 |
using LIMSEQ_le_const2[of f "lim f" x] by (simp add: convergent_LIMSEQ_iff)
|
|
1435 |
|
|
1436 |
subsubsection{*Increasing and Decreasing Series*}
|
|
1437 |
|
|
1438 |
lemma incseq_le: "incseq X \<Longrightarrow> X ----> L \<Longrightarrow> X n \<le> (L::'a::linorder_topology)"
|
|
1439 |
by (metis incseq_def LIMSEQ_le_const)
|
|
1440 |
|
|
1441 |
lemma decseq_le: "decseq X \<Longrightarrow> X ----> L \<Longrightarrow> (L::'a::linorder_topology) \<le> X n"
|
|
1442 |
by (metis decseq_def LIMSEQ_le_const2)
|
|
1443 |
|
51473
|
1444 |
subsection {* First countable topologies *}
|
|
1445 |
|
|
1446 |
class first_countable_topology = topological_space +
|
|
1447 |
assumes first_countable_basis:
|
|
1448 |
"\<exists>A::nat \<Rightarrow> 'a set. (\<forall>i. x \<in> A i \<and> open (A i)) \<and> (\<forall>S. open S \<and> x \<in> S \<longrightarrow> (\<exists>i. A i \<subseteq> S))"
|
|
1449 |
|
|
1450 |
lemma (in first_countable_topology) countable_basis_at_decseq:
|
|
1451 |
obtains A :: "nat \<Rightarrow> 'a set" where
|
|
1452 |
"\<And>i. open (A i)" "\<And>i. x \<in> (A i)"
|
|
1453 |
"\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> eventually (\<lambda>i. A i \<subseteq> S) sequentially"
|
|
1454 |
proof atomize_elim
|
|
1455 |
from first_countable_basis[of x] obtain A :: "nat \<Rightarrow> 'a set" where
|
|
1456 |
nhds: "\<And>i. open (A i)" "\<And>i. x \<in> A i"
|
|
1457 |
and incl: "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> \<exists>i. A i \<subseteq> S" by auto
|
|
1458 |
def F \<equiv> "\<lambda>n. \<Inter>i\<le>n. A i"
|
|
1459 |
show "\<exists>A. (\<forall>i. open (A i)) \<and> (\<forall>i. x \<in> A i) \<and>
|
|
1460 |
(\<forall>S. open S \<longrightarrow> x \<in> S \<longrightarrow> eventually (\<lambda>i. A i \<subseteq> S) sequentially)"
|
|
1461 |
proof (safe intro!: exI[of _ F])
|
|
1462 |
fix i
|
|
1463 |
show "open (F i)" using nhds(1) by (auto simp: F_def intro!: open_INT)
|
|
1464 |
show "x \<in> F i" using nhds(2) by (auto simp: F_def)
|
|
1465 |
next
|
|
1466 |
fix S assume "open S" "x \<in> S"
|
|
1467 |
from incl[OF this] obtain i where "F i \<subseteq> S" unfolding F_def by auto
|
|
1468 |
moreover have "\<And>j. i \<le> j \<Longrightarrow> F j \<subseteq> F i"
|
|
1469 |
by (auto simp: F_def)
|
|
1470 |
ultimately show "eventually (\<lambda>i. F i \<subseteq> S) sequentially"
|
|
1471 |
by (auto simp: eventually_sequentially)
|
|
1472 |
qed
|
|
1473 |
qed
|
|
1474 |
|
|
1475 |
lemma (in first_countable_topology) countable_basis:
|
|
1476 |
obtains A :: "nat \<Rightarrow> 'a set" where
|
|
1477 |
"\<And>i. open (A i)" "\<And>i. x \<in> A i"
|
|
1478 |
"\<And>F. (\<forall>n. F n \<in> A n) \<Longrightarrow> F ----> x"
|
|
1479 |
proof atomize_elim
|
|
1480 |
from countable_basis_at_decseq[of x] guess A . note A = this
|
|
1481 |
{ fix F S assume "\<forall>n. F n \<in> A n" "open S" "x \<in> S"
|
|
1482 |
with A(3)[of S] have "eventually (\<lambda>n. F n \<in> S) sequentially"
|
|
1483 |
by (auto elim: eventually_elim1 simp: subset_eq) }
|
|
1484 |
with A show "\<exists>A. (\<forall>i. open (A i)) \<and> (\<forall>i. x \<in> A i) \<and> (\<forall>F. (\<forall>n. F n \<in> A n) \<longrightarrow> F ----> x)"
|
|
1485 |
by (intro exI[of _ A]) (auto simp: tendsto_def)
|
|
1486 |
qed
|
|
1487 |
|
|
1488 |
lemma (in first_countable_topology) sequentially_imp_eventually_nhds_within:
|
|
1489 |
assumes "\<forall>f. (\<forall>n. f n \<in> s) \<and> f ----> a \<longrightarrow> eventually (\<lambda>n. P (f n)) sequentially"
|
|
1490 |
shows "eventually P (nhds a within s)"
|
|
1491 |
proof (rule ccontr)
|
|
1492 |
from countable_basis[of a] guess A . note A = this
|
|
1493 |
assume "\<not> eventually P (nhds a within s)"
|
|
1494 |
with A have P: "\<exists>F. \<forall>n. F n \<in> s \<and> F n \<in> A n \<and> \<not> P (F n)"
|
|
1495 |
unfolding eventually_within eventually_nhds by (intro choice) fastforce
|
|
1496 |
then guess F ..
|
|
1497 |
hence F0: "\<forall>n. F n \<in> s" and F2: "\<forall>n. F n \<in> A n" and F3: "\<forall>n. \<not> P (F n)"
|
|
1498 |
by fast+
|
|
1499 |
with A have "F ----> a" by auto
|
|
1500 |
hence "eventually (\<lambda>n. P (F n)) sequentially"
|
|
1501 |
using assms F0 by simp
|
|
1502 |
thus "False" by (simp add: F3)
|
|
1503 |
qed
|
|
1504 |
|
|
1505 |
lemma (in first_countable_topology) eventually_nhds_within_iff_sequentially:
|
|
1506 |
"eventually P (nhds a within s) \<longleftrightarrow>
|
|
1507 |
(\<forall>f. (\<forall>n. f n \<in> s) \<and> f ----> a \<longrightarrow> eventually (\<lambda>n. P (f n)) sequentially)"
|
|
1508 |
proof (safe intro!: sequentially_imp_eventually_nhds_within)
|
|
1509 |
assume "eventually P (nhds a within s)"
|
|
1510 |
then obtain S where "open S" "a \<in> S" "\<forall>x\<in>S. x \<in> s \<longrightarrow> P x"
|
|
1511 |
by (auto simp: eventually_within eventually_nhds)
|
|
1512 |
moreover fix f assume "\<forall>n. f n \<in> s" "f ----> a"
|
|
1513 |
ultimately show "eventually (\<lambda>n. P (f n)) sequentially"
|
|
1514 |
by (auto dest!: topological_tendstoD elim: eventually_elim1)
|
|
1515 |
qed
|
|
1516 |
|
|
1517 |
lemma (in first_countable_topology) eventually_nhds_iff_sequentially:
|
|
1518 |
"eventually P (nhds a) \<longleftrightarrow> (\<forall>f. f ----> a \<longrightarrow> eventually (\<lambda>n. P (f n)) sequentially)"
|
|
1519 |
using eventually_nhds_within_iff_sequentially[of P a UNIV] by simp
|
|
1520 |
|
51471
|
1521 |
subsection {* Function limit at a point *}
|
|
1522 |
|
|
1523 |
abbreviation
|
|
1524 |
LIM :: "('a::topological_space \<Rightarrow> 'b::topological_space) \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> bool"
|
|
1525 |
("((_)/ -- (_)/ --> (_))" [60, 0, 60] 60) where
|
|
1526 |
"f -- a --> L \<equiv> (f ---> L) (at a)"
|
|
1527 |
|
|
1528 |
lemma LIM_const_not_eq[tendsto_intros]:
|
|
1529 |
fixes a :: "'a::perfect_space"
|
|
1530 |
fixes k L :: "'b::t2_space"
|
|
1531 |
shows "k \<noteq> L \<Longrightarrow> \<not> (\<lambda>x. k) -- a --> L"
|
|
1532 |
by (simp add: tendsto_const_iff)
|
|
1533 |
|
|
1534 |
lemmas LIM_not_zero = LIM_const_not_eq [where L = 0]
|
|
1535 |
|
|
1536 |
lemma LIM_const_eq:
|
|
1537 |
fixes a :: "'a::perfect_space"
|
|
1538 |
fixes k L :: "'b::t2_space"
|
|
1539 |
shows "(\<lambda>x. k) -- a --> L \<Longrightarrow> k = L"
|
|
1540 |
by (simp add: tendsto_const_iff)
|
|
1541 |
|
|
1542 |
lemma LIM_unique:
|
|
1543 |
fixes a :: "'a::perfect_space" and L M :: "'b::t2_space"
|
|
1544 |
shows "f -- a --> L \<Longrightarrow> f -- a --> M \<Longrightarrow> L = M"
|
|
1545 |
using at_neq_bot by (rule tendsto_unique)
|
|
1546 |
|
|
1547 |
text {* Limits are equal for functions equal except at limit point *}
|
|
1548 |
|
|
1549 |
lemma LIM_equal: "\<forall>x. x \<noteq> a --> (f x = g x) \<Longrightarrow> (f -- a --> l) \<longleftrightarrow> (g -- a --> l)"
|
|
1550 |
unfolding tendsto_def eventually_at_topological by simp
|
|
1551 |
|
|
1552 |
lemma LIM_cong: "a = b \<Longrightarrow> (\<And>x. x \<noteq> b \<Longrightarrow> f x = g x) \<Longrightarrow> l = m \<Longrightarrow> (f -- a --> l) \<longleftrightarrow> (g -- b --> m)"
|
|
1553 |
by (simp add: LIM_equal)
|
|
1554 |
|
|
1555 |
lemma LIM_cong_limit: "f -- x --> L \<Longrightarrow> K = L \<Longrightarrow> f -- x --> K"
|
|
1556 |
by simp
|
|
1557 |
|
|
1558 |
lemma tendsto_at_iff_tendsto_nhds:
|
|
1559 |
"g -- l --> g l \<longleftrightarrow> (g ---> g l) (nhds l)"
|
|
1560 |
unfolding tendsto_def at_def eventually_within
|
|
1561 |
by (intro ext all_cong imp_cong) (auto elim!: eventually_elim1)
|
|
1562 |
|
|
1563 |
lemma tendsto_compose:
|
|
1564 |
"g -- l --> g l \<Longrightarrow> (f ---> l) F \<Longrightarrow> ((\<lambda>x. g (f x)) ---> g l) F"
|
|
1565 |
unfolding tendsto_at_iff_tendsto_nhds by (rule filterlim_compose[of g])
|
|
1566 |
|
|
1567 |
lemma LIM_o: "\<lbrakk>g -- l --> g l; f -- a --> l\<rbrakk> \<Longrightarrow> (g \<circ> f) -- a --> g l"
|
|
1568 |
unfolding o_def by (rule tendsto_compose)
|
|
1569 |
|
|
1570 |
lemma tendsto_compose_eventually:
|
|
1571 |
"g -- l --> m \<Longrightarrow> (f ---> l) F \<Longrightarrow> eventually (\<lambda>x. f x \<noteq> l) F \<Longrightarrow> ((\<lambda>x. g (f x)) ---> m) F"
|
|
1572 |
by (rule filterlim_compose[of g _ "at l"]) (auto simp add: filterlim_at)
|
|
1573 |
|
|
1574 |
lemma LIM_compose_eventually:
|
|
1575 |
assumes f: "f -- a --> b"
|
|
1576 |
assumes g: "g -- b --> c"
|
|
1577 |
assumes inj: "eventually (\<lambda>x. f x \<noteq> b) (at a)"
|
|
1578 |
shows "(\<lambda>x. g (f x)) -- a --> c"
|
|
1579 |
using g f inj by (rule tendsto_compose_eventually)
|
|
1580 |
|
51473
|
1581 |
subsubsection {* Relation of LIM and LIMSEQ *}
|
|
1582 |
|
|
1583 |
lemma (in first_countable_topology) sequentially_imp_eventually_within:
|
|
1584 |
"(\<forall>f. (\<forall>n. f n \<in> s \<and> f n \<noteq> a) \<and> f ----> a \<longrightarrow> eventually (\<lambda>n. P (f n)) sequentially) \<Longrightarrow>
|
|
1585 |
eventually P (at a within s)"
|
|
1586 |
unfolding at_def within_within_eq
|
|
1587 |
by (intro sequentially_imp_eventually_nhds_within) auto
|
|
1588 |
|
|
1589 |
lemma (in first_countable_topology) sequentially_imp_eventually_at:
|
|
1590 |
"(\<forall>f. (\<forall>n. f n \<noteq> a) \<and> f ----> a \<longrightarrow> eventually (\<lambda>n. P (f n)) sequentially) \<Longrightarrow> eventually P (at a)"
|
|
1591 |
using assms sequentially_imp_eventually_within [where s=UNIV] by simp
|
|
1592 |
|
|
1593 |
lemma LIMSEQ_SEQ_conv1:
|
|
1594 |
fixes f :: "'a::topological_space \<Rightarrow> 'b::topological_space"
|
|
1595 |
assumes f: "f -- a --> l"
|
|
1596 |
shows "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. f (S n)) ----> l"
|
|
1597 |
using tendsto_compose_eventually [OF f, where F=sequentially] by simp
|
|
1598 |
|
|
1599 |
lemma LIMSEQ_SEQ_conv2:
|
|
1600 |
fixes f :: "'a::first_countable_topology \<Rightarrow> 'b::topological_space"
|
|
1601 |
assumes "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. f (S n)) ----> l"
|
|
1602 |
shows "f -- a --> l"
|
|
1603 |
using assms unfolding tendsto_def [where l=l] by (simp add: sequentially_imp_eventually_at)
|
|
1604 |
|
|
1605 |
lemma LIMSEQ_SEQ_conv:
|
|
1606 |
"(\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> (a::'a::first_countable_topology) \<longrightarrow> (\<lambda>n. X (S n)) ----> L) =
|
|
1607 |
(X -- a --> (L::'b::topological_space))"
|
|
1608 |
using LIMSEQ_SEQ_conv2 LIMSEQ_SEQ_conv1 ..
|
|
1609 |
|
51471
|
1610 |
subsection {* Continuity *}
|
|
1611 |
|
|
1612 |
definition isCont :: "('a::topological_space \<Rightarrow> 'b::topological_space) \<Rightarrow> 'a \<Rightarrow> bool" where
|
|
1613 |
"isCont f a \<longleftrightarrow> f -- a --> f a"
|
|
1614 |
|
|
1615 |
lemma isCont_ident [simp]: "isCont (\<lambda>x. x) a"
|
|
1616 |
unfolding isCont_def by (rule tendsto_ident_at)
|
|
1617 |
|
|
1618 |
lemma isCont_const [simp]: "isCont (\<lambda>x. k) a"
|
|
1619 |
unfolding isCont_def by (rule tendsto_const)
|
|
1620 |
|
|
1621 |
lemma isCont_tendsto_compose: "isCont g l \<Longrightarrow> (f ---> l) F \<Longrightarrow> ((\<lambda>x. g (f x)) ---> g l) F"
|
|
1622 |
unfolding isCont_def by (rule tendsto_compose)
|
|
1623 |
|
|
1624 |
lemma isCont_o2: "isCont f a \<Longrightarrow> isCont g (f a) \<Longrightarrow> isCont (\<lambda>x. g (f x)) a"
|
|
1625 |
unfolding isCont_def by (rule tendsto_compose)
|
|
1626 |
|
|
1627 |
lemma isCont_o: "isCont f a \<Longrightarrow> isCont g (f a) \<Longrightarrow> isCont (g o f) a"
|
|
1628 |
unfolding o_def by (rule isCont_o2)
|
|
1629 |
|
|
1630 |
end
|
|
1631 |
|