242 fix S assume "open S" "x \<in> S" then obtain a where a: "a\<in>A'" "a \<subseteq> S" using A' by blast |
242 fix S assume "open S" "x \<in> S" then obtain a where a: "a\<in>A'" "a \<subseteq> S" using A' by blast |
243 thus "\<exists>a\<in>A. a \<subseteq> S" using a A' |
243 thus "\<exists>a\<in>A. a \<subseteq> S" using a A' |
244 by (intro bexI[where x=a]) (auto simp: A_def intro: image_eqI[where x="{to_nat_on A' a}"]) |
244 by (intro bexI[where x=a]) (auto simp: A_def intro: image_eqI[where x="{to_nat_on A' a}"]) |
245 qed |
245 qed |
246 qed |
246 qed |
|
247 |
|
248 |
|
249 lemma countable_basis: |
|
250 obtains A :: "nat \<Rightarrow> 'a::first_countable_topology set" where |
|
251 "\<And>i. open (A i)" "\<And>i. x \<in> A i" |
|
252 "\<And>F. (\<forall>n. F n \<in> A n) \<Longrightarrow> F ----> x" |
|
253 proof atomize_elim |
|
254 from countable_basis_at_decseq[of x] guess A . note A = this |
|
255 { fix F S assume "\<forall>n. F n \<in> A n" "open S" "x \<in> S" |
|
256 with A(3)[of S] have "eventually (\<lambda>n. F n \<in> S) sequentially" |
|
257 by (auto elim: eventually_elim1 simp: subset_eq) } |
|
258 with A show "\<exists>A. (\<forall>i. open (A i)) \<and> (\<forall>i. x \<in> A i) \<and> (\<forall>F. (\<forall>n. F n \<in> A n) \<longrightarrow> F ----> x)" |
|
259 by (intro exI[of _ A]) (auto simp: tendsto_def) |
|
260 qed |
|
261 |
|
262 lemma sequentially_imp_eventually_nhds_within: |
|
263 fixes a :: "'a::first_countable_topology" |
|
264 assumes "\<forall>f. (\<forall>n. f n \<in> s) \<and> f ----> a \<longrightarrow> eventually (\<lambda>n. P (f n)) sequentially" |
|
265 shows "eventually P (nhds a within s)" |
|
266 proof (rule ccontr) |
|
267 from countable_basis[of a] guess A . note A = this |
|
268 assume "\<not> eventually P (nhds a within s)" |
|
269 with A have P: "\<exists>F. \<forall>n. F n \<in> s \<and> F n \<in> A n \<and> \<not> P (F n)" |
|
270 unfolding Limits.eventually_within eventually_nhds by (intro choice) fastforce |
|
271 then guess F .. |
|
272 hence F0: "\<forall>n. F n \<in> s" and F2: "\<forall>n. F n \<in> A n" and F3: "\<forall>n. \<not> P (F n)" |
|
273 by fast+ |
|
274 with A have "F ----> a" by auto |
|
275 hence "eventually (\<lambda>n. P (F n)) sequentially" |
|
276 using assms F0 by simp |
|
277 thus "False" by (simp add: F3) |
|
278 qed |
|
279 |
|
280 lemma eventually_nhds_within_iff_sequentially: |
|
281 fixes a :: "'a::first_countable_topology" |
|
282 shows "eventually P (nhds a within s) \<longleftrightarrow> |
|
283 (\<forall>f. (\<forall>n. f n \<in> s) \<and> f ----> a \<longrightarrow> eventually (\<lambda>n. P (f n)) sequentially)" |
|
284 proof (safe intro!: sequentially_imp_eventually_nhds_within) |
|
285 assume "eventually P (nhds a within s)" |
|
286 then obtain S where "open S" "a \<in> S" "\<forall>x\<in>S. x \<in> s \<longrightarrow> P x" |
|
287 by (auto simp: Limits.eventually_within eventually_nhds) |
|
288 moreover fix f assume "\<forall>n. f n \<in> s" "f ----> a" |
|
289 ultimately show "eventually (\<lambda>n. P (f n)) sequentially" |
|
290 by (auto dest!: topological_tendstoD elim: eventually_elim1) |
|
291 qed |
|
292 |
|
293 lemma eventually_nhds_iff_sequentially: |
|
294 fixes a :: "'a::first_countable_topology" |
|
295 shows "eventually P (nhds a) \<longleftrightarrow> (\<forall>f. f ----> a \<longrightarrow> eventually (\<lambda>n. P (f n)) sequentially)" |
|
296 using eventually_nhds_within_iff_sequentially[of P a UNIV] by simp |
|
297 |
|
298 lemma not_eventually_sequentiallyD: |
|
299 assumes P: "\<not> eventually P sequentially" |
|
300 shows "\<exists>r. subseq r \<and> (\<forall>n. \<not> P (r n))" |
|
301 proof - |
|
302 from P have "\<forall>n. \<exists>m\<ge>n. \<not> P m" |
|
303 unfolding eventually_sequentially by (simp add: not_less) |
|
304 then obtain r where "\<And>n. r n \<ge> n" "\<And>n. \<not> P (r n)" |
|
305 by (auto simp: choice_iff) |
|
306 then show ?thesis |
|
307 by (auto intro!: exI[of _ "\<lambda>n. r (((Suc \<circ> r) ^^ Suc n) 0)"] |
|
308 simp: less_eq_Suc_le subseq_Suc_iff) |
|
309 qed |
|
310 |
247 |
311 |
248 instance prod :: (first_countable_topology, first_countable_topology) first_countable_topology |
312 instance prod :: (first_countable_topology, first_countable_topology) first_countable_topology |
249 proof |
313 proof |
250 fix x :: "'a \<times> 'b" |
314 fix x :: "'a \<times> 'b" |
251 from first_countable_basisE[of "fst x"] guess A :: "'a set set" . note A = this |
315 from first_countable_basisE[of "fst x"] guess A :: "'a set set" . note A = this |