src/HOL/Topological_Spaces.thy
 author hoelzl Fri Mar 22 10:41:42 2013 +0100 (2013-03-22) changeset 51471 cad22a3cc09c child 51473 1210309fddab permissions -rw-r--r--
move topological_space to its own theory
```     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
```
```   684 abbreviation at_right :: "'a\<Colon>{topological_space, order} \<Rightarrow> 'a filter" where
```
```   685   "at_right x \<equiv> at x within {x <..}"
```
```   686
```
```   687 abbreviation at_left :: "'a\<Colon>{topological_space, order} \<Rightarrow> 'a filter" where
```
```   688   "at_left x \<equiv> at x within {..< x}"
```
```   689
```
```   690 lemma eventually_nhds:
```
```   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)
```
```   694   have "open (UNIV :: 'a :: topological_space set) \<and> a \<in> UNIV \<and> (\<forall>x\<in>UNIV. True)" by simp
```
```   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
```
```   846 lemma tendsto_def: "(f ---> l) F \<longleftrightarrow> (\<forall>S. open S \<longrightarrow> l \<in> S \<longrightarrow> eventually (\<lambda>x. f x \<in> S) F)"
```
```   847   unfolding filterlim_def
```
```   848 proof safe
```
```   849   fix S assume "open S" "l \<in> S" "filtermap f F \<le> nhds l"
```
```   850   then show "eventually (\<lambda>x. f x \<in> S) F"
```
```   851     unfolding eventually_nhds eventually_filtermap le_filter_def
```
```   852     by (auto elim!: allE[of _ "\<lambda>x. x \<in> S"] eventually_rev_mp)
```
```   853 qed (auto elim!: eventually_rev_mp simp: eventually_nhds eventually_filtermap le_filter_def)
```
```   854
```
```   855 lemma filterlim_at:
```
```   856   "(LIM x F. f x :> at b) \<longleftrightarrow> (eventually (\<lambda>x. f x \<noteq> b) F \<and> (f ---> b) F)"
```
```   857   by (simp add: at_def filterlim_within)
```
```   858
```
```   859 lemma tendsto_mono: "F \<le> F' \<Longrightarrow> (f ---> l) F' \<Longrightarrow> (f ---> l) F"
```
```   860   unfolding tendsto_def le_filter_def by fast
```
```   861
```
```   862 lemma topological_tendstoI:
```
```   863   "(\<And>S. open S \<Longrightarrow> l \<in> S \<Longrightarrow> eventually (\<lambda>x. f x \<in> S) F)
```
```   864     \<Longrightarrow> (f ---> l) F"
```
```   865   unfolding tendsto_def by auto
```
```   866
```
```   867 lemma topological_tendstoD:
```
```   868   "(f ---> l) F \<Longrightarrow> open S \<Longrightarrow> l \<in> S \<Longrightarrow> eventually (\<lambda>x. f x \<in> S) F"
```
```   869   unfolding tendsto_def by auto
```
```   870
```
```   871 lemma order_tendstoI:
```
```   872   fixes y :: "_ :: order_topology"
```
```   873   assumes "\<And>a. a < y \<Longrightarrow> eventually (\<lambda>x. a < f x) F"
```
```   874   assumes "\<And>a. y < a \<Longrightarrow> eventually (\<lambda>x. f x < a) F"
```
```   875   shows "(f ---> y) F"
```
```   876 proof (rule topological_tendstoI)
```
```   877   fix S assume "open S" "y \<in> S"
```
```   878   then show "eventually (\<lambda>x. f x \<in> S) F"
```
```   879     unfolding open_generated_order
```
```   880   proof induct
```
```   881     case (UN K)
```
```   882     then obtain k where "y \<in> k" "k \<in> K" by auto
```
```   883     with UN(2)[of k] show ?case
```
```   884       by (auto elim: eventually_elim1)
```
```   885   qed (insert assms, auto elim: eventually_elim2)
```
```   886 qed
```
```   887
```
```   888 lemma order_tendstoD:
```
```   889   fixes y :: "_ :: order_topology"
```
```   890   assumes y: "(f ---> y) F"
```
```   891   shows "a < y \<Longrightarrow> eventually (\<lambda>x. a < f x) F"
```
```   892     and "y < a \<Longrightarrow> eventually (\<lambda>x. f x < a) F"
```
```   893   using topological_tendstoD[OF y, of "{..< a}"] topological_tendstoD[OF y, of "{a <..}"] by auto
```
```   894
```
```   895 lemma order_tendsto_iff:
```
```   896   fixes f :: "_ \<Rightarrow> 'a :: order_topology"
```
```   897   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)"
```
```   898   by (metis order_tendstoI order_tendstoD)
```
```   899
```
```   900 lemma tendsto_bot [simp]: "(f ---> a) bot"
```
```   901   unfolding tendsto_def by simp
```
```   902
```
```   903 lemma tendsto_ident_at [tendsto_intros]: "((\<lambda>x. x) ---> a) (at a)"
```
```   904   unfolding tendsto_def eventually_at_topological by auto
```
```   905
```
```   906 lemma tendsto_ident_at_within [tendsto_intros]:
```
```   907   "((\<lambda>x. x) ---> a) (at a within S)"
```
```   908   unfolding tendsto_def eventually_within eventually_at_topological by auto
```
```   909
```
```   910 lemma tendsto_const [tendsto_intros]: "((\<lambda>x. k) ---> k) F"
```
```   911   by (simp add: tendsto_def)
```
```   912
```
```   913 lemma tendsto_unique:
```
```   914   fixes f :: "'a \<Rightarrow> 'b::t2_space"
```
```   915   assumes "\<not> trivial_limit F" and "(f ---> a) F" and "(f ---> b) F"
```
```   916   shows "a = b"
```
```   917 proof (rule ccontr)
```
```   918   assume "a \<noteq> b"
```
```   919   obtain U V where "open U" "open V" "a \<in> U" "b \<in> V" "U \<inter> V = {}"
```
```   920     using hausdorff [OF `a \<noteq> b`] by fast
```
```   921   have "eventually (\<lambda>x. f x \<in> U) F"
```
```   922     using `(f ---> a) F` `open U` `a \<in> U` by (rule topological_tendstoD)
```
```   923   moreover
```
```   924   have "eventually (\<lambda>x. f x \<in> V) F"
```
```   925     using `(f ---> b) F` `open V` `b \<in> V` by (rule topological_tendstoD)
```
```   926   ultimately
```
```   927   have "eventually (\<lambda>x. False) F"
```
```   928   proof eventually_elim
```
```   929     case (elim x)
```
```   930     hence "f x \<in> U \<inter> V" by simp
```
```   931     with `U \<inter> V = {}` show ?case by simp
```
```   932   qed
```
```   933   with `\<not> trivial_limit F` show "False"
```
```   934     by (simp add: trivial_limit_def)
```
```   935 qed
```
```   936
```
```   937 lemma tendsto_const_iff:
```
```   938   fixes a b :: "'a::t2_space"
```
```   939   assumes "\<not> trivial_limit F" shows "((\<lambda>x. a) ---> b) F \<longleftrightarrow> a = b"
```
```   940   by (safe intro!: tendsto_const tendsto_unique [OF assms tendsto_const])
```
```   941
```
```   942 lemma increasing_tendsto:
```
```   943   fixes f :: "_ \<Rightarrow> 'a::order_topology"
```
```   944   assumes bdd: "eventually (\<lambda>n. f n \<le> l) F"
```
```   945       and en: "\<And>x. x < l \<Longrightarrow> eventually (\<lambda>n. x < f n) F"
```
```   946   shows "(f ---> l) F"
```
```   947   using assms by (intro order_tendstoI) (auto elim!: eventually_elim1)
```
```   948
```
```   949 lemma decreasing_tendsto:
```
```   950   fixes f :: "_ \<Rightarrow> 'a::order_topology"
```
```   951   assumes bdd: "eventually (\<lambda>n. l \<le> f n) F"
```
```   952       and en: "\<And>x. l < x \<Longrightarrow> eventually (\<lambda>n. f n < x) F"
```
```   953   shows "(f ---> l) F"
```
```   954   using assms by (intro order_tendstoI) (auto elim!: eventually_elim1)
```
```   955
```
```   956 lemma tendsto_sandwich:
```
```   957   fixes f g h :: "'a \<Rightarrow> 'b::order_topology"
```
```   958   assumes ev: "eventually (\<lambda>n. f n \<le> g n) net" "eventually (\<lambda>n. g n \<le> h n) net"
```
```   959   assumes lim: "(f ---> c) net" "(h ---> c) net"
```
```   960   shows "(g ---> c) net"
```
```   961 proof (rule order_tendstoI)
```
```   962   fix a show "a < c \<Longrightarrow> eventually (\<lambda>x. a < g x) net"
```
```   963     using order_tendstoD[OF lim(1), of a] ev by (auto elim: eventually_elim2)
```
```   964 next
```
```   965   fix a show "c < a \<Longrightarrow> eventually (\<lambda>x. g x < a) net"
```
```   966     using order_tendstoD[OF lim(2), of a] ev by (auto elim: eventually_elim2)
```
```   967 qed
```
```   968
```
```   969 lemma tendsto_le:
```
```   970   fixes f g :: "'a \<Rightarrow> 'b::linorder_topology"
```
```   971   assumes F: "\<not> trivial_limit F"
```
```   972   assumes x: "(f ---> x) F" and y: "(g ---> y) F"
```
```   973   assumes ev: "eventually (\<lambda>x. g x \<le> f x) F"
```
```   974   shows "y \<le> x"
```
```   975 proof (rule ccontr)
```
```   976   assume "\<not> y \<le> x"
```
```   977   with less_separate[of x y] obtain a b where xy: "x < a" "b < y" "{..<a} \<inter> {b<..} = {}"
```
```   978     by (auto simp: not_le)
```
```   979   then have "eventually (\<lambda>x. f x < a) F" "eventually (\<lambda>x. b < g x) F"
```
```   980     using x y by (auto intro: order_tendstoD)
```
```   981   with ev have "eventually (\<lambda>x. False) F"
```
```   982     by eventually_elim (insert xy, fastforce)
```
```   983   with F show False
```
```   984     by (simp add: eventually_False)
```
```   985 qed
```
```   986
```
```   987 lemma tendsto_le_const:
```
```   988   fixes f :: "'a \<Rightarrow> 'b::linorder_topology"
```
```   989   assumes F: "\<not> trivial_limit F"
```
```   990   assumes x: "(f ---> x) F" and a: "eventually (\<lambda>x. a \<le> f x) F"
```
```   991   shows "a \<le> x"
```
```   992   using F x tendsto_const a by (rule tendsto_le)
```
```   993
```
```   994 subsection {* Limits to @{const at_top} and @{const at_bot} *}
```
```   995
```
```   996 lemma filterlim_at_top:
```
```   997   fixes f :: "'a \<Rightarrow> ('b::linorder)"
```
```   998   shows "(LIM x F. f x :> at_top) \<longleftrightarrow> (\<forall>Z. eventually (\<lambda>x. Z \<le> f x) F)"
```
```   999   by (auto simp: filterlim_iff eventually_at_top_linorder elim!: eventually_elim1)
```
```  1000
```
```  1001 lemma filterlim_at_top_dense:
```
```  1002   fixes f :: "'a \<Rightarrow> ('b::dense_linorder)"
```
```  1003   shows "(LIM x F. f x :> at_top) \<longleftrightarrow> (\<forall>Z. eventually (\<lambda>x. Z < f x) F)"
```
```  1004   by (metis eventually_elim1[of _ F] eventually_gt_at_top order_less_imp_le
```
```  1005             filterlim_at_top[of f F] filterlim_iff[of f at_top F])
```
```  1006
```
```  1007 lemma filterlim_at_top_ge:
```
```  1008   fixes f :: "'a \<Rightarrow> ('b::linorder)" and c :: "'b"
```
```  1009   shows "(LIM x F. f x :> at_top) \<longleftrightarrow> (\<forall>Z\<ge>c. eventually (\<lambda>x. Z \<le> f x) F)"
```
```  1010   unfolding filterlim_at_top
```
```  1011 proof safe
```
```  1012   fix Z assume *: "\<forall>Z\<ge>c. eventually (\<lambda>x. Z \<le> f x) F"
```
```  1013   with *[THEN spec, of "max Z c"] show "eventually (\<lambda>x. Z \<le> f x) F"
```
```  1014     by (auto elim!: eventually_elim1)
```
```  1015 qed simp
```
```  1016
```
```  1017 lemma filterlim_at_top_at_top:
```
```  1018   fixes f :: "'a::linorder \<Rightarrow> 'b::linorder"
```
```  1019   assumes mono: "\<And>x y. Q x \<Longrightarrow> Q y \<Longrightarrow> x \<le> y \<Longrightarrow> f x \<le> f y"
```
```  1020   assumes bij: "\<And>x. P x \<Longrightarrow> f (g x) = x" "\<And>x. P x \<Longrightarrow> Q (g x)"
```
```  1021   assumes Q: "eventually Q at_top"
```
```  1022   assumes P: "eventually P at_top"
```
```  1023   shows "filterlim f at_top at_top"
```
```  1024 proof -
```
```  1025   from P obtain x where x: "\<And>y. x \<le> y \<Longrightarrow> P y"
```
```  1026     unfolding eventually_at_top_linorder by auto
```
```  1027   show ?thesis
```
```  1028   proof (intro filterlim_at_top_ge[THEN iffD2] allI impI)
```
```  1029     fix z assume "x \<le> z"
```
```  1030     with x have "P z" by auto
```
```  1031     have "eventually (\<lambda>x. g z \<le> x) at_top"
```
```  1032       by (rule eventually_ge_at_top)
```
```  1033     with Q show "eventually (\<lambda>x. z \<le> f x) at_top"
```
```  1034       by eventually_elim (metis mono bij `P z`)
```
```  1035   qed
```
```  1036 qed
```
```  1037
```
```  1038 lemma filterlim_at_top_gt:
```
```  1039   fixes f :: "'a \<Rightarrow> ('b::dense_linorder)" and c :: "'b"
```
```  1040   shows "(LIM x F. f x :> at_top) \<longleftrightarrow> (\<forall>Z>c. eventually (\<lambda>x. Z \<le> f x) F)"
```
```  1041   by (metis filterlim_at_top order_less_le_trans gt_ex filterlim_at_top_ge)
```
```  1042
```
```  1043 lemma filterlim_at_bot:
```
```  1044   fixes f :: "'a \<Rightarrow> ('b::linorder)"
```
```  1045   shows "(LIM x F. f x :> at_bot) \<longleftrightarrow> (\<forall>Z. eventually (\<lambda>x. f x \<le> Z) F)"
```
```  1046   by (auto simp: filterlim_iff eventually_at_bot_linorder elim!: eventually_elim1)
```
```  1047
```
```  1048 lemma filterlim_at_bot_le:
```
```  1049   fixes f :: "'a \<Rightarrow> ('b::linorder)" and c :: "'b"
```
```  1050   shows "(LIM x F. f x :> at_bot) \<longleftrightarrow> (\<forall>Z\<le>c. eventually (\<lambda>x. Z \<ge> f x) F)"
```
```  1051   unfolding filterlim_at_bot
```
```  1052 proof safe
```
```  1053   fix Z assume *: "\<forall>Z\<le>c. eventually (\<lambda>x. Z \<ge> f x) F"
```
```  1054   with *[THEN spec, of "min Z c"] show "eventually (\<lambda>x. Z \<ge> f x) F"
```
```  1055     by (auto elim!: eventually_elim1)
```
```  1056 qed simp
```
```  1057
```
```  1058 lemma filterlim_at_bot_lt:
```
```  1059   fixes f :: "'a \<Rightarrow> ('b::dense_linorder)" and c :: "'b"
```
```  1060   shows "(LIM x F. f x :> at_bot) \<longleftrightarrow> (\<forall>Z<c. eventually (\<lambda>x. Z \<ge> f x) F)"
```
```  1061   by (metis filterlim_at_bot filterlim_at_bot_le lt_ex order_le_less_trans)
```
```  1062
```
```  1063 lemma filterlim_at_bot_at_right:
```
```  1064   fixes f :: "'a::{no_top, linorder_topology} \<Rightarrow> 'b::linorder"
```
```  1065   assumes mono: "\<And>x y. Q x \<Longrightarrow> Q y \<Longrightarrow> x \<le> y \<Longrightarrow> f x \<le> f y"
```
```  1066   assumes bij: "\<And>x. P x \<Longrightarrow> f (g x) = x" "\<And>x. P x \<Longrightarrow> Q (g x)"
```
```  1067   assumes Q: "eventually Q (at_right a)" and bound: "\<And>b. Q b \<Longrightarrow> a < b"
```
```  1068   assumes P: "eventually P at_bot"
```
```  1069   shows "filterlim f at_bot (at_right a)"
```
```  1070 proof -
```
```  1071   from P obtain x where x: "\<And>y. y \<le> x \<Longrightarrow> P y"
```
```  1072     unfolding eventually_at_bot_linorder by auto
```
```  1073   show ?thesis
```
```  1074   proof (intro filterlim_at_bot_le[THEN iffD2] allI impI)
```
```  1075     fix z assume "z \<le> x"
```
```  1076     with x have "P z" by auto
```
```  1077     have "eventually (\<lambda>x. x \<le> g z) (at_right a)"
```
```  1078       using bound[OF bij(2)[OF `P z`]]
```
```  1079       unfolding eventually_at_right by (auto intro!: exI[of _ "g z"])
```
```  1080     with Q show "eventually (\<lambda>x. f x \<le> z) (at_right a)"
```
```  1081       by eventually_elim (metis bij `P z` mono)
```
```  1082   qed
```
```  1083 qed
```
```  1084
```
```  1085 lemma filterlim_at_top_at_left:
```
```  1086   fixes f :: "'a::{no_bot, linorder_topology} \<Rightarrow> 'b::linorder"
```
```  1087   assumes mono: "\<And>x y. Q x \<Longrightarrow> Q y \<Longrightarrow> x \<le> y \<Longrightarrow> f x \<le> f y"
```
```  1088   assumes bij: "\<And>x. P x \<Longrightarrow> f (g x) = x" "\<And>x. P x \<Longrightarrow> Q (g x)"
```
```  1089   assumes Q: "eventually Q (at_left a)" and bound: "\<And>b. Q b \<Longrightarrow> b < a"
```
```  1090   assumes P: "eventually P at_top"
```
```  1091   shows "filterlim f at_top (at_left a)"
```
```  1092 proof -
```
```  1093   from P obtain x where x: "\<And>y. x \<le> y \<Longrightarrow> P y"
```
```  1094     unfolding eventually_at_top_linorder by auto
```
```  1095   show ?thesis
```
```  1096   proof (intro filterlim_at_top_ge[THEN iffD2] allI impI)
```
```  1097     fix z assume "x \<le> z"
```
```  1098     with x have "P z" by auto
```
```  1099     have "eventually (\<lambda>x. g z \<le> x) (at_left a)"
```
```  1100       using bound[OF bij(2)[OF `P z`]]
```
```  1101       unfolding eventually_at_left by (auto intro!: exI[of _ "g z"])
```
```  1102     with Q show "eventually (\<lambda>x. z \<le> f x) (at_left a)"
```
```  1103       by eventually_elim (metis bij `P z` mono)
```
```  1104   qed
```
```  1105 qed
```
```  1106
```
```  1107 lemma filterlim_split_at:
```
```  1108   "filterlim f F (at_left x) \<Longrightarrow> filterlim f F (at_right x) \<Longrightarrow> filterlim f F (at (x::'a::linorder_topology))"
```
```  1109   by (subst at_eq_sup_left_right) (rule filterlim_sup)
```
```  1110
```
```  1111 lemma filterlim_at_split:
```
```  1112   "filterlim f F (at (x::'a::linorder_topology)) \<longleftrightarrow> filterlim f F (at_left x) \<and> filterlim f F (at_right x)"
```
```  1113   by (subst at_eq_sup_left_right) (simp add: filterlim_def filtermap_sup)
```
```  1114
```
```  1115
```
```  1116 subsection {* Limits on sequences *}
```
```  1117
```
```  1118 abbreviation (in topological_space)
```
```  1119   LIMSEQ :: "[nat \<Rightarrow> 'a, 'a] \<Rightarrow> bool"
```
```  1120     ("((_)/ ----> (_))" [60, 60] 60) where
```
```  1121   "X ----> L \<equiv> (X ---> L) sequentially"
```
```  1122
```
```  1123 definition
```
```  1124   lim :: "(nat \<Rightarrow> 'a::t2_space) \<Rightarrow> 'a" where
```
```  1125     --{*Standard definition of limit using choice operator*}
```
```  1126   "lim X = (THE L. X ----> L)"
```
```  1127
```
```  1128 definition (in topological_space) convergent :: "(nat \<Rightarrow> 'a) \<Rightarrow> bool" where
```
```  1129   "convergent X = (\<exists>L. X ----> L)"
```
```  1130
```
```  1131 subsubsection {* Monotone sequences and subsequences *}
```
```  1132
```
```  1133 definition
```
```  1134   monoseq :: "(nat \<Rightarrow> 'a::order) \<Rightarrow> bool" where
```
```  1135     --{*Definition of monotonicity.
```
```  1136         The use of disjunction here complicates proofs considerably.
```
```  1137         One alternative is to add a Boolean argument to indicate the direction.
```
```  1138         Another is to develop the notions of increasing and decreasing first.*}
```
```  1139   "monoseq X = ((\<forall>m. \<forall>n\<ge>m. X m \<le> X n) | (\<forall>m. \<forall>n\<ge>m. X n \<le> X m))"
```
```  1140
```
```  1141 definition
```
```  1142   incseq :: "(nat \<Rightarrow> 'a::order) \<Rightarrow> bool" where
```
```  1143     --{*Increasing sequence*}
```
```  1144   "incseq X \<longleftrightarrow> (\<forall>m. \<forall>n\<ge>m. X m \<le> X n)"
```
```  1145
```
```  1146 definition
```
```  1147   decseq :: "(nat \<Rightarrow> 'a::order) \<Rightarrow> bool" where
```
```  1148     --{*Decreasing sequence*}
```
```  1149   "decseq X \<longleftrightarrow> (\<forall>m. \<forall>n\<ge>m. X n \<le> X m)"
```
```  1150
```
```  1151 definition
```
```  1152   subseq :: "(nat \<Rightarrow> nat) \<Rightarrow> bool" where
```
```  1153     --{*Definition of subsequence*}
```
```  1154   "subseq f \<longleftrightarrow> (\<forall>m. \<forall>n>m. f m < f n)"
```
```  1155
```
```  1156 lemma incseq_mono: "mono f \<longleftrightarrow> incseq f"
```
```  1157   unfolding mono_def incseq_def by auto
```
```  1158
```
```  1159 lemma incseq_SucI:
```
```  1160   "(\<And>n. X n \<le> X (Suc n)) \<Longrightarrow> incseq X"
```
```  1161   using lift_Suc_mono_le[of X]
```
```  1162   by (auto simp: incseq_def)
```
```  1163
```
```  1164 lemma incseqD: "\<And>i j. incseq f \<Longrightarrow> i \<le> j \<Longrightarrow> f i \<le> f j"
```
```  1165   by (auto simp: incseq_def)
```
```  1166
```
```  1167 lemma incseq_SucD: "incseq A \<Longrightarrow> A i \<le> A (Suc i)"
```
```  1168   using incseqD[of A i "Suc i"] by auto
```
```  1169
```
```  1170 lemma incseq_Suc_iff: "incseq f \<longleftrightarrow> (\<forall>n. f n \<le> f (Suc n))"
```
```  1171   by (auto intro: incseq_SucI dest: incseq_SucD)
```
```  1172
```
```  1173 lemma incseq_const[simp, intro]: "incseq (\<lambda>x. k)"
```
```  1174   unfolding incseq_def by auto
```
```  1175
```
```  1176 lemma decseq_SucI:
```
```  1177   "(\<And>n. X (Suc n) \<le> X n) \<Longrightarrow> decseq X"
```
```  1178   using order.lift_Suc_mono_le[OF dual_order, of X]
```
```  1179   by (auto simp: decseq_def)
```
```  1180
```
```  1181 lemma decseqD: "\<And>i j. decseq f \<Longrightarrow> i \<le> j \<Longrightarrow> f j \<le> f i"
```
```  1182   by (auto simp: decseq_def)
```
```  1183
```
```  1184 lemma decseq_SucD: "decseq A \<Longrightarrow> A (Suc i) \<le> A i"
```
```  1185   using decseqD[of A i "Suc i"] by auto
```
```  1186
```
```  1187 lemma decseq_Suc_iff: "decseq f \<longleftrightarrow> (\<forall>n. f (Suc n) \<le> f n)"
```
```  1188   by (auto intro: decseq_SucI dest: decseq_SucD)
```
```  1189
```
```  1190 lemma decseq_const[simp, intro]: "decseq (\<lambda>x. k)"
```
```  1191   unfolding decseq_def by auto
```
```  1192
```
```  1193 lemma monoseq_iff: "monoseq X \<longleftrightarrow> incseq X \<or> decseq X"
```
```  1194   unfolding monoseq_def incseq_def decseq_def ..
```
```  1195
```
```  1196 lemma monoseq_Suc:
```
```  1197   "monoseq X \<longleftrightarrow> (\<forall>n. X n \<le> X (Suc n)) \<or> (\<forall>n. X (Suc n) \<le> X n)"
```
```  1198   unfolding monoseq_iff incseq_Suc_iff decseq_Suc_iff ..
```
```  1199
```
```  1200 lemma monoI1: "\<forall>m. \<forall> n \<ge> m. X m \<le> X n ==> monoseq X"
```
```  1201 by (simp add: monoseq_def)
```
```  1202
```
```  1203 lemma monoI2: "\<forall>m. \<forall> n \<ge> m. X n \<le> X m ==> monoseq X"
```
```  1204 by (simp add: monoseq_def)
```
```  1205
```
```  1206 lemma mono_SucI1: "\<forall>n. X n \<le> X (Suc n) ==> monoseq X"
```
```  1207 by (simp add: monoseq_Suc)
```
```  1208
```
```  1209 lemma mono_SucI2: "\<forall>n. X (Suc n) \<le> X n ==> monoseq X"
```
```  1210 by (simp add: monoseq_Suc)
```
```  1211
```
```  1212 lemma monoseq_minus:
```
```  1213   fixes a :: "nat \<Rightarrow> 'a::ordered_ab_group_add"
```
```  1214   assumes "monoseq a"
```
```  1215   shows "monoseq (\<lambda> n. - a n)"
```
```  1216 proof (cases "\<forall> m. \<forall> n \<ge> m. a m \<le> a n")
```
```  1217   case True
```
```  1218   hence "\<forall> m. \<forall> n \<ge> m. - a n \<le> - a m" by auto
```
```  1219   thus ?thesis by (rule monoI2)
```
```  1220 next
```
```  1221   case False
```
```  1222   hence "\<forall> m. \<forall> n \<ge> m. - a m \<le> - a n" using `monoseq a`[unfolded monoseq_def] by auto
```
```  1223   thus ?thesis by (rule monoI1)
```
```  1224 qed
```
```  1225
```
```  1226 text{*Subsequence (alternative definition, (e.g. Hoskins)*}
```
```  1227
```
```  1228 lemma subseq_Suc_iff: "subseq f = (\<forall>n. (f n) < (f (Suc n)))"
```
```  1229 apply (simp add: subseq_def)
```
```  1230 apply (auto dest!: less_imp_Suc_add)
```
```  1231 apply (induct_tac k)
```
```  1232 apply (auto intro: less_trans)
```
```  1233 done
```
```  1234
```
```  1235 text{* for any sequence, there is a monotonic subsequence *}
```
```  1236 lemma seq_monosub:
```
```  1237   fixes s :: "nat => 'a::linorder"
```
```  1238   shows "\<exists>f. subseq f \<and> monoseq (\<lambda> n. (s (f n)))"
```
```  1239 proof cases
```
```  1240   let "?P p n" = "p > n \<and> (\<forall>m\<ge>p. s m \<le> s p)"
```
```  1241   assume *: "\<forall>n. \<exists>p. ?P p n"
```
```  1242   def f \<equiv> "nat_rec (SOME p. ?P p 0) (\<lambda>_ n. SOME p. ?P p n)"
```
```  1243   have f_0: "f 0 = (SOME p. ?P p 0)" unfolding f_def by simp
```
```  1244   have f_Suc: "\<And>i. f (Suc i) = (SOME p. ?P p (f i))" unfolding f_def nat_rec_Suc ..
```
```  1245   have P_0: "?P (f 0) 0" unfolding f_0 using *[rule_format] by (rule someI2_ex) auto
```
```  1246   have P_Suc: "\<And>i. ?P (f (Suc i)) (f i)" unfolding f_Suc using *[rule_format] by (rule someI2_ex) auto
```
```  1247   then have "subseq f" unfolding subseq_Suc_iff by auto
```
```  1248   moreover have "monoseq (\<lambda>n. s (f n))" unfolding monoseq_Suc
```
```  1249   proof (intro disjI2 allI)
```
```  1250     fix n show "s (f (Suc n)) \<le> s (f n)"
```
```  1251     proof (cases n)
```
```  1252       case 0 with P_Suc[of 0] P_0 show ?thesis by auto
```
```  1253     next
```
```  1254       case (Suc m)
```
```  1255       from P_Suc[of n] Suc have "f (Suc m) \<le> f (Suc (Suc m))" by simp
```
```  1256       with P_Suc Suc show ?thesis by simp
```
```  1257     qed
```
```  1258   qed
```
```  1259   ultimately show ?thesis by auto
```
```  1260 next
```
```  1261   let "?P p m" = "m < p \<and> s m < s p"
```
```  1262   assume "\<not> (\<forall>n. \<exists>p>n. (\<forall>m\<ge>p. s m \<le> s p))"
```
```  1263   then obtain N where N: "\<And>p. p > N \<Longrightarrow> \<exists>m>p. s p < s m" by (force simp: not_le le_less)
```
```  1264   def f \<equiv> "nat_rec (SOME p. ?P p (Suc N)) (\<lambda>_ n. SOME p. ?P p n)"
```
```  1265   have f_0: "f 0 = (SOME p. ?P p (Suc N))" unfolding f_def by simp
```
```  1266   have f_Suc: "\<And>i. f (Suc i) = (SOME p. ?P p (f i))" unfolding f_def nat_rec_Suc ..
```
```  1267   have P_0: "?P (f 0) (Suc N)"
```
```  1268     unfolding f_0 some_eq_ex[of "\<lambda>p. ?P p (Suc N)"] using N[of "Suc N"] by auto
```
```  1269   { fix i have "N < f i \<Longrightarrow> ?P (f (Suc i)) (f i)"
```
```  1270       unfolding f_Suc some_eq_ex[of "\<lambda>p. ?P p (f i)"] using N[of "f i"] . }
```
```  1271   note P' = this
```
```  1272   { fix i have "N < f i \<and> ?P (f (Suc i)) (f i)"
```
```  1273       by (induct i) (insert P_0 P', auto) }
```
```  1274   then have "subseq f" "monoseq (\<lambda>x. s (f x))"
```
```  1275     unfolding subseq_Suc_iff monoseq_Suc by (auto simp: not_le intro: less_imp_le)
```
```  1276   then show ?thesis by auto
```
```  1277 qed
```
```  1278
```
```  1279 lemma seq_suble: assumes sf: "subseq f" shows "n \<le> f n"
```
```  1280 proof(induct n)
```
```  1281   case 0 thus ?case by simp
```
```  1282 next
```
```  1283   case (Suc n)
```
```  1284   from sf[unfolded subseq_Suc_iff, rule_format, of n] Suc.hyps
```
```  1285   have "n < f (Suc n)" by arith
```
```  1286   thus ?case by arith
```
```  1287 qed
```
```  1288
```
```  1289 lemma eventually_subseq:
```
```  1290   "subseq r \<Longrightarrow> eventually P sequentially \<Longrightarrow> eventually (\<lambda>n. P (r n)) sequentially"
```
```  1291   unfolding eventually_sequentially by (metis seq_suble le_trans)
```
```  1292
```
```  1293 lemma filterlim_subseq: "subseq f \<Longrightarrow> filterlim f sequentially sequentially"
```
```  1294   unfolding filterlim_iff by (metis eventually_subseq)
```
```  1295
```
```  1296 lemma subseq_o: "subseq r \<Longrightarrow> subseq s \<Longrightarrow> subseq (r \<circ> s)"
```
```  1297   unfolding subseq_def by simp
```
```  1298
```
```  1299 lemma subseq_mono: assumes "subseq r" "m < n" shows "r m < r n"
```
```  1300   using assms by (auto simp: subseq_def)
```
```  1301
```
```  1302 lemma incseq_imp_monoseq:  "incseq X \<Longrightarrow> monoseq X"
```
```  1303   by (simp add: incseq_def monoseq_def)
```
```  1304
```
```  1305 lemma decseq_imp_monoseq:  "decseq X \<Longrightarrow> monoseq X"
```
```  1306   by (simp add: decseq_def monoseq_def)
```
```  1307
```
```  1308 lemma decseq_eq_incseq:
```
```  1309   fixes X :: "nat \<Rightarrow> 'a::ordered_ab_group_add" shows "decseq X = incseq (\<lambda>n. - X n)"
```
```  1310   by (simp add: decseq_def incseq_def)
```
```  1311
```
```  1312 lemma INT_decseq_offset:
```
```  1313   assumes "decseq F"
```
```  1314   shows "(\<Inter>i. F i) = (\<Inter>i\<in>{n..}. F i)"
```
```  1315 proof safe
```
```  1316   fix x i assume x: "x \<in> (\<Inter>i\<in>{n..}. F i)"
```
```  1317   show "x \<in> F i"
```
```  1318   proof cases
```
```  1319     from x have "x \<in> F n" by auto
```
```  1320     also assume "i \<le> n" with `decseq F` have "F n \<subseteq> F i"
```
```  1321       unfolding decseq_def by simp
```
```  1322     finally show ?thesis .
```
```  1323   qed (insert x, simp)
```
```  1324 qed auto
```
```  1325
```
```  1326 lemma LIMSEQ_const_iff:
```
```  1327   fixes k l :: "'a::t2_space"
```
```  1328   shows "(\<lambda>n. k) ----> l \<longleftrightarrow> k = l"
```
```  1329   using trivial_limit_sequentially by (rule tendsto_const_iff)
```
```  1330
```
```  1331 lemma LIMSEQ_SUP:
```
```  1332   "incseq X \<Longrightarrow> X ----> (SUP i. X i :: 'a :: {complete_linorder, linorder_topology})"
```
```  1333   by (intro increasing_tendsto)
```
```  1334      (auto simp: SUP_upper less_SUP_iff incseq_def eventually_sequentially intro: less_le_trans)
```
```  1335
```
```  1336 lemma LIMSEQ_INF:
```
```  1337   "decseq X \<Longrightarrow> X ----> (INF i. X i :: 'a :: {complete_linorder, linorder_topology})"
```
```  1338   by (intro decreasing_tendsto)
```
```  1339      (auto simp: INF_lower INF_less_iff decseq_def eventually_sequentially intro: le_less_trans)
```
```  1340
```
```  1341 lemma LIMSEQ_ignore_initial_segment:
```
```  1342   "f ----> a \<Longrightarrow> (\<lambda>n. f (n + k)) ----> a"
```
```  1343 apply (rule topological_tendstoI)
```
```  1344 apply (drule (2) topological_tendstoD)
```
```  1345 apply (simp only: eventually_sequentially)
```
```  1346 apply (erule exE, rename_tac N)
```
```  1347 apply (rule_tac x=N in exI)
```
```  1348 apply simp
```
```  1349 done
```
```  1350
```
```  1351 lemma LIMSEQ_offset:
```
```  1352   "(\<lambda>n. f (n + k)) ----> a \<Longrightarrow> f ----> a"
```
```  1353 apply (rule topological_tendstoI)
```
```  1354 apply (drule (2) topological_tendstoD)
```
```  1355 apply (simp only: eventually_sequentially)
```
```  1356 apply (erule exE, rename_tac N)
```
```  1357 apply (rule_tac x="N + k" in exI)
```
```  1358 apply clarify
```
```  1359 apply (drule_tac x="n - k" in spec)
```
```  1360 apply (simp add: le_diff_conv2)
```
```  1361 done
```
```  1362
```
```  1363 lemma LIMSEQ_Suc: "f ----> l \<Longrightarrow> (\<lambda>n. f (Suc n)) ----> l"
```
```  1364 by (drule_tac k="Suc 0" in LIMSEQ_ignore_initial_segment, simp)
```
```  1365
```
```  1366 lemma LIMSEQ_imp_Suc: "(\<lambda>n. f (Suc n)) ----> l \<Longrightarrow> f ----> l"
```
```  1367 by (rule_tac k="Suc 0" in LIMSEQ_offset, simp)
```
```  1368
```
```  1369 lemma LIMSEQ_Suc_iff: "(\<lambda>n. f (Suc n)) ----> l = f ----> l"
```
```  1370 by (blast intro: LIMSEQ_imp_Suc LIMSEQ_Suc)
```
```  1371
```
```  1372 lemma LIMSEQ_unique:
```
```  1373   fixes a b :: "'a::t2_space"
```
```  1374   shows "\<lbrakk>X ----> a; X ----> b\<rbrakk> \<Longrightarrow> a = b"
```
```  1375   using trivial_limit_sequentially by (rule tendsto_unique)
```
```  1376
```
```  1377 lemma LIMSEQ_le_const:
```
```  1378   "\<lbrakk>X ----> (x::'a::linorder_topology); \<exists>N. \<forall>n\<ge>N. a \<le> X n\<rbrakk> \<Longrightarrow> a \<le> x"
```
```  1379   using tendsto_le_const[of sequentially X x a] by (simp add: eventually_sequentially)
```
```  1380
```
```  1381 lemma LIMSEQ_le:
```
```  1382   "\<lbrakk>X ----> x; Y ----> y; \<exists>N. \<forall>n\<ge>N. X n \<le> Y n\<rbrakk> \<Longrightarrow> x \<le> (y::'a::linorder_topology)"
```
```  1383   using tendsto_le[of sequentially Y y X x] by (simp add: eventually_sequentially)
```
```  1384
```
```  1385 lemma LIMSEQ_le_const2:
```
```  1386   "\<lbrakk>X ----> (x::'a::linorder_topology); \<exists>N. \<forall>n\<ge>N. X n \<le> a\<rbrakk> \<Longrightarrow> x \<le> a"
```
```  1387   by (rule LIMSEQ_le[of X x "\<lambda>n. a"]) (auto simp: tendsto_const)
```
```  1388
```
```  1389 lemma convergentD: "convergent X ==> \<exists>L. (X ----> L)"
```
```  1390 by (simp add: convergent_def)
```
```  1391
```
```  1392 lemma convergentI: "(X ----> L) ==> convergent X"
```
```  1393 by (auto simp add: convergent_def)
```
```  1394
```
```  1395 lemma convergent_LIMSEQ_iff: "convergent X = (X ----> lim X)"
```
```  1396 by (auto intro: theI LIMSEQ_unique simp add: convergent_def lim_def)
```
```  1397
```
```  1398 lemma convergent_const: "convergent (\<lambda>n. c)"
```
```  1399   by (rule convergentI, rule tendsto_const)
```
```  1400
```
```  1401 lemma monoseq_le:
```
```  1402   "monoseq a \<Longrightarrow> a ----> (x::'a::linorder_topology) \<Longrightarrow>
```
```  1403     ((\<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))"
```
```  1404   by (metis LIMSEQ_le_const LIMSEQ_le_const2 decseq_def incseq_def monoseq_iff)
```
```  1405
```
```  1406 lemma LIMSEQ_subseq_LIMSEQ:
```
```  1407   "\<lbrakk> X ----> L; subseq f \<rbrakk> \<Longrightarrow> (X o f) ----> L"
```
```  1408   unfolding comp_def by (rule filterlim_compose[of X, OF _ filterlim_subseq])
```
```  1409
```
```  1410 lemma convergent_subseq_convergent:
```
```  1411   "\<lbrakk>convergent X; subseq f\<rbrakk> \<Longrightarrow> convergent (X o f)"
```
```  1412   unfolding convergent_def by (auto intro: LIMSEQ_subseq_LIMSEQ)
```
```  1413
```
```  1414 lemma limI: "X ----> L ==> lim X = L"
```
```  1415 apply (simp add: lim_def)
```
```  1416 apply (blast intro: LIMSEQ_unique)
```
```  1417 done
```
```  1418
```
```  1419 lemma lim_le: "convergent f \<Longrightarrow> (\<And>n. f n \<le> (x::'a::linorder_topology)) \<Longrightarrow> lim f \<le> x"
```
```  1420   using LIMSEQ_le_const2[of f "lim f" x] by (simp add: convergent_LIMSEQ_iff)
```
```  1421
```
```  1422 subsubsection{*Increasing and Decreasing Series*}
```
```  1423
```
```  1424 lemma incseq_le: "incseq X \<Longrightarrow> X ----> L \<Longrightarrow> X n \<le> (L::'a::linorder_topology)"
```
```  1425   by (metis incseq_def LIMSEQ_le_const)
```
```  1426
```
```  1427 lemma decseq_le: "decseq X \<Longrightarrow> X ----> L \<Longrightarrow> (L::'a::linorder_topology) \<le> X n"
```
```  1428   by (metis decseq_def LIMSEQ_le_const2)
```
```  1429
```
```  1430 subsection {* Function limit at a point *}
```
```  1431
```
```  1432 abbreviation
```
```  1433   LIM :: "('a::topological_space \<Rightarrow> 'b::topological_space) \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> bool"
```
```  1434         ("((_)/ -- (_)/ --> (_))" [60, 0, 60] 60) where
```
```  1435   "f -- a --> L \<equiv> (f ---> L) (at a)"
```
```  1436
```
```  1437 lemma LIM_const_not_eq[tendsto_intros]:
```
```  1438   fixes a :: "'a::perfect_space"
```
```  1439   fixes k L :: "'b::t2_space"
```
```  1440   shows "k \<noteq> L \<Longrightarrow> \<not> (\<lambda>x. k) -- a --> L"
```
```  1441   by (simp add: tendsto_const_iff)
```
```  1442
```
```  1443 lemmas LIM_not_zero = LIM_const_not_eq [where L = 0]
```
```  1444
```
```  1445 lemma LIM_const_eq:
```
```  1446   fixes a :: "'a::perfect_space"
```
```  1447   fixes k L :: "'b::t2_space"
```
```  1448   shows "(\<lambda>x. k) -- a --> L \<Longrightarrow> k = L"
```
```  1449   by (simp add: tendsto_const_iff)
```
```  1450
```
```  1451 lemma LIM_unique:
```
```  1452   fixes a :: "'a::perfect_space" and L M :: "'b::t2_space"
```
```  1453   shows "f -- a --> L \<Longrightarrow> f -- a --> M \<Longrightarrow> L = M"
```
```  1454   using at_neq_bot by (rule tendsto_unique)
```
```  1455
```
```  1456 text {* Limits are equal for functions equal except at limit point *}
```
```  1457
```
```  1458 lemma LIM_equal: "\<forall>x. x \<noteq> a --> (f x = g x) \<Longrightarrow> (f -- a --> l) \<longleftrightarrow> (g -- a --> l)"
```
```  1459   unfolding tendsto_def eventually_at_topological by simp
```
```  1460
```
```  1461 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)"
```
```  1462   by (simp add: LIM_equal)
```
```  1463
```
```  1464 lemma LIM_cong_limit: "f -- x --> L \<Longrightarrow> K = L \<Longrightarrow> f -- x --> K"
```
```  1465   by simp
```
```  1466
```
```  1467 lemma tendsto_at_iff_tendsto_nhds:
```
```  1468   "g -- l --> g l \<longleftrightarrow> (g ---> g l) (nhds l)"
```
```  1469   unfolding tendsto_def at_def eventually_within
```
```  1470   by (intro ext all_cong imp_cong) (auto elim!: eventually_elim1)
```
```  1471
```
```  1472 lemma tendsto_compose:
```
```  1473   "g -- l --> g l \<Longrightarrow> (f ---> l) F \<Longrightarrow> ((\<lambda>x. g (f x)) ---> g l) F"
```
```  1474   unfolding tendsto_at_iff_tendsto_nhds by (rule filterlim_compose[of g])
```
```  1475
```
```  1476 lemma LIM_o: "\<lbrakk>g -- l --> g l; f -- a --> l\<rbrakk> \<Longrightarrow> (g \<circ> f) -- a --> g l"
```
```  1477   unfolding o_def by (rule tendsto_compose)
```
```  1478
```
```  1479 lemma tendsto_compose_eventually:
```
```  1480   "g -- l --> m \<Longrightarrow> (f ---> l) F \<Longrightarrow> eventually (\<lambda>x. f x \<noteq> l) F \<Longrightarrow> ((\<lambda>x. g (f x)) ---> m) F"
```
```  1481   by (rule filterlim_compose[of g _ "at l"]) (auto simp add: filterlim_at)
```
```  1482
```
```  1483 lemma LIM_compose_eventually:
```
```  1484   assumes f: "f -- a --> b"
```
```  1485   assumes g: "g -- b --> c"
```
```  1486   assumes inj: "eventually (\<lambda>x. f x \<noteq> b) (at a)"
```
```  1487   shows "(\<lambda>x. g (f x)) -- a --> c"
```
```  1488   using g f inj by (rule tendsto_compose_eventually)
```
```  1489
```
```  1490 subsection {* Continuity *}
```
```  1491
```
```  1492 definition isCont :: "('a::topological_space \<Rightarrow> 'b::topological_space) \<Rightarrow> 'a \<Rightarrow> bool" where
```
```  1493   "isCont f a \<longleftrightarrow> f -- a --> f a"
```
```  1494
```
```  1495 lemma isCont_ident [simp]: "isCont (\<lambda>x. x) a"
```
```  1496   unfolding isCont_def by (rule tendsto_ident_at)
```
```  1497
```
```  1498 lemma isCont_const [simp]: "isCont (\<lambda>x. k) a"
```
```  1499   unfolding isCont_def by (rule tendsto_const)
```
```  1500
```
```  1501 lemma isCont_tendsto_compose: "isCont g l \<Longrightarrow> (f ---> l) F \<Longrightarrow> ((\<lambda>x. g (f x)) ---> g l) F"
```
```  1502   unfolding isCont_def by (rule tendsto_compose)
```
```  1503
```
```  1504 lemma isCont_o2: "isCont f a \<Longrightarrow> isCont g (f a) \<Longrightarrow> isCont (\<lambda>x. g (f x)) a"
```
```  1505   unfolding isCont_def by (rule tendsto_compose)
```
```  1506
```
```  1507 lemma isCont_o: "isCont f a \<Longrightarrow> isCont g (f a) \<Longrightarrow> isCont (g o f) a"
```
```  1508   unfolding o_def by (rule isCont_o2)
```
```  1509
```
```  1510 end
```
```  1511
```