| author | wenzelm | 
| Fri, 08 Dec 2023 15:37:46 +0100 | |
| changeset 79207 | f991d3003ec8 | 
| parent 78685 | 07c35dec9dac | 
| child 79945 | ca004ccf2352 | 
| permissions | -rw-r--r-- | 
| 52265 | 1 | (* Title: HOL/Topological_Spaces.thy | 
| 51471 | 2 | Author: Brian Huffman | 
| 3 | Author: Johannes Hölzl | |
| 4 | *) | |
| 5 | ||
| 60758 | 6 | section \<open>Topological Spaces\<close> | 
| 51471 | 7 | |
| 8 | theory Topological_Spaces | |
| 63494 | 9 | imports Main | 
| 51471 | 10 | begin | 
| 11 | ||
| 57953 | 12 | named_theorems continuous_intros "structural introduction rules for continuity" | 
| 13 | ||
| 60758 | 14 | subsection \<open>Topological space\<close> | 
| 51471 | 15 | |
| 16 | class "open" = | |
| 17 | fixes "open" :: "'a set \<Rightarrow> bool" | |
| 18 | ||
| 19 | class topological_space = "open" + | |
| 20 | assumes open_UNIV [simp, intro]: "open UNIV" | |
| 21 | assumes open_Int [intro]: "open S \<Longrightarrow> open T \<Longrightarrow> open (S \<inter> T)" | |
| 60585 | 22 | assumes open_Union [intro]: "\<forall>S\<in>K. open S \<Longrightarrow> open (\<Union>K)" | 
| 51471 | 23 | begin | 
| 24 | ||
| 63494 | 25 | definition closed :: "'a set \<Rightarrow> bool" | 
| 26 | where "closed S \<longleftrightarrow> open (- S)" | |
| 51471 | 27 | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 28 | lemma open_empty [continuous_intros, intro, simp]: "open {}"
 | 
| 51471 | 29 |   using open_Union [of "{}"] by simp
 | 
| 30 | ||
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 31 | lemma open_Un [continuous_intros, intro]: "open S \<Longrightarrow> open T \<Longrightarrow> open (S \<union> T)" | 
| 51471 | 32 |   using open_Union [of "{S, T}"] by simp
 | 
| 33 | ||
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 34 | lemma open_UN [continuous_intros, intro]: "\<forall>x\<in>A. open (B x) \<Longrightarrow> open (\<Union>x\<in>A. B x)" | 
| 56166 | 35 | using open_Union [of "B ` A"] by simp | 
| 51471 | 36 | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 37 | lemma open_Inter [continuous_intros, intro]: "finite S \<Longrightarrow> \<forall>T\<in>S. open T \<Longrightarrow> open (\<Inter>S)" | 
| 73832 | 38 | by (induction set: finite) auto | 
| 51471 | 39 | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 40 | lemma open_INT [continuous_intros, intro]: "finite A \<Longrightarrow> \<forall>x\<in>A. open (B x) \<Longrightarrow> open (\<Inter>x\<in>A. B x)" | 
| 56166 | 41 | using open_Inter [of "B ` A"] by simp | 
| 51471 | 42 | |
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 43 | lemma openI: | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 44 | assumes "\<And>x. x \<in> S \<Longrightarrow> \<exists>T. open T \<and> x \<in> T \<and> T \<subseteq> S" | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 45 | shows "open S" | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 46 | proof - | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 47 |   have "open (\<Union>{T. open T \<and> T \<subseteq> S})" by auto
 | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 48 |   moreover have "\<Union>{T. open T \<and> T \<subseteq> S} = S" by (auto dest!: assms)
 | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 49 | ultimately show "open S" by simp | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 50 | qed | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 51 | |
| 71063 | 52 | lemma open_subopen: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>T. open T \<and> x \<in> T \<and> T \<subseteq> S)" | 
| 53 | by (auto intro: openI) | |
| 54 | ||
| 63494 | 55 | lemma closed_empty [continuous_intros, intro, simp]: "closed {}"
 | 
| 51471 | 56 | unfolding closed_def by simp | 
| 57 | ||
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 58 | lemma closed_Un [continuous_intros, intro]: "closed S \<Longrightarrow> closed T \<Longrightarrow> closed (S \<union> T)" | 
| 51471 | 59 | unfolding closed_def by auto | 
| 60 | ||
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 61 | lemma closed_UNIV [continuous_intros, intro, simp]: "closed UNIV" | 
| 51471 | 62 | unfolding closed_def by simp | 
| 63 | ||
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 64 | lemma closed_Int [continuous_intros, intro]: "closed S \<Longrightarrow> closed T \<Longrightarrow> closed (S \<inter> T)" | 
| 51471 | 65 | unfolding closed_def by auto | 
| 66 | ||
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 67 | lemma closed_INT [continuous_intros, intro]: "\<forall>x\<in>A. closed (B x) \<Longrightarrow> closed (\<Inter>x\<in>A. B x)" | 
| 51471 | 68 | unfolding closed_def by auto | 
| 69 | ||
| 60585 | 70 | lemma closed_Inter [continuous_intros, intro]: "\<forall>S\<in>K. closed S \<Longrightarrow> closed (\<Inter>K)" | 
| 51471 | 71 | unfolding closed_def uminus_Inf by auto | 
| 72 | ||
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 73 | lemma closed_Union [continuous_intros, intro]: "finite S \<Longrightarrow> \<forall>T\<in>S. closed T \<Longrightarrow> closed (\<Union>S)" | 
| 51471 | 74 | by (induct set: finite) auto | 
| 75 | ||
| 63494 | 76 | lemma closed_UN [continuous_intros, intro]: | 
| 77 | "finite A \<Longrightarrow> \<forall>x\<in>A. closed (B x) \<Longrightarrow> closed (\<Union>x\<in>A. B x)" | |
| 56166 | 78 | using closed_Union [of "B ` A"] by simp | 
| 51471 | 79 | |
| 80 | lemma open_closed: "open S \<longleftrightarrow> closed (- S)" | |
| 63170 | 81 | by (simp add: closed_def) | 
| 51471 | 82 | |
| 83 | lemma closed_open: "closed S \<longleftrightarrow> open (- S)" | |
| 63170 | 84 | by (rule closed_def) | 
| 51471 | 85 | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 86 | lemma open_Diff [continuous_intros, intro]: "open S \<Longrightarrow> closed T \<Longrightarrow> open (S - T)" | 
| 63170 | 87 | by (simp add: closed_open Diff_eq open_Int) | 
| 51471 | 88 | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 89 | lemma closed_Diff [continuous_intros, intro]: "closed S \<Longrightarrow> open T \<Longrightarrow> closed (S - T)" | 
| 63170 | 90 | by (simp add: open_closed Diff_eq closed_Int) | 
| 51471 | 91 | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 92 | lemma open_Compl [continuous_intros, intro]: "closed S \<Longrightarrow> open (- S)" | 
| 63170 | 93 | by (simp add: closed_open) | 
| 51471 | 94 | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 95 | lemma closed_Compl [continuous_intros, intro]: "open S \<Longrightarrow> closed (- S)" | 
| 63170 | 96 | by (simp add: open_closed) | 
| 51471 | 97 | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 98 | lemma open_Collect_neg: "closed {x. P x} \<Longrightarrow> open {x. \<not> P x}"
 | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 99 | unfolding Collect_neg_eq by (rule open_Compl) | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 100 | |
| 63494 | 101 | lemma open_Collect_conj: | 
| 102 |   assumes "open {x. P x}" "open {x. Q x}"
 | |
| 103 |   shows "open {x. P x \<and> Q x}"
 | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 104 | using open_Int[OF assms] by (simp add: Int_def) | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 105 | |
| 63494 | 106 | lemma open_Collect_disj: | 
| 107 |   assumes "open {x. P x}" "open {x. Q x}"
 | |
| 108 |   shows "open {x. P x \<or> Q x}"
 | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 109 | using open_Un[OF assms] by (simp add: Un_def) | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 110 | |
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 111 | lemma open_Collect_ex: "(\<And>i. open {x. P i x}) \<Longrightarrow> open {x. \<exists>i. P i x}"
 | 
| 62102 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 hoelzl parents: 
62101diff
changeset | 112 |   using open_UN[of UNIV "\<lambda>i. {x. P i x}"] unfolding Collect_ex_eq by simp
 | 
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 113 | |
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 114 | lemma open_Collect_imp: "closed {x. P x} \<Longrightarrow> open {x. Q x} \<Longrightarrow> open {x. P x \<longrightarrow> Q x}"
 | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 115 | unfolding imp_conv_disj by (intro open_Collect_disj open_Collect_neg) | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 116 | |
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 117 | lemma open_Collect_const: "open {x. P}"
 | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 118 | by (cases P) auto | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 119 | |
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 120 | lemma closed_Collect_neg: "open {x. P x} \<Longrightarrow> closed {x. \<not> P x}"
 | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 121 | unfolding Collect_neg_eq by (rule closed_Compl) | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 122 | |
| 63494 | 123 | lemma closed_Collect_conj: | 
| 124 |   assumes "closed {x. P x}" "closed {x. Q x}"
 | |
| 125 |   shows "closed {x. P x \<and> Q x}"
 | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 126 | using closed_Int[OF assms] by (simp add: Int_def) | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 127 | |
| 63494 | 128 | lemma closed_Collect_disj: | 
| 129 |   assumes "closed {x. P x}" "closed {x. Q x}"
 | |
| 130 |   shows "closed {x. P x \<or> Q x}"
 | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 131 | using closed_Un[OF assms] by (simp add: Un_def) | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 132 | |
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 133 | lemma closed_Collect_all: "(\<And>i. closed {x. P i x}) \<Longrightarrow> closed {x. \<forall>i. P i x}"
 | 
| 63494 | 134 |   using closed_INT[of UNIV "\<lambda>i. {x. P i x}"] by (simp add: Collect_all_eq)
 | 
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 135 | |
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 136 | lemma closed_Collect_imp: "open {x. P x} \<Longrightarrow> closed {x. Q x} \<Longrightarrow> closed {x. P x \<longrightarrow> Q x}"
 | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 137 | unfolding imp_conv_disj by (intro closed_Collect_disj closed_Collect_neg) | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 138 | |
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 139 | lemma closed_Collect_const: "closed {x. P}"
 | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 140 | by (cases P) auto | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 141 | |
| 51471 | 142 | end | 
| 143 | ||
| 63494 | 144 | |
| 145 | subsection \<open>Hausdorff and other separation properties\<close> | |
| 51471 | 146 | |
| 147 | class t0_space = topological_space + | |
| 148 | assumes t0_space: "x \<noteq> y \<Longrightarrow> \<exists>U. open U \<and> \<not> (x \<in> U \<longleftrightarrow> y \<in> U)" | |
| 149 | ||
| 150 | class t1_space = topological_space + | |
| 151 | assumes t1_space: "x \<noteq> y \<Longrightarrow> \<exists>U. open U \<and> x \<in> U \<and> y \<notin> U" | |
| 152 | ||
| 153 | instance t1_space \<subseteq> t0_space | |
| 63494 | 154 | by standard (fast dest: t1_space) | 
| 155 | ||
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 156 | context t1_space begin | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 157 | |
| 63494 | 158 | lemma separation_t1: "x \<noteq> y \<longleftrightarrow> (\<exists>U. open U \<and> x \<in> U \<and> y \<notin> U)" | 
| 51471 | 159 | using t1_space[of x y] by blast | 
| 160 | ||
| 63494 | 161 | lemma closed_singleton [iff]: "closed {a}"
 | 
| 51471 | 162 | proof - | 
| 163 |   let ?T = "\<Union>{S. open S \<and> a \<notin> S}"
 | |
| 63494 | 164 | have "open ?T" | 
| 165 | by (simp add: open_Union) | |
| 51471 | 166 |   also have "?T = - {a}"
 | 
| 63494 | 167 | by (auto simp add: set_eq_iff separation_t1) | 
| 168 |   finally show "closed {a}"
 | |
| 169 | by (simp only: closed_def) | |
| 51471 | 170 | qed | 
| 171 | ||
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 172 | lemma closed_insert [continuous_intros, simp]: | 
| 63494 | 173 | assumes "closed S" | 
| 174 | shows "closed (insert a S)" | |
| 51471 | 175 | proof - | 
| 63494 | 176 |   from closed_singleton assms have "closed ({a} \<union> S)"
 | 
| 177 | by (rule closed_Un) | |
| 178 | then show "closed (insert a S)" | |
| 179 | by simp | |
| 51471 | 180 | qed | 
| 181 | ||
| 63494 | 182 | lemma finite_imp_closed: "finite S \<Longrightarrow> closed S" | 
| 183 | by (induct pred: finite) simp_all | |
| 184 | ||
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 185 | end | 
| 51471 | 186 | |
| 60758 | 187 | text \<open>T2 spaces are also known as Hausdorff spaces.\<close> | 
| 51471 | 188 | |
| 189 | class t2_space = topological_space + | |
| 190 |   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 = {}"
 | |
| 191 | ||
| 192 | instance t2_space \<subseteq> t1_space | |
| 63494 | 193 | by standard (fast dest: hausdorff) | 
| 194 | ||
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 195 | lemma (in t2_space) separation_t2: "x \<noteq> y \<longleftrightarrow> (\<exists>U V. open U \<and> open V \<and> x \<in> U \<and> y \<in> V \<and> U \<inter> V = {})"
 | 
| 63494 | 196 | using hausdorff [of x y] by blast | 
| 197 | ||
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 198 | lemma (in t0_space) separation_t0: "x \<noteq> y \<longleftrightarrow> (\<exists>U. open U \<and> \<not> (x \<in> U \<longleftrightarrow> y \<in> U))" | 
| 63494 | 199 | using t0_space [of x y] by blast | 
| 200 | ||
| 51471 | 201 | |
| 67454 | 202 | text \<open>A classical separation axiom for topological space, the T3 axiom -- also called regularity: | 
| 203 | if a point is not in a closed set, then there are open sets separating them.\<close> | |
| 204 | ||
| 205 | class t3_space = t2_space + | |
| 206 |   assumes t3_space: "closed S \<Longrightarrow> y \<notin> S \<Longrightarrow> \<exists>U V. open U \<and> open V \<and> y \<in> U \<and> S \<subseteq> V \<and> U \<inter> V = {}"
 | |
| 207 | ||
| 208 | text \<open>A classical separation axiom for topological space, the T4 axiom -- also called normality: | |
| 209 | if two closed sets are disjoint, then there are open sets separating them.\<close> | |
| 210 | ||
| 211 | class t4_space = t2_space + | |
| 212 |   assumes t4_space: "closed S \<Longrightarrow> closed T \<Longrightarrow> S \<inter> T = {} \<Longrightarrow> \<exists>U V. open U \<and> open V \<and> S \<subseteq> U \<and> T \<subseteq> V \<and> U \<inter> V = {}"
 | |
| 213 | ||
| 214 | text \<open>T4 is stronger than T3, and weaker than metric.\<close> | |
| 215 | ||
| 216 | instance t4_space \<subseteq> t3_space | |
| 217 | proof | |
| 218 | fix S and y::'a assume "closed S" "y \<notin> S" | |
| 219 |   then show "\<exists>U V. open U \<and> open V \<and> y \<in> U \<and> S \<subseteq> V \<and> U \<inter> V = {}"
 | |
| 220 |     using t4_space[of "{y}" S] by auto
 | |
| 221 | qed | |
| 222 | ||
| 60758 | 223 | text \<open>A perfect space is a topological space with no isolated points.\<close> | 
| 51471 | 224 | |
| 225 | class perfect_space = topological_space + | |
| 226 |   assumes not_open_singleton: "\<not> open {x}"
 | |
| 227 | ||
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 228 | lemma (in perfect_space) UNIV_not_singleton: "UNIV \<noteq> {x}"
 | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 229 | for x::'a | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 230 | by (metis (no_types) open_UNIV not_open_singleton) | 
| 62381 
a6479cb85944
New and revised material for (multivariate) analysis
 paulson <lp15@cam.ac.uk> parents: 
62369diff
changeset | 231 | |
| 51471 | 232 | |
| 60758 | 233 | subsection \<open>Generators for toplogies\<close> | 
| 51471 | 234 | |
| 63494 | 235 | inductive generate_topology :: "'a set set \<Rightarrow> 'a set \<Rightarrow> bool" for S :: "'a set set" | 
| 236 | where | |
| 237 | UNIV: "generate_topology S UNIV" | |
| 238 | | Int: "generate_topology S (a \<inter> b)" if "generate_topology S a" and "generate_topology S b" | |
| 239 | | UN: "generate_topology S (\<Union>K)" if "(\<And>k. k \<in> K \<Longrightarrow> generate_topology S k)" | |
| 240 | | Basis: "generate_topology S s" if "s \<in> S" | |
| 51471 | 241 | |
| 62102 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 hoelzl parents: 
62101diff
changeset | 242 | hide_fact (open) UNIV Int UN Basis | 
| 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 hoelzl parents: 
62101diff
changeset | 243 | |
| 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 hoelzl parents: 
62101diff
changeset | 244 | lemma generate_topology_Union: | 
| 51471 | 245 | "(\<And>k. k \<in> I \<Longrightarrow> generate_topology S (K k)) \<Longrightarrow> generate_topology S (\<Union>k\<in>I. K k)" | 
| 56166 | 246 | using generate_topology.UN [of "K ` I"] by auto | 
| 51471 | 247 | |
| 63494 | 248 | lemma topological_space_generate_topology: "class.topological_space (generate_topology S)" | 
| 61169 | 249 | by standard (auto intro: generate_topology.intros) | 
| 51471 | 250 | |
| 63494 | 251 | |
| 60758 | 252 | subsection \<open>Order topologies\<close> | 
| 51471 | 253 | |
| 254 | class order_topology = order + "open" + | |
| 255 |   assumes open_generated_order: "open = generate_topology (range (\<lambda>a. {..< a}) \<union> range (\<lambda>a. {a <..}))"
 | |
| 256 | begin | |
| 257 | ||
| 258 | subclass topological_space | |
| 259 | unfolding open_generated_order | |
| 260 | by (rule topological_space_generate_topology) | |
| 261 | ||
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 262 | lemma open_greaterThan [continuous_intros, simp]: "open {a <..}"
 | 
| 51471 | 263 | unfolding open_generated_order by (auto intro: generate_topology.Basis) | 
| 264 | ||
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 265 | lemma open_lessThan [continuous_intros, simp]: "open {..< a}"
 | 
| 51471 | 266 | unfolding open_generated_order by (auto intro: generate_topology.Basis) | 
| 267 | ||
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 268 | lemma open_greaterThanLessThan [continuous_intros, simp]: "open {a <..< b}"
 | 
| 51471 | 269 | unfolding greaterThanLessThan_eq by (simp add: open_Int) | 
| 270 | ||
| 271 | end | |
| 272 | ||
| 273 | class linorder_topology = linorder + order_topology | |
| 274 | ||
| 63494 | 275 | lemma closed_atMost [continuous_intros, simp]: "closed {..a}"
 | 
| 276 | for a :: "'a::linorder_topology" | |
| 51471 | 277 | by (simp add: closed_open) | 
| 278 | ||
| 63494 | 279 | lemma closed_atLeast [continuous_intros, simp]: "closed {a..}"
 | 
| 280 | for a :: "'a::linorder_topology" | |
| 51471 | 281 | by (simp add: closed_open) | 
| 282 | ||
| 63494 | 283 | lemma closed_atLeastAtMost [continuous_intros, simp]: "closed {a..b}"
 | 
| 284 | for a b :: "'a::linorder_topology" | |
| 51471 | 285 | proof - | 
| 286 |   have "{a .. b} = {a ..} \<inter> {.. b}"
 | |
| 287 | by auto | |
| 288 | then show ?thesis | |
| 289 | by (simp add: closed_Int) | |
| 290 | qed | |
| 291 | ||
| 70749 
5d06b7bb9d22
More type class generalisations. Note that linorder_antisym_conv1 and linorder_antisym_conv2 no longer exist.
 paulson <lp15@cam.ac.uk> parents: 
70723diff
changeset | 292 | lemma (in order) less_separate: | 
| 51471 | 293 | assumes "x < y" | 
| 294 |   shows "\<exists>a b. x \<in> {..< a} \<and> y \<in> {b <..} \<and> {..< a} \<inter> {b <..} = {}"
 | |
| 53381 | 295 | proof (cases "\<exists>z. x < z \<and> z < y") | 
| 296 | case True | |
| 297 | then obtain z where "x < z \<and> z < y" .. | |
| 51471 | 298 |   then have "x \<in> {..< z} \<and> y \<in> {z <..} \<and> {z <..} \<inter> {..< z} = {}"
 | 
| 299 | by auto | |
| 300 | then show ?thesis by blast | |
| 301 | next | |
| 53381 | 302 | case False | 
| 63494 | 303 |   with \<open>x < y\<close> have "x \<in> {..< y}" "y \<in> {x <..}" "{x <..} \<inter> {..< y} = {}"
 | 
| 51471 | 304 | by auto | 
| 305 | then show ?thesis by blast | |
| 306 | qed | |
| 307 | ||
| 308 | instance linorder_topology \<subseteq> t2_space | |
| 309 | proof | |
| 310 | fix x y :: 'a | |
| 311 |   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 = {}"
 | |
| 63494 | 312 | using less_separate [of x y] less_separate [of y x] | 
| 313 | by (elim neqE; metis open_lessThan open_greaterThan Int_commute) | |
| 51471 | 314 | qed | 
| 315 | ||
| 51480 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 316 | lemma (in linorder_topology) open_right: | 
| 63494 | 317 | assumes "open S" "x \<in> S" | 
| 318 | and gt_ex: "x < y" | |
| 319 |   shows "\<exists>b>x. {x ..< b} \<subseteq> S"
 | |
| 320 | using assms unfolding open_generated_order | |
| 321 | proof induct | |
| 322 | case UNIV | |
| 323 | then show ?case by blast | |
| 324 | next | |
| 325 | case (Int A B) | |
| 326 |   then obtain a b where "a > x" "{x ..< a} \<subseteq> A"  "b > x" "{x ..< b} \<subseteq> B"
 | |
| 327 | by auto | |
| 328 | then show ?case | |
| 329 | by (auto intro!: exI[of _ "min a b"]) | |
| 330 | next | |
| 331 | case UN | |
| 332 | then show ?case by blast | |
| 333 | next | |
| 334 | case Basis | |
| 335 | then show ?case | |
| 336 | by (fastforce intro: exI[of _ y] gt_ex) | |
| 337 | qed | |
| 338 | ||
| 339 | lemma (in linorder_topology) open_left: | |
| 340 | assumes "open S" "x \<in> S" | |
| 341 | and lt_ex: "y < x" | |
| 342 |   shows "\<exists>b<x. {b <.. x} \<subseteq> S"
 | |
| 51471 | 343 | using assms unfolding open_generated_order | 
| 344 | proof induction | |
| 63494 | 345 | case UNIV | 
| 346 | then show ?case by blast | |
| 347 | next | |
| 51471 | 348 | case (Int A B) | 
| 63494 | 349 |   then obtain a b where "a < x" "{a <.. x} \<subseteq> A"  "b < x" "{b <.. x} \<subseteq> B"
 | 
| 350 | by auto | |
| 351 | then show ?case | |
| 352 | by (auto intro!: exI[of _ "max a b"]) | |
| 51471 | 353 | next | 
| 63494 | 354 | case UN | 
| 355 | then show ?case by blast | |
| 51471 | 356 | next | 
| 63494 | 357 | case Basis | 
| 358 | then show ?case | |
| 359 | by (fastforce intro: exI[of _ y] lt_ex) | |
| 360 | qed | |
| 361 | ||
| 51471 | 362 | |
| 62369 | 363 | subsection \<open>Setup some topologies\<close> | 
| 364 | ||
| 60758 | 365 | subsubsection \<open>Boolean is an order topology\<close> | 
| 59106 | 366 | |
| 62369 | 367 | class discrete_topology = topological_space + | 
| 368 | assumes open_discrete: "\<And>A. open A" | |
| 369 | ||
| 370 | instance discrete_topology < t2_space | |
| 371 | proof | |
| 63494 | 372 | fix x y :: 'a | 
| 373 | assume "x \<noteq> y" | |
| 374 |   then show "\<exists>U V. open U \<and> open V \<and> x \<in> U \<and> y \<in> V \<and> U \<inter> V = {}"
 | |
| 62369 | 375 |     by (intro exI[of _ "{_}"]) (auto intro!: open_discrete)
 | 
| 376 | qed | |
| 377 | ||
| 378 | instantiation bool :: linorder_topology | |
| 59106 | 379 | begin | 
| 380 | ||
| 63494 | 381 | definition open_bool :: "bool set \<Rightarrow> bool" | 
| 382 |   where "open_bool = generate_topology (range (\<lambda>a. {..< a}) \<union> range (\<lambda>a. {a <..}))"
 | |
| 59106 | 383 | |
| 384 | instance | |
| 63494 | 385 | by standard (rule open_bool_def) | 
| 59106 | 386 | |
| 387 | end | |
| 388 | ||
| 62369 | 389 | instance bool :: discrete_topology | 
| 390 | proof | |
| 391 | fix A :: "bool set" | |
| 59106 | 392 |   have *: "{False <..} = {True}" "{..< True} = {False}"
 | 
| 393 | by auto | |
| 394 |   have "A = UNIV \<or> A = {} \<or> A = {False <..} \<or> A = {..< True}"
 | |
| 63171 | 395 | using subset_UNIV[of A] unfolding UNIV_bool * by blast | 
| 59106 | 396 | then show "open A" | 
| 397 | by auto | |
| 398 | qed | |
| 399 | ||
| 62369 | 400 | instantiation nat :: linorder_topology | 
| 401 | begin | |
| 402 | ||
| 63494 | 403 | definition open_nat :: "nat set \<Rightarrow> bool" | 
| 404 |   where "open_nat = generate_topology (range (\<lambda>a. {..< a}) \<union> range (\<lambda>a. {a <..}))"
 | |
| 62369 | 405 | |
| 406 | instance | |
| 63494 | 407 | by standard (rule open_nat_def) | 
| 62369 | 408 | |
| 409 | end | |
| 410 | ||
| 411 | instance nat :: discrete_topology | |
| 412 | proof | |
| 413 | fix A :: "nat set" | |
| 414 |   have "open {n}" for n :: nat
 | |
| 415 | proof (cases n) | |
| 416 | case 0 | |
| 417 |     moreover have "{0} = {..<1::nat}"
 | |
| 418 | by auto | |
| 419 | ultimately show ?thesis | |
| 420 | by auto | |
| 421 | next | |
| 422 | case (Suc n') | |
| 63494 | 423 |     then have "{n} = {..<Suc n} \<inter> {n' <..}"
 | 
| 62369 | 424 | by auto | 
| 63494 | 425 | with Suc show ?thesis | 
| 62369 | 426 | by (auto intro: open_lessThan open_greaterThan) | 
| 427 | qed | |
| 428 |   then have "open (\<Union>a\<in>A. {a})"
 | |
| 429 | by (intro open_UN) auto | |
| 430 | then show "open A" | |
| 431 | by simp | |
| 432 | qed | |
| 433 | ||
| 434 | instantiation int :: linorder_topology | |
| 435 | begin | |
| 436 | ||
| 63494 | 437 | definition open_int :: "int set \<Rightarrow> bool" | 
| 438 |   where "open_int = generate_topology (range (\<lambda>a. {..< a}) \<union> range (\<lambda>a. {a <..}))"
 | |
| 62369 | 439 | |
| 440 | instance | |
| 63494 | 441 | by standard (rule open_int_def) | 
| 62369 | 442 | |
| 443 | end | |
| 444 | ||
| 445 | instance int :: discrete_topology | |
| 446 | proof | |
| 447 | fix A :: "int set" | |
| 448 |   have "{..<i + 1} \<inter> {i-1 <..} = {i}" for i :: int
 | |
| 449 | by auto | |
| 450 |   then have "open {i}" for i :: int
 | |
| 451 | using open_Int[OF open_lessThan[of "i + 1"] open_greaterThan[of "i - 1"]] by auto | |
| 452 |   then have "open (\<Union>a\<in>A. {a})"
 | |
| 453 | by (intro open_UN) auto | |
| 454 | then show "open A" | |
| 455 | by simp | |
| 456 | qed | |
| 457 | ||
| 63494 | 458 | |
| 60758 | 459 | subsubsection \<open>Topological filters\<close> | 
| 51471 | 460 | |
| 461 | definition (in topological_space) nhds :: "'a \<Rightarrow> 'a filter" | |
| 68802 | 462 |   where "nhds a = (INF S\<in>{S. open S \<and> a \<in> S}. principal S)"
 | 
| 51471 | 463 | |
| 63494 | 464 | definition (in topological_space) at_within :: "'a \<Rightarrow> 'a set \<Rightarrow> 'a filter" | 
| 465 |     ("at (_)/ within (_)" [1000, 60] 60)
 | |
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51518diff
changeset | 466 |   where "at a within s = inf (nhds a) (principal (s - {a}))"
 | 
| 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51518diff
changeset | 467 | |
| 63494 | 468 | abbreviation (in topological_space) at :: "'a \<Rightarrow> 'a filter"  ("at")
 | 
| 469 | where "at x \<equiv> at x within (CONST UNIV)" | |
| 470 | ||
| 471 | abbreviation (in order_topology) at_right :: "'a \<Rightarrow> 'a filter" | |
| 472 |   where "at_right x \<equiv> at x within {x <..}"
 | |
| 473 | ||
| 474 | abbreviation (in order_topology) at_left :: "'a \<Rightarrow> 'a filter" | |
| 475 |   where "at_left x \<equiv> at x within {..< x}"
 | |
| 51471 | 476 | |
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 477 | lemma (in topological_space) nhds_generated_topology: | 
| 68802 | 478 |   "open = generate_topology T \<Longrightarrow> nhds x = (INF S\<in>{S\<in>T. x \<in> S}. principal S)"
 | 
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 479 | unfolding nhds_def | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 480 | proof (safe intro!: antisym INF_greatest) | 
| 63494 | 481 | fix S | 
| 482 | assume "generate_topology T S" "x \<in> S" | |
| 68802 | 483 |   then show "(INF S\<in>{S \<in> T. x \<in> S}. principal S) \<le> principal S"
 | 
| 63494 | 484 | by induct | 
| 485 | (auto intro: INF_lower order_trans simp: inf_principal[symmetric] simp del: inf_principal) | |
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 486 | qed (auto intro!: INF_lower intro: generate_topology.intros) | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 487 | |
| 51473 | 488 | lemma (in topological_space) eventually_nhds: | 
| 51471 | 489 | "eventually P (nhds a) \<longleftrightarrow> (\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. P x))" | 
| 57276 | 490 | unfolding nhds_def by (subst eventually_INF_base) (auto simp: eventually_principal) | 
| 51471 | 491 | |
| 65036 
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
 paulson <lp15@cam.ac.uk> parents: 
64969diff
changeset | 492 | lemma eventually_eventually: | 
| 64969 | 493 | "eventually (\<lambda>y. eventually P (nhds y)) (nhds x) = eventually P (nhds x)" | 
| 65036 
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
 paulson <lp15@cam.ac.uk> parents: 
64969diff
changeset | 494 | by (auto simp: eventually_nhds) | 
| 64969 | 495 | |
| 62102 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 hoelzl parents: 
62101diff
changeset | 496 | lemma (in topological_space) eventually_nhds_in_open: | 
| 61531 
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
 eberlm parents: 
61520diff
changeset | 497 | "open s \<Longrightarrow> x \<in> s \<Longrightarrow> eventually (\<lambda>y. y \<in> s) (nhds x)" | 
| 
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
 eberlm parents: 
61520diff
changeset | 498 | by (subst eventually_nhds) blast | 
| 
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
 eberlm parents: 
61520diff
changeset | 499 | |
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 500 | lemma (in topological_space) eventually_nhds_x_imp_x: "eventually P (nhds x) \<Longrightarrow> P x" | 
| 63295 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 501 | by (subst (asm) eventually_nhds) blast | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 502 | |
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 503 | lemma (in topological_space) nhds_neq_bot [simp]: "nhds a \<noteq> bot" | 
| 63494 | 504 | by (simp add: trivial_limit_def eventually_nhds) | 
| 505 | ||
| 506 | lemma (in t1_space) t1_space_nhds: "x \<noteq> y \<Longrightarrow> (\<forall>\<^sub>F x in nhds x. x \<noteq> y)" | |
| 60182 
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
 hoelzl parents: 
60172diff
changeset | 507 | by (drule t1_space) (auto simp: eventually_nhds) | 
| 
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
 hoelzl parents: 
60172diff
changeset | 508 | |
| 62369 | 509 | lemma (in topological_space) nhds_discrete_open: "open {x} \<Longrightarrow> nhds x = principal {x}"
 | 
| 510 |   by (auto simp: nhds_def intro!: antisym INF_greatest INF_lower2[of "{x}"])
 | |
| 511 | ||
| 512 | lemma (in discrete_topology) nhds_discrete: "nhds x = principal {x}"
 | |
| 513 | by (simp add: nhds_discrete_open open_discrete) | |
| 514 | ||
| 515 | lemma (in discrete_topology) at_discrete: "at x within S = bot" | |
| 516 | unfolding at_within_def nhds_discrete by simp | |
| 517 | ||
| 68860 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 518 | lemma (in discrete_topology) tendsto_discrete: | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 519 | "filterlim (f :: 'b \<Rightarrow> 'a) (nhds y) F \<longleftrightarrow> eventually (\<lambda>x. f x = y) F" | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 520 | by (auto simp: nhds_discrete filterlim_principal) | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 521 | |
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 522 | lemma (in topological_space) at_within_eq: | 
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 523 |   "at x within s = (INF S\<in>{S. open S \<and> x \<in> S}. principal (S \<inter> s - {x}))"
 | 
| 63494 | 524 | unfolding nhds_def at_within_def | 
| 525 | by (subst INF_inf_const2[symmetric]) (auto simp: Diff_Int_distrib) | |
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 526 | |
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 527 | lemma (in topological_space) eventually_at_filter: | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51518diff
changeset | 528 | "eventually P (at a within s) \<longleftrightarrow> eventually (\<lambda>x. x \<noteq> a \<longrightarrow> x \<in> s \<longrightarrow> P x) (nhds a)" | 
| 63494 | 529 | by (simp add: at_within_def eventually_inf_principal imp_conjL[symmetric] conj_commute) | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51518diff
changeset | 530 | |
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 531 | lemma (in topological_space) at_le: "s \<subseteq> t \<Longrightarrow> at x within s \<le> at x within t" | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51518diff
changeset | 532 | unfolding at_within_def by (intro inf_mono) auto | 
| 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51518diff
changeset | 533 | |
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 534 | lemma (in topological_space) eventually_at_topological: | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51518diff
changeset | 535 | "eventually P (at a within s) \<longleftrightarrow> (\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. x \<noteq> a \<longrightarrow> x \<in> s \<longrightarrow> P x))" | 
| 63494 | 536 | by (simp add: eventually_nhds eventually_at_filter) | 
| 51471 | 537 | |
| 77138 
c8597292cd41
Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 538 | lemma eventually_at_in_open: | 
| 
c8597292cd41
Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 539 | assumes "open A" "x \<in> A" | 
| 
c8597292cd41
Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 540 |   shows   "eventually (\<lambda>y. y \<in> A - {x}) (at x)"
 | 
| 
c8597292cd41
Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 541 | using assms eventually_at_topological by blast | 
| 
c8597292cd41
Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 542 | |
| 
c8597292cd41
Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 543 | lemma eventually_at_in_open': | 
| 
c8597292cd41
Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 544 | assumes "open A" "x \<in> A" | 
| 
c8597292cd41
Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 545 | shows "eventually (\<lambda>y. y \<in> A) (at x)" | 
| 
c8597292cd41
Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 546 | using assms eventually_at_topological by blast | 
| 
c8597292cd41
Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 547 | |
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 548 | lemma (in topological_space) at_within_open: "a \<in> S \<Longrightarrow> open S \<Longrightarrow> at a within S = at a" | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51518diff
changeset | 549 | unfolding filter_eq_iff eventually_at_topological by (metis open_Int Int_iff UNIV_I) | 
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 550 | |
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 551 | lemma (in topological_space) at_within_open_NO_MATCH: | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 552 | "a \<in> s \<Longrightarrow> open s \<Longrightarrow> NO_MATCH UNIV s \<Longrightarrow> at a within s = at a" | 
| 61234 | 553 | by (simp only: at_within_open) | 
| 554 | ||
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 555 | lemma (in topological_space) at_within_open_subset: | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 556 | "a \<in> S \<Longrightarrow> open S \<Longrightarrow> S \<subseteq> T \<Longrightarrow> at a within T = at a" | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 557 | by (metis at_le at_within_open dual_order.antisym subset_UNIV) | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 558 | |
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 559 | lemma (in topological_space) at_within_nhd: | 
| 61245 | 560 |   assumes "x \<in> S" "open S" "T \<inter> S - {x} = U \<inter> S - {x}"
 | 
| 561 | shows "at x within T = at x within U" | |
| 562 | unfolding filter_eq_iff eventually_at_filter | |
| 563 | proof (intro allI eventually_subst) | |
| 564 | have "eventually (\<lambda>x. x \<in> S) (nhds x)" | |
| 565 | using \<open>x \<in> S\<close> \<open>open S\<close> by (auto simp: eventually_nhds) | |
| 62102 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 hoelzl parents: 
62101diff
changeset | 566 | then show "\<forall>\<^sub>F n in nhds x. (n \<noteq> x \<longrightarrow> n \<in> T \<longrightarrow> P n) = (n \<noteq> x \<longrightarrow> n \<in> U \<longrightarrow> P n)" for P | 
| 61245 | 567 |     by eventually_elim (insert \<open>T \<inter> S - {x} = U \<inter> S - {x}\<close>, blast)
 | 
| 568 | qed | |
| 569 | ||
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 570 | lemma (in topological_space) at_within_empty [simp]: "at a within {} = bot"
 | 
| 53859 | 571 | unfolding at_within_def by simp | 
| 572 | ||
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 573 | lemma (in topological_space) at_within_union: | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 574 | "at x within (S \<union> T) = sup (at x within S) (at x within T)" | 
| 53860 | 575 | unfolding filter_eq_iff eventually_sup eventually_at_filter | 
| 576 | by (auto elim!: eventually_rev_mp) | |
| 577 | ||
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 578 | lemma (in topological_space) at_eq_bot_iff: "at a = bot \<longleftrightarrow> open {a}"
 | 
| 51471 | 579 | unfolding trivial_limit_def eventually_at_topological | 
| 74668 | 580 | by (metis UNIV_I empty_iff is_singletonE is_singletonI' singleton_iff) | 
| 63494 | 581 | |
| 77138 
c8597292cd41
Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 582 | lemma (in t1_space) eventually_neq_at_within: | 
| 
c8597292cd41
Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 583 | "eventually (\<lambda>w. w \<noteq> x) (at z within A)" | 
| 
c8597292cd41
Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 584 | by (smt (verit, ccfv_threshold) eventually_True eventually_at_topological separation_t1) | 
| 
c8597292cd41
Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76724diff
changeset | 585 | |
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 586 | lemma (in perfect_space) at_neq_bot [simp]: "at a \<noteq> bot" | 
| 51471 | 587 | by (simp add: at_eq_bot_iff not_open_singleton) | 
| 588 | ||
| 63494 | 589 | lemma (in order_topology) nhds_order: | 
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 590 |   "nhds x = inf (INF a\<in>{x <..}. principal {..< a}) (INF a\<in>{..< x}. principal {a <..})"
 | 
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 591 | proof - | 
| 62102 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 hoelzl parents: 
62101diff
changeset | 592 |   have 1: "{S \<in> range lessThan \<union> range greaterThan. x \<in> S} =
 | 
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 593 |       (\<lambda>a. {..< a}) ` {x <..} \<union> (\<lambda>a. {a <..}) ` {..< x}"
 | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 594 | by auto | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 595 | show ?thesis | 
| 63494 | 596 | by (simp only: nhds_generated_topology[OF open_generated_order] INF_union 1 INF_image comp_def) | 
| 51471 | 597 | qed | 
| 598 | ||
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 599 | lemma (in topological_space) filterlim_at_within_If: | 
| 63295 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 600 |   assumes "filterlim f G (at x within (A \<inter> {x. P x}))"
 | 
| 63494 | 601 |     and "filterlim g G (at x within (A \<inter> {x. \<not>P x}))"
 | 
| 602 | shows "filterlim (\<lambda>x. if P x then f x else g x) G (at x within A)" | |
| 63295 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 603 | proof (rule filterlim_If) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 604 | note assms(1) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 605 |   also have "at x within (A \<inter> {x. P x}) = inf (nhds x) (principal (A \<inter> Collect P - {x}))"
 | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 606 | by (simp add: at_within_def) | 
| 63494 | 607 |   also have "A \<inter> Collect P - {x} = (A - {x}) \<inter> Collect P"
 | 
| 608 | by blast | |
| 63295 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 609 | also have "inf (nhds x) (principal \<dots>) = inf (at x within A) (principal (Collect P))" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 610 | by (simp add: at_within_def inf_assoc) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 611 | finally show "filterlim f G (inf (at x within A) (principal (Collect P)))" . | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 612 | next | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 613 | note assms(2) | 
| 63494 | 614 |   also have "at x within (A \<inter> {x. \<not> P x}) = inf (nhds x) (principal (A \<inter> {x. \<not> P x} - {x}))"
 | 
| 63295 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 615 | by (simp add: at_within_def) | 
| 63494 | 616 |   also have "A \<inter> {x. \<not> P x} - {x} = (A - {x}) \<inter> {x. \<not> P x}"
 | 
| 617 | by blast | |
| 618 |   also have "inf (nhds x) (principal \<dots>) = inf (at x within A) (principal {x. \<not> P x})"
 | |
| 63295 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 619 | by (simp add: at_within_def inf_assoc) | 
| 63494 | 620 |   finally show "filterlim g G (inf (at x within A) (principal {x. \<not> P x}))" .
 | 
| 63295 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 621 | qed | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 622 | |
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 623 | lemma (in topological_space) filterlim_at_If: | 
| 63295 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 624 |   assumes "filterlim f G (at x within {x. P x})"
 | 
| 63494 | 625 |     and "filterlim g G (at x within {x. \<not>P x})"
 | 
| 626 | shows "filterlim (\<lambda>x. if P x then f x else g x) G (at x)" | |
| 63295 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 627 | using assms by (intro filterlim_at_within_If) simp_all | 
| 63494 | 628 | lemma (in linorder_topology) at_within_order: | 
| 629 |   assumes "UNIV \<noteq> {x}"
 | |
| 630 | shows "at x within s = | |
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 631 |     inf (INF a\<in>{x <..}. principal ({..< a} \<inter> s - {x}))
 | 
| 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 632 |         (INF a\<in>{..< x}. principal ({a <..} \<inter> s - {x}))"
 | 
| 63494 | 633 | proof (cases "{x <..} = {}" "{..< x} = {}" rule: case_split [case_product case_split])
 | 
| 634 | case True_True | |
| 635 |   have "UNIV = {..< x} \<union> {x} \<union> {x <..}"
 | |
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 636 | by auto | 
| 63494 | 637 | with assms True_True show ?thesis | 
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 638 | by auto | 
| 63494 | 639 | qed (auto simp del: inf_principal simp: at_within_def nhds_order Int_Diff | 
| 640 | inf_principal[symmetric] INF_inf_const2 inf_sup_aci[where 'a="'a filter"]) | |
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 641 | |
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 642 | lemma (in linorder_topology) at_left_eq: | 
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 643 |   "y < x \<Longrightarrow> at_left x = (INF a\<in>{..< x}. principal {a <..< x})"
 | 
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 644 | by (subst at_within_order) | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 645 | (auto simp: greaterThan_Int_greaterThan greaterThanLessThan_eq[symmetric] min.absorb2 INF_constant | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 646 | intro!: INF_lower2 inf_absorb2) | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 647 | |
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 648 | lemma (in linorder_topology) eventually_at_left: | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 649 | "y < x \<Longrightarrow> eventually P (at_left x) \<longleftrightarrow> (\<exists>b<x. \<forall>y>b. y < x \<longrightarrow> P y)" | 
| 63494 | 650 | unfolding at_left_eq | 
| 651 | by (subst eventually_INF_base) (auto simp: eventually_principal Ball_def) | |
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 652 | |
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 653 | lemma (in linorder_topology) at_right_eq: | 
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 654 |   "x < y \<Longrightarrow> at_right x = (INF a\<in>{x <..}. principal {x <..< a})"
 | 
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 655 | by (subst at_within_order) | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 656 | (auto simp: lessThan_Int_lessThan greaterThanLessThan_eq[symmetric] max.absorb2 INF_constant Int_commute | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 657 | intro!: INF_lower2 inf_absorb1) | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 658 | |
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 659 | lemma (in linorder_topology) eventually_at_right: | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 660 | "x < y \<Longrightarrow> eventually P (at_right x) \<longleftrightarrow> (\<exists>b>x. \<forall>y>x. y < b \<longrightarrow> P y)" | 
| 63494 | 661 | unfolding at_right_eq | 
| 662 | by (subst eventually_INF_base) (auto simp: eventually_principal Ball_def) | |
| 51471 | 663 | |
| 62083 | 664 | lemma eventually_at_right_less: "\<forall>\<^sub>F y in at_right (x::'a::{linorder_topology, no_top}). x < y"
 | 
| 665 | using gt_ex[of x] eventually_at_right[of x] by auto | |
| 666 | ||
| 63494 | 667 | lemma trivial_limit_at_right_top: "at_right (top::_::{order_top,linorder_topology}) = bot"
 | 
| 668 | by (auto simp: filter_eq_iff eventually_at_topological) | |
| 669 | ||
| 670 | lemma trivial_limit_at_left_bot: "at_left (bot::_::{order_bot,linorder_topology}) = bot"
 | |
| 671 | by (auto simp: filter_eq_iff eventually_at_topological) | |
| 672 | ||
| 673 | lemma trivial_limit_at_left_real [simp]: "\<not> trivial_limit (at_left x)" | |
| 674 |   for x :: "'a::{no_bot,dense_order,linorder_topology}"
 | |
| 675 | using lt_ex [of x] | |
| 57275 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 hoelzl parents: 
57025diff
changeset | 676 | by safe (auto simp add: trivial_limit_def eventually_at_left dest: dense) | 
| 51471 | 677 | |
| 63494 | 678 | lemma trivial_limit_at_right_real [simp]: "\<not> trivial_limit (at_right x)" | 
| 679 |   for x :: "'a::{no_top,dense_order,linorder_topology}"
 | |
| 57275 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 hoelzl parents: 
57025diff
changeset | 680 | using gt_ex[of x] | 
| 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 hoelzl parents: 
57025diff
changeset | 681 | by safe (auto simp add: trivial_limit_def eventually_at_right dest: dense) | 
| 51471 | 682 | |
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 683 | lemma (in linorder_topology) at_eq_sup_left_right: "at x = sup (at_left x) (at_right x)" | 
| 62102 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 hoelzl parents: 
62101diff
changeset | 684 | by (auto simp: eventually_at_filter filter_eq_iff eventually_sup | 
| 63494 | 685 | elim: eventually_elim2 eventually_mono) | 
| 51471 | 686 | |
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 687 | lemma (in linorder_topology) eventually_at_split: | 
| 63494 | 688 | "eventually P (at x) \<longleftrightarrow> eventually P (at_left x) \<and> eventually P (at_right x)" | 
| 51471 | 689 | by (subst at_eq_sup_left_right) (simp add: eventually_sup) | 
| 690 | ||
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 691 | lemma (in order_topology) eventually_at_leftI: | 
| 63713 | 692 |   assumes "\<And>x. x \<in> {a<..<b} \<Longrightarrow> P x" "a < b"
 | 
| 693 | shows "eventually P (at_left b)" | |
| 694 |   using assms unfolding eventually_at_topological by (intro exI[of _ "{a<..}"]) auto
 | |
| 695 | ||
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 696 | lemma (in order_topology) eventually_at_rightI: | 
| 63713 | 697 |   assumes "\<And>x. x \<in> {a<..<b} \<Longrightarrow> P x" "a < b"
 | 
| 698 | shows "eventually P (at_right a)" | |
| 699 |   using assms unfolding eventually_at_topological by (intro exI[of _ "{..<b}"]) auto
 | |
| 700 | ||
| 66162 | 701 | lemma eventually_filtercomap_nhds: | 
| 702 | "eventually P (filtercomap f (nhds x)) \<longleftrightarrow> (\<exists>S. open S \<and> x \<in> S \<and> (\<forall>x. f x \<in> S \<longrightarrow> P x))" | |
| 703 | unfolding eventually_filtercomap eventually_nhds by auto | |
| 704 | ||
| 705 | lemma eventually_filtercomap_at_topological: | |
| 706 | "eventually P (filtercomap f (at A within B)) \<longleftrightarrow> | |
| 707 |      (\<exists>S. open S \<and> A \<in> S \<and> (\<forall>x. f x \<in> S \<inter> B - {A} \<longrightarrow> P x))" (is "?lhs = ?rhs")
 | |
| 708 | unfolding at_within_def filtercomap_inf eventually_inf_principal filtercomap_principal | |
| 709 | eventually_filtercomap_nhds eventually_principal by blast | |
| 67685 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 710 | |
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 711 | lemma eventually_at_right_field: | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 712 | "eventually P (at_right x) \<longleftrightarrow> (\<exists>b>x. \<forall>y>x. y < b \<longrightarrow> P y)" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 713 |   for x :: "'a::{linordered_field, linorder_topology}"
 | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 714 | using linordered_field_no_ub[rule_format, of x] | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 715 | by (auto simp: eventually_at_right) | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 716 | |
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 717 | lemma eventually_at_left_field: | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 718 | "eventually P (at_left x) \<longleftrightarrow> (\<exists>b<x. \<forall>y>b. y < x \<longrightarrow> P y)" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 719 |   for x :: "'a::{linordered_field, linorder_topology}"
 | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 720 | using linordered_field_no_lb[rule_format, of x] | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 721 | by (auto simp: eventually_at_left) | 
| 66162 | 722 | |
| 77140 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 723 | lemma filtermap_nhds_eq_imp_filtermap_at_eq: | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 724 | assumes "filtermap f (nhds z) = nhds (f z)" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 725 | assumes "eventually (\<lambda>x. f x = f z \<longrightarrow> x = z) (at z)" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 726 | shows "filtermap f (at z) = at (f z)" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 727 | proof (rule filter_eqI) | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 728 | fix P :: "'a \<Rightarrow> bool" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 729 | have "eventually P (filtermap f (at z)) \<longleftrightarrow> (\<forall>\<^sub>F x in nhds z. x \<noteq> z \<longrightarrow> P (f x))" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 730 | by (simp add: eventually_filtermap eventually_at_filter) | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 731 | also have "\<dots> \<longleftrightarrow> (\<forall>\<^sub>F x in nhds z. f x \<noteq> f z \<longrightarrow> P (f x))" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 732 | by (rule eventually_cong [OF assms(2)[unfolded eventually_at_filter]]) auto | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 733 | also have "\<dots> \<longleftrightarrow> (\<forall>\<^sub>F x in filtermap f (nhds z). x \<noteq> f z \<longrightarrow> P x)" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 734 | by (simp add: eventually_filtermap) | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 735 | also have "filtermap f (nhds z) = nhds (f z)" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 736 | by (rule assms) | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 737 | also have "(\<forall>\<^sub>F x in nhds (f z). x \<noteq> f z \<longrightarrow> P x) \<longleftrightarrow> (\<forall>\<^sub>F x in at (f z). P x)" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 738 | by (simp add: eventually_at_filter) | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 739 | finally show "eventually P (filtermap f (at z)) = eventually P (at (f z))" . | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 740 | qed | 
| 63494 | 741 | |
| 60758 | 742 | subsubsection \<open>Tendsto\<close> | 
| 51471 | 743 | |
| 744 | abbreviation (in topological_space) | |
| 63494 | 745 |   tendsto :: "('b \<Rightarrow> 'a) \<Rightarrow> 'a \<Rightarrow> 'b filter \<Rightarrow> bool"  (infixr "\<longlongrightarrow>" 55)
 | 
| 746 | where "(f \<longlongrightarrow> l) F \<equiv> filterlim f (nhds l) F" | |
| 747 | ||
| 748 | definition (in t2_space) Lim :: "'f filter \<Rightarrow> ('f \<Rightarrow> 'a) \<Rightarrow> 'a"
 | |
| 749 | where "Lim A f = (THE l. (f \<longlongrightarrow> l) A)" | |
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 750 | |
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 751 | lemma (in topological_space) tendsto_eq_rhs: "(f \<longlongrightarrow> x) F \<Longrightarrow> x = y \<Longrightarrow> (f \<longlongrightarrow> y) F" | 
| 51471 | 752 | by simp | 
| 753 | ||
| 57953 | 754 | named_theorems tendsto_intros "introduction rules for tendsto" | 
| 60758 | 755 | setup \<open> | 
| 67149 | 756 | Global_Theory.add_thms_dynamic (\<^binding>\<open>tendsto_eq_intros\<close>, | 
| 57953 | 757 | fn context => | 
| 69593 | 758 | Named_Theorems.get (Context.proof_of context) \<^named_theorems>\<open>tendsto_intros\<close> | 
| 57953 | 759 |       |> map_filter (try (fn thm => @{thm tendsto_eq_rhs} OF [thm])))
 | 
| 60758 | 760 | \<close> | 
| 51471 | 761 | |
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 762 | context topological_space begin | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 763 | |
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 764 | lemma tendsto_def: | 
| 61973 | 765 | "(f \<longlongrightarrow> l) F \<longleftrightarrow> (\<forall>S. open S \<longrightarrow> l \<in> S \<longrightarrow> eventually (\<lambda>x. f x \<in> S) F)" | 
| 57276 | 766 | unfolding nhds_def filterlim_INF filterlim_principal by auto | 
| 51471 | 767 | |
| 63494 | 768 | lemma tendsto_cong: "(f \<longlongrightarrow> c) F \<longleftrightarrow> (g \<longlongrightarrow> c) F" if "eventually (\<lambda>x. f x = g x) F" | 
| 769 | by (rule filterlim_cong [OF refl refl that]) | |
| 61531 
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
 eberlm parents: 
61520diff
changeset | 770 | |
| 61973 | 771 | lemma tendsto_mono: "F \<le> F' \<Longrightarrow> (f \<longlongrightarrow> l) F' \<Longrightarrow> (f \<longlongrightarrow> l) F" | 
| 51471 | 772 | unfolding tendsto_def le_filter_def by fast | 
| 773 | ||
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 774 | lemma tendsto_ident_at [tendsto_intros, simp, intro]: "((\<lambda>x. x) \<longlongrightarrow> a) (at a within s)" | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 775 | by (auto simp: tendsto_def eventually_at_topological) | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 776 | |
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 777 | lemma tendsto_const [tendsto_intros, simp, intro]: "((\<lambda>x. k) \<longlongrightarrow> k) F" | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 778 | by (simp add: tendsto_def) | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 779 | |
| 67950 
99eaa5cedbb7
Added some simple facts about limits
 Manuel Eberl <eberlm@in.tum.de> parents: 
67727diff
changeset | 780 | lemma filterlim_at: | 
| 63494 | 781 | "(LIM x F. f x :> at b within s) \<longleftrightarrow> eventually (\<lambda>x. f x \<in> s \<and> f x \<noteq> b) F \<and> (f \<longlongrightarrow> b) F" | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51518diff
changeset | 782 | by (simp add: at_within_def filterlim_inf filterlim_principal conj_commute) | 
| 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51518diff
changeset | 783 | |
| 67950 
99eaa5cedbb7
Added some simple facts about limits
 Manuel Eberl <eberlm@in.tum.de> parents: 
67727diff
changeset | 784 | lemma (in -) | 
| 
99eaa5cedbb7
Added some simple facts about limits
 Manuel Eberl <eberlm@in.tum.de> parents: 
67727diff
changeset | 785 | assumes "filterlim f (nhds L) F" | 
| 
99eaa5cedbb7
Added some simple facts about limits
 Manuel Eberl <eberlm@in.tum.de> parents: 
67727diff
changeset | 786 | shows tendsto_imp_filterlim_at_right: | 
| 
99eaa5cedbb7
Added some simple facts about limits
 Manuel Eberl <eberlm@in.tum.de> parents: 
67727diff
changeset | 787 | "eventually (\<lambda>x. f x > L) F \<Longrightarrow> filterlim f (at_right L) F" | 
| 
99eaa5cedbb7
Added some simple facts about limits
 Manuel Eberl <eberlm@in.tum.de> parents: 
67727diff
changeset | 788 | and tendsto_imp_filterlim_at_left: | 
| 
99eaa5cedbb7
Added some simple facts about limits
 Manuel Eberl <eberlm@in.tum.de> parents: 
67727diff
changeset | 789 | "eventually (\<lambda>x. f x < L) F \<Longrightarrow> filterlim f (at_left L) F" | 
| 
99eaa5cedbb7
Added some simple facts about limits
 Manuel Eberl <eberlm@in.tum.de> parents: 
67727diff
changeset | 790 | using assms by (auto simp: filterlim_at elim: eventually_mono) | 
| 
99eaa5cedbb7
Added some simple facts about limits
 Manuel Eberl <eberlm@in.tum.de> parents: 
67727diff
changeset | 791 | |
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 792 | lemma filterlim_at_withinI: | 
| 63713 | 793 | assumes "filterlim f (nhds c) F" | 
| 794 |   assumes "eventually (\<lambda>x. f x \<in> A - {c}) F"
 | |
| 795 | shows "filterlim f (at c within A) F" | |
| 64008 
17a20ca86d62
HOL-Probability: more about probability, prepare for Markov processes in the AFP
 hoelzl parents: 
63952diff
changeset | 796 | using assms by (simp add: filterlim_at) | 
| 63713 | 797 | |
| 798 | lemma filterlim_atI: | |
| 799 | assumes "filterlim f (nhds c) F" | |
| 800 | assumes "eventually (\<lambda>x. f x \<noteq> c) F" | |
| 801 | shows "filterlim f (at c) F" | |
| 802 | using assms by (intro filterlim_at_withinI) simp_all | |
| 803 | ||
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 804 | lemma topological_tendstoI: | 
| 61973 | 805 | "(\<And>S. open S \<Longrightarrow> l \<in> S \<Longrightarrow> eventually (\<lambda>x. f x \<in> S) F) \<Longrightarrow> (f \<longlongrightarrow> l) F" | 
| 63494 | 806 | by (auto simp: tendsto_def) | 
| 51471 | 807 | |
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 808 | lemma topological_tendstoD: | 
| 61973 | 809 | "(f \<longlongrightarrow> l) F \<Longrightarrow> open S \<Longrightarrow> l \<in> S \<Longrightarrow> eventually (\<lambda>x. f x \<in> S) F" | 
| 63494 | 810 | by (auto simp: tendsto_def) | 
| 51471 | 811 | |
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 812 | lemma tendsto_bot [simp]: "(f \<longlongrightarrow> a) bot" | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 813 | by (simp add: tendsto_def) | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 814 | |
| 70365 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 815 | lemma tendsto_eventually: "eventually (\<lambda>x. f x = l) net \<Longrightarrow> ((\<lambda>x. f x) \<longlongrightarrow> l) net" | 
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 816 | by (rule topological_tendstoI) (auto elim: eventually_mono) | 
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 817 | |
| 74475 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 eberlm <eberlm@in.tum.de> parents: 
73832diff
changeset | 818 | (* Contributed by Dominique Unruh *) | 
| 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 eberlm <eberlm@in.tum.de> parents: 
73832diff
changeset | 819 | lemma tendsto_principal_singleton[simp]: | 
| 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 eberlm <eberlm@in.tum.de> parents: 
73832diff
changeset | 820 |   shows "(f \<longlongrightarrow> f x) (principal {x})"
 | 
| 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 eberlm <eberlm@in.tum.de> parents: 
73832diff
changeset | 821 | unfolding tendsto_def eventually_principal by simp | 
| 
409ca22dee4c
new notion of infinite sums in HOL-Analysis, ordering on complex numbers
 eberlm <eberlm@in.tum.de> parents: 
73832diff
changeset | 822 | |
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 823 | end | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 824 | |
| 67685 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 825 | lemma (in topological_space) filterlim_within_subset: | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 826 | "filterlim f l (at x within S) \<Longrightarrow> T \<subseteq> S \<Longrightarrow> filterlim f l (at x within T)" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 827 | by (blast intro: filterlim_mono at_le) | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 828 | |
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 829 | lemmas tendsto_within_subset = filterlim_within_subset | 
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 830 | |
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 831 | lemma (in order_topology) order_tendsto_iff: | 
| 61973 | 832 | "(f \<longlongrightarrow> x) F \<longleftrightarrow> (\<forall>l<x. eventually (\<lambda>x. l < f x) F) \<and> (\<forall>u>x. eventually (\<lambda>x. f x < u) F)" | 
| 63494 | 833 | by (auto simp: nhds_order filterlim_inf filterlim_INF filterlim_principal) | 
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 834 | |
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 835 | lemma (in order_topology) order_tendstoI: | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 836 | "(\<And>a. a < y \<Longrightarrow> eventually (\<lambda>x. a < f x) F) \<Longrightarrow> (\<And>a. y < a \<Longrightarrow> eventually (\<lambda>x. f x < a) F) \<Longrightarrow> | 
| 61973 | 837 | (f \<longlongrightarrow> y) F" | 
| 63494 | 838 | by (auto simp: order_tendsto_iff) | 
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 839 | |
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 840 | lemma (in order_topology) order_tendstoD: | 
| 61973 | 841 | assumes "(f \<longlongrightarrow> y) F" | 
| 51471 | 842 | shows "a < y \<Longrightarrow> eventually (\<lambda>x. a < f x) F" | 
| 843 | and "y < a \<Longrightarrow> eventually (\<lambda>x. f x < a) F" | |
| 63494 | 844 | using assms by (auto simp: order_tendsto_iff) | 
| 51471 | 845 | |
| 67453 | 846 | lemma (in linorder_topology) tendsto_max[tendsto_intros]: | 
| 61973 | 847 | assumes X: "(X \<longlongrightarrow> x) net" | 
| 63494 | 848 | and Y: "(Y \<longlongrightarrow> y) net" | 
| 61973 | 849 | shows "((\<lambda>x. max (X x) (Y x)) \<longlongrightarrow> max x y) net" | 
| 56949 | 850 | proof (rule order_tendstoI) | 
| 63494 | 851 | fix a | 
| 852 | assume "a < max x y" | |
| 56949 | 853 | then show "eventually (\<lambda>x. a < max (X x) (Y x)) net" | 
| 854 | using order_tendstoD(1)[OF X, of a] order_tendstoD(1)[OF Y, of a] | |
| 61810 | 855 | by (auto simp: less_max_iff_disj elim: eventually_mono) | 
| 56949 | 856 | next | 
| 63494 | 857 | fix a | 
| 858 | assume "max x y < a" | |
| 56949 | 859 | then show "eventually (\<lambda>x. max (X x) (Y x) < a) net" | 
| 860 | using order_tendstoD(2)[OF X, of a] order_tendstoD(2)[OF Y, of a] | |
| 861 | by (auto simp: eventually_conj_iff) | |
| 862 | qed | |
| 863 | ||
| 67453 | 864 | lemma (in linorder_topology) tendsto_min[tendsto_intros]: | 
| 61973 | 865 | assumes X: "(X \<longlongrightarrow> x) net" | 
| 63494 | 866 | and Y: "(Y \<longlongrightarrow> y) net" | 
| 61973 | 867 | shows "((\<lambda>x. min (X x) (Y x)) \<longlongrightarrow> min x y) net" | 
| 56949 | 868 | proof (rule order_tendstoI) | 
| 63494 | 869 | fix a | 
| 870 | assume "a < min x y" | |
| 56949 | 871 | then show "eventually (\<lambda>x. a < min (X x) (Y x)) net" | 
| 872 | using order_tendstoD(1)[OF X, of a] order_tendstoD(1)[OF Y, of a] | |
| 873 | by (auto simp: eventually_conj_iff) | |
| 874 | next | |
| 63494 | 875 | fix a | 
| 876 | assume "min x y < a" | |
| 56949 | 877 | then show "eventually (\<lambda>x. min (X x) (Y x) < a) net" | 
| 878 | using order_tendstoD(2)[OF X, of a] order_tendstoD(2)[OF Y, of a] | |
| 61810 | 879 | by (auto simp: min_less_iff_disj elim: eventually_mono) | 
| 56949 | 880 | qed | 
| 881 | ||
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 882 | lemma (in order_topology) | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 883 | assumes "a < b" | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 884 |   shows at_within_Icc_at_right: "at a within {a..b} = at_right a"
 | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 885 |     and at_within_Icc_at_left:  "at b within {a..b} = at_left b"
 | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 886 |   using order_tendstoD(2)[OF tendsto_ident_at assms, of "{a<..}"]
 | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 887 |   using order_tendstoD(1)[OF tendsto_ident_at assms, of "{..<b}"]
 | 
| 73411 | 888 | by (auto intro!: order_class.order_antisym filter_leI | 
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 889 | simp: eventually_at_filter less_le | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 890 | elim: eventually_elim2) | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 891 | |
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 892 | lemma (in order_topology) at_within_Icc_at: "a < x \<Longrightarrow> x < b \<Longrightarrow> at x within {a..b} = at x"
 | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 893 |   by (rule at_within_open_subset[where S="{a<..<b}"]) auto
 | 
| 51471 | 894 | |
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 895 | lemma (in t2_space) tendsto_unique: | 
| 63494 | 896 | assumes "F \<noteq> bot" | 
| 897 | and "(f \<longlongrightarrow> a) F" | |
| 898 | and "(f \<longlongrightarrow> b) F" | |
| 51471 | 899 | shows "a = b" | 
| 900 | proof (rule ccontr) | |
| 901 | assume "a \<noteq> b" | |
| 902 |   obtain U V where "open U" "open V" "a \<in> U" "b \<in> V" "U \<inter> V = {}"
 | |
| 60758 | 903 | using hausdorff [OF \<open>a \<noteq> b\<close>] by fast | 
| 51471 | 904 | have "eventually (\<lambda>x. f x \<in> U) F" | 
| 61973 | 905 | using \<open>(f \<longlongrightarrow> a) F\<close> \<open>open U\<close> \<open>a \<in> U\<close> by (rule topological_tendstoD) | 
| 51471 | 906 | moreover | 
| 907 | have "eventually (\<lambda>x. f x \<in> V) F" | |
| 61973 | 908 | using \<open>(f \<longlongrightarrow> b) F\<close> \<open>open V\<close> \<open>b \<in> V\<close> by (rule topological_tendstoD) | 
| 51471 | 909 | ultimately | 
| 910 | have "eventually (\<lambda>x. False) F" | |
| 911 | proof eventually_elim | |
| 912 | case (elim x) | |
| 63494 | 913 | then have "f x \<in> U \<inter> V" by simp | 
| 60758 | 914 |     with \<open>U \<inter> V = {}\<close> show ?case by simp
 | 
| 51471 | 915 | qed | 
| 60758 | 916 | with \<open>\<not> trivial_limit F\<close> show "False" | 
| 51471 | 917 | by (simp add: trivial_limit_def) | 
| 918 | qed | |
| 919 | ||
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 920 | lemma (in t2_space) tendsto_const_iff: | 
| 63494 | 921 | fixes a b :: 'a | 
| 922 | assumes "\<not> trivial_limit F" | |
| 923 | shows "((\<lambda>x. a) \<longlongrightarrow> b) F \<longleftrightarrow> a = b" | |
| 58729 
e8ecc79aee43
add tendsto_const and tendsto_ident_at as simp and intro rules
 hoelzl parents: 
57953diff
changeset | 924 | by (auto intro!: tendsto_unique [OF assms tendsto_const]) | 
| 51471 | 925 | |
| 71827 | 926 | lemma (in t2_space) tendsto_unique': | 
| 927 | assumes "F \<noteq> bot" | |
| 928 | shows "\<exists>\<^sub>\<le>\<^sub>1l. (f \<longlongrightarrow> l) F" | |
| 929 | using Uniq_def assms local.tendsto_unique by fastforce | |
| 930 | ||
| 68860 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 931 | lemma Lim_in_closed_set: | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 932 | assumes "closed S" "eventually (\<lambda>x. f(x) \<in> S) F" "F \<noteq> bot" "(f \<longlongrightarrow> l) F" | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 933 | shows "l \<in> S" | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 934 | proof (rule ccontr) | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 935 | assume "l \<notin> S" | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 936 | with \<open>closed S\<close> have "open (- S)" "l \<in> - S" | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 937 | by (simp_all add: open_Compl) | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 938 | with assms(4) have "eventually (\<lambda>x. f x \<in> - S) F" | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 939 | by (rule topological_tendstoD) | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 940 | with assms(2) have "eventually (\<lambda>x. False) F" | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 941 | by (rule eventually_elim2) simp | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 942 | with assms(3) show "False" | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 943 | by (simp add: eventually_False) | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 944 | qed | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 945 | |
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 946 | lemma (in t3_space) nhds_closed: | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 947 | assumes "x \<in> A" and "open A" | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 948 | shows "\<exists>A'. x \<in> A' \<and> closed A' \<and> A' \<subseteq> A \<and> eventually (\<lambda>y. y \<in> A') (nhds x)" | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 949 | proof - | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 950 |   from assms have "\<exists>U V. open U \<and> open V \<and> x \<in> U \<and> - A \<subseteq> V \<and> U \<inter> V = {}"
 | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 951 | by (intro t3_space) auto | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 952 |   then obtain U V where UV: "open U" "open V" "x \<in> U" "-A \<subseteq> V" "U \<inter> V = {}"
 | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 953 | by auto | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 954 | have "eventually (\<lambda>y. y \<in> U) (nhds x)" | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 955 | using \<open>open U\<close> and \<open>x \<in> U\<close> by (intro eventually_nhds_in_open) | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 956 | hence "eventually (\<lambda>y. y \<in> -V) (nhds x)" | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 957 | by eventually_elim (use UV in auto) | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 958 | with UV show ?thesis by (intro exI[of _ "-V"]) auto | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 959 | qed | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 960 | |
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 961 | lemma (in order_topology) increasing_tendsto: | 
| 51471 | 962 | assumes bdd: "eventually (\<lambda>n. f n \<le> l) F" | 
| 63494 | 963 | and en: "\<And>x. x < l \<Longrightarrow> eventually (\<lambda>n. x < f n) F" | 
| 61973 | 964 | shows "(f \<longlongrightarrow> l) F" | 
| 61810 | 965 | using assms by (intro order_tendstoI) (auto elim!: eventually_mono) | 
| 51471 | 966 | |
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 967 | lemma (in order_topology) decreasing_tendsto: | 
| 51471 | 968 | assumes bdd: "eventually (\<lambda>n. l \<le> f n) F" | 
| 63494 | 969 | and en: "\<And>x. l < x \<Longrightarrow> eventually (\<lambda>n. f n < x) F" | 
| 61973 | 970 | shows "(f \<longlongrightarrow> l) F" | 
| 61810 | 971 | using assms by (intro order_tendstoI) (auto elim!: eventually_mono) | 
| 51471 | 972 | |
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 973 | lemma (in order_topology) tendsto_sandwich: | 
| 51471 | 974 | assumes ev: "eventually (\<lambda>n. f n \<le> g n) net" "eventually (\<lambda>n. g n \<le> h n) net" | 
| 61973 | 975 | assumes lim: "(f \<longlongrightarrow> c) net" "(h \<longlongrightarrow> c) net" | 
| 976 | shows "(g \<longlongrightarrow> c) net" | |
| 51471 | 977 | proof (rule order_tendstoI) | 
| 63494 | 978 | fix a | 
| 979 | show "a < c \<Longrightarrow> eventually (\<lambda>x. a < g x) net" | |
| 51471 | 980 | using order_tendstoD[OF lim(1), of a] ev by (auto elim: eventually_elim2) | 
| 981 | next | |
| 63494 | 982 | fix a | 
| 983 | show "c < a \<Longrightarrow> eventually (\<lambda>x. g x < a) net" | |
| 51471 | 984 | using order_tendstoD[OF lim(2), of a] ev by (auto elim: eventually_elim2) | 
| 985 | qed | |
| 986 | ||
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 987 | lemma (in t1_space) limit_frequently_eq: | 
| 61531 
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
 eberlm parents: 
61520diff
changeset | 988 | assumes "F \<noteq> bot" | 
| 63494 | 989 | and "frequently (\<lambda>x. f x = c) F" | 
| 990 | and "(f \<longlongrightarrow> d) F" | |
| 991 | shows "d = c" | |
| 61531 
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
 eberlm parents: 
61520diff
changeset | 992 | proof (rule ccontr) | 
| 
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
 eberlm parents: 
61520diff
changeset | 993 | assume "d \<noteq> c" | 
| 63494 | 994 | from t1_space[OF this] obtain U where "open U" "d \<in> U" "c \<notin> U" | 
| 995 | by blast | |
| 996 | with assms have "eventually (\<lambda>x. f x \<in> U) F" | |
| 997 | unfolding tendsto_def by blast | |
| 998 | then have "eventually (\<lambda>x. f x \<noteq> c) F" | |
| 999 | by eventually_elim (insert \<open>c \<notin> U\<close>, blast) | |
| 1000 | with assms(2) show False | |
| 1001 | unfolding frequently_def by contradiction | |
| 61531 
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
 eberlm parents: 
61520diff
changeset | 1002 | qed | 
| 
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
 eberlm parents: 
61520diff
changeset | 1003 | |
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 1004 | lemma (in t1_space) tendsto_imp_eventually_ne: | 
| 64394 | 1005 | assumes "(f \<longlongrightarrow> c) F" "c \<noteq> c'" | 
| 63494 | 1006 | shows "eventually (\<lambda>z. f z \<noteq> c') F" | 
| 64394 | 1007 | proof (cases "F=bot") | 
| 1008 | case True | |
| 1009 | thus ?thesis by auto | |
| 1010 | next | |
| 1011 | case False | |
| 1012 | show ?thesis | |
| 1013 | proof (rule ccontr) | |
| 1014 | assume "\<not> eventually (\<lambda>z. f z \<noteq> c') F" | |
| 1015 | then have "frequently (\<lambda>z. f z = c') F" | |
| 1016 | by (simp add: frequently_def) | |
| 1017 | from limit_frequently_eq[OF False this \<open>(f \<longlongrightarrow> c) F\<close>] and \<open>c \<noteq> c'\<close> show False | |
| 1018 | by contradiction | |
| 1019 | qed | |
| 61531 
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
 eberlm parents: 
61520diff
changeset | 1020 | qed | 
| 
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
 eberlm parents: 
61520diff
changeset | 1021 | |
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 1022 | lemma (in linorder_topology) tendsto_le: | 
| 51471 | 1023 | assumes F: "\<not> trivial_limit F" | 
| 63494 | 1024 | and x: "(f \<longlongrightarrow> x) F" | 
| 1025 | and y: "(g \<longlongrightarrow> y) F" | |
| 1026 | and ev: "eventually (\<lambda>x. g x \<le> f x) F" | |
| 51471 | 1027 | shows "y \<le> x" | 
| 1028 | proof (rule ccontr) | |
| 1029 | assume "\<not> y \<le> x" | |
| 1030 |   with less_separate[of x y] obtain a b where xy: "x < a" "b < y" "{..<a} \<inter> {b<..} = {}"
 | |
| 1031 | by (auto simp: not_le) | |
| 1032 | then have "eventually (\<lambda>x. f x < a) F" "eventually (\<lambda>x. b < g x) F" | |
| 1033 | using x y by (auto intro: order_tendstoD) | |
| 1034 | with ev have "eventually (\<lambda>x. False) F" | |
| 1035 | by eventually_elim (insert xy, fastforce) | |
| 1036 | with F show False | |
| 1037 | by (simp add: eventually_False) | |
| 1038 | qed | |
| 1039 | ||
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 1040 | lemma (in linorder_topology) tendsto_lowerbound: | 
| 63952 
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
 paulson <lp15@cam.ac.uk> parents: 
63713diff
changeset | 1041 | assumes x: "(f \<longlongrightarrow> x) F" | 
| 
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
 paulson <lp15@cam.ac.uk> parents: 
63713diff
changeset | 1042 | and ev: "eventually (\<lambda>i. a \<le> f i) F" | 
| 
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
 paulson <lp15@cam.ac.uk> parents: 
63713diff
changeset | 1043 | and F: "\<not> trivial_limit F" | 
| 51471 | 1044 | shows "a \<le> x" | 
| 63494 | 1045 | using F x tendsto_const ev by (rule tendsto_le) | 
| 51471 | 1046 | |
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 1047 | lemma (in linorder_topology) tendsto_upperbound: | 
| 63952 
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
 paulson <lp15@cam.ac.uk> parents: 
63713diff
changeset | 1048 | assumes x: "(f \<longlongrightarrow> x) F" | 
| 
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
 paulson <lp15@cam.ac.uk> parents: 
63713diff
changeset | 1049 | and ev: "eventually (\<lambda>i. a \<ge> f i) F" | 
| 
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
 paulson <lp15@cam.ac.uk> parents: 
63713diff
changeset | 1050 | and F: "\<not> trivial_limit F" | 
| 56289 | 1051 | shows "a \<ge> x" | 
| 63494 | 1052 | by (rule tendsto_le [OF F tendsto_const x ev]) | 
| 56289 | 1053 | |
| 67706 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67577diff
changeset | 1054 | lemma filterlim_at_within_not_equal: | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67577diff
changeset | 1055 | fixes f::"'a \<Rightarrow> 'b::t2_space" | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67577diff
changeset | 1056 | assumes "filterlim f (at a within s) F" | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67577diff
changeset | 1057 | shows "eventually (\<lambda>w. f w\<in>s \<and> f w \<noteq>b) F" | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67577diff
changeset | 1058 | proof (cases "a=b") | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67577diff
changeset | 1059 | case True | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67577diff
changeset | 1060 | then show ?thesis using assms by (simp add: filterlim_at) | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67577diff
changeset | 1061 | next | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67577diff
changeset | 1062 | case False | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67577diff
changeset | 1063 |   from hausdorff[OF this] obtain U V where UV:"open U" "open V" "a \<in> U" "b \<in> V" "U \<inter> V = {}"
 | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67577diff
changeset | 1064 | by auto | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67577diff
changeset | 1065 | have "(f \<longlongrightarrow> a) F" using assms filterlim_at by auto | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67577diff
changeset | 1066 | then have "\<forall>\<^sub>F x in F. f x \<in> U" using UV unfolding tendsto_def by auto | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67577diff
changeset | 1067 | moreover have "\<forall>\<^sub>F x in F. f x \<in> s \<and> f x\<noteq>a" using assms filterlim_at by auto | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67577diff
changeset | 1068 | ultimately show ?thesis | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67577diff
changeset | 1069 | apply eventually_elim | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67577diff
changeset | 1070 | using UV by auto | 
| 
4ddc49205f5d
Unified the order of zeros and poles; improved reasoning around non-essential singularites
 Wenda Li <wl302@cam.ac.uk> parents: 
67577diff
changeset | 1071 | qed | 
| 61531 
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
 eberlm parents: 
61520diff
changeset | 1072 | |
| 69593 | 1073 | subsubsection \<open>Rules about \<^const>\<open>Lim\<close>\<close> | 
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 1074 | |
| 63494 | 1075 | lemma tendsto_Lim: "\<not> trivial_limit net \<Longrightarrow> (f \<longlongrightarrow> l) net \<Longrightarrow> Lim net f = l" | 
| 1076 | unfolding Lim_def using tendsto_unique [of net f] by auto | |
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 1077 | |
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51518diff
changeset | 1078 | lemma Lim_ident_at: "\<not> trivial_limit (at x within s) \<Longrightarrow> Lim (at x within s) (\<lambda>x. x) = x" | 
| 78685 | 1079 | by (simp add: tendsto_Lim) | 
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 1080 | |
| 77223 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1081 | lemma Lim_cong: | 
| 78685 | 1082 | assumes "\<forall>\<^sub>F x in F. f x = g x" "F = G" | 
| 1083 | shows "Lim F f = Lim F g" | |
| 1084 | unfolding t2_space_class.Lim_def using tendsto_cong assms by fastforce | |
| 77223 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1085 | |
| 67685 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 1086 | lemma eventually_Lim_ident_at: | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 1087 | "(\<forall>\<^sub>F y in at x within X. P (Lim (at x within X) (\<lambda>x. x)) y) \<longleftrightarrow> | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 1088 | (\<forall>\<^sub>F y in at x within X. P x y)" for x::"'a::t2_space" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 1089 | by (cases "at x within X = bot") (auto simp: Lim_ident_at) | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 1090 | |
| 51471 | 1091 | lemma filterlim_at_bot_at_right: | 
| 57275 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 hoelzl parents: 
57025diff
changeset | 1092 | fixes f :: "'a::linorder_topology \<Rightarrow> 'b::linorder" | 
| 51471 | 1093 | assumes mono: "\<And>x y. Q x \<Longrightarrow> Q y \<Longrightarrow> x \<le> y \<Longrightarrow> f x \<le> f y" | 
| 63494 | 1094 | and bij: "\<And>x. P x \<Longrightarrow> f (g x) = x" "\<And>x. P x \<Longrightarrow> Q (g x)" | 
| 1095 | and Q: "eventually Q (at_right a)" | |
| 1096 | and bound: "\<And>b. Q b \<Longrightarrow> a < b" | |
| 1097 | and P: "eventually P at_bot" | |
| 51471 | 1098 | shows "filterlim f at_bot (at_right a)" | 
| 1099 | proof - | |
| 1100 | from P obtain x where x: "\<And>y. y \<le> x \<Longrightarrow> P y" | |
| 1101 | unfolding eventually_at_bot_linorder by auto | |
| 1102 | show ?thesis | |
| 1103 | proof (intro filterlim_at_bot_le[THEN iffD2] allI impI) | |
| 63494 | 1104 | fix z | 
| 1105 | assume "z \<le> x" | |
| 51471 | 1106 | with x have "P z" by auto | 
| 1107 | have "eventually (\<lambda>x. x \<le> g z) (at_right a)" | |
| 60758 | 1108 | using bound[OF bij(2)[OF \<open>P z\<close>]] | 
| 63494 | 1109 | unfolding eventually_at_right[OF bound[OF bij(2)[OF \<open>P z\<close>]]] | 
| 1110 | by (auto intro!: exI[of _ "g z"]) | |
| 51471 | 1111 | with Q show "eventually (\<lambda>x. f x \<le> z) (at_right a)" | 
| 60758 | 1112 | by eventually_elim (metis bij \<open>P z\<close> mono) | 
| 51471 | 1113 | qed | 
| 1114 | qed | |
| 1115 | ||
| 1116 | lemma filterlim_at_top_at_left: | |
| 57275 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 hoelzl parents: 
57025diff
changeset | 1117 | fixes f :: "'a::linorder_topology \<Rightarrow> 'b::linorder" | 
| 51471 | 1118 | assumes mono: "\<And>x y. Q x \<Longrightarrow> Q y \<Longrightarrow> x \<le> y \<Longrightarrow> f x \<le> f y" | 
| 63494 | 1119 | and bij: "\<And>x. P x \<Longrightarrow> f (g x) = x" "\<And>x. P x \<Longrightarrow> Q (g x)" | 
| 1120 | and Q: "eventually Q (at_left a)" | |
| 1121 | and bound: "\<And>b. Q b \<Longrightarrow> b < a" | |
| 1122 | and P: "eventually P at_top" | |
| 51471 | 1123 | shows "filterlim f at_top (at_left a)" | 
| 1124 | proof - | |
| 1125 | from P obtain x where x: "\<And>y. x \<le> y \<Longrightarrow> P y" | |
| 1126 | unfolding eventually_at_top_linorder by auto | |
| 1127 | show ?thesis | |
| 1128 | proof (intro filterlim_at_top_ge[THEN iffD2] allI impI) | |
| 63494 | 1129 | fix z | 
| 1130 | assume "x \<le> z" | |
| 51471 | 1131 | with x have "P z" by auto | 
| 1132 | have "eventually (\<lambda>x. g z \<le> x) (at_left a)" | |
| 60758 | 1133 | using bound[OF bij(2)[OF \<open>P z\<close>]] | 
| 63494 | 1134 | unfolding eventually_at_left[OF bound[OF bij(2)[OF \<open>P z\<close>]]] | 
| 1135 | by (auto intro!: exI[of _ "g z"]) | |
| 51471 | 1136 | with Q show "eventually (\<lambda>x. z \<le> f x) (at_left a)" | 
| 60758 | 1137 | by eventually_elim (metis bij \<open>P z\<close> mono) | 
| 51471 | 1138 | qed | 
| 1139 | qed | |
| 1140 | ||
| 1141 | lemma filterlim_split_at: | |
| 63494 | 1142 | "filterlim f F (at_left x) \<Longrightarrow> filterlim f F (at_right x) \<Longrightarrow> | 
| 1143 | filterlim f F (at x)" | |
| 1144 | for x :: "'a::linorder_topology" | |
| 51471 | 1145 | by (subst at_eq_sup_left_right) (rule filterlim_sup) | 
| 1146 | ||
| 1147 | lemma filterlim_at_split: | |
| 63494 | 1148 | "filterlim f F (at x) \<longleftrightarrow> filterlim f F (at_left x) \<and> filterlim f F (at_right x)" | 
| 1149 | for x :: "'a::linorder_topology" | |
| 51471 | 1150 | by (subst at_eq_sup_left_right) (simp add: filterlim_def filtermap_sup) | 
| 1151 | ||
| 57025 | 1152 | lemma eventually_nhds_top: | 
| 63494 | 1153 |   fixes P :: "'a :: {order_top,linorder_topology} \<Rightarrow> bool"
 | 
| 1154 | and b :: 'a | |
| 1155 | assumes "b < top" | |
| 57025 | 1156 | shows "eventually P (nhds top) \<longleftrightarrow> (\<exists>b<top. (\<forall>z. b < z \<longrightarrow> P z))" | 
| 1157 | unfolding eventually_nhds | |
| 1158 | proof safe | |
| 63494 | 1159 | fix S :: "'a set" | 
| 1160 | assume "open S" "top \<in> S" | |
| 60758 | 1161 | note open_left[OF this \<open>b < top\<close>] | 
| 57025 | 1162 | moreover assume "\<forall>s\<in>S. P s" | 
| 1163 | ultimately show "\<exists>b<top. \<forall>z>b. P z" | |
| 1164 | by (auto simp: subset_eq Ball_def) | |
| 1165 | next | |
| 63494 | 1166 | fix b | 
| 1167 | assume "b < top" "\<forall>z>b. P z" | |
| 57025 | 1168 | then show "\<exists>S. open S \<and> top \<in> S \<and> (\<forall>xa\<in>S. P xa)" | 
| 1169 |     by (intro exI[of _ "{b <..}"]) auto
 | |
| 1170 | qed | |
| 51471 | 1171 | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1172 | lemma tendsto_at_within_iff_tendsto_nhds: | 
| 61973 | 1173 | "(g \<longlongrightarrow> g l) (at l within S) \<longleftrightarrow> (g \<longlongrightarrow> g l) (inf (nhds l) (principal S))" | 
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1174 | unfolding tendsto_def eventually_at_filter eventually_inf_principal | 
| 61810 | 1175 | by (intro ext all_cong imp_cong) (auto elim!: eventually_mono) | 
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1176 | |
| 63494 | 1177 | |
| 60758 | 1178 | subsection \<open>Limits on sequences\<close> | 
| 51471 | 1179 | |
| 1180 | abbreviation (in topological_space) | |
| 63494 | 1181 |   LIMSEQ :: "[nat \<Rightarrow> 'a, 'a] \<Rightarrow> bool"  ("((_)/ \<longlonglongrightarrow> (_))" [60, 60] 60)
 | 
| 1182 | where "X \<longlonglongrightarrow> L \<equiv> (X \<longlongrightarrow> L) sequentially" | |
| 1183 | ||
| 1184 | abbreviation (in t2_space) lim :: "(nat \<Rightarrow> 'a) \<Rightarrow> 'a" | |
| 1185 | where "lim X \<equiv> Lim sequentially X" | |
| 1186 | ||
| 1187 | definition (in topological_space) convergent :: "(nat \<Rightarrow> 'a) \<Rightarrow> bool" | |
| 1188 | where "convergent X = (\<exists>L. X \<longlonglongrightarrow> L)" | |
| 51471 | 1189 | |
| 61969 | 1190 | lemma lim_def: "lim X = (THE L. X \<longlonglongrightarrow> L)" | 
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 1191 | unfolding Lim_def .. | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 1192 | |
| 70367 | 1193 | lemma lim_explicit: | 
| 70365 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 1194 | "f \<longlonglongrightarrow> f0 \<longleftrightarrow> (\<forall>S. open S \<longrightarrow> f0 \<in> S \<longrightarrow> (\<exists>N. \<forall>n\<ge>N. f n \<in> S))" | 
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 1195 | unfolding tendsto_def eventually_sequentially by auto | 
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 1196 | |
| 78516 
56a408fa2440
substantial tidy-up, shortening many proofs
 paulson <lp15@cam.ac.uk> parents: 
78093diff
changeset | 1197 | lemma closed_sequentially: | 
| 
56a408fa2440
substantial tidy-up, shortening many proofs
 paulson <lp15@cam.ac.uk> parents: 
78093diff
changeset | 1198 | assumes "closed S" and "\<And>n. f n \<in> S" and "f \<longlonglongrightarrow> l" | 
| 
56a408fa2440
substantial tidy-up, shortening many proofs
 paulson <lp15@cam.ac.uk> parents: 
78093diff
changeset | 1199 | shows "l \<in> S" | 
| 
56a408fa2440
substantial tidy-up, shortening many proofs
 paulson <lp15@cam.ac.uk> parents: 
78093diff
changeset | 1200 | by (metis Lim_in_closed_set assms eventually_sequentially trivial_limit_sequentially) | 
| 
56a408fa2440
substantial tidy-up, shortening many proofs
 paulson <lp15@cam.ac.uk> parents: 
78093diff
changeset | 1201 | |
| 63494 | 1202 | |
| 68532 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1203 | subsection \<open>Monotone sequences and subsequences\<close> | 
| 51471 | 1204 | |
| 63494 | 1205 | text \<open> | 
| 1206 | Definition of monotonicity. | |
| 1207 | The use of disjunction here complicates proofs considerably. | |
| 1208 | One alternative is to add a Boolean argument to indicate the direction. | |
| 1209 | Another is to develop the notions of increasing and decreasing first. | |
| 1210 | \<close> | |
| 1211 | definition monoseq :: "(nat \<Rightarrow> 'a::order) \<Rightarrow> bool" | |
| 1212 | where "monoseq X \<longleftrightarrow> (\<forall>m. \<forall>n\<ge>m. X m \<le> X n) \<or> (\<forall>m. \<forall>n\<ge>m. X n \<le> X m)" | |
| 1213 | ||
| 1214 | abbreviation incseq :: "(nat \<Rightarrow> 'a::order) \<Rightarrow> bool" | |
| 1215 | where "incseq X \<equiv> mono X" | |
| 56020 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
55945diff
changeset | 1216 | |
| 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
55945diff
changeset | 1217 | lemma incseq_def: "incseq X \<longleftrightarrow> (\<forall>m. \<forall>n\<ge>m. X n \<ge> X m)" | 
| 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
55945diff
changeset | 1218 | unfolding mono_def .. | 
| 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
55945diff
changeset | 1219 | |
| 63494 | 1220 | abbreviation decseq :: "(nat \<Rightarrow> 'a::order) \<Rightarrow> bool" | 
| 1221 | where "decseq X \<equiv> antimono X" | |
| 56020 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
55945diff
changeset | 1222 | |
| 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
55945diff
changeset | 1223 | lemma decseq_def: "decseq X \<longleftrightarrow> (\<forall>m. \<forall>n\<ge>m. X n \<le> X m)" | 
| 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
55945diff
changeset | 1224 | unfolding antimono_def .. | 
| 51471 | 1225 | |
| 68532 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1226 | subsubsection \<open>Definition of subsequence.\<close> | 
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1227 | |
| 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1228 | (* For compatibility with the old "subseq" *) | 
| 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1229 | lemma strict_mono_leD: "strict_mono r \<Longrightarrow> m \<le> n \<Longrightarrow> r m \<le> r n" | 
| 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1230 | by (erule (1) monoD [OF strict_mono_mono]) | 
| 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1231 | |
| 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1232 | lemma strict_mono_id: "strict_mono id" | 
| 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1233 | by (simp add: strict_mono_def) | 
| 65036 
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
 paulson <lp15@cam.ac.uk> parents: 
64969diff
changeset | 1234 | |
| 63494 | 1235 | lemma incseq_SucI: "(\<And>n. X n \<le> X (Suc n)) \<Longrightarrow> incseq X" | 
| 1236 | using lift_Suc_mono_le[of X] by (auto simp: incseq_def) | |
| 1237 | ||
| 1238 | lemma incseqD: "incseq f \<Longrightarrow> i \<le> j \<Longrightarrow> f i \<le> f j" | |
| 51471 | 1239 | by (auto simp: incseq_def) | 
| 1240 | ||
| 1241 | lemma incseq_SucD: "incseq A \<Longrightarrow> A i \<le> A (Suc i)" | |
| 1242 | using incseqD[of A i "Suc i"] by auto | |
| 1243 | ||
| 1244 | lemma incseq_Suc_iff: "incseq f \<longleftrightarrow> (\<forall>n. f n \<le> f (Suc n))" | |
| 1245 | by (auto intro: incseq_SucI dest: incseq_SucD) | |
| 1246 | ||
| 1247 | lemma incseq_const[simp, intro]: "incseq (\<lambda>x. k)" | |
| 1248 | unfolding incseq_def by auto | |
| 1249 | ||
| 63494 | 1250 | lemma decseq_SucI: "(\<And>n. X (Suc n) \<le> X n) \<Longrightarrow> decseq X" | 
| 1251 | using order.lift_Suc_mono_le[OF dual_order, of X] by (auto simp: decseq_def) | |
| 1252 | ||
| 1253 | lemma decseqD: "decseq f \<Longrightarrow> i \<le> j \<Longrightarrow> f j \<le> f i" | |
| 51471 | 1254 | by (auto simp: decseq_def) | 
| 1255 | ||
| 1256 | lemma decseq_SucD: "decseq A \<Longrightarrow> A (Suc i) \<le> A i" | |
| 1257 | using decseqD[of A i "Suc i"] by auto | |
| 1258 | ||
| 1259 | lemma decseq_Suc_iff: "decseq f \<longleftrightarrow> (\<forall>n. f (Suc n) \<le> f n)" | |
| 1260 | by (auto intro: decseq_SucI dest: decseq_SucD) | |
| 1261 | ||
| 1262 | lemma decseq_const[simp, intro]: "decseq (\<lambda>x. k)" | |
| 1263 | unfolding decseq_def by auto | |
| 1264 | ||
| 1265 | lemma monoseq_iff: "monoseq X \<longleftrightarrow> incseq X \<or> decseq X" | |
| 1266 | unfolding monoseq_def incseq_def decseq_def .. | |
| 1267 | ||
| 63494 | 1268 | lemma monoseq_Suc: "monoseq X \<longleftrightarrow> (\<forall>n. X n \<le> X (Suc n)) \<or> (\<forall>n. X (Suc n) \<le> X n)" | 
| 51471 | 1269 | unfolding monoseq_iff incseq_Suc_iff decseq_Suc_iff .. | 
| 1270 | ||
| 63494 | 1271 | lemma monoI1: "\<forall>m. \<forall>n \<ge> m. X m \<le> X n \<Longrightarrow> monoseq X" | 
| 1272 | by (simp add: monoseq_def) | |
| 1273 | ||
| 1274 | lemma monoI2: "\<forall>m. \<forall>n \<ge> m. X n \<le> X m \<Longrightarrow> monoseq X" | |
| 1275 | by (simp add: monoseq_def) | |
| 1276 | ||
| 1277 | lemma mono_SucI1: "\<forall>n. X n \<le> X (Suc n) \<Longrightarrow> monoseq X" | |
| 1278 | by (simp add: monoseq_Suc) | |
| 1279 | ||
| 1280 | lemma mono_SucI2: "\<forall>n. X (Suc n) \<le> X n \<Longrightarrow> monoseq X" | |
| 1281 | by (simp add: monoseq_Suc) | |
| 51471 | 1282 | |
| 1283 | lemma monoseq_minus: | |
| 1284 | fixes a :: "nat \<Rightarrow> 'a::ordered_ab_group_add" | |
| 1285 | assumes "monoseq a" | |
| 1286 | shows "monoseq (\<lambda> n. - a n)" | |
| 63494 | 1287 | proof (cases "\<forall>m. \<forall>n \<ge> m. a m \<le> a n") | 
| 51471 | 1288 | case True | 
| 63494 | 1289 | then have "\<forall>m. \<forall>n \<ge> m. - a n \<le> - a m" by auto | 
| 1290 | then show ?thesis by (rule monoI2) | |
| 51471 | 1291 | next | 
| 1292 | case False | |
| 63494 | 1293 | then have "\<forall>m. \<forall>n \<ge> m. - a m \<le> - a n" | 
| 1294 | using \<open>monoseq a\<close>[unfolded monoseq_def] by auto | |
| 1295 | then show ?thesis by (rule monoI1) | |
| 51471 | 1296 | qed | 
| 1297 | ||
| 63494 | 1298 | |
| 68532 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1299 | subsubsection \<open>Subsequence (alternative definition, (e.g. Hoskins)\<close> | 
| 63494 | 1300 | |
| 1301 | text \<open>For any sequence, there is a monotonic subsequence.\<close> | |
| 51471 | 1302 | lemma seq_monosub: | 
| 63494 | 1303 | fixes s :: "nat \<Rightarrow> 'a::linorder" | 
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1304 | shows "\<exists>f. strict_mono f \<and> monoseq (\<lambda>n. (s (f n)))" | 
| 63494 | 1305 | proof (cases "\<forall>n. \<exists>p>n. \<forall>m\<ge>p. s m \<le> s p") | 
| 1306 | case True | |
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1307 | then have "\<exists>f. \<forall>n. (\<forall>m\<ge>f n. s m \<le> s (f n)) \<and> f n < f (Suc n)" | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1308 | by (intro dependent_nat_choice) (auto simp: conj_commute) | 
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1309 | then obtain f :: "nat \<Rightarrow> nat" | 
| 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1310 | where f: "strict_mono f" and mono: "\<And>n m. f n \<le> m \<Longrightarrow> s m \<le> s (f n)" | 
| 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1311 | by (auto simp: strict_mono_Suc_iff) | 
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1312 | then have "incseq f" | 
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1313 | unfolding strict_mono_Suc_iff incseq_Suc_iff by (auto intro: less_imp_le) | 
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1314 | then have "monoseq (\<lambda>n. s (f n))" | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1315 | by (auto simp add: incseq_def intro!: mono monoI2) | 
| 63494 | 1316 | with f show ?thesis | 
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1317 | by auto | 
| 51471 | 1318 | next | 
| 63494 | 1319 | case False | 
| 1320 | then obtain N where N: "p > N \<Longrightarrow> \<exists>m>p. s p < s m" for p | |
| 1321 | by (force simp: not_le le_less) | |
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1322 | have "\<exists>f. \<forall>n. N < f n \<and> f n < f (Suc n) \<and> s (f n) \<le> s (f (Suc n))" | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1323 | proof (intro dependent_nat_choice) | 
| 63494 | 1324 | fix x | 
| 1325 | assume "N < x" with N[of x] | |
| 1326 | show "\<exists>y>N. x < y \<and> s x \<le> s y" | |
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1327 | by (auto intro: less_trans) | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1328 | qed auto | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1329 | then show ?thesis | 
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1330 | by (auto simp: monoseq_iff incseq_Suc_iff strict_mono_Suc_iff) | 
| 51471 | 1331 | qed | 
| 1332 | ||
| 63494 | 1333 | lemma seq_suble: | 
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1334 | assumes sf: "strict_mono (f :: nat \<Rightarrow> nat)" | 
| 63494 | 1335 | shows "n \<le> f n" | 
| 1336 | proof (induct n) | |
| 1337 | case 0 | |
| 1338 | show ?case by simp | |
| 51471 | 1339 | next | 
| 1340 | case (Suc n) | |
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1341 | with sf [unfolded strict_mono_Suc_iff, rule_format, of n] have "n < f (Suc n)" | 
| 63494 | 1342 | by arith | 
| 1343 | then show ?case by arith | |
| 51471 | 1344 | qed | 
| 1345 | ||
| 1346 | lemma eventually_subseq: | |
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1347 | "strict_mono r \<Longrightarrow> eventually P sequentially \<Longrightarrow> eventually (\<lambda>n. P (r n)) sequentially" | 
| 51471 | 1348 | unfolding eventually_sequentially by (metis seq_suble le_trans) | 
| 1349 | ||
| 51473 | 1350 | lemma not_eventually_sequentiallyD: | 
| 63494 | 1351 | assumes "\<not> eventually P sequentially" | 
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1352 | shows "\<exists>r::nat\<Rightarrow>nat. strict_mono r \<and> (\<forall>n. \<not> P (r n))" | 
| 51473 | 1353 | proof - | 
| 63494 | 1354 | from assms have "\<forall>n. \<exists>m\<ge>n. \<not> P m" | 
| 51473 | 1355 | unfolding eventually_sequentially by (simp add: not_less) | 
| 1356 | then obtain r where "\<And>n. r n \<ge> n" "\<And>n. \<not> P (r n)" | |
| 1357 | by (auto simp: choice_iff) | |
| 1358 | then show ?thesis | |
| 1359 | by (auto intro!: exI[of _ "\<lambda>n. r (((Suc \<circ> r) ^^ Suc n) 0)"] | |
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1360 | simp: less_eq_Suc_le strict_mono_Suc_iff) | 
| 51473 | 1361 | qed | 
| 1362 | ||
| 66827 
c94531b5007d
Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
 paulson <lp15@cam.ac.uk> parents: 
66447diff
changeset | 1363 | lemma sequentially_offset: | 
| 
c94531b5007d
Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
 paulson <lp15@cam.ac.uk> parents: 
66447diff
changeset | 1364 | assumes "eventually (\<lambda>i. P i) sequentially" | 
| 
c94531b5007d
Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
 paulson <lp15@cam.ac.uk> parents: 
66447diff
changeset | 1365 | shows "eventually (\<lambda>i. P (i + k)) sequentially" | 
| 
c94531b5007d
Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
 paulson <lp15@cam.ac.uk> parents: 
66447diff
changeset | 1366 | using assms by (rule eventually_sequentially_seg [THEN iffD2]) | 
| 
c94531b5007d
Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
 paulson <lp15@cam.ac.uk> parents: 
66447diff
changeset | 1367 | |
| 
c94531b5007d
Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
 paulson <lp15@cam.ac.uk> parents: 
66447diff
changeset | 1368 | lemma seq_offset_neg: | 
| 
c94531b5007d
Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
 paulson <lp15@cam.ac.uk> parents: 
66447diff
changeset | 1369 | "(f \<longlongrightarrow> l) sequentially \<Longrightarrow> ((\<lambda>i. f(i - k)) \<longlongrightarrow> l) sequentially" | 
| 
c94531b5007d
Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
 paulson <lp15@cam.ac.uk> parents: 
66447diff
changeset | 1370 | apply (erule filterlim_compose) | 
| 
c94531b5007d
Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
 paulson <lp15@cam.ac.uk> parents: 
66447diff
changeset | 1371 | apply (simp add: filterlim_def le_sequentially eventually_filtermap eventually_sequentially, arith) | 
| 
c94531b5007d
Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
 paulson <lp15@cam.ac.uk> parents: 
66447diff
changeset | 1372 | done | 
| 
c94531b5007d
Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
 paulson <lp15@cam.ac.uk> parents: 
66447diff
changeset | 1373 | |
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1374 | lemma filterlim_subseq: "strict_mono f \<Longrightarrow> filterlim f sequentially sequentially" | 
| 51471 | 1375 | unfolding filterlim_iff by (metis eventually_subseq) | 
| 1376 | ||
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1377 | lemma strict_mono_o: "strict_mono r \<Longrightarrow> strict_mono s \<Longrightarrow> strict_mono (r \<circ> s)" | 
| 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1378 | unfolding strict_mono_def by simp | 
| 61531 
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
 eberlm parents: 
61520diff
changeset | 1379 | |
| 67727 
ce3e87a51488
moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
 immler parents: 
67707diff
changeset | 1380 | lemma strict_mono_compose: "strict_mono r \<Longrightarrow> strict_mono s \<Longrightarrow> strict_mono (\<lambda>x. r (s x))" | 
| 
ce3e87a51488
moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
 immler parents: 
67707diff
changeset | 1381 | using strict_mono_o[of r s] by (simp add: o_def) | 
| 
ce3e87a51488
moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
 immler parents: 
67707diff
changeset | 1382 | |
| 51471 | 1383 | lemma incseq_imp_monoseq: "incseq X \<Longrightarrow> monoseq X" | 
| 1384 | by (simp add: incseq_def monoseq_def) | |
| 1385 | ||
| 1386 | lemma decseq_imp_monoseq: "decseq X \<Longrightarrow> monoseq X" | |
| 1387 | by (simp add: decseq_def monoseq_def) | |
| 1388 | ||
| 63494 | 1389 | lemma decseq_eq_incseq: "decseq X = incseq (\<lambda>n. - X n)" | 
| 1390 | for X :: "nat \<Rightarrow> 'a::ordered_ab_group_add" | |
| 51471 | 1391 | by (simp add: decseq_def incseq_def) | 
| 1392 | ||
| 1393 | lemma INT_decseq_offset: | |
| 1394 | assumes "decseq F" | |
| 1395 |   shows "(\<Inter>i. F i) = (\<Inter>i\<in>{n..}. F i)"
 | |
| 1396 | proof safe | |
| 63494 | 1397 | fix x i | 
| 1398 |   assume x: "x \<in> (\<Inter>i\<in>{n..}. F i)"
 | |
| 51471 | 1399 | show "x \<in> F i" | 
| 1400 | proof cases | |
| 1401 | from x have "x \<in> F n" by auto | |
| 60758 | 1402 | also assume "i \<le> n" with \<open>decseq F\<close> have "F n \<subseteq> F i" | 
| 51471 | 1403 | unfolding decseq_def by simp | 
| 1404 | finally show ?thesis . | |
| 1405 | qed (insert x, simp) | |
| 1406 | qed auto | |
| 1407 | ||
| 63494 | 1408 | lemma LIMSEQ_const_iff: "(\<lambda>n. k) \<longlonglongrightarrow> l \<longleftrightarrow> k = l" | 
| 1409 | for k l :: "'a::t2_space" | |
| 51471 | 1410 | using trivial_limit_sequentially by (rule tendsto_const_iff) | 
| 1411 | ||
| 63494 | 1412 | lemma LIMSEQ_SUP: "incseq X \<Longrightarrow> X \<longlonglongrightarrow> (SUP i. X i :: 'a::{complete_linorder,linorder_topology})"
 | 
| 51471 | 1413 | by (intro increasing_tendsto) | 
| 63494 | 1414 | (auto simp: SUP_upper less_SUP_iff incseq_def eventually_sequentially intro: less_le_trans) | 
| 1415 | ||
| 1416 | lemma LIMSEQ_INF: "decseq X \<Longrightarrow> X \<longlonglongrightarrow> (INF i. X i :: 'a::{complete_linorder,linorder_topology})"
 | |
| 51471 | 1417 | by (intro decreasing_tendsto) | 
| 63494 | 1418 | (auto simp: INF_lower INF_less_iff decseq_def eventually_sequentially intro: le_less_trans) | 
| 1419 | ||
| 1420 | lemma LIMSEQ_ignore_initial_segment: "f \<longlonglongrightarrow> a \<Longrightarrow> (\<lambda>n. f (n + k)) \<longlonglongrightarrow> a" | |
| 1421 | unfolding tendsto_def by (subst eventually_sequentially_seg[where k=k]) | |
| 1422 | ||
| 1423 | lemma LIMSEQ_offset: "(\<lambda>n. f (n + k)) \<longlonglongrightarrow> a \<Longrightarrow> f \<longlonglongrightarrow> a" | |
| 51474 
1e9e68247ad1
generalize Bfun and Bseq to metric spaces; Bseq is an abbreviation for Bfun
 hoelzl parents: 
51473diff
changeset | 1424 | unfolding tendsto_def | 
| 
1e9e68247ad1
generalize Bfun and Bseq to metric spaces; Bseq is an abbreviation for Bfun
 hoelzl parents: 
51473diff
changeset | 1425 | by (subst (asm) eventually_sequentially_seg[where k=k]) | 
| 51471 | 1426 | |
| 61969 | 1427 | lemma LIMSEQ_Suc: "f \<longlonglongrightarrow> l \<Longrightarrow> (\<lambda>n. f (Suc n)) \<longlonglongrightarrow> l" | 
| 63494 | 1428 | by (drule LIMSEQ_ignore_initial_segment [where k="Suc 0"]) simp | 
| 51471 | 1429 | |
| 61969 | 1430 | lemma LIMSEQ_imp_Suc: "(\<lambda>n. f (Suc n)) \<longlonglongrightarrow> l \<Longrightarrow> f \<longlonglongrightarrow> l" | 
| 63494 | 1431 | by (rule LIMSEQ_offset [where k="Suc 0"]) simp | 
| 51471 | 1432 | |
| 68361 | 1433 | lemma LIMSEQ_lessThan_iff_atMost: | 
| 1434 |   shows "(\<lambda>n. f {..<n}) \<longlonglongrightarrow> x \<longleftrightarrow> (\<lambda>n. f {..n}) \<longlonglongrightarrow> x"
 | |
| 71827 | 1435 | apply (subst filterlim_sequentially_Suc [symmetric]) | 
| 68361 | 1436 | apply (simp only: lessThan_Suc_atMost) | 
| 1437 | done | |
| 1438 | ||
| 71827 | 1439 | lemma (in t2_space) LIMSEQ_Uniq: "\<exists>\<^sub>\<le>\<^sub>1l. X \<longlonglongrightarrow> l" | 
| 1440 | by (simp add: tendsto_unique') | |
| 1441 | ||
| 1442 | lemma (in t2_space) LIMSEQ_unique: "X \<longlonglongrightarrow> a \<Longrightarrow> X \<longlonglongrightarrow> b \<Longrightarrow> a = b" | |
| 51471 | 1443 | using trivial_limit_sequentially by (rule tendsto_unique) | 
| 1444 | ||
| 63494 | 1445 | lemma LIMSEQ_le_const: "X \<longlonglongrightarrow> x \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. a \<le> X n \<Longrightarrow> a \<le> x" | 
| 1446 | for a x :: "'a::linorder_topology" | |
| 63952 
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
 paulson <lp15@cam.ac.uk> parents: 
63713diff
changeset | 1447 | by (simp add: eventually_at_top_linorder tendsto_lowerbound) | 
| 51471 | 1448 | |
| 63494 | 1449 | lemma LIMSEQ_le: "X \<longlonglongrightarrow> x \<Longrightarrow> Y \<longlonglongrightarrow> y \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. X n \<le> Y n \<Longrightarrow> x \<le> y" | 
| 1450 | for x y :: "'a::linorder_topology" | |
| 51471 | 1451 | using tendsto_le[of sequentially Y y X x] by (simp add: eventually_sequentially) | 
| 1452 | ||
| 63494 | 1453 | lemma LIMSEQ_le_const2: "X \<longlonglongrightarrow> x \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. X n \<le> a \<Longrightarrow> x \<le> a" | 
| 1454 | for a x :: "'a::linorder_topology" | |
| 58729 
e8ecc79aee43
add tendsto_const and tendsto_ident_at as simp and intro rules
 hoelzl parents: 
57953diff
changeset | 1455 | by (rule LIMSEQ_le[of X x "\<lambda>n. a"]) auto | 
| 51471 | 1456 | |
| 68532 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1457 | lemma Lim_bounded: "f \<longlonglongrightarrow> l \<Longrightarrow> \<forall>n\<ge>M. f n \<le> C \<Longrightarrow> l \<le> C" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1458 | for l :: "'a::linorder_topology" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1459 | by (intro LIMSEQ_le_const2) auto | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1460 | |
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1461 | lemma Lim_bounded2: | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1462 | fixes f :: "nat \<Rightarrow> 'a::linorder_topology" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1463 | assumes lim:"f \<longlonglongrightarrow> l" and ge: "\<forall>n\<ge>N. f n \<ge> C" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1464 | shows "l \<ge> C" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1465 | using ge | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1466 | by (intro tendsto_le[OF trivial_limit_sequentially lim tendsto_const]) | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1467 | (auto simp: eventually_sequentially) | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1468 | |
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1469 | lemma lim_mono: | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1470 | fixes X Y :: "nat \<Rightarrow> 'a::linorder_topology" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1471 | assumes "\<And>n. N \<le> n \<Longrightarrow> X n \<le> Y n" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1472 | and "X \<longlonglongrightarrow> x" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1473 | and "Y \<longlonglongrightarrow> y" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1474 | shows "x \<le> y" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1475 | using assms(1) by (intro LIMSEQ_le[OF assms(2,3)]) auto | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1476 | |
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1477 | lemma Sup_lim: | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1478 |   fixes a :: "'a::{complete_linorder,linorder_topology}"
 | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1479 | assumes "\<And>n. b n \<in> s" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1480 | and "b \<longlonglongrightarrow> a" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1481 | shows "a \<le> Sup s" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1482 | by (metis Lim_bounded assms complete_lattice_class.Sup_upper) | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1483 | |
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1484 | lemma Inf_lim: | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1485 |   fixes a :: "'a::{complete_linorder,linorder_topology}"
 | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1486 | assumes "\<And>n. b n \<in> s" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1487 | and "b \<longlonglongrightarrow> a" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1488 | shows "Inf s \<le> a" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1489 | by (metis Lim_bounded2 assms complete_lattice_class.Inf_lower) | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1490 | |
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1491 | lemma SUP_Lim: | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1492 |   fixes X :: "nat \<Rightarrow> 'a::{complete_linorder,linorder_topology}"
 | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1493 | assumes inc: "incseq X" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1494 | and l: "X \<longlonglongrightarrow> l" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1495 | shows "(SUP n. X n) = l" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1496 | using LIMSEQ_SUP[OF inc] tendsto_unique[OF trivial_limit_sequentially l] | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1497 | by simp | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1498 | |
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1499 | lemma INF_Lim: | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1500 |   fixes X :: "nat \<Rightarrow> 'a::{complete_linorder,linorder_topology}"
 | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1501 | assumes dec: "decseq X" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1502 | and l: "X \<longlonglongrightarrow> l" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1503 | shows "(INF n. X n) = l" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1504 | using LIMSEQ_INF[OF dec] tendsto_unique[OF trivial_limit_sequentially l] | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1505 | by simp | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1506 | |
| 63494 | 1507 | lemma convergentD: "convergent X \<Longrightarrow> \<exists>L. X \<longlonglongrightarrow> L" | 
| 1508 | by (simp add: convergent_def) | |
| 1509 | ||
| 1510 | lemma convergentI: "X \<longlonglongrightarrow> L \<Longrightarrow> convergent X" | |
| 1511 | by (auto simp add: convergent_def) | |
| 1512 | ||
| 1513 | lemma convergent_LIMSEQ_iff: "convergent X \<longleftrightarrow> X \<longlonglongrightarrow> lim X" | |
| 1514 | by (auto intro: theI LIMSEQ_unique simp add: convergent_def lim_def) | |
| 51471 | 1515 | |
| 1516 | lemma convergent_const: "convergent (\<lambda>n. c)" | |
| 63494 | 1517 | by (rule convergentI) (rule tendsto_const) | 
| 51471 | 1518 | |
| 1519 | lemma monoseq_le: | |
| 63494 | 1520 | "monoseq a \<Longrightarrow> a \<longlonglongrightarrow> x \<Longrightarrow> | 
| 1521 | (\<forall>n. a n \<le> x) \<and> (\<forall>m. \<forall>n\<ge>m. a m \<le> a n) \<or> | |
| 1522 | (\<forall>n. x \<le> a n) \<and> (\<forall>m. \<forall>n\<ge>m. a n \<le> a m)" | |
| 1523 | for x :: "'a::linorder_topology" | |
| 51471 | 1524 | by (metis LIMSEQ_le_const LIMSEQ_le_const2 decseq_def incseq_def monoseq_iff) | 
| 1525 | ||
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1526 | lemma LIMSEQ_subseq_LIMSEQ: "X \<longlonglongrightarrow> L \<Longrightarrow> strict_mono f \<Longrightarrow> (X \<circ> f) \<longlonglongrightarrow> L" | 
| 63494 | 1527 | unfolding comp_def by (rule filterlim_compose [of X, OF _ filterlim_subseq]) | 
| 1528 | ||
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1529 | lemma convergent_subseq_convergent: "convergent X \<Longrightarrow> strict_mono f \<Longrightarrow> convergent (X \<circ> f)" | 
| 63494 | 1530 | by (auto simp: convergent_def intro: LIMSEQ_subseq_LIMSEQ) | 
| 1531 | ||
| 1532 | lemma limI: "X \<longlonglongrightarrow> L \<Longrightarrow> lim X = L" | |
| 57276 | 1533 | by (rule tendsto_Lim) (rule trivial_limit_sequentially) | 
| 51471 | 1534 | |
| 63494 | 1535 | lemma lim_le: "convergent f \<Longrightarrow> (\<And>n. f n \<le> x) \<Longrightarrow> lim f \<le> x" | 
| 1536 | for x :: "'a::linorder_topology" | |
| 51471 | 1537 | using LIMSEQ_le_const2[of f "lim f" x] by (simp add: convergent_LIMSEQ_iff) | 
| 1538 | ||
| 62217 | 1539 | lemma lim_const [simp]: "lim (\<lambda>m. a) = a" | 
| 1540 | by (simp add: limI) | |
| 1541 | ||
| 63494 | 1542 | |
| 1543 | subsubsection \<open>Increasing and Decreasing Series\<close> | |
| 1544 | ||
| 1545 | lemma incseq_le: "incseq X \<Longrightarrow> X \<longlonglongrightarrow> L \<Longrightarrow> X n \<le> L" | |
| 1546 | for L :: "'a::linorder_topology" | |
| 51471 | 1547 | by (metis incseq_def LIMSEQ_le_const) | 
| 1548 | ||
| 68532 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1549 | lemma decseq_ge: "decseq X \<Longrightarrow> X \<longlonglongrightarrow> L \<Longrightarrow> L \<le> X n" | 
| 63494 | 1550 | for L :: "'a::linorder_topology" | 
| 51471 | 1551 | by (metis decseq_def LIMSEQ_le_const2) | 
| 1552 | ||
| 63494 | 1553 | |
| 60758 | 1554 | subsection \<open>First countable topologies\<close> | 
| 51473 | 1555 | |
| 1556 | class first_countable_topology = topological_space + | |
| 1557 | assumes first_countable_basis: | |
| 1558 | "\<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))" | |
| 1559 | ||
| 1560 | lemma (in first_countable_topology) countable_basis_at_decseq: | |
| 1561 | obtains A :: "nat \<Rightarrow> 'a set" where | |
| 1562 | "\<And>i. open (A i)" "\<And>i. x \<in> (A i)" | |
| 1563 | "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> eventually (\<lambda>i. A i \<subseteq> S) sequentially" | |
| 1564 | proof atomize_elim | |
| 63494 | 1565 | from first_countable_basis[of x] obtain A :: "nat \<Rightarrow> 'a set" | 
| 1566 | where nhds: "\<And>i. open (A i)" "\<And>i. x \<in> A i" | |
| 1567 | and incl: "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> \<exists>i. A i \<subseteq> S" | |
| 1568 | by auto | |
| 63040 | 1569 | define F where "F n = (\<Inter>i\<le>n. A i)" for n | 
| 51473 | 1570 | show "\<exists>A. (\<forall>i. open (A i)) \<and> (\<forall>i. x \<in> A i) \<and> | 
| 63494 | 1571 | (\<forall>S. open S \<longrightarrow> x \<in> S \<longrightarrow> eventually (\<lambda>i. A i \<subseteq> S) sequentially)" | 
| 51473 | 1572 | proof (safe intro!: exI[of _ F]) | 
| 1573 | fix i | |
| 63494 | 1574 | show "open (F i)" | 
| 1575 | using nhds(1) by (auto simp: F_def) | |
| 1576 | show "x \<in> F i" | |
| 1577 | using nhds(2) by (auto simp: F_def) | |
| 51473 | 1578 | next | 
| 63494 | 1579 | fix S | 
| 1580 | assume "open S" "x \<in> S" | |
| 1581 | from incl[OF this] obtain i where "F i \<subseteq> S" | |
| 1582 | unfolding F_def by auto | |
| 51473 | 1583 | moreover have "\<And>j. i \<le> j \<Longrightarrow> F j \<subseteq> F i" | 
| 63171 | 1584 | by (simp add: Inf_superset_mono F_def image_mono) | 
| 51473 | 1585 | ultimately show "eventually (\<lambda>i. F i \<subseteq> S) sequentially" | 
| 1586 | by (auto simp: eventually_sequentially) | |
| 1587 | qed | |
| 1588 | qed | |
| 1589 | ||
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1590 | lemma (in first_countable_topology) nhds_countable: | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1591 | obtains X :: "nat \<Rightarrow> 'a set" | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1592 | where "decseq X" "\<And>n. open (X n)" "\<And>n. x \<in> X n" "nhds x = (INF n. principal (X n))" | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1593 | proof - | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1594 | from first_countable_basis obtain A :: "nat \<Rightarrow> 'a set" | 
| 63494 | 1595 | where *: "\<And>n. x \<in> A n" "\<And>n. open (A n)" "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> \<exists>i. A i \<subseteq> S" | 
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1596 | by metis | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1597 | show thesis | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1598 | proof | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1599 | show "decseq (\<lambda>n. \<Inter>i\<le>n. A i)" | 
| 63171 | 1600 | by (simp add: antimono_iff_le_Suc atMost_Suc) | 
| 63494 | 1601 | show "x \<in> (\<Inter>i\<le>n. A i)" "\<And>n. open (\<Inter>i\<le>n. A i)" for n | 
| 1602 | using * by auto | |
| 74668 | 1603 | with * show "nhds x = (INF n. principal (\<Inter>i\<le>n. A i))" | 
| 63494 | 1604 | unfolding nhds_def | 
| 74668 | 1605 | apply (intro INF_eq) | 
| 63494 | 1606 | apply fastforce | 
| 74668 | 1607 | apply blast | 
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1608 | done | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1609 | qed | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1610 | qed | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1611 | |
| 51473 | 1612 | lemma (in first_countable_topology) countable_basis: | 
| 1613 | obtains A :: "nat \<Rightarrow> 'a set" where | |
| 1614 | "\<And>i. open (A i)" "\<And>i. x \<in> A i" | |
| 61969 | 1615 | "\<And>F. (\<forall>n. F n \<in> A n) \<Longrightarrow> F \<longlonglongrightarrow> x" | 
| 51473 | 1616 | proof atomize_elim | 
| 63494 | 1617 | obtain A :: "nat \<Rightarrow> 'a set" where *: | 
| 53381 | 1618 | "\<And>i. open (A i)" | 
| 1619 | "\<And>i. x \<in> A i" | |
| 1620 | "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> eventually (\<lambda>i. A i \<subseteq> S) sequentially" | |
| 1621 | by (rule countable_basis_at_decseq) blast | |
| 63494 | 1622 | have "eventually (\<lambda>n. F n \<in> S) sequentially" | 
| 1623 | if "\<forall>n. F n \<in> A n" "open S" "x \<in> S" for F S | |
| 1624 | using *(3)[of S] that by (auto elim: eventually_mono simp: subset_eq) | |
| 1625 | with * 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 \<longlonglongrightarrow> x)" | |
| 51473 | 1626 | by (intro exI[of _ A]) (auto simp: tendsto_def) | 
| 1627 | qed | |
| 1628 | ||
| 1629 | lemma (in first_countable_topology) sequentially_imp_eventually_nhds_within: | |
| 61969 | 1630 | assumes "\<forall>f. (\<forall>n. f n \<in> s) \<and> f \<longlonglongrightarrow> a \<longrightarrow> eventually (\<lambda>n. P (f n)) sequentially" | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51518diff
changeset | 1631 | shows "eventually P (inf (nhds a) (principal s))" | 
| 51473 | 1632 | proof (rule ccontr) | 
| 63494 | 1633 | obtain A :: "nat \<Rightarrow> 'a set" where *: | 
| 53381 | 1634 | "\<And>i. open (A i)" | 
| 1635 | "\<And>i. a \<in> A i" | |
| 61969 | 1636 | "\<And>F. \<forall>n. F n \<in> A n \<Longrightarrow> F \<longlonglongrightarrow> a" | 
| 53381 | 1637 | by (rule countable_basis) blast | 
| 1638 | assume "\<not> ?thesis" | |
| 63494 | 1639 | with * have "\<exists>F. \<forall>n. F n \<in> s \<and> F n \<in> A n \<and> \<not> P (F n)" | 
| 1640 | unfolding eventually_inf_principal eventually_nhds | |
| 1641 | by (intro choice) fastforce | |
| 1642 | then obtain F where F: "\<forall>n. F n \<in> s" and "\<forall>n. F n \<in> A n" and F': "\<forall>n. \<not> P (F n)" | |
| 53381 | 1643 | by blast | 
| 63494 | 1644 | with * have "F \<longlonglongrightarrow> a" | 
| 1645 | by auto | |
| 1646 | then have "eventually (\<lambda>n. P (F n)) sequentially" | |
| 1647 | using assms F by simp | |
| 1648 | then show False | |
| 1649 | by (simp add: F') | |
| 51473 | 1650 | qed | 
| 1651 | ||
| 1652 | lemma (in first_countable_topology) eventually_nhds_within_iff_sequentially: | |
| 62102 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 hoelzl parents: 
62101diff
changeset | 1653 | "eventually P (inf (nhds a) (principal s)) \<longleftrightarrow> | 
| 61969 | 1654 | (\<forall>f. (\<forall>n. f n \<in> s) \<and> f \<longlonglongrightarrow> a \<longrightarrow> eventually (\<lambda>n. P (f n)) sequentially)" | 
| 51473 | 1655 | proof (safe intro!: sequentially_imp_eventually_nhds_within) | 
| 62102 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 hoelzl parents: 
62101diff
changeset | 1656 | assume "eventually P (inf (nhds a) (principal s))" | 
| 51473 | 1657 | then obtain S where "open S" "a \<in> S" "\<forall>x\<in>S. x \<in> s \<longrightarrow> P x" | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51518diff
changeset | 1658 | by (auto simp: eventually_inf_principal eventually_nhds) | 
| 63494 | 1659 | moreover | 
| 1660 | fix f | |
| 1661 | assume "\<forall>n. f n \<in> s" "f \<longlonglongrightarrow> a" | |
| 51473 | 1662 | ultimately show "eventually (\<lambda>n. P (f n)) sequentially" | 
| 61810 | 1663 | by (auto dest!: topological_tendstoD elim: eventually_mono) | 
| 51473 | 1664 | qed | 
| 1665 | ||
| 1666 | lemma (in first_countable_topology) eventually_nhds_iff_sequentially: | |
| 61969 | 1667 | "eventually P (nhds a) \<longleftrightarrow> (\<forall>f. f \<longlonglongrightarrow> a \<longrightarrow> eventually (\<lambda>n. P (f n)) sequentially)" | 
| 51473 | 1668 | using eventually_nhds_within_iff_sequentially[of P a UNIV] by simp | 
| 1669 | ||
| 70723 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1670 | (*Thanks to Sébastien Gouëzel*) | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1671 | lemma Inf_as_limit: | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1672 |   fixes A::"'a::{linorder_topology, first_countable_topology, complete_linorder} set"
 | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1673 |   assumes "A \<noteq> {}"
 | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1674 | shows "\<exists>u. (\<forall>n. u n \<in> A) \<and> u \<longlonglongrightarrow> Inf A" | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1675 | proof (cases "Inf A \<in> A") | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1676 | case True | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1677 | show ?thesis | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1678 | by (rule exI[of _ "\<lambda>n. Inf A"], auto simp add: True) | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1679 | next | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1680 | case False | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1681 | obtain y where "y \<in> A" using assms by auto | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1682 | then have "Inf A < y" using False Inf_lower less_le by auto | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1683 | obtain F :: "nat \<Rightarrow> 'a set" where F: "\<And>i. open (F i)" "\<And>i. Inf A \<in> F i" | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1684 | "\<And>u. (\<forall>n. u n \<in> F n) \<Longrightarrow> u \<longlonglongrightarrow> Inf A" | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1685 | by (metis first_countable_topology_class.countable_basis) | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1686 | define u where "u = (\<lambda>n. SOME z. z \<in> F n \<and> z \<in> A)" | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1687 | have "\<exists>z. z \<in> U \<and> z \<in> A" if "Inf A \<in> U" "open U" for U | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1688 | proof - | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1689 |     obtain b where "b > Inf A" "{Inf A ..<b} \<subseteq> U"
 | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1690 | using open_right[OF \<open>open U\<close> \<open>Inf A \<in> U\<close> \<open>Inf A < y\<close>] by auto | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1691 | obtain z where "z < b" "z \<in> A" | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1692 | using \<open>Inf A < b\<close> Inf_less_iff by auto | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1693 |     then have "z \<in> {Inf A ..<b}"
 | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1694 | by (simp add: Inf_lower) | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1695 |     then show ?thesis using \<open>z \<in> A\<close> \<open>{Inf A ..<b} \<subseteq> U\<close> by auto
 | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1696 | qed | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1697 | then have *: "u n \<in> F n \<and> u n \<in> A" for n | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1698 | using \<open>Inf A \<in> F n\<close> \<open>open (F n)\<close> unfolding u_def by (metis (no_types, lifting) someI_ex) | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1699 | then have "u \<longlonglongrightarrow> Inf A" using F(3) by simp | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1700 | then show ?thesis using * by auto | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1701 | qed | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1702 | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1703 | lemma tendsto_at_iff_sequentially: | 
| 63494 | 1704 |   "(f \<longlongrightarrow> a) (at x within s) \<longleftrightarrow> (\<forall>X. (\<forall>i. X i \<in> s - {x}) \<longrightarrow> X \<longlonglongrightarrow> x \<longrightarrow> ((f \<circ> X) \<longlonglongrightarrow> a))"
 | 
| 1705 | for f :: "'a::first_countable_topology \<Rightarrow> _" | |
| 1706 | unfolding filterlim_def[of _ "nhds a"] le_filter_def eventually_filtermap | |
| 1707 | at_within_def eventually_nhds_within_iff_sequentially comp_def | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1708 | by metis | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1709 | |
| 64283 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1710 | lemma approx_from_above_dense_linorder: | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1711 |   fixes x::"'a::{dense_linorder, linorder_topology, first_countable_topology}"
 | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1712 | assumes "x < y" | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1713 | shows "\<exists>u. (\<forall>n. u n > x) \<and> (u \<longlonglongrightarrow> x)" | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1714 | proof - | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1715 | obtain A :: "nat \<Rightarrow> 'a set" where A: "\<And>i. open (A i)" "\<And>i. x \<in> A i" | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1716 | "\<And>F. (\<forall>n. F n \<in> A n) \<Longrightarrow> F \<longlonglongrightarrow> x" | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1717 | by (metis first_countable_topology_class.countable_basis) | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1718 | define u where "u = (\<lambda>n. SOME z. z \<in> A n \<and> z > x)" | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1719 | have "\<exists>z. z \<in> U \<and> x < z" if "x \<in> U" "open U" for U | 
| 67226 | 1720 | using open_right[OF \<open>open U\<close> \<open>x \<in> U\<close> \<open>x < y\<close>] | 
| 64283 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1721 | by (meson atLeastLessThan_iff dense less_imp_le subset_eq) | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1722 | then have *: "u n \<in> A n \<and> x < u n" for n | 
| 67226 | 1723 | using \<open>x \<in> A n\<close> \<open>open (A n)\<close> unfolding u_def by (metis (no_types, lifting) someI_ex) | 
| 64283 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1724 | then have "u \<longlonglongrightarrow> x" using A(3) by simp | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1725 | then show ?thesis using * by auto | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1726 | qed | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1727 | |
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1728 | lemma approx_from_below_dense_linorder: | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1729 |   fixes x::"'a::{dense_linorder, linorder_topology, first_countable_topology}"
 | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1730 | assumes "x > y" | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1731 | shows "\<exists>u. (\<forall>n. u n < x) \<and> (u \<longlonglongrightarrow> x)" | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1732 | proof - | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1733 | obtain A :: "nat \<Rightarrow> 'a set" where A: "\<And>i. open (A i)" "\<And>i. x \<in> A i" | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1734 | "\<And>F. (\<forall>n. F n \<in> A n) \<Longrightarrow> F \<longlonglongrightarrow> x" | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1735 | by (metis first_countable_topology_class.countable_basis) | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1736 | define u where "u = (\<lambda>n. SOME z. z \<in> A n \<and> z < x)" | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1737 | have "\<exists>z. z \<in> U \<and> z < x" if "x \<in> U" "open U" for U | 
| 67226 | 1738 | using open_left[OF \<open>open U\<close> \<open>x \<in> U\<close> \<open>x > y\<close>] | 
| 64283 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1739 | by (meson dense greaterThanAtMost_iff less_imp_le subset_eq) | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1740 | then have *: "u n \<in> A n \<and> u n < x" for n | 
| 67226 | 1741 | using \<open>x \<in> A n\<close> \<open>open (A n)\<close> unfolding u_def by (metis (no_types, lifting) someI_ex) | 
| 64283 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1742 | then have "u \<longlonglongrightarrow> x" using A(3) by simp | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1743 | then show ?thesis using * by auto | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1744 | qed | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1745 | |
| 63494 | 1746 | |
| 60758 | 1747 | subsection \<open>Function limit at a point\<close> | 
| 51471 | 1748 | |
| 63494 | 1749 | abbreviation LIM :: "('a::topological_space \<Rightarrow> 'b::topological_space) \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> bool"
 | 
| 1750 |     ("((_)/ \<midarrow>(_)/\<rightarrow> (_))" [60, 0, 60] 60)
 | |
| 1751 | where "f \<midarrow>a\<rightarrow> L \<equiv> (f \<longlongrightarrow> L) (at a)" | |
| 51471 | 1752 | |
| 61976 | 1753 | lemma tendsto_within_open: "a \<in> S \<Longrightarrow> open S \<Longrightarrow> (f \<longlongrightarrow> l) (at a within S) \<longleftrightarrow> (f \<midarrow>a\<rightarrow> l)" | 
| 63494 | 1754 | by (simp add: tendsto_def at_within_open[where S = S]) | 
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 1755 | |
| 62397 
5ae24f33d343
Substantial new material for multivariate analysis. Also removal of some duplicates.
 paulson <lp15@cam.ac.uk> parents: 
62381diff
changeset | 1756 | lemma tendsto_within_open_NO_MATCH: | 
| 63494 | 1757 | "a \<in> S \<Longrightarrow> NO_MATCH UNIV S \<Longrightarrow> open S \<Longrightarrow> (f \<longlongrightarrow> l)(at a within S) \<longleftrightarrow> (f \<longlongrightarrow> l)(at a)" | 
| 1758 | for f :: "'a::topological_space \<Rightarrow> 'b::topological_space" | |
| 1759 | using tendsto_within_open by blast | |
| 1760 | ||
| 1761 | lemma LIM_const_not_eq[tendsto_intros]: "k \<noteq> L \<Longrightarrow> \<not> (\<lambda>x. k) \<midarrow>a\<rightarrow> L" | |
| 1762 | for a :: "'a::perfect_space" and k L :: "'b::t2_space" | |
| 51471 | 1763 | by (simp add: tendsto_const_iff) | 
| 1764 | ||
| 1765 | lemmas LIM_not_zero = LIM_const_not_eq [where L = 0] | |
| 1766 | ||
| 63494 | 1767 | lemma LIM_const_eq: "(\<lambda>x. k) \<midarrow>a\<rightarrow> L \<Longrightarrow> k = L" | 
| 1768 | for a :: "'a::perfect_space" and k L :: "'b::t2_space" | |
| 51471 | 1769 | by (simp add: tendsto_const_iff) | 
| 1770 | ||
| 63494 | 1771 | lemma LIM_unique: "f \<midarrow>a\<rightarrow> L \<Longrightarrow> f \<midarrow>a\<rightarrow> M \<Longrightarrow> L = M" | 
| 1772 | for a :: "'a::perfect_space" and L M :: "'b::t2_space" | |
| 51471 | 1773 | using at_neq_bot by (rule tendsto_unique) | 
| 1774 | ||
| 71827 | 1775 | lemma LIM_Uniq: "\<exists>\<^sub>\<le>\<^sub>1L::'b::t2_space. f \<midarrow>a\<rightarrow> L" | 
| 1776 | for a :: "'a::perfect_space" | |
| 1777 | by (auto simp add: Uniq_def LIM_unique) | |
| 1778 | ||
| 63494 | 1779 | |
| 1780 | text \<open>Limits are equal for functions equal except at limit point.\<close> | |
| 1781 | lemma LIM_equal: "\<forall>x. x \<noteq> a \<longrightarrow> f x = g x \<Longrightarrow> (f \<midarrow>a\<rightarrow> l) \<longleftrightarrow> (g \<midarrow>a\<rightarrow> l)" | |
| 1782 | by (simp add: tendsto_def eventually_at_topological) | |
| 51471 | 1783 | |
| 61976 | 1784 | lemma LIM_cong: "a = b \<Longrightarrow> (\<And>x. x \<noteq> b \<Longrightarrow> f x = g x) \<Longrightarrow> l = m \<Longrightarrow> (f \<midarrow>a\<rightarrow> l) \<longleftrightarrow> (g \<midarrow>b\<rightarrow> m)" | 
| 51471 | 1785 | by (simp add: LIM_equal) | 
| 1786 | ||
| 70365 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 1787 | lemma tendsto_cong_limit: "(f \<longlongrightarrow> l) F \<Longrightarrow> k = l \<Longrightarrow> (f \<longlongrightarrow> k) F" | 
| 51471 | 1788 | by simp | 
| 1789 | ||
| 63494 | 1790 | lemma tendsto_at_iff_tendsto_nhds: "g \<midarrow>l\<rightarrow> g l \<longleftrightarrow> (g \<longlongrightarrow> g l) (nhds l)" | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51518diff
changeset | 1791 | unfolding tendsto_def eventually_at_filter | 
| 61810 | 1792 | by (intro ext all_cong imp_cong) (auto elim!: eventually_mono) | 
| 51471 | 1793 | |
| 63494 | 1794 | lemma tendsto_compose: "g \<midarrow>l\<rightarrow> g l \<Longrightarrow> (f \<longlongrightarrow> l) F \<Longrightarrow> ((\<lambda>x. g (f x)) \<longlongrightarrow> g l) F" | 
| 51471 | 1795 | unfolding tendsto_at_iff_tendsto_nhds by (rule filterlim_compose[of g]) | 
| 1796 | ||
| 1797 | lemma tendsto_compose_eventually: | |
| 61976 | 1798 | "g \<midarrow>l\<rightarrow> m \<Longrightarrow> (f \<longlongrightarrow> l) F \<Longrightarrow> eventually (\<lambda>x. f x \<noteq> l) F \<Longrightarrow> ((\<lambda>x. g (f x)) \<longlongrightarrow> m) F" | 
| 51471 | 1799 | by (rule filterlim_compose[of g _ "at l"]) (auto simp add: filterlim_at) | 
| 1800 | ||
| 1801 | lemma LIM_compose_eventually: | |
| 63494 | 1802 | assumes "f \<midarrow>a\<rightarrow> b" | 
| 1803 | and "g \<midarrow>b\<rightarrow> c" | |
| 1804 | and "eventually (\<lambda>x. f x \<noteq> b) (at a)" | |
| 61976 | 1805 | shows "(\<lambda>x. g (f x)) \<midarrow>a\<rightarrow> c" | 
| 63494 | 1806 | using assms(2,1,3) by (rule tendsto_compose_eventually) | 
| 51471 | 1807 | |
| 61973 | 1808 | lemma tendsto_compose_filtermap: "((g \<circ> f) \<longlongrightarrow> T) F \<longleftrightarrow> (g \<longlongrightarrow> T) (filtermap f F)" | 
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1809 | by (simp add: filterlim_def filtermap_filtermap comp_def) | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1810 | |
| 64758 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 1811 | lemma tendsto_compose_at: | 
| 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 1812 | assumes f: "(f \<longlongrightarrow> y) F" and g: "(g \<longlongrightarrow> z) (at y)" and fg: "eventually (\<lambda>w. f w = y \<longrightarrow> g y = z) F" | 
| 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 1813 | shows "((g \<circ> f) \<longlongrightarrow> z) F" | 
| 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 1814 | proof - | 
| 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 1815 | have "(\<forall>\<^sub>F a in F. f a \<noteq> y) \<or> g y = z" | 
| 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 1816 | using fg by force | 
| 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 1817 | moreover have "(g \<longlongrightarrow> z) (filtermap f F) \<or> \<not> (\<forall>\<^sub>F a in F. f a \<noteq> y)" | 
| 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 1818 | by (metis (no_types) filterlim_atI filterlim_def tendsto_mono f g) | 
| 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 1819 | ultimately show ?thesis | 
| 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 1820 | by (metis (no_types) f filterlim_compose filterlim_filtermap g tendsto_at_iff_tendsto_nhds tendsto_compose_filtermap) | 
| 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 1821 | qed | 
| 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 1822 | |
| 77140 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1823 | lemma tendsto_nhds_iff: "(f \<longlongrightarrow> (c :: 'a :: t1_space)) (nhds x) \<longleftrightarrow> f \<midarrow>x\<rightarrow> c \<and> f x = c" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1824 | proof safe | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1825 | assume lim: "(f \<longlongrightarrow> c) (nhds x)" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1826 | show "f x = c" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1827 | proof (rule ccontr) | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1828 | assume "f x \<noteq> c" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1829 | hence "c \<noteq> f x" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1830 | by auto | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1831 | then obtain A where A: "open A" "c \<in> A" "f x \<notin> A" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1832 | by (subst (asm) separation_t1) auto | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1833 | with lim obtain B where "open B" "x \<in> B" "\<And>x. x \<in> B \<Longrightarrow> f x \<in> A" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1834 | unfolding tendsto_def eventually_nhds by metis | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1835 | with \<open>f x \<notin> A\<close> show False | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1836 | by blast | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1837 | qed | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1838 | show "(f \<longlongrightarrow> c) (at x)" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1839 | using lim by (rule filterlim_mono) (auto simp: at_within_def) | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1840 | next | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1841 | assume "f \<midarrow>x\<rightarrow> f x" "c = f x" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1842 | thus "(f \<longlongrightarrow> f x) (nhds x)" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1843 | unfolding tendsto_def eventually_at_filter by (fast elim: eventually_mono) | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1844 | qed | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1845 | |
| 63494 | 1846 | |
| 1847 | subsubsection \<open>Relation of \<open>LIM\<close> and \<open>LIMSEQ\<close>\<close> | |
| 51473 | 1848 | |
| 1849 | lemma (in first_countable_topology) sequentially_imp_eventually_within: | |
| 61969 | 1850 | "(\<forall>f. (\<forall>n. f n \<in> s \<and> f n \<noteq> a) \<and> f \<longlonglongrightarrow> a \<longrightarrow> eventually (\<lambda>n. P (f n)) sequentially) \<Longrightarrow> | 
| 51473 | 1851 | eventually P (at a within s)" | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51518diff
changeset | 1852 | unfolding at_within_def | 
| 51473 | 1853 | by (intro sequentially_imp_eventually_nhds_within) auto | 
| 1854 | ||
| 1855 | lemma (in first_countable_topology) sequentially_imp_eventually_at: | |
| 61969 | 1856 | "(\<forall>f. (\<forall>n. f n \<noteq> a) \<and> f \<longlonglongrightarrow> a \<longrightarrow> eventually (\<lambda>n. P (f n)) sequentially) \<Longrightarrow> eventually P (at a)" | 
| 63092 | 1857 | using sequentially_imp_eventually_within [where s=UNIV] by simp | 
| 51473 | 1858 | |
| 75243 | 1859 | lemma LIMSEQ_SEQ_conv: | 
| 1860 | "(\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S \<longlonglongrightarrow> a \<longrightarrow> (\<lambda>n. X (S n)) \<longlonglongrightarrow> L) \<longleftrightarrow> X \<midarrow>a\<rightarrow> L" (is "?lhs=?rhs") | |
| 63494 | 1861 | for a :: "'a::first_countable_topology" and L :: "'b::topological_space" | 
| 75243 | 1862 | proof | 
| 1863 | assume ?lhs then show ?rhs | |
| 1864 | by (simp add: sequentially_imp_eventually_within tendsto_def) | |
| 1865 | next | |
| 1866 | assume ?rhs then show ?lhs | |
| 1867 | using tendsto_compose_eventually eventuallyI by blast | |
| 1868 | qed | |
| 51473 | 1869 | |
| 57025 | 1870 | lemma sequentially_imp_eventually_at_left: | 
| 63494 | 1871 |   fixes a :: "'a::{linorder_topology,first_countable_topology}"
 | 
| 57025 | 1872 | assumes b[simp]: "b < a" | 
| 63494 | 1873 | and *: "\<And>f. (\<And>n. b < f n) \<Longrightarrow> (\<And>n. f n < a) \<Longrightarrow> incseq f \<Longrightarrow> f \<longlonglongrightarrow> a \<Longrightarrow> | 
| 1874 | eventually (\<lambda>n. P (f n)) sequentially" | |
| 57025 | 1875 | shows "eventually P (at_left a)" | 
| 1876 | proof (safe intro!: sequentially_imp_eventually_within) | |
| 63494 | 1877 | fix X | 
| 1878 |   assume X: "\<forall>n. X n \<in> {..< a} \<and> X n \<noteq> a" "X \<longlonglongrightarrow> a"
 | |
| 57025 | 1879 | show "eventually (\<lambda>n. P (X n)) sequentially" | 
| 1880 | proof (rule ccontr) | |
| 63494 | 1881 | assume neg: "\<not> ?thesis" | 
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1882 | have "\<exists>s. \<forall>n. (\<not> P (X (s n)) \<and> b < X (s n)) \<and> (X (s n) \<le> X (s (Suc n)) \<and> Suc (s n) \<le> s (Suc n))" | 
| 63494 | 1883 | (is "\<exists>s. ?P s") | 
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1884 | proof (rule dependent_nat_choice) | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1885 | have "\<not> eventually (\<lambda>n. b < X n \<longrightarrow> P (X n)) sequentially" | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1886 | by (intro not_eventually_impI neg order_tendstoD(1) [OF X(2) b]) | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1887 | then show "\<exists>x. \<not> P (X x) \<and> b < X x" | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1888 | by (auto dest!: not_eventuallyD) | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1889 | next | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1890 | fix x n | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1891 | have "\<not> eventually (\<lambda>n. Suc x \<le> n \<longrightarrow> b < X n \<longrightarrow> X x < X n \<longrightarrow> P (X n)) sequentially" | 
| 63494 | 1892 | using X | 
| 1893 | by (intro not_eventually_impI order_tendstoD(1)[OF X(2)] eventually_ge_at_top neg) auto | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1894 | then show "\<exists>n. (\<not> P (X n) \<and> b < X n) \<and> (X x \<le> X n \<and> Suc x \<le> n)" | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1895 | by (auto dest!: not_eventuallyD) | 
| 57025 | 1896 | qed | 
| 63494 | 1897 | then obtain s where "?P s" .. | 
| 1898 | with X have "b < X (s n)" | |
| 1899 | and "X (s n) < a" | |
| 1900 | and "incseq (\<lambda>n. X (s n))" | |
| 1901 | and "(\<lambda>n. X (s n)) \<longlonglongrightarrow> a" | |
| 1902 | and "\<not> P (X (s n))" | |
| 1903 | for n | |
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1904 | by (auto simp: strict_mono_Suc_iff Suc_le_eq incseq_Suc_iff | 
| 63494 | 1905 | intro!: LIMSEQ_subseq_LIMSEQ[OF \<open>X \<longlonglongrightarrow> a\<close>, unfolded comp_def]) | 
| 1906 | from *[OF this(1,2,3,4)] this(5) show False | |
| 1907 | by auto | |
| 57025 | 1908 | qed | 
| 1909 | qed | |
| 1910 | ||
| 1911 | lemma tendsto_at_left_sequentially: | |
| 63494 | 1912 |   fixes a b :: "'b::{linorder_topology,first_countable_topology}"
 | 
| 57025 | 1913 | assumes "b < a" | 
| 63494 | 1914 | assumes *: "\<And>S. (\<And>n. S n < a) \<Longrightarrow> (\<And>n. b < S n) \<Longrightarrow> incseq S \<Longrightarrow> S \<longlonglongrightarrow> a \<Longrightarrow> | 
| 1915 | (\<lambda>n. X (S n)) \<longlonglongrightarrow> L" | |
| 61973 | 1916 | shows "(X \<longlongrightarrow> L) (at_left a)" | 
| 63494 | 1917 | using assms by (simp add: tendsto_def [where l=L] sequentially_imp_eventually_at_left) | 
| 57025 | 1918 | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1919 | lemma sequentially_imp_eventually_at_right: | 
| 63494 | 1920 |   fixes a b :: "'a::{linorder_topology,first_countable_topology}"
 | 
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1921 | assumes b[simp]: "a < b" | 
| 63494 | 1922 | assumes *: "\<And>f. (\<And>n. a < f n) \<Longrightarrow> (\<And>n. f n < b) \<Longrightarrow> decseq f \<Longrightarrow> f \<longlonglongrightarrow> a \<Longrightarrow> | 
| 1923 | eventually (\<lambda>n. P (f n)) sequentially" | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1924 | shows "eventually P (at_right a)" | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1925 | proof (safe intro!: sequentially_imp_eventually_within) | 
| 63494 | 1926 | fix X | 
| 1927 |   assume X: "\<forall>n. X n \<in> {a <..} \<and> X n \<noteq> a" "X \<longlonglongrightarrow> a"
 | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1928 | show "eventually (\<lambda>n. P (X n)) sequentially" | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1929 | proof (rule ccontr) | 
| 63494 | 1930 | assume neg: "\<not> ?thesis" | 
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1931 | have "\<exists>s. \<forall>n. (\<not> P (X (s n)) \<and> X (s n) < b) \<and> (X (s (Suc n)) \<le> X (s n) \<and> Suc (s n) \<le> s (Suc n))" | 
| 63494 | 1932 | (is "\<exists>s. ?P s") | 
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1933 | proof (rule dependent_nat_choice) | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1934 | have "\<not> eventually (\<lambda>n. X n < b \<longrightarrow> P (X n)) sequentially" | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1935 | by (intro not_eventually_impI neg order_tendstoD(2) [OF X(2) b]) | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1936 | then show "\<exists>x. \<not> P (X x) \<and> X x < b" | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1937 | by (auto dest!: not_eventuallyD) | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1938 | next | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1939 | fix x n | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1940 | have "\<not> eventually (\<lambda>n. Suc x \<le> n \<longrightarrow> X n < b \<longrightarrow> X n < X x \<longrightarrow> P (X n)) sequentially" | 
| 63494 | 1941 | using X | 
| 1942 | by (intro not_eventually_impI order_tendstoD(2)[OF X(2)] eventually_ge_at_top neg) auto | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1943 | then show "\<exists>n. (\<not> P (X n) \<and> X n < b) \<and> (X n \<le> X x \<and> Suc x \<le> n)" | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1944 | by (auto dest!: not_eventuallyD) | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1945 | qed | 
| 63494 | 1946 | then obtain s where "?P s" .. | 
| 1947 | with X have "a < X (s n)" | |
| 1948 | and "X (s n) < b" | |
| 1949 | and "decseq (\<lambda>n. X (s n))" | |
| 1950 | and "(\<lambda>n. X (s n)) \<longlonglongrightarrow> a" | |
| 1951 | and "\<not> P (X (s n))" | |
| 1952 | for n | |
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1953 | by (auto simp: strict_mono_Suc_iff Suc_le_eq decseq_Suc_iff | 
| 63494 | 1954 | intro!: LIMSEQ_subseq_LIMSEQ[OF \<open>X \<longlonglongrightarrow> a\<close>, unfolded comp_def]) | 
| 1955 | from *[OF this(1,2,3,4)] this(5) show False | |
| 1956 | by auto | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1957 | qed | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1958 | qed | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1959 | |
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1960 | lemma tendsto_at_right_sequentially: | 
| 60172 
423273355b55
rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
 hoelzl parents: 
60150diff
changeset | 1961 |   fixes a :: "_ :: {linorder_topology, first_countable_topology}"
 | 
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1962 | assumes "a < b" | 
| 63494 | 1963 | and *: "\<And>S. (\<And>n. a < S n) \<Longrightarrow> (\<And>n. S n < b) \<Longrightarrow> decseq S \<Longrightarrow> S \<longlonglongrightarrow> a \<Longrightarrow> | 
| 1964 | (\<lambda>n. X (S n)) \<longlonglongrightarrow> L" | |
| 61973 | 1965 | shows "(X \<longlongrightarrow> L) (at_right a)" | 
| 63494 | 1966 | using assms by (simp add: tendsto_def [where l=L] sequentially_imp_eventually_at_right) | 
| 1967 | ||
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1968 | |
| 60758 | 1969 | subsection \<open>Continuity\<close> | 
| 51471 | 1970 | |
| 60758 | 1971 | subsubsection \<open>Continuity on a set\<close> | 
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 1972 | |
| 63494 | 1973 | definition continuous_on :: "'a set \<Rightarrow> ('a::topological_space \<Rightarrow> 'b::topological_space) \<Rightarrow> bool"
 | 
| 1974 | where "continuous_on s f \<longleftrightarrow> (\<forall>x\<in>s. (f \<longlongrightarrow> f x) (at x within s))" | |
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 1975 | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 1976 | lemma continuous_on_cong [cong]: | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 1977 | "s = t \<Longrightarrow> (\<And>x. x \<in> t \<Longrightarrow> f x = g x) \<Longrightarrow> continuous_on s f \<longleftrightarrow> continuous_on t g" | 
| 63494 | 1978 | unfolding continuous_on_def | 
| 1979 | by (intro ball_cong filterlim_cong) (auto simp: eventually_at_filter) | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 1980 | |
| 69546 
27dae626822b
prefer naming convention from datatype package for strong congruence rules
 haftmann parents: 
69529diff
changeset | 1981 | lemma continuous_on_cong_simp: | 
| 64008 
17a20ca86d62
HOL-Probability: more about probability, prepare for Markov processes in the AFP
 hoelzl parents: 
63952diff
changeset | 1982 | "s = t \<Longrightarrow> (\<And>x. x \<in> t =simp=> f x = g x) \<Longrightarrow> continuous_on s f \<longleftrightarrow> continuous_on t g" | 
| 
17a20ca86d62
HOL-Probability: more about probability, prepare for Markov processes in the AFP
 hoelzl parents: 
63952diff
changeset | 1983 | unfolding simp_implies_def by (rule continuous_on_cong) | 
| 
17a20ca86d62
HOL-Probability: more about probability, prepare for Markov processes in the AFP
 hoelzl parents: 
63952diff
changeset | 1984 | |
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 1985 | lemma continuous_on_topological: | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 1986 | "continuous_on s f \<longleftrightarrow> | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 1987 | (\<forall>x\<in>s. \<forall>B. open B \<longrightarrow> f x \<in> B \<longrightarrow> (\<exists>A. open A \<and> x \<in> A \<and> (\<forall>y\<in>s. y \<in> A \<longrightarrow> f y \<in> B)))" | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51518diff
changeset | 1988 | unfolding continuous_on_def tendsto_def eventually_at_topological by metis | 
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 1989 | |
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 1990 | lemma continuous_on_open_invariant: | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 1991 | "continuous_on s f \<longleftrightarrow> (\<forall>B. open B \<longrightarrow> (\<exists>A. open A \<and> A \<inter> s = f -` B \<inter> s))" | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 1992 | proof safe | 
| 63494 | 1993 | fix B :: "'b set" | 
| 1994 | assume "continuous_on s f" "open B" | |
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 1995 | then have "\<forall>x\<in>f -` B \<inter> s. (\<exists>A. open A \<and> x \<in> A \<and> s \<inter> A \<subseteq> f -` B)" | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 1996 | by (auto simp: continuous_on_topological subset_eq Ball_def imp_conjL) | 
| 53381 | 1997 | then obtain A where "\<forall>x\<in>f -` B \<inter> s. open (A x) \<and> x \<in> A x \<and> s \<inter> A x \<subseteq> f -` B" | 
| 1998 | unfolding bchoice_iff .. | |
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 1999 | then show "\<exists>A. open A \<and> A \<inter> s = f -` B \<inter> s" | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2000 | by (intro exI[of _ "\<Union>x\<in>f -` B \<inter> s. A x"]) auto | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2001 | next | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2002 | assume B: "\<forall>B. open B \<longrightarrow> (\<exists>A. open A \<and> A \<inter> s = f -` B \<inter> s)" | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2003 | show "continuous_on s f" | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2004 | unfolding continuous_on_topological | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2005 | proof safe | 
| 63494 | 2006 | fix x B | 
| 2007 | assume "x \<in> s" "open B" "f x \<in> B" | |
| 2008 | with B obtain A where A: "open A" "A \<inter> s = f -` B \<inter> s" | |
| 2009 | by auto | |
| 60758 | 2010 | with \<open>x \<in> s\<close> \<open>f x \<in> B\<close> show "\<exists>A. open A \<and> x \<in> A \<and> (\<forall>y\<in>s. y \<in> A \<longrightarrow> f y \<in> B)" | 
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2011 | by (intro exI[of _ A]) auto | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2012 | qed | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2013 | qed | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2014 | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2015 | lemma continuous_on_open_vimage: | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2016 | "open s \<Longrightarrow> continuous_on s f \<longleftrightarrow> (\<forall>B. open B \<longrightarrow> open (f -` B \<inter> s))" | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2017 | unfolding continuous_on_open_invariant | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2018 | by (metis open_Int Int_absorb Int_commute[of s] Int_assoc[of _ _ s]) | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2019 | |
| 55734 | 2020 | corollary continuous_imp_open_vimage: | 
| 2021 | assumes "continuous_on s f" "open s" "open B" "f -` B \<subseteq> s" | |
| 63494 | 2022 | shows "open (f -` B)" | 
| 2023 | by (metis assms continuous_on_open_vimage le_iff_inf) | |
| 55734 | 2024 | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 2025 | corollary open_vimage[continuous_intros]: | 
| 63494 | 2026 | assumes "open s" | 
| 2027 | and "continuous_on UNIV f" | |
| 55775 | 2028 | shows "open (f -` s)" | 
| 63494 | 2029 | using assms by (simp add: continuous_on_open_vimage [OF open_UNIV]) | 
| 55775 | 2030 | |
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2031 | lemma continuous_on_closed_invariant: | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2032 | "continuous_on s f \<longleftrightarrow> (\<forall>B. closed B \<longrightarrow> (\<exists>A. closed A \<and> A \<inter> s = f -` B \<inter> s))" | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2033 | proof - | 
| 63494 | 2034 | have *: "(\<And>A. P A \<longleftrightarrow> Q (- A)) \<Longrightarrow> (\<forall>A. P A) \<longleftrightarrow> (\<forall>A. Q A)" | 
| 2035 | for P Q :: "'b set \<Rightarrow> bool" | |
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2036 | by (metis double_compl) | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2037 | show ?thesis | 
| 63494 | 2038 | unfolding continuous_on_open_invariant | 
| 2039 | by (intro *) (auto simp: open_closed[symmetric]) | |
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2040 | qed | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2041 | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2042 | lemma continuous_on_closed_vimage: | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2043 | "closed s \<Longrightarrow> continuous_on s f \<longleftrightarrow> (\<forall>B. closed B \<longrightarrow> closed (f -` B \<inter> s))" | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2044 | unfolding continuous_on_closed_invariant | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2045 | by (metis closed_Int Int_absorb Int_commute[of s] Int_assoc[of _ _ s]) | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2046 | |
| 61426 
d53db136e8fd
new material on path_component_sets, inside, outside, etc. And more default simprules
 paulson <lp15@cam.ac.uk> parents: 
61342diff
changeset | 2047 | corollary closed_vimage_Int[continuous_intros]: | 
| 63494 | 2048 | assumes "closed s" | 
| 2049 | and "continuous_on t f" | |
| 2050 | and t: "closed t" | |
| 61426 
d53db136e8fd
new material on path_component_sets, inside, outside, etc. And more default simprules
 paulson <lp15@cam.ac.uk> parents: 
61342diff
changeset | 2051 | shows "closed (f -` s \<inter> t)" | 
| 63494 | 2052 | using assms by (simp add: continuous_on_closed_vimage [OF t]) | 
| 61426 
d53db136e8fd
new material on path_component_sets, inside, outside, etc. And more default simprules
 paulson <lp15@cam.ac.uk> parents: 
61342diff
changeset | 2053 | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 2054 | corollary closed_vimage[continuous_intros]: | 
| 63494 | 2055 | assumes "closed s" | 
| 2056 | and "continuous_on UNIV f" | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 2057 | shows "closed (f -` s)" | 
| 61426 
d53db136e8fd
new material on path_component_sets, inside, outside, etc. And more default simprules
 paulson <lp15@cam.ac.uk> parents: 
61342diff
changeset | 2058 | using closed_vimage_Int [OF assms] by simp | 
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 2059 | |
| 62843 
313d3b697c9a
Mostly renaming (from HOL Light to Isabelle conventions), with a couple of new results
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2060 | lemma continuous_on_empty [simp]: "continuous_on {} f"
 | 
| 61907 
f0c894ab18c9
Liouville theorem, Fundamental Theorem of Algebra, etc.
 paulson <lp15@cam.ac.uk> parents: 
61810diff
changeset | 2061 | by (simp add: continuous_on_def) | 
| 
f0c894ab18c9
Liouville theorem, Fundamental Theorem of Algebra, etc.
 paulson <lp15@cam.ac.uk> parents: 
61810diff
changeset | 2062 | |
| 62843 
313d3b697c9a
Mostly renaming (from HOL Light to Isabelle conventions), with a couple of new results
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2063 | lemma continuous_on_sing [simp]: "continuous_on {x} f"
 | 
| 61907 
f0c894ab18c9
Liouville theorem, Fundamental Theorem of Algebra, etc.
 paulson <lp15@cam.ac.uk> parents: 
61810diff
changeset | 2064 | by (simp add: continuous_on_def at_within_def) | 
| 
f0c894ab18c9
Liouville theorem, Fundamental Theorem of Algebra, etc.
 paulson <lp15@cam.ac.uk> parents: 
61810diff
changeset | 2065 | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2066 | lemma continuous_on_open_Union: | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2067 | "(\<And>s. s \<in> S \<Longrightarrow> open s) \<Longrightarrow> (\<And>s. s \<in> S \<Longrightarrow> continuous_on s f) \<Longrightarrow> continuous_on (\<Union>S) f" | 
| 63494 | 2068 | unfolding continuous_on_def | 
| 2069 | by safe (metis open_Union at_within_open UnionI) | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2070 | |
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2071 | lemma continuous_on_open_UN: | 
| 63494 | 2072 | "(\<And>s. s \<in> S \<Longrightarrow> open (A s)) \<Longrightarrow> (\<And>s. s \<in> S \<Longrightarrow> continuous_on (A s) f) \<Longrightarrow> | 
| 2073 | continuous_on (\<Union>s\<in>S. A s) f" | |
| 62343 
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
 haftmann parents: 
62217diff
changeset | 2074 | by (rule continuous_on_open_Union) auto | 
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2075 | |
| 61204 | 2076 | lemma continuous_on_open_Un: | 
| 2077 | "open s \<Longrightarrow> open t \<Longrightarrow> continuous_on s f \<Longrightarrow> continuous_on t f \<Longrightarrow> continuous_on (s \<union> t) f" | |
| 2078 |   using continuous_on_open_Union [of "{s,t}"] by auto
 | |
| 2079 | ||
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2080 | lemma continuous_on_closed_Un: | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2081 | "closed s \<Longrightarrow> closed t \<Longrightarrow> continuous_on s f \<Longrightarrow> continuous_on t f \<Longrightarrow> continuous_on (s \<union> t) f" | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2082 | by (auto simp add: continuous_on_closed_vimage closed_Un Int_Un_distrib) | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2083 | |
| 67727 
ce3e87a51488
moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
 immler parents: 
67707diff
changeset | 2084 | lemma continuous_on_closed_Union: | 
| 
ce3e87a51488
moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
 immler parents: 
67707diff
changeset | 2085 | assumes "finite I" | 
| 
ce3e87a51488
moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
 immler parents: 
67707diff
changeset | 2086 | "\<And>i. i \<in> I \<Longrightarrow> closed (U i)" | 
| 
ce3e87a51488
moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
 immler parents: 
67707diff
changeset | 2087 | "\<And>i. i \<in> I \<Longrightarrow> continuous_on (U i) f" | 
| 
ce3e87a51488
moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
 immler parents: 
67707diff
changeset | 2088 | shows "continuous_on (\<Union> i \<in> I. U i) f" | 
| 
ce3e87a51488
moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
 immler parents: 
67707diff
changeset | 2089 | using assms | 
| 
ce3e87a51488
moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
 immler parents: 
67707diff
changeset | 2090 | by (induction I) (auto intro!: continuous_on_closed_Un) | 
| 
ce3e87a51488
moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
 immler parents: 
67707diff
changeset | 2091 | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2092 | lemma continuous_on_If: | 
| 63494 | 2093 | assumes closed: "closed s" "closed t" | 
| 2094 | and cont: "continuous_on s f" "continuous_on t g" | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2095 | and P: "\<And>x. x \<in> s \<Longrightarrow> \<not> P x \<Longrightarrow> f x = g x" "\<And>x. x \<in> t \<Longrightarrow> P x \<Longrightarrow> f x = g x" | 
| 63494 | 2096 | shows "continuous_on (s \<union> t) (\<lambda>x. if P x then f x else g x)" | 
| 2097 | (is "continuous_on _ ?h") | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2098 | proof- | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2099 | from P have "\<forall>x\<in>s. f x = ?h x" "\<forall>x\<in>t. g x = ?h x" | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2100 | by auto | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2101 | with cont have "continuous_on s ?h" "continuous_on t ?h" | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2102 | by simp_all | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2103 | with closed show ?thesis | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2104 | by (rule continuous_on_closed_Un) | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2105 | qed | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2106 | |
| 65036 
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
 paulson <lp15@cam.ac.uk> parents: 
64969diff
changeset | 2107 | lemma continuous_on_cases: | 
| 
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
 paulson <lp15@cam.ac.uk> parents: 
64969diff
changeset | 2108 | "closed s \<Longrightarrow> closed t \<Longrightarrow> continuous_on s f \<Longrightarrow> continuous_on t g \<Longrightarrow> | 
| 
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
 paulson <lp15@cam.ac.uk> parents: 
64969diff
changeset | 2109 | \<forall>x. (x\<in>s \<and> \<not> P x) \<or> (x \<in> t \<and> P x) \<longrightarrow> f x = g x \<Longrightarrow> | 
| 
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
 paulson <lp15@cam.ac.uk> parents: 
64969diff
changeset | 2110 | continuous_on (s \<union> t) (\<lambda>x. if P x then f x else g x)" | 
| 
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
 paulson <lp15@cam.ac.uk> parents: 
64969diff
changeset | 2111 | by (rule continuous_on_If) auto | 
| 
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
 paulson <lp15@cam.ac.uk> parents: 
64969diff
changeset | 2112 | |
| 68296 
69d680e94961
tidying and reorganisation around Cauchy Integral Theorem
 paulson <lp15@cam.ac.uk> parents: 
68064diff
changeset | 2113 | lemma continuous_on_id[continuous_intros,simp]: "continuous_on s (\<lambda>x. x)" | 
| 58729 
e8ecc79aee43
add tendsto_const and tendsto_ident_at as simp and intro rules
 hoelzl parents: 
57953diff
changeset | 2114 | unfolding continuous_on_def by fast | 
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2115 | |
| 68296 
69d680e94961
tidying and reorganisation around Cauchy Integral Theorem
 paulson <lp15@cam.ac.uk> parents: 
68064diff
changeset | 2116 | lemma continuous_on_id'[continuous_intros,simp]: "continuous_on s id" | 
| 63301 | 2117 | unfolding continuous_on_def id_def by fast | 
| 2118 | ||
| 68296 
69d680e94961
tidying and reorganisation around Cauchy Integral Theorem
 paulson <lp15@cam.ac.uk> parents: 
68064diff
changeset | 2119 | lemma continuous_on_const[continuous_intros,simp]: "continuous_on s (\<lambda>x. c)" | 
| 58729 
e8ecc79aee43
add tendsto_const and tendsto_ident_at as simp and intro rules
 hoelzl parents: 
57953diff
changeset | 2120 | unfolding continuous_on_def by auto | 
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2121 | |
| 61738 
c4f6031f1310
New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
 paulson <lp15@cam.ac.uk> parents: 
61531diff
changeset | 2122 | lemma continuous_on_subset: "continuous_on s f \<Longrightarrow> t \<subseteq> s \<Longrightarrow> continuous_on t f" | 
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2123 | unfolding continuous_on_def | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2124 | by (metis subset_eq tendsto_within_subset) | 
| 61738 
c4f6031f1310
New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
 paulson <lp15@cam.ac.uk> parents: 
61531diff
changeset | 2125 | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 2126 | lemma continuous_on_compose[continuous_intros]: | 
| 63494 | 2127 | "continuous_on s f \<Longrightarrow> continuous_on (f ` s) g \<Longrightarrow> continuous_on s (g \<circ> f)" | 
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2128 | unfolding continuous_on_topological by simp metis | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2129 | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2130 | lemma continuous_on_compose2: | 
| 61738 
c4f6031f1310
New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
 paulson <lp15@cam.ac.uk> parents: 
61531diff
changeset | 2131 | "continuous_on t g \<Longrightarrow> continuous_on s f \<Longrightarrow> f ` s \<subseteq> t \<Longrightarrow> continuous_on s (\<lambda>x. g (f x))" | 
| 
c4f6031f1310
New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
 paulson <lp15@cam.ac.uk> parents: 
61531diff
changeset | 2132 | using continuous_on_compose[of s f g] continuous_on_subset by (force simp add: comp_def) | 
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2133 | |
| 60720 | 2134 | lemma continuous_on_generate_topology: | 
| 2135 | assumes *: "open = generate_topology X" | |
| 63494 | 2136 | and **: "\<And>B. B \<in> X \<Longrightarrow> \<exists>C. open C \<and> C \<inter> A = f -` B \<inter> A" | 
| 60720 | 2137 | shows "continuous_on A f" | 
| 2138 | unfolding continuous_on_open_invariant | |
| 2139 | proof safe | |
| 63494 | 2140 | fix B :: "'a set" | 
| 2141 | assume "open B" | |
| 2142 | then show "\<exists>C. open C \<and> C \<inter> A = f -` B \<inter> A" | |
| 60720 | 2143 | unfolding * | 
| 63494 | 2144 | proof induct | 
| 60720 | 2145 | case (UN K) | 
| 2146 | then obtain C where "\<And>k. k \<in> K \<Longrightarrow> open (C k)" "\<And>k. k \<in> K \<Longrightarrow> C k \<inter> A = f -` k \<inter> A" | |
| 2147 | by metis | |
| 2148 | then show ?case | |
| 2149 | by (intro exI[of _ "\<Union>k\<in>K. C k"]) blast | |
| 2150 | qed (auto intro: **) | |
| 2151 | qed | |
| 2152 | ||
| 2153 | lemma continuous_onI_mono: | |
| 63494 | 2154 |   fixes f :: "'a::linorder_topology \<Rightarrow> 'b::{dense_order,linorder_topology}"
 | 
| 60720 | 2155 | assumes "open (f`A)" | 
| 63494 | 2156 | and mono: "\<And>x y. x \<in> A \<Longrightarrow> y \<in> A \<Longrightarrow> x \<le> y \<Longrightarrow> f x \<le> f y" | 
| 60720 | 2157 | shows "continuous_on A f" | 
| 2158 | proof (rule continuous_on_generate_topology[OF open_generated_order], safe) | |
| 2159 | have monoD: "\<And>x y. x \<in> A \<Longrightarrow> y \<in> A \<Longrightarrow> f x < f y \<Longrightarrow> x < y" | |
| 2160 | by (auto simp: not_le[symmetric] mono) | |
| 63494 | 2161 | have "\<exists>x. x \<in> A \<and> f x < b \<and> a < x" if a: "a \<in> A" and fa: "f a < b" for a b | 
| 2162 | proof - | |
| 2163 |     obtain y where "f a < y" "{f a ..< y} \<subseteq> f`A"
 | |
| 2164 | using open_right[OF \<open>open (f`A)\<close>, of "f a" b] a fa | |
| 60720 | 2165 | by auto | 
| 63494 | 2166 | obtain z where z: "f a < z" "z < min b y" | 
| 60720 | 2167 | using dense[of "f a" "min b y"] \<open>f a < y\<close> \<open>f a < b\<close> by auto | 
| 63494 | 2168 | then obtain c where "z = f c" "c \<in> A" | 
| 60720 | 2169 |       using \<open>{f a ..< y} \<subseteq> f`A\<close>[THEN subsetD, of z] by (auto simp: less_imp_le)
 | 
| 63494 | 2170 | with a z show ?thesis | 
| 2171 | by (auto intro!: exI[of _ c] simp: monoD) | |
| 2172 | qed | |
| 60720 | 2173 |   then show "\<exists>C. open C \<and> C \<inter> A = f -` {..<b} \<inter> A" for b
 | 
| 2174 |     by (intro exI[of _ "(\<Union>x\<in>{x\<in>A. f x < b}. {..< x})"])
 | |
| 2175 | (auto intro: le_less_trans[OF mono] less_imp_le) | |
| 2176 | ||
| 63494 | 2177 | have "\<exists>x. x \<in> A \<and> b < f x \<and> x < a" if a: "a \<in> A" and fa: "b < f a" for a b | 
| 2178 | proof - | |
| 2179 | note a fa | |
| 60720 | 2180 | moreover | 
| 63494 | 2181 |     obtain y where "y < f a" "{y <.. f a} \<subseteq> f`A"
 | 
| 2182 | using open_left[OF \<open>open (f`A)\<close>, of "f a" b] a fa | |
| 60720 | 2183 | by auto | 
| 63494 | 2184 | then obtain z where z: "max b y < z" "z < f a" | 
| 60720 | 2185 | using dense[of "max b y" "f a"] \<open>y < f a\<close> \<open>b < f a\<close> by auto | 
| 63494 | 2186 | then obtain c where "z = f c" "c \<in> A" | 
| 60720 | 2187 |       using \<open>{y <.. f a} \<subseteq> f`A\<close>[THEN subsetD, of z] by (auto simp: less_imp_le)
 | 
| 63494 | 2188 | with a z show ?thesis | 
| 2189 | by (auto intro!: exI[of _ c] simp: monoD) | |
| 2190 | qed | |
| 60720 | 2191 |   then show "\<exists>C. open C \<and> C \<inter> A = f -` {b <..} \<inter> A" for b
 | 
| 2192 |     by (intro exI[of _ "(\<Union>x\<in>{x\<in>A. b < f x}. {x <..})"])
 | |
| 2193 | (auto intro: less_le_trans[OF _ mono] less_imp_le) | |
| 2194 | qed | |
| 2195 | ||
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2196 | lemma continuous_on_IccI: | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2197 | "\<lbrakk>(f \<longlongrightarrow> f a) (at_right a); | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2198 | (f \<longlongrightarrow> f b) (at_left b); | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2199 | (\<And>x. a < x \<Longrightarrow> x < b \<Longrightarrow> f \<midarrow>x\<rightarrow> f x); a < b\<rbrakk> \<Longrightarrow> | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2200 |     continuous_on {a .. b} f"
 | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2201 | for a::"'a::linorder_topology" | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2202 |   using at_within_open[of _ "{a<..<b}"]
 | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2203 | by (auto simp: continuous_on_def at_within_Icc_at_right at_within_Icc_at_left le_less | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2204 | at_within_Icc_at) | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2205 | |
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2206 | lemma | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2207 | fixes a b::"'a::linorder_topology" | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2208 |   assumes "continuous_on {a .. b} f" "a < b"
 | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2209 | shows continuous_on_Icc_at_rightD: "(f \<longlongrightarrow> f a) (at_right a)" | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2210 | and continuous_on_Icc_at_leftD: "(f \<longlongrightarrow> f b) (at_left b)" | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2211 | using assms | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2212 | by (auto simp: at_within_Icc_at_right at_within_Icc_at_left continuous_on_def | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2213 | dest: bspec[where x=a] bspec[where x=b]) | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2214 | |
| 68965 
1254f3e57fed
Removed problematic rules from continuous_intros
 eberlm <eberlm@in.tum.de> parents: 
68860diff
changeset | 2215 | lemma continuous_on_discrete [simp]: | 
| 68860 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 2216 | "continuous_on A (f :: 'a :: discrete_topology \<Rightarrow> _)" | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 2217 | by (auto simp: continuous_on_def at_discrete) | 
| 63494 | 2218 | |
| 77223 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2219 | lemma continuous_on_of_nat [continuous_intros]: | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2220 | assumes "continuous_on A f" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2221 | shows "continuous_on A (\<lambda>n. of_nat (f n))" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2222 | using continuous_on_compose[OF assms continuous_on_discrete[of _ of_nat]] | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2223 | by (simp add: o_def) | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2224 | |
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2225 | lemma continuous_on_of_int [continuous_intros]: | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2226 | assumes "continuous_on A f" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2227 | shows "continuous_on A (\<lambda>n. of_int (f n))" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2228 | using continuous_on_compose[OF assms continuous_on_discrete[of _ of_int]] | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2229 | by (simp add: o_def) | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2230 | |
| 60758 | 2231 | subsubsection \<open>Continuity at a point\<close> | 
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2232 | |
| 63494 | 2233 | definition continuous :: "'a::t2_space filter \<Rightarrow> ('a \<Rightarrow> 'b::topological_space) \<Rightarrow> bool"
 | 
| 2234 | where "continuous F f \<longleftrightarrow> (f \<longlongrightarrow> f (Lim F (\<lambda>x. x))) F" | |
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2235 | |
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2236 | lemma continuous_bot[continuous_intros, simp]: "continuous bot f" | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2237 | unfolding continuous_def by auto | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2238 | |
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2239 | lemma continuous_trivial_limit: "trivial_limit net \<Longrightarrow> continuous net f" | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2240 | by simp | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2241 | |
| 61973 | 2242 | lemma continuous_within: "continuous (at x within s) f \<longleftrightarrow> (f \<longlongrightarrow> f x) (at x within s)" | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51518diff
changeset | 2243 | by (cases "trivial_limit (at x within s)") (auto simp add: Lim_ident_at continuous_def) | 
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2244 | |
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2245 | lemma continuous_within_topological: | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2246 | "continuous (at x within s) f \<longleftrightarrow> | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2247 | (\<forall>B. open B \<longrightarrow> f x \<in> B \<longrightarrow> (\<exists>A. open A \<and> x \<in> A \<and> (\<forall>y\<in>s. y \<in> A \<longrightarrow> f y \<in> B)))" | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51518diff
changeset | 2248 | unfolding continuous_within tendsto_def eventually_at_topological by metis | 
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2249 | |
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2250 | lemma continuous_within_compose[continuous_intros]: | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2251 | "continuous (at x within s) f \<Longrightarrow> continuous (at (f x) within f ` s) g \<Longrightarrow> | 
| 63494 | 2252 | continuous (at x within s) (g \<circ> f)" | 
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2253 | by (simp add: continuous_within_topological) metis | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2254 | |
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2255 | lemma continuous_within_compose2: | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2256 | "continuous (at x within s) f \<Longrightarrow> continuous (at (f x) within f ` s) g \<Longrightarrow> | 
| 63494 | 2257 | continuous (at x within s) (\<lambda>x. g (f x))" | 
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2258 | using continuous_within_compose[of x s f g] by (simp add: comp_def) | 
| 51471 | 2259 | |
| 61976 | 2260 | lemma continuous_at: "continuous (at x) f \<longleftrightarrow> f \<midarrow>x\<rightarrow> f x" | 
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2261 | using continuous_within[of x UNIV f] by simp | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2262 | |
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2263 | lemma continuous_ident[continuous_intros, simp]: "continuous (at x within S) (\<lambda>x. x)" | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51518diff
changeset | 2264 | unfolding continuous_within by (rule tendsto_ident_at) | 
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2265 | |
| 70707 
125705f5965f
A little-known material, and some tidying up
 paulson <lp15@cam.ac.uk> parents: 
70367diff
changeset | 2266 | lemma continuous_id[continuous_intros, simp]: "continuous (at x within S) id" | 
| 
125705f5965f
A little-known material, and some tidying up
 paulson <lp15@cam.ac.uk> parents: 
70367diff
changeset | 2267 | by (simp add: id_def) | 
| 
125705f5965f
A little-known material, and some tidying up
 paulson <lp15@cam.ac.uk> parents: 
70367diff
changeset | 2268 | |
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2269 | lemma continuous_const[continuous_intros, simp]: "continuous F (\<lambda>x. c)" | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2270 | unfolding continuous_def by (rule tendsto_const) | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2271 | |
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2272 | lemma continuous_on_eq_continuous_within: | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2273 | "continuous_on s f \<longleftrightarrow> (\<forall>x\<in>s. continuous (at x within s) f)" | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2274 | unfolding continuous_on_def continuous_within .. | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2275 | |
| 68965 
1254f3e57fed
Removed problematic rules from continuous_intros
 eberlm <eberlm@in.tum.de> parents: 
68860diff
changeset | 2276 | lemma continuous_discrete [simp]: | 
| 68860 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 2277 | "continuous (at x within A) (f :: 'a :: discrete_topology \<Rightarrow> _)" | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 2278 | by (auto simp: continuous_def at_discrete) | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 2279 | |
| 63494 | 2280 | abbreviation isCont :: "('a::t2_space \<Rightarrow> 'b::topological_space) \<Rightarrow> 'a \<Rightarrow> bool"
 | 
| 2281 | where "isCont f a \<equiv> continuous (at a) f" | |
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2282 | |
| 61976 | 2283 | lemma isCont_def: "isCont f a \<longleftrightarrow> f \<midarrow>a\<rightarrow> f a" | 
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2284 | by (rule continuous_at) | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2285 | |
| 68721 | 2286 | lemma isContD: "isCont f x \<Longrightarrow> f \<midarrow>x\<rightarrow> f x" | 
| 2287 | by (simp add: isCont_def) | |
| 2288 | ||
| 63295 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 2289 | lemma isCont_cong: | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 2290 | assumes "eventually (\<lambda>x. f x = g x) (nhds x)" | 
| 63494 | 2291 | shows "isCont f x \<longleftrightarrow> isCont g x" | 
| 63295 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 2292 | proof - | 
| 63494 | 2293 | from assms have [simp]: "f x = g x" | 
| 2294 | by (rule eventually_nhds_x_imp_x) | |
| 63295 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 2295 | from assms have "eventually (\<lambda>x. f x = g x) (at x)" | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 2296 | by (auto simp: eventually_at_filter elim!: eventually_mono) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 2297 | with assms have "isCont f x \<longleftrightarrow> isCont g x" unfolding isCont_def | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 2298 | by (intro filterlim_cong) (auto elim!: eventually_mono) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 2299 | with assms show ?thesis by simp | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 2300 | qed | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 2301 | |
| 60762 | 2302 | lemma continuous_at_imp_continuous_at_within: "isCont f x \<Longrightarrow> continuous (at x within s) f" | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51518diff
changeset | 2303 | by (auto intro: tendsto_mono at_le simp: continuous_at continuous_within) | 
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2304 | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2305 | lemma continuous_on_eq_continuous_at: "open s \<Longrightarrow> continuous_on s f \<longleftrightarrow> (\<forall>x\<in>s. isCont f x)" | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51518diff
changeset | 2306 | by (simp add: continuous_on_def continuous_at at_within_open[of _ s]) | 
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2307 | |
| 62083 | 2308 | lemma continuous_within_open: "a \<in> A \<Longrightarrow> open A \<Longrightarrow> continuous (at a within A) f \<longleftrightarrow> isCont f a" | 
| 2309 | by (simp add: at_within_open_NO_MATCH) | |
| 2310 | ||
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2311 | lemma continuous_at_imp_continuous_on: "\<forall>x\<in>s. isCont f x \<Longrightarrow> continuous_on s f" | 
| 60762 | 2312 | by (auto intro: continuous_at_imp_continuous_at_within simp: continuous_on_eq_continuous_within) | 
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2313 | |
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2314 | lemma isCont_o2: "isCont f a \<Longrightarrow> isCont g (f a) \<Longrightarrow> isCont (\<lambda>x. g (f x)) a" | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2315 | unfolding isCont_def by (rule tendsto_compose) | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2316 | |
| 66827 
c94531b5007d
Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
 paulson <lp15@cam.ac.uk> parents: 
66447diff
changeset | 2317 | lemma continuous_at_compose[continuous_intros]: "isCont f a \<Longrightarrow> isCont g (f a) \<Longrightarrow> isCont (g \<circ> f) a" | 
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2318 | unfolding o_def by (rule isCont_o2) | 
| 51471 | 2319 | |
| 61973 | 2320 | lemma isCont_tendsto_compose: "isCont g l \<Longrightarrow> (f \<longlongrightarrow> l) F \<Longrightarrow> ((\<lambda>x. g (f x)) \<longlongrightarrow> g l) F" | 
| 51471 | 2321 | unfolding isCont_def by (rule tendsto_compose) | 
| 62102 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 hoelzl parents: 
62101diff
changeset | 2322 | |
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61976diff
changeset | 2323 | lemma continuous_on_tendsto_compose: | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61976diff
changeset | 2324 | assumes f_cont: "continuous_on s f" | 
| 63494 | 2325 | and g: "(g \<longlongrightarrow> l) F" | 
| 2326 | and l: "l \<in> s" | |
| 2327 | and ev: "\<forall>\<^sub>Fx in F. g x \<in> s" | |
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61976diff
changeset | 2328 | shows "((\<lambda>x. f (g x)) \<longlongrightarrow> f l) F" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61976diff
changeset | 2329 | proof - | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61976diff
changeset | 2330 | from f_cont l have f: "(f \<longlongrightarrow> f l) (at l within s)" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61976diff
changeset | 2331 | by (simp add: continuous_on_def) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61976diff
changeset | 2332 | have i: "((\<lambda>x. if g x = l then f l else f (g x)) \<longlongrightarrow> f l) F" | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61976diff
changeset | 2333 | by (rule filterlim_If) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61976diff
changeset | 2334 | (auto intro!: filterlim_compose[OF f] eventually_conj tendsto_mono[OF _ g] | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61976diff
changeset | 2335 | simp: filterlim_at eventually_inf_principal eventually_mono[OF ev]) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61976diff
changeset | 2336 | show ?thesis | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61976diff
changeset | 2337 | by (rule filterlim_cong[THEN iffD1[OF _ i]]) auto | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61976diff
changeset | 2338 | qed | 
| 51471 | 2339 | |
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2340 | lemma continuous_within_compose3: | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51474diff
changeset | 2341 | "isCont g (f x) \<Longrightarrow> continuous (at x within s) f \<Longrightarrow> continuous (at x within s) (\<lambda>x. g (f x))" | 
| 63171 | 2342 | using continuous_at_imp_continuous_at_within continuous_within_compose2 by blast | 
| 51471 | 2343 | |
| 77223 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2344 | lemma at_within_isCont_imp_nhds: | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2345 |   fixes f:: "'a:: {t2_space,perfect_space} \<Rightarrow> 'b:: t2_space"
 | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2346 | assumes "\<forall>\<^sub>F w in at z. f w = g w" "isCont f z" "isCont g z" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2347 | shows "\<forall>\<^sub>F w in nhds z. f w = g w" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2348 | proof - | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2349 | have "g \<midarrow>z\<rightarrow> f z" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2350 | using assms isContD tendsto_cong by blast | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2351 | moreover have "g \<midarrow>z\<rightarrow> g z" using \<open>isCont g z\<close> using isCont_def by blast | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2352 | ultimately have "f z=g z" using LIM_unique by auto | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2353 | moreover have "\<forall>\<^sub>F x in nhds z. x \<noteq> z \<longrightarrow> f x = g x" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2354 | using assms unfolding eventually_at_filter by auto | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2355 | ultimately show ?thesis | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2356 | by (auto elim:eventually_mono) | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2357 | qed | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2358 | |
| 77140 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2359 | lemma filtermap_nhds_open_map': | 
| 63494 | 2360 | assumes cont: "isCont f a" | 
| 77140 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2361 | and "open A" "a \<in> A" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2362 | and open_map: "\<And>S. open S \<Longrightarrow> S \<subseteq> A \<Longrightarrow> open (f ` S)" | 
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 2363 | shows "filtermap f (nhds a) = nhds (f a)" | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 2364 | unfolding filter_eq_iff | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 2365 | proof safe | 
| 63494 | 2366 | fix P | 
| 2367 | assume "eventually P (filtermap f (nhds a))" | |
| 77140 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2368 | then obtain S where S: "open S" "a \<in> S" "\<forall>x\<in>S. P (f x)" | 
| 63494 | 2369 | by (auto simp: eventually_filtermap eventually_nhds) | 
| 77140 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2370 | show "eventually P (nhds (f a))" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2371 | unfolding eventually_nhds | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2372 | proof (rule exI [of _ "f ` (A \<inter> S)"], safe) | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2373 | show "open (f ` (A \<inter> S))" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2374 | using S by (intro open_Int assms) auto | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2375 | show "f a \<in> f ` (A \<inter> S)" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2376 | using assms S by auto | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2377 | show "P (f x)" if "x \<in> A" "x \<in> S" for x | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2378 | using S that by auto | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2379 | qed | 
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 2380 | qed (metis filterlim_iff tendsto_at_iff_tendsto_nhds isCont_def eventually_filtermap cont) | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 2381 | |
| 77140 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2382 | lemma filtermap_nhds_open_map: | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2383 | assumes cont: "isCont f a" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2384 | and open_map: "\<And>S. open S \<Longrightarrow> open (f`S)" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2385 | shows "filtermap f (nhds a) = nhds (f a)" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2386 | using cont filtermap_nhds_open_map' open_map by blast | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2387 | |
| 62102 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 hoelzl parents: 
62101diff
changeset | 2388 | lemma continuous_at_split: | 
| 63494 | 2389 | "continuous (at x) f \<longleftrightarrow> continuous (at_left x) f \<and> continuous (at_right x) f" | 
| 2390 | for x :: "'a::linorder_topology" | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 2391 | by (simp add: continuous_within filterlim_at_split) | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 2392 | |
| 70365 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2393 | lemma continuous_on_max [continuous_intros]: | 
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2394 | fixes f g :: "'a::topological_space \<Rightarrow> 'b::linorder_topology" | 
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2395 | shows "continuous_on A f \<Longrightarrow> continuous_on A g \<Longrightarrow> continuous_on A (\<lambda>x. max (f x) (g x))" | 
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2396 | by (auto simp: continuous_on_def intro!: tendsto_max) | 
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2397 | |
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2398 | lemma continuous_on_min [continuous_intros]: | 
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2399 | fixes f g :: "'a::topological_space \<Rightarrow> 'b::linorder_topology" | 
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2400 | shows "continuous_on A f \<Longrightarrow> continuous_on A g \<Longrightarrow> continuous_on A (\<lambda>x. min (f x) (g x))" | 
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2401 | by (auto simp: continuous_on_def intro!: tendsto_min) | 
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2402 | |
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2403 | lemma continuous_max [continuous_intros]: | 
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2404 | fixes f :: "'a::t2_space \<Rightarrow> 'b::linorder_topology" | 
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2405 | shows "\<lbrakk>continuous F f; continuous F g\<rbrakk> \<Longrightarrow> continuous F (\<lambda>x. (max (f x) (g x)))" | 
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2406 | by (simp add: tendsto_max continuous_def) | 
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2407 | |
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2408 | lemma continuous_min [continuous_intros]: | 
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2409 | fixes f :: "'a::t2_space \<Rightarrow> 'b::linorder_topology" | 
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2410 | shows "\<lbrakk>continuous F f; continuous F g\<rbrakk> \<Longrightarrow> continuous F (\<lambda>x. (min (f x) (g x)))" | 
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2411 | by (simp add: tendsto_min continuous_def) | 
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2412 | |
| 63494 | 2413 | text \<open> | 
| 63495 | 2414 | The following open/closed Collect lemmas are ported from | 
| 2415 | Sébastien Gouëzel's \<open>Ergodic_Theory\<close>. | |
| 63494 | 2416 | \<close> | 
| 63332 | 2417 | lemma open_Collect_neq: | 
| 63494 | 2418 | fixes f g :: "'a::topological_space \<Rightarrow> 'b::t2_space" | 
| 63332 | 2419 | assumes f: "continuous_on UNIV f" and g: "continuous_on UNIV g" | 
| 2420 |   shows "open {x. f x \<noteq> g x}"
 | |
| 2421 | proof (rule openI) | |
| 63494 | 2422 | fix t | 
| 2423 |   assume "t \<in> {x. f x \<noteq> g x}"
 | |
| 63332 | 2424 |   then obtain U V where *: "open U" "open V" "f t \<in> U" "g t \<in> V" "U \<inter> V = {}"
 | 
| 2425 | by (auto simp add: separation_t2) | |
| 2426 | with open_vimage[OF \<open>open U\<close> f] open_vimage[OF \<open>open V\<close> g] | |
| 2427 |   show "\<exists>T. open T \<and> t \<in> T \<and> T \<subseteq> {x. f x \<noteq> g x}"
 | |
| 2428 | by (intro exI[of _ "f -` U \<inter> g -` V"]) auto | |
| 2429 | qed | |
| 2430 | ||
| 2431 | lemma closed_Collect_eq: | |
| 63494 | 2432 | fixes f g :: "'a::topological_space \<Rightarrow> 'b::t2_space" | 
| 63332 | 2433 | assumes f: "continuous_on UNIV f" and g: "continuous_on UNIV g" | 
| 2434 |   shows "closed {x. f x = g x}"
 | |
| 2435 | using open_Collect_neq[OF f g] by (simp add: closed_def Collect_neg_eq) | |
| 2436 | ||
| 2437 | lemma open_Collect_less: | |
| 63494 | 2438 | fixes f g :: "'a::topological_space \<Rightarrow> 'b::linorder_topology" | 
| 63332 | 2439 | assumes f: "continuous_on UNIV f" and g: "continuous_on UNIV g" | 
| 2440 |   shows "open {x. f x < g x}"
 | |
| 2441 | proof (rule openI) | |
| 63494 | 2442 | fix t | 
| 2443 |   assume t: "t \<in> {x. f x < g x}"
 | |
| 63332 | 2444 |   show "\<exists>T. open T \<and> t \<in> T \<and> T \<subseteq> {x. f x < g x}"
 | 
| 63494 | 2445 | proof (cases "\<exists>z. f t < z \<and> z < g t") | 
| 2446 | case True | |
| 2447 | then obtain z where "f t < z \<and> z < g t" by blast | |
| 63332 | 2448 | then show ?thesis | 
| 2449 |       using open_vimage[OF _ f, of "{..< z}"] open_vimage[OF _ g, of "{z <..}"]
 | |
| 2450 |       by (intro exI[of _ "f -` {..<z} \<inter> g -` {z<..}"]) auto
 | |
| 2451 | next | |
| 63494 | 2452 | case False | 
| 63332 | 2453 |     then have *: "{g t ..} = {f t <..}" "{..< g t} = {.. f t}"
 | 
| 2454 | using t by (auto intro: leI) | |
| 2455 | show ?thesis | |
| 2456 |       using open_vimage[OF _ f, of "{..< g t}"] open_vimage[OF _ g, of "{f t <..}"] t
 | |
| 2457 |       apply (intro exI[of _ "f -` {..< g t} \<inter> g -` {f t<..}"])
 | |
| 2458 | apply (simp add: open_Int) | |
| 2459 | apply (auto simp add: *) | |
| 2460 | done | |
| 2461 | qed | |
| 2462 | qed | |
| 2463 | ||
| 2464 | lemma closed_Collect_le: | |
| 2465 | fixes f g :: "'a :: topological_space \<Rightarrow> 'b::linorder_topology" | |
| 63494 | 2466 | assumes f: "continuous_on UNIV f" | 
| 2467 | and g: "continuous_on UNIV g" | |
| 63332 | 2468 |   shows "closed {x. f x \<le> g x}"
 | 
| 63494 | 2469 | using open_Collect_less [OF g f] | 
| 2470 | by (simp add: closed_def Collect_neg_eq[symmetric] not_le) | |
| 2471 | ||
| 63332 | 2472 | |
| 61245 | 2473 | subsubsection \<open>Open-cover compactness\<close> | 
| 51479 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2474 | |
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2475 | context topological_space | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2476 | begin | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2477 | |
| 69529 | 2478 | definition compact :: "'a set \<Rightarrow> bool" where | 
| 2479 | compact_eq_Heine_Borel: (* This name is used for backwards compatibility *) | |
| 51479 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2480 | "compact S \<longleftrightarrow> (\<forall>C. (\<forall>c\<in>C. open c) \<and> S \<subseteq> \<Union>C \<longrightarrow> (\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union>D))" | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2481 | |
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2482 | lemma compactI: | 
| 60585 | 2483 | assumes "\<And>C. \<forall>t\<in>C. open t \<Longrightarrow> s \<subseteq> \<Union>C \<Longrightarrow> \<exists>C'. C' \<subseteq> C \<and> finite C' \<and> s \<subseteq> \<Union>C'" | 
| 51479 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2484 | shows "compact s" | 
| 69529 | 2485 | unfolding compact_eq_Heine_Borel using assms by metis | 
| 51479 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2486 | |
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2487 | lemma compact_empty[simp]: "compact {}"
 | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2488 | by (auto intro!: compactI) | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2489 | |
| 64758 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 2490 | lemma compactE: (*related to COMPACT_IMP_HEINE_BOREL in HOL Light*) | 
| 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 2491 | assumes "compact S" "S \<subseteq> \<Union>\<T>" "\<And>B. B \<in> \<T> \<Longrightarrow> open B" | 
| 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 2492 | obtains \<T>' where "\<T>' \<subseteq> \<T>" "finite \<T>'" "S \<subseteq> \<Union>\<T>'" | 
| 69529 | 2493 | by (meson assms compact_eq_Heine_Borel) | 
| 51479 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2494 | |
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2495 | lemma compactE_image: | 
| 64845 | 2496 | assumes "compact S" | 
| 67231 | 2497 | and opn: "\<And>T. T \<in> C \<Longrightarrow> open (f T)" | 
| 65583 
8d53b3bebab4
Further new material. The simprule status of some exp and ln identities was reverted.
 paulson <lp15@cam.ac.uk> parents: 
65204diff
changeset | 2498 | and S: "S \<subseteq> (\<Union>c\<in>C. f c)" | 
| 64845 | 2499 | obtains C' where "C' \<subseteq> C" and "finite C'" and "S \<subseteq> (\<Union>c\<in>C'. f c)" | 
| 65583 
8d53b3bebab4
Further new material. The simprule status of some exp and ln identities was reverted.
 paulson <lp15@cam.ac.uk> parents: 
65204diff
changeset | 2500 | apply (rule compactE[OF \<open>compact S\<close> S]) | 
| 67231 | 2501 | using opn apply force | 
| 65583 
8d53b3bebab4
Further new material. The simprule status of some exp and ln identities was reverted.
 paulson <lp15@cam.ac.uk> parents: 
65204diff
changeset | 2502 | by (metis finite_subset_image) | 
| 51479 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2503 | |
| 62843 
313d3b697c9a
Mostly renaming (from HOL Light to Isabelle conventions), with a couple of new results
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2504 | lemma compact_Int_closed [intro]: | 
| 64845 | 2505 | assumes "compact S" | 
| 2506 | and "closed T" | |
| 2507 | shows "compact (S \<inter> T)" | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2508 | proof (rule compactI) | 
| 63494 | 2509 | fix C | 
| 2510 | assume C: "\<forall>c\<in>C. open c" | |
| 64845 | 2511 | assume cover: "S \<inter> T \<subseteq> \<Union>C" | 
| 2512 |   from C \<open>closed T\<close> have "\<forall>c\<in>C \<union> {- T}. open c"
 | |
| 63494 | 2513 | by auto | 
| 64845 | 2514 |   moreover from cover have "S \<subseteq> \<Union>(C \<union> {- T})"
 | 
| 63494 | 2515 | by auto | 
| 64845 | 2516 |   ultimately have "\<exists>D\<subseteq>C \<union> {- T}. finite D \<and> S \<subseteq> \<Union>D"
 | 
| 69529 | 2517 | using \<open>compact S\<close> unfolding compact_eq_Heine_Borel by auto | 
| 64845 | 2518 |   then obtain D where "D \<subseteq> C \<union> {- T} \<and> finite D \<and> S \<subseteq> \<Union>D" ..
 | 
| 2519 | then show "\<exists>D\<subseteq>C. finite D \<and> S \<inter> T \<subseteq> \<Union>D" | |
| 2520 |     by (intro exI[of _ "D - {-T}"]) auto
 | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2521 | qed | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2522 | |
| 64845 | 2523 | lemma compact_diff: "\<lbrakk>compact S; open T\<rbrakk> \<Longrightarrow> compact(S - T)" | 
| 2524 | by (simp add: Diff_eq compact_Int_closed open_closed) | |
| 2525 | ||
| 54797 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2526 | lemma inj_setminus: "inj_on uminus (A::'a set set)" | 
| 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2527 | by (auto simp: inj_on_def) | 
| 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2528 | |
| 63494 | 2529 | |
| 2530 | subsection \<open>Finite intersection property\<close> | |
| 63301 | 2531 | |
| 54797 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2532 | lemma compact_fip: | 
| 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2533 | "compact U \<longleftrightarrow> | 
| 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2534 |     (\<forall>A. (\<forall>a\<in>A. closed a) \<longrightarrow> (\<forall>B \<subseteq> A. finite B \<longrightarrow> U \<inter> \<Inter>B \<noteq> {}) \<longrightarrow> U \<inter> \<Inter>A \<noteq> {})"
 | 
| 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2535 | (is "_ \<longleftrightarrow> ?R") | 
| 69529 | 2536 | proof (safe intro!: compact_eq_Heine_Borel[THEN iffD2]) | 
| 54797 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2537 | fix A | 
| 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2538 | assume "compact U" | 
| 63494 | 2539 |   assume A: "\<forall>a\<in>A. closed a" "U \<inter> \<Inter>A = {}"
 | 
| 2540 |   assume fin: "\<forall>B \<subseteq> A. finite B \<longrightarrow> U \<inter> \<Inter>B \<noteq> {}"
 | |
| 54797 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2541 | from A have "(\<forall>a\<in>uminus`A. open a) \<and> U \<subseteq> \<Union>(uminus`A)" | 
| 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2542 | by auto | 
| 60758 | 2543 | with \<open>compact U\<close> obtain B where "B \<subseteq> A" "finite (uminus`B)" "U \<subseteq> \<Union>(uminus`B)" | 
| 69529 | 2544 | unfolding compact_eq_Heine_Borel by (metis subset_image_iff) | 
| 63494 | 2545 | with fin[THEN spec, of B] show False | 
| 54797 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2546 | by (auto dest: finite_imageD intro: inj_setminus) | 
| 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2547 | next | 
| 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2548 | fix A | 
| 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2549 | assume ?R | 
| 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2550 | assume "\<forall>a\<in>A. open a" "U \<subseteq> \<Union>A" | 
| 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2551 |   then have "U \<inter> \<Inter>(uminus`A) = {}" "\<forall>a\<in>uminus`A. closed a"
 | 
| 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2552 | by auto | 
| 60758 | 2553 |   with \<open>?R\<close> obtain B where "B \<subseteq> A" "finite (uminus`B)" "U \<inter> \<Inter>(uminus`B) = {}"
 | 
| 54797 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2554 | by (metis subset_image_iff) | 
| 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2555 | then show "\<exists>T\<subseteq>A. finite T \<and> U \<subseteq> \<Union>T" | 
| 63494 | 2556 | by (auto intro!: exI[of _ B] inj_setminus dest: finite_imageD) | 
| 54797 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2557 | qed | 
| 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2558 | |
| 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2559 | lemma compact_imp_fip: | 
| 63494 | 2560 | assumes "compact S" | 
| 2561 | and "\<And>T. T \<in> F \<Longrightarrow> closed T" | |
| 2562 |     and "\<And>F'. finite F' \<Longrightarrow> F' \<subseteq> F \<Longrightarrow> S \<inter> (\<Inter>F') \<noteq> {}"
 | |
| 2563 |   shows "S \<inter> (\<Inter>F) \<noteq> {}"
 | |
| 2564 | using assms unfolding compact_fip by auto | |
| 54797 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2565 | |
| 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2566 | lemma compact_imp_fip_image: | 
| 56166 | 2567 | assumes "compact s" | 
| 2568 | and P: "\<And>i. i \<in> I \<Longrightarrow> closed (f i)" | |
| 2569 |     and Q: "\<And>I'. finite I' \<Longrightarrow> I' \<subseteq> I \<Longrightarrow> (s \<inter> (\<Inter>i\<in>I'. f i) \<noteq> {})"
 | |
| 2570 |   shows "s \<inter> (\<Inter>i\<in>I. f i) \<noteq> {}"
 | |
| 2571 | proof - | |
| 74668 | 2572 | from P have "\<forall>i \<in> f ` I. closed i" | 
| 63494 | 2573 | by blast | 
| 56166 | 2574 |   moreover have "\<forall>A. finite A \<and> A \<subseteq> f ` I \<longrightarrow> (s \<inter> (\<Inter>A) \<noteq> {})"
 | 
| 74668 | 2575 | by (metis Q finite_subset_image) | 
| 2576 |   ultimately show "s \<inter> (\<Inter>(f ` I)) \<noteq> {}"
 | |
| 2577 | by (metis \<open>compact s\<close> compact_imp_fip) | |
| 56166 | 2578 | qed | 
| 54797 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2579 | |
| 51471 | 2580 | end | 
| 2581 | ||
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2582 | lemma (in t2_space) compact_imp_closed: | 
| 63494 | 2583 | assumes "compact s" | 
| 2584 | shows "closed s" | |
| 2585 | unfolding closed_def | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2586 | proof (rule openI) | 
| 63494 | 2587 | fix y | 
| 2588 | assume "y \<in> - s" | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2589 |   let ?C = "\<Union>x\<in>s. {u. open u \<and> x \<in> u \<and> eventually (\<lambda>y. y \<notin> u) (nhds y)}"
 | 
| 64758 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 2590 | have "s \<subseteq> \<Union>?C" | 
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2591 | proof | 
| 63494 | 2592 | fix x | 
| 2593 | assume "x \<in> s" | |
| 60758 | 2594 | with \<open>y \<in> - s\<close> have "x \<noteq> y" by clarsimp | 
| 63494 | 2595 |     then have "\<exists>u v. open u \<and> open v \<and> x \<in> u \<and> y \<in> v \<and> u \<inter> v = {}"
 | 
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2596 | by (rule hausdorff) | 
| 60758 | 2597 | with \<open>x \<in> s\<close> show "x \<in> \<Union>?C" | 
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2598 | unfolding eventually_nhds by auto | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2599 | qed | 
| 64758 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 2600 | then obtain D where "D \<subseteq> ?C" and "finite D" and "s \<subseteq> \<Union>D" | 
| 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 2601 | by (rule compactE [OF \<open>compact s\<close>]) auto | 
| 63494 | 2602 | from \<open>D \<subseteq> ?C\<close> have "\<forall>x\<in>D. eventually (\<lambda>y. y \<notin> x) (nhds y)" | 
| 2603 | by auto | |
| 60758 | 2604 | with \<open>finite D\<close> have "eventually (\<lambda>y. y \<notin> \<Union>D) (nhds y)" | 
| 60040 
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
 hoelzl parents: 
60036diff
changeset | 2605 | by (simp add: eventually_ball_finite) | 
| 60758 | 2606 | with \<open>s \<subseteq> \<Union>D\<close> have "eventually (\<lambda>y. y \<notin> s) (nhds y)" | 
| 61810 | 2607 | by (auto elim!: eventually_mono) | 
| 63494 | 2608 | then show "\<exists>t. open t \<and> y \<in> t \<and> t \<subseteq> - s" | 
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2609 | by (simp add: eventually_nhds subset_eq) | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2610 | qed | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2611 | |
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2612 | lemma compact_continuous_image: | 
| 63494 | 2613 | assumes f: "continuous_on s f" | 
| 2614 | and s: "compact s" | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2615 | shows "compact (f ` s)" | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2616 | proof (rule compactI) | 
| 63494 | 2617 | fix C | 
| 2618 | assume "\<forall>c\<in>C. open c" and cover: "f`s \<subseteq> \<Union>C" | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2619 | with f have "\<forall>c\<in>C. \<exists>A. open A \<and> A \<inter> s = f -` c \<inter> s" | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2620 | unfolding continuous_on_open_invariant by blast | 
| 53381 | 2621 | then obtain A where A: "\<forall>c\<in>C. open (A c) \<and> A c \<inter> s = f -` c \<inter> s" | 
| 2622 | unfolding bchoice_iff .. | |
| 65583 
8d53b3bebab4
Further new material. The simprule status of some exp and ln identities was reverted.
 paulson <lp15@cam.ac.uk> parents: 
65204diff
changeset | 2623 | with cover have "\<And>c. c \<in> C \<Longrightarrow> open (A c)" "s \<subseteq> (\<Union>c\<in>C. A c)" | 
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2624 | by (fastforce simp add: subset_eq set_eq_iff)+ | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2625 | from compactE_image[OF s this] obtain D where "D \<subseteq> C" "finite D" "s \<subseteq> (\<Union>c\<in>D. A c)" . | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2626 | with A show "\<exists>D \<subseteq> C. finite D \<and> f`s \<subseteq> \<Union>D" | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2627 | by (intro exI[of _ D]) (fastforce simp add: subset_eq set_eq_iff)+ | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2628 | qed | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2629 | |
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2630 | lemma continuous_on_inv: | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2631 | fixes f :: "'a::topological_space \<Rightarrow> 'b::t2_space" | 
| 63494 | 2632 | assumes "continuous_on s f" | 
| 2633 | and "compact s" | |
| 2634 | and "\<forall>x\<in>s. g (f x) = x" | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2635 | shows "continuous_on (f ` s) g" | 
| 63494 | 2636 | unfolding continuous_on_topological | 
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2637 | proof (clarsimp simp add: assms(3)) | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2638 | fix x :: 'a and B :: "'a set" | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2639 | assume "x \<in> s" and "open B" and "x \<in> B" | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2640 | have 1: "\<forall>x\<in>s. f x \<in> f ` (s - B) \<longleftrightarrow> x \<in> s - B" | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2641 | using assms(3) by (auto, metis) | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2642 | have "continuous_on (s - B) f" | 
| 60758 | 2643 | using \<open>continuous_on s f\<close> Diff_subset | 
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2644 | by (rule continuous_on_subset) | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2645 | moreover have "compact (s - B)" | 
| 60758 | 2646 | using \<open>open B\<close> and \<open>compact s\<close> | 
| 62843 
313d3b697c9a
Mostly renaming (from HOL Light to Isabelle conventions), with a couple of new results
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2647 | unfolding Diff_eq by (intro compact_Int_closed closed_Compl) | 
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2648 | ultimately have "compact (f ` (s - B))" | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2649 | by (rule compact_continuous_image) | 
| 63494 | 2650 | then have "closed (f ` (s - B))" | 
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2651 | by (rule compact_imp_closed) | 
| 63494 | 2652 | then have "open (- f ` (s - B))" | 
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2653 | by (rule open_Compl) | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2654 | moreover have "f x \<in> - f ` (s - B)" | 
| 60758 | 2655 | using \<open>x \<in> s\<close> and \<open>x \<in> B\<close> by (simp add: 1) | 
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2656 | moreover have "\<forall>y\<in>s. f y \<in> - f ` (s - B) \<longrightarrow> y \<in> B" | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2657 | by (simp add: 1) | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2658 | ultimately show "\<exists>A. open A \<and> f x \<in> A \<and> (\<forall>y\<in>s. f y \<in> A \<longrightarrow> y \<in> B)" | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2659 | by fast | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2660 | qed | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2661 | |
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2662 | lemma continuous_on_inv_into: | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2663 | fixes f :: "'a::topological_space \<Rightarrow> 'b::t2_space" | 
| 63494 | 2664 | assumes s: "continuous_on s f" "compact s" | 
| 2665 | and f: "inj_on f s" | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2666 | shows "continuous_on (f ` s) (the_inv_into s f)" | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2667 | by (rule continuous_on_inv[OF s]) (auto simp: the_inv_into_f_f[OF f]) | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2668 | |
| 51479 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2669 | lemma (in linorder_topology) compact_attains_sup: | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2670 |   assumes "compact S" "S \<noteq> {}"
 | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2671 | shows "\<exists>s\<in>S. \<forall>t\<in>S. t \<le> s" | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2672 | proof (rule classical) | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2673 | assume "\<not> (\<exists>s\<in>S. \<forall>t\<in>S. t \<le> s)" | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2674 | then obtain t where t: "\<forall>s\<in>S. t s \<in> S" and "\<forall>s\<in>S. s < t s" | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2675 | by (metis not_le) | 
| 65583 
8d53b3bebab4
Further new material. The simprule status of some exp and ln identities was reverted.
 paulson <lp15@cam.ac.uk> parents: 
65204diff
changeset | 2676 |   then have "\<And>s. s\<in>S \<Longrightarrow> open {..< t s}" "S \<subseteq> (\<Union>s\<in>S. {..< t s})"
 | 
| 51479 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2677 | by auto | 
| 60758 | 2678 |   with \<open>compact S\<close> obtain C where "C \<subseteq> S" "finite C" and C: "S \<subseteq> (\<Union>s\<in>C. {..< t s})"
 | 
| 65583 
8d53b3bebab4
Further new material. The simprule status of some exp and ln identities was reverted.
 paulson <lp15@cam.ac.uk> parents: 
65204diff
changeset | 2679 | by (metis compactE_image) | 
| 60758 | 2680 |   with \<open>S \<noteq> {}\<close> have Max: "Max (t`C) \<in> t`C" and "\<forall>s\<in>t`C. s \<le> Max (t`C)"
 | 
| 51479 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2681 | by (auto intro!: Max_in) | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2682 |   with C have "S \<subseteq> {..< Max (t`C)}"
 | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2683 | by (auto intro: less_le_trans simp: subset_eq) | 
| 60758 | 2684 | with t Max \<open>C \<subseteq> S\<close> show ?thesis | 
| 51479 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2685 | by fastforce | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2686 | qed | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2687 | |
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2688 | lemma (in linorder_topology) compact_attains_inf: | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2689 |   assumes "compact S" "S \<noteq> {}"
 | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2690 | shows "\<exists>s\<in>S. \<forall>t\<in>S. s \<le> t" | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2691 | proof (rule classical) | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2692 | assume "\<not> (\<exists>s\<in>S. \<forall>t\<in>S. s \<le> t)" | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2693 | then obtain t where t: "\<forall>s\<in>S. t s \<in> S" and "\<forall>s\<in>S. t s < s" | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2694 | by (metis not_le) | 
| 65583 
8d53b3bebab4
Further new material. The simprule status of some exp and ln identities was reverted.
 paulson <lp15@cam.ac.uk> parents: 
65204diff
changeset | 2695 |   then have "\<And>s. s\<in>S \<Longrightarrow> open {t s <..}" "S \<subseteq> (\<Union>s\<in>S. {t s <..})"
 | 
| 51479 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2696 | by auto | 
| 60758 | 2697 |   with \<open>compact S\<close> obtain C where "C \<subseteq> S" "finite C" and C: "S \<subseteq> (\<Union>s\<in>C. {t s <..})"
 | 
| 65583 
8d53b3bebab4
Further new material. The simprule status of some exp and ln identities was reverted.
 paulson <lp15@cam.ac.uk> parents: 
65204diff
changeset | 2698 | by (metis compactE_image) | 
| 60758 | 2699 |   with \<open>S \<noteq> {}\<close> have Min: "Min (t`C) \<in> t`C" and "\<forall>s\<in>t`C. Min (t`C) \<le> s"
 | 
| 51479 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2700 | by (auto intro!: Min_in) | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2701 |   with C have "S \<subseteq> {Min (t`C) <..}"
 | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2702 | by (auto intro: le_less_trans simp: subset_eq) | 
| 60758 | 2703 | with t Min \<open>C \<subseteq> S\<close> show ?thesis | 
| 51479 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2704 | by fastforce | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2705 | qed | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2706 | |
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2707 | lemma continuous_attains_sup: | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2708 | fixes f :: "'a::topological_space \<Rightarrow> 'b::linorder_topology" | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2709 |   shows "compact s \<Longrightarrow> s \<noteq> {} \<Longrightarrow> continuous_on s f \<Longrightarrow> (\<exists>x\<in>s. \<forall>y\<in>s.  f y \<le> f x)"
 | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2710 | using compact_attains_sup[of "f ` s"] compact_continuous_image[of s f] by auto | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2711 | |
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2712 | lemma continuous_attains_inf: | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2713 | fixes f :: "'a::topological_space \<Rightarrow> 'b::linorder_topology" | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2714 |   shows "compact s \<Longrightarrow> s \<noteq> {} \<Longrightarrow> continuous_on s f \<Longrightarrow> (\<exists>x\<in>s. \<forall>y\<in>s. f x \<le> f y)"
 | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2715 | using compact_attains_inf[of "f ` s"] compact_continuous_image[of s f] by auto | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2716 | |
| 63494 | 2717 | |
| 60758 | 2718 | subsection \<open>Connectedness\<close> | 
| 51480 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2719 | |
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2720 | context topological_space | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2721 | begin | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2722 | |
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2723 | definition "connected S \<longleftrightarrow> | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2724 |   \<not> (\<exists>A B. open A \<and> open B \<and> S \<subseteq> A \<union> B \<and> A \<inter> B \<inter> S = {} \<and> A \<inter> S \<noteq> {} \<and> B \<inter> S \<noteq> {})"
 | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2725 | |
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2726 | lemma connectedI: | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2727 |   "(\<And>A B. open A \<Longrightarrow> open B \<Longrightarrow> A \<inter> U \<noteq> {} \<Longrightarrow> B \<inter> U \<noteq> {} \<Longrightarrow> A \<inter> B \<inter> U = {} \<Longrightarrow> U \<subseteq> A \<union> B \<Longrightarrow> False)
 | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2728 | \<Longrightarrow> connected U" | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2729 | by (auto simp: connected_def) | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2730 | |
| 61306 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2731 | lemma connected_empty [simp]: "connected {}"
 | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2732 | by (auto intro!: connectedI) | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2733 | |
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2734 | lemma connected_sing [simp]: "connected {x}"
 | 
| 51480 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2735 | by (auto intro!: connectedI) | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2736 | |
| 56329 | 2737 | lemma connectedD: | 
| 62102 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 hoelzl parents: 
62101diff
changeset | 2738 |   "connected A \<Longrightarrow> open U \<Longrightarrow> open V \<Longrightarrow> U \<inter> V \<inter> A = {} \<Longrightarrow> A \<subseteq> U \<union> V \<Longrightarrow> U \<inter> A = {} \<or> V \<inter> A = {}"
 | 
| 56329 | 2739 | by (auto simp: connected_def) | 
| 2740 | ||
| 51479 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2741 | end | 
| 
33db4b7189af
move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
 hoelzl parents: 
51478diff
changeset | 2742 | |
| 61306 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2743 | lemma connected_closed: | 
| 63494 | 2744 | "connected s \<longleftrightarrow> | 
| 2745 |     \<not> (\<exists>A B. closed A \<and> closed B \<and> s \<subseteq> A \<union> B \<and> A \<inter> B \<inter> s = {} \<and> A \<inter> s \<noteq> {} \<and> B \<inter> s \<noteq> {})"
 | |
| 2746 | apply (simp add: connected_def del: ex_simps, safe) | |
| 2747 | apply (drule_tac x="-A" in spec) | |
| 2748 | apply (drule_tac x="-B" in spec) | |
| 2749 | apply (fastforce simp add: closed_def [symmetric]) | |
| 2750 | apply (drule_tac x="-A" in spec) | |
| 2751 | apply (drule_tac x="-B" in spec) | |
| 2752 | apply (fastforce simp add: open_closed [symmetric]) | |
| 2753 | done | |
| 61306 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2754 | |
| 62397 
5ae24f33d343
Substantial new material for multivariate analysis. Also removal of some duplicates.
 paulson <lp15@cam.ac.uk> parents: 
62381diff
changeset | 2755 | lemma connected_closedD: | 
| 63494 | 2756 |   "\<lbrakk>connected s; A \<inter> B \<inter> s = {}; s \<subseteq> A \<union> B; closed A; closed B\<rbrakk> \<Longrightarrow> A \<inter> s = {} \<or> B \<inter> s = {}"
 | 
| 2757 | by (simp add: connected_closed) | |
| 61306 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2758 | |
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2759 | lemma connected_Union: | 
| 63494 | 2760 | assumes cs: "\<And>s. s \<in> S \<Longrightarrow> connected s" | 
| 2761 |     and ne: "\<Inter>S \<noteq> {}"
 | |
| 2762 | shows "connected(\<Union>S)" | |
| 61306 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2763 | proof (rule connectedI) | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2764 | fix A B | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2765 |   assume A: "open A" and B: "open B" and Alap: "A \<inter> \<Union>S \<noteq> {}" and Blap: "B \<inter> \<Union>S \<noteq> {}"
 | 
| 63494 | 2766 |     and disj: "A \<inter> B \<inter> \<Union>S = {}" and cover: "\<Union>S \<subseteq> A \<union> B"
 | 
| 61306 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2767 |   have disjs:"\<And>s. s \<in> S \<Longrightarrow> A \<inter> B \<inter> s = {}"
 | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2768 | using disj by auto | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2769 |   obtain sa where sa: "sa \<in> S" "A \<inter> sa \<noteq> {}"
 | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2770 | using Alap by auto | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2771 |   obtain sb where sb: "sb \<in> S" "B \<inter> sb \<noteq> {}"
 | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2772 | using Blap by auto | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2773 | obtain x where x: "\<And>s. s \<in> S \<Longrightarrow> x \<in> s" | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2774 | using ne by auto | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2775 | then have "x \<in> \<Union>S" | 
| 61342 | 2776 | using \<open>sa \<in> S\<close> by blast | 
| 61306 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2777 | then have "x \<in> A \<or> x \<in> B" | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2778 | using cover by auto | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2779 | then show False | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2780 | using cs [unfolded connected_def] | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2781 | by (metis A B IntI Sup_upper sa sb disjs x cover empty_iff subset_trans) | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2782 | qed | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2783 | |
| 63494 | 2784 | lemma connected_Un: "connected s \<Longrightarrow> connected t \<Longrightarrow> s \<inter> t \<noteq> {} \<Longrightarrow> connected (s \<union> t)"
 | 
| 61306 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2785 |   using connected_Union [of "{s,t}"] by auto
 | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2786 | |
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2787 | lemma connected_diff_open_from_closed: | 
| 63494 | 2788 | assumes st: "s \<subseteq> t" | 
| 2789 | and tu: "t \<subseteq> u" | |
| 2790 | and s: "open s" | |
| 2791 | and t: "closed t" | |
| 2792 | and u: "connected u" | |
| 2793 | and ts: "connected (t - s)" | |
| 61306 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2794 | shows "connected(u - s)" | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2795 | proof (rule connectedI) | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2796 | fix A B | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2797 |   assume AB: "open A" "open B" "A \<inter> (u - s) \<noteq> {}" "B \<inter> (u - s) \<noteq> {}"
 | 
| 63494 | 2798 |     and disj: "A \<inter> B \<inter> (u - s) = {}"
 | 
| 2799 | and cover: "u - s \<subseteq> A \<union> B" | |
| 61306 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2800 |   then consider "A \<inter> (t - s) = {}" | "B \<inter> (t - s) = {}"
 | 
| 63494 | 2801 | using st ts tu connectedD [of "t-s" "A" "B"] by auto | 
| 61306 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2802 | then show False | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2803 | proof cases | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2804 | case 1 | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2805 |     then have "(A - t) \<inter> (B \<union> s) \<inter> u = {}"
 | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2806 | using disj st by auto | 
| 63494 | 2807 | moreover have "u \<subseteq> (A - t) \<union> (B \<union> s)" | 
| 2808 | using 1 cover by auto | |
| 61306 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2809 | ultimately show False | 
| 63494 | 2810 | using connectedD [of u "A - t" "B \<union> s"] AB s t 1 u by auto | 
| 61306 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2811 | next | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2812 | case 2 | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2813 |     then have "(A \<union> s) \<inter> (B - t) \<inter> u = {}"
 | 
| 63494 | 2814 | using disj st by auto | 
| 2815 | moreover have "u \<subseteq> (A \<union> s) \<union> (B - t)" | |
| 2816 | using 2 cover by auto | |
| 61306 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2817 | ultimately show False | 
| 63494 | 2818 | using connectedD [of u "A \<union> s" "B - t"] AB s t 2 u by auto | 
| 61306 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2819 | qed | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2820 | qed | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2821 | |
| 59106 | 2822 | lemma connected_iff_const: | 
| 2823 | fixes S :: "'a::topological_space set" | |
| 2824 | shows "connected S \<longleftrightarrow> (\<forall>P::'a \<Rightarrow> bool. continuous_on S P \<longrightarrow> (\<exists>c. \<forall>s\<in>S. P s = c))" | |
| 2825 | proof safe | |
| 63494 | 2826 | fix P :: "'a \<Rightarrow> bool" | 
| 2827 | assume "connected S" "continuous_on S P" | |
| 59106 | 2828 |   then have "\<And>b. \<exists>A. open A \<and> A \<inter> S = P -` {b} \<inter> S"
 | 
| 62369 | 2829 | unfolding continuous_on_open_invariant by (simp add: open_discrete) | 
| 59106 | 2830 | from this[of True] this[of False] | 
| 2831 |   obtain t f where "open t" "open f" and *: "f \<inter> S = P -` {False} \<inter> S" "t \<inter> S = P -` {True} \<inter> S"
 | |
| 63171 | 2832 | by meson | 
| 59106 | 2833 |   then have "t \<inter> S = {} \<or> f \<inter> S = {}"
 | 
| 60758 | 2834 | by (intro connectedD[OF \<open>connected S\<close>]) auto | 
| 59106 | 2835 | then show "\<exists>c. \<forall>s\<in>S. P s = c" | 
| 2836 | proof (rule disjE) | |
| 63494 | 2837 |     assume "t \<inter> S = {}"
 | 
| 2838 | then show ?thesis | |
| 59106 | 2839 | unfolding * by (intro exI[of _ False]) auto | 
| 2840 | next | |
| 63494 | 2841 |     assume "f \<inter> S = {}"
 | 
| 2842 | then show ?thesis | |
| 59106 | 2843 | unfolding * by (intro exI[of _ True]) auto | 
| 2844 | qed | |
| 2845 | next | |
| 2846 | assume P: "\<forall>P::'a \<Rightarrow> bool. continuous_on S P \<longrightarrow> (\<exists>c. \<forall>s\<in>S. P s = c)" | |
| 2847 | show "connected S" | |
| 2848 | proof (rule connectedI) | |
| 63494 | 2849 | fix A B | 
| 2850 |     assume *: "open A" "open B" "A \<inter> S \<noteq> {}" "B \<inter> S \<noteq> {}" "A \<inter> B \<inter> S = {}" "S \<subseteq> A \<union> B"
 | |
| 59106 | 2851 | have "continuous_on S (\<lambda>x. x \<in> A)" | 
| 2852 | unfolding continuous_on_open_invariant | |
| 2853 | proof safe | |
| 2854 | fix C :: "bool set" | |
| 2855 |       have "C = UNIV \<or> C = {True} \<or> C = {False} \<or> C = {}"
 | |
| 2856 | using subset_UNIV[of C] unfolding UNIV_bool by auto | |
| 2857 | with * show "\<exists>T. open T \<and> T \<inter> S = (\<lambda>x. x \<in> A) -` C \<inter> S" | |
| 2858 |         by (intro exI[of _ "(if True \<in> C then A else {}) \<union> (if False \<in> C then B else {})"]) auto
 | |
| 2859 | qed | |
| 63494 | 2860 | from P[rule_format, OF this] obtain c where "\<And>s. s \<in> S \<Longrightarrow> (s \<in> A) = c" | 
| 2861 | by blast | |
| 59106 | 2862 | with * show False | 
| 2863 | by (cases c) auto | |
| 2864 | qed | |
| 2865 | qed | |
| 2866 | ||
| 63494 | 2867 | lemma connectedD_const: "connected S \<Longrightarrow> continuous_on S P \<Longrightarrow> \<exists>c. \<forall>s\<in>S. P s = c" | 
| 2868 | for P :: "'a::topological_space \<Rightarrow> bool" | |
| 2869 | by (auto simp: connected_iff_const) | |
| 59106 | 2870 | |
| 2871 | lemma connectedI_const: | |
| 2872 | "(\<And>P::'a::topological_space \<Rightarrow> bool. continuous_on S P \<Longrightarrow> \<exists>c. \<forall>s\<in>S. P s = c) \<Longrightarrow> connected S" | |
| 63494 | 2873 | by (auto simp: connected_iff_const) | 
| 59106 | 2874 | |
| 56329 | 2875 | lemma connected_local_const: | 
| 2876 | assumes "connected A" "a \<in> A" "b \<in> A" | |
| 63494 | 2877 | and *: "\<forall>a\<in>A. eventually (\<lambda>b. f a = f b) (at a within A)" | 
| 56329 | 2878 | shows "f a = f b" | 
| 2879 | proof - | |
| 2880 | obtain S where S: "\<And>a. a \<in> A \<Longrightarrow> a \<in> S a" "\<And>a. a \<in> A \<Longrightarrow> open (S a)" | |
| 2881 | "\<And>a x. a \<in> A \<Longrightarrow> x \<in> S a \<Longrightarrow> x \<in> A \<Longrightarrow> f a = f x" | |
| 2882 | using * unfolding eventually_at_topological by metis | |
| 2883 |   let ?P = "\<Union>b\<in>{b\<in>A. f a = f b}. S b" and ?N = "\<Union>b\<in>{b\<in>A. f a \<noteq> f b}. S b"
 | |
| 2884 |   have "?P \<inter> A = {} \<or> ?N \<inter> A = {}"
 | |
| 60758 | 2885 | using \<open>connected A\<close> S \<open>a\<in>A\<close> | 
| 56329 | 2886 | by (intro connectedD) (auto, metis) | 
| 2887 | then show "f a = f b" | |
| 2888 | proof | |
| 2889 |     assume "?N \<inter> A = {}"
 | |
| 2890 | then have "\<forall>x\<in>A. f a = f x" | |
| 2891 | using S(1) by auto | |
| 60758 | 2892 | with \<open>b\<in>A\<close> show ?thesis by auto | 
| 56329 | 2893 | next | 
| 2894 |     assume "?P \<inter> A = {}" then show ?thesis
 | |
| 60758 | 2895 | using \<open>a \<in> A\<close> S(1)[of a] by auto | 
| 56329 | 2896 | qed | 
| 2897 | qed | |
| 2898 | ||
| 51480 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2899 | lemma (in linorder_topology) connectedD_interval: | 
| 63494 | 2900 | assumes "connected U" | 
| 2901 | and xy: "x \<in> U" "y \<in> U" | |
| 2902 | and "x \<le> z" "z \<le> y" | |
| 51480 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2903 | shows "z \<in> U" | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2904 | proof - | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2905 |   have eq: "{..<z} \<union> {z<..} = - {z}"
 | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2906 | by auto | 
| 63494 | 2907 | have "\<not> connected U" if "z \<notin> U" "x < z" "z < y" | 
| 2908 | using xy that | |
| 2909 | apply (simp only: connected_def simp_thms) | |
| 2910 |     apply (rule_tac exI[of _ "{..< z}"])
 | |
| 2911 |     apply (rule_tac exI[of _ "{z <..}"])
 | |
| 2912 | apply (auto simp add: eq) | |
| 2913 | done | |
| 51480 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2914 | with assms show "z \<in> U" | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2915 | by (metis less_le) | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2916 | qed | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2917 | |
| 67685 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2918 | lemma (in linorder_topology) not_in_connected_cases: | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2919 | assumes conn: "connected S" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2920 | assumes nbdd: "x \<notin> S" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2921 |   assumes ne: "S \<noteq> {}"
 | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2922 | obtains "bdd_above S" "\<And>y. y \<in> S \<Longrightarrow> x \<ge> y" | "bdd_below S" "\<And>y. y \<in> S \<Longrightarrow> x \<le> y" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2923 | proof - | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2924 | obtain s where "s \<in> S" using ne by blast | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2925 |   {
 | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2926 | assume "s \<le> x" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2927 | have "False" if "x \<le> y" "y \<in> S" for y | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2928 | using connectedD_interval[OF conn \<open>s \<in> S\<close> \<open>y \<in> S\<close> \<open>s \<le> x\<close> \<open>x \<le> y\<close>] \<open>x \<notin> S\<close> | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2929 | by simp | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2930 | then have wit: "y \<in> S \<Longrightarrow> x \<ge> y" for y | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2931 | using le_cases by blast | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2932 | then have "bdd_above S" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2933 | by (rule local.bdd_aboveI) | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2934 | note this wit | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2935 |   } moreover {
 | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2936 | assume "x \<le> s" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2937 | have "False" if "x \<ge> y" "y \<in> S" for y | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2938 | using connectedD_interval[OF conn \<open>y \<in> S\<close> \<open>s \<in> S\<close> \<open>x \<ge> y\<close> \<open>s \<ge> x\<close> ] \<open>x \<notin> S\<close> | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2939 | by simp | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2940 | then have wit: "y \<in> S \<Longrightarrow> x \<le> y" for y | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2941 | using le_cases by blast | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2942 | then have "bdd_below S" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2943 | by (rule bdd_belowI) | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2944 | note this wit | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2945 | } ultimately show ?thesis | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2946 | by (meson le_cases that) | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2947 | qed | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2948 | |
| 51480 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2949 | lemma connected_continuous_image: | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2950 | assumes *: "continuous_on s f" | 
| 63494 | 2951 | and "connected s" | 
| 51480 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2952 | shows "connected (f ` s)" | 
| 59106 | 2953 | proof (rule connectedI_const) | 
| 63494 | 2954 | fix P :: "'b \<Rightarrow> bool" | 
| 2955 | assume "continuous_on (f ` s) P" | |
| 59106 | 2956 | then have "continuous_on s (P \<circ> f)" | 
| 2957 | by (rule continuous_on_compose[OF *]) | |
| 60758 | 2958 | from connectedD_const[OF \<open>connected s\<close> this] show "\<exists>c. \<forall>s\<in>f ` s. P s = c" | 
| 59106 | 2959 | by auto | 
| 51480 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2960 | qed | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2961 | |
| 77223 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2962 | lemma connected_Un_UN: | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2963 |   assumes "connected A" "\<And>X. X \<in> B \<Longrightarrow> connected X" "\<And>X. X \<in> B \<Longrightarrow> A \<inter> X \<noteq> {}"
 | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2964 | shows "connected (A \<union> \<Union>B)" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2965 | proof (rule connectedI_const) | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2966 | fix f :: "'a \<Rightarrow> bool" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2967 | assume f: "continuous_on (A \<union> \<Union>B) f" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2968 | have "connected A" "continuous_on A f" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2969 | by (auto intro: assms continuous_on_subset[OF f(1)]) | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2970 | from connectedD_const[OF this] obtain c where c: "\<And>x. x \<in> A \<Longrightarrow> f x = c" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2971 | by metis | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2972 | have "f x = c" if "x \<in> X" "X \<in> B" for x X | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2973 | proof - | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2974 | have "connected X" "continuous_on X f" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2975 | using that by (auto intro: assms continuous_on_subset[OF f]) | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2976 | from connectedD_const[OF this] obtain c' where c': "\<And>x. x \<in> X \<Longrightarrow> f x = c'" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2977 | by metis | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2978 | from assms(3) and that obtain y where "y \<in> A \<inter> X" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2979 | by auto | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2980 | with c[of y] c'[of y] c'[of x] that show ?thesis | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2981 | by auto | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2982 | qed | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2983 | with c show "\<exists>c. \<forall>x\<in>A \<union> \<Union> B. f x = c" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2984 | by (intro exI[of _ c]) auto | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2985 | qed | 
| 61306 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2986 | |
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2987 | section \<open>Linear Continuum Topologies\<close> | 
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 2988 | |
| 51775 
408d937c9486
revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
 hoelzl parents: 
51774diff
changeset | 2989 | class linear_continuum_topology = linorder_topology + linear_continuum | 
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 2990 | begin | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 2991 | |
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 2992 | lemma Inf_notin_open: | 
| 63494 | 2993 | assumes A: "open A" | 
| 2994 | and bnd: "\<forall>a\<in>A. x < a" | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 2995 | shows "Inf A \<notin> A" | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 2996 | proof | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 2997 | assume "Inf A \<in> A" | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 2998 |   then obtain b where "b < Inf A" "{b <.. Inf A} \<subseteq> A"
 | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 2999 | using open_left[of A "Inf A" x] assms by auto | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3000 | with dense[of b "Inf A"] obtain c where "c < Inf A" "c \<in> A" | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3001 | by (auto simp: subset_eq) | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3002 | then show False | 
| 63494 | 3003 | using cInf_lower[OF \<open>c \<in> A\<close>] bnd | 
| 3004 | by (metis not_le less_imp_le bdd_belowI) | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3005 | qed | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3006 | |
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3007 | lemma Sup_notin_open: | 
| 63494 | 3008 | assumes A: "open A" | 
| 3009 | and bnd: "\<forall>a\<in>A. a < x" | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3010 | shows "Sup A \<notin> A" | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3011 | proof | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3012 | assume "Sup A \<in> A" | 
| 63494 | 3013 |   with assms obtain b where "Sup A < b" "{Sup A ..< b} \<subseteq> A"
 | 
| 3014 | using open_right[of A "Sup A" x] by auto | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3015 | with dense[of "Sup A" b] obtain c where "Sup A < c" "c \<in> A" | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3016 | by (auto simp: subset_eq) | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3017 | then show False | 
| 63494 | 3018 | using cSup_upper[OF \<open>c \<in> A\<close>] bnd | 
| 3019 | by (metis less_imp_le not_le bdd_aboveI) | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3020 | qed | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3021 | |
| 51480 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 3022 | end | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 3023 | |
| 51775 
408d937c9486
revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
 hoelzl parents: 
51774diff
changeset | 3024 | instance linear_continuum_topology \<subseteq> perfect_space | 
| 
408d937c9486
revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
 hoelzl parents: 
51774diff
changeset | 3025 | proof | 
| 
408d937c9486
revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
 hoelzl parents: 
51774diff
changeset | 3026 | fix x :: 'a | 
| 53381 | 3027 | obtain y where "x < y \<or> y < x" | 
| 3028 | using ex_gt_or_lt [of x] .. | |
| 63494 | 3029 |   with Inf_notin_open[of "{x}" y] Sup_notin_open[of "{x}" y] show "\<not> open {x}"
 | 
| 51775 
408d937c9486
revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
 hoelzl parents: 
51774diff
changeset | 3030 | by auto | 
| 
408d937c9486
revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
 hoelzl parents: 
51774diff
changeset | 3031 | qed | 
| 
408d937c9486
revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
 hoelzl parents: 
51774diff
changeset | 3032 | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3033 | lemma connectedI_interval: | 
| 51775 
408d937c9486
revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
 hoelzl parents: 
51774diff
changeset | 3034 | fixes U :: "'a :: linear_continuum_topology set" | 
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3035 | assumes *: "\<And>x y z. x \<in> U \<Longrightarrow> y \<in> U \<Longrightarrow> x \<le> z \<Longrightarrow> z \<le> y \<Longrightarrow> z \<in> U" | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3036 | shows "connected U" | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3037 | proof (rule connectedI) | 
| 63494 | 3038 |   {
 | 
| 3039 | fix A B | |
| 3040 |     assume "open A" "open B" "A \<inter> B \<inter> U = {}" "U \<subseteq> A \<union> B"
 | |
| 3041 | fix x y | |
| 3042 | assume "x < y" "x \<in> A" "y \<in> B" "x \<in> U" "y \<in> U" | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3043 | |
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3044 |     let ?z = "Inf (B \<inter> {x <..})"
 | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3045 | |
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3046 | have "x \<le> ?z" "?z \<le> y" | 
| 60758 | 3047 | using \<open>y \<in> B\<close> \<open>x < y\<close> by (auto intro: cInf_lower cInf_greatest) | 
| 3048 | with \<open>x \<in> U\<close> \<open>y \<in> U\<close> have "?z \<in> U" | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3049 | by (rule *) | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3050 |     moreover have "?z \<notin> B \<inter> {x <..}"
 | 
| 60758 | 3051 | using \<open>open B\<close> by (intro Inf_notin_open) auto | 
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3052 | ultimately have "?z \<in> A" | 
| 60758 | 3053 |       using \<open>x \<le> ?z\<close> \<open>A \<inter> B \<inter> U = {}\<close> \<open>x \<in> A\<close> \<open>U \<subseteq> A \<union> B\<close> by auto
 | 
| 63494 | 3054 | have "\<exists>b\<in>B. b \<in> A \<and> b \<in> U" if "?z < y" | 
| 3055 | proof - | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3056 |       obtain a where "?z < a" "{?z ..< a} \<subseteq> A"
 | 
| 60758 | 3057 | using open_right[OF \<open>open A\<close> \<open>?z \<in> A\<close> \<open>?z < y\<close>] by auto | 
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3058 | moreover obtain b where "b \<in> B" "x < b" "b < min a y" | 
| 60758 | 3059 |         using cInf_less_iff[of "B \<inter> {x <..}" "min a y"] \<open>?z < a\<close> \<open>?z < y\<close> \<open>x < y\<close> \<open>y \<in> B\<close>
 | 
| 63171 | 3060 | by auto | 
| 53374 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53215diff
changeset | 3061 | moreover have "?z \<le> b" | 
| 60758 | 3062 | using \<open>b \<in> B\<close> \<open>x < b\<close> | 
| 54258 
adfc759263ab
use bdd_above and bdd_below for conditionally complete lattices
 hoelzl parents: 
53946diff
changeset | 3063 | by (intro cInf_lower) auto | 
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3064 | moreover have "b \<in> U" | 
| 60758 | 3065 | using \<open>x \<le> ?z\<close> \<open>?z \<le> b\<close> \<open>b < min a y\<close> | 
| 3066 | by (intro *[OF \<open>x \<in> U\<close> \<open>y \<in> U\<close>]) (auto simp: less_imp_le) | |
| 63494 | 3067 | ultimately show ?thesis | 
| 3068 | by (intro bexI[of _ b]) auto | |
| 3069 | qed | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3070 | then have False | 
| 63494 | 3071 |       using \<open>?z \<le> y\<close> \<open>?z \<in> A\<close> \<open>y \<in> B\<close> \<open>y \<in> U\<close> \<open>A \<inter> B \<inter> U = {}\<close>
 | 
| 3072 | unfolding le_less by blast | |
| 3073 | } | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3074 | note not_disjoint = this | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3075 | |
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3076 |   fix A B assume AB: "open A" "open B" "U \<subseteq> A \<union> B" "A \<inter> B \<inter> U = {}"
 | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3077 |   moreover assume "A \<inter> U \<noteq> {}" then obtain x where x: "x \<in> U" "x \<in> A" by auto
 | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3078 |   moreover assume "B \<inter> U \<noteq> {}" then obtain y where y: "y \<in> U" "y \<in> B" by auto
 | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3079 | moreover note not_disjoint[of B A y x] not_disjoint[of A B x y] | 
| 63494 | 3080 | ultimately show False | 
| 3081 | by (cases x y rule: linorder_cases) auto | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3082 | qed | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3083 | |
| 63494 | 3084 | lemma connected_iff_interval: "connected U \<longleftrightarrow> (\<forall>x\<in>U. \<forall>y\<in>U. \<forall>z. x \<le> z \<longrightarrow> z \<le> y \<longrightarrow> z \<in> U)" | 
| 3085 | for U :: "'a::linear_continuum_topology set" | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3086 | by (auto intro: connectedI_interval dest: connectedD_interval) | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3087 | |
| 51775 
408d937c9486
revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
 hoelzl parents: 
51774diff
changeset | 3088 | lemma connected_UNIV[simp]: "connected (UNIV::'a::linear_continuum_topology set)" | 
| 63494 | 3089 | by (simp add: connected_iff_interval) | 
| 3090 | ||
| 3091 | lemma connected_Ioi[simp]: "connected {a<..}"
 | |
| 3092 | for a :: "'a::linear_continuum_topology" | |
| 3093 | by (auto simp: connected_iff_interval) | |
| 3094 | ||
| 3095 | lemma connected_Ici[simp]: "connected {a..}"
 | |
| 3096 | for a :: "'a::linear_continuum_topology" | |
| 3097 | by (auto simp: connected_iff_interval) | |
| 3098 | ||
| 3099 | lemma connected_Iio[simp]: "connected {..<a}"
 | |
| 3100 | for a :: "'a::linear_continuum_topology" | |
| 3101 | by (auto simp: connected_iff_interval) | |
| 3102 | ||
| 3103 | lemma connected_Iic[simp]: "connected {..a}"
 | |
| 3104 | for a :: "'a::linear_continuum_topology" | |
| 3105 | by (auto simp: connected_iff_interval) | |
| 3106 | ||
| 3107 | lemma connected_Ioo[simp]: "connected {a<..<b}"
 | |
| 3108 | for a b :: "'a::linear_continuum_topology" | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3109 | unfolding connected_iff_interval by auto | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3110 | |
| 63494 | 3111 | lemma connected_Ioc[simp]: "connected {a<..b}"
 | 
| 3112 | for a b :: "'a::linear_continuum_topology" | |
| 3113 | by (auto simp: connected_iff_interval) | |
| 3114 | ||
| 3115 | lemma connected_Ico[simp]: "connected {a..<b}"
 | |
| 3116 | for a b :: "'a::linear_continuum_topology" | |
| 3117 | by (auto simp: connected_iff_interval) | |
| 3118 | ||
| 3119 | lemma connected_Icc[simp]: "connected {a..b}"
 | |
| 3120 | for a b :: "'a::linear_continuum_topology" | |
| 3121 | by (auto simp: connected_iff_interval) | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3122 | |
| 62102 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 hoelzl parents: 
62101diff
changeset | 3123 | lemma connected_contains_Ioo: | 
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3124 | fixes A :: "'a :: linorder_topology set" | 
| 63494 | 3125 |   assumes "connected A" "a \<in> A" "b \<in> A" shows "{a <..< b} \<subseteq> A"
 | 
| 3126 | using connectedD_interval[OF assms] by (simp add: subset_eq Ball_def less_imp_le) | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3127 | |
| 61531 
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
 eberlm parents: 
61520diff
changeset | 3128 | lemma connected_contains_Icc: | 
| 63494 | 3129 | fixes A :: "'a::linorder_topology set" | 
| 3130 | assumes "connected A" "a \<in> A" "b \<in> A" | |
| 3131 |   shows "{a..b} \<subseteq> A"
 | |
| 61531 
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
 eberlm parents: 
61520diff
changeset | 3132 | proof | 
| 
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
 eberlm parents: 
61520diff
changeset | 3133 |   fix x assume "x \<in> {a..b}"
 | 
| 63494 | 3134 |   then have "x = a \<or> x = b \<or> x \<in> {a<..<b}"
 | 
| 3135 | by auto | |
| 3136 | then show "x \<in> A" | |
| 3137 | using assms connected_contains_Ioo[of A a b] by auto | |
| 61531 
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
 eberlm parents: 
61520diff
changeset | 3138 | qed | 
| 
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
 eberlm parents: 
61520diff
changeset | 3139 | |
| 63494 | 3140 | |
| 60758 | 3141 | subsection \<open>Intermediate Value Theorem\<close> | 
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3142 | |
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3143 | lemma IVT': | 
| 63494 | 3144 | fixes f :: "'a::linear_continuum_topology \<Rightarrow> 'b::linorder_topology" | 
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3145 | assumes y: "f a \<le> y" "y \<le> f b" "a \<le> b" | 
| 63494 | 3146 |     and *: "continuous_on {a .. b} f"
 | 
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3147 | shows "\<exists>x. a \<le> x \<and> x \<le> b \<and> f x = y" | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3148 | proof - | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3149 |   have "connected {a..b}"
 | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3150 | unfolding connected_iff_interval by auto | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3151 | from connected_continuous_image[OF * this, THEN connectedD_interval, of "f a" "f b" y] y | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3152 | show ?thesis | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3153 | by (auto simp add: atLeastAtMost_def atLeast_def atMost_def) | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3154 | qed | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3155 | |
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3156 | lemma IVT2': | 
| 51775 
408d937c9486
revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
 hoelzl parents: 
51774diff
changeset | 3157 | fixes f :: "'a :: linear_continuum_topology \<Rightarrow> 'b :: linorder_topology" | 
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3158 | assumes y: "f b \<le> y" "y \<le> f a" "a \<le> b" | 
| 63494 | 3159 |     and *: "continuous_on {a .. b} f"
 | 
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3160 | shows "\<exists>x. a \<le> x \<and> x \<le> b \<and> f x = y" | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3161 | proof - | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3162 |   have "connected {a..b}"
 | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3163 | unfolding connected_iff_interval by auto | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3164 | from connected_continuous_image[OF * this, THEN connectedD_interval, of "f b" "f a" y] y | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3165 | show ?thesis | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3166 | by (auto simp add: atLeastAtMost_def atLeast_def atMost_def) | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3167 | qed | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3168 | |
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3169 | lemma IVT: | 
| 63494 | 3170 | fixes f :: "'a::linear_continuum_topology \<Rightarrow> 'b::linorder_topology" | 
| 3171 | shows "f a \<le> y \<Longrightarrow> y \<le> f b \<Longrightarrow> a \<le> b \<Longrightarrow> (\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> isCont f x) \<Longrightarrow> | |
| 3172 | \<exists>x. a \<le> x \<and> x \<le> b \<and> f x = y" | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3173 | by (rule IVT') (auto intro: continuous_at_imp_continuous_on) | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3174 | |
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3175 | lemma IVT2: | 
| 63494 | 3176 | fixes f :: "'a::linear_continuum_topology \<Rightarrow> 'b::linorder_topology" | 
| 3177 | shows "f b \<le> y \<Longrightarrow> y \<le> f a \<Longrightarrow> a \<le> b \<Longrightarrow> (\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> isCont f x) \<Longrightarrow> | |
| 3178 | \<exists>x. a \<le> x \<and> x \<le> b \<and> f x = y" | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3179 | by (rule IVT2') (auto intro: continuous_at_imp_continuous_on) | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3180 | |
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3181 | lemma continuous_inj_imp_mono: | 
| 63494 | 3182 | fixes f :: "'a::linear_continuum_topology \<Rightarrow> 'b::linorder_topology" | 
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3183 | assumes x: "a < x" "x < b" | 
| 63494 | 3184 |     and cont: "continuous_on {a..b} f"
 | 
| 3185 |     and inj: "inj_on f {a..b}"
 | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3186 | shows "(f a < f x \<and> f x < f b) \<or> (f b < f x \<and> f x < f a)" | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3187 | proof - | 
| 61520 
8f85bb443d33
Cauchy's integral formula, required lemmas, and a bit of reorganisation
 paulson <lp15@cam.ac.uk> parents: 
61426diff
changeset | 3188 | note I = inj_on_eq_iff[OF inj] | 
| 63494 | 3189 |   {
 | 
| 3190 | assume "f x < f a" "f x < f b" | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3191 | then obtain s t where "x \<le> s" "s \<le> b" "a \<le> t" "t \<le> x" "f s = f t" "f x < f s" | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3192 | using IVT'[of f x "min (f a) (f b)" b] IVT2'[of f x "min (f a) (f b)" a] x | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3193 | by (auto simp: continuous_on_subset[OF cont] less_imp_le) | 
| 63494 | 3194 | with x I have False by auto | 
| 3195 | } | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3196 | moreover | 
| 63494 | 3197 |   {
 | 
| 3198 | assume "f a < f x" "f b < f x" | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3199 | then obtain s t where "x \<le> s" "s \<le> b" "a \<le> t" "t \<le> x" "f s = f t" "f s < f x" | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3200 | using IVT'[of f a "max (f a) (f b)" x] IVT2'[of f b "max (f a) (f b)" x] x | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3201 | by (auto simp: continuous_on_subset[OF cont] less_imp_le) | 
| 63494 | 3202 | with x I have False by auto | 
| 3203 | } | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3204 | ultimately show ?thesis | 
| 63494 | 3205 | using I[of a x] I[of x b] x less_trans[OF x] | 
| 3206 | by (auto simp add: le_less less_imp_neq neq_iff) | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3207 | qed | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3208 | |
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3209 | lemma continuous_at_Sup_mono: | 
| 63494 | 3210 |   fixes f :: "'a::{linorder_topology,conditionally_complete_linorder} \<Rightarrow>
 | 
| 3211 |     'b::{linorder_topology,conditionally_complete_linorder}"
 | |
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3212 | assumes "mono f" | 
| 63494 | 3213 | and cont: "continuous (at_left (Sup S)) f" | 
| 3214 |     and S: "S \<noteq> {}" "bdd_above S"
 | |
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3215 | shows "f (Sup S) = (SUP s\<in>S. f s)" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3216 | proof (rule antisym) | 
| 61973 | 3217 | have f: "(f \<longlongrightarrow> f (Sup S)) (at_left (Sup S))" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3218 | using cont unfolding continuous_within . | 
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3219 | show "f (Sup S) \<le> (SUP s\<in>S. f s)" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3220 | proof cases | 
| 63494 | 3221 | assume "Sup S \<in> S" | 
| 3222 | then show ?thesis | |
| 60758 | 3223 | by (rule cSUP_upper) (auto intro: bdd_above_image_mono S \<open>mono f\<close>) | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3224 | next | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3225 | assume "Sup S \<notin> S" | 
| 60758 | 3226 |     from \<open>S \<noteq> {}\<close> obtain s where "s \<in> S"
 | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3227 | by auto | 
| 60758 | 3228 | with \<open>Sup S \<notin> S\<close> S have "s < Sup S" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3229 | unfolding less_le by (blast intro: cSup_upper) | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3230 | show ?thesis | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3231 | proof (rule ccontr) | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3232 | assume "\<not> ?thesis" | 
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3233 | with order_tendstoD(1)[OF f, of "SUP s\<in>S. f s"] obtain b where "b < Sup S" | 
| 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3234 | and *: "\<And>y. b < y \<Longrightarrow> y < Sup S \<Longrightarrow> (SUP s\<in>S. f s) < f y" | 
| 60758 | 3235 | by (auto simp: not_le eventually_at_left[OF \<open>s < Sup S\<close>]) | 
| 3236 |       with \<open>S \<noteq> {}\<close> obtain c where "c \<in> S" "b < c"
 | |
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3237 | using less_cSupD[of S b] by auto | 
| 60758 | 3238 | with \<open>Sup S \<notin> S\<close> S have "c < Sup S" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3239 | unfolding less_le by (blast intro: cSup_upper) | 
| 60758 | 3240 | from *[OF \<open>b < c\<close> \<open>c < Sup S\<close>] cSUP_upper[OF \<open>c \<in> S\<close> bdd_above_image_mono[of f]] | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3241 | show False | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3242 | by (auto simp: assms) | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3243 | qed | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3244 | qed | 
| 60758 | 3245 | qed (intro cSUP_least \<open>mono f\<close>[THEN monoD] cSup_upper S) | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3246 | |
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3247 | lemma continuous_at_Sup_antimono: | 
| 63494 | 3248 |   fixes f :: "'a::{linorder_topology,conditionally_complete_linorder} \<Rightarrow>
 | 
| 3249 |     'b::{linorder_topology,conditionally_complete_linorder}"
 | |
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3250 | assumes "antimono f" | 
| 63494 | 3251 | and cont: "continuous (at_left (Sup S)) f" | 
| 3252 |     and S: "S \<noteq> {}" "bdd_above S"
 | |
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3253 | shows "f (Sup S) = (INF s\<in>S. f s)" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3254 | proof (rule antisym) | 
| 61973 | 3255 | have f: "(f \<longlongrightarrow> f (Sup S)) (at_left (Sup S))" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3256 | using cont unfolding continuous_within . | 
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3257 | show "(INF s\<in>S. f s) \<le> f (Sup S)" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3258 | proof cases | 
| 63494 | 3259 | assume "Sup S \<in> S" | 
| 3260 | then show ?thesis | |
| 60758 | 3261 | by (intro cINF_lower) (auto intro: bdd_below_image_antimono S \<open>antimono f\<close>) | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3262 | next | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3263 | assume "Sup S \<notin> S" | 
| 60758 | 3264 |     from \<open>S \<noteq> {}\<close> obtain s where "s \<in> S"
 | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3265 | by auto | 
| 60758 | 3266 | with \<open>Sup S \<notin> S\<close> S have "s < Sup S" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3267 | unfolding less_le by (blast intro: cSup_upper) | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3268 | show ?thesis | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3269 | proof (rule ccontr) | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3270 | assume "\<not> ?thesis" | 
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3271 | with order_tendstoD(2)[OF f, of "INF s\<in>S. f s"] obtain b where "b < Sup S" | 
| 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3272 | and *: "\<And>y. b < y \<Longrightarrow> y < Sup S \<Longrightarrow> f y < (INF s\<in>S. f s)" | 
| 60758 | 3273 | by (auto simp: not_le eventually_at_left[OF \<open>s < Sup S\<close>]) | 
| 3274 |       with \<open>S \<noteq> {}\<close> obtain c where "c \<in> S" "b < c"
 | |
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3275 | using less_cSupD[of S b] by auto | 
| 60758 | 3276 | with \<open>Sup S \<notin> S\<close> S have "c < Sup S" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3277 | unfolding less_le by (blast intro: cSup_upper) | 
| 60758 | 3278 | from *[OF \<open>b < c\<close> \<open>c < Sup S\<close>] cINF_lower[OF bdd_below_image_antimono, of f S c] \<open>c \<in> S\<close> | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3279 | show False | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3280 | by (auto simp: assms) | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3281 | qed | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3282 | qed | 
| 60758 | 3283 | qed (intro cINF_greatest \<open>antimono f\<close>[THEN antimonoD] cSup_upper S) | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3284 | |
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3285 | lemma continuous_at_Inf_mono: | 
| 63494 | 3286 |   fixes f :: "'a::{linorder_topology,conditionally_complete_linorder} \<Rightarrow>
 | 
| 3287 |     'b::{linorder_topology,conditionally_complete_linorder}"
 | |
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3288 | assumes "mono f" | 
| 63494 | 3289 | and cont: "continuous (at_right (Inf S)) f" | 
| 3290 |     and S: "S \<noteq> {}" "bdd_below S"
 | |
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3291 | shows "f (Inf S) = (INF s\<in>S. f s)" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3292 | proof (rule antisym) | 
| 61973 | 3293 | have f: "(f \<longlongrightarrow> f (Inf S)) (at_right (Inf S))" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3294 | using cont unfolding continuous_within . | 
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3295 | show "(INF s\<in>S. f s) \<le> f (Inf S)" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3296 | proof cases | 
| 63494 | 3297 | assume "Inf S \<in> S" | 
| 3298 | then show ?thesis | |
| 60758 | 3299 | by (rule cINF_lower[rotated]) (auto intro: bdd_below_image_mono S \<open>mono f\<close>) | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3300 | next | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3301 | assume "Inf S \<notin> S" | 
| 60758 | 3302 |     from \<open>S \<noteq> {}\<close> obtain s where "s \<in> S"
 | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3303 | by auto | 
| 60758 | 3304 | with \<open>Inf S \<notin> S\<close> S have "Inf S < s" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3305 | unfolding less_le by (blast intro: cInf_lower) | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3306 | show ?thesis | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3307 | proof (rule ccontr) | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3308 | assume "\<not> ?thesis" | 
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3309 | with order_tendstoD(2)[OF f, of "INF s\<in>S. f s"] obtain b where "Inf S < b" | 
| 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3310 | and *: "\<And>y. Inf S < y \<Longrightarrow> y < b \<Longrightarrow> f y < (INF s\<in>S. f s)" | 
| 60758 | 3311 | by (auto simp: not_le eventually_at_right[OF \<open>Inf S < s\<close>]) | 
| 3312 |       with \<open>S \<noteq> {}\<close> obtain c where "c \<in> S" "c < b"
 | |
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3313 | using cInf_lessD[of S b] by auto | 
| 60758 | 3314 | with \<open>Inf S \<notin> S\<close> S have "Inf S < c" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3315 | unfolding less_le by (blast intro: cInf_lower) | 
| 60758 | 3316 | from *[OF \<open>Inf S < c\<close> \<open>c < b\<close>] cINF_lower[OF bdd_below_image_mono[of f] \<open>c \<in> S\<close>] | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3317 | show False | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3318 | by (auto simp: assms) | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3319 | qed | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3320 | qed | 
| 60758 | 3321 | qed (intro cINF_greatest \<open>mono f\<close>[THEN monoD] cInf_lower \<open>bdd_below S\<close> \<open>S \<noteq> {}\<close>)
 | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3322 | |
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3323 | lemma continuous_at_Inf_antimono: | 
| 63494 | 3324 |   fixes f :: "'a::{linorder_topology,conditionally_complete_linorder} \<Rightarrow>
 | 
| 3325 |     'b::{linorder_topology,conditionally_complete_linorder}"
 | |
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3326 | assumes "antimono f" | 
| 63494 | 3327 | and cont: "continuous (at_right (Inf S)) f" | 
| 3328 |     and S: "S \<noteq> {}" "bdd_below S"
 | |
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3329 | shows "f (Inf S) = (SUP s\<in>S. f s)" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3330 | proof (rule antisym) | 
| 61973 | 3331 | have f: "(f \<longlongrightarrow> f (Inf S)) (at_right (Inf S))" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3332 | using cont unfolding continuous_within . | 
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3333 | show "f (Inf S) \<le> (SUP s\<in>S. f s)" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3334 | proof cases | 
| 63494 | 3335 | assume "Inf S \<in> S" | 
| 3336 | then show ?thesis | |
| 60758 | 3337 | by (rule cSUP_upper) (auto intro: bdd_above_image_antimono S \<open>antimono f\<close>) | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3338 | next | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3339 | assume "Inf S \<notin> S" | 
| 60758 | 3340 |     from \<open>S \<noteq> {}\<close> obtain s where "s \<in> S"
 | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3341 | by auto | 
| 60758 | 3342 | with \<open>Inf S \<notin> S\<close> S have "Inf S < s" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3343 | unfolding less_le by (blast intro: cInf_lower) | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3344 | show ?thesis | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3345 | proof (rule ccontr) | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3346 | assume "\<not> ?thesis" | 
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3347 | with order_tendstoD(1)[OF f, of "SUP s\<in>S. f s"] obtain b where "Inf S < b" | 
| 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3348 | and *: "\<And>y. Inf S < y \<Longrightarrow> y < b \<Longrightarrow> (SUP s\<in>S. f s) < f y" | 
| 60758 | 3349 | by (auto simp: not_le eventually_at_right[OF \<open>Inf S < s\<close>]) | 
| 3350 |       with \<open>S \<noteq> {}\<close> obtain c where "c \<in> S" "c < b"
 | |
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3351 | using cInf_lessD[of S b] by auto | 
| 60758 | 3352 | with \<open>Inf S \<notin> S\<close> S have "Inf S < c" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3353 | unfolding less_le by (blast intro: cInf_lower) | 
| 60758 | 3354 | from *[OF \<open>Inf S < c\<close> \<open>c < b\<close>] cSUP_upper[OF \<open>c \<in> S\<close> bdd_above_image_antimono[of f]] | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3355 | show False | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3356 | by (auto simp: assms) | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3357 | qed | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3358 | qed | 
| 60758 | 3359 | qed (intro cSUP_least \<open>antimono f\<close>[THEN antimonoD] cInf_lower S) | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3360 | |
| 63494 | 3361 | |
| 62101 | 3362 | subsection \<open>Uniform spaces\<close> | 
| 3363 | ||
| 62102 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 hoelzl parents: 
62101diff
changeset | 3364 | class uniformity = | 
| 62101 | 3365 |   fixes uniformity :: "('a \<times> 'a) filter"
 | 
| 3366 | begin | |
| 3367 | ||
| 63494 | 3368 | abbreviation uniformity_on :: "'a set \<Rightarrow> ('a \<times> 'a) filter"
 | 
| 3369 | where "uniformity_on s \<equiv> inf uniformity (principal (s\<times>s))" | |
| 62101 | 3370 | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3371 | end | 
| 62101 | 3372 | |
| 62102 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 hoelzl parents: 
62101diff
changeset | 3373 | lemma uniformity_Abort: | 
| 62123 
df65f5c27c15
setup code generation for filters as suggested by Florian
 hoelzl parents: 
62102diff
changeset | 3374 | "uniformity = | 
| 
df65f5c27c15
setup code generation for filters as suggested by Florian
 hoelzl parents: 
62102diff
changeset | 3375 | Filter.abstract_filter (\<lambda>u. Code.abort (STR ''uniformity is not executable'') (\<lambda>u. uniformity))" | 
| 
df65f5c27c15
setup code generation for filters as suggested by Florian
 hoelzl parents: 
62102diff
changeset | 3376 | by simp | 
| 62102 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 hoelzl parents: 
62101diff
changeset | 3377 | |
| 62101 | 3378 | class open_uniformity = "open" + uniformity + | 
| 63494 | 3379 | assumes open_uniformity: | 
| 3380 | "\<And>U. open U \<longleftrightarrow> (\<forall>x\<in>U. eventually (\<lambda>(x', y). x' = x \<longrightarrow> y \<in> U) uniformity)" | |
| 68064 
b249fab48c76
type class generalisations; some work on infinite products
 paulson <lp15@cam.ac.uk> parents: 
67957diff
changeset | 3381 | begin | 
| 
b249fab48c76
type class generalisations; some work on infinite products
 paulson <lp15@cam.ac.uk> parents: 
67957diff
changeset | 3382 | |
| 
b249fab48c76
type class generalisations; some work on infinite products
 paulson <lp15@cam.ac.uk> parents: 
67957diff
changeset | 3383 | subclass topological_space | 
| 
b249fab48c76
type class generalisations; some work on infinite products
 paulson <lp15@cam.ac.uk> parents: 
67957diff
changeset | 3384 | by standard (force elim: eventually_mono eventually_elim2 simp: split_beta' open_uniformity)+ | 
| 
b249fab48c76
type class generalisations; some work on infinite products
 paulson <lp15@cam.ac.uk> parents: 
67957diff
changeset | 3385 | |
| 
b249fab48c76
type class generalisations; some work on infinite products
 paulson <lp15@cam.ac.uk> parents: 
67957diff
changeset | 3386 | end | 
| 62101 | 3387 | |
| 3388 | class uniform_space = open_uniformity + | |
| 3389 | assumes uniformity_refl: "eventually E uniformity \<Longrightarrow> E (x, x)" | |
| 63494 | 3390 | and uniformity_sym: "eventually E uniformity \<Longrightarrow> eventually (\<lambda>(x, y). E (y, x)) uniformity" | 
| 3391 | and uniformity_trans: | |
| 3392 | "eventually E uniformity \<Longrightarrow> | |
| 3393 | \<exists>D. eventually D uniformity \<and> (\<forall>x y z. D (x, y) \<longrightarrow> D (y, z) \<longrightarrow> E (x, z))" | |
| 62101 | 3394 | begin | 
| 3395 | ||
| 3396 | lemma uniformity_bot: "uniformity \<noteq> bot" | |
| 3397 | using uniformity_refl by auto | |
| 3398 | ||
| 3399 | lemma uniformity_trans': | |
| 63494 | 3400 | "eventually E uniformity \<Longrightarrow> | 
| 3401 | eventually (\<lambda>((x, y), (y', z)). y = y' \<longrightarrow> E (x, z)) (uniformity \<times>\<^sub>F uniformity)" | |
| 62101 | 3402 | by (drule uniformity_trans) (auto simp add: eventually_prod_same) | 
| 3403 | ||
| 3404 | lemma uniformity_transE: | |
| 63494 | 3405 | assumes "eventually E uniformity" | 
| 62101 | 3406 | obtains D where "eventually D uniformity" "\<And>x y z. D (x, y) \<Longrightarrow> D (y, z) \<Longrightarrow> E (x, z)" | 
| 63494 | 3407 | using uniformity_trans [OF assms] by auto | 
| 62101 | 3408 | |
| 3409 | lemma eventually_nhds_uniformity: | |
| 63494 | 3410 | "eventually P (nhds x) \<longleftrightarrow> eventually (\<lambda>(x', y). x' = x \<longrightarrow> P y) uniformity" | 
| 3411 | (is "_ \<longleftrightarrow> ?N P x") | |
| 62101 | 3412 | unfolding eventually_nhds | 
| 3413 | proof safe | |
| 3414 | assume *: "?N P x" | |
| 63494 | 3415 | have "?N (?N P) x" if "?N P x" for x | 
| 3416 | proof - | |
| 3417 | from that obtain D where ev: "eventually D uniformity" | |
| 3418 | and D: "D (a, b) \<Longrightarrow> D (b, c) \<Longrightarrow> case (a, c) of (x', y) \<Rightarrow> x' = x \<longrightarrow> P y" for a b c | |
| 3419 | by (rule uniformity_transE) simp | |
| 3420 | from ev show ?thesis | |
| 3421 | by eventually_elim (insert ev D, force elim: eventually_mono split: prod.split) | |
| 3422 | qed | |
| 62101 | 3423 |   then have "open {x. ?N P x}"
 | 
| 3424 | by (simp add: open_uniformity) | |
| 3425 | then show "\<exists>S. open S \<and> x \<in> S \<and> (\<forall>x\<in>S. P x)" | |
| 3426 |     by (intro exI[of _ "{x. ?N P x}"]) (auto dest: uniformity_refl simp: *)
 | |
| 3427 | qed (force simp add: open_uniformity elim: eventually_mono) | |
| 3428 | ||
| 63494 | 3429 | |
| 62101 | 3430 | subsubsection \<open>Totally bounded sets\<close> | 
| 3431 | ||
| 63494 | 3432 | definition totally_bounded :: "'a set \<Rightarrow> bool" | 
| 3433 | where "totally_bounded S \<longleftrightarrow> | |
| 62101 | 3434 | (\<forall>E. eventually E uniformity \<longrightarrow> (\<exists>X. finite X \<and> (\<forall>s\<in>S. \<exists>x\<in>X. E (x, s))))" | 
| 3435 | ||
| 3436 | lemma totally_bounded_empty[iff]: "totally_bounded {}"
 | |
| 3437 | by (auto simp add: totally_bounded_def) | |
| 3438 | ||
| 3439 | lemma totally_bounded_subset: "totally_bounded S \<Longrightarrow> T \<subseteq> S \<Longrightarrow> totally_bounded T" | |
| 63171 | 3440 | by (fastforce simp add: totally_bounded_def) | 
| 62101 | 3441 | |
| 62102 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 hoelzl parents: 
62101diff
changeset | 3442 | lemma totally_bounded_Union[intro]: | 
| 63494 | 3443 | assumes M: "finite M" "\<And>S. S \<in> M \<Longrightarrow> totally_bounded S" | 
| 3444 | shows "totally_bounded (\<Union>M)" | |
| 62101 | 3445 | unfolding totally_bounded_def | 
| 3446 | proof safe | |
| 63494 | 3447 | fix E | 
| 3448 | assume "eventually E uniformity" | |
| 62101 | 3449 | with M obtain X where "\<forall>S\<in>M. finite (X S) \<and> (\<forall>s\<in>S. \<exists>x\<in>X S. E (x, s))" | 
| 3450 | by (metis totally_bounded_def) | |
| 62175 | 3451 | with \<open>finite M\<close> show "\<exists>X. finite X \<and> (\<forall>s\<in>\<Union>M. \<exists>x\<in>X. E (x, s))" | 
| 62101 | 3452 | by (intro exI[of _ "\<Union>S\<in>M. X S"]) force | 
| 3453 | qed | |
| 3454 | ||
| 63494 | 3455 | |
| 62101 | 3456 | subsubsection \<open>Cauchy filter\<close> | 
| 3457 | ||
| 63494 | 3458 | definition cauchy_filter :: "'a filter \<Rightarrow> bool" | 
| 3459 | where "cauchy_filter F \<longleftrightarrow> F \<times>\<^sub>F F \<le> uniformity" | |
| 3460 | ||
| 3461 | definition Cauchy :: "(nat \<Rightarrow> 'a) \<Rightarrow> bool" | |
| 3462 | where Cauchy_uniform: "Cauchy X = cauchy_filter (filtermap X sequentially)" | |
| 62101 | 3463 | |
| 3464 | lemma Cauchy_uniform_iff: | |
| 3465 | "Cauchy X \<longleftrightarrow> (\<forall>P. eventually P uniformity \<longrightarrow> (\<exists>N. \<forall>n\<ge>N. \<forall>m\<ge>N. P (X n, X m)))" | |
| 3466 | unfolding Cauchy_uniform cauchy_filter_def le_filter_def eventually_prod_same | |
| 3467 | eventually_filtermap eventually_sequentially | |
| 3468 | proof safe | |
| 3469 | let ?U = "\<lambda>P. eventually P uniformity" | |
| 63494 | 3470 |   {
 | 
| 3471 | fix P | |
| 3472 | assume "?U P" "\<forall>P. ?U P \<longrightarrow> (\<exists>Q. (\<exists>N. \<forall>n\<ge>N. Q (X n)) \<and> (\<forall>x y. Q x \<longrightarrow> Q y \<longrightarrow> P (x, y)))" | |
| 62101 | 3473 | then obtain Q N where "\<And>n. n \<ge> N \<Longrightarrow> Q (X n)" "\<And>x y. Q x \<Longrightarrow> Q y \<Longrightarrow> P (x, y)" | 
| 3474 | by metis | |
| 3475 | then show "\<exists>N. \<forall>n\<ge>N. \<forall>m\<ge>N. P (X n, X m)" | |
| 63494 | 3476 | by blast | 
| 3477 | next | |
| 3478 | fix P | |
| 3479 | assume "?U P" and P: "\<forall>P. ?U P \<longrightarrow> (\<exists>N. \<forall>n\<ge>N. \<forall>m\<ge>N. P (X n, X m))" | |
| 62101 | 3480 | then obtain Q where "?U Q" and Q: "\<And>x y z. Q (x, y) \<Longrightarrow> Q (y, z) \<Longrightarrow> P (x, z)" | 
| 3481 | by (auto elim: uniformity_transE) | |
| 3482 | then have "?U (\<lambda>x. Q x \<and> (\<lambda>(x, y). Q (y, x)) x)" | |
| 3483 | unfolding eventually_conj_iff by (simp add: uniformity_sym) | |
| 3484 | from P[rule_format, OF this] | |
| 3485 | obtain N where N: "\<And>n m. n \<ge> N \<Longrightarrow> m \<ge> N \<Longrightarrow> Q (X n, X m) \<and> Q (X m, X n)" | |
| 3486 | by auto | |
| 3487 | show "\<exists>Q. (\<exists>N. \<forall>n\<ge>N. Q (X n)) \<and> (\<forall>x y. Q x \<longrightarrow> Q y \<longrightarrow> P (x, y))" | |
| 3488 | proof (safe intro!: exI[of _ "\<lambda>x. \<forall>n\<ge>N. Q (x, X n) \<and> Q (X n, x)"] exI[of _ N] N) | |
| 63494 | 3489 | fix x y | 
| 3490 | assume "\<forall>n\<ge>N. Q (x, X n) \<and> Q (X n, x)" "\<forall>n\<ge>N. Q (y, X n) \<and> Q (X n, y)" | |
| 62101 | 3491 | then have "Q (x, X N)" "Q (X N, y)" by auto | 
| 3492 | then show "P (x, y)" | |
| 3493 | by (rule Q) | |
| 63494 | 3494 | qed | 
| 3495 | } | |
| 62101 | 3496 | qed | 
| 3497 | ||
| 3498 | lemma nhds_imp_cauchy_filter: | |
| 63494 | 3499 | assumes *: "F \<le> nhds x" | 
| 3500 | shows "cauchy_filter F" | |
| 62101 | 3501 | proof - | 
| 3502 | have "F \<times>\<^sub>F F \<le> nhds x \<times>\<^sub>F nhds x" | |
| 3503 | by (intro prod_filter_mono *) | |
| 3504 | also have "\<dots> \<le> uniformity" | |
| 3505 | unfolding le_filter_def eventually_nhds_uniformity eventually_prod_same | |
| 3506 | proof safe | |
| 63494 | 3507 | fix P | 
| 3508 | assume "eventually P uniformity" | |
| 3509 | then obtain Ql where ev: "eventually Ql uniformity" | |
| 3510 | and "Ql (x, y) \<Longrightarrow> Ql (y, z) \<Longrightarrow> P (x, z)" for x y z | |
| 3511 | by (rule uniformity_transE) simp | |
| 3512 | with ev[THEN uniformity_sym] | |
| 3513 | show "\<exists>Q. eventually (\<lambda>(x', y). x' = x \<longrightarrow> Q y) uniformity \<and> | |
| 3514 | (\<forall>x y. Q x \<longrightarrow> Q y \<longrightarrow> P (x, y))" | |
| 62101 | 3515 | by (rule_tac exI[of _ "\<lambda>y. Ql (y, x) \<and> Ql (x, y)"]) (fastforce elim: eventually_elim2) | 
| 3516 | qed | |
| 3517 | finally show ?thesis | |
| 3518 | by (simp add: cauchy_filter_def) | |
| 3519 | qed | |
| 3520 | ||
| 3521 | lemma LIMSEQ_imp_Cauchy: "X \<longlonglongrightarrow> x \<Longrightarrow> Cauchy X" | |
| 3522 | unfolding Cauchy_uniform filterlim_def by (intro nhds_imp_cauchy_filter) | |
| 3523 | ||
| 63494 | 3524 | lemma Cauchy_subseq_Cauchy: | 
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 3525 | assumes "Cauchy X" "strict_mono f" | 
| 63494 | 3526 | shows "Cauchy (X \<circ> f)" | 
| 62101 | 3527 | unfolding Cauchy_uniform comp_def filtermap_filtermap[symmetric] cauchy_filter_def | 
| 3528 | by (rule order_trans[OF _ \<open>Cauchy X\<close>[unfolded Cauchy_uniform cauchy_filter_def]]) | |
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 3529 | (intro prod_filter_mono filtermap_mono filterlim_subseq[OF \<open>strict_mono f\<close>, unfolded filterlim_def]) | 
| 62101 | 3530 | |
| 3531 | lemma convergent_Cauchy: "convergent X \<Longrightarrow> Cauchy X" | |
| 3532 | unfolding convergent_def by (erule exE, erule LIMSEQ_imp_Cauchy) | |
| 3533 | ||
| 63494 | 3534 | definition complete :: "'a set \<Rightarrow> bool" | 
| 3535 | where complete_uniform: "complete S \<longleftrightarrow> | |
| 3536 | (\<forall>F \<le> principal S. F \<noteq> bot \<longrightarrow> cauchy_filter F \<longrightarrow> (\<exists>x\<in>S. F \<le> nhds x))" | |
| 62101 | 3537 | |
| 75462 
7448423e5dba
Renamed the misleading has_field_derivative_iff_has_vector_derivative. Inserted a number of minor lemmas
 paulson <lp15@cam.ac.uk> parents: 
75243diff
changeset | 3538 | lemma (in uniform_space) cauchy_filter_complete_converges: | 
| 
7448423e5dba
Renamed the misleading has_field_derivative_iff_has_vector_derivative. Inserted a number of minor lemmas
 paulson <lp15@cam.ac.uk> parents: 
75243diff
changeset | 3539 | assumes "cauchy_filter F" "complete A" "F \<le> principal A" "F \<noteq> bot" | 
| 
7448423e5dba
Renamed the misleading has_field_derivative_iff_has_vector_derivative. Inserted a number of minor lemmas
 paulson <lp15@cam.ac.uk> parents: 
75243diff
changeset | 3540 | shows "\<exists>c. F \<le> nhds c" | 
| 
7448423e5dba
Renamed the misleading has_field_derivative_iff_has_vector_derivative. Inserted a number of minor lemmas
 paulson <lp15@cam.ac.uk> parents: 
75243diff
changeset | 3541 | using assms unfolding complete_uniform by blast | 
| 
7448423e5dba
Renamed the misleading has_field_derivative_iff_has_vector_derivative. Inserted a number of minor lemmas
 paulson <lp15@cam.ac.uk> parents: 
75243diff
changeset | 3542 | |
| 62101 | 3543 | end | 
| 3544 | ||
| 3545 | subsubsection \<open>Uniformly continuous functions\<close> | |
| 3546 | ||
| 63494 | 3547 | definition uniformly_continuous_on :: "'a set \<Rightarrow> ('a::uniform_space \<Rightarrow> 'b::uniform_space) \<Rightarrow> bool"
 | 
| 3548 | where uniformly_continuous_on_uniformity: "uniformly_continuous_on s f \<longleftrightarrow> | |
| 62101 | 3549 | (LIM (x, y) (uniformity_on s). (f x, f y) :> uniformity)" | 
| 3550 | ||
| 3551 | lemma uniformly_continuous_onD: | |
| 63494 | 3552 | "uniformly_continuous_on s f \<Longrightarrow> eventually E uniformity \<Longrightarrow> | 
| 3553 | eventually (\<lambda>(x, y). x \<in> s \<longrightarrow> y \<in> s \<longrightarrow> E (f x, f y)) uniformity" | |
| 3554 | by (simp add: uniformly_continuous_on_uniformity filterlim_iff | |
| 3555 | eventually_inf_principal split_beta' mem_Times_iff imp_conjL) | |
| 62101 | 3556 | |
| 3557 | lemma uniformly_continuous_on_const[continuous_intros]: "uniformly_continuous_on s (\<lambda>x. c)" | |
| 3558 | by (auto simp: uniformly_continuous_on_uniformity filterlim_iff uniformity_refl) | |
| 3559 | ||
| 3560 | lemma uniformly_continuous_on_id[continuous_intros]: "uniformly_continuous_on s (\<lambda>x. x)" | |
| 3561 | by (auto simp: uniformly_continuous_on_uniformity filterlim_def) | |
| 3562 | ||
| 76724 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
75462diff
changeset | 3563 | lemma uniformly_continuous_on_compose: | 
| 63494 | 3564 | "uniformly_continuous_on s g \<Longrightarrow> uniformly_continuous_on (g`s) f \<Longrightarrow> | 
| 3565 | uniformly_continuous_on s (\<lambda>x. f (g x))" | |
| 3566 | using filterlim_compose[of "\<lambda>(x, y). (f x, f y)" uniformity | |
| 3567 | "uniformity_on (g`s)" "\<lambda>(x, y). (g x, g y)" "uniformity_on s"] | |
| 3568 | by (simp add: split_beta' uniformly_continuous_on_uniformity | |
| 3569 | filterlim_inf filterlim_principal eventually_inf_principal mem_Times_iff) | |
| 3570 | ||
| 3571 | lemma uniformly_continuous_imp_continuous: | |
| 3572 | assumes f: "uniformly_continuous_on s f" | |
| 3573 | shows "continuous_on s f" | |
| 62101 | 3574 | by (auto simp: filterlim_iff eventually_at_filter eventually_nhds_uniformity continuous_on_def | 
| 3575 | elim: eventually_mono dest!: uniformly_continuous_onD[OF f]) | |
| 3576 | ||
| 63494 | 3577 | |
| 62367 | 3578 | section \<open>Product Topology\<close> | 
| 3579 | ||
| 3580 | subsection \<open>Product is a topological space\<close> | |
| 3581 | ||
| 3582 | instantiation prod :: (topological_space, topological_space) topological_space | |
| 3583 | begin | |
| 3584 | ||
| 3585 | definition open_prod_def[code del]: | |
| 3586 |   "open (S :: ('a \<times> 'b) set) \<longleftrightarrow>
 | |
| 3587 | (\<forall>x\<in>S. \<exists>A B. open A \<and> open B \<and> x \<in> A \<times> B \<and> A \<times> B \<subseteq> S)" | |
| 3588 | ||
| 3589 | lemma open_prod_elim: | |
| 3590 | assumes "open S" and "x \<in> S" | |
| 3591 | obtains A B where "open A" and "open B" and "x \<in> A \<times> B" and "A \<times> B \<subseteq> S" | |
| 63494 | 3592 | using assms unfolding open_prod_def by fast | 
| 62367 | 3593 | |
| 3594 | lemma open_prod_intro: | |
| 3595 | assumes "\<And>x. x \<in> S \<Longrightarrow> \<exists>A B. open A \<and> open B \<and> x \<in> A \<times> B \<and> A \<times> B \<subseteq> S" | |
| 3596 | shows "open S" | |
| 63494 | 3597 | using assms unfolding open_prod_def by fast | 
| 62367 | 3598 | |
| 3599 | instance | |
| 3600 | proof | |
| 3601 |   show "open (UNIV :: ('a \<times> 'b) set)"
 | |
| 3602 | unfolding open_prod_def by auto | |
| 3603 | next | |
| 3604 |   fix S T :: "('a \<times> 'b) set"
 | |
| 3605 | assume "open S" "open T" | |
| 3606 | show "open (S \<inter> T)" | |
| 3607 | proof (rule open_prod_intro) | |
| 63494 | 3608 | fix x | 
| 3609 | assume x: "x \<in> S \<inter> T" | |
| 62367 | 3610 | from x have "x \<in> S" by simp | 
| 3611 | obtain Sa Sb where A: "open Sa" "open Sb" "x \<in> Sa \<times> Sb" "Sa \<times> Sb \<subseteq> S" | |
| 3612 | using \<open>open S\<close> and \<open>x \<in> S\<close> by (rule open_prod_elim) | |
| 3613 | from x have "x \<in> T" by simp | |
| 3614 | obtain Ta Tb where B: "open Ta" "open Tb" "x \<in> Ta \<times> Tb" "Ta \<times> Tb \<subseteq> T" | |
| 3615 | using \<open>open T\<close> and \<open>x \<in> T\<close> by (rule open_prod_elim) | |
| 3616 | let ?A = "Sa \<inter> Ta" and ?B = "Sb \<inter> Tb" | |
| 3617 | have "open ?A \<and> open ?B \<and> x \<in> ?A \<times> ?B \<and> ?A \<times> ?B \<subseteq> S \<inter> T" | |
| 3618 | using A B by (auto simp add: open_Int) | |
| 63494 | 3619 | then show "\<exists>A B. open A \<and> open B \<and> x \<in> A \<times> B \<and> A \<times> B \<subseteq> S \<inter> T" | 
| 62367 | 3620 | by fast | 
| 3621 | qed | |
| 3622 | next | |
| 3623 |   fix K :: "('a \<times> 'b) set set"
 | |
| 63494 | 3624 | assume "\<forall>S\<in>K. open S" | 
| 3625 | then show "open (\<Union>K)" | |
| 62367 | 3626 | unfolding open_prod_def by fast | 
| 3627 | qed | |
| 3628 | ||
| 62101 | 3629 | end | 
| 62367 | 3630 | |
| 63494 | 3631 | declare [[code abort: "open :: ('a::topological_space \<times> 'b::topological_space) set \<Rightarrow> bool"]]
 | 
| 62367 | 3632 | |
| 3633 | lemma open_Times: "open S \<Longrightarrow> open T \<Longrightarrow> open (S \<times> T)" | |
| 63494 | 3634 | unfolding open_prod_def by auto | 
| 62367 | 3635 | |
| 3636 | lemma fst_vimage_eq_Times: "fst -` S = S \<times> UNIV" | |
| 63494 | 3637 | by auto | 
| 62367 | 3638 | |
| 3639 | lemma snd_vimage_eq_Times: "snd -` S = UNIV \<times> S" | |
| 63494 | 3640 | by auto | 
| 62367 | 3641 | |
| 3642 | lemma open_vimage_fst: "open S \<Longrightarrow> open (fst -` S)" | |
| 63494 | 3643 | by (simp add: fst_vimage_eq_Times open_Times) | 
| 62367 | 3644 | |
| 3645 | lemma open_vimage_snd: "open S \<Longrightarrow> open (snd -` S)" | |
| 63494 | 3646 | by (simp add: snd_vimage_eq_Times open_Times) | 
| 62367 | 3647 | |
| 3648 | lemma closed_vimage_fst: "closed S \<Longrightarrow> closed (fst -` S)" | |
| 63494 | 3649 | unfolding closed_open vimage_Compl [symmetric] | 
| 3650 | by (rule open_vimage_fst) | |
| 62367 | 3651 | |
| 3652 | lemma closed_vimage_snd: "closed S \<Longrightarrow> closed (snd -` S)" | |
| 63494 | 3653 | unfolding closed_open vimage_Compl [symmetric] | 
| 3654 | by (rule open_vimage_snd) | |
| 62367 | 3655 | |
| 3656 | lemma closed_Times: "closed S \<Longrightarrow> closed T \<Longrightarrow> closed (S \<times> T)" | |
| 3657 | proof - | |
| 63494 | 3658 | have "S \<times> T = (fst -` S) \<inter> (snd -` T)" | 
| 3659 | by auto | |
| 3660 | then show "closed S \<Longrightarrow> closed T \<Longrightarrow> closed (S \<times> T)" | |
| 62367 | 3661 | by (simp add: closed_vimage_fst closed_vimage_snd closed_Int) | 
| 3662 | qed | |
| 3663 | ||
| 3664 | lemma subset_fst_imageI: "A \<times> B \<subseteq> S \<Longrightarrow> y \<in> B \<Longrightarrow> A \<subseteq> fst ` S" | |
| 3665 | unfolding image_def subset_eq by force | |
| 3666 | ||
| 3667 | lemma subset_snd_imageI: "A \<times> B \<subseteq> S \<Longrightarrow> x \<in> A \<Longrightarrow> B \<subseteq> snd ` S" | |
| 3668 | unfolding image_def subset_eq by force | |
| 3669 | ||
| 63494 | 3670 | lemma open_image_fst: | 
| 3671 | assumes "open S" | |
| 3672 | shows "open (fst ` S)" | |
| 62367 | 3673 | proof (rule openI) | 
| 63494 | 3674 | fix x | 
| 3675 | assume "x \<in> fst ` S" | |
| 3676 | then obtain y where "(x, y) \<in> S" | |
| 3677 | by auto | |
| 62367 | 3678 | then obtain A B where "open A" "open B" "x \<in> A" "y \<in> B" "A \<times> B \<subseteq> S" | 
| 3679 | using \<open>open S\<close> unfolding open_prod_def by auto | |
| 63494 | 3680 | from \<open>A \<times> B \<subseteq> S\<close> \<open>y \<in> B\<close> have "A \<subseteq> fst ` S" | 
| 3681 | by (rule subset_fst_imageI) | |
| 3682 | with \<open>open A\<close> \<open>x \<in> A\<close> have "open A \<and> x \<in> A \<and> A \<subseteq> fst ` S" | |
| 3683 | by simp | |
| 3684 | then show "\<exists>T. open T \<and> x \<in> T \<and> T \<subseteq> fst ` S" .. | |
| 62367 | 3685 | qed | 
| 3686 | ||
| 63494 | 3687 | lemma open_image_snd: | 
| 3688 | assumes "open S" | |
| 3689 | shows "open (snd ` S)" | |
| 62367 | 3690 | proof (rule openI) | 
| 63494 | 3691 | fix y | 
| 3692 | assume "y \<in> snd ` S" | |
| 3693 | then obtain x where "(x, y) \<in> S" | |
| 3694 | by auto | |
| 62367 | 3695 | then obtain A B where "open A" "open B" "x \<in> A" "y \<in> B" "A \<times> B \<subseteq> S" | 
| 3696 | using \<open>open S\<close> unfolding open_prod_def by auto | |
| 63494 | 3697 | from \<open>A \<times> B \<subseteq> S\<close> \<open>x \<in> A\<close> have "B \<subseteq> snd ` S" | 
| 3698 | by (rule subset_snd_imageI) | |
| 3699 | with \<open>open B\<close> \<open>y \<in> B\<close> have "open B \<and> y \<in> B \<and> B \<subseteq> snd ` S" | |
| 3700 | by simp | |
| 3701 | then show "\<exists>T. open T \<and> y \<in> T \<and> T \<subseteq> snd ` S" .. | |
| 62367 | 3702 | qed | 
| 3703 | ||
| 3704 | lemma nhds_prod: "nhds (a, b) = nhds a \<times>\<^sub>F nhds b" | |
| 3705 | unfolding nhds_def | |
| 3706 | proof (subst prod_filter_INF, auto intro!: antisym INF_greatest simp: principal_prod_principal) | |
| 63494 | 3707 | fix S T | 
| 3708 | assume "open S" "a \<in> S" "open T" "b \<in> T" | |
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3709 |   then show "(INF x \<in> {S. open S \<and> (a, b) \<in> S}. principal x) \<le> principal (S \<times> T)"
 | 
| 62367 | 3710 | by (intro INF_lower) (auto intro!: open_Times) | 
| 3711 | next | |
| 63494 | 3712 | fix S' | 
| 3713 | assume "open S'" "(a, b) \<in> S'" | |
| 62367 | 3714 | then obtain S T where "open S" "a \<in> S" "open T" "b \<in> T" "S \<times> T \<subseteq> S'" | 
| 3715 | by (auto elim: open_prod_elim) | |
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3716 |   then show "(INF x \<in> {S. open S \<and> a \<in> S}. INF y \<in> {S. open S \<and> b \<in> S}.
 | 
| 63494 | 3717 | principal (x \<times> y)) \<le> principal S'" | 
| 62367 | 3718 | by (auto intro!: INF_lower2) | 
| 3719 | qed | |
| 3720 | ||
| 63494 | 3721 | |
| 62367 | 3722 | subsubsection \<open>Continuity of operations\<close> | 
| 3723 | ||
| 3724 | lemma tendsto_fst [tendsto_intros]: | |
| 3725 | assumes "(f \<longlongrightarrow> a) F" | |
| 3726 | shows "((\<lambda>x. fst (f x)) \<longlongrightarrow> fst a) F" | |
| 3727 | proof (rule topological_tendstoI) | |
| 63494 | 3728 | fix S | 
| 3729 | assume "open S" and "fst a \<in> S" | |
| 62367 | 3730 | then have "open (fst -` S)" and "a \<in> fst -` S" | 
| 3731 | by (simp_all add: open_vimage_fst) | |
| 3732 | with assms have "eventually (\<lambda>x. f x \<in> fst -` S) F" | |
| 3733 | by (rule topological_tendstoD) | |
| 3734 | then show "eventually (\<lambda>x. fst (f x) \<in> S) F" | |
| 3735 | by simp | |
| 3736 | qed | |
| 3737 | ||
| 3738 | lemma tendsto_snd [tendsto_intros]: | |
| 3739 | assumes "(f \<longlongrightarrow> a) F" | |
| 3740 | shows "((\<lambda>x. snd (f x)) \<longlongrightarrow> snd a) F" | |
| 3741 | proof (rule topological_tendstoI) | |
| 63494 | 3742 | fix S | 
| 3743 | assume "open S" and "snd a \<in> S" | |
| 62367 | 3744 | then have "open (snd -` S)" and "a \<in> snd -` S" | 
| 3745 | by (simp_all add: open_vimage_snd) | |
| 3746 | with assms have "eventually (\<lambda>x. f x \<in> snd -` S) F" | |
| 3747 | by (rule topological_tendstoD) | |
| 3748 | then show "eventually (\<lambda>x. snd (f x) \<in> S) F" | |
| 3749 | by simp | |
| 3750 | qed | |
| 3751 | ||
| 3752 | lemma tendsto_Pair [tendsto_intros]: | |
| 3753 | assumes "(f \<longlongrightarrow> a) F" and "(g \<longlongrightarrow> b) F" | |
| 3754 | shows "((\<lambda>x. (f x, g x)) \<longlongrightarrow> (a, b)) F" | |
| 67957 | 3755 | unfolding nhds_prod using assms by (rule filterlim_Pair) | 
| 62367 | 3756 | |
| 3757 | lemma continuous_fst[continuous_intros]: "continuous F f \<Longrightarrow> continuous F (\<lambda>x. fst (f x))" | |
| 3758 | unfolding continuous_def by (rule tendsto_fst) | |
| 3759 | ||
| 3760 | lemma continuous_snd[continuous_intros]: "continuous F f \<Longrightarrow> continuous F (\<lambda>x. snd (f x))" | |
| 3761 | unfolding continuous_def by (rule tendsto_snd) | |
| 3762 | ||
| 63494 | 3763 | lemma continuous_Pair[continuous_intros]: | 
| 3764 | "continuous F f \<Longrightarrow> continuous F g \<Longrightarrow> continuous F (\<lambda>x. (f x, g x))" | |
| 62367 | 3765 | unfolding continuous_def by (rule tendsto_Pair) | 
| 3766 | ||
| 63494 | 3767 | lemma continuous_on_fst[continuous_intros]: | 
| 3768 | "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. fst (f x))" | |
| 62367 | 3769 | unfolding continuous_on_def by (auto intro: tendsto_fst) | 
| 3770 | ||
| 63494 | 3771 | lemma continuous_on_snd[continuous_intros]: | 
| 3772 | "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. snd (f x))" | |
| 62367 | 3773 | unfolding continuous_on_def by (auto intro: tendsto_snd) | 
| 3774 | ||
| 63494 | 3775 | lemma continuous_on_Pair[continuous_intros]: | 
| 3776 | "continuous_on s f \<Longrightarrow> continuous_on s g \<Longrightarrow> continuous_on s (\<lambda>x. (f x, g x))" | |
| 62367 | 3777 | unfolding continuous_on_def by (auto intro: tendsto_Pair) | 
| 3778 | ||
| 3779 | lemma continuous_on_swap[continuous_intros]: "continuous_on A prod.swap" | |
| 63494 | 3780 | by (simp add: prod.swap_def continuous_on_fst continuous_on_snd | 
| 3781 | continuous_on_Pair continuous_on_id) | |
| 62367 | 3782 | |
| 3783 | lemma continuous_on_swap_args: | |
| 3784 | assumes "continuous_on (A\<times>B) (\<lambda>(x,y). d x y)" | |
| 3785 | shows "continuous_on (B\<times>A) (\<lambda>(x,y). d y x)" | |
| 3786 | proof - | |
| 63494 | 3787 | have "(\<lambda>(x,y). d y x) = (\<lambda>(x,y). d x y) \<circ> prod.swap" | 
| 62367 | 3788 | by force | 
| 3789 | then show ?thesis | |
| 70749 
5d06b7bb9d22
More type class generalisations. Note that linorder_antisym_conv1 and linorder_antisym_conv2 no longer exist.
 paulson <lp15@cam.ac.uk> parents: 
70723diff
changeset | 3790 | by (metis assms continuous_on_compose continuous_on_swap product_swap) | 
| 62367 | 3791 | qed | 
| 3792 | ||
| 3793 | lemma isCont_fst [simp]: "isCont f a \<Longrightarrow> isCont (\<lambda>x. fst (f x)) a" | |
| 3794 | by (fact continuous_fst) | |
| 3795 | ||
| 3796 | lemma isCont_snd [simp]: "isCont f a \<Longrightarrow> isCont (\<lambda>x. snd (f x)) a" | |
| 3797 | by (fact continuous_snd) | |
| 3798 | ||
| 3799 | lemma isCont_Pair [simp]: "\<lbrakk>isCont f a; isCont g a\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. (f x, g x)) a" | |
| 3800 | by (fact continuous_Pair) | |
| 3801 | ||
| 67685 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 3802 | lemma continuous_on_compose_Pair: | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 3803 | assumes f: "continuous_on (Sigma A B) (\<lambda>(a, b). f a b)" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 3804 | assumes g: "continuous_on C g" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 3805 | assumes h: "continuous_on C h" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 3806 | assumes subset: "\<And>c. c \<in> C \<Longrightarrow> g c \<in> A" "\<And>c. c \<in> C \<Longrightarrow> h c \<in> B (g c)" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 3807 | shows "continuous_on C (\<lambda>c. f (g c) (h c))" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 3808 | using continuous_on_compose2[OF f continuous_on_Pair[OF g h]] subset | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 3809 | by auto | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 3810 | |
| 63494 | 3811 | |
| 67577 | 3812 | subsubsection \<open>Connectedness of products\<close> | 
| 3813 | ||
| 3814 | proposition connected_Times: | |
| 3815 | assumes S: "connected S" and T: "connected T" | |
| 3816 | shows "connected (S \<times> T)" | |
| 3817 | proof (rule connectedI_const) | |
| 3818 | fix P::"'a \<times> 'b \<Rightarrow> bool" | |
| 3819 | assume P[THEN continuous_on_compose2, continuous_intros]: "continuous_on (S \<times> T) P" | |
| 3820 | have "continuous_on S (\<lambda>s. P (s, t))" if "t \<in> T" for t | |
| 3821 | by (auto intro!: continuous_intros that) | |
| 3822 | from connectedD_const[OF S this] | |
| 3823 | obtain c1 where c1: "\<And>s t. t \<in> T \<Longrightarrow> s \<in> S \<Longrightarrow> P (s, t) = c1 t" | |
| 3824 | by metis | |
| 3825 | moreover | |
| 3826 | have "continuous_on T (\<lambda>t. P (s, t))" if "s \<in> S" for s | |
| 3827 | by (auto intro!: continuous_intros that) | |
| 3828 | from connectedD_const[OF T this] | |
| 3829 | obtain c2 where "\<And>s t. t \<in> T \<Longrightarrow> s \<in> S \<Longrightarrow> P (s, t) = c2 s" | |
| 3830 | by metis | |
| 3831 | ultimately show "\<exists>c. \<forall>s\<in>S \<times> T. P s = c" | |
| 3832 | by auto | |
| 3833 | qed | |
| 3834 | ||
| 3835 | corollary connected_Times_eq [simp]: | |
| 3836 |    "connected (S \<times> T) \<longleftrightarrow> S = {} \<or> T = {} \<or> connected S \<and> connected T"  (is "?lhs = ?rhs")
 | |
| 3837 | proof | |
| 3838 | assume L: ?lhs | |
| 3839 | show ?rhs | |
| 3840 | proof cases | |
| 3841 |     assume "S \<noteq> {} \<and> T \<noteq> {}"
 | |
| 3842 | moreover | |
| 3843 | have "connected (fst ` (S \<times> T))" "connected (snd ` (S \<times> T))" | |
| 3844 | using continuous_on_fst continuous_on_snd continuous_on_id | |
| 3845 | by (blast intro: connected_continuous_image [OF _ L])+ | |
| 3846 | ultimately show ?thesis | |
| 3847 | by auto | |
| 3848 | qed auto | |
| 3849 | qed (auto simp: connected_Times) | |
| 3850 | ||
| 3851 | ||
| 62367 | 3852 | subsubsection \<open>Separation axioms\<close> | 
| 3853 | ||
| 3854 | instance prod :: (t0_space, t0_space) t0_space | |
| 3855 | proof | |
| 63494 | 3856 | fix x y :: "'a \<times> 'b" | 
| 3857 | assume "x \<noteq> y" | |
| 3858 | then have "fst x \<noteq> fst y \<or> snd x \<noteq> snd y" | |
| 62367 | 3859 | by (simp add: prod_eq_iff) | 
| 63494 | 3860 | then show "\<exists>U. open U \<and> (x \<in> U) \<noteq> (y \<in> U)" | 
| 62367 | 3861 | by (fast dest: t0_space elim: open_vimage_fst open_vimage_snd) | 
| 3862 | qed | |
| 3863 | ||
| 3864 | instance prod :: (t1_space, t1_space) t1_space | |
| 3865 | proof | |
| 63494 | 3866 | fix x y :: "'a \<times> 'b" | 
| 3867 | assume "x \<noteq> y" | |
| 3868 | then have "fst x \<noteq> fst y \<or> snd x \<noteq> snd y" | |
| 62367 | 3869 | by (simp add: prod_eq_iff) | 
| 63494 | 3870 | then show "\<exists>U. open U \<and> x \<in> U \<and> y \<notin> U" | 
| 62367 | 3871 | by (fast dest: t1_space elim: open_vimage_fst open_vimage_snd) | 
| 3872 | qed | |
| 3873 | ||
| 3874 | instance prod :: (t2_space, t2_space) t2_space | |
| 3875 | proof | |
| 63494 | 3876 | fix x y :: "'a \<times> 'b" | 
| 3877 | assume "x \<noteq> y" | |
| 3878 | then have "fst x \<noteq> fst y \<or> snd x \<noteq> snd y" | |
| 62367 | 3879 | by (simp add: prod_eq_iff) | 
| 63494 | 3880 |   then show "\<exists>U V. open U \<and> open V \<and> x \<in> U \<and> y \<in> V \<and> U \<inter> V = {}"
 | 
| 62367 | 3881 | by (fast dest: hausdorff elim: open_vimage_fst open_vimage_snd) | 
| 3882 | qed | |
| 3883 | ||
| 3884 | lemma isCont_swap[continuous_intros]: "isCont prod.swap a" | |
| 3885 | using continuous_on_eq_continuous_within continuous_on_swap by blast | |
| 3886 | ||
| 64284 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3887 | lemma open_diagonal_complement: | 
| 67957 | 3888 |   "open {(x,y) |x y. x \<noteq> (y::('a::t2_space))}"
 | 
| 3889 | proof - | |
| 3890 |   have "open {(x, y). x \<noteq> (y::'a)}"
 | |
| 3891 | unfolding split_def by (intro open_Collect_neq continuous_intros) | |
| 3892 |   also have "{(x, y). x \<noteq> (y::'a)} = {(x, y) |x y. x \<noteq> (y::'a)}"
 | |
| 3893 | by auto | |
| 3894 | finally show ?thesis . | |
| 64284 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3895 | qed | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3896 | |
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3897 | lemma closed_diagonal: | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3898 |   "closed {y. \<exists> x::('a::t2_space). y = (x,x)}"
 | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3899 | proof - | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3900 |   have "{y. \<exists> x::'a. y = (x,x)} = UNIV - {(x,y) | x y. x \<noteq> y}" by auto
 | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3901 | then show ?thesis using open_diagonal_complement closed_Diff by auto | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3902 | qed | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3903 | |
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3904 | lemma open_superdiagonal: | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3905 |   "open {(x,y) | x y. x > (y::'a::{linorder_topology})}"
 | 
| 67957 | 3906 | proof - | 
| 3907 |   have "open {(x, y). x > (y::'a)}"
 | |
| 3908 | unfolding split_def by (intro open_Collect_less continuous_intros) | |
| 3909 |   also have "{(x, y). x > (y::'a)} = {(x, y) |x y. x > (y::'a)}"
 | |
| 3910 | by auto | |
| 3911 | finally show ?thesis . | |
| 64284 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3912 | qed | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3913 | |
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3914 | lemma closed_subdiagonal: | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3915 |   "closed {(x,y) | x y. x \<le> (y::'a::{linorder_topology})}"
 | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3916 | proof - | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3917 |   have "{(x,y) | x y. x \<le> (y::'a)} = UNIV - {(x,y) | x y. x > (y::'a)}" by auto
 | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3918 | then show ?thesis using open_superdiagonal closed_Diff by auto | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3919 | qed | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3920 | |
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3921 | lemma open_subdiagonal: | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3922 |   "open {(x,y) | x y. x < (y::'a::{linorder_topology})}"
 | 
| 67957 | 3923 | proof - | 
| 3924 |   have "open {(x, y). x < (y::'a)}"
 | |
| 3925 | unfolding split_def by (intro open_Collect_less continuous_intros) | |
| 3926 |   also have "{(x, y). x < (y::'a)} = {(x, y) |x y. x < (y::'a)}"
 | |
| 3927 | by auto | |
| 3928 | finally show ?thesis . | |
| 64284 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3929 | qed | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3930 | |
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3931 | lemma closed_superdiagonal: | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3932 |   "closed {(x,y) | x y. x \<ge> (y::('a::{linorder_topology}))}"
 | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3933 | proof - | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3934 |   have "{(x,y) | x y. x \<ge> (y::'a)} = UNIV - {(x,y) | x y. x < y}" by auto
 | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3935 | then show ?thesis using open_subdiagonal closed_Diff by auto | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3936 | qed | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3937 | |
| 62367 | 3938 | end |