| author | paulson | 
| Tue, 11 Jul 2023 20:22:08 +0100 | |
| changeset 78321 | 021fb1b01de5 | 
| parent 78093 | cec875dcc59e | 
| child 78516 | 56a408fa2440 | 
| 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" | 
| 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 | 1079 | by (rule tendsto_Lim[OF _ tendsto_ident_at]) 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 | 1080 | |
| 77223 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1081 | lemma Lim_cong: | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1082 | assumes "eventually (\<lambda>x. f x = g x) F" "F = G" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1083 | shows "Lim F f = Lim G g" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1084 | proof (cases "(\<exists>c. (f \<longlongrightarrow> c) F) \<and> F \<noteq> bot") | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1085 | case True | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1086 | then obtain c where c: "(f \<longlongrightarrow> c) F" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1087 | by blast | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1088 | hence "Lim F f = c" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1089 | using True by (intro tendsto_Lim) auto | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1090 | moreover have "(f \<longlongrightarrow> c) F \<longleftrightarrow> (g \<longlongrightarrow> c) G" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1091 | using assms by (intro filterlim_cong) auto | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1092 | with True c assms have "Lim G g = c" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1093 | by (intro tendsto_Lim) auto | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1094 | ultimately show ?thesis | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1095 | by simp | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1096 | next | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1097 | case False | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1098 | show ?thesis | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1099 | proof (cases "F = bot") | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1100 | case True | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1101 | thus ?thesis using assms | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1102 | by (auto simp: Topological_Spaces.Lim_def) | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1103 | next | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1104 | case False | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1105 | have "(f \<longlongrightarrow> c) F \<longleftrightarrow> (g \<longlongrightarrow> c) G" for c | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1106 | using assms by (intro filterlim_cong) auto | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1107 | thus ?thesis | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1108 | by (auto simp: Topological_Spaces.Lim_def) | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1109 | qed | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1110 | qed | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 1111 | |
| 67685 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 1112 | lemma eventually_Lim_ident_at: | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 1113 | "(\<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 | 1114 | (\<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 | 1115 | 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 | 1116 | |
| 51471 | 1117 | 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 | 1118 | fixes f :: "'a::linorder_topology \<Rightarrow> 'b::linorder" | 
| 51471 | 1119 | assumes mono: "\<And>x y. Q x \<Longrightarrow> Q y \<Longrightarrow> x \<le> y \<Longrightarrow> f x \<le> f y" | 
| 63494 | 1120 | and bij: "\<And>x. P x \<Longrightarrow> f (g x) = x" "\<And>x. P x \<Longrightarrow> Q (g x)" | 
| 1121 | and Q: "eventually Q (at_right a)" | |
| 1122 | and bound: "\<And>b. Q b \<Longrightarrow> a < b" | |
| 1123 | and P: "eventually P at_bot" | |
| 51471 | 1124 | shows "filterlim f at_bot (at_right a)" | 
| 1125 | proof - | |
| 1126 | from P obtain x where x: "\<And>y. y \<le> x \<Longrightarrow> P y" | |
| 1127 | unfolding eventually_at_bot_linorder by auto | |
| 1128 | show ?thesis | |
| 1129 | proof (intro filterlim_at_bot_le[THEN iffD2] allI impI) | |
| 63494 | 1130 | fix z | 
| 1131 | assume "z \<le> x" | |
| 51471 | 1132 | with x have "P z" by auto | 
| 1133 | have "eventually (\<lambda>x. x \<le> g z) (at_right a)" | |
| 60758 | 1134 | using bound[OF bij(2)[OF \<open>P z\<close>]] | 
| 63494 | 1135 | unfolding eventually_at_right[OF bound[OF bij(2)[OF \<open>P z\<close>]]] | 
| 1136 | by (auto intro!: exI[of _ "g z"]) | |
| 51471 | 1137 | with Q show "eventually (\<lambda>x. f x \<le> z) (at_right a)" | 
| 60758 | 1138 | by eventually_elim (metis bij \<open>P z\<close> mono) | 
| 51471 | 1139 | qed | 
| 1140 | qed | |
| 1141 | ||
| 1142 | 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 | 1143 | fixes f :: "'a::linorder_topology \<Rightarrow> 'b::linorder" | 
| 51471 | 1144 | assumes mono: "\<And>x y. Q x \<Longrightarrow> Q y \<Longrightarrow> x \<le> y \<Longrightarrow> f x \<le> f y" | 
| 63494 | 1145 | and bij: "\<And>x. P x \<Longrightarrow> f (g x) = x" "\<And>x. P x \<Longrightarrow> Q (g x)" | 
| 1146 | and Q: "eventually Q (at_left a)" | |
| 1147 | and bound: "\<And>b. Q b \<Longrightarrow> b < a" | |
| 1148 | and P: "eventually P at_top" | |
| 51471 | 1149 | shows "filterlim f at_top (at_left a)" | 
| 1150 | proof - | |
| 1151 | from P obtain x where x: "\<And>y. x \<le> y \<Longrightarrow> P y" | |
| 1152 | unfolding eventually_at_top_linorder by auto | |
| 1153 | show ?thesis | |
| 1154 | proof (intro filterlim_at_top_ge[THEN iffD2] allI impI) | |
| 63494 | 1155 | fix z | 
| 1156 | assume "x \<le> z" | |
| 51471 | 1157 | with x have "P z" by auto | 
| 1158 | have "eventually (\<lambda>x. g z \<le> x) (at_left a)" | |
| 60758 | 1159 | using bound[OF bij(2)[OF \<open>P z\<close>]] | 
| 63494 | 1160 | unfolding eventually_at_left[OF bound[OF bij(2)[OF \<open>P z\<close>]]] | 
| 1161 | by (auto intro!: exI[of _ "g z"]) | |
| 51471 | 1162 | with Q show "eventually (\<lambda>x. z \<le> f x) (at_left a)" | 
| 60758 | 1163 | by eventually_elim (metis bij \<open>P z\<close> mono) | 
| 51471 | 1164 | qed | 
| 1165 | qed | |
| 1166 | ||
| 1167 | lemma filterlim_split_at: | |
| 63494 | 1168 | "filterlim f F (at_left x) \<Longrightarrow> filterlim f F (at_right x) \<Longrightarrow> | 
| 1169 | filterlim f F (at x)" | |
| 1170 | for x :: "'a::linorder_topology" | |
| 51471 | 1171 | by (subst at_eq_sup_left_right) (rule filterlim_sup) | 
| 1172 | ||
| 1173 | lemma filterlim_at_split: | |
| 63494 | 1174 | "filterlim f F (at x) \<longleftrightarrow> filterlim f F (at_left x) \<and> filterlim f F (at_right x)" | 
| 1175 | for x :: "'a::linorder_topology" | |
| 51471 | 1176 | by (subst at_eq_sup_left_right) (simp add: filterlim_def filtermap_sup) | 
| 1177 | ||
| 57025 | 1178 | lemma eventually_nhds_top: | 
| 63494 | 1179 |   fixes P :: "'a :: {order_top,linorder_topology} \<Rightarrow> bool"
 | 
| 1180 | and b :: 'a | |
| 1181 | assumes "b < top" | |
| 57025 | 1182 | shows "eventually P (nhds top) \<longleftrightarrow> (\<exists>b<top. (\<forall>z. b < z \<longrightarrow> P z))" | 
| 1183 | unfolding eventually_nhds | |
| 1184 | proof safe | |
| 63494 | 1185 | fix S :: "'a set" | 
| 1186 | assume "open S" "top \<in> S" | |
| 60758 | 1187 | note open_left[OF this \<open>b < top\<close>] | 
| 57025 | 1188 | moreover assume "\<forall>s\<in>S. P s" | 
| 1189 | ultimately show "\<exists>b<top. \<forall>z>b. P z" | |
| 1190 | by (auto simp: subset_eq Ball_def) | |
| 1191 | next | |
| 63494 | 1192 | fix b | 
| 1193 | assume "b < top" "\<forall>z>b. P z" | |
| 57025 | 1194 | then show "\<exists>S. open S \<and> top \<in> S \<and> (\<forall>xa\<in>S. P xa)" | 
| 1195 |     by (intro exI[of _ "{b <..}"]) auto
 | |
| 1196 | qed | |
| 51471 | 1197 | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1198 | lemma tendsto_at_within_iff_tendsto_nhds: | 
| 61973 | 1199 | "(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 | 1200 | unfolding tendsto_def eventually_at_filter eventually_inf_principal | 
| 61810 | 1201 | 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 | 1202 | |
| 63494 | 1203 | |
| 60758 | 1204 | subsection \<open>Limits on sequences\<close> | 
| 51471 | 1205 | |
| 1206 | abbreviation (in topological_space) | |
| 63494 | 1207 |   LIMSEQ :: "[nat \<Rightarrow> 'a, 'a] \<Rightarrow> bool"  ("((_)/ \<longlonglongrightarrow> (_))" [60, 60] 60)
 | 
| 1208 | where "X \<longlonglongrightarrow> L \<equiv> (X \<longlongrightarrow> L) sequentially" | |
| 1209 | ||
| 1210 | abbreviation (in t2_space) lim :: "(nat \<Rightarrow> 'a) \<Rightarrow> 'a" | |
| 1211 | where "lim X \<equiv> Lim sequentially X" | |
| 1212 | ||
| 1213 | definition (in topological_space) convergent :: "(nat \<Rightarrow> 'a) \<Rightarrow> bool" | |
| 1214 | where "convergent X = (\<exists>L. X \<longlonglongrightarrow> L)" | |
| 51471 | 1215 | |
| 61969 | 1216 | 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 | 1217 | 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 | 1218 | |
| 70367 | 1219 | lemma lim_explicit: | 
| 70365 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 1220 | "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 | 1221 | 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 | 1222 | |
| 63494 | 1223 | |
| 68532 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1224 | subsection \<open>Monotone sequences and subsequences\<close> | 
| 51471 | 1225 | |
| 63494 | 1226 | text \<open> | 
| 1227 | Definition of monotonicity. | |
| 1228 | The use of disjunction here complicates proofs considerably. | |
| 1229 | One alternative is to add a Boolean argument to indicate the direction. | |
| 1230 | Another is to develop the notions of increasing and decreasing first. | |
| 1231 | \<close> | |
| 1232 | definition monoseq :: "(nat \<Rightarrow> 'a::order) \<Rightarrow> bool" | |
| 1233 | 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)" | |
| 1234 | ||
| 1235 | abbreviation incseq :: "(nat \<Rightarrow> 'a::order) \<Rightarrow> bool" | |
| 1236 | 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 | 1237 | |
| 
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 | 1238 | 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 | 1239 | 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 | 1240 | |
| 63494 | 1241 | abbreviation decseq :: "(nat \<Rightarrow> 'a::order) \<Rightarrow> bool" | 
| 1242 | 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 | 1243 | |
| 
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 | 1244 | 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 | 1245 | unfolding antimono_def .. | 
| 51471 | 1246 | |
| 68532 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1247 | subsubsection \<open>Definition of subsequence.\<close> | 
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1248 | |
| 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1249 | (* For compatibility with the old "subseq" *) | 
| 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1250 | 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 | 1251 | by (erule (1) monoD [OF strict_mono_mono]) | 
| 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1252 | |
| 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1253 | lemma strict_mono_id: "strict_mono id" | 
| 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1254 | 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 | 1255 | |
| 63494 | 1256 | lemma incseq_SucI: "(\<And>n. X n \<le> X (Suc n)) \<Longrightarrow> incseq X" | 
| 1257 | using lift_Suc_mono_le[of X] by (auto simp: incseq_def) | |
| 1258 | ||
| 1259 | lemma incseqD: "incseq f \<Longrightarrow> i \<le> j \<Longrightarrow> f i \<le> f j" | |
| 51471 | 1260 | by (auto simp: incseq_def) | 
| 1261 | ||
| 1262 | lemma incseq_SucD: "incseq A \<Longrightarrow> A i \<le> A (Suc i)" | |
| 1263 | using incseqD[of A i "Suc i"] by auto | |
| 1264 | ||
| 1265 | lemma incseq_Suc_iff: "incseq f \<longleftrightarrow> (\<forall>n. f n \<le> f (Suc n))" | |
| 1266 | by (auto intro: incseq_SucI dest: incseq_SucD) | |
| 1267 | ||
| 1268 | lemma incseq_const[simp, intro]: "incseq (\<lambda>x. k)" | |
| 1269 | unfolding incseq_def by auto | |
| 1270 | ||
| 63494 | 1271 | lemma decseq_SucI: "(\<And>n. X (Suc n) \<le> X n) \<Longrightarrow> decseq X" | 
| 1272 | using order.lift_Suc_mono_le[OF dual_order, of X] by (auto simp: decseq_def) | |
| 1273 | ||
| 1274 | lemma decseqD: "decseq f \<Longrightarrow> i \<le> j \<Longrightarrow> f j \<le> f i" | |
| 51471 | 1275 | by (auto simp: decseq_def) | 
| 1276 | ||
| 1277 | lemma decseq_SucD: "decseq A \<Longrightarrow> A (Suc i) \<le> A i" | |
| 1278 | using decseqD[of A i "Suc i"] by auto | |
| 1279 | ||
| 1280 | lemma decseq_Suc_iff: "decseq f \<longleftrightarrow> (\<forall>n. f (Suc n) \<le> f n)" | |
| 1281 | by (auto intro: decseq_SucI dest: decseq_SucD) | |
| 1282 | ||
| 1283 | lemma decseq_const[simp, intro]: "decseq (\<lambda>x. k)" | |
| 1284 | unfolding decseq_def by auto | |
| 1285 | ||
| 1286 | lemma monoseq_iff: "monoseq X \<longleftrightarrow> incseq X \<or> decseq X" | |
| 1287 | unfolding monoseq_def incseq_def decseq_def .. | |
| 1288 | ||
| 63494 | 1289 | lemma monoseq_Suc: "monoseq X \<longleftrightarrow> (\<forall>n. X n \<le> X (Suc n)) \<or> (\<forall>n. X (Suc n) \<le> X n)" | 
| 51471 | 1290 | unfolding monoseq_iff incseq_Suc_iff decseq_Suc_iff .. | 
| 1291 | ||
| 63494 | 1292 | lemma monoI1: "\<forall>m. \<forall>n \<ge> m. X m \<le> X n \<Longrightarrow> monoseq X" | 
| 1293 | by (simp add: monoseq_def) | |
| 1294 | ||
| 1295 | lemma monoI2: "\<forall>m. \<forall>n \<ge> m. X n \<le> X m \<Longrightarrow> monoseq X" | |
| 1296 | by (simp add: monoseq_def) | |
| 1297 | ||
| 1298 | lemma mono_SucI1: "\<forall>n. X n \<le> X (Suc n) \<Longrightarrow> monoseq X" | |
| 1299 | by (simp add: monoseq_Suc) | |
| 1300 | ||
| 1301 | lemma mono_SucI2: "\<forall>n. X (Suc n) \<le> X n \<Longrightarrow> monoseq X" | |
| 1302 | by (simp add: monoseq_Suc) | |
| 51471 | 1303 | |
| 1304 | lemma monoseq_minus: | |
| 1305 | fixes a :: "nat \<Rightarrow> 'a::ordered_ab_group_add" | |
| 1306 | assumes "monoseq a" | |
| 1307 | shows "monoseq (\<lambda> n. - a n)" | |
| 63494 | 1308 | proof (cases "\<forall>m. \<forall>n \<ge> m. a m \<le> a n") | 
| 51471 | 1309 | case True | 
| 63494 | 1310 | then have "\<forall>m. \<forall>n \<ge> m. - a n \<le> - a m" by auto | 
| 1311 | then show ?thesis by (rule monoI2) | |
| 51471 | 1312 | next | 
| 1313 | case False | |
| 63494 | 1314 | then have "\<forall>m. \<forall>n \<ge> m. - a m \<le> - a n" | 
| 1315 | using \<open>monoseq a\<close>[unfolded monoseq_def] by auto | |
| 1316 | then show ?thesis by (rule monoI1) | |
| 51471 | 1317 | qed | 
| 1318 | ||
| 63494 | 1319 | |
| 68532 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1320 | subsubsection \<open>Subsequence (alternative definition, (e.g. Hoskins)\<close> | 
| 63494 | 1321 | |
| 1322 | text \<open>For any sequence, there is a monotonic subsequence.\<close> | |
| 51471 | 1323 | lemma seq_monosub: | 
| 63494 | 1324 | fixes s :: "nat \<Rightarrow> 'a::linorder" | 
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1325 | shows "\<exists>f. strict_mono f \<and> monoseq (\<lambda>n. (s (f n)))" | 
| 63494 | 1326 | proof (cases "\<forall>n. \<exists>p>n. \<forall>m\<ge>p. s m \<le> s p") | 
| 1327 | case True | |
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1328 | 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 | 1329 | by (intro dependent_nat_choice) (auto simp: conj_commute) | 
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1330 | then obtain f :: "nat \<Rightarrow> nat" | 
| 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1331 | 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 | 1332 | 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 | 1333 | then have "incseq f" | 
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1334 | 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 | 1335 | 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 | 1336 | by (auto simp add: incseq_def intro!: mono monoI2) | 
| 63494 | 1337 | with f show ?thesis | 
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1338 | by auto | 
| 51471 | 1339 | next | 
| 63494 | 1340 | case False | 
| 1341 | then obtain N where N: "p > N \<Longrightarrow> \<exists>m>p. s p < s m" for p | |
| 1342 | 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 | 1343 | 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 | 1344 | proof (intro dependent_nat_choice) | 
| 63494 | 1345 | fix x | 
| 1346 | assume "N < x" with N[of x] | |
| 1347 | 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 | 1348 | by (auto intro: less_trans) | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1349 | qed auto | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1350 | then show ?thesis | 
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1351 | by (auto simp: monoseq_iff incseq_Suc_iff strict_mono_Suc_iff) | 
| 51471 | 1352 | qed | 
| 1353 | ||
| 63494 | 1354 | lemma seq_suble: | 
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1355 | assumes sf: "strict_mono (f :: nat \<Rightarrow> nat)" | 
| 63494 | 1356 | shows "n \<le> f n" | 
| 1357 | proof (induct n) | |
| 1358 | case 0 | |
| 1359 | show ?case by simp | |
| 51471 | 1360 | next | 
| 1361 | case (Suc n) | |
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1362 | with sf [unfolded strict_mono_Suc_iff, rule_format, of n] have "n < f (Suc n)" | 
| 63494 | 1363 | by arith | 
| 1364 | then show ?case by arith | |
| 51471 | 1365 | qed | 
| 1366 | ||
| 1367 | lemma eventually_subseq: | |
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1368 | "strict_mono r \<Longrightarrow> eventually P sequentially \<Longrightarrow> eventually (\<lambda>n. P (r n)) sequentially" | 
| 51471 | 1369 | unfolding eventually_sequentially by (metis seq_suble le_trans) | 
| 1370 | ||
| 51473 | 1371 | lemma not_eventually_sequentiallyD: | 
| 63494 | 1372 | assumes "\<not> eventually P sequentially" | 
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1373 | shows "\<exists>r::nat\<Rightarrow>nat. strict_mono r \<and> (\<forall>n. \<not> P (r n))" | 
| 51473 | 1374 | proof - | 
| 63494 | 1375 | from assms have "\<forall>n. \<exists>m\<ge>n. \<not> P m" | 
| 51473 | 1376 | unfolding eventually_sequentially by (simp add: not_less) | 
| 1377 | then obtain r where "\<And>n. r n \<ge> n" "\<And>n. \<not> P (r n)" | |
| 1378 | by (auto simp: choice_iff) | |
| 1379 | then show ?thesis | |
| 1380 | 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 | 1381 | simp: less_eq_Suc_le strict_mono_Suc_iff) | 
| 51473 | 1382 | qed | 
| 1383 | ||
| 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 | 1384 | 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 | 1385 | 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 | 1386 | 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 | 1387 | 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 | 1388 | |
| 
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 | 1389 | 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 | 1390 | "(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 | 1391 | 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 | 1392 | 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 | 1393 | 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 | 1394 | |
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1395 | lemma filterlim_subseq: "strict_mono f \<Longrightarrow> filterlim f sequentially sequentially" | 
| 51471 | 1396 | unfolding filterlim_iff by (metis eventually_subseq) | 
| 1397 | ||
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1398 | 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 | 1399 | unfolding strict_mono_def by simp | 
| 61531 
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
 eberlm parents: 
61520diff
changeset | 1400 | |
| 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 | 1401 | 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 | 1402 | 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 | 1403 | |
| 51471 | 1404 | lemma incseq_imp_monoseq: "incseq X \<Longrightarrow> monoseq X" | 
| 1405 | by (simp add: incseq_def monoseq_def) | |
| 1406 | ||
| 1407 | lemma decseq_imp_monoseq: "decseq X \<Longrightarrow> monoseq X" | |
| 1408 | by (simp add: decseq_def monoseq_def) | |
| 1409 | ||
| 63494 | 1410 | lemma decseq_eq_incseq: "decseq X = incseq (\<lambda>n. - X n)" | 
| 1411 | for X :: "nat \<Rightarrow> 'a::ordered_ab_group_add" | |
| 51471 | 1412 | by (simp add: decseq_def incseq_def) | 
| 1413 | ||
| 1414 | lemma INT_decseq_offset: | |
| 1415 | assumes "decseq F" | |
| 1416 |   shows "(\<Inter>i. F i) = (\<Inter>i\<in>{n..}. F i)"
 | |
| 1417 | proof safe | |
| 63494 | 1418 | fix x i | 
| 1419 |   assume x: "x \<in> (\<Inter>i\<in>{n..}. F i)"
 | |
| 51471 | 1420 | show "x \<in> F i" | 
| 1421 | proof cases | |
| 1422 | from x have "x \<in> F n" by auto | |
| 60758 | 1423 | also assume "i \<le> n" with \<open>decseq F\<close> have "F n \<subseteq> F i" | 
| 51471 | 1424 | unfolding decseq_def by simp | 
| 1425 | finally show ?thesis . | |
| 1426 | qed (insert x, simp) | |
| 1427 | qed auto | |
| 1428 | ||
| 63494 | 1429 | lemma LIMSEQ_const_iff: "(\<lambda>n. k) \<longlonglongrightarrow> l \<longleftrightarrow> k = l" | 
| 1430 | for k l :: "'a::t2_space" | |
| 51471 | 1431 | using trivial_limit_sequentially by (rule tendsto_const_iff) | 
| 1432 | ||
| 63494 | 1433 | lemma LIMSEQ_SUP: "incseq X \<Longrightarrow> X \<longlonglongrightarrow> (SUP i. X i :: 'a::{complete_linorder,linorder_topology})"
 | 
| 51471 | 1434 | by (intro increasing_tendsto) | 
| 63494 | 1435 | (auto simp: SUP_upper less_SUP_iff incseq_def eventually_sequentially intro: less_le_trans) | 
| 1436 | ||
| 1437 | lemma LIMSEQ_INF: "decseq X \<Longrightarrow> X \<longlonglongrightarrow> (INF i. X i :: 'a::{complete_linorder,linorder_topology})"
 | |
| 51471 | 1438 | by (intro decreasing_tendsto) | 
| 63494 | 1439 | (auto simp: INF_lower INF_less_iff decseq_def eventually_sequentially intro: le_less_trans) | 
| 1440 | ||
| 1441 | lemma LIMSEQ_ignore_initial_segment: "f \<longlonglongrightarrow> a \<Longrightarrow> (\<lambda>n. f (n + k)) \<longlonglongrightarrow> a" | |
| 1442 | unfolding tendsto_def by (subst eventually_sequentially_seg[where k=k]) | |
| 1443 | ||
| 1444 | 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 | 1445 | unfolding tendsto_def | 
| 
1e9e68247ad1
generalize Bfun and Bseq to metric spaces; Bseq is an abbreviation for Bfun
 hoelzl parents: 
51473diff
changeset | 1446 | by (subst (asm) eventually_sequentially_seg[where k=k]) | 
| 51471 | 1447 | |
| 61969 | 1448 | lemma LIMSEQ_Suc: "f \<longlonglongrightarrow> l \<Longrightarrow> (\<lambda>n. f (Suc n)) \<longlonglongrightarrow> l" | 
| 63494 | 1449 | by (drule LIMSEQ_ignore_initial_segment [where k="Suc 0"]) simp | 
| 51471 | 1450 | |
| 61969 | 1451 | lemma LIMSEQ_imp_Suc: "(\<lambda>n. f (Suc n)) \<longlonglongrightarrow> l \<Longrightarrow> f \<longlonglongrightarrow> l" | 
| 63494 | 1452 | by (rule LIMSEQ_offset [where k="Suc 0"]) simp | 
| 51471 | 1453 | |
| 68361 | 1454 | lemma LIMSEQ_lessThan_iff_atMost: | 
| 1455 |   shows "(\<lambda>n. f {..<n}) \<longlonglongrightarrow> x \<longleftrightarrow> (\<lambda>n. f {..n}) \<longlonglongrightarrow> x"
 | |
| 71827 | 1456 | apply (subst filterlim_sequentially_Suc [symmetric]) | 
| 68361 | 1457 | apply (simp only: lessThan_Suc_atMost) | 
| 1458 | done | |
| 1459 | ||
| 71827 | 1460 | lemma (in t2_space) LIMSEQ_Uniq: "\<exists>\<^sub>\<le>\<^sub>1l. X \<longlonglongrightarrow> l" | 
| 1461 | by (simp add: tendsto_unique') | |
| 1462 | ||
| 1463 | lemma (in t2_space) LIMSEQ_unique: "X \<longlonglongrightarrow> a \<Longrightarrow> X \<longlonglongrightarrow> b \<Longrightarrow> a = b" | |
| 51471 | 1464 | using trivial_limit_sequentially by (rule tendsto_unique) | 
| 1465 | ||
| 63494 | 1466 | lemma LIMSEQ_le_const: "X \<longlonglongrightarrow> x \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. a \<le> X n \<Longrightarrow> a \<le> x" | 
| 1467 | 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 | 1468 | by (simp add: eventually_at_top_linorder tendsto_lowerbound) | 
| 51471 | 1469 | |
| 63494 | 1470 | 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" | 
| 1471 | for x y :: "'a::linorder_topology" | |
| 51471 | 1472 | using tendsto_le[of sequentially Y y X x] by (simp add: eventually_sequentially) | 
| 1473 | ||
| 63494 | 1474 | lemma LIMSEQ_le_const2: "X \<longlonglongrightarrow> x \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. X n \<le> a \<Longrightarrow> x \<le> a" | 
| 1475 | for a x :: "'a::linorder_topology" | |
| 58729 
e8ecc79aee43
add tendsto_const and tendsto_ident_at as simp and intro rules
 hoelzl parents: 
57953diff
changeset | 1476 | by (rule LIMSEQ_le[of X x "\<lambda>n. a"]) auto | 
| 51471 | 1477 | |
| 68532 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1478 | 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 | 1479 | for l :: "'a::linorder_topology" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1480 | by (intro LIMSEQ_le_const2) auto | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1481 | |
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1482 | lemma Lim_bounded2: | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1483 | 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 | 1484 | 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 | 1485 | shows "l \<ge> C" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1486 | using ge | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1487 | 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 | 1488 | (auto simp: eventually_sequentially) | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1489 | |
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1490 | lemma lim_mono: | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1491 | 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 | 1492 | 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 | 1493 | and "X \<longlonglongrightarrow> x" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1494 | and "Y \<longlonglongrightarrow> y" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1495 | shows "x \<le> y" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1496 | 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 | 1497 | |
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1498 | lemma Sup_lim: | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1499 |   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 | 1500 | 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 | 1501 | and "b \<longlonglongrightarrow> a" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1502 | shows "a \<le> Sup s" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1503 | 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 | 1504 | |
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1505 | lemma Inf_lim: | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1506 |   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 | 1507 | 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 | 1508 | and "b \<longlonglongrightarrow> a" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1509 | shows "Inf s \<le> a" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1510 | 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 | 1511 | |
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1512 | lemma SUP_Lim: | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1513 |   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 | 1514 | assumes inc: "incseq X" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1515 | and l: "X \<longlonglongrightarrow> l" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1516 | shows "(SUP n. X n) = l" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1517 | 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 | 1518 | by simp | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1519 | |
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1520 | lemma INF_Lim: | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1521 |   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 | 1522 | assumes dec: "decseq X" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1523 | and l: "X \<longlonglongrightarrow> l" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1524 | shows "(INF n. X n) = l" | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1525 | 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 | 1526 | by simp | 
| 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1527 | |
| 63494 | 1528 | lemma convergentD: "convergent X \<Longrightarrow> \<exists>L. X \<longlonglongrightarrow> L" | 
| 1529 | by (simp add: convergent_def) | |
| 1530 | ||
| 1531 | lemma convergentI: "X \<longlonglongrightarrow> L \<Longrightarrow> convergent X" | |
| 1532 | by (auto simp add: convergent_def) | |
| 1533 | ||
| 1534 | lemma convergent_LIMSEQ_iff: "convergent X \<longleftrightarrow> X \<longlonglongrightarrow> lim X" | |
| 1535 | by (auto intro: theI LIMSEQ_unique simp add: convergent_def lim_def) | |
| 51471 | 1536 | |
| 1537 | lemma convergent_const: "convergent (\<lambda>n. c)" | |
| 63494 | 1538 | by (rule convergentI) (rule tendsto_const) | 
| 51471 | 1539 | |
| 1540 | lemma monoseq_le: | |
| 63494 | 1541 | "monoseq a \<Longrightarrow> a \<longlonglongrightarrow> x \<Longrightarrow> | 
| 1542 | (\<forall>n. a n \<le> x) \<and> (\<forall>m. \<forall>n\<ge>m. a m \<le> a n) \<or> | |
| 1543 | (\<forall>n. x \<le> a n) \<and> (\<forall>m. \<forall>n\<ge>m. a n \<le> a m)" | |
| 1544 | for x :: "'a::linorder_topology" | |
| 51471 | 1545 | by (metis LIMSEQ_le_const LIMSEQ_le_const2 decseq_def incseq_def monoseq_iff) | 
| 1546 | ||
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1547 | lemma LIMSEQ_subseq_LIMSEQ: "X \<longlonglongrightarrow> L \<Longrightarrow> strict_mono f \<Longrightarrow> (X \<circ> f) \<longlonglongrightarrow> L" | 
| 63494 | 1548 | unfolding comp_def by (rule filterlim_compose [of X, OF _ filterlim_subseq]) | 
| 1549 | ||
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1550 | lemma convergent_subseq_convergent: "convergent X \<Longrightarrow> strict_mono f \<Longrightarrow> convergent (X \<circ> f)" | 
| 63494 | 1551 | by (auto simp: convergent_def intro: LIMSEQ_subseq_LIMSEQ) | 
| 1552 | ||
| 1553 | lemma limI: "X \<longlonglongrightarrow> L \<Longrightarrow> lim X = L" | |
| 57276 | 1554 | by (rule tendsto_Lim) (rule trivial_limit_sequentially) | 
| 51471 | 1555 | |
| 63494 | 1556 | lemma lim_le: "convergent f \<Longrightarrow> (\<And>n. f n \<le> x) \<Longrightarrow> lim f \<le> x" | 
| 1557 | for x :: "'a::linorder_topology" | |
| 51471 | 1558 | using LIMSEQ_le_const2[of f "lim f" x] by (simp add: convergent_LIMSEQ_iff) | 
| 1559 | ||
| 62217 | 1560 | lemma lim_const [simp]: "lim (\<lambda>m. a) = a" | 
| 1561 | by (simp add: limI) | |
| 1562 | ||
| 63494 | 1563 | |
| 1564 | subsubsection \<open>Increasing and Decreasing Series\<close> | |
| 1565 | ||
| 1566 | lemma incseq_le: "incseq X \<Longrightarrow> X \<longlonglongrightarrow> L \<Longrightarrow> X n \<le> L" | |
| 1567 | for L :: "'a::linorder_topology" | |
| 51471 | 1568 | by (metis incseq_def LIMSEQ_le_const) | 
| 1569 | ||
| 68532 
f8b98d31ad45
Incorporating new/strengthened proofs from Library and AFP entries
 paulson <lp15@cam.ac.uk> parents: 
68361diff
changeset | 1570 | lemma decseq_ge: "decseq X \<Longrightarrow> X \<longlonglongrightarrow> L \<Longrightarrow> L \<le> X n" | 
| 63494 | 1571 | for L :: "'a::linorder_topology" | 
| 51471 | 1572 | by (metis decseq_def LIMSEQ_le_const2) | 
| 1573 | ||
| 63494 | 1574 | |
| 60758 | 1575 | subsection \<open>First countable topologies\<close> | 
| 51473 | 1576 | |
| 1577 | class first_countable_topology = topological_space + | |
| 1578 | assumes first_countable_basis: | |
| 1579 | "\<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))" | |
| 1580 | ||
| 1581 | lemma (in first_countable_topology) countable_basis_at_decseq: | |
| 1582 | obtains A :: "nat \<Rightarrow> 'a set" where | |
| 1583 | "\<And>i. open (A i)" "\<And>i. x \<in> (A i)" | |
| 1584 | "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> eventually (\<lambda>i. A i \<subseteq> S) sequentially" | |
| 1585 | proof atomize_elim | |
| 63494 | 1586 | from first_countable_basis[of x] obtain A :: "nat \<Rightarrow> 'a set" | 
| 1587 | where nhds: "\<And>i. open (A i)" "\<And>i. x \<in> A i" | |
| 1588 | and incl: "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> \<exists>i. A i \<subseteq> S" | |
| 1589 | by auto | |
| 63040 | 1590 | define F where "F n = (\<Inter>i\<le>n. A i)" for n | 
| 51473 | 1591 | show "\<exists>A. (\<forall>i. open (A i)) \<and> (\<forall>i. x \<in> A i) \<and> | 
| 63494 | 1592 | (\<forall>S. open S \<longrightarrow> x \<in> S \<longrightarrow> eventually (\<lambda>i. A i \<subseteq> S) sequentially)" | 
| 51473 | 1593 | proof (safe intro!: exI[of _ F]) | 
| 1594 | fix i | |
| 63494 | 1595 | show "open (F i)" | 
| 1596 | using nhds(1) by (auto simp: F_def) | |
| 1597 | show "x \<in> F i" | |
| 1598 | using nhds(2) by (auto simp: F_def) | |
| 51473 | 1599 | next | 
| 63494 | 1600 | fix S | 
| 1601 | assume "open S" "x \<in> S" | |
| 1602 | from incl[OF this] obtain i where "F i \<subseteq> S" | |
| 1603 | unfolding F_def by auto | |
| 51473 | 1604 | moreover have "\<And>j. i \<le> j \<Longrightarrow> F j \<subseteq> F i" | 
| 63171 | 1605 | by (simp add: Inf_superset_mono F_def image_mono) | 
| 51473 | 1606 | ultimately show "eventually (\<lambda>i. F i \<subseteq> S) sequentially" | 
| 1607 | by (auto simp: eventually_sequentially) | |
| 1608 | qed | |
| 1609 | qed | |
| 1610 | ||
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1611 | 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 | 1612 | 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 | 1613 | 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 | 1614 | proof - | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1615 | from first_countable_basis obtain A :: "nat \<Rightarrow> 'a set" | 
| 63494 | 1616 | 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 | 1617 | by metis | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1618 | show thesis | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1619 | proof | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1620 | show "decseq (\<lambda>n. \<Inter>i\<le>n. A i)" | 
| 63171 | 1621 | by (simp add: antimono_iff_le_Suc atMost_Suc) | 
| 63494 | 1622 | show "x \<in> (\<Inter>i\<le>n. A i)" "\<And>n. open (\<Inter>i\<le>n. A i)" for n | 
| 1623 | using * by auto | |
| 74668 | 1624 | with * show "nhds x = (INF n. principal (\<Inter>i\<le>n. A i))" | 
| 63494 | 1625 | unfolding nhds_def | 
| 74668 | 1626 | apply (intro INF_eq) | 
| 63494 | 1627 | apply fastforce | 
| 74668 | 1628 | apply blast | 
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1629 | done | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1630 | qed | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1631 | qed | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 1632 | |
| 51473 | 1633 | lemma (in first_countable_topology) countable_basis: | 
| 1634 | obtains A :: "nat \<Rightarrow> 'a set" where | |
| 1635 | "\<And>i. open (A i)" "\<And>i. x \<in> A i" | |
| 61969 | 1636 | "\<And>F. (\<forall>n. F n \<in> A n) \<Longrightarrow> F \<longlonglongrightarrow> x" | 
| 51473 | 1637 | proof atomize_elim | 
| 63494 | 1638 | obtain A :: "nat \<Rightarrow> 'a set" where *: | 
| 53381 | 1639 | "\<And>i. open (A i)" | 
| 1640 | "\<And>i. x \<in> A i" | |
| 1641 | "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> eventually (\<lambda>i. A i \<subseteq> S) sequentially" | |
| 1642 | by (rule countable_basis_at_decseq) blast | |
| 63494 | 1643 | have "eventually (\<lambda>n. F n \<in> S) sequentially" | 
| 1644 | if "\<forall>n. F n \<in> A n" "open S" "x \<in> S" for F S | |
| 1645 | using *(3)[of S] that by (auto elim: eventually_mono simp: subset_eq) | |
| 1646 | 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 | 1647 | by (intro exI[of _ A]) (auto simp: tendsto_def) | 
| 1648 | qed | |
| 1649 | ||
| 1650 | lemma (in first_countable_topology) sequentially_imp_eventually_nhds_within: | |
| 61969 | 1651 | 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 | 1652 | shows "eventually P (inf (nhds a) (principal s))" | 
| 51473 | 1653 | proof (rule ccontr) | 
| 63494 | 1654 | obtain A :: "nat \<Rightarrow> 'a set" where *: | 
| 53381 | 1655 | "\<And>i. open (A i)" | 
| 1656 | "\<And>i. a \<in> A i" | |
| 61969 | 1657 | "\<And>F. \<forall>n. F n \<in> A n \<Longrightarrow> F \<longlonglongrightarrow> a" | 
| 53381 | 1658 | by (rule countable_basis) blast | 
| 1659 | assume "\<not> ?thesis" | |
| 63494 | 1660 | with * have "\<exists>F. \<forall>n. F n \<in> s \<and> F n \<in> A n \<and> \<not> P (F n)" | 
| 1661 | unfolding eventually_inf_principal eventually_nhds | |
| 1662 | by (intro choice) fastforce | |
| 1663 | 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 | 1664 | by blast | 
| 63494 | 1665 | with * have "F \<longlonglongrightarrow> a" | 
| 1666 | by auto | |
| 1667 | then have "eventually (\<lambda>n. P (F n)) sequentially" | |
| 1668 | using assms F by simp | |
| 1669 | then show False | |
| 1670 | by (simp add: F') | |
| 51473 | 1671 | qed | 
| 1672 | ||
| 1673 | 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 | 1674 | "eventually P (inf (nhds a) (principal s)) \<longleftrightarrow> | 
| 61969 | 1675 | (\<forall>f. (\<forall>n. f n \<in> s) \<and> f \<longlonglongrightarrow> a \<longrightarrow> eventually (\<lambda>n. P (f n)) sequentially)" | 
| 51473 | 1676 | 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 | 1677 | assume "eventually P (inf (nhds a) (principal s))" | 
| 51473 | 1678 | 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 | 1679 | by (auto simp: eventually_inf_principal eventually_nhds) | 
| 63494 | 1680 | moreover | 
| 1681 | fix f | |
| 1682 | assume "\<forall>n. f n \<in> s" "f \<longlonglongrightarrow> a" | |
| 51473 | 1683 | ultimately show "eventually (\<lambda>n. P (f n)) sequentially" | 
| 61810 | 1684 | by (auto dest!: topological_tendstoD elim: eventually_mono) | 
| 51473 | 1685 | qed | 
| 1686 | ||
| 1687 | lemma (in first_countable_topology) eventually_nhds_iff_sequentially: | |
| 61969 | 1688 | "eventually P (nhds a) \<longleftrightarrow> (\<forall>f. f \<longlonglongrightarrow> a \<longrightarrow> eventually (\<lambda>n. P (f n)) sequentially)" | 
| 51473 | 1689 | using eventually_nhds_within_iff_sequentially[of P a UNIV] by simp | 
| 1690 | ||
| 70723 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1691 | (*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 | 1692 | lemma Inf_as_limit: | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1693 |   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 | 1694 |   assumes "A \<noteq> {}"
 | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1695 | 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 | 1696 | 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 | 1697 | case True | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1698 | show ?thesis | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1699 | 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 | 1700 | next | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1701 | case False | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1702 | 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 | 1703 | 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 | 1704 | 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 | 1705 | "\<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 | 1706 | 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 | 1707 | 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 | 1708 | 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 | 1709 | proof - | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1710 |     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 | 1711 | 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 | 1712 | 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 | 1713 | 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 | 1714 |     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 | 1715 | by (simp add: Inf_lower) | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1716 |     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 | 1717 | qed | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1718 | 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 | 1719 | 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 | 1720 | 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 | 1721 | 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 | 1722 | qed | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70707diff
changeset | 1723 | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1724 | lemma tendsto_at_iff_sequentially: | 
| 63494 | 1725 |   "(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))"
 | 
| 1726 | for f :: "'a::first_countable_topology \<Rightarrow> _" | |
| 1727 | unfolding filterlim_def[of _ "nhds a"] le_filter_def eventually_filtermap | |
| 1728 | 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 | 1729 | by metis | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1730 | |
| 64283 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1731 | lemma approx_from_above_dense_linorder: | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1732 |   fixes x::"'a::{dense_linorder, linorder_topology, first_countable_topology}"
 | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1733 | assumes "x < y" | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1734 | 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 | 1735 | proof - | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1736 | 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 | 1737 | "\<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 | 1738 | by (metis first_countable_topology_class.countable_basis) | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1739 | 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 | 1740 | have "\<exists>z. z \<in> U \<and> x < z" if "x \<in> U" "open U" for U | 
| 67226 | 1741 | 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 | 1742 | by (meson atLeastLessThan_iff dense less_imp_le subset_eq) | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1743 | then have *: "u n \<in> A n \<and> x < u n" for n | 
| 67226 | 1744 | 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 | 1745 | then have "u \<longlonglongrightarrow> x" using A(3) by simp | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1746 | then show ?thesis using * by auto | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1747 | qed | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1748 | |
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1749 | lemma approx_from_below_dense_linorder: | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1750 |   fixes x::"'a::{dense_linorder, linorder_topology, first_countable_topology}"
 | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1751 | assumes "x > y" | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1752 | 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 | 1753 | proof - | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1754 | 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 | 1755 | "\<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 | 1756 | by (metis first_countable_topology_class.countable_basis) | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1757 | 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 | 1758 | have "\<exists>z. z \<in> U \<and> z < x" if "x \<in> U" "open U" for U | 
| 67226 | 1759 | 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 | 1760 | by (meson dense greaterThanAtMost_iff less_imp_le subset_eq) | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1761 | then have *: "u n \<in> A n \<and> u n < x" for n | 
| 67226 | 1762 | 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 | 1763 | then have "u \<longlonglongrightarrow> x" using A(3) by simp | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1764 | then show ?thesis using * by auto | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1765 | qed | 
| 
979cdfdf7a79
HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
 hoelzl parents: 
64008diff
changeset | 1766 | |
| 63494 | 1767 | |
| 60758 | 1768 | subsection \<open>Function limit at a point\<close> | 
| 51471 | 1769 | |
| 63494 | 1770 | abbreviation LIM :: "('a::topological_space \<Rightarrow> 'b::topological_space) \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> bool"
 | 
| 1771 |     ("((_)/ \<midarrow>(_)/\<rightarrow> (_))" [60, 0, 60] 60)
 | |
| 1772 | where "f \<midarrow>a\<rightarrow> L \<equiv> (f \<longlongrightarrow> L) (at a)" | |
| 51471 | 1773 | |
| 61976 | 1774 | 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 | 1775 | 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 | 1776 | |
| 62397 
5ae24f33d343
Substantial new material for multivariate analysis. Also removal of some duplicates.
 paulson <lp15@cam.ac.uk> parents: 
62381diff
changeset | 1777 | lemma tendsto_within_open_NO_MATCH: | 
| 63494 | 1778 | "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)" | 
| 1779 | for f :: "'a::topological_space \<Rightarrow> 'b::topological_space" | |
| 1780 | using tendsto_within_open by blast | |
| 1781 | ||
| 1782 | lemma LIM_const_not_eq[tendsto_intros]: "k \<noteq> L \<Longrightarrow> \<not> (\<lambda>x. k) \<midarrow>a\<rightarrow> L" | |
| 1783 | for a :: "'a::perfect_space" and k L :: "'b::t2_space" | |
| 51471 | 1784 | by (simp add: tendsto_const_iff) | 
| 1785 | ||
| 1786 | lemmas LIM_not_zero = LIM_const_not_eq [where L = 0] | |
| 1787 | ||
| 63494 | 1788 | lemma LIM_const_eq: "(\<lambda>x. k) \<midarrow>a\<rightarrow> L \<Longrightarrow> k = L" | 
| 1789 | for a :: "'a::perfect_space" and k L :: "'b::t2_space" | |
| 51471 | 1790 | by (simp add: tendsto_const_iff) | 
| 1791 | ||
| 63494 | 1792 | lemma LIM_unique: "f \<midarrow>a\<rightarrow> L \<Longrightarrow> f \<midarrow>a\<rightarrow> M \<Longrightarrow> L = M" | 
| 1793 | for a :: "'a::perfect_space" and L M :: "'b::t2_space" | |
| 51471 | 1794 | using at_neq_bot by (rule tendsto_unique) | 
| 1795 | ||
| 71827 | 1796 | lemma LIM_Uniq: "\<exists>\<^sub>\<le>\<^sub>1L::'b::t2_space. f \<midarrow>a\<rightarrow> L" | 
| 1797 | for a :: "'a::perfect_space" | |
| 1798 | by (auto simp add: Uniq_def LIM_unique) | |
| 1799 | ||
| 63494 | 1800 | |
| 1801 | text \<open>Limits are equal for functions equal except at limit point.\<close> | |
| 1802 | 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)" | |
| 1803 | by (simp add: tendsto_def eventually_at_topological) | |
| 51471 | 1804 | |
| 61976 | 1805 | 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 | 1806 | by (simp add: LIM_equal) | 
| 1807 | ||
| 70365 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 1808 | lemma tendsto_cong_limit: "(f \<longlongrightarrow> l) F \<Longrightarrow> k = l \<Longrightarrow> (f \<longlongrightarrow> k) F" | 
| 51471 | 1809 | by simp | 
| 1810 | ||
| 63494 | 1811 | 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 | 1812 | unfolding tendsto_def eventually_at_filter | 
| 61810 | 1813 | by (intro ext all_cong imp_cong) (auto elim!: eventually_mono) | 
| 51471 | 1814 | |
| 63494 | 1815 | 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 | 1816 | unfolding tendsto_at_iff_tendsto_nhds by (rule filterlim_compose[of g]) | 
| 1817 | ||
| 1818 | lemma tendsto_compose_eventually: | |
| 61976 | 1819 | "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 | 1820 | by (rule filterlim_compose[of g _ "at l"]) (auto simp add: filterlim_at) | 
| 1821 | ||
| 1822 | lemma LIM_compose_eventually: | |
| 63494 | 1823 | assumes "f \<midarrow>a\<rightarrow> b" | 
| 1824 | and "g \<midarrow>b\<rightarrow> c" | |
| 1825 | and "eventually (\<lambda>x. f x \<noteq> b) (at a)" | |
| 61976 | 1826 | shows "(\<lambda>x. g (f x)) \<midarrow>a\<rightarrow> c" | 
| 63494 | 1827 | using assms(2,1,3) by (rule tendsto_compose_eventually) | 
| 51471 | 1828 | |
| 61973 | 1829 | 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 | 1830 | 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 | 1831 | |
| 64758 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 1832 | lemma tendsto_compose_at: | 
| 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 1833 | 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 | 1834 | shows "((g \<circ> f) \<longlongrightarrow> z) F" | 
| 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 1835 | proof - | 
| 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 1836 | 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 | 1837 | using fg by force | 
| 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 1838 | 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 | 1839 | 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 | 1840 | ultimately show ?thesis | 
| 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 1841 | 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 | 1842 | qed | 
| 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 1843 | |
| 77140 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1844 | 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 | 1845 | proof safe | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1846 | assume lim: "(f \<longlongrightarrow> c) (nhds x)" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1847 | show "f x = c" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1848 | proof (rule ccontr) | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1849 | assume "f x \<noteq> c" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1850 | hence "c \<noteq> f x" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1851 | by auto | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1852 | 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 | 1853 | by (subst (asm) separation_t1) auto | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1854 | 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 | 1855 | unfolding tendsto_def eventually_nhds by metis | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1856 | 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 | 1857 | by blast | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1858 | qed | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1859 | show "(f \<longlongrightarrow> c) (at x)" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1860 | 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 | 1861 | next | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1862 | 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 | 1863 | thus "(f \<longlongrightarrow> f x) (nhds x)" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1864 | 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 | 1865 | qed | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 1866 | |
| 63494 | 1867 | |
| 1868 | subsubsection \<open>Relation of \<open>LIM\<close> and \<open>LIMSEQ\<close>\<close> | |
| 51473 | 1869 | |
| 1870 | lemma (in first_countable_topology) sequentially_imp_eventually_within: | |
| 61969 | 1871 | "(\<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 | 1872 | 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 | 1873 | unfolding at_within_def | 
| 51473 | 1874 | by (intro sequentially_imp_eventually_nhds_within) auto | 
| 1875 | ||
| 1876 | lemma (in first_countable_topology) sequentially_imp_eventually_at: | |
| 61969 | 1877 | "(\<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 | 1878 | using sequentially_imp_eventually_within [where s=UNIV] by simp | 
| 51473 | 1879 | |
| 75243 | 1880 | lemma LIMSEQ_SEQ_conv: | 
| 1881 | "(\<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 | 1882 | for a :: "'a::first_countable_topology" and L :: "'b::topological_space" | 
| 75243 | 1883 | proof | 
| 1884 | assume ?lhs then show ?rhs | |
| 1885 | by (simp add: sequentially_imp_eventually_within tendsto_def) | |
| 1886 | next | |
| 1887 | assume ?rhs then show ?lhs | |
| 1888 | using tendsto_compose_eventually eventuallyI by blast | |
| 1889 | qed | |
| 51473 | 1890 | |
| 57025 | 1891 | lemma sequentially_imp_eventually_at_left: | 
| 63494 | 1892 |   fixes a :: "'a::{linorder_topology,first_countable_topology}"
 | 
| 57025 | 1893 | assumes b[simp]: "b < a" | 
| 63494 | 1894 | and *: "\<And>f. (\<And>n. b < f n) \<Longrightarrow> (\<And>n. f n < a) \<Longrightarrow> incseq f \<Longrightarrow> f \<longlonglongrightarrow> a \<Longrightarrow> | 
| 1895 | eventually (\<lambda>n. P (f n)) sequentially" | |
| 57025 | 1896 | shows "eventually P (at_left a)" | 
| 1897 | proof (safe intro!: sequentially_imp_eventually_within) | |
| 63494 | 1898 | fix X | 
| 1899 |   assume X: "\<forall>n. X n \<in> {..< a} \<and> X n \<noteq> a" "X \<longlonglongrightarrow> a"
 | |
| 57025 | 1900 | show "eventually (\<lambda>n. P (X n)) sequentially" | 
| 1901 | proof (rule ccontr) | |
| 63494 | 1902 | 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 | 1903 | 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 | 1904 | (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 | 1905 | 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 | 1906 | 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 | 1907 | 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 | 1908 | 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 | 1909 | 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 | 1910 | next | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1911 | 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 | 1912 | have "\<not> eventually (\<lambda>n. Suc x \<le> n \<longrightarrow> b < X n \<longrightarrow> X x < X n \<longrightarrow> P (X n)) sequentially" | 
| 63494 | 1913 | using X | 
| 1914 | 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 | 1915 | 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 | 1916 | by (auto dest!: not_eventuallyD) | 
| 57025 | 1917 | qed | 
| 63494 | 1918 | then obtain s where "?P s" .. | 
| 1919 | with X have "b < X (s n)" | |
| 1920 | and "X (s n) < a" | |
| 1921 | and "incseq (\<lambda>n. X (s n))" | |
| 1922 | and "(\<lambda>n. X (s n)) \<longlonglongrightarrow> a" | |
| 1923 | and "\<not> P (X (s n))" | |
| 1924 | for n | |
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1925 | by (auto simp: strict_mono_Suc_iff Suc_le_eq incseq_Suc_iff | 
| 63494 | 1926 | intro!: LIMSEQ_subseq_LIMSEQ[OF \<open>X \<longlonglongrightarrow> a\<close>, unfolded comp_def]) | 
| 1927 | from *[OF this(1,2,3,4)] this(5) show False | |
| 1928 | by auto | |
| 57025 | 1929 | qed | 
| 1930 | qed | |
| 1931 | ||
| 1932 | lemma tendsto_at_left_sequentially: | |
| 63494 | 1933 |   fixes a b :: "'b::{linorder_topology,first_countable_topology}"
 | 
| 57025 | 1934 | assumes "b < a" | 
| 63494 | 1935 | assumes *: "\<And>S. (\<And>n. S n < a) \<Longrightarrow> (\<And>n. b < S n) \<Longrightarrow> incseq S \<Longrightarrow> S \<longlonglongrightarrow> a \<Longrightarrow> | 
| 1936 | (\<lambda>n. X (S n)) \<longlonglongrightarrow> L" | |
| 61973 | 1937 | shows "(X \<longlongrightarrow> L) (at_left a)" | 
| 63494 | 1938 | using assms by (simp add: tendsto_def [where l=L] sequentially_imp_eventually_at_left) | 
| 57025 | 1939 | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1940 | lemma sequentially_imp_eventually_at_right: | 
| 63494 | 1941 |   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 | 1942 | assumes b[simp]: "a < b" | 
| 63494 | 1943 | assumes *: "\<And>f. (\<And>n. a < f n) \<Longrightarrow> (\<And>n. f n < b) \<Longrightarrow> decseq f \<Longrightarrow> f \<longlonglongrightarrow> a \<Longrightarrow> | 
| 1944 | 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 | 1945 | 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 | 1946 | proof (safe intro!: sequentially_imp_eventually_within) | 
| 63494 | 1947 | fix X | 
| 1948 |   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 | 1949 | 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 | 1950 | proof (rule ccontr) | 
| 63494 | 1951 | 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 | 1952 | 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 | 1953 | (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 | 1954 | 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 | 1955 | 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 | 1956 | 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 | 1957 | 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 | 1958 | 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 | 1959 | next | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1960 | 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 | 1961 | have "\<not> eventually (\<lambda>n. Suc x \<le> n \<longrightarrow> X n < b \<longrightarrow> X n < X x \<longrightarrow> P (X n)) sequentially" | 
| 63494 | 1962 | using X | 
| 1963 | 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 | 1964 | 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 | 1965 | 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 | 1966 | qed | 
| 63494 | 1967 | then obtain s where "?P s" .. | 
| 1968 | with X have "a < X (s n)" | |
| 1969 | and "X (s n) < b" | |
| 1970 | and "decseq (\<lambda>n. X (s n))" | |
| 1971 | and "(\<lambda>n. X (s n)) \<longlonglongrightarrow> a" | |
| 1972 | and "\<not> P (X (s n))" | |
| 1973 | for n | |
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 1974 | by (auto simp: strict_mono_Suc_iff Suc_le_eq decseq_Suc_iff | 
| 63494 | 1975 | intro!: LIMSEQ_subseq_LIMSEQ[OF \<open>X \<longlonglongrightarrow> a\<close>, unfolded comp_def]) | 
| 1976 | from *[OF this(1,2,3,4)] this(5) show False | |
| 1977 | 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 | 1978 | qed | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1979 | qed | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1980 | |
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1981 | 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 | 1982 |   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 | 1983 | assumes "a < b" | 
| 63494 | 1984 | and *: "\<And>S. (\<And>n. a < S n) \<Longrightarrow> (\<And>n. S n < b) \<Longrightarrow> decseq S \<Longrightarrow> S \<longlonglongrightarrow> a \<Longrightarrow> | 
| 1985 | (\<lambda>n. X (S n)) \<longlonglongrightarrow> L" | |
| 61973 | 1986 | shows "(X \<longlongrightarrow> L) (at_right a)" | 
| 63494 | 1987 | using assms by (simp add: tendsto_def [where l=L] sequentially_imp_eventually_at_right) | 
| 1988 | ||
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 1989 | |
| 60758 | 1990 | subsection \<open>Continuity\<close> | 
| 51471 | 1991 | |
| 60758 | 1992 | 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 | 1993 | |
| 63494 | 1994 | definition continuous_on :: "'a set \<Rightarrow> ('a::topological_space \<Rightarrow> 'b::topological_space) \<Rightarrow> bool"
 | 
| 1995 | 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 | 1996 | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 1997 | lemma continuous_on_cong [cong]: | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 1998 | "s = t \<Longrightarrow> (\<And>x. x \<in> t \<Longrightarrow> f x = g x) \<Longrightarrow> continuous_on s f \<longleftrightarrow> continuous_on t g" | 
| 63494 | 1999 | unfolding continuous_on_def | 
| 2000 | 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 | 2001 | |
| 69546 
27dae626822b
prefer naming convention from datatype package for strong congruence rules
 haftmann parents: 
69529diff
changeset | 2002 | lemma continuous_on_cong_simp: | 
| 64008 
17a20ca86d62
HOL-Probability: more about probability, prepare for Markov processes in the AFP
 hoelzl parents: 
63952diff
changeset | 2003 | "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 | 2004 | 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 | 2005 | |
| 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 | 2006 | 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 | 2007 | "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 | 2008 | (\<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 | 2009 | 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 | 2010 | |
| 
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 | 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 | 2012 | "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 | 2013 | proof safe | 
| 63494 | 2014 | fix B :: "'b set" | 
| 2015 | 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 | 2016 | 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 | 2017 | by (auto simp: continuous_on_topological subset_eq Ball_def imp_conjL) | 
| 53381 | 2018 | 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" | 
| 2019 | 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 | 2020 | 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 | 2021 | 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 | 2022 | 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 | 2023 | 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 | 2024 | 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 | 2025 | 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 | 2026 | proof safe | 
| 63494 | 2027 | fix x B | 
| 2028 | assume "x \<in> s" "open B" "f x \<in> B" | |
| 2029 | with B obtain A where A: "open A" "A \<inter> s = f -` B \<inter> s" | |
| 2030 | by auto | |
| 60758 | 2031 | 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 | 2032 | 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 | 2033 | 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 | 2034 | 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 | 2035 | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2036 | lemma continuous_on_open_vimage: | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2037 | "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 | 2038 | unfolding continuous_on_open_invariant | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2039 | 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 | 2040 | |
| 55734 | 2041 | corollary continuous_imp_open_vimage: | 
| 2042 | assumes "continuous_on s f" "open s" "open B" "f -` B \<subseteq> s" | |
| 63494 | 2043 | shows "open (f -` B)" | 
| 2044 | by (metis assms continuous_on_open_vimage le_iff_inf) | |
| 55734 | 2045 | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 2046 | corollary open_vimage[continuous_intros]: | 
| 63494 | 2047 | assumes "open s" | 
| 2048 | and "continuous_on UNIV f" | |
| 55775 | 2049 | shows "open (f -` s)" | 
| 63494 | 2050 | using assms by (simp add: continuous_on_open_vimage [OF open_UNIV]) | 
| 55775 | 2051 | |
| 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 | 2052 | 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 | 2053 | "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 | 2054 | proof - | 
| 63494 | 2055 | have *: "(\<And>A. P A \<longleftrightarrow> Q (- A)) \<Longrightarrow> (\<forall>A. P A) \<longleftrightarrow> (\<forall>A. Q A)" | 
| 2056 | 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 | 2057 | 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 | 2058 | show ?thesis | 
| 63494 | 2059 | unfolding continuous_on_open_invariant | 
| 2060 | 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 | 2061 | 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 | 2062 | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2063 | lemma continuous_on_closed_vimage: | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2064 | "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 | 2065 | unfolding continuous_on_closed_invariant | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2066 | 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 | 2067 | |
| 61426 
d53db136e8fd
new material on path_component_sets, inside, outside, etc. And more default simprules
 paulson <lp15@cam.ac.uk> parents: 
61342diff
changeset | 2068 | corollary closed_vimage_Int[continuous_intros]: | 
| 63494 | 2069 | assumes "closed s" | 
| 2070 | and "continuous_on t f" | |
| 2071 | 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 | 2072 | shows "closed (f -` s \<inter> t)" | 
| 63494 | 2073 | 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 | 2074 | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 2075 | corollary closed_vimage[continuous_intros]: | 
| 63494 | 2076 | assumes "closed s" | 
| 2077 | and "continuous_on UNIV f" | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 2078 | 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 | 2079 | using closed_vimage_Int [OF assms] by simp | 
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 2080 | |
| 62843 
313d3b697c9a
Mostly renaming (from HOL Light to Isabelle conventions), with a couple of new results
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2081 | 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 | 2082 | by (simp add: continuous_on_def) | 
| 
f0c894ab18c9
Liouville theorem, Fundamental Theorem of Algebra, etc.
 paulson <lp15@cam.ac.uk> parents: 
61810diff
changeset | 2083 | |
| 62843 
313d3b697c9a
Mostly renaming (from HOL Light to Isabelle conventions), with a couple of new results
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2084 | 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 | 2085 | 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 | 2086 | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2087 | lemma continuous_on_open_Union: | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2088 | "(\<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 | 2089 | unfolding continuous_on_def | 
| 2090 | 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 | 2091 | |
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2092 | lemma continuous_on_open_UN: | 
| 63494 | 2093 | "(\<And>s. s \<in> S \<Longrightarrow> open (A s)) \<Longrightarrow> (\<And>s. s \<in> S \<Longrightarrow> continuous_on (A s) f) \<Longrightarrow> | 
| 2094 | continuous_on (\<Union>s\<in>S. A s) f" | |
| 62343 
24106dc44def
prefer abbreviations for compound operators INFIMUM and SUPREMUM
 haftmann parents: 
62217diff
changeset | 2095 | by (rule continuous_on_open_Union) auto | 
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2096 | |
| 61204 | 2097 | lemma continuous_on_open_Un: | 
| 2098 | "open s \<Longrightarrow> open t \<Longrightarrow> continuous_on s f \<Longrightarrow> continuous_on t f \<Longrightarrow> continuous_on (s \<union> t) f" | |
| 2099 |   using continuous_on_open_Union [of "{s,t}"] by auto
 | |
| 2100 | ||
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2101 | lemma continuous_on_closed_Un: | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2102 | "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 | 2103 | 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 | 2104 | |
| 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 | 2105 | 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 | 2106 | 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 | 2107 | "\<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 | 2108 | "\<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 | 2109 | 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 | 2110 | 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 | 2111 | 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 | 2112 | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2113 | lemma continuous_on_If: | 
| 63494 | 2114 | assumes closed: "closed s" "closed t" | 
| 2115 | 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 | 2116 | 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 | 2117 | shows "continuous_on (s \<union> t) (\<lambda>x. if P x then f x else g x)" | 
| 2118 | (is "continuous_on _ ?h") | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2119 | proof- | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2120 | 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 | 2121 | by auto | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2122 | 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 | 2123 | by simp_all | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2124 | with closed show ?thesis | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2125 | by (rule continuous_on_closed_Un) | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2126 | qed | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2127 | |
| 65036 
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
 paulson <lp15@cam.ac.uk> parents: 
64969diff
changeset | 2128 | 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 | 2129 | "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 | 2130 | \<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 | 2131 | 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 | 2132 | 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 | 2133 | |
| 68296 
69d680e94961
tidying and reorganisation around Cauchy Integral Theorem
 paulson <lp15@cam.ac.uk> parents: 
68064diff
changeset | 2134 | 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 | 2135 | 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 | 2136 | |
| 68296 
69d680e94961
tidying and reorganisation around Cauchy Integral Theorem
 paulson <lp15@cam.ac.uk> parents: 
68064diff
changeset | 2137 | lemma continuous_on_id'[continuous_intros,simp]: "continuous_on s id" | 
| 63301 | 2138 | unfolding continuous_on_def id_def by fast | 
| 2139 | ||
| 68296 
69d680e94961
tidying and reorganisation around Cauchy Integral Theorem
 paulson <lp15@cam.ac.uk> parents: 
68064diff
changeset | 2140 | 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 | 2141 | 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 | 2142 | |
| 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 | 2143 | 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 | 2144 | unfolding continuous_on_def | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2145 | 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 | 2146 | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56329diff
changeset | 2147 | lemma continuous_on_compose[continuous_intros]: | 
| 63494 | 2148 | "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 | 2149 | 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 | 2150 | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2151 | 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 | 2152 | "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 | 2153 | 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 | 2154 | |
| 60720 | 2155 | lemma continuous_on_generate_topology: | 
| 2156 | assumes *: "open = generate_topology X" | |
| 63494 | 2157 | and **: "\<And>B. B \<in> X \<Longrightarrow> \<exists>C. open C \<and> C \<inter> A = f -` B \<inter> A" | 
| 60720 | 2158 | shows "continuous_on A f" | 
| 2159 | unfolding continuous_on_open_invariant | |
| 2160 | proof safe | |
| 63494 | 2161 | fix B :: "'a set" | 
| 2162 | assume "open B" | |
| 2163 | then show "\<exists>C. open C \<and> C \<inter> A = f -` B \<inter> A" | |
| 60720 | 2164 | unfolding * | 
| 63494 | 2165 | proof induct | 
| 60720 | 2166 | case (UN K) | 
| 2167 | 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" | |
| 2168 | by metis | |
| 2169 | then show ?case | |
| 2170 | by (intro exI[of _ "\<Union>k\<in>K. C k"]) blast | |
| 2171 | qed (auto intro: **) | |
| 2172 | qed | |
| 2173 | ||
| 2174 | lemma continuous_onI_mono: | |
| 63494 | 2175 |   fixes f :: "'a::linorder_topology \<Rightarrow> 'b::{dense_order,linorder_topology}"
 | 
| 60720 | 2176 | assumes "open (f`A)" | 
| 63494 | 2177 | and mono: "\<And>x y. x \<in> A \<Longrightarrow> y \<in> A \<Longrightarrow> x \<le> y \<Longrightarrow> f x \<le> f y" | 
| 60720 | 2178 | shows "continuous_on A f" | 
| 2179 | proof (rule continuous_on_generate_topology[OF open_generated_order], safe) | |
| 2180 | have monoD: "\<And>x y. x \<in> A \<Longrightarrow> y \<in> A \<Longrightarrow> f x < f y \<Longrightarrow> x < y" | |
| 2181 | by (auto simp: not_le[symmetric] mono) | |
| 63494 | 2182 | 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 | 
| 2183 | proof - | |
| 2184 |     obtain y where "f a < y" "{f a ..< y} \<subseteq> f`A"
 | |
| 2185 | using open_right[OF \<open>open (f`A)\<close>, of "f a" b] a fa | |
| 60720 | 2186 | by auto | 
| 63494 | 2187 | obtain z where z: "f a < z" "z < min b y" | 
| 60720 | 2188 | using dense[of "f a" "min b y"] \<open>f a < y\<close> \<open>f a < b\<close> by auto | 
| 63494 | 2189 | then obtain c where "z = f c" "c \<in> A" | 
| 60720 | 2190 |       using \<open>{f a ..< y} \<subseteq> f`A\<close>[THEN subsetD, of z] by (auto simp: less_imp_le)
 | 
| 63494 | 2191 | with a z show ?thesis | 
| 2192 | by (auto intro!: exI[of _ c] simp: monoD) | |
| 2193 | qed | |
| 60720 | 2194 |   then show "\<exists>C. open C \<and> C \<inter> A = f -` {..<b} \<inter> A" for b
 | 
| 2195 |     by (intro exI[of _ "(\<Union>x\<in>{x\<in>A. f x < b}. {..< x})"])
 | |
| 2196 | (auto intro: le_less_trans[OF mono] less_imp_le) | |
| 2197 | ||
| 63494 | 2198 | 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 | 
| 2199 | proof - | |
| 2200 | note a fa | |
| 60720 | 2201 | moreover | 
| 63494 | 2202 |     obtain y where "y < f a" "{y <.. f a} \<subseteq> f`A"
 | 
| 2203 | using open_left[OF \<open>open (f`A)\<close>, of "f a" b] a fa | |
| 60720 | 2204 | by auto | 
| 63494 | 2205 | then obtain z where z: "max b y < z" "z < f a" | 
| 60720 | 2206 | using dense[of "max b y" "f a"] \<open>y < f a\<close> \<open>b < f a\<close> by auto | 
| 63494 | 2207 | then obtain c where "z = f c" "c \<in> A" | 
| 60720 | 2208 |       using \<open>{y <.. f a} \<subseteq> f`A\<close>[THEN subsetD, of z] by (auto simp: less_imp_le)
 | 
| 63494 | 2209 | with a z show ?thesis | 
| 2210 | by (auto intro!: exI[of _ c] simp: monoD) | |
| 2211 | qed | |
| 60720 | 2212 |   then show "\<exists>C. open C \<and> C \<inter> A = f -` {b <..} \<inter> A" for b
 | 
| 2213 |     by (intro exI[of _ "(\<Union>x\<in>{x\<in>A. b < f x}. {x <..})"])
 | |
| 2214 | (auto intro: less_le_trans[OF _ mono] less_imp_le) | |
| 2215 | qed | |
| 2216 | ||
| 65204 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2217 | lemma continuous_on_IccI: | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2218 | "\<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 | 2219 | (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 | 2220 | (\<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 | 2221 |     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 | 2222 | 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 | 2223 |   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 | 2224 | 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 | 2225 | at_within_Icc_at) | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2226 | |
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2227 | lemma | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2228 | 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 | 2229 |   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 | 2230 | 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 | 2231 | 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 | 2232 | using assms | 
| 
d23eded35a33
modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
 immler parents: 
65036diff
changeset | 2233 | 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 | 2234 | 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 | 2235 | |
| 68965 
1254f3e57fed
Removed problematic rules from continuous_intros
 eberlm <eberlm@in.tum.de> parents: 
68860diff
changeset | 2236 | lemma continuous_on_discrete [simp]: | 
| 68860 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 2237 | "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 | 2238 | by (auto simp: continuous_on_def at_discrete) | 
| 63494 | 2239 | |
| 77223 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2240 | lemma continuous_on_of_nat [continuous_intros]: | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2241 | assumes "continuous_on A f" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2242 | 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 | 2243 | 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 | 2244 | by (simp add: o_def) | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2245 | |
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2246 | lemma continuous_on_of_int [continuous_intros]: | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2247 | assumes "continuous_on A f" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2248 | 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 | 2249 | 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 | 2250 | by (simp add: o_def) | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2251 | |
| 60758 | 2252 | 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 | 2253 | |
| 63494 | 2254 | definition continuous :: "'a::t2_space filter \<Rightarrow> ('a \<Rightarrow> 'b::topological_space) \<Rightarrow> bool"
 | 
| 2255 | 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 | 2256 | |
| 
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 | 2257 | 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 | 2258 | 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 | 2259 | |
| 
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 | 2260 | 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 | 2261 | 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 | |
| 61973 | 2263 | 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 | 2264 | 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 | 2265 | |
| 
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 | 2266 | 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 | 2267 | "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 | 2268 | (\<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 | 2269 | 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 | 2270 | |
| 
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 | 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 | 2272 | "continuous (at x within s) f \<Longrightarrow> continuous (at (f x) within f ` s) g \<Longrightarrow> | 
| 63494 | 2273 | 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 | 2274 | 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 | 2275 | |
| 
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 | 2276 | 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 | 2277 | "continuous (at x within s) f \<Longrightarrow> continuous (at (f x) within f ` s) g \<Longrightarrow> | 
| 63494 | 2278 | 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 | 2279 | using continuous_within_compose[of x s f g] by (simp add: comp_def) | 
| 51471 | 2280 | |
| 61976 | 2281 | 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 | 2282 | 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 | 2283 | |
| 
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 | 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 | 2285 | 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 | 2286 | |
| 70707 
125705f5965f
A little-known material, and some tidying up
 paulson <lp15@cam.ac.uk> parents: 
70367diff
changeset | 2287 | 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 | 2288 | by (simp add: id_def) | 
| 
125705f5965f
A little-known material, and some tidying up
 paulson <lp15@cam.ac.uk> parents: 
70367diff
changeset | 2289 | |
| 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 | 2290 | 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 | 2291 | 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 | 2292 | |
| 
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 | 2293 | 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 | 2294 | "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 | 2295 | 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 | 2296 | |
| 68965 
1254f3e57fed
Removed problematic rules from continuous_intros
 eberlm <eberlm@in.tum.de> parents: 
68860diff
changeset | 2297 | lemma continuous_discrete [simp]: | 
| 68860 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 2298 | "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 | 2299 | by (auto simp: continuous_def at_discrete) | 
| 
f443ec10447d
Some basic materials on filters and topology
 Manuel Eberl <eberlm@in.tum.de> parents: 
68802diff
changeset | 2300 | |
| 63494 | 2301 | abbreviation isCont :: "('a::t2_space \<Rightarrow> 'b::topological_space) \<Rightarrow> 'a \<Rightarrow> bool"
 | 
| 2302 | 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 | 2303 | |
| 61976 | 2304 | 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 | 2305 | 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 | 2306 | |
| 68721 | 2307 | lemma isContD: "isCont f x \<Longrightarrow> f \<midarrow>x\<rightarrow> f x" | 
| 2308 | by (simp add: isCont_def) | |
| 2309 | ||
| 63295 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 2310 | lemma isCont_cong: | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 2311 | assumes "eventually (\<lambda>x. f x = g x) (nhds x)" | 
| 63494 | 2312 | shows "isCont f x \<longleftrightarrow> isCont g x" | 
| 63295 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 2313 | proof - | 
| 63494 | 2314 | from assms have [simp]: "f x = g x" | 
| 2315 | by (rule eventually_nhds_x_imp_x) | |
| 63295 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 2316 | 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 | 2317 | by (auto simp: eventually_at_filter elim!: eventually_mono) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 2318 | 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 | 2319 | by (intro filterlim_cong) (auto elim!: eventually_mono) | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 2320 | with assms show ?thesis by simp | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 2321 | qed | 
| 
52792bb9126e
Facts about HK integration, complex powers, Gamma function
 eberlm parents: 
63171diff
changeset | 2322 | |
| 60762 | 2323 | 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 | 2324 | 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 | 2325 | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2326 | 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 | 2327 | 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 | 2328 | |
| 62083 | 2329 | lemma continuous_within_open: "a \<in> A \<Longrightarrow> open A \<Longrightarrow> continuous (at a within A) f \<longleftrightarrow> isCont f a" | 
| 2330 | by (simp add: at_within_open_NO_MATCH) | |
| 2331 | ||
| 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 | 2332 | lemma continuous_at_imp_continuous_on: "\<forall>x\<in>s. isCont f x \<Longrightarrow> continuous_on s f" | 
| 60762 | 2333 | 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 | 2334 | |
| 
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 | 2335 | 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 | 2336 | 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 | 2337 | |
| 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 | 2338 | 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 | 2339 | unfolding o_def by (rule isCont_o2) | 
| 51471 | 2340 | |
| 61973 | 2341 | lemma isCont_tendsto_compose: "isCont g l \<Longrightarrow> (f \<longlongrightarrow> l) F \<Longrightarrow> ((\<lambda>x. g (f x)) \<longlongrightarrow> g l) F" | 
| 51471 | 2342 | 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 | 2343 | |
| 62049 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61976diff
changeset | 2344 | lemma continuous_on_tendsto_compose: | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61976diff
changeset | 2345 | assumes f_cont: "continuous_on s f" | 
| 63494 | 2346 | and g: "(g \<longlongrightarrow> l) F" | 
| 2347 | and l: "l \<in> s" | |
| 2348 | 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 | 2349 | 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 | 2350 | proof - | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61976diff
changeset | 2351 | 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 | 2352 | by (simp add: continuous_on_def) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61976diff
changeset | 2353 | 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 | 2354 | by (rule filterlim_If) | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61976diff
changeset | 2355 | (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 | 2356 | 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 | 2357 | show ?thesis | 
| 
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
 eberlm parents: 
61976diff
changeset | 2358 | 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 | 2359 | qed | 
| 51471 | 2360 | |
| 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 | 2361 | 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 | 2362 | "isCont g (f x) \<Longrightarrow> continuous (at x within s) f \<Longrightarrow> continuous (at x within s) (\<lambda>x. g (f x))" | 
| 63171 | 2363 | using continuous_at_imp_continuous_at_within continuous_within_compose2 by blast | 
| 51471 | 2364 | |
| 77223 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2365 | lemma at_within_isCont_imp_nhds: | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2366 |   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 | 2367 | 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 | 2368 | 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 | 2369 | proof - | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2370 | have "g \<midarrow>z\<rightarrow> f z" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2371 | using assms isContD tendsto_cong by blast | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2372 | 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 | 2373 | 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 | 2374 | 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 | 2375 | 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 | 2376 | ultimately show ?thesis | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2377 | by (auto elim:eventually_mono) | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2378 | qed | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2379 | |
| 77140 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2380 | lemma filtermap_nhds_open_map': | 
| 63494 | 2381 | assumes cont: "isCont f a" | 
| 77140 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2382 | and "open A" "a \<in> A" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2383 | 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 | 2384 | 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 | 2385 | 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 | 2386 | proof safe | 
| 63494 | 2387 | fix P | 
| 2388 | 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 | 2389 | then obtain S where S: "open S" "a \<in> S" "\<forall>x\<in>S. P (f x)" | 
| 63494 | 2390 | 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 | 2391 | show "eventually P (nhds (f a))" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2392 | unfolding eventually_nhds | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2393 | 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 | 2394 | show "open (f ` (A \<inter> S))" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2395 | 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 | 2396 | 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 | 2397 | using assms S by auto | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2398 | 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 | 2399 | using S that by auto | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2400 | qed | 
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57276diff
changeset | 2401 | 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 | 2402 | |
| 77140 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2403 | lemma filtermap_nhds_open_map: | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2404 | assumes cont: "isCont f a" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
77138diff
changeset | 2405 | 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 | 2406 | 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 | 2407 | 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 | 2408 | |
| 62102 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 hoelzl parents: 
62101diff
changeset | 2409 | lemma continuous_at_split: | 
| 63494 | 2410 | "continuous (at x) f \<longleftrightarrow> continuous (at_left x) f \<and> continuous (at_right x) f" | 
| 2411 | 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 | 2412 | 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 | 2413 | |
| 70365 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2414 | lemma continuous_on_max [continuous_intros]: | 
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2415 | 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 | 2416 | 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 | 2417 | 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 | 2418 | |
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2419 | lemma continuous_on_min [continuous_intros]: | 
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2420 | 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 | 2421 | 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 | 2422 | 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 | 2423 | |
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2424 | lemma continuous_max [continuous_intros]: | 
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2425 | 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 | 2426 | 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 | 2427 | 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 | 2428 | |
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2429 | lemma continuous_min [continuous_intros]: | 
| 
4df0628e8545
a few new lemmas and a bit of tidying
 paulson <lp15@cam.ac.uk> parents: 
69593diff
changeset | 2430 | 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 | 2431 | 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 | 2432 | 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 | 2433 | |
| 63494 | 2434 | text \<open> | 
| 63495 | 2435 | The following open/closed Collect lemmas are ported from | 
| 2436 | Sébastien Gouëzel's \<open>Ergodic_Theory\<close>. | |
| 63494 | 2437 | \<close> | 
| 63332 | 2438 | lemma open_Collect_neq: | 
| 63494 | 2439 | fixes f g :: "'a::topological_space \<Rightarrow> 'b::t2_space" | 
| 63332 | 2440 | assumes f: "continuous_on UNIV f" and g: "continuous_on UNIV g" | 
| 2441 |   shows "open {x. f x \<noteq> g x}"
 | |
| 2442 | proof (rule openI) | |
| 63494 | 2443 | fix t | 
| 2444 |   assume "t \<in> {x. f x \<noteq> g x}"
 | |
| 63332 | 2445 |   then obtain U V where *: "open U" "open V" "f t \<in> U" "g t \<in> V" "U \<inter> V = {}"
 | 
| 2446 | by (auto simp add: separation_t2) | |
| 2447 | with open_vimage[OF \<open>open U\<close> f] open_vimage[OF \<open>open V\<close> g] | |
| 2448 |   show "\<exists>T. open T \<and> t \<in> T \<and> T \<subseteq> {x. f x \<noteq> g x}"
 | |
| 2449 | by (intro exI[of _ "f -` U \<inter> g -` V"]) auto | |
| 2450 | qed | |
| 2451 | ||
| 2452 | lemma closed_Collect_eq: | |
| 63494 | 2453 | fixes f g :: "'a::topological_space \<Rightarrow> 'b::t2_space" | 
| 63332 | 2454 | assumes f: "continuous_on UNIV f" and g: "continuous_on UNIV g" | 
| 2455 |   shows "closed {x. f x = g x}"
 | |
| 2456 | using open_Collect_neq[OF f g] by (simp add: closed_def Collect_neg_eq) | |
| 2457 | ||
| 2458 | lemma open_Collect_less: | |
| 63494 | 2459 | fixes f g :: "'a::topological_space \<Rightarrow> 'b::linorder_topology" | 
| 63332 | 2460 | assumes f: "continuous_on UNIV f" and g: "continuous_on UNIV g" | 
| 2461 |   shows "open {x. f x < g x}"
 | |
| 2462 | proof (rule openI) | |
| 63494 | 2463 | fix t | 
| 2464 |   assume t: "t \<in> {x. f x < g x}"
 | |
| 63332 | 2465 |   show "\<exists>T. open T \<and> t \<in> T \<and> T \<subseteq> {x. f x < g x}"
 | 
| 63494 | 2466 | proof (cases "\<exists>z. f t < z \<and> z < g t") | 
| 2467 | case True | |
| 2468 | then obtain z where "f t < z \<and> z < g t" by blast | |
| 63332 | 2469 | then show ?thesis | 
| 2470 |       using open_vimage[OF _ f, of "{..< z}"] open_vimage[OF _ g, of "{z <..}"]
 | |
| 2471 |       by (intro exI[of _ "f -` {..<z} \<inter> g -` {z<..}"]) auto
 | |
| 2472 | next | |
| 63494 | 2473 | case False | 
| 63332 | 2474 |     then have *: "{g t ..} = {f t <..}" "{..< g t} = {.. f t}"
 | 
| 2475 | using t by (auto intro: leI) | |
| 2476 | show ?thesis | |
| 2477 |       using open_vimage[OF _ f, of "{..< g t}"] open_vimage[OF _ g, of "{f t <..}"] t
 | |
| 2478 |       apply (intro exI[of _ "f -` {..< g t} \<inter> g -` {f t<..}"])
 | |
| 2479 | apply (simp add: open_Int) | |
| 2480 | apply (auto simp add: *) | |
| 2481 | done | |
| 2482 | qed | |
| 2483 | qed | |
| 2484 | ||
| 2485 | lemma closed_Collect_le: | |
| 2486 | fixes f g :: "'a :: topological_space \<Rightarrow> 'b::linorder_topology" | |
| 63494 | 2487 | assumes f: "continuous_on UNIV f" | 
| 2488 | and g: "continuous_on UNIV g" | |
| 63332 | 2489 |   shows "closed {x. f x \<le> g x}"
 | 
| 63494 | 2490 | using open_Collect_less [OF g f] | 
| 2491 | by (simp add: closed_def Collect_neg_eq[symmetric] not_le) | |
| 2492 | ||
| 63332 | 2493 | |
| 61245 | 2494 | 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 | 2495 | |
| 
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 | 2496 | 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 | 2497 | 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 | 2498 | |
| 69529 | 2499 | definition compact :: "'a set \<Rightarrow> bool" where | 
| 2500 | 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 | 2501 | "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 | 2502 | |
| 
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 | lemma compactI: | 
| 60585 | 2504 | 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 | 2505 | shows "compact s" | 
| 69529 | 2506 | 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 | 2507 | |
| 
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 | 2508 | 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 | 2509 | 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 | 2510 | |
| 64758 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 2511 | 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 | 2512 | 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 | 2513 | obtains \<T>' where "\<T>' \<subseteq> \<T>" "finite \<T>'" "S \<subseteq> \<Union>\<T>'" | 
| 69529 | 2514 | 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 | 2515 | |
| 
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 | 2516 | lemma compactE_image: | 
| 64845 | 2517 | assumes "compact S" | 
| 67231 | 2518 | 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 | 2519 | and S: "S \<subseteq> (\<Union>c\<in>C. f c)" | 
| 64845 | 2520 | 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 | 2521 | apply (rule compactE[OF \<open>compact S\<close> S]) | 
| 67231 | 2522 | 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 | 2523 | 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 | 2524 | |
| 62843 
313d3b697c9a
Mostly renaming (from HOL Light to Isabelle conventions), with a couple of new results
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 2525 | lemma compact_Int_closed [intro]: | 
| 64845 | 2526 | assumes "compact S" | 
| 2527 | and "closed T" | |
| 2528 | shows "compact (S \<inter> T)" | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2529 | proof (rule compactI) | 
| 63494 | 2530 | fix C | 
| 2531 | assume C: "\<forall>c\<in>C. open c" | |
| 64845 | 2532 | assume cover: "S \<inter> T \<subseteq> \<Union>C" | 
| 2533 |   from C \<open>closed T\<close> have "\<forall>c\<in>C \<union> {- T}. open c"
 | |
| 63494 | 2534 | by auto | 
| 64845 | 2535 |   moreover from cover have "S \<subseteq> \<Union>(C \<union> {- T})"
 | 
| 63494 | 2536 | by auto | 
| 64845 | 2537 |   ultimately have "\<exists>D\<subseteq>C \<union> {- T}. finite D \<and> S \<subseteq> \<Union>D"
 | 
| 69529 | 2538 | using \<open>compact S\<close> unfolding compact_eq_Heine_Borel by auto | 
| 64845 | 2539 |   then obtain D where "D \<subseteq> C \<union> {- T} \<and> finite D \<and> S \<subseteq> \<Union>D" ..
 | 
| 2540 | then show "\<exists>D\<subseteq>C. finite D \<and> S \<inter> T \<subseteq> \<Union>D" | |
| 2541 |     by (intro exI[of _ "D - {-T}"]) auto
 | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2542 | qed | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2543 | |
| 64845 | 2544 | lemma compact_diff: "\<lbrakk>compact S; open T\<rbrakk> \<Longrightarrow> compact(S - T)" | 
| 2545 | by (simp add: Diff_eq compact_Int_closed open_closed) | |
| 2546 | ||
| 54797 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2547 | 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 | 2548 | 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 | 2549 | |
| 63494 | 2550 | |
| 2551 | subsection \<open>Finite intersection property\<close> | |
| 63301 | 2552 | |
| 54797 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2553 | lemma compact_fip: | 
| 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2554 | "compact U \<longleftrightarrow> | 
| 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2555 |     (\<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 | 2556 | (is "_ \<longleftrightarrow> ?R") | 
| 69529 | 2557 | 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 | 2558 | fix A | 
| 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2559 | assume "compact U" | 
| 63494 | 2560 |   assume A: "\<forall>a\<in>A. closed a" "U \<inter> \<Inter>A = {}"
 | 
| 2561 |   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 | 2562 | 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 | 2563 | by auto | 
| 60758 | 2564 | with \<open>compact U\<close> obtain B where "B \<subseteq> A" "finite (uminus`B)" "U \<subseteq> \<Union>(uminus`B)" | 
| 69529 | 2565 | unfolding compact_eq_Heine_Borel by (metis subset_image_iff) | 
| 63494 | 2566 | 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 | 2567 | 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 | 2568 | next | 
| 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2569 | fix A | 
| 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2570 | assume ?R | 
| 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2571 | 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 | 2572 |   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 | 2573 | by auto | 
| 60758 | 2574 |   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 | 2575 | 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 | 2576 | then show "\<exists>T\<subseteq>A. finite T \<and> U \<subseteq> \<Union>T" | 
| 63494 | 2577 | 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 | 2578 | qed | 
| 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2579 | |
| 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2580 | lemma compact_imp_fip: | 
| 63494 | 2581 | assumes "compact S" | 
| 2582 | and "\<And>T. T \<in> F \<Longrightarrow> closed T" | |
| 2583 |     and "\<And>F'. finite F' \<Longrightarrow> F' \<subseteq> F \<Longrightarrow> S \<inter> (\<Inter>F') \<noteq> {}"
 | |
| 2584 |   shows "S \<inter> (\<Inter>F) \<noteq> {}"
 | |
| 2585 | 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 | 2586 | |
| 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2587 | lemma compact_imp_fip_image: | 
| 56166 | 2588 | assumes "compact s" | 
| 2589 | and P: "\<And>i. i \<in> I \<Longrightarrow> closed (f i)" | |
| 2590 |     and Q: "\<And>I'. finite I' \<Longrightarrow> I' \<subseteq> I \<Longrightarrow> (s \<inter> (\<Inter>i\<in>I'. f i) \<noteq> {})"
 | |
| 2591 |   shows "s \<inter> (\<Inter>i\<in>I. f i) \<noteq> {}"
 | |
| 2592 | proof - | |
| 74668 | 2593 | from P have "\<forall>i \<in> f ` I. closed i" | 
| 63494 | 2594 | by blast | 
| 56166 | 2595 |   moreover have "\<forall>A. finite A \<and> A \<subseteq> f ` I \<longrightarrow> (s \<inter> (\<Inter>A) \<noteq> {})"
 | 
| 74668 | 2596 | by (metis Q finite_subset_image) | 
| 2597 |   ultimately show "s \<inter> (\<Inter>(f ` I)) \<noteq> {}"
 | |
| 2598 | by (metis \<open>compact s\<close> compact_imp_fip) | |
| 56166 | 2599 | qed | 
| 54797 
be020ec8560c
modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
 hoelzl parents: 
54258diff
changeset | 2600 | |
| 51471 | 2601 | end | 
| 2602 | ||
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2603 | lemma (in t2_space) compact_imp_closed: | 
| 63494 | 2604 | assumes "compact s" | 
| 2605 | shows "closed s" | |
| 2606 | unfolding closed_def | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2607 | proof (rule openI) | 
| 63494 | 2608 | fix y | 
| 2609 | assume "y \<in> - s" | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2610 |   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 | 2611 | have "s \<subseteq> \<Union>?C" | 
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2612 | proof | 
| 63494 | 2613 | fix x | 
| 2614 | assume "x \<in> s" | |
| 60758 | 2615 | with \<open>y \<in> - s\<close> have "x \<noteq> y" by clarsimp | 
| 63494 | 2616 |     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 | 2617 | by (rule hausdorff) | 
| 60758 | 2618 | 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 | 2619 | unfolding eventually_nhds by auto | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2620 | qed | 
| 64758 
3b33d2fc5fc0
A few new lemmas and needed adaptations
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 2621 | 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 | 2622 | by (rule compactE [OF \<open>compact s\<close>]) auto | 
| 63494 | 2623 | from \<open>D \<subseteq> ?C\<close> have "\<forall>x\<in>D. eventually (\<lambda>y. y \<notin> x) (nhds y)" | 
| 2624 | by auto | |
| 60758 | 2625 | 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 | 2626 | by (simp add: eventually_ball_finite) | 
| 60758 | 2627 | with \<open>s \<subseteq> \<Union>D\<close> have "eventually (\<lambda>y. y \<notin> s) (nhds y)" | 
| 61810 | 2628 | by (auto elim!: eventually_mono) | 
| 63494 | 2629 | 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 | 2630 | by (simp add: eventually_nhds subset_eq) | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2631 | qed | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2632 | |
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2633 | lemma compact_continuous_image: | 
| 63494 | 2634 | assumes f: "continuous_on s f" | 
| 2635 | and s: "compact s" | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2636 | shows "compact (f ` s)" | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2637 | proof (rule compactI) | 
| 63494 | 2638 | fix C | 
| 2639 | 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 | 2640 | 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 | 2641 | unfolding continuous_on_open_invariant by blast | 
| 53381 | 2642 | then obtain A where A: "\<forall>c\<in>C. open (A c) \<and> A c \<inter> s = f -` c \<inter> s" | 
| 2643 | 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 | 2644 | 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 | 2645 | 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 | 2646 | 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 | 2647 | 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 | 2648 | 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 | 2649 | qed | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2650 | |
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2651 | lemma continuous_on_inv: | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2652 | fixes f :: "'a::topological_space \<Rightarrow> 'b::t2_space" | 
| 63494 | 2653 | assumes "continuous_on s f" | 
| 2654 | and "compact s" | |
| 2655 | 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 | 2656 | shows "continuous_on (f ` s) g" | 
| 63494 | 2657 | unfolding continuous_on_topological | 
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2658 | proof (clarsimp simp add: assms(3)) | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2659 | fix x :: 'a and B :: "'a set" | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2660 | 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 | 2661 | 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 | 2662 | using assms(3) by (auto, metis) | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2663 | have "continuous_on (s - B) f" | 
| 60758 | 2664 | 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 | 2665 | by (rule continuous_on_subset) | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2666 | moreover have "compact (s - B)" | 
| 60758 | 2667 | 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 | 2668 | 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 | 2669 | ultimately have "compact (f ` (s - B))" | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2670 | by (rule compact_continuous_image) | 
| 63494 | 2671 | then have "closed (f ` (s - B))" | 
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2672 | by (rule compact_imp_closed) | 
| 63494 | 2673 | then have "open (- f ` (s - B))" | 
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2674 | by (rule open_Compl) | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2675 | moreover have "f x \<in> - f ` (s - B)" | 
| 60758 | 2676 | 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 | 2677 | 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 | 2678 | by (simp add: 1) | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2679 | 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 | 2680 | by fast | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2681 | qed | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2682 | |
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2683 | lemma continuous_on_inv_into: | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2684 | fixes f :: "'a::topological_space \<Rightarrow> 'b::t2_space" | 
| 63494 | 2685 | assumes s: "continuous_on s f" "compact s" | 
| 2686 | and f: "inj_on f s" | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 2687 | 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 | 2688 | 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 | 2689 | |
| 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 | 2690 | 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 | 2691 |   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 | 2692 | 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 | 2693 | 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 | 2694 | 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 | 2695 | 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 | 2696 | 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 | 2697 |   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 | 2698 | by auto | 
| 60758 | 2699 |   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 | 2700 | by (metis compactE_image) | 
| 60758 | 2701 |   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 | 2702 | 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 | 2703 |   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 | 2704 | by (auto intro: less_le_trans simp: subset_eq) | 
| 60758 | 2705 | 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 | 2706 | 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 | 2707 | 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 | 2708 | |
| 
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 | 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 | 2710 |   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 | 2711 | 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 | 2712 | 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 | 2713 | 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 | 2714 | 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 | 2715 | 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 | 2716 |   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 | 2717 | by auto | 
| 60758 | 2718 |   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 | 2719 | by (metis compactE_image) | 
| 60758 | 2720 |   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 | 2721 | 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 | 2722 |   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 | 2723 | by (auto intro: le_less_trans simp: subset_eq) | 
| 60758 | 2724 | 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 | 2725 | 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 | 2726 | 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 | 2727 | |
| 
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 | 2728 | 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 | 2729 | 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 | 2730 |   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 | 2731 | 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 | 2732 | |
| 
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 | 2733 | 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 | 2734 | 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 | 2735 |   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 | 2736 | 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 | 2737 | |
| 63494 | 2738 | |
| 60758 | 2739 | subsection \<open>Connectedness\<close> | 
| 51480 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2740 | |
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2741 | context topological_space | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2742 | begin | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2743 | |
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2744 | definition "connected S \<longleftrightarrow> | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2745 |   \<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 | 2746 | |
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2747 | lemma connectedI: | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2748 |   "(\<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 | 2749 | \<Longrightarrow> connected U" | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2750 | by (auto simp: connected_def) | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2751 | |
| 61306 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2752 | 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 | 2753 | by (auto intro!: connectedI) | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2754 | |
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2755 | lemma connected_sing [simp]: "connected {x}"
 | 
| 51480 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2756 | by (auto intro!: connectedI) | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2757 | |
| 56329 | 2758 | lemma connectedD: | 
| 62102 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 hoelzl parents: 
62101diff
changeset | 2759 |   "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 | 2760 | by (auto simp: connected_def) | 
| 2761 | ||
| 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 | 2762 | 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 | 2763 | |
| 61306 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2764 | lemma connected_closed: | 
| 63494 | 2765 | "connected s \<longleftrightarrow> | 
| 2766 |     \<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> {})"
 | |
| 2767 | apply (simp add: connected_def del: ex_simps, safe) | |
| 2768 | apply (drule_tac x="-A" in spec) | |
| 2769 | apply (drule_tac x="-B" in spec) | |
| 2770 | apply (fastforce simp add: closed_def [symmetric]) | |
| 2771 | apply (drule_tac x="-A" in spec) | |
| 2772 | apply (drule_tac x="-B" in spec) | |
| 2773 | apply (fastforce simp add: open_closed [symmetric]) | |
| 2774 | done | |
| 61306 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2775 | |
| 62397 
5ae24f33d343
Substantial new material for multivariate analysis. Also removal of some duplicates.
 paulson <lp15@cam.ac.uk> parents: 
62381diff
changeset | 2776 | lemma connected_closedD: | 
| 63494 | 2777 |   "\<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 = {}"
 | 
| 2778 | 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 | 2779 | |
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2780 | lemma connected_Union: | 
| 63494 | 2781 | assumes cs: "\<And>s. s \<in> S \<Longrightarrow> connected s" | 
| 2782 |     and ne: "\<Inter>S \<noteq> {}"
 | |
| 2783 | 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 | 2784 | proof (rule connectedI) | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2785 | fix A B | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2786 |   assume A: "open A" and B: "open B" and Alap: "A \<inter> \<Union>S \<noteq> {}" and Blap: "B \<inter> \<Union>S \<noteq> {}"
 | 
| 63494 | 2787 |     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 | 2788 |   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 | 2789 | using disj by auto | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2790 |   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 | 2791 | using Alap by auto | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2792 |   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 | 2793 | using Blap by auto | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2794 | 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 | 2795 | using ne by auto | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2796 | then have "x \<in> \<Union>S" | 
| 61342 | 2797 | 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 | 2798 | 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 | 2799 | using cover by auto | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2800 | then show False | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2801 | 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 | 2802 | 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 | 2803 | qed | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2804 | |
| 63494 | 2805 | 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 | 2806 |   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 | 2807 | |
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2808 | lemma connected_diff_open_from_closed: | 
| 63494 | 2809 | assumes st: "s \<subseteq> t" | 
| 2810 | and tu: "t \<subseteq> u" | |
| 2811 | and s: "open s" | |
| 2812 | and t: "closed t" | |
| 2813 | and u: "connected u" | |
| 2814 | 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 | 2815 | shows "connected(u - s)" | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2816 | proof (rule connectedI) | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2817 | fix A B | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2818 |   assume AB: "open A" "open B" "A \<inter> (u - s) \<noteq> {}" "B \<inter> (u - s) \<noteq> {}"
 | 
| 63494 | 2819 |     and disj: "A \<inter> B \<inter> (u - s) = {}"
 | 
| 2820 | 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 | 2821 |   then consider "A \<inter> (t - s) = {}" | "B \<inter> (t - s) = {}"
 | 
| 63494 | 2822 | 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 | 2823 | then show False | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2824 | proof cases | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2825 | case 1 | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2826 |     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 | 2827 | using disj st by auto | 
| 63494 | 2828 | moreover have "u \<subseteq> (A - t) \<union> (B \<union> s)" | 
| 2829 | 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 | 2830 | ultimately show False | 
| 63494 | 2831 | 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 | 2832 | next | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2833 | case 2 | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2834 |     then have "(A \<union> s) \<inter> (B - t) \<inter> u = {}"
 | 
| 63494 | 2835 | using disj st by auto | 
| 2836 | moreover have "u \<subseteq> (A \<union> s) \<union> (B - t)" | |
| 2837 | 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 | 2838 | ultimately show False | 
| 63494 | 2839 | 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 | 2840 | qed | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2841 | qed | 
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 2842 | |
| 59106 | 2843 | lemma connected_iff_const: | 
| 2844 | fixes S :: "'a::topological_space set" | |
| 2845 | shows "connected S \<longleftrightarrow> (\<forall>P::'a \<Rightarrow> bool. continuous_on S P \<longrightarrow> (\<exists>c. \<forall>s\<in>S. P s = c))" | |
| 2846 | proof safe | |
| 63494 | 2847 | fix P :: "'a \<Rightarrow> bool" | 
| 2848 | assume "connected S" "continuous_on S P" | |
| 59106 | 2849 |   then have "\<And>b. \<exists>A. open A \<and> A \<inter> S = P -` {b} \<inter> S"
 | 
| 62369 | 2850 | unfolding continuous_on_open_invariant by (simp add: open_discrete) | 
| 59106 | 2851 | from this[of True] this[of False] | 
| 2852 |   obtain t f where "open t" "open f" and *: "f \<inter> S = P -` {False} \<inter> S" "t \<inter> S = P -` {True} \<inter> S"
 | |
| 63171 | 2853 | by meson | 
| 59106 | 2854 |   then have "t \<inter> S = {} \<or> f \<inter> S = {}"
 | 
| 60758 | 2855 | by (intro connectedD[OF \<open>connected S\<close>]) auto | 
| 59106 | 2856 | then show "\<exists>c. \<forall>s\<in>S. P s = c" | 
| 2857 | proof (rule disjE) | |
| 63494 | 2858 |     assume "t \<inter> S = {}"
 | 
| 2859 | then show ?thesis | |
| 59106 | 2860 | unfolding * by (intro exI[of _ False]) auto | 
| 2861 | next | |
| 63494 | 2862 |     assume "f \<inter> S = {}"
 | 
| 2863 | then show ?thesis | |
| 59106 | 2864 | unfolding * by (intro exI[of _ True]) auto | 
| 2865 | qed | |
| 2866 | next | |
| 2867 | assume P: "\<forall>P::'a \<Rightarrow> bool. continuous_on S P \<longrightarrow> (\<exists>c. \<forall>s\<in>S. P s = c)" | |
| 2868 | show "connected S" | |
| 2869 | proof (rule connectedI) | |
| 63494 | 2870 | fix A B | 
| 2871 |     assume *: "open A" "open B" "A \<inter> S \<noteq> {}" "B \<inter> S \<noteq> {}" "A \<inter> B \<inter> S = {}" "S \<subseteq> A \<union> B"
 | |
| 59106 | 2872 | have "continuous_on S (\<lambda>x. x \<in> A)" | 
| 2873 | unfolding continuous_on_open_invariant | |
| 2874 | proof safe | |
| 2875 | fix C :: "bool set" | |
| 2876 |       have "C = UNIV \<or> C = {True} \<or> C = {False} \<or> C = {}"
 | |
| 2877 | using subset_UNIV[of C] unfolding UNIV_bool by auto | |
| 2878 | with * show "\<exists>T. open T \<and> T \<inter> S = (\<lambda>x. x \<in> A) -` C \<inter> S" | |
| 2879 |         by (intro exI[of _ "(if True \<in> C then A else {}) \<union> (if False \<in> C then B else {})"]) auto
 | |
| 2880 | qed | |
| 63494 | 2881 | from P[rule_format, OF this] obtain c where "\<And>s. s \<in> S \<Longrightarrow> (s \<in> A) = c" | 
| 2882 | by blast | |
| 59106 | 2883 | with * show False | 
| 2884 | by (cases c) auto | |
| 2885 | qed | |
| 2886 | qed | |
| 2887 | ||
| 63494 | 2888 | lemma connectedD_const: "connected S \<Longrightarrow> continuous_on S P \<Longrightarrow> \<exists>c. \<forall>s\<in>S. P s = c" | 
| 2889 | for P :: "'a::topological_space \<Rightarrow> bool" | |
| 2890 | by (auto simp: connected_iff_const) | |
| 59106 | 2891 | |
| 2892 | lemma connectedI_const: | |
| 2893 | "(\<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 | 2894 | by (auto simp: connected_iff_const) | 
| 59106 | 2895 | |
| 56329 | 2896 | lemma connected_local_const: | 
| 2897 | assumes "connected A" "a \<in> A" "b \<in> A" | |
| 63494 | 2898 | and *: "\<forall>a\<in>A. eventually (\<lambda>b. f a = f b) (at a within A)" | 
| 56329 | 2899 | shows "f a = f b" | 
| 2900 | proof - | |
| 2901 | obtain S where S: "\<And>a. a \<in> A \<Longrightarrow> a \<in> S a" "\<And>a. a \<in> A \<Longrightarrow> open (S a)" | |
| 2902 | "\<And>a x. a \<in> A \<Longrightarrow> x \<in> S a \<Longrightarrow> x \<in> A \<Longrightarrow> f a = f x" | |
| 2903 | using * unfolding eventually_at_topological by metis | |
| 2904 |   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"
 | |
| 2905 |   have "?P \<inter> A = {} \<or> ?N \<inter> A = {}"
 | |
| 60758 | 2906 | using \<open>connected A\<close> S \<open>a\<in>A\<close> | 
| 56329 | 2907 | by (intro connectedD) (auto, metis) | 
| 2908 | then show "f a = f b" | |
| 2909 | proof | |
| 2910 |     assume "?N \<inter> A = {}"
 | |
| 2911 | then have "\<forall>x\<in>A. f a = f x" | |
| 2912 | using S(1) by auto | |
| 60758 | 2913 | with \<open>b\<in>A\<close> show ?thesis by auto | 
| 56329 | 2914 | next | 
| 2915 |     assume "?P \<inter> A = {}" then show ?thesis
 | |
| 60758 | 2916 | using \<open>a \<in> A\<close> S(1)[of a] by auto | 
| 56329 | 2917 | qed | 
| 2918 | qed | |
| 2919 | ||
| 51480 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2920 | lemma (in linorder_topology) connectedD_interval: | 
| 63494 | 2921 | assumes "connected U" | 
| 2922 | and xy: "x \<in> U" "y \<in> U" | |
| 2923 | and "x \<le> z" "z \<le> y" | |
| 51480 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2924 | shows "z \<in> U" | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2925 | proof - | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2926 |   have eq: "{..<z} \<union> {z<..} = - {z}"
 | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2927 | by auto | 
| 63494 | 2928 | have "\<not> connected U" if "z \<notin> U" "x < z" "z < y" | 
| 2929 | using xy that | |
| 2930 | apply (simp only: connected_def simp_thms) | |
| 2931 |     apply (rule_tac exI[of _ "{..< z}"])
 | |
| 2932 |     apply (rule_tac exI[of _ "{z <..}"])
 | |
| 2933 | apply (auto simp add: eq) | |
| 2934 | done | |
| 51480 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2935 | with assms show "z \<in> U" | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2936 | by (metis less_le) | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2937 | qed | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2938 | |
| 67685 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2939 | lemma (in linorder_topology) not_in_connected_cases: | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2940 | assumes conn: "connected S" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2941 | assumes nbdd: "x \<notin> S" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2942 |   assumes ne: "S \<noteq> {}"
 | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2943 | 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 | 2944 | proof - | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2945 | 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 | 2946 |   {
 | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2947 | assume "s \<le> x" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2948 | 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 | 2949 | 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 | 2950 | by simp | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2951 | 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 | 2952 | using le_cases by blast | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2953 | then have "bdd_above S" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2954 | by (rule local.bdd_aboveI) | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2955 | note this wit | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2956 |   } moreover {
 | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2957 | assume "x \<le> s" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2958 | 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 | 2959 | 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 | 2960 | by simp | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2961 | 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 | 2962 | using le_cases by blast | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2963 | then have "bdd_below S" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2964 | by (rule bdd_belowI) | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2965 | note this wit | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2966 | } ultimately show ?thesis | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2967 | by (meson le_cases that) | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2968 | qed | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 2969 | |
| 51480 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2970 | lemma connected_continuous_image: | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2971 | assumes *: "continuous_on s f" | 
| 63494 | 2972 | and "connected s" | 
| 51480 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2973 | shows "connected (f ` s)" | 
| 59106 | 2974 | proof (rule connectedI_const) | 
| 63494 | 2975 | fix P :: "'b \<Rightarrow> bool" | 
| 2976 | assume "continuous_on (f ` s) P" | |
| 59106 | 2977 | then have "continuous_on s (P \<circ> f)" | 
| 2978 | by (rule continuous_on_compose[OF *]) | |
| 60758 | 2979 | from connectedD_const[OF \<open>connected s\<close> this] show "\<exists>c. \<forall>s\<in>f ` s. P s = c" | 
| 59106 | 2980 | by auto | 
| 51480 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2981 | qed | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 2982 | |
| 77223 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2983 | lemma connected_Un_UN: | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2984 |   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 | 2985 | shows "connected (A \<union> \<Union>B)" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2986 | proof (rule connectedI_const) | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2987 | fix f :: "'a \<Rightarrow> bool" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2988 | 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 | 2989 | have "connected A" "continuous_on A f" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2990 | 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 | 2991 | 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 | 2992 | by metis | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2993 | 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 | 2994 | proof - | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2995 | have "connected X" "continuous_on X f" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2996 | 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 | 2997 | 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 | 2998 | by metis | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2999 | 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 | 3000 | by auto | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 3001 | 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 | 3002 | by auto | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 3003 | qed | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 3004 | 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 | 3005 | by (intro exI[of _ c]) auto | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 3006 | qed | 
| 61306 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 3007 | |
| 
9dd394c866fc
New theorems about connected sets. And pairwise moved to Set.thy.
 paulson <lp15@cam.ac.uk> parents: 
61245diff
changeset | 3008 | section \<open>Linear Continuum Topologies\<close> | 
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3009 | |
| 51775 
408d937c9486
revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
 hoelzl parents: 
51774diff
changeset | 3010 | 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 | 3011 | begin | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3012 | |
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3013 | lemma Inf_notin_open: | 
| 63494 | 3014 | assumes A: "open A" | 
| 3015 | 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 | 3016 | shows "Inf A \<notin> A" | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3017 | proof | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3018 | assume "Inf A \<in> A" | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3019 |   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 | 3020 | 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 | 3021 | 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 | 3022 | by (auto simp: subset_eq) | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3023 | then show False | 
| 63494 | 3024 | using cInf_lower[OF \<open>c \<in> A\<close>] bnd | 
| 3025 | 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 | 3026 | qed | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3027 | |
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3028 | lemma Sup_notin_open: | 
| 63494 | 3029 | assumes A: "open A" | 
| 3030 | 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 | 3031 | shows "Sup A \<notin> A" | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3032 | proof | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3033 | assume "Sup A \<in> A" | 
| 63494 | 3034 |   with assms obtain b where "Sup A < b" "{Sup A ..< b} \<subseteq> A"
 | 
| 3035 | 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 | 3036 | 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 | 3037 | by (auto simp: subset_eq) | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3038 | then show False | 
| 63494 | 3039 | using cSup_upper[OF \<open>c \<in> A\<close>] bnd | 
| 3040 | 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 | 3041 | qed | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3042 | |
| 51480 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 3043 | end | 
| 
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
 hoelzl parents: 
51479diff
changeset | 3044 | |
| 51775 
408d937c9486
revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
 hoelzl parents: 
51774diff
changeset | 3045 | 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 | 3046 | proof | 
| 
408d937c9486
revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
 hoelzl parents: 
51774diff
changeset | 3047 | fix x :: 'a | 
| 53381 | 3048 | obtain y where "x < y \<or> y < x" | 
| 3049 | using ex_gt_or_lt [of x] .. | |
| 63494 | 3050 |   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 | 3051 | by auto | 
| 
408d937c9486
revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
 hoelzl parents: 
51774diff
changeset | 3052 | qed | 
| 
408d937c9486
revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
 hoelzl parents: 
51774diff
changeset | 3053 | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3054 | 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 | 3055 | 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 | 3056 | 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 | 3057 | shows "connected U" | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3058 | proof (rule connectedI) | 
| 63494 | 3059 |   {
 | 
| 3060 | fix A B | |
| 3061 |     assume "open A" "open B" "A \<inter> B \<inter> U = {}" "U \<subseteq> A \<union> B"
 | |
| 3062 | fix x y | |
| 3063 | 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 | 3064 | |
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3065 |     let ?z = "Inf (B \<inter> {x <..})"
 | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3066 | |
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3067 | have "x \<le> ?z" "?z \<le> y" | 
| 60758 | 3068 | using \<open>y \<in> B\<close> \<open>x < y\<close> by (auto intro: cInf_lower cInf_greatest) | 
| 3069 | 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 | 3070 | by (rule *) | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3071 |     moreover have "?z \<notin> B \<inter> {x <..}"
 | 
| 60758 | 3072 | 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 | 3073 | ultimately have "?z \<in> A" | 
| 60758 | 3074 |       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 | 3075 | have "\<exists>b\<in>B. b \<in> A \<and> b \<in> U" if "?z < y" | 
| 3076 | proof - | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3077 |       obtain a where "?z < a" "{?z ..< a} \<subseteq> A"
 | 
| 60758 | 3078 | 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 | 3079 | moreover obtain b where "b \<in> B" "x < b" "b < min a y" | 
| 60758 | 3080 |         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 | 3081 | by auto | 
| 53374 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53215diff
changeset | 3082 | moreover have "?z \<le> b" | 
| 60758 | 3083 | 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 | 3084 | by (intro cInf_lower) auto | 
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3085 | moreover have "b \<in> U" | 
| 60758 | 3086 | using \<open>x \<le> ?z\<close> \<open>?z \<le> b\<close> \<open>b < min a y\<close> | 
| 3087 | by (intro *[OF \<open>x \<in> U\<close> \<open>y \<in> U\<close>]) (auto simp: less_imp_le) | |
| 63494 | 3088 | ultimately show ?thesis | 
| 3089 | by (intro bexI[of _ b]) auto | |
| 3090 | qed | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3091 | then have False | 
| 63494 | 3092 |       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>
 | 
| 3093 | unfolding le_less by blast | |
| 3094 | } | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3095 | note not_disjoint = this | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3096 | |
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3097 |   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 | 3098 |   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 | 3099 |   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 | 3100 | moreover note not_disjoint[of B A y x] not_disjoint[of A B x y] | 
| 63494 | 3101 | ultimately show False | 
| 3102 | 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 | 3103 | qed | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3104 | |
| 63494 | 3105 | 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)" | 
| 3106 | 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 | 3107 | 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 | 3108 | |
| 51775 
408d937c9486
revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
 hoelzl parents: 
51774diff
changeset | 3109 | lemma connected_UNIV[simp]: "connected (UNIV::'a::linear_continuum_topology set)" | 
| 63494 | 3110 | by (simp add: connected_iff_interval) | 
| 3111 | ||
| 3112 | lemma connected_Ioi[simp]: "connected {a<..}"
 | |
| 3113 | for a :: "'a::linear_continuum_topology" | |
| 3114 | by (auto simp: connected_iff_interval) | |
| 3115 | ||
| 3116 | lemma connected_Ici[simp]: "connected {a..}"
 | |
| 3117 | for a :: "'a::linear_continuum_topology" | |
| 3118 | by (auto simp: connected_iff_interval) | |
| 3119 | ||
| 3120 | lemma connected_Iio[simp]: "connected {..<a}"
 | |
| 3121 | for a :: "'a::linear_continuum_topology" | |
| 3122 | by (auto simp: connected_iff_interval) | |
| 3123 | ||
| 3124 | lemma connected_Iic[simp]: "connected {..a}"
 | |
| 3125 | for a :: "'a::linear_continuum_topology" | |
| 3126 | by (auto simp: connected_iff_interval) | |
| 3127 | ||
| 3128 | lemma connected_Ioo[simp]: "connected {a<..<b}"
 | |
| 3129 | 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 | 3130 | unfolding connected_iff_interval by auto | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3131 | |
| 63494 | 3132 | lemma connected_Ioc[simp]: "connected {a<..b}"
 | 
| 3133 | for a b :: "'a::linear_continuum_topology" | |
| 3134 | by (auto simp: connected_iff_interval) | |
| 3135 | ||
| 3136 | lemma connected_Ico[simp]: "connected {a..<b}"
 | |
| 3137 | for a b :: "'a::linear_continuum_topology" | |
| 3138 | by (auto simp: connected_iff_interval) | |
| 3139 | ||
| 3140 | lemma connected_Icc[simp]: "connected {a..b}"
 | |
| 3141 | for a b :: "'a::linear_continuum_topology" | |
| 3142 | by (auto simp: connected_iff_interval) | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3143 | |
| 62102 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 hoelzl parents: 
62101diff
changeset | 3144 | lemma connected_contains_Ioo: | 
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3145 | fixes A :: "'a :: linorder_topology set" | 
| 63494 | 3146 |   assumes "connected A" "a \<in> A" "b \<in> A" shows "{a <..< b} \<subseteq> A"
 | 
| 3147 | 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 | 3148 | |
| 61531 
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
 eberlm parents: 
61520diff
changeset | 3149 | lemma connected_contains_Icc: | 
| 63494 | 3150 | fixes A :: "'a::linorder_topology set" | 
| 3151 | assumes "connected A" "a \<in> A" "b \<in> A" | |
| 3152 |   shows "{a..b} \<subseteq> A"
 | |
| 61531 
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
 eberlm parents: 
61520diff
changeset | 3153 | proof | 
| 
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
 eberlm parents: 
61520diff
changeset | 3154 |   fix x assume "x \<in> {a..b}"
 | 
| 63494 | 3155 |   then have "x = a \<or> x = b \<or> x \<in> {a<..<b}"
 | 
| 3156 | by auto | |
| 3157 | then show "x \<in> A" | |
| 3158 | using assms connected_contains_Ioo[of A a b] by auto | |
| 61531 
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
 eberlm parents: 
61520diff
changeset | 3159 | qed | 
| 
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
 eberlm parents: 
61520diff
changeset | 3160 | |
| 63494 | 3161 | |
| 60758 | 3162 | subsection \<open>Intermediate Value Theorem\<close> | 
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3163 | |
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3164 | lemma IVT': | 
| 63494 | 3165 | 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 | 3166 | assumes y: "f a \<le> y" "y \<le> f b" "a \<le> b" | 
| 63494 | 3167 |     and *: "continuous_on {a .. b} f"
 | 
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3168 | 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 | 3169 | proof - | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3170 |   have "connected {a..b}"
 | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3171 | unfolding connected_iff_interval by auto | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3172 | 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 | 3173 | show ?thesis | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3174 | 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 | 3175 | qed | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3176 | |
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3177 | 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 | 3178 | 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 | 3179 | assumes y: "f b \<le> y" "y \<le> f a" "a \<le> b" | 
| 63494 | 3180 |     and *: "continuous_on {a .. b} f"
 | 
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3181 | 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 | 3182 | proof - | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3183 |   have "connected {a..b}"
 | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3184 | unfolding connected_iff_interval by auto | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3185 | 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 | 3186 | show ?thesis | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3187 | 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 | 3188 | qed | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3189 | |
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3190 | lemma IVT: | 
| 63494 | 3191 | fixes f :: "'a::linear_continuum_topology \<Rightarrow> 'b::linorder_topology" | 
| 3192 | 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> | |
| 3193 | \<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 | 3194 | 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 | 3195 | |
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3196 | lemma IVT2: | 
| 63494 | 3197 | fixes f :: "'a::linear_continuum_topology \<Rightarrow> 'b::linorder_topology" | 
| 3198 | 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> | |
| 3199 | \<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 | 3200 | 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 | 3201 | |
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3202 | lemma continuous_inj_imp_mono: | 
| 63494 | 3203 | 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 | 3204 | assumes x: "a < x" "x < b" | 
| 63494 | 3205 |     and cont: "continuous_on {a..b} f"
 | 
| 3206 |     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 | 3207 | 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 | 3208 | proof - | 
| 61520 
8f85bb443d33
Cauchy's integral formula, required lemmas, and a bit of reorganisation
 paulson <lp15@cam.ac.uk> parents: 
61426diff
changeset | 3209 | note I = inj_on_eq_iff[OF inj] | 
| 63494 | 3210 |   {
 | 
| 3211 | 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 | 3212 | 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 | 3213 | 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 | 3214 | by (auto simp: continuous_on_subset[OF cont] less_imp_le) | 
| 63494 | 3215 | with x I have False by auto | 
| 3216 | } | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3217 | moreover | 
| 63494 | 3218 |   {
 | 
| 3219 | 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 | 3220 | 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 | 3221 | 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 | 3222 | by (auto simp: continuous_on_subset[OF cont] less_imp_le) | 
| 63494 | 3223 | with x I have False by auto | 
| 3224 | } | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3225 | ultimately show ?thesis | 
| 63494 | 3226 | using I[of a x] I[of x b] x less_trans[OF x] | 
| 3227 | 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 | 3228 | qed | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3229 | |
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3230 | lemma continuous_at_Sup_mono: | 
| 63494 | 3231 |   fixes f :: "'a::{linorder_topology,conditionally_complete_linorder} \<Rightarrow>
 | 
| 3232 |     'b::{linorder_topology,conditionally_complete_linorder}"
 | |
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3233 | assumes "mono f" | 
| 63494 | 3234 | and cont: "continuous (at_left (Sup S)) f" | 
| 3235 |     and S: "S \<noteq> {}" "bdd_above S"
 | |
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3236 | shows "f (Sup S) = (SUP s\<in>S. f s)" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3237 | proof (rule antisym) | 
| 61973 | 3238 | have f: "(f \<longlongrightarrow> f (Sup S)) (at_left (Sup S))" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3239 | using cont unfolding continuous_within . | 
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3240 | show "f (Sup S) \<le> (SUP s\<in>S. f s)" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3241 | proof cases | 
| 63494 | 3242 | assume "Sup S \<in> S" | 
| 3243 | then show ?thesis | |
| 60758 | 3244 | 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 | 3245 | next | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3246 | assume "Sup S \<notin> S" | 
| 60758 | 3247 |     from \<open>S \<noteq> {}\<close> obtain s where "s \<in> S"
 | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3248 | by auto | 
| 60758 | 3249 | 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 | 3250 | unfolding less_le by (blast intro: cSup_upper) | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3251 | show ?thesis | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3252 | proof (rule ccontr) | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3253 | assume "\<not> ?thesis" | 
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3254 | 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 | 3255 | and *: "\<And>y. b < y \<Longrightarrow> y < Sup S \<Longrightarrow> (SUP s\<in>S. f s) < f y" | 
| 60758 | 3256 | by (auto simp: not_le eventually_at_left[OF \<open>s < Sup S\<close>]) | 
| 3257 |       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 | 3258 | using less_cSupD[of S b] by auto | 
| 60758 | 3259 | 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 | 3260 | unfolding less_le by (blast intro: cSup_upper) | 
| 60758 | 3261 | 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 | 3262 | show False | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3263 | by (auto simp: assms) | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3264 | qed | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3265 | qed | 
| 60758 | 3266 | 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 | 3267 | |
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3268 | lemma continuous_at_Sup_antimono: | 
| 63494 | 3269 |   fixes f :: "'a::{linorder_topology,conditionally_complete_linorder} \<Rightarrow>
 | 
| 3270 |     'b::{linorder_topology,conditionally_complete_linorder}"
 | |
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3271 | assumes "antimono f" | 
| 63494 | 3272 | and cont: "continuous (at_left (Sup S)) f" | 
| 3273 |     and S: "S \<noteq> {}" "bdd_above S"
 | |
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3274 | shows "f (Sup S) = (INF s\<in>S. f s)" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3275 | proof (rule antisym) | 
| 61973 | 3276 | have f: "(f \<longlongrightarrow> f (Sup S)) (at_left (Sup S))" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3277 | using cont unfolding continuous_within . | 
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3278 | show "(INF s\<in>S. f s) \<le> f (Sup S)" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3279 | proof cases | 
| 63494 | 3280 | assume "Sup S \<in> S" | 
| 3281 | then show ?thesis | |
| 60758 | 3282 | 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 | 3283 | next | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3284 | assume "Sup S \<notin> S" | 
| 60758 | 3285 |     from \<open>S \<noteq> {}\<close> obtain s where "s \<in> S"
 | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3286 | by auto | 
| 60758 | 3287 | 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 | 3288 | unfolding less_le by (blast intro: cSup_upper) | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3289 | show ?thesis | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3290 | proof (rule ccontr) | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3291 | assume "\<not> ?thesis" | 
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3292 | 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 | 3293 | and *: "\<And>y. b < y \<Longrightarrow> y < Sup S \<Longrightarrow> f y < (INF s\<in>S. f s)" | 
| 60758 | 3294 | by (auto simp: not_le eventually_at_left[OF \<open>s < Sup S\<close>]) | 
| 3295 |       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 | 3296 | using less_cSupD[of S b] by auto | 
| 60758 | 3297 | 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 | 3298 | unfolding less_le by (blast intro: cSup_upper) | 
| 60758 | 3299 | 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 | 3300 | show False | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3301 | by (auto simp: assms) | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3302 | qed | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3303 | qed | 
| 60758 | 3304 | 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 | 3305 | |
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3306 | lemma continuous_at_Inf_mono: | 
| 63494 | 3307 |   fixes f :: "'a::{linorder_topology,conditionally_complete_linorder} \<Rightarrow>
 | 
| 3308 |     'b::{linorder_topology,conditionally_complete_linorder}"
 | |
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3309 | assumes "mono f" | 
| 63494 | 3310 | and cont: "continuous (at_right (Inf S)) f" | 
| 3311 |     and S: "S \<noteq> {}" "bdd_below S"
 | |
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3312 | shows "f (Inf S) = (INF s\<in>S. f s)" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3313 | proof (rule antisym) | 
| 61973 | 3314 | have f: "(f \<longlongrightarrow> f (Inf S)) (at_right (Inf S))" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3315 | using cont unfolding continuous_within . | 
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3316 | show "(INF s\<in>S. f s) \<le> f (Inf S)" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3317 | proof cases | 
| 63494 | 3318 | assume "Inf S \<in> S" | 
| 3319 | then show ?thesis | |
| 60758 | 3320 | 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 | 3321 | next | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3322 | assume "Inf S \<notin> S" | 
| 60758 | 3323 |     from \<open>S \<noteq> {}\<close> obtain s where "s \<in> S"
 | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3324 | by auto | 
| 60758 | 3325 | 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 | 3326 | unfolding less_le by (blast intro: cInf_lower) | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3327 | show ?thesis | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3328 | proof (rule ccontr) | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3329 | assume "\<not> ?thesis" | 
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3330 | 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 | 3331 | and *: "\<And>y. Inf S < y \<Longrightarrow> y < b \<Longrightarrow> f y < (INF s\<in>S. f s)" | 
| 60758 | 3332 | by (auto simp: not_le eventually_at_right[OF \<open>Inf S < s\<close>]) | 
| 3333 |       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 | 3334 | using cInf_lessD[of S b] by auto | 
| 60758 | 3335 | 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 | 3336 | unfolding less_le by (blast intro: cInf_lower) | 
| 60758 | 3337 | 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 | 3338 | show False | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3339 | by (auto simp: assms) | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3340 | qed | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3341 | qed | 
| 60758 | 3342 | 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 | 3343 | |
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3344 | lemma continuous_at_Inf_antimono: | 
| 63494 | 3345 |   fixes f :: "'a::{linorder_topology,conditionally_complete_linorder} \<Rightarrow>
 | 
| 3346 |     'b::{linorder_topology,conditionally_complete_linorder}"
 | |
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3347 | assumes "antimono f" | 
| 63494 | 3348 | and cont: "continuous (at_right (Inf S)) f" | 
| 3349 |     and S: "S \<noteq> {}" "bdd_below S"
 | |
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3350 | shows "f (Inf S) = (SUP s\<in>S. f s)" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3351 | proof (rule antisym) | 
| 61973 | 3352 | have f: "(f \<longlongrightarrow> f (Inf S)) (at_right (Inf S))" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3353 | using cont unfolding continuous_within . | 
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3354 | show "f (Inf S) \<le> (SUP s\<in>S. f s)" | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3355 | proof cases | 
| 63494 | 3356 | assume "Inf S \<in> S" | 
| 3357 | then show ?thesis | |
| 60758 | 3358 | 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 | 3359 | next | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3360 | assume "Inf S \<notin> S" | 
| 60758 | 3361 |     from \<open>S \<noteq> {}\<close> obtain s where "s \<in> S"
 | 
| 59452 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3362 | by auto | 
| 60758 | 3363 | 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 | 3364 | unfolding less_le by (blast intro: cInf_lower) | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3365 | show ?thesis | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3366 | proof (rule ccontr) | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3367 | assume "\<not> ?thesis" | 
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3368 | 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 | 3369 | and *: "\<And>y. Inf S < y \<Longrightarrow> y < b \<Longrightarrow> (SUP s\<in>S. f s) < f y" | 
| 60758 | 3370 | by (auto simp: not_le eventually_at_right[OF \<open>Inf S < s\<close>]) | 
| 3371 |       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 | 3372 | using cInf_lessD[of S b] by auto | 
| 60758 | 3373 | 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 | 3374 | unfolding less_le by (blast intro: cInf_lower) | 
| 60758 | 3375 | 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 | 3376 | show False | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3377 | by (auto simp: assms) | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3378 | qed | 
| 
2538b2c51769
ereal: tuned proofs concerning continuity and suprema
 hoelzl parents: 
59106diff
changeset | 3379 | qed | 
| 60758 | 3380 | 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 | 3381 | |
| 63494 | 3382 | |
| 62101 | 3383 | subsection \<open>Uniform spaces\<close> | 
| 3384 | ||
| 62102 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 hoelzl parents: 
62101diff
changeset | 3385 | class uniformity = | 
| 62101 | 3386 |   fixes uniformity :: "('a \<times> 'a) filter"
 | 
| 3387 | begin | |
| 3388 | ||
| 63494 | 3389 | abbreviation uniformity_on :: "'a set \<Rightarrow> ('a \<times> 'a) filter"
 | 
| 3390 | where "uniformity_on s \<equiv> inf uniformity (principal (s\<times>s))" | |
| 62101 | 3391 | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 3392 | end | 
| 62101 | 3393 | |
| 62102 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 hoelzl parents: 
62101diff
changeset | 3394 | lemma uniformity_Abort: | 
| 62123 
df65f5c27c15
setup code generation for filters as suggested by Florian
 hoelzl parents: 
62102diff
changeset | 3395 | "uniformity = | 
| 
df65f5c27c15
setup code generation for filters as suggested by Florian
 hoelzl parents: 
62102diff
changeset | 3396 | 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 | 3397 | by simp | 
| 62102 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 hoelzl parents: 
62101diff
changeset | 3398 | |
| 62101 | 3399 | class open_uniformity = "open" + uniformity + | 
| 63494 | 3400 | assumes open_uniformity: | 
| 3401 | "\<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 | 3402 | begin | 
| 
b249fab48c76
type class generalisations; some work on infinite products
 paulson <lp15@cam.ac.uk> parents: 
67957diff
changeset | 3403 | |
| 
b249fab48c76
type class generalisations; some work on infinite products
 paulson <lp15@cam.ac.uk> parents: 
67957diff
changeset | 3404 | subclass topological_space | 
| 
b249fab48c76
type class generalisations; some work on infinite products
 paulson <lp15@cam.ac.uk> parents: 
67957diff
changeset | 3405 | 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 | 3406 | |
| 
b249fab48c76
type class generalisations; some work on infinite products
 paulson <lp15@cam.ac.uk> parents: 
67957diff
changeset | 3407 | end | 
| 62101 | 3408 | |
| 3409 | class uniform_space = open_uniformity + | |
| 3410 | assumes uniformity_refl: "eventually E uniformity \<Longrightarrow> E (x, x)" | |
| 63494 | 3411 | and uniformity_sym: "eventually E uniformity \<Longrightarrow> eventually (\<lambda>(x, y). E (y, x)) uniformity" | 
| 3412 | and uniformity_trans: | |
| 3413 | "eventually E uniformity \<Longrightarrow> | |
| 3414 | \<exists>D. eventually D uniformity \<and> (\<forall>x y z. D (x, y) \<longrightarrow> D (y, z) \<longrightarrow> E (x, z))" | |
| 62101 | 3415 | begin | 
| 3416 | ||
| 3417 | lemma uniformity_bot: "uniformity \<noteq> bot" | |
| 3418 | using uniformity_refl by auto | |
| 3419 | ||
| 3420 | lemma uniformity_trans': | |
| 63494 | 3421 | "eventually E uniformity \<Longrightarrow> | 
| 3422 | eventually (\<lambda>((x, y), (y', z)). y = y' \<longrightarrow> E (x, z)) (uniformity \<times>\<^sub>F uniformity)" | |
| 62101 | 3423 | by (drule uniformity_trans) (auto simp add: eventually_prod_same) | 
| 3424 | ||
| 3425 | lemma uniformity_transE: | |
| 63494 | 3426 | assumes "eventually E uniformity" | 
| 62101 | 3427 | obtains D where "eventually D uniformity" "\<And>x y z. D (x, y) \<Longrightarrow> D (y, z) \<Longrightarrow> E (x, z)" | 
| 63494 | 3428 | using uniformity_trans [OF assms] by auto | 
| 62101 | 3429 | |
| 3430 | lemma eventually_nhds_uniformity: | |
| 63494 | 3431 | "eventually P (nhds x) \<longleftrightarrow> eventually (\<lambda>(x', y). x' = x \<longrightarrow> P y) uniformity" | 
| 3432 | (is "_ \<longleftrightarrow> ?N P x") | |
| 62101 | 3433 | unfolding eventually_nhds | 
| 3434 | proof safe | |
| 3435 | assume *: "?N P x" | |
| 63494 | 3436 | have "?N (?N P) x" if "?N P x" for x | 
| 3437 | proof - | |
| 3438 | from that obtain D where ev: "eventually D uniformity" | |
| 3439 | 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 | |
| 3440 | by (rule uniformity_transE) simp | |
| 3441 | from ev show ?thesis | |
| 3442 | by eventually_elim (insert ev D, force elim: eventually_mono split: prod.split) | |
| 3443 | qed | |
| 62101 | 3444 |   then have "open {x. ?N P x}"
 | 
| 3445 | by (simp add: open_uniformity) | |
| 3446 | then show "\<exists>S. open S \<and> x \<in> S \<and> (\<forall>x\<in>S. P x)" | |
| 3447 |     by (intro exI[of _ "{x. ?N P x}"]) (auto dest: uniformity_refl simp: *)
 | |
| 3448 | qed (force simp add: open_uniformity elim: eventually_mono) | |
| 3449 | ||
| 63494 | 3450 | |
| 62101 | 3451 | subsubsection \<open>Totally bounded sets\<close> | 
| 3452 | ||
| 63494 | 3453 | definition totally_bounded :: "'a set \<Rightarrow> bool" | 
| 3454 | where "totally_bounded S \<longleftrightarrow> | |
| 62101 | 3455 | (\<forall>E. eventually E uniformity \<longrightarrow> (\<exists>X. finite X \<and> (\<forall>s\<in>S. \<exists>x\<in>X. E (x, s))))" | 
| 3456 | ||
| 3457 | lemma totally_bounded_empty[iff]: "totally_bounded {}"
 | |
| 3458 | by (auto simp add: totally_bounded_def) | |
| 3459 | ||
| 3460 | lemma totally_bounded_subset: "totally_bounded S \<Longrightarrow> T \<subseteq> S \<Longrightarrow> totally_bounded T" | |
| 63171 | 3461 | by (fastforce simp add: totally_bounded_def) | 
| 62101 | 3462 | |
| 62102 
877463945ce9
fix code generation for uniformity: uniformity is a non-computable pure data.
 hoelzl parents: 
62101diff
changeset | 3463 | lemma totally_bounded_Union[intro]: | 
| 63494 | 3464 | assumes M: "finite M" "\<And>S. S \<in> M \<Longrightarrow> totally_bounded S" | 
| 3465 | shows "totally_bounded (\<Union>M)" | |
| 62101 | 3466 | unfolding totally_bounded_def | 
| 3467 | proof safe | |
| 63494 | 3468 | fix E | 
| 3469 | assume "eventually E uniformity" | |
| 62101 | 3470 | 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))" | 
| 3471 | by (metis totally_bounded_def) | |
| 62175 | 3472 | with \<open>finite M\<close> show "\<exists>X. finite X \<and> (\<forall>s\<in>\<Union>M. \<exists>x\<in>X. E (x, s))" | 
| 62101 | 3473 | by (intro exI[of _ "\<Union>S\<in>M. X S"]) force | 
| 3474 | qed | |
| 3475 | ||
| 63494 | 3476 | |
| 62101 | 3477 | subsubsection \<open>Cauchy filter\<close> | 
| 3478 | ||
| 63494 | 3479 | definition cauchy_filter :: "'a filter \<Rightarrow> bool" | 
| 3480 | where "cauchy_filter F \<longleftrightarrow> F \<times>\<^sub>F F \<le> uniformity" | |
| 3481 | ||
| 3482 | definition Cauchy :: "(nat \<Rightarrow> 'a) \<Rightarrow> bool" | |
| 3483 | where Cauchy_uniform: "Cauchy X = cauchy_filter (filtermap X sequentially)" | |
| 62101 | 3484 | |
| 3485 | lemma Cauchy_uniform_iff: | |
| 3486 | "Cauchy X \<longleftrightarrow> (\<forall>P. eventually P uniformity \<longrightarrow> (\<exists>N. \<forall>n\<ge>N. \<forall>m\<ge>N. P (X n, X m)))" | |
| 3487 | unfolding Cauchy_uniform cauchy_filter_def le_filter_def eventually_prod_same | |
| 3488 | eventually_filtermap eventually_sequentially | |
| 3489 | proof safe | |
| 3490 | let ?U = "\<lambda>P. eventually P uniformity" | |
| 63494 | 3491 |   {
 | 
| 3492 | fix P | |
| 3493 | 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 | 3494 | 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)" | 
| 3495 | by metis | |
| 3496 | then show "\<exists>N. \<forall>n\<ge>N. \<forall>m\<ge>N. P (X n, X m)" | |
| 63494 | 3497 | by blast | 
| 3498 | next | |
| 3499 | fix P | |
| 3500 | 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 | 3501 | then obtain Q where "?U Q" and Q: "\<And>x y z. Q (x, y) \<Longrightarrow> Q (y, z) \<Longrightarrow> P (x, z)" | 
| 3502 | by (auto elim: uniformity_transE) | |
| 3503 | then have "?U (\<lambda>x. Q x \<and> (\<lambda>(x, y). Q (y, x)) x)" | |
| 3504 | unfolding eventually_conj_iff by (simp add: uniformity_sym) | |
| 3505 | from P[rule_format, OF this] | |
| 3506 | 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)" | |
| 3507 | by auto | |
| 3508 | 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))" | |
| 3509 | 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 | 3510 | fix x y | 
| 3511 | 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 | 3512 | then have "Q (x, X N)" "Q (X N, y)" by auto | 
| 3513 | then show "P (x, y)" | |
| 3514 | by (rule Q) | |
| 63494 | 3515 | qed | 
| 3516 | } | |
| 62101 | 3517 | qed | 
| 3518 | ||
| 3519 | lemma nhds_imp_cauchy_filter: | |
| 63494 | 3520 | assumes *: "F \<le> nhds x" | 
| 3521 | shows "cauchy_filter F" | |
| 62101 | 3522 | proof - | 
| 3523 | have "F \<times>\<^sub>F F \<le> nhds x \<times>\<^sub>F nhds x" | |
| 3524 | by (intro prod_filter_mono *) | |
| 3525 | also have "\<dots> \<le> uniformity" | |
| 3526 | unfolding le_filter_def eventually_nhds_uniformity eventually_prod_same | |
| 3527 | proof safe | |
| 63494 | 3528 | fix P | 
| 3529 | assume "eventually P uniformity" | |
| 3530 | then obtain Ql where ev: "eventually Ql uniformity" | |
| 3531 | and "Ql (x, y) \<Longrightarrow> Ql (y, z) \<Longrightarrow> P (x, z)" for x y z | |
| 3532 | by (rule uniformity_transE) simp | |
| 3533 | with ev[THEN uniformity_sym] | |
| 3534 | show "\<exists>Q. eventually (\<lambda>(x', y). x' = x \<longrightarrow> Q y) uniformity \<and> | |
| 3535 | (\<forall>x y. Q x \<longrightarrow> Q y \<longrightarrow> P (x, y))" | |
| 62101 | 3536 | by (rule_tac exI[of _ "\<lambda>y. Ql (y, x) \<and> Ql (x, y)"]) (fastforce elim: eventually_elim2) | 
| 3537 | qed | |
| 3538 | finally show ?thesis | |
| 3539 | by (simp add: cauchy_filter_def) | |
| 3540 | qed | |
| 3541 | ||
| 3542 | lemma LIMSEQ_imp_Cauchy: "X \<longlonglongrightarrow> x \<Longrightarrow> Cauchy X" | |
| 3543 | unfolding Cauchy_uniform filterlim_def by (intro nhds_imp_cauchy_filter) | |
| 3544 | ||
| 63494 | 3545 | lemma Cauchy_subseq_Cauchy: | 
| 66447 
a1f5c5c26fa6
Replaced subseq with strict_mono
 eberlm <eberlm@in.tum.de> parents: 
66162diff
changeset | 3546 | assumes "Cauchy X" "strict_mono f" | 
| 63494 | 3547 | shows "Cauchy (X \<circ> f)" | 
| 62101 | 3548 | unfolding Cauchy_uniform comp_def filtermap_filtermap[symmetric] cauchy_filter_def | 
| 3549 | 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 | 3550 | (intro prod_filter_mono filtermap_mono filterlim_subseq[OF \<open>strict_mono f\<close>, unfolded filterlim_def]) | 
| 62101 | 3551 | |
| 3552 | lemma convergent_Cauchy: "convergent X \<Longrightarrow> Cauchy X" | |
| 3553 | unfolding convergent_def by (erule exE, erule LIMSEQ_imp_Cauchy) | |
| 3554 | ||
| 63494 | 3555 | definition complete :: "'a set \<Rightarrow> bool" | 
| 3556 | where complete_uniform: "complete S \<longleftrightarrow> | |
| 3557 | (\<forall>F \<le> principal S. F \<noteq> bot \<longrightarrow> cauchy_filter F \<longrightarrow> (\<exists>x\<in>S. F \<le> nhds x))" | |
| 62101 | 3558 | |
| 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 | 3559 | 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 | 3560 | 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 | 3561 | 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 | 3562 | 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 | 3563 | |
| 62101 | 3564 | end | 
| 3565 | ||
| 3566 | subsubsection \<open>Uniformly continuous functions\<close> | |
| 3567 | ||
| 63494 | 3568 | definition uniformly_continuous_on :: "'a set \<Rightarrow> ('a::uniform_space \<Rightarrow> 'b::uniform_space) \<Rightarrow> bool"
 | 
| 3569 | where uniformly_continuous_on_uniformity: "uniformly_continuous_on s f \<longleftrightarrow> | |
| 62101 | 3570 | (LIM (x, y) (uniformity_on s). (f x, f y) :> uniformity)" | 
| 3571 | ||
| 3572 | lemma uniformly_continuous_onD: | |
| 63494 | 3573 | "uniformly_continuous_on s f \<Longrightarrow> eventually E uniformity \<Longrightarrow> | 
| 3574 | eventually (\<lambda>(x, y). x \<in> s \<longrightarrow> y \<in> s \<longrightarrow> E (f x, f y)) uniformity" | |
| 3575 | by (simp add: uniformly_continuous_on_uniformity filterlim_iff | |
| 3576 | eventually_inf_principal split_beta' mem_Times_iff imp_conjL) | |
| 62101 | 3577 | |
| 3578 | lemma uniformly_continuous_on_const[continuous_intros]: "uniformly_continuous_on s (\<lambda>x. c)" | |
| 3579 | by (auto simp: uniformly_continuous_on_uniformity filterlim_iff uniformity_refl) | |
| 3580 | ||
| 3581 | lemma uniformly_continuous_on_id[continuous_intros]: "uniformly_continuous_on s (\<lambda>x. x)" | |
| 3582 | by (auto simp: uniformly_continuous_on_uniformity filterlim_def) | |
| 3583 | ||
| 76724 
7ff71bdcf731
Additional new material about infinite products, etc.
 paulson <lp15@cam.ac.uk> parents: 
75462diff
changeset | 3584 | lemma uniformly_continuous_on_compose: | 
| 63494 | 3585 | "uniformly_continuous_on s g \<Longrightarrow> uniformly_continuous_on (g`s) f \<Longrightarrow> | 
| 3586 | uniformly_continuous_on s (\<lambda>x. f (g x))" | |
| 3587 | using filterlim_compose[of "\<lambda>(x, y). (f x, f y)" uniformity | |
| 3588 | "uniformity_on (g`s)" "\<lambda>(x, y). (g x, g y)" "uniformity_on s"] | |
| 3589 | by (simp add: split_beta' uniformly_continuous_on_uniformity | |
| 3590 | filterlim_inf filterlim_principal eventually_inf_principal mem_Times_iff) | |
| 3591 | ||
| 3592 | lemma uniformly_continuous_imp_continuous: | |
| 3593 | assumes f: "uniformly_continuous_on s f" | |
| 3594 | shows "continuous_on s f" | |
| 62101 | 3595 | by (auto simp: filterlim_iff eventually_at_filter eventually_nhds_uniformity continuous_on_def | 
| 3596 | elim: eventually_mono dest!: uniformly_continuous_onD[OF f]) | |
| 3597 | ||
| 63494 | 3598 | |
| 62367 | 3599 | section \<open>Product Topology\<close> | 
| 3600 | ||
| 3601 | subsection \<open>Product is a topological space\<close> | |
| 3602 | ||
| 3603 | instantiation prod :: (topological_space, topological_space) topological_space | |
| 3604 | begin | |
| 3605 | ||
| 3606 | definition open_prod_def[code del]: | |
| 3607 |   "open (S :: ('a \<times> 'b) set) \<longleftrightarrow>
 | |
| 3608 | (\<forall>x\<in>S. \<exists>A B. open A \<and> open B \<and> x \<in> A \<times> B \<and> A \<times> B \<subseteq> S)" | |
| 3609 | ||
| 3610 | lemma open_prod_elim: | |
| 3611 | assumes "open S" and "x \<in> S" | |
| 3612 | obtains A B where "open A" and "open B" and "x \<in> A \<times> B" and "A \<times> B \<subseteq> S" | |
| 63494 | 3613 | using assms unfolding open_prod_def by fast | 
| 62367 | 3614 | |
| 3615 | lemma open_prod_intro: | |
| 3616 | 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" | |
| 3617 | shows "open S" | |
| 63494 | 3618 | using assms unfolding open_prod_def by fast | 
| 62367 | 3619 | |
| 3620 | instance | |
| 3621 | proof | |
| 3622 |   show "open (UNIV :: ('a \<times> 'b) set)"
 | |
| 3623 | unfolding open_prod_def by auto | |
| 3624 | next | |
| 3625 |   fix S T :: "('a \<times> 'b) set"
 | |
| 3626 | assume "open S" "open T" | |
| 3627 | show "open (S \<inter> T)" | |
| 3628 | proof (rule open_prod_intro) | |
| 63494 | 3629 | fix x | 
| 3630 | assume x: "x \<in> S \<inter> T" | |
| 62367 | 3631 | from x have "x \<in> S" by simp | 
| 3632 | obtain Sa Sb where A: "open Sa" "open Sb" "x \<in> Sa \<times> Sb" "Sa \<times> Sb \<subseteq> S" | |
| 3633 | using \<open>open S\<close> and \<open>x \<in> S\<close> by (rule open_prod_elim) | |
| 3634 | from x have "x \<in> T" by simp | |
| 3635 | obtain Ta Tb where B: "open Ta" "open Tb" "x \<in> Ta \<times> Tb" "Ta \<times> Tb \<subseteq> T" | |
| 3636 | using \<open>open T\<close> and \<open>x \<in> T\<close> by (rule open_prod_elim) | |
| 3637 | let ?A = "Sa \<inter> Ta" and ?B = "Sb \<inter> Tb" | |
| 3638 | have "open ?A \<and> open ?B \<and> x \<in> ?A \<times> ?B \<and> ?A \<times> ?B \<subseteq> S \<inter> T" | |
| 3639 | using A B by (auto simp add: open_Int) | |
| 63494 | 3640 | 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 | 3641 | by fast | 
| 3642 | qed | |
| 3643 | next | |
| 3644 |   fix K :: "('a \<times> 'b) set set"
 | |
| 63494 | 3645 | assume "\<forall>S\<in>K. open S" | 
| 3646 | then show "open (\<Union>K)" | |
| 62367 | 3647 | unfolding open_prod_def by fast | 
| 3648 | qed | |
| 3649 | ||
| 62101 | 3650 | end | 
| 62367 | 3651 | |
| 63494 | 3652 | declare [[code abort: "open :: ('a::topological_space \<times> 'b::topological_space) set \<Rightarrow> bool"]]
 | 
| 62367 | 3653 | |
| 3654 | lemma open_Times: "open S \<Longrightarrow> open T \<Longrightarrow> open (S \<times> T)" | |
| 63494 | 3655 | unfolding open_prod_def by auto | 
| 62367 | 3656 | |
| 3657 | lemma fst_vimage_eq_Times: "fst -` S = S \<times> UNIV" | |
| 63494 | 3658 | by auto | 
| 62367 | 3659 | |
| 3660 | lemma snd_vimage_eq_Times: "snd -` S = UNIV \<times> S" | |
| 63494 | 3661 | by auto | 
| 62367 | 3662 | |
| 3663 | lemma open_vimage_fst: "open S \<Longrightarrow> open (fst -` S)" | |
| 63494 | 3664 | by (simp add: fst_vimage_eq_Times open_Times) | 
| 62367 | 3665 | |
| 3666 | lemma open_vimage_snd: "open S \<Longrightarrow> open (snd -` S)" | |
| 63494 | 3667 | by (simp add: snd_vimage_eq_Times open_Times) | 
| 62367 | 3668 | |
| 3669 | lemma closed_vimage_fst: "closed S \<Longrightarrow> closed (fst -` S)" | |
| 63494 | 3670 | unfolding closed_open vimage_Compl [symmetric] | 
| 3671 | by (rule open_vimage_fst) | |
| 62367 | 3672 | |
| 3673 | lemma closed_vimage_snd: "closed S \<Longrightarrow> closed (snd -` S)" | |
| 63494 | 3674 | unfolding closed_open vimage_Compl [symmetric] | 
| 3675 | by (rule open_vimage_snd) | |
| 62367 | 3676 | |
| 3677 | lemma closed_Times: "closed S \<Longrightarrow> closed T \<Longrightarrow> closed (S \<times> T)" | |
| 3678 | proof - | |
| 63494 | 3679 | have "S \<times> T = (fst -` S) \<inter> (snd -` T)" | 
| 3680 | by auto | |
| 3681 | then show "closed S \<Longrightarrow> closed T \<Longrightarrow> closed (S \<times> T)" | |
| 62367 | 3682 | by (simp add: closed_vimage_fst closed_vimage_snd closed_Int) | 
| 3683 | qed | |
| 3684 | ||
| 3685 | lemma subset_fst_imageI: "A \<times> B \<subseteq> S \<Longrightarrow> y \<in> B \<Longrightarrow> A \<subseteq> fst ` S" | |
| 3686 | unfolding image_def subset_eq by force | |
| 3687 | ||
| 3688 | lemma subset_snd_imageI: "A \<times> B \<subseteq> S \<Longrightarrow> x \<in> A \<Longrightarrow> B \<subseteq> snd ` S" | |
| 3689 | unfolding image_def subset_eq by force | |
| 3690 | ||
| 63494 | 3691 | lemma open_image_fst: | 
| 3692 | assumes "open S" | |
| 3693 | shows "open (fst ` S)" | |
| 62367 | 3694 | proof (rule openI) | 
| 63494 | 3695 | fix x | 
| 3696 | assume "x \<in> fst ` S" | |
| 3697 | then obtain y where "(x, y) \<in> S" | |
| 3698 | by auto | |
| 62367 | 3699 | then obtain A B where "open A" "open B" "x \<in> A" "y \<in> B" "A \<times> B \<subseteq> S" | 
| 3700 | using \<open>open S\<close> unfolding open_prod_def by auto | |
| 63494 | 3701 | from \<open>A \<times> B \<subseteq> S\<close> \<open>y \<in> B\<close> have "A \<subseteq> fst ` S" | 
| 3702 | by (rule subset_fst_imageI) | |
| 3703 | with \<open>open A\<close> \<open>x \<in> A\<close> have "open A \<and> x \<in> A \<and> A \<subseteq> fst ` S" | |
| 3704 | by simp | |
| 3705 | then show "\<exists>T. open T \<and> x \<in> T \<and> T \<subseteq> fst ` S" .. | |
| 62367 | 3706 | qed | 
| 3707 | ||
| 63494 | 3708 | lemma open_image_snd: | 
| 3709 | assumes "open S" | |
| 3710 | shows "open (snd ` S)" | |
| 62367 | 3711 | proof (rule openI) | 
| 63494 | 3712 | fix y | 
| 3713 | assume "y \<in> snd ` S" | |
| 3714 | then obtain x where "(x, y) \<in> S" | |
| 3715 | by auto | |
| 62367 | 3716 | then obtain A B where "open A" "open B" "x \<in> A" "y \<in> B" "A \<times> B \<subseteq> S" | 
| 3717 | using \<open>open S\<close> unfolding open_prod_def by auto | |
| 63494 | 3718 | from \<open>A \<times> B \<subseteq> S\<close> \<open>x \<in> A\<close> have "B \<subseteq> snd ` S" | 
| 3719 | by (rule subset_snd_imageI) | |
| 3720 | with \<open>open B\<close> \<open>y \<in> B\<close> have "open B \<and> y \<in> B \<and> B \<subseteq> snd ` S" | |
| 3721 | by simp | |
| 3722 | then show "\<exists>T. open T \<and> y \<in> T \<and> T \<subseteq> snd ` S" .. | |
| 62367 | 3723 | qed | 
| 3724 | ||
| 3725 | lemma nhds_prod: "nhds (a, b) = nhds a \<times>\<^sub>F nhds b" | |
| 3726 | unfolding nhds_def | |
| 3727 | proof (subst prod_filter_INF, auto intro!: antisym INF_greatest simp: principal_prod_principal) | |
| 63494 | 3728 | fix S T | 
| 3729 | 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 | 3730 |   then show "(INF x \<in> {S. open S \<and> (a, b) \<in> S}. principal x) \<le> principal (S \<times> T)"
 | 
| 62367 | 3731 | by (intro INF_lower) (auto intro!: open_Times) | 
| 3732 | next | |
| 63494 | 3733 | fix S' | 
| 3734 | assume "open S'" "(a, b) \<in> S'" | |
| 62367 | 3735 | then obtain S T where "open S" "a \<in> S" "open T" "b \<in> T" "S \<times> T \<subseteq> S'" | 
| 3736 | by (auto elim: open_prod_elim) | |
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69164diff
changeset | 3737 |   then show "(INF x \<in> {S. open S \<and> a \<in> S}. INF y \<in> {S. open S \<and> b \<in> S}.
 | 
| 63494 | 3738 | principal (x \<times> y)) \<le> principal S'" | 
| 62367 | 3739 | by (auto intro!: INF_lower2) | 
| 3740 | qed | |
| 3741 | ||
| 63494 | 3742 | |
| 62367 | 3743 | subsubsection \<open>Continuity of operations\<close> | 
| 3744 | ||
| 3745 | lemma tendsto_fst [tendsto_intros]: | |
| 3746 | assumes "(f \<longlongrightarrow> a) F" | |
| 3747 | shows "((\<lambda>x. fst (f x)) \<longlongrightarrow> fst a) F" | |
| 3748 | proof (rule topological_tendstoI) | |
| 63494 | 3749 | fix S | 
| 3750 | assume "open S" and "fst a \<in> S" | |
| 62367 | 3751 | then have "open (fst -` S)" and "a \<in> fst -` S" | 
| 3752 | by (simp_all add: open_vimage_fst) | |
| 3753 | with assms have "eventually (\<lambda>x. f x \<in> fst -` S) F" | |
| 3754 | by (rule topological_tendstoD) | |
| 3755 | then show "eventually (\<lambda>x. fst (f x) \<in> S) F" | |
| 3756 | by simp | |
| 3757 | qed | |
| 3758 | ||
| 3759 | lemma tendsto_snd [tendsto_intros]: | |
| 3760 | assumes "(f \<longlongrightarrow> a) F" | |
| 3761 | shows "((\<lambda>x. snd (f x)) \<longlongrightarrow> snd a) F" | |
| 3762 | proof (rule topological_tendstoI) | |
| 63494 | 3763 | fix S | 
| 3764 | assume "open S" and "snd a \<in> S" | |
| 62367 | 3765 | then have "open (snd -` S)" and "a \<in> snd -` S" | 
| 3766 | by (simp_all add: open_vimage_snd) | |
| 3767 | with assms have "eventually (\<lambda>x. f x \<in> snd -` S) F" | |
| 3768 | by (rule topological_tendstoD) | |
| 3769 | then show "eventually (\<lambda>x. snd (f x) \<in> S) F" | |
| 3770 | by simp | |
| 3771 | qed | |
| 3772 | ||
| 3773 | lemma tendsto_Pair [tendsto_intros]: | |
| 3774 | assumes "(f \<longlongrightarrow> a) F" and "(g \<longlongrightarrow> b) F" | |
| 3775 | shows "((\<lambda>x. (f x, g x)) \<longlongrightarrow> (a, b)) F" | |
| 67957 | 3776 | unfolding nhds_prod using assms by (rule filterlim_Pair) | 
| 62367 | 3777 | |
| 3778 | lemma continuous_fst[continuous_intros]: "continuous F f \<Longrightarrow> continuous F (\<lambda>x. fst (f x))" | |
| 3779 | unfolding continuous_def by (rule tendsto_fst) | |
| 3780 | ||
| 3781 | lemma continuous_snd[continuous_intros]: "continuous F f \<Longrightarrow> continuous F (\<lambda>x. snd (f x))" | |
| 3782 | unfolding continuous_def by (rule tendsto_snd) | |
| 3783 | ||
| 63494 | 3784 | lemma continuous_Pair[continuous_intros]: | 
| 3785 | "continuous F f \<Longrightarrow> continuous F g \<Longrightarrow> continuous F (\<lambda>x. (f x, g x))" | |
| 62367 | 3786 | unfolding continuous_def by (rule tendsto_Pair) | 
| 3787 | ||
| 63494 | 3788 | lemma continuous_on_fst[continuous_intros]: | 
| 3789 | "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. fst (f x))" | |
| 62367 | 3790 | unfolding continuous_on_def by (auto intro: tendsto_fst) | 
| 3791 | ||
| 63494 | 3792 | lemma continuous_on_snd[continuous_intros]: | 
| 3793 | "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. snd (f x))" | |
| 62367 | 3794 | unfolding continuous_on_def by (auto intro: tendsto_snd) | 
| 3795 | ||
| 63494 | 3796 | lemma continuous_on_Pair[continuous_intros]: | 
| 3797 | "continuous_on s f \<Longrightarrow> continuous_on s g \<Longrightarrow> continuous_on s (\<lambda>x. (f x, g x))" | |
| 62367 | 3798 | unfolding continuous_on_def by (auto intro: tendsto_Pair) | 
| 3799 | ||
| 3800 | lemma continuous_on_swap[continuous_intros]: "continuous_on A prod.swap" | |
| 63494 | 3801 | by (simp add: prod.swap_def continuous_on_fst continuous_on_snd | 
| 3802 | continuous_on_Pair continuous_on_id) | |
| 62367 | 3803 | |
| 3804 | lemma continuous_on_swap_args: | |
| 3805 | assumes "continuous_on (A\<times>B) (\<lambda>(x,y). d x y)" | |
| 3806 | shows "continuous_on (B\<times>A) (\<lambda>(x,y). d y x)" | |
| 3807 | proof - | |
| 63494 | 3808 | have "(\<lambda>(x,y). d y x) = (\<lambda>(x,y). d x y) \<circ> prod.swap" | 
| 62367 | 3809 | by force | 
| 3810 | 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 | 3811 | by (metis assms continuous_on_compose continuous_on_swap product_swap) | 
| 62367 | 3812 | qed | 
| 3813 | ||
| 3814 | lemma isCont_fst [simp]: "isCont f a \<Longrightarrow> isCont (\<lambda>x. fst (f x)) a" | |
| 3815 | by (fact continuous_fst) | |
| 3816 | ||
| 3817 | lemma isCont_snd [simp]: "isCont f a \<Longrightarrow> isCont (\<lambda>x. snd (f x)) a" | |
| 3818 | by (fact continuous_snd) | |
| 3819 | ||
| 3820 | lemma isCont_Pair [simp]: "\<lbrakk>isCont f a; isCont g a\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. (f x, g x)) a" | |
| 3821 | by (fact continuous_Pair) | |
| 3822 | ||
| 67685 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 3823 | lemma continuous_on_compose_Pair: | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 3824 | 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 | 3825 | assumes g: "continuous_on C g" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 3826 | assumes h: "continuous_on C h" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 3827 | 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 | 3828 | 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 | 3829 | 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 | 3830 | by auto | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67577diff
changeset | 3831 | |
| 63494 | 3832 | |
| 67577 | 3833 | subsubsection \<open>Connectedness of products\<close> | 
| 3834 | ||
| 3835 | proposition connected_Times: | |
| 3836 | assumes S: "connected S" and T: "connected T" | |
| 3837 | shows "connected (S \<times> T)" | |
| 3838 | proof (rule connectedI_const) | |
| 3839 | fix P::"'a \<times> 'b \<Rightarrow> bool" | |
| 3840 | assume P[THEN continuous_on_compose2, continuous_intros]: "continuous_on (S \<times> T) P" | |
| 3841 | have "continuous_on S (\<lambda>s. P (s, t))" if "t \<in> T" for t | |
| 3842 | by (auto intro!: continuous_intros that) | |
| 3843 | from connectedD_const[OF S this] | |
| 3844 | obtain c1 where c1: "\<And>s t. t \<in> T \<Longrightarrow> s \<in> S \<Longrightarrow> P (s, t) = c1 t" | |
| 3845 | by metis | |
| 3846 | moreover | |
| 3847 | have "continuous_on T (\<lambda>t. P (s, t))" if "s \<in> S" for s | |
| 3848 | by (auto intro!: continuous_intros that) | |
| 3849 | from connectedD_const[OF T this] | |
| 3850 | obtain c2 where "\<And>s t. t \<in> T \<Longrightarrow> s \<in> S \<Longrightarrow> P (s, t) = c2 s" | |
| 3851 | by metis | |
| 3852 | ultimately show "\<exists>c. \<forall>s\<in>S \<times> T. P s = c" | |
| 3853 | by auto | |
| 3854 | qed | |
| 3855 | ||
| 3856 | corollary connected_Times_eq [simp]: | |
| 3857 |    "connected (S \<times> T) \<longleftrightarrow> S = {} \<or> T = {} \<or> connected S \<and> connected T"  (is "?lhs = ?rhs")
 | |
| 3858 | proof | |
| 3859 | assume L: ?lhs | |
| 3860 | show ?rhs | |
| 3861 | proof cases | |
| 3862 |     assume "S \<noteq> {} \<and> T \<noteq> {}"
 | |
| 3863 | moreover | |
| 3864 | have "connected (fst ` (S \<times> T))" "connected (snd ` (S \<times> T))" | |
| 3865 | using continuous_on_fst continuous_on_snd continuous_on_id | |
| 3866 | by (blast intro: connected_continuous_image [OF _ L])+ | |
| 3867 | ultimately show ?thesis | |
| 3868 | by auto | |
| 3869 | qed auto | |
| 3870 | qed (auto simp: connected_Times) | |
| 3871 | ||
| 3872 | ||
| 62367 | 3873 | subsubsection \<open>Separation axioms\<close> | 
| 3874 | ||
| 3875 | instance prod :: (t0_space, t0_space) t0_space | |
| 3876 | proof | |
| 63494 | 3877 | fix x y :: "'a \<times> 'b" | 
| 3878 | assume "x \<noteq> y" | |
| 3879 | then have "fst x \<noteq> fst y \<or> snd x \<noteq> snd y" | |
| 62367 | 3880 | by (simp add: prod_eq_iff) | 
| 63494 | 3881 | then show "\<exists>U. open U \<and> (x \<in> U) \<noteq> (y \<in> U)" | 
| 62367 | 3882 | by (fast dest: t0_space elim: open_vimage_fst open_vimage_snd) | 
| 3883 | qed | |
| 3884 | ||
| 3885 | instance prod :: (t1_space, t1_space) t1_space | |
| 3886 | proof | |
| 63494 | 3887 | fix x y :: "'a \<times> 'b" | 
| 3888 | assume "x \<noteq> y" | |
| 3889 | then have "fst x \<noteq> fst y \<or> snd x \<noteq> snd y" | |
| 62367 | 3890 | by (simp add: prod_eq_iff) | 
| 63494 | 3891 | then show "\<exists>U. open U \<and> x \<in> U \<and> y \<notin> U" | 
| 62367 | 3892 | by (fast dest: t1_space elim: open_vimage_fst open_vimage_snd) | 
| 3893 | qed | |
| 3894 | ||
| 3895 | instance prod :: (t2_space, t2_space) t2_space | |
| 3896 | proof | |
| 63494 | 3897 | fix x y :: "'a \<times> 'b" | 
| 3898 | assume "x \<noteq> y" | |
| 3899 | then have "fst x \<noteq> fst y \<or> snd x \<noteq> snd y" | |
| 62367 | 3900 | by (simp add: prod_eq_iff) | 
| 63494 | 3901 |   then show "\<exists>U V. open U \<and> open V \<and> x \<in> U \<and> y \<in> V \<and> U \<inter> V = {}"
 | 
| 62367 | 3902 | by (fast dest: hausdorff elim: open_vimage_fst open_vimage_snd) | 
| 3903 | qed | |
| 3904 | ||
| 3905 | lemma isCont_swap[continuous_intros]: "isCont prod.swap a" | |
| 3906 | using continuous_on_eq_continuous_within continuous_on_swap by blast | |
| 3907 | ||
| 64284 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3908 | lemma open_diagonal_complement: | 
| 67957 | 3909 |   "open {(x,y) |x y. x \<noteq> (y::('a::t2_space))}"
 | 
| 3910 | proof - | |
| 3911 |   have "open {(x, y). x \<noteq> (y::'a)}"
 | |
| 3912 | unfolding split_def by (intro open_Collect_neq continuous_intros) | |
| 3913 |   also have "{(x, y). x \<noteq> (y::'a)} = {(x, y) |x y. x \<noteq> (y::'a)}"
 | |
| 3914 | by auto | |
| 3915 | finally show ?thesis . | |
| 64284 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3916 | qed | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3917 | |
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3918 | lemma closed_diagonal: | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3919 |   "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 | 3920 | proof - | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3921 |   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 | 3922 | 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 | 3923 | qed | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3924 | |
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3925 | lemma open_superdiagonal: | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3926 |   "open {(x,y) | x y. x > (y::'a::{linorder_topology})}"
 | 
| 67957 | 3927 | proof - | 
| 3928 |   have "open {(x, y). x > (y::'a)}"
 | |
| 3929 | unfolding split_def by (intro open_Collect_less continuous_intros) | |
| 3930 |   also have "{(x, y). x > (y::'a)} = {(x, y) |x y. x > (y::'a)}"
 | |
| 3931 | by auto | |
| 3932 | finally show ?thesis . | |
| 64284 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3933 | qed | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3934 | |
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3935 | lemma closed_subdiagonal: | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3936 |   "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 | 3937 | proof - | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3938 |   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 | 3939 | 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 | 3940 | qed | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3941 | |
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3942 | lemma open_subdiagonal: | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3943 |   "open {(x,y) | x y. x < (y::'a::{linorder_topology})}"
 | 
| 67957 | 3944 | proof - | 
| 3945 |   have "open {(x, y). x < (y::'a)}"
 | |
| 3946 | unfolding split_def by (intro open_Collect_less continuous_intros) | |
| 3947 |   also have "{(x, y). x < (y::'a)} = {(x, y) |x y. x < (y::'a)}"
 | |
| 3948 | by auto | |
| 3949 | finally show ?thesis . | |
| 64284 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3950 | qed | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3951 | |
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3952 | lemma closed_superdiagonal: | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3953 |   "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 | 3954 | proof - | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3955 |   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 | 3956 | 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 | 3957 | qed | 
| 
f3b905b2eee2
HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
 hoelzl parents: 
64283diff
changeset | 3958 | |
| 62367 | 3959 | end |