2342 apply (frule isGlb_isLb) |
2342 apply (frule isGlb_isLb) |
2343 apply (frule_tac x = y in isGlb_isLb) |
2343 apply (frule_tac x = y in isGlb_isLb) |
2344 apply (blast intro!: order_antisym dest!: isGlb_le_isLb) |
2344 apply (blast intro!: order_antisym dest!: isGlb_le_isLb) |
2345 done |
2345 done |
2346 |
2346 |
2347 |
2347 subsection {* Compactness *} |
2348 subsection {* Equivalent versions of compactness *} |
2348 |
|
2349 subsubsection{* Open-cover compactness *} |
|
2350 |
|
2351 definition compact :: "'a::topological_space set \<Rightarrow> bool" where |
|
2352 compact_eq_heine_borel: -- "This name is used for backwards compatibility" |
|
2353 "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))" |
|
2354 |
|
2355 subsubsection {* Bolzano-Weierstrass property *} |
|
2356 |
|
2357 lemma heine_borel_imp_bolzano_weierstrass: |
|
2358 assumes "compact s" "infinite t" "t \<subseteq> s" |
|
2359 shows "\<exists>x \<in> s. x islimpt t" |
|
2360 proof(rule ccontr) |
|
2361 assume "\<not> (\<exists>x \<in> s. x islimpt t)" |
|
2362 then obtain f where f:"\<forall>x\<in>s. x \<in> f x \<and> open (f x) \<and> (\<forall>y\<in>t. y \<in> f x \<longrightarrow> y = x)" unfolding islimpt_def |
|
2363 using bchoice[of s "\<lambda> x T. x \<in> T \<and> open T \<and> (\<forall>y\<in>t. y \<in> T \<longrightarrow> y = x)"] by auto |
|
2364 obtain g where g:"g\<subseteq>{t. \<exists>x. x \<in> s \<and> t = f x}" "finite g" "s \<subseteq> \<Union>g" |
|
2365 using assms(1)[unfolded compact_eq_heine_borel, THEN spec[where x="{t. \<exists>x. x\<in>s \<and> t = f x}"]] using f by auto |
|
2366 from g(1,3) have g':"\<forall>x\<in>g. \<exists>xa \<in> s. x = f xa" by auto |
|
2367 { fix x y assume "x\<in>t" "y\<in>t" "f x = f y" |
|
2368 hence "x \<in> f x" "y \<in> f x \<longrightarrow> y = x" using f[THEN bspec[where x=x]] and `t\<subseteq>s` by auto |
|
2369 hence "x = y" using `f x = f y` and f[THEN bspec[where x=y]] and `y\<in>t` and `t\<subseteq>s` by auto } |
|
2370 hence "inj_on f t" unfolding inj_on_def by simp |
|
2371 hence "infinite (f ` t)" using assms(2) using finite_imageD by auto |
|
2372 moreover |
|
2373 { fix x assume "x\<in>t" "f x \<notin> g" |
|
2374 from g(3) assms(3) `x\<in>t` obtain h where "h\<in>g" and "x\<in>h" by auto |
|
2375 then obtain y where "y\<in>s" "h = f y" using g'[THEN bspec[where x=h]] by auto |
|
2376 hence "y = x" using f[THEN bspec[where x=y]] and `x\<in>t` and `x\<in>h`[unfolded `h = f y`] by auto |
|
2377 hence False using `f x \<notin> g` `h\<in>g` unfolding `h = f y` by auto } |
|
2378 hence "f ` t \<subseteq> g" by auto |
|
2379 ultimately show False using g(2) using finite_subset by auto |
|
2380 qed |
|
2381 |
|
2382 lemma islimpt_range_imp_convergent_subsequence: |
|
2383 fixes l :: "'a :: {t1_space, first_countable_topology}" |
|
2384 assumes l: "l islimpt (range f)" |
|
2385 shows "\<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" |
|
2386 proof - |
|
2387 from first_countable_topology_class.countable_basis_at_decseq[of l] guess A . note A = this |
|
2388 |
|
2389 def s \<equiv> "\<lambda>n i. SOME j. i < j \<and> f j \<in> A (Suc n)" |
|
2390 { fix n i |
|
2391 have "\<exists>a. i < a \<and> f a \<in> A (Suc n) - (f ` {.. i} - {l})" (is "\<exists>a. _ \<and> _ \<in> ?A") |
|
2392 apply (rule l[THEN islimptE, of "?A"]) |
|
2393 using A(2) apply fastforce |
|
2394 using A(1) |
|
2395 apply (intro open_Diff finite_imp_closed) |
|
2396 apply auto |
|
2397 apply (rule_tac x=x in exI) |
|
2398 apply auto |
|
2399 done |
|
2400 then have "\<exists>a. i < a \<and> f a \<in> A (Suc n)" by blast |
|
2401 then have "i < s n i" "f (s n i) \<in> A (Suc n)" |
|
2402 unfolding s_def by (auto intro: someI2_ex) } |
|
2403 note s = this |
|
2404 def r \<equiv> "nat_rec (s 0 0) s" |
|
2405 have "subseq r" |
|
2406 by (auto simp: r_def s subseq_Suc_iff) |
|
2407 moreover |
|
2408 have "(\<lambda>n. f (r n)) ----> l" |
|
2409 proof (rule topological_tendstoI) |
|
2410 fix S assume "open S" "l \<in> S" |
|
2411 with A(3) have "eventually (\<lambda>i. A i \<subseteq> S) sequentially" by auto |
|
2412 moreover |
|
2413 { fix i assume "Suc 0 \<le> i" then have "f (r i) \<in> A i" |
|
2414 by (cases i) (simp_all add: r_def s) } |
|
2415 then have "eventually (\<lambda>i. f (r i) \<in> A i) sequentially" by (auto simp: eventually_sequentially) |
|
2416 ultimately show "eventually (\<lambda>i. f (r i) \<in> S) sequentially" |
|
2417 by eventually_elim auto |
|
2418 qed |
|
2419 ultimately show "\<exists>r. subseq r \<and> (f \<circ> r) ----> l" |
|
2420 by (auto simp: convergent_def comp_def) |
|
2421 qed |
|
2422 |
|
2423 lemma finite_range_imp_infinite_repeats: |
|
2424 fixes f :: "nat \<Rightarrow> 'a" |
|
2425 assumes "finite (range f)" |
|
2426 shows "\<exists>k. infinite {n. f n = k}" |
|
2427 proof - |
|
2428 { fix A :: "'a set" assume "finite A" |
|
2429 hence "\<And>f. infinite {n. f n \<in> A} \<Longrightarrow> \<exists>k. infinite {n. f n = k}" |
|
2430 proof (induct) |
|
2431 case empty thus ?case by simp |
|
2432 next |
|
2433 case (insert x A) |
|
2434 show ?case |
|
2435 proof (cases "finite {n. f n = x}") |
|
2436 case True |
|
2437 with `infinite {n. f n \<in> insert x A}` |
|
2438 have "infinite {n. f n \<in> A}" by simp |
|
2439 thus "\<exists>k. infinite {n. f n = k}" by (rule insert) |
|
2440 next |
|
2441 case False thus "\<exists>k. infinite {n. f n = k}" .. |
|
2442 qed |
|
2443 qed |
|
2444 } note H = this |
|
2445 from assms show "\<exists>k. infinite {n. f n = k}" |
|
2446 by (rule H) simp |
|
2447 qed |
|
2448 |
|
2449 lemma sequence_infinite_lemma: |
|
2450 fixes f :: "nat \<Rightarrow> 'a::t1_space" |
|
2451 assumes "\<forall>n. f n \<noteq> l" and "(f ---> l) sequentially" |
|
2452 shows "infinite (range f)" |
|
2453 proof |
|
2454 assume "finite (range f)" |
|
2455 hence "closed (range f)" by (rule finite_imp_closed) |
|
2456 hence "open (- range f)" by (rule open_Compl) |
|
2457 from assms(1) have "l \<in> - range f" by auto |
|
2458 from assms(2) have "eventually (\<lambda>n. f n \<in> - range f) sequentially" |
|
2459 using `open (- range f)` `l \<in> - range f` by (rule topological_tendstoD) |
|
2460 thus False unfolding eventually_sequentially by auto |
|
2461 qed |
|
2462 |
|
2463 lemma closure_insert: |
|
2464 fixes x :: "'a::t1_space" |
|
2465 shows "closure (insert x s) = insert x (closure s)" |
|
2466 apply (rule closure_unique) |
|
2467 apply (rule insert_mono [OF closure_subset]) |
|
2468 apply (rule closed_insert [OF closed_closure]) |
|
2469 apply (simp add: closure_minimal) |
|
2470 done |
|
2471 |
|
2472 lemma islimpt_insert: |
|
2473 fixes x :: "'a::t1_space" |
|
2474 shows "x islimpt (insert a s) \<longleftrightarrow> x islimpt s" |
|
2475 proof |
|
2476 assume *: "x islimpt (insert a s)" |
|
2477 show "x islimpt s" |
|
2478 proof (rule islimptI) |
|
2479 fix t assume t: "x \<in> t" "open t" |
|
2480 show "\<exists>y\<in>s. y \<in> t \<and> y \<noteq> x" |
|
2481 proof (cases "x = a") |
|
2482 case True |
|
2483 obtain y where "y \<in> insert a s" "y \<in> t" "y \<noteq> x" |
|
2484 using * t by (rule islimptE) |
|
2485 with `x = a` show ?thesis by auto |
|
2486 next |
|
2487 case False |
|
2488 with t have t': "x \<in> t - {a}" "open (t - {a})" |
|
2489 by (simp_all add: open_Diff) |
|
2490 obtain y where "y \<in> insert a s" "y \<in> t - {a}" "y \<noteq> x" |
|
2491 using * t' by (rule islimptE) |
|
2492 thus ?thesis by auto |
|
2493 qed |
|
2494 qed |
|
2495 next |
|
2496 assume "x islimpt s" thus "x islimpt (insert a s)" |
|
2497 by (rule islimpt_subset) auto |
|
2498 qed |
|
2499 |
|
2500 lemma islimpt_union_finite: |
|
2501 fixes x :: "'a::t1_space" |
|
2502 shows "finite s \<Longrightarrow> x islimpt (s \<union> t) \<longleftrightarrow> x islimpt t" |
|
2503 by (induct set: finite, simp_all add: islimpt_insert) |
|
2504 |
|
2505 lemma sequence_unique_limpt: |
|
2506 fixes f :: "nat \<Rightarrow> 'a::t2_space" |
|
2507 assumes "(f ---> l) sequentially" and "l' islimpt (range f)" |
|
2508 shows "l' = l" |
|
2509 proof (rule ccontr) |
|
2510 assume "l' \<noteq> l" |
|
2511 obtain s t where "open s" "open t" "l' \<in> s" "l \<in> t" "s \<inter> t = {}" |
|
2512 using hausdorff [OF `l' \<noteq> l`] by auto |
|
2513 have "eventually (\<lambda>n. f n \<in> t) sequentially" |
|
2514 using assms(1) `open t` `l \<in> t` by (rule topological_tendstoD) |
|
2515 then obtain N where "\<forall>n\<ge>N. f n \<in> t" |
|
2516 unfolding eventually_sequentially by auto |
|
2517 |
|
2518 have "UNIV = {..<N} \<union> {N..}" by auto |
|
2519 hence "l' islimpt (f ` ({..<N} \<union> {N..}))" using assms(2) by simp |
|
2520 hence "l' islimpt (f ` {..<N} \<union> f ` {N..})" by (simp add: image_Un) |
|
2521 hence "l' islimpt (f ` {N..})" by (simp add: islimpt_union_finite) |
|
2522 then obtain y where "y \<in> f ` {N..}" "y \<in> s" "y \<noteq> l'" |
|
2523 using `l' \<in> s` `open s` by (rule islimptE) |
|
2524 then obtain n where "N \<le> n" "f n \<in> s" "f n \<noteq> l'" by auto |
|
2525 with `\<forall>n\<ge>N. f n \<in> t` have "f n \<in> s \<inter> t" by simp |
|
2526 with `s \<inter> t = {}` show False by simp |
|
2527 qed |
|
2528 |
|
2529 lemma bolzano_weierstrass_imp_closed: |
|
2530 fixes s :: "'a::{first_countable_topology, t2_space} set" |
|
2531 assumes "\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t)" |
|
2532 shows "closed s" |
|
2533 proof- |
|
2534 { fix x l assume as: "\<forall>n::nat. x n \<in> s" "(x ---> l) sequentially" |
|
2535 hence "l \<in> s" |
|
2536 proof(cases "\<forall>n. x n \<noteq> l") |
|
2537 case False thus "l\<in>s" using as(1) by auto |
|
2538 next |
|
2539 case True note cas = this |
|
2540 with as(2) have "infinite (range x)" using sequence_infinite_lemma[of x l] by auto |
|
2541 then obtain l' where "l'\<in>s" "l' islimpt (range x)" using assms[THEN spec[where x="range x"]] as(1) by auto |
|
2542 thus "l\<in>s" using sequence_unique_limpt[of x l l'] using as cas by auto |
|
2543 qed } |
|
2544 thus ?thesis unfolding closed_sequential_limits by fast |
|
2545 qed |
|
2546 |
|
2547 lemma compact_imp_closed: |
|
2548 fixes s :: "'a::{first_countable_topology, t2_space} set" |
|
2549 shows "compact s \<Longrightarrow> closed s" |
|
2550 proof - |
|
2551 assume "compact s" |
|
2552 hence "\<forall>t. infinite t \<and> t \<subseteq> s \<longrightarrow> (\<exists>x \<in> s. x islimpt t)" |
|
2553 using heine_borel_imp_bolzano_weierstrass[of s] by auto |
|
2554 thus "closed s" |
|
2555 by (rule bolzano_weierstrass_imp_closed) |
|
2556 qed |
|
2557 |
|
2558 text{* In particular, some common special cases. *} |
|
2559 |
|
2560 lemma compact_empty[simp]: |
|
2561 "compact {}" |
|
2562 unfolding compact_eq_heine_borel |
|
2563 by auto |
|
2564 |
|
2565 lemma compact_union [intro]: |
|
2566 assumes "compact s" "compact t" shows " compact (s \<union> t)" |
|
2567 unfolding compact_eq_heine_borel |
|
2568 proof (intro allI impI) |
|
2569 fix f assume *: "Ball f open \<and> s \<union> t \<subseteq> \<Union>f" |
|
2570 from * `compact s` obtain s' where "s' \<subseteq> f \<and> finite s' \<and> s \<subseteq> \<Union>s'" |
|
2571 unfolding compact_eq_heine_borel by (auto elim!: allE[of _ f]) metis |
|
2572 moreover from * `compact t` obtain t' where "t' \<subseteq> f \<and> finite t' \<and> t \<subseteq> \<Union>t'" |
|
2573 unfolding compact_eq_heine_borel by (auto elim!: allE[of _ f]) metis |
|
2574 ultimately show "\<exists>f'\<subseteq>f. finite f' \<and> s \<union> t \<subseteq> \<Union>f'" |
|
2575 by (auto intro!: exI[of _ "s' \<union> t'"]) |
|
2576 qed |
|
2577 |
|
2578 lemma compact_Union [intro]: "finite S \<Longrightarrow> (\<And>T. T \<in> S \<Longrightarrow> compact T) \<Longrightarrow> compact (\<Union>S)" |
|
2579 by (induct set: finite) auto |
|
2580 |
|
2581 lemma compact_UN [intro]: |
|
2582 "finite A \<Longrightarrow> (\<And>x. x \<in> A \<Longrightarrow> compact (B x)) \<Longrightarrow> compact (\<Union>x\<in>A. B x)" |
|
2583 unfolding SUP_def by (rule compact_Union) auto |
|
2584 |
|
2585 lemma compact_inter_closed [intro]: |
|
2586 assumes "compact s" and "closed t" |
|
2587 shows "compact (s \<inter> t)" |
|
2588 unfolding compact_eq_heine_borel |
|
2589 proof safe |
|
2590 fix C assume C: "\<forall>c\<in>C. open c" and cover: "s \<inter> t \<subseteq> \<Union>C" |
|
2591 from C `closed t` have "\<forall>c\<in>C \<union> {-t}. open c" by auto |
|
2592 moreover from cover have "s \<subseteq> \<Union>(C \<union> {-t})" by auto |
|
2593 ultimately have "\<exists>D\<subseteq>C \<union> {-t}. finite D \<and> s \<subseteq> \<Union>D" |
|
2594 using `compact s` unfolding compact_eq_heine_borel by auto |
|
2595 then guess D .. |
|
2596 then show "\<exists>D\<subseteq>C. finite D \<and> s \<inter> t \<subseteq> \<Union>D" |
|
2597 by (intro exI[of _ "D - {-t}"]) auto |
|
2598 qed |
|
2599 |
|
2600 lemma closed_inter_compact [intro]: |
|
2601 assumes "closed s" and "compact t" |
|
2602 shows "compact (s \<inter> t)" |
|
2603 using compact_inter_closed [of t s] assms |
|
2604 by (simp add: Int_commute) |
|
2605 |
|
2606 lemma compact_inter [intro]: |
|
2607 fixes s t :: "'a :: {t2_space, first_countable_topology} set" |
|
2608 assumes "compact s" and "compact t" |
|
2609 shows "compact (s \<inter> t)" |
|
2610 using assms by (intro compact_inter_closed compact_imp_closed) |
|
2611 |
|
2612 lemma compact_sing [simp]: "compact {a}" |
|
2613 unfolding compact_eq_heine_borel by auto |
|
2614 |
|
2615 lemma compact_insert [simp]: |
|
2616 assumes "compact s" shows "compact (insert x s)" |
|
2617 proof - |
|
2618 have "compact ({x} \<union> s)" |
|
2619 using compact_sing assms by (rule compact_union) |
|
2620 thus ?thesis by simp |
|
2621 qed |
|
2622 |
|
2623 lemma finite_imp_compact: |
|
2624 shows "finite s \<Longrightarrow> compact s" |
|
2625 by (induct set: finite) simp_all |
|
2626 |
|
2627 lemma open_delete: |
|
2628 fixes s :: "'a::t1_space set" |
|
2629 shows "open s \<Longrightarrow> open (s - {x})" |
|
2630 by (simp add: open_Diff) |
|
2631 |
|
2632 text{* Finite intersection property *} |
|
2633 |
|
2634 lemma inj_setminus: "inj_on uminus (A::'a set set)" |
|
2635 by (auto simp: inj_on_def) |
|
2636 |
|
2637 lemma compact_fip: |
|
2638 "compact U \<longleftrightarrow> |
|
2639 (\<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> {})" |
|
2640 (is "_ \<longleftrightarrow> ?R") |
|
2641 proof (safe intro!: compact_eq_heine_borel[THEN iffD2]) |
|
2642 fix A assume "compact U" and A: "\<forall>a\<in>A. closed a" "U \<inter> \<Inter>A = {}" |
|
2643 and fi: "\<forall>B \<subseteq> A. finite B \<longrightarrow> U \<inter> \<Inter>B \<noteq> {}" |
|
2644 from A have "(\<forall>a\<in>uminus`A. open a) \<and> U \<subseteq> \<Union>uminus`A" |
|
2645 by auto |
|
2646 with `compact U` obtain B where "B \<subseteq> A" "finite (uminus`B)" "U \<subseteq> \<Union>(uminus`B)" |
|
2647 unfolding compact_eq_heine_borel by (metis subset_image_iff) |
|
2648 with fi[THEN spec, of B] show False |
|
2649 by (auto dest: finite_imageD intro: inj_setminus) |
|
2650 next |
|
2651 fix A assume ?R and cover: "\<forall>a\<in>A. open a" "U \<subseteq> \<Union>A" |
|
2652 from cover have "U \<inter> \<Inter>(uminus`A) = {}" "\<forall>a\<in>uminus`A. closed a" |
|
2653 by auto |
|
2654 with `?R` obtain B where "B \<subseteq> A" "finite (uminus`B)" "U \<inter> \<Inter>uminus`B = {}" |
|
2655 by (metis subset_image_iff) |
|
2656 then show "\<exists>T\<subseteq>A. finite T \<and> U \<subseteq> \<Union>T" |
|
2657 by (auto intro!: exI[of _ B] inj_setminus dest: finite_imageD) |
|
2658 qed |
|
2659 |
|
2660 lemma compact_imp_fip: |
|
2661 "compact s \<Longrightarrow> \<forall>t \<in> f. closed t \<Longrightarrow> \<forall>f'. finite f' \<and> f' \<subseteq> f \<longrightarrow> (s \<inter> (\<Inter> f') \<noteq> {}) \<Longrightarrow> |
|
2662 s \<inter> (\<Inter> f) \<noteq> {}" |
|
2663 unfolding compact_fip by auto |
|
2664 |
|
2665 text{*Compactness expressed with filters*} |
|
2666 |
|
2667 definition "filter_from_subbase B = Abs_filter (\<lambda>P. \<exists>X \<subseteq> B. finite X \<and> Inf X \<le> P)" |
|
2668 |
|
2669 lemma eventually_filter_from_subbase: |
|
2670 "eventually P (filter_from_subbase B) \<longleftrightarrow> (\<exists>X \<subseteq> B. finite X \<and> Inf X \<le> P)" |
|
2671 (is "_ \<longleftrightarrow> ?R P") |
|
2672 unfolding filter_from_subbase_def |
|
2673 proof (rule eventually_Abs_filter is_filter.intro)+ |
|
2674 show "?R (\<lambda>x. True)" |
|
2675 by (rule exI[of _ "{}"]) (simp add: le_fun_def) |
|
2676 next |
|
2677 fix P Q assume "?R P" then guess X .. |
|
2678 moreover assume "?R Q" then guess Y .. |
|
2679 ultimately show "?R (\<lambda>x. P x \<and> Q x)" |
|
2680 by (intro exI[of _ "X \<union> Y"]) auto |
|
2681 next |
|
2682 fix P Q |
|
2683 assume "?R P" then guess X .. |
|
2684 moreover assume "\<forall>x. P x \<longrightarrow> Q x" |
|
2685 ultimately show "?R Q" |
|
2686 by (intro exI[of _ X]) auto |
|
2687 qed |
|
2688 |
|
2689 lemma eventually_filter_from_subbaseI: "P \<in> B \<Longrightarrow> eventually P (filter_from_subbase B)" |
|
2690 by (subst eventually_filter_from_subbase) (auto intro!: exI[of _ "{P}"]) |
|
2691 |
|
2692 lemma filter_from_subbase_not_bot: |
|
2693 "\<forall>X \<subseteq> B. finite X \<longrightarrow> Inf X \<noteq> bot \<Longrightarrow> filter_from_subbase B \<noteq> bot" |
|
2694 unfolding trivial_limit_def eventually_filter_from_subbase by auto |
|
2695 |
|
2696 lemma closure_iff_nhds_not_empty: |
|
2697 "x \<in> closure X \<longleftrightarrow> (\<forall>A. \<forall>S\<subseteq>A. open S \<longrightarrow> x \<in> S \<longrightarrow> X \<inter> A \<noteq> {})" |
|
2698 proof safe |
|
2699 assume x: "x \<in> closure X" |
|
2700 fix S A assume "open S" "x \<in> S" "X \<inter> A = {}" "S \<subseteq> A" |
|
2701 then have "x \<notin> closure (-S)" |
|
2702 by (auto simp: closure_complement subset_eq[symmetric] intro: interiorI) |
|
2703 with x have "x \<in> closure X - closure (-S)" |
|
2704 by auto |
|
2705 also have "\<dots> \<subseteq> closure (X \<inter> S)" |
|
2706 using `open S` open_inter_closure_subset[of S X] by (simp add: closed_Compl ac_simps) |
|
2707 finally have "X \<inter> S \<noteq> {}" by auto |
|
2708 then show False using `X \<inter> A = {}` `S \<subseteq> A` by auto |
|
2709 next |
|
2710 assume "\<forall>A S. S \<subseteq> A \<longrightarrow> open S \<longrightarrow> x \<in> S \<longrightarrow> X \<inter> A \<noteq> {}" |
|
2711 from this[THEN spec, of "- X", THEN spec, of "- closure X"] |
|
2712 show "x \<in> closure X" |
|
2713 by (simp add: closure_subset open_Compl) |
|
2714 qed |
|
2715 |
|
2716 lemma compact_filter: |
|
2717 "compact U \<longleftrightarrow> (\<forall>F. F \<noteq> bot \<longrightarrow> eventually (\<lambda>x. x \<in> U) F \<longrightarrow> (\<exists>x\<in>U. inf (nhds x) F \<noteq> bot))" |
|
2718 proof (intro allI iffI impI compact_fip[THEN iffD2] notI) |
|
2719 fix F assume "compact U" and F: "F \<noteq> bot" "eventually (\<lambda>x. x \<in> U) F" |
|
2720 from F have "U \<noteq> {}" |
|
2721 by (auto simp: eventually_False) |
|
2722 |
|
2723 def Z \<equiv> "closure ` {A. eventually (\<lambda>x. x \<in> A) F}" |
|
2724 then have "\<forall>z\<in>Z. closed z" |
|
2725 by auto |
|
2726 moreover |
|
2727 have ev_Z: "\<And>z. z \<in> Z \<Longrightarrow> eventually (\<lambda>x. x \<in> z) F" |
|
2728 unfolding Z_def by (auto elim: eventually_elim1 intro: set_mp[OF closure_subset]) |
|
2729 have "(\<forall>B \<subseteq> Z. finite B \<longrightarrow> U \<inter> \<Inter>B \<noteq> {})" |
|
2730 proof (intro allI impI) |
|
2731 fix B assume "finite B" "B \<subseteq> Z" |
|
2732 with `finite B` ev_Z have "eventually (\<lambda>x. \<forall>b\<in>B. x \<in> b) F" |
|
2733 by (auto intro!: eventually_Ball_finite) |
|
2734 with F(2) have "eventually (\<lambda>x. x \<in> U \<inter> (\<Inter>B)) F" |
|
2735 by eventually_elim auto |
|
2736 with F show "U \<inter> \<Inter>B \<noteq> {}" |
|
2737 by (intro notI) (simp add: eventually_False) |
|
2738 qed |
|
2739 ultimately have "U \<inter> \<Inter>Z \<noteq> {}" |
|
2740 using `compact U` unfolding compact_fip by blast |
|
2741 then obtain x where "x \<in> U" and x: "\<And>z. z \<in> Z \<Longrightarrow> x \<in> z" by auto |
|
2742 |
|
2743 have "\<And>P. eventually P (inf (nhds x) F) \<Longrightarrow> P \<noteq> bot" |
|
2744 unfolding eventually_inf eventually_nhds |
|
2745 proof safe |
|
2746 fix P Q R S |
|
2747 assume "eventually R F" "open S" "x \<in> S" |
|
2748 with open_inter_closure_eq_empty[of S "{x. R x}"] x[of "closure {x. R x}"] |
|
2749 have "S \<inter> {x. R x} \<noteq> {}" by (auto simp: Z_def) |
|
2750 moreover assume "Ball S Q" "\<forall>x. Q x \<and> R x \<longrightarrow> bot x" |
|
2751 ultimately show False by (auto simp: set_eq_iff) |
|
2752 qed |
|
2753 with `x \<in> U` show "\<exists>x\<in>U. inf (nhds x) F \<noteq> bot" |
|
2754 by (metis eventually_bot) |
|
2755 next |
|
2756 fix A assume A: "\<forall>a\<in>A. closed a" "\<forall>B\<subseteq>A. finite B \<longrightarrow> U \<inter> \<Inter>B \<noteq> {}" "U \<inter> \<Inter>A = {}" |
|
2757 |
|
2758 def P' \<equiv> "(\<lambda>a (x::'a). x \<in> a)" |
|
2759 then have inj_P': "\<And>A. inj_on P' A" |
|
2760 by (auto intro!: inj_onI simp: fun_eq_iff) |
|
2761 def F \<equiv> "filter_from_subbase (P' ` insert U A)" |
|
2762 have "F \<noteq> bot" |
|
2763 unfolding F_def |
|
2764 proof (safe intro!: filter_from_subbase_not_bot) |
|
2765 fix X assume "X \<subseteq> P' ` insert U A" "finite X" "Inf X = bot" |
|
2766 then obtain B where "B \<subseteq> insert U A" "finite B" and B: "Inf (P' ` B) = bot" |
|
2767 unfolding subset_image_iff by (auto intro: inj_P' finite_imageD) |
|
2768 with A(2)[THEN spec, of "B - {U}"] have "U \<inter> \<Inter>(B - {U}) \<noteq> {}" by auto |
|
2769 with B show False by (auto simp: P'_def fun_eq_iff) |
|
2770 qed |
|
2771 moreover have "eventually (\<lambda>x. x \<in> U) F" |
|
2772 unfolding F_def by (rule eventually_filter_from_subbaseI) (auto simp: P'_def) |
|
2773 moreover assume "\<forall>F. F \<noteq> bot \<longrightarrow> eventually (\<lambda>x. x \<in> U) F \<longrightarrow> (\<exists>x\<in>U. inf (nhds x) F \<noteq> bot)" |
|
2774 ultimately obtain x where "x \<in> U" and x: "inf (nhds x) F \<noteq> bot" |
|
2775 by auto |
|
2776 |
|
2777 { fix V assume "V \<in> A" |
|
2778 then have V: "eventually (\<lambda>x. x \<in> V) F" |
|
2779 by (auto simp add: F_def image_iff P'_def intro!: eventually_filter_from_subbaseI) |
|
2780 have "x \<in> closure V" |
|
2781 unfolding closure_iff_nhds_not_empty |
|
2782 proof (intro impI allI) |
|
2783 fix S A assume "open S" "x \<in> S" "S \<subseteq> A" |
|
2784 then have "eventually (\<lambda>x. x \<in> A) (nhds x)" by (auto simp: eventually_nhds) |
|
2785 with V have "eventually (\<lambda>x. x \<in> V \<inter> A) (inf (nhds x) F)" |
|
2786 by (auto simp: eventually_inf) |
|
2787 with x show "V \<inter> A \<noteq> {}" |
|
2788 by (auto simp del: Int_iff simp add: trivial_limit_def) |
|
2789 qed |
|
2790 then have "x \<in> V" |
|
2791 using `V \<in> A` A(1) by simp } |
|
2792 with `x\<in>U` have "x \<in> U \<inter> \<Inter>A" by auto |
|
2793 with `U \<inter> \<Inter>A = {}` show False by auto |
|
2794 qed |
|
2795 |
|
2796 lemma countable_compact: |
|
2797 fixes U :: "'a :: second_countable_topology set" |
|
2798 shows "compact U \<longleftrightarrow> |
|
2799 (\<forall>A. countable A \<longrightarrow> (\<forall>a\<in>A. open a) \<longrightarrow> U \<subseteq> \<Union>A \<longrightarrow> (\<exists>T\<subseteq>A. finite T \<and> U \<subseteq> \<Union>T))" |
|
2800 proof (safe intro!: compact_eq_heine_borel[THEN iffD2]) |
|
2801 fix A assume A: "\<forall>a\<in>A. open a" "U \<subseteq> \<Union>A" |
|
2802 assume *: "\<forall>A. countable A \<longrightarrow> (\<forall>a\<in>A. open a) \<longrightarrow> U \<subseteq> \<Union>A \<longrightarrow> (\<exists>T\<subseteq>A. finite T \<and> U \<subseteq> \<Union>T)" |
|
2803 def B \<equiv> "SOME B::'a set set. countable B \<and> topological_basis B" |
|
2804 then have B: "countable B" "topological_basis B" |
|
2805 by (auto simp: countable_basis is_basis) |
|
2806 |
|
2807 moreover def C \<equiv> "{b\<in>B. \<exists>a\<in>A. b \<subseteq> a}" |
|
2808 ultimately have "countable C" "\<forall>a\<in>C. open a" |
|
2809 unfolding C_def by (auto simp: topological_basis_open) |
|
2810 moreover |
|
2811 have "\<Union>A \<subseteq> \<Union>C" |
|
2812 proof safe |
|
2813 fix x a assume "x \<in> a" "a \<in> A" |
|
2814 with topological_basisE[of B a x] B A |
|
2815 obtain b where "x \<in> b" "b \<in> B" "b \<subseteq> a" by metis |
|
2816 with `a \<in> A` show "x \<in> \<Union>C" unfolding C_def by auto |
|
2817 qed |
|
2818 then have "U \<subseteq> \<Union>C" using `U \<subseteq> \<Union>A` by auto |
|
2819 ultimately obtain T where "T\<subseteq>C" "finite T" "U \<subseteq> \<Union>T" |
|
2820 using * by metis |
|
2821 moreover then have "\<forall>t\<in>T. \<exists>a\<in>A. t \<subseteq> a" |
|
2822 by (auto simp: C_def) |
|
2823 then guess f unfolding bchoice_iff Bex_def .. |
|
2824 ultimately show "\<exists>T\<subseteq>A. finite T \<and> U \<subseteq> \<Union>T" |
|
2825 unfolding C_def by (intro exI[of _ "f`T"]) fastforce |
|
2826 qed (auto simp: compact_eq_heine_borel) |
2349 |
2827 |
2350 subsubsection{* Sequential compactness *} |
2828 subsubsection{* Sequential compactness *} |
2351 |
2829 |
2352 definition |
2830 definition |
2353 compact :: "'a::metric_space set \<Rightarrow> bool" where (* TODO: generalize *) |
2831 seq_compact :: "'a::topological_space set \<Rightarrow> bool" where |
2354 "compact S \<longleftrightarrow> |
2832 "seq_compact S \<longleftrightarrow> |
2355 (\<forall>f. (\<forall>n. f n \<in> S) \<longrightarrow> |
2833 (\<forall>f. (\<forall>n. f n \<in> S) \<longrightarrow> |
2356 (\<exists>l\<in>S. \<exists>r. subseq r \<and> ((f o r) ---> l) sequentially))" |
2834 (\<exists>l\<in>S. \<exists>r. subseq r \<and> ((f o r) ---> l) sequentially))" |
2357 |
2835 |
2358 lemma compactI: |
2836 lemma seq_compact_imp_compact: |
|
2837 fixes U :: "'a :: second_countable_topology set" |
|
2838 assumes "seq_compact U" |
|
2839 shows "compact U" |
|
2840 unfolding countable_compact |
|
2841 proof safe |
|
2842 fix A assume A: "\<forall>a\<in>A. open a" "U \<subseteq> \<Union>A" "countable A" |
|
2843 have subseq: "\<And>X. range X \<subseteq> U \<Longrightarrow> \<exists>r x. x \<in> U \<and> subseq r \<and> (X \<circ> r) ----> x" |
|
2844 using `seq_compact U` by (fastforce simp: seq_compact_def subset_eq) |
|
2845 show "\<exists>T\<subseteq>A. finite T \<and> U \<subseteq> \<Union>T" |
|
2846 proof cases |
|
2847 assume "finite A" with A show ?thesis by auto |
|
2848 next |
|
2849 assume "infinite A" |
|
2850 then have "A \<noteq> {}" by auto |
|
2851 show ?thesis |
|
2852 proof (rule ccontr) |
|
2853 assume "\<not> (\<exists>T\<subseteq>A. finite T \<and> U \<subseteq> \<Union>T)" |
|
2854 then have "\<forall>T. \<exists>x. T \<subseteq> A \<and> finite T \<longrightarrow> (x \<in> U - \<Union>T)" by auto |
|
2855 then obtain X' where T: "\<And>T. T \<subseteq> A \<Longrightarrow> finite T \<Longrightarrow> X' T \<in> U - \<Union>T" by metis |
|
2856 def X \<equiv> "\<lambda>n. X' (from_nat_into A ` {.. n})" |
|
2857 have X: "\<And>n. X n \<in> U - (\<Union>i\<le>n. from_nat_into A i)" |
|
2858 using `A \<noteq> {}` unfolding X_def SUP_def by (intro T) (auto intro: from_nat_into) |
|
2859 then have "range X \<subseteq> U" by auto |
|
2860 with subseq[of X] obtain r x where "x \<in> U" and r: "subseq r" "(X \<circ> r) ----> x" by auto |
|
2861 from `x\<in>U` `U \<subseteq> \<Union>A` from_nat_into_surj[OF `countable A`] |
|
2862 obtain n where "x \<in> from_nat_into A n" by auto |
|
2863 with r(2) A(1) from_nat_into[OF `A \<noteq> {}`, of n] |
|
2864 have "eventually (\<lambda>i. X (r i) \<in> from_nat_into A n) sequentially" |
|
2865 unfolding tendsto_def by (auto simp: comp_def) |
|
2866 then obtain N where "\<And>i. N \<le> i \<Longrightarrow> X (r i) \<in> from_nat_into A n" |
|
2867 by (auto simp: eventually_sequentially) |
|
2868 moreover from X have "\<And>i. n \<le> r i \<Longrightarrow> X (r i) \<notin> from_nat_into A n" |
|
2869 by auto |
|
2870 moreover from `subseq r`[THEN seq_suble, of "max n N"] have "\<exists>i. n \<le> r i \<and> N \<le> i" |
|
2871 by (auto intro!: exI[of _ "max n N"]) |
|
2872 ultimately show False |
|
2873 by auto |
|
2874 qed |
|
2875 qed |
|
2876 qed |
|
2877 |
|
2878 lemma compact_imp_seq_compact: |
|
2879 fixes U :: "'a :: first_countable_topology set" |
|
2880 assumes "compact U" shows "seq_compact U" |
|
2881 unfolding seq_compact_def |
|
2882 proof safe |
|
2883 fix X :: "nat \<Rightarrow> 'a" assume "\<forall>n. X n \<in> U" |
|
2884 then have "eventually (\<lambda>x. x \<in> U) (filtermap X sequentially)" |
|
2885 by (auto simp: eventually_filtermap) |
|
2886 moreover have "filtermap X sequentially \<noteq> bot" |
|
2887 by (simp add: trivial_limit_def eventually_filtermap) |
|
2888 ultimately obtain x where "x \<in> U" and x: "inf (nhds x) (filtermap X sequentially) \<noteq> bot" (is "?F \<noteq> _") |
|
2889 using `compact U` by (auto simp: compact_filter) |
|
2890 |
|
2891 from countable_basis_at_decseq[of x] guess A . note A = this |
|
2892 def s \<equiv> "\<lambda>n i. SOME j. i < j \<and> X j \<in> A (Suc n)" |
|
2893 { fix n i |
|
2894 have "\<exists>a. i < a \<and> X a \<in> A (Suc n)" |
|
2895 proof (rule ccontr) |
|
2896 assume "\<not> (\<exists>a>i. X a \<in> A (Suc n))" |
|
2897 then have "\<And>a. Suc i \<le> a \<Longrightarrow> X a \<notin> A (Suc n)" by auto |
|
2898 then have "eventually (\<lambda>x. x \<notin> A (Suc n)) (filtermap X sequentially)" |
|
2899 by (auto simp: eventually_filtermap eventually_sequentially) |
|
2900 moreover have "eventually (\<lambda>x. x \<in> A (Suc n)) (nhds x)" |
|
2901 using A(1,2)[of "Suc n"] by (auto simp: eventually_nhds) |
|
2902 ultimately have "eventually (\<lambda>x. False) ?F" |
|
2903 by (auto simp add: eventually_inf) |
|
2904 with x show False |
|
2905 by (simp add: eventually_False) |
|
2906 qed |
|
2907 then have "i < s n i" "X (s n i) \<in> A (Suc n)" |
|
2908 unfolding s_def by (auto intro: someI2_ex) } |
|
2909 note s = this |
|
2910 def r \<equiv> "nat_rec (s 0 0) s" |
|
2911 have "subseq r" |
|
2912 by (auto simp: r_def s subseq_Suc_iff) |
|
2913 moreover |
|
2914 have "(\<lambda>n. X (r n)) ----> x" |
|
2915 proof (rule topological_tendstoI) |
|
2916 fix S assume "open S" "x \<in> S" |
|
2917 with A(3) have "eventually (\<lambda>i. A i \<subseteq> S) sequentially" by auto |
|
2918 moreover |
|
2919 { fix i assume "Suc 0 \<le> i" then have "X (r i) \<in> A i" |
|
2920 by (cases i) (simp_all add: r_def s) } |
|
2921 then have "eventually (\<lambda>i. X (r i) \<in> A i) sequentially" by (auto simp: eventually_sequentially) |
|
2922 ultimately show "eventually (\<lambda>i. X (r i) \<in> S) sequentially" |
|
2923 by eventually_elim auto |
|
2924 qed |
|
2925 ultimately show "\<exists>x \<in> U. \<exists>r. subseq r \<and> (X \<circ> r) ----> x" |
|
2926 using `x \<in> U` by (auto simp: convergent_def comp_def) |
|
2927 qed |
|
2928 |
|
2929 lemma seq_compact_eq_compact: |
|
2930 fixes U :: "'a :: second_countable_topology set" |
|
2931 shows "seq_compact U \<longleftrightarrow> compact U" |
|
2932 using compact_imp_seq_compact seq_compact_imp_compact by blast |
|
2933 |
|
2934 lemma seq_compactI: |
2359 assumes "\<And>f. \<forall>n. f n \<in> S \<Longrightarrow> \<exists>l\<in>S. \<exists>r. subseq r \<and> ((f o r) ---> l) sequentially" |
2935 assumes "\<And>f. \<forall>n. f n \<in> S \<Longrightarrow> \<exists>l\<in>S. \<exists>r. subseq r \<and> ((f o r) ---> l) sequentially" |
2360 shows "compact S" |
2936 shows "seq_compact S" |
2361 unfolding compact_def using assms by fast |
2937 unfolding seq_compact_def using assms by fast |
2362 |
2938 |
2363 lemma compactE: |
2939 lemma seq_compactE: |
2364 assumes "compact S" "\<forall>n. f n \<in> S" |
2940 assumes "seq_compact S" "\<forall>n. f n \<in> S" |
2365 obtains l r where "l \<in> S" "subseq r" "((f \<circ> r) ---> l) sequentially" |
2941 obtains l r where "l \<in> S" "subseq r" "((f \<circ> r) ---> l) sequentially" |
2366 using assms unfolding compact_def by fast |
2942 using assms unfolding seq_compact_def by fast |
|
2943 |
|
2944 lemma bolzano_weierstrass_imp_seq_compact: |
|
2945 fixes s :: "'a::{t1_space, first_countable_topology} set" |
|
2946 assumes "\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t)" |
|
2947 shows "seq_compact s" |
|
2948 proof - |
|
2949 { fix f :: "nat \<Rightarrow> 'a" assume f: "\<forall>n. f n \<in> s" |
|
2950 have "\<exists>l\<in>s. \<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" |
|
2951 proof (cases "finite (range f)") |
|
2952 case True |
|
2953 hence "\<exists>l. infinite {n. f n = l}" |
|
2954 by (rule finite_range_imp_infinite_repeats) |
|
2955 then obtain l where "infinite {n. f n = l}" .. |
|
2956 hence "\<exists>r. subseq r \<and> (\<forall>n. r n \<in> {n. f n = l})" |
|
2957 by (rule infinite_enumerate) |
|
2958 then obtain r where "subseq r" and fr: "\<forall>n. f (r n) = l" by auto |
|
2959 hence "subseq r \<and> ((f \<circ> r) ---> l) sequentially" |
|
2960 unfolding o_def by (simp add: fr tendsto_const) |
|
2961 hence "\<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" |
|
2962 by - (rule exI) |
|
2963 from f have "\<forall>n. f (r n) \<in> s" by simp |
|
2964 hence "l \<in> s" by (simp add: fr) |
|
2965 thus "\<exists>l\<in>s. \<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" |
|
2966 by (rule rev_bexI) fact |
|
2967 next |
|
2968 case False |
|
2969 with f assms have "\<exists>x\<in>s. x islimpt (range f)" by auto |
|
2970 then obtain l where "l \<in> s" "l islimpt (range f)" .. |
|
2971 have "\<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" |
|
2972 using `l islimpt (range f)` |
|
2973 by (rule islimpt_range_imp_convergent_subsequence) |
|
2974 with `l \<in> s` show "\<exists>l\<in>s. \<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" .. |
|
2975 qed |
|
2976 } |
|
2977 thus ?thesis unfolding seq_compact_def by auto |
|
2978 qed |
2367 |
2979 |
2368 text {* |
2980 text {* |
2369 A metric space (or topological vector space) is said to have the |
2981 A metric space (or topological vector space) is said to have the |
2370 Heine-Borel property if every closed and bounded subset is compact. |
2982 Heine-Borel property if every closed and bounded subset is compact. |
2371 *} |
2983 *} |
2838 hence "x \<in> \<Union>(bb ` k)" using Union_iff[of x "bb ` k"] by auto |
3453 hence "x \<in> \<Union>(bb ` k)" using Union_iff[of x "bb ` k"] by auto |
2839 } |
3454 } |
2840 ultimately show "\<exists>f'\<subseteq>f. finite f' \<and> s \<subseteq> \<Union>f'" using bb k(2) by (rule_tac x="bb ` k" in exI) auto |
3455 ultimately show "\<exists>f'\<subseteq>f. finite f' \<and> s \<subseteq> \<Union>f'" using bb k(2) by (rule_tac x="bb ` k" in exI) auto |
2841 qed |
3456 qed |
2842 |
3457 |
2843 subsubsection {* Bolzano-Weierstrass property *} |
|
2844 |
|
2845 lemma heine_borel_imp_bolzano_weierstrass: |
|
2846 assumes "\<forall>f. (\<forall>t \<in> f. open t) \<and> s \<subseteq> (\<Union> f) --> (\<exists>f'. f' \<subseteq> f \<and> finite f' \<and> s \<subseteq> (\<Union> f'))" |
|
2847 "infinite t" "t \<subseteq> s" |
|
2848 shows "\<exists>x \<in> s. x islimpt t" |
|
2849 proof(rule ccontr) |
|
2850 assume "\<not> (\<exists>x \<in> s. x islimpt t)" |
|
2851 then obtain f where f:"\<forall>x\<in>s. x \<in> f x \<and> open (f x) \<and> (\<forall>y\<in>t. y \<in> f x \<longrightarrow> y = x)" unfolding islimpt_def |
|
2852 using bchoice[of s "\<lambda> x T. x \<in> T \<and> open T \<and> (\<forall>y\<in>t. y \<in> T \<longrightarrow> y = x)"] by auto |
|
2853 obtain g where g:"g\<subseteq>{t. \<exists>x. x \<in> s \<and> t = f x}" "finite g" "s \<subseteq> \<Union>g" |
|
2854 using assms(1)[THEN spec[where x="{t. \<exists>x. x\<in>s \<and> t = f x}"]] using f by auto |
|
2855 from g(1,3) have g':"\<forall>x\<in>g. \<exists>xa \<in> s. x = f xa" by auto |
|
2856 { fix x y assume "x\<in>t" "y\<in>t" "f x = f y" |
|
2857 hence "x \<in> f x" "y \<in> f x \<longrightarrow> y = x" using f[THEN bspec[where x=x]] and `t\<subseteq>s` by auto |
|
2858 hence "x = y" using `f x = f y` and f[THEN bspec[where x=y]] and `y\<in>t` and `t\<subseteq>s` by auto } |
|
2859 hence "inj_on f t" unfolding inj_on_def by simp |
|
2860 hence "infinite (f ` t)" using assms(2) using finite_imageD by auto |
|
2861 moreover |
|
2862 { fix x assume "x\<in>t" "f x \<notin> g" |
|
2863 from g(3) assms(3) `x\<in>t` obtain h where "h\<in>g" and "x\<in>h" by auto |
|
2864 then obtain y where "y\<in>s" "h = f y" using g'[THEN bspec[where x=h]] by auto |
|
2865 hence "y = x" using f[THEN bspec[where x=y]] and `x\<in>t` and `x\<in>h`[unfolded `h = f y`] by auto |
|
2866 hence False using `f x \<notin> g` `h\<in>g` unfolding `h = f y` by auto } |
|
2867 hence "f ` t \<subseteq> g" by auto |
|
2868 ultimately show False using g(2) using finite_subset by auto |
|
2869 qed |
|
2870 |
|
2871 subsubsection {* Complete the chain of compactness variants *} |
3458 subsubsection {* Complete the chain of compactness variants *} |
2872 |
|
2873 lemma islimpt_range_imp_convergent_subsequence: |
|
2874 fixes l :: "'a :: {t1_space, first_countable_topology}" |
|
2875 assumes l: "l islimpt (range f)" |
|
2876 shows "\<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" |
|
2877 proof - |
|
2878 from first_countable_topology_class.countable_basis_at_decseq[of l] guess A . note A = this |
|
2879 |
|
2880 def s \<equiv> "\<lambda>n i. SOME j. i < j \<and> f j \<in> A (Suc n)" |
|
2881 { fix n i |
|
2882 have "\<exists>a. i < a \<and> f a \<in> A (Suc n)" |
|
2883 by (rule l[THEN islimptE, of "A (Suc n) - (f ` {.. i} - {l})"]) |
|
2884 (auto simp: not_le[symmetric] finite_imp_closed A(1,2)) |
|
2885 then have "i < s n i" "f (s n i) \<in> A (Suc n)" |
|
2886 unfolding s_def by (auto intro: someI2_ex) } |
|
2887 note s = this |
|
2888 def r \<equiv> "nat_rec (s 0 0) s" |
|
2889 have "subseq r" |
|
2890 by (auto simp: r_def s subseq_Suc_iff) |
|
2891 moreover |
|
2892 have "(\<lambda>n. f (r n)) ----> l" |
|
2893 proof (rule topological_tendstoI) |
|
2894 fix S assume "open S" "l \<in> S" |
|
2895 with A(3) have "eventually (\<lambda>i. A i \<subseteq> S) sequentially" by auto |
|
2896 moreover |
|
2897 { fix i assume "Suc 0 \<le> i" then have "f (r i) \<in> A i" |
|
2898 by (cases i) (simp_all add: r_def s) } |
|
2899 then have "eventually (\<lambda>i. f (r i) \<in> A i) sequentially" by (auto simp: eventually_sequentially) |
|
2900 ultimately show "eventually (\<lambda>i. f (r i) \<in> S) sequentially" |
|
2901 by eventually_elim auto |
|
2902 qed |
|
2903 ultimately show "\<exists>r. subseq r \<and> (f \<circ> r) ----> l" |
|
2904 by (auto simp: convergent_def comp_def) |
|
2905 qed |
|
2906 |
|
2907 lemma finite_range_imp_infinite_repeats: |
|
2908 fixes f :: "nat \<Rightarrow> 'a" |
|
2909 assumes "finite (range f)" |
|
2910 shows "\<exists>k. infinite {n. f n = k}" |
|
2911 proof - |
|
2912 { fix A :: "'a set" assume "finite A" |
|
2913 hence "\<And>f. infinite {n. f n \<in> A} \<Longrightarrow> \<exists>k. infinite {n. f n = k}" |
|
2914 proof (induct) |
|
2915 case empty thus ?case by simp |
|
2916 next |
|
2917 case (insert x A) |
|
2918 show ?case |
|
2919 proof (cases "finite {n. f n = x}") |
|
2920 case True |
|
2921 with `infinite {n. f n \<in> insert x A}` |
|
2922 have "infinite {n. f n \<in> A}" by simp |
|
2923 thus "\<exists>k. infinite {n. f n = k}" by (rule insert) |
|
2924 next |
|
2925 case False thus "\<exists>k. infinite {n. f n = k}" .. |
|
2926 qed |
|
2927 qed |
|
2928 } note H = this |
|
2929 from assms show "\<exists>k. infinite {n. f n = k}" |
|
2930 by (rule H) simp |
|
2931 qed |
|
2932 |
|
2933 lemma bolzano_weierstrass_imp_compact: |
|
2934 fixes s :: "'a::metric_space set" |
|
2935 assumes "\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t)" |
|
2936 shows "compact s" |
|
2937 proof - |
|
2938 { fix f :: "nat \<Rightarrow> 'a" assume f: "\<forall>n. f n \<in> s" |
|
2939 have "\<exists>l\<in>s. \<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" |
|
2940 proof (cases "finite (range f)") |
|
2941 case True |
|
2942 hence "\<exists>l. infinite {n. f n = l}" |
|
2943 by (rule finite_range_imp_infinite_repeats) |
|
2944 then obtain l where "infinite {n. f n = l}" .. |
|
2945 hence "\<exists>r. subseq r \<and> (\<forall>n. r n \<in> {n. f n = l})" |
|
2946 by (rule infinite_enumerate) |
|
2947 then obtain r where "subseq r" and fr: "\<forall>n. f (r n) = l" by auto |
|
2948 hence "subseq r \<and> ((f \<circ> r) ---> l) sequentially" |
|
2949 unfolding o_def by (simp add: fr tendsto_const) |
|
2950 hence "\<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" |
|
2951 by - (rule exI) |
|
2952 from f have "\<forall>n. f (r n) \<in> s" by simp |
|
2953 hence "l \<in> s" by (simp add: fr) |
|
2954 thus "\<exists>l\<in>s. \<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" |
|
2955 by (rule rev_bexI) fact |
|
2956 next |
|
2957 case False |
|
2958 with f assms have "\<exists>x\<in>s. x islimpt (range f)" by auto |
|
2959 then obtain l where "l \<in> s" "l islimpt (range f)" .. |
|
2960 have "\<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" |
|
2961 using `l islimpt (range f)` |
|
2962 by (rule islimpt_range_imp_convergent_subsequence) |
|
2963 with `l \<in> s` show "\<exists>l\<in>s. \<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" .. |
|
2964 qed |
|
2965 } |
|
2966 thus ?thesis unfolding compact_def by auto |
|
2967 qed |
|
2968 |
3459 |
2969 primrec helper_2::"(real \<Rightarrow> 'a::metric_space) \<Rightarrow> nat \<Rightarrow> 'a" where |
3460 primrec helper_2::"(real \<Rightarrow> 'a::metric_space) \<Rightarrow> nat \<Rightarrow> 'a" where |
2970 "helper_2 beyond 0 = beyond 0" | |
3461 "helper_2 beyond 0 = beyond 0" | |
2971 "helper_2 beyond (Suc n) = beyond (dist undefined (helper_2 beyond n) + 1 )" |
3462 "helper_2 beyond (Suc n) = beyond (dist undefined (helper_2 beyond n) + 1 )" |
2972 |
3463 |
3028 then obtain z where "x z \<noteq> l" and z:"dist (x z) l < dist (x y) l" using l[unfolded islimpt_approachable, THEN spec[where x="dist (x y) l"]] |
3519 then obtain z where "x z \<noteq> l" and z:"dist (x z) l < dist (x y) l" using l[unfolded islimpt_approachable, THEN spec[where x="dist (x y) l"]] |
3029 unfolding dist_nz by auto |
3520 unfolding dist_nz by auto |
3030 show False using y and z and dist_triangle_half_l[of "x y" l 1 "x z"] and **[of y z] by auto |
3521 show False using y and z and dist_triangle_half_l[of "x y" l 1 "x z"] and **[of y z] by auto |
3031 qed |
3522 qed |
3032 |
3523 |
3033 lemma sequence_infinite_lemma: |
|
3034 fixes f :: "nat \<Rightarrow> 'a::t1_space" |
|
3035 assumes "\<forall>n. f n \<noteq> l" and "(f ---> l) sequentially" |
|
3036 shows "infinite (range f)" |
|
3037 proof |
|
3038 assume "finite (range f)" |
|
3039 hence "closed (range f)" by (rule finite_imp_closed) |
|
3040 hence "open (- range f)" by (rule open_Compl) |
|
3041 from assms(1) have "l \<in> - range f" by auto |
|
3042 from assms(2) have "eventually (\<lambda>n. f n \<in> - range f) sequentially" |
|
3043 using `open (- range f)` `l \<in> - range f` by (rule topological_tendstoD) |
|
3044 thus False unfolding eventually_sequentially by auto |
|
3045 qed |
|
3046 |
|
3047 lemma closure_insert: |
|
3048 fixes x :: "'a::t1_space" |
|
3049 shows "closure (insert x s) = insert x (closure s)" |
|
3050 apply (rule closure_unique) |
|
3051 apply (rule insert_mono [OF closure_subset]) |
|
3052 apply (rule closed_insert [OF closed_closure]) |
|
3053 apply (simp add: closure_minimal) |
|
3054 done |
|
3055 |
|
3056 lemma islimpt_insert: |
|
3057 fixes x :: "'a::t1_space" |
|
3058 shows "x islimpt (insert a s) \<longleftrightarrow> x islimpt s" |
|
3059 proof |
|
3060 assume *: "x islimpt (insert a s)" |
|
3061 show "x islimpt s" |
|
3062 proof (rule islimptI) |
|
3063 fix t assume t: "x \<in> t" "open t" |
|
3064 show "\<exists>y\<in>s. y \<in> t \<and> y \<noteq> x" |
|
3065 proof (cases "x = a") |
|
3066 case True |
|
3067 obtain y where "y \<in> insert a s" "y \<in> t" "y \<noteq> x" |
|
3068 using * t by (rule islimptE) |
|
3069 with `x = a` show ?thesis by auto |
|
3070 next |
|
3071 case False |
|
3072 with t have t': "x \<in> t - {a}" "open (t - {a})" |
|
3073 by (simp_all add: open_Diff) |
|
3074 obtain y where "y \<in> insert a s" "y \<in> t - {a}" "y \<noteq> x" |
|
3075 using * t' by (rule islimptE) |
|
3076 thus ?thesis by auto |
|
3077 qed |
|
3078 qed |
|
3079 next |
|
3080 assume "x islimpt s" thus "x islimpt (insert a s)" |
|
3081 by (rule islimpt_subset) auto |
|
3082 qed |
|
3083 |
|
3084 lemma islimpt_union_finite: |
|
3085 fixes x :: "'a::t1_space" |
|
3086 shows "finite s \<Longrightarrow> x islimpt (s \<union> t) \<longleftrightarrow> x islimpt t" |
|
3087 by (induct set: finite, simp_all add: islimpt_insert) |
|
3088 |
|
3089 lemma sequence_unique_limpt: |
|
3090 fixes f :: "nat \<Rightarrow> 'a::t2_space" |
|
3091 assumes "(f ---> l) sequentially" and "l' islimpt (range f)" |
|
3092 shows "l' = l" |
|
3093 proof (rule ccontr) |
|
3094 assume "l' \<noteq> l" |
|
3095 obtain s t where "open s" "open t" "l' \<in> s" "l \<in> t" "s \<inter> t = {}" |
|
3096 using hausdorff [OF `l' \<noteq> l`] by auto |
|
3097 have "eventually (\<lambda>n. f n \<in> t) sequentially" |
|
3098 using assms(1) `open t` `l \<in> t` by (rule topological_tendstoD) |
|
3099 then obtain N where "\<forall>n\<ge>N. f n \<in> t" |
|
3100 unfolding eventually_sequentially by auto |
|
3101 |
|
3102 have "UNIV = {..<N} \<union> {N..}" by auto |
|
3103 hence "l' islimpt (f ` ({..<N} \<union> {N..}))" using assms(2) by simp |
|
3104 hence "l' islimpt (f ` {..<N} \<union> f ` {N..})" by (simp add: image_Un) |
|
3105 hence "l' islimpt (f ` {N..})" by (simp add: islimpt_union_finite) |
|
3106 then obtain y where "y \<in> f ` {N..}" "y \<in> s" "y \<noteq> l'" |
|
3107 using `l' \<in> s` `open s` by (rule islimptE) |
|
3108 then obtain n where "N \<le> n" "f n \<in> s" "f n \<noteq> l'" by auto |
|
3109 with `\<forall>n\<ge>N. f n \<in> t` have "f n \<in> s \<inter> t" by simp |
|
3110 with `s \<inter> t = {}` show False by simp |
|
3111 qed |
|
3112 |
|
3113 lemma bolzano_weierstrass_imp_closed: |
|
3114 fixes s :: "'a::metric_space set" (* TODO: can this be generalized? *) |
|
3115 assumes "\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t)" |
|
3116 shows "closed s" |
|
3117 proof- |
|
3118 { fix x l assume as: "\<forall>n::nat. x n \<in> s" "(x ---> l) sequentially" |
|
3119 hence "l \<in> s" |
|
3120 proof(cases "\<forall>n. x n \<noteq> l") |
|
3121 case False thus "l\<in>s" using as(1) by auto |
|
3122 next |
|
3123 case True note cas = this |
|
3124 with as(2) have "infinite (range x)" using sequence_infinite_lemma[of x l] by auto |
|
3125 then obtain l' where "l'\<in>s" "l' islimpt (range x)" using assms[THEN spec[where x="range x"]] as(1) by auto |
|
3126 thus "l\<in>s" using sequence_unique_limpt[of x l l'] using as cas by auto |
|
3127 qed } |
|
3128 thus ?thesis unfolding closed_sequential_limits by fast |
|
3129 qed |
|
3130 |
|
3131 text {* Hence express everything as an equivalence. *} |
3524 text {* Hence express everything as an equivalence. *} |
3132 |
3525 |
3133 lemma compact_eq_heine_borel: |
3526 lemma compact_eq_seq_compact_metric: |
3134 fixes s :: "'a::metric_space set" |
3527 "compact (s :: 'a::metric_space set) \<longleftrightarrow> seq_compact s" |
3135 shows "compact s \<longleftrightarrow> |
3528 using compact_imp_seq_compact seq_compact_imp_heine_borel by blast |
3136 (\<forall>f. (\<forall>t \<in> f. open t) \<and> s \<subseteq> (\<Union> f) |
3529 |
3137 --> (\<exists>f'. f' \<subseteq> f \<and> finite f' \<and> s \<subseteq> (\<Union> f')))" (is "?lhs = ?rhs") |
3530 lemma compact_def: |
3138 proof |
3531 "compact (S :: 'a::metric_space set) \<longleftrightarrow> |
3139 assume ?lhs thus ?rhs by (rule compact_imp_heine_borel) |
3532 (\<forall>f. (\<forall>n. f n \<in> S) \<longrightarrow> |
3140 next |
3533 (\<exists>l\<in>S. \<exists>r. subseq r \<and> ((f o r) ---> l) sequentially)) " |
3141 assume ?rhs |
3534 unfolding compact_eq_seq_compact_metric seq_compact_def by auto |
3142 hence "\<forall>t. infinite t \<and> t \<subseteq> s \<longrightarrow> (\<exists>x\<in>s. x islimpt t)" |
|
3143 by (blast intro: heine_borel_imp_bolzano_weierstrass[of s]) |
|
3144 thus ?lhs by (rule bolzano_weierstrass_imp_compact) |
|
3145 qed |
|
3146 |
3535 |
3147 lemma compact_eq_bolzano_weierstrass: |
3536 lemma compact_eq_bolzano_weierstrass: |
3148 fixes s :: "'a::metric_space set" |
3537 fixes s :: "'a::metric_space set" |
3149 shows "compact s \<longleftrightarrow> (\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t))" (is "?lhs = ?rhs") |
3538 shows "compact s \<longleftrightarrow> (\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t))" (is "?lhs = ?rhs") |
3150 proof |
3539 proof |
3151 assume ?lhs thus ?rhs unfolding compact_eq_heine_borel using heine_borel_imp_bolzano_weierstrass[of s] by auto |
3540 assume ?lhs thus ?rhs using heine_borel_imp_bolzano_weierstrass[of s] by auto |
3152 next |
3541 next |
3153 assume ?rhs thus ?lhs by (rule bolzano_weierstrass_imp_compact) |
3542 assume ?rhs thus ?lhs |
|
3543 unfolding compact_eq_seq_compact_metric by (rule bolzano_weierstrass_imp_seq_compact) |
3154 qed |
3544 qed |
3155 |
3545 |
3156 lemma nat_approx_posE: |
3546 lemma nat_approx_posE: |
3157 fixes e::real |
3547 fixes e::real |
3158 assumes "0 < e" |
3548 assumes "0 < e" |
3303 |
3693 |
3304 lemma compact_eq_bounded_closed: |
3694 lemma compact_eq_bounded_closed: |
3305 fixes s :: "'a::heine_borel set" |
3695 fixes s :: "'a::heine_borel set" |
3306 shows "compact s \<longleftrightarrow> bounded s \<and> closed s" (is "?lhs = ?rhs") |
3696 shows "compact s \<longleftrightarrow> bounded s \<and> closed s" (is "?lhs = ?rhs") |
3307 proof |
3697 proof |
3308 assume ?lhs thus ?rhs unfolding compact_eq_bolzano_weierstrass using bolzano_weierstrass_imp_bounded bolzano_weierstrass_imp_closed by auto |
3698 assume ?lhs thus ?rhs |
|
3699 unfolding compact_eq_bolzano_weierstrass using bolzano_weierstrass_imp_bounded bolzano_weierstrass_imp_closed by auto |
3309 next |
3700 next |
3310 assume ?rhs thus ?lhs using bounded_closed_imp_compact by auto |
3701 assume ?rhs thus ?lhs |
|
3702 using bounded_closed_imp_seq_compact[of s] unfolding compact_eq_seq_compact_metric by auto |
3311 qed |
3703 qed |
3312 |
3704 |
3313 lemma compact_imp_bounded: |
3705 lemma compact_imp_bounded: |
3314 fixes s :: "'a::metric_space set" |
3706 fixes s :: "'a::metric_space set" |
3315 shows "compact s ==> bounded s" |
3707 shows "compact s \<Longrightarrow> bounded s" |
3316 proof - |
3708 proof - |
3317 assume "compact s" |
3709 assume "compact s" |
3318 hence "\<forall>f. (\<forall>t\<in>f. open t) \<and> s \<subseteq> \<Union>f \<longrightarrow> (\<exists>f'\<subseteq>f. finite f' \<and> s \<subseteq> \<Union>f')" |
|
3319 by (rule compact_imp_heine_borel) |
|
3320 hence "\<forall>t. infinite t \<and> t \<subseteq> s \<longrightarrow> (\<exists>x \<in> s. x islimpt t)" |
3710 hence "\<forall>t. infinite t \<and> t \<subseteq> s \<longrightarrow> (\<exists>x \<in> s. x islimpt t)" |
3321 using heine_borel_imp_bolzano_weierstrass[of s] by auto |
3711 using heine_borel_imp_bolzano_weierstrass[of s] by auto |
3322 thus "bounded s" |
3712 thus "bounded s" |
3323 by (rule bolzano_weierstrass_imp_bounded) |
3713 by (rule bolzano_weierstrass_imp_bounded) |
3324 qed |
3714 qed |
3325 |
|
3326 lemma compact_imp_closed: |
|
3327 fixes s :: "'a::metric_space set" |
|
3328 shows "compact s ==> closed s" |
|
3329 proof - |
|
3330 assume "compact s" |
|
3331 hence "\<forall>f. (\<forall>t\<in>f. open t) \<and> s \<subseteq> \<Union>f \<longrightarrow> (\<exists>f'\<subseteq>f. finite f' \<and> s \<subseteq> \<Union>f')" |
|
3332 by (rule compact_imp_heine_borel) |
|
3333 hence "\<forall>t. infinite t \<and> t \<subseteq> s \<longrightarrow> (\<exists>x \<in> s. x islimpt t)" |
|
3334 using heine_borel_imp_bolzano_weierstrass[of s] by auto |
|
3335 thus "closed s" |
|
3336 by (rule bolzano_weierstrass_imp_closed) |
|
3337 qed |
|
3338 |
|
3339 text{* In particular, some common special cases. *} |
|
3340 |
|
3341 lemma compact_empty[simp]: |
|
3342 "compact {}" |
|
3343 unfolding compact_def |
|
3344 by simp |
|
3345 |
|
3346 lemma compact_union [intro]: |
|
3347 assumes "compact s" and "compact t" |
|
3348 shows "compact (s \<union> t)" |
|
3349 proof (rule compactI) |
|
3350 fix f :: "nat \<Rightarrow> 'a" |
|
3351 assume "\<forall>n. f n \<in> s \<union> t" |
|
3352 hence "infinite {n. f n \<in> s \<union> t}" by simp |
|
3353 hence "infinite {n. f n \<in> s} \<or> infinite {n. f n \<in> t}" by simp |
|
3354 thus "\<exists>l\<in>s \<union> t. \<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" |
|
3355 proof |
|
3356 assume "infinite {n. f n \<in> s}" |
|
3357 from infinite_enumerate [OF this] |
|
3358 obtain q where "subseq q" "\<forall>n. (f \<circ> q) n \<in> s" by auto |
|
3359 obtain r l where "l \<in> s" "subseq r" "((f \<circ> q \<circ> r) ---> l) sequentially" |
|
3360 using `compact s` `\<forall>n. (f \<circ> q) n \<in> s` by (rule compactE) |
|
3361 hence "l \<in> s \<union> t" "subseq (q \<circ> r)" "((f \<circ> (q \<circ> r)) ---> l) sequentially" |
|
3362 using `subseq q` by (simp_all add: subseq_o o_assoc) |
|
3363 thus ?thesis by auto |
|
3364 next |
|
3365 assume "infinite {n. f n \<in> t}" |
|
3366 from infinite_enumerate [OF this] |
|
3367 obtain q where "subseq q" "\<forall>n. (f \<circ> q) n \<in> t" by auto |
|
3368 obtain r l where "l \<in> t" "subseq r" "((f \<circ> q \<circ> r) ---> l) sequentially" |
|
3369 using `compact t` `\<forall>n. (f \<circ> q) n \<in> t` by (rule compactE) |
|
3370 hence "l \<in> s \<union> t" "subseq (q \<circ> r)" "((f \<circ> (q \<circ> r)) ---> l) sequentially" |
|
3371 using `subseq q` by (simp_all add: subseq_o o_assoc) |
|
3372 thus ?thesis by auto |
|
3373 qed |
|
3374 qed |
|
3375 |
|
3376 lemma compact_Union [intro]: "finite S \<Longrightarrow> (\<And>T. T \<in> S \<Longrightarrow> compact T) \<Longrightarrow> compact (\<Union>S)" |
|
3377 by (induct set: finite) auto |
|
3378 |
|
3379 lemma compact_UN [intro]: |
|
3380 "finite A \<Longrightarrow> (\<And>x. x \<in> A \<Longrightarrow> compact (B x)) \<Longrightarrow> compact (\<Union>x\<in>A. B x)" |
|
3381 unfolding SUP_def by (rule compact_Union) auto |
|
3382 |
|
3383 lemma compact_inter_closed [intro]: |
|
3384 assumes "compact s" and "closed t" |
|
3385 shows "compact (s \<inter> t)" |
|
3386 proof (rule compactI) |
|
3387 fix f :: "nat \<Rightarrow> 'a" |
|
3388 assume "\<forall>n. f n \<in> s \<inter> t" |
|
3389 hence "\<forall>n. f n \<in> s" and "\<forall>n. f n \<in> t" by simp_all |
|
3390 obtain l r where "l \<in> s" "subseq r" "((f \<circ> r) ---> l) sequentially" |
|
3391 using `compact s` `\<forall>n. f n \<in> s` by (rule compactE) |
|
3392 moreover |
|
3393 from `closed t` `\<forall>n. f n \<in> t` `((f \<circ> r) ---> l) sequentially` have "l \<in> t" |
|
3394 unfolding closed_sequential_limits o_def by fast |
|
3395 ultimately show "\<exists>l\<in>s \<inter> t. \<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" |
|
3396 by auto |
|
3397 qed |
|
3398 |
|
3399 lemma closed_inter_compact [intro]: |
|
3400 assumes "closed s" and "compact t" |
|
3401 shows "compact (s \<inter> t)" |
|
3402 using compact_inter_closed [of t s] assms |
|
3403 by (simp add: Int_commute) |
|
3404 |
|
3405 lemma compact_inter [intro]: |
|
3406 assumes "compact s" and "compact t" |
|
3407 shows "compact (s \<inter> t)" |
|
3408 using assms by (intro compact_inter_closed compact_imp_closed) |
|
3409 |
|
3410 lemma compact_sing [simp]: "compact {a}" |
|
3411 unfolding compact_def o_def subseq_def |
|
3412 by (auto simp add: tendsto_const) |
|
3413 |
|
3414 lemma compact_insert [simp]: |
|
3415 assumes "compact s" shows "compact (insert x s)" |
|
3416 proof - |
|
3417 have "compact ({x} \<union> s)" |
|
3418 using compact_sing assms by (rule compact_union) |
|
3419 thus ?thesis by simp |
|
3420 qed |
|
3421 |
|
3422 lemma finite_imp_compact: |
|
3423 shows "finite s \<Longrightarrow> compact s" |
|
3424 by (induct set: finite) simp_all |
|
3425 |
3715 |
3426 lemma compact_cball[simp]: |
3716 lemma compact_cball[simp]: |
3427 fixes x :: "'a::heine_borel" |
3717 fixes x :: "'a::heine_borel" |
3428 shows "compact(cball x e)" |
3718 shows "compact(cball x e)" |
3429 using compact_eq_bounded_closed bounded_cball closed_cball |
3719 using compact_eq_bounded_closed bounded_cball closed_cball |