src/HOL/Analysis/Connected.thy
author wenzelm
Mon, 11 Sep 2023 19:30:48 +0200
changeset 78659 b5f3d1051b13
parent 78475 a5f6d2fc1b1f
child 82538 4b132ea7d575
permissions -rw-r--r--
tuned;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
66835
ecc99a5a1ab8 fixed markup
paulson <lp15@cam.ac.uk>
parents: 66827
diff changeset
     1
(*  Author:     L C Paulson, University of Cambridge
ecc99a5a1ab8 fixed markup
paulson <lp15@cam.ac.uk>
parents: 66827
diff changeset
     2
    Material split off from Topology_Euclidean_Space
ecc99a5a1ab8 fixed markup
paulson <lp15@cam.ac.uk>
parents: 66827
diff changeset
     3
*)
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     4
69617
63ee37c519a3 reduced dependencies of Connected.thy
immler
parents: 69616
diff changeset
     5
section \<open>Connected Components\<close>
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     6
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     7
theory Connected
69544
5aa5a8d6e5b5 split off theorems involving classes below metric_space and real_normed_vector
immler
parents: 69529
diff changeset
     8
  imports
69617
63ee37c519a3 reduced dependencies of Connected.thy
immler
parents: 69616
diff changeset
     9
    Abstract_Topology_2
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    10
begin
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    11
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69922
diff changeset
    12
subsection\<^marker>\<open>tag unimportant\<close> \<open>Connectedness\<close>
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    13
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    14
lemma connected_local:
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    15
 "connected S \<longleftrightarrow>
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    16
  \<not> (\<exists>e1 e2.
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
    17
      openin (top_of_set S) e1 \<and>
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
    18
      openin (top_of_set S) e2 \<and>
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    19
      S \<subseteq> e1 \<union> e2 \<and>
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    20
      e1 \<inter> e2 = {} \<and>
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    21
      e1 \<noteq> {} \<and>
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    22
      e2 \<noteq> {})"
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
    23
  using connected_openin by blast
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    24
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    25
lemma exists_diff:
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    26
  fixes P :: "'a set \<Rightarrow> bool"
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    27
  shows "(\<exists>S. P (- S)) \<longleftrightarrow> (\<exists>S. P S)"
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
    28
  by (metis boolean_algebra_class.boolean_algebra.double_compl)
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    29
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    30
lemma connected_clopen: "connected S \<longleftrightarrow>
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
    31
  (\<forall>T. openin (top_of_set S) T \<and>
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
    32
     closedin (top_of_set S) T \<longrightarrow> T = {} \<or> T = S)" (is "?lhs \<longleftrightarrow> ?rhs")
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    33
proof -
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    34
  have "\<not> connected S \<longleftrightarrow>
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    35
    (\<exists>e1 e2. open e1 \<and> open (- e2) \<and> S \<subseteq> e1 \<union> (- e2) \<and> e1 \<inter> (- e2) \<inter> S = {} \<and> e1 \<inter> S \<noteq> {} \<and> (- e2) \<inter> S \<noteq> {})"
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    36
    unfolding connected_def openin_open closedin_closed
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    37
    by (metis double_complement)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    38
  then have th0: "connected S \<longleftrightarrow>
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    39
    \<not> (\<exists>e2 e1. closed e2 \<and> open e1 \<and> S \<subseteq> e1 \<union> (- e2) \<and> e1 \<inter> (- e2) \<inter> S = {} \<and> e1 \<inter> S \<noteq> {} \<and> (- e2) \<inter> S \<noteq> {})"
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    40
    (is " _ \<longleftrightarrow> \<not> (\<exists>e2 e1. ?P e2 e1)")
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    41
    by (simp add: closed_def) metis
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    42
  have th1: "?rhs \<longleftrightarrow> \<not> (\<exists>t' t. closed t'\<and>t = S\<inter>t' \<and> t\<noteq>{} \<and> t\<noteq>S \<and> (\<exists>t'. open t' \<and> t = S \<inter> t'))"
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    43
    (is "_ \<longleftrightarrow> \<not> (\<exists>t' t. ?Q t' t)")
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    44
    unfolding connected_def openin_open closedin_closed by auto
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    45
  have "(\<exists>e1. ?P e2 e1) \<longleftrightarrow> (\<exists>t. ?Q e2 t)" for e2
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    46
  proof -
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    47
    have "?P e2 e1 \<longleftrightarrow> (\<exists>t. closed e2 \<and> t = S\<inter>e2 \<and> open e1 \<and> t = S\<inter>e1 \<and> t\<noteq>{} \<and> t \<noteq> S)" for e1
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    48
      by auto
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    49
    then show ?thesis
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    50
      by metis
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    51
  qed
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    52
  then have "\<forall>e2. (\<exists>e1. ?P e2 e1) \<longleftrightarrow> (\<exists>t. ?Q e2 t)"
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    53
    by blast
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    54
  then show ?thesis
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    55
    by (simp add: th0 th1)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    56
qed
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    57
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    58
subsection \<open>Connected components, considered as a connectedness relation or a set\<close>
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    59
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
    60
definition\<^marker>\<open>tag important\<close> "connected_component S x y \<equiv> \<exists>T. connected T \<and> T \<subseteq> S \<and> x \<in> T \<and> y \<in> T"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    61
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
    62
abbreviation "connected_component_set S x \<equiv> Collect (connected_component S x)"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    63
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    64
lemma connected_componentI:
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
    65
  "connected T \<Longrightarrow> T \<subseteq> S \<Longrightarrow> x \<in> T \<Longrightarrow> y \<in> T \<Longrightarrow> connected_component S x y"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    66
  by (auto simp: connected_component_def)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    67
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
    68
lemma connected_component_in: "connected_component S x y \<Longrightarrow> x \<in> S \<and> y \<in> S"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    69
  by (auto simp: connected_component_def)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    70
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
    71
lemma connected_component_refl: "x \<in> S \<Longrightarrow> connected_component S x x"
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
    72
  using connected_component_def connected_sing by blast
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
    73
 
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
    74
lemma connected_component_refl_eq [simp]: "connected_component S x x \<longleftrightarrow> x \<in> S"
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
    75
  using connected_component_in connected_component_refl by blast
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    76
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
    77
lemma connected_component_sym: "connected_component S x y \<Longrightarrow> connected_component S y x"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    78
  by (auto simp: connected_component_def)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    79
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    80
lemma connected_component_trans:
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
    81
  "connected_component S x y \<Longrightarrow> connected_component S y z \<Longrightarrow> connected_component S x z"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    82
  unfolding connected_component_def
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    83
  by (metis Int_iff Un_iff Un_subset_iff equals0D connected_Un)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    84
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    85
lemma connected_component_of_subset:
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
    86
  "connected_component S x y \<Longrightarrow> S \<subseteq> T \<Longrightarrow> connected_component T x y"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    87
  by (auto simp: connected_component_def)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    88
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
    89
lemma connected_component_Union: "connected_component_set S x = \<Union>{T. connected T \<and> x \<in> T \<and> T \<subseteq> S}"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    90
  by (auto simp: connected_component_def)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    91
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
    92
lemma connected_connected_component [iff]: "connected (connected_component_set S x)"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    93
  by (auto simp: connected_component_Union intro: connected_Union)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    94
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    95
lemma connected_iff_eq_connected_component_set:
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
    96
  "connected S \<longleftrightarrow> (\<forall>x \<in> S. connected_component_set S x = S)"
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
    97
  by (metis connected_component_def connected_component_in connected_connected_component mem_Collect_eq subsetI subset_antisym)
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    98
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
    99
lemma connected_component_subset: "connected_component_set S x \<subseteq> S"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   100
  using connected_component_in by blast
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   101
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   102
lemma connected_component_eq_self: "connected S \<Longrightarrow> x \<in> S \<Longrightarrow> connected_component_set S x = S"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   103
  by (simp add: connected_iff_eq_connected_component_set)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   104
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   105
lemma connected_iff_connected_component:
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   106
  "connected S \<longleftrightarrow> (\<forall>x \<in> S. \<forall>y \<in> S. connected_component S x y)"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   107
  using connected_component_in by (auto simp: connected_iff_eq_connected_component_set)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   108
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   109
lemma connected_component_maximal:
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   110
  "x \<in> T \<Longrightarrow> connected T \<Longrightarrow> T \<subseteq> S \<Longrightarrow> T \<subseteq> (connected_component_set S x)"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   111
  using connected_component_eq_self connected_component_of_subset by blast
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   112
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   113
lemma connected_component_mono:
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   114
  "S \<subseteq> T \<Longrightarrow> connected_component_set S x \<subseteq> connected_component_set T x"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   115
  by (simp add: Collect_mono connected_component_of_subset)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   116
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   117
lemma connected_component_eq_empty [simp]: "connected_component_set S x = {} \<longleftrightarrow> x \<notin> S"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   118
  using connected_component_refl by (fastforce simp: connected_component_in)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   119
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   120
lemma connected_component_set_empty [simp]: "connected_component_set {} x = {}"
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   121
  using connected_component_eq_empty by blast
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   122
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   123
lemma connected_component_eq:
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   124
  "y \<in> connected_component_set S x \<Longrightarrow> (connected_component_set S y = connected_component_set S x)"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   125
  by (metis (no_types, lifting)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   126
      Collect_cong connected_component_sym connected_component_trans mem_Collect_eq)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   127
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   128
lemma closed_connected_component:
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   129
  assumes S: "closed S"
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   130
  shows "closed (connected_component_set S x)"
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   131
proof (cases "x \<in> S")
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   132
  case False
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   133
  then show ?thesis
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   134
    by (metis connected_component_eq_empty closed_empty)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   135
next
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   136
  case True
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   137
  show ?thesis
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   138
    unfolding closure_eq [symmetric]
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   139
  proof
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   140
    show "closure (connected_component_set S x) \<subseteq> connected_component_set S x"
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   141
    proof (rule connected_component_maximal)
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   142
      show "x \<in> closure (connected_component_set S x)"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   143
        by (simp add: closure_def True)
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   144
      show "connected (closure (connected_component_set S x))"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   145
        by (simp add: connected_imp_connected_closure)
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   146
      show "closure (connected_component_set S x) \<subseteq> S"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   147
        by (simp add: S closure_minimal connected_component_subset)
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   148
    qed  
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   149
  qed (simp add: closure_subset)
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   150
qed
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   151
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   152
lemma connected_component_disjoint:
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   153
  "connected_component_set S a \<inter> connected_component_set S b = {} \<longleftrightarrow>
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   154
    a \<notin> connected_component_set S b"
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   155
  by (smt (verit) connected_component_eq connected_component_eq_empty connected_component_refl_eq
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   156
      disjoint_iff_not_equal mem_Collect_eq)
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   157
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   158
lemma connected_component_nonoverlap:
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   159
  "connected_component_set S a \<inter> connected_component_set S b = {} \<longleftrightarrow>
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   160
    a \<notin> S \<or> b \<notin> S \<or> connected_component_set S a \<noteq> connected_component_set S b"
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   161
  by (metis connected_component_disjoint connected_component_eq connected_component_eq_empty inf.idem)
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   162
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   163
lemma connected_component_overlap:
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   164
  "connected_component_set S a \<inter> connected_component_set S b \<noteq> {} \<longleftrightarrow>
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   165
    a \<in> S \<and> b \<in> S \<and> connected_component_set S a = connected_component_set S b"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   166
  by (auto simp: connected_component_nonoverlap)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   167
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   168
lemma connected_component_sym_eq: "connected_component S x y \<longleftrightarrow> connected_component S y x"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   169
  using connected_component_sym by blast
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   170
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   171
lemma connected_component_eq_eq:
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   172
  "connected_component_set S x = connected_component_set S y \<longleftrightarrow>
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   173
    x \<notin> S \<and> y \<notin> S \<or> x \<in> S \<and> y \<in> S \<and> connected_component S x y"
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   174
  by (metis connected_component_eq connected_component_eq_empty connected_component_refl mem_Collect_eq)
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   175
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   176
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   177
lemma connected_iff_connected_component_eq:
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   178
  "connected S \<longleftrightarrow> (\<forall>x \<in> S. \<forall>y \<in> S. connected_component_set S x = connected_component_set S y)"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   179
  by (simp add: connected_component_eq_eq connected_iff_connected_component)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   180
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   181
lemma connected_component_idemp:
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   182
  "connected_component_set (connected_component_set S x) x = connected_component_set S x"
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   183
  by (metis Int_absorb connected_component_disjoint connected_component_eq_empty connected_component_eq_self connected_connected_component)
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   184
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   185
lemma connected_component_unique:
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   186
  "\<lbrakk>x \<in> c; c \<subseteq> S; connected c;
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   187
    \<And>c'. \<lbrakk>x \<in> c'; c' \<subseteq> S; connected c'\<rbrakk> \<Longrightarrow> c' \<subseteq> c\<rbrakk>
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   188
        \<Longrightarrow> connected_component_set S x = c"
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   189
  by (meson connected_component_maximal connected_component_subset connected_connected_component subsetD subset_antisym)
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   190
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   191
lemma joinable_connected_component_eq:
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   192
  "\<lbrakk>connected T; T \<subseteq> S;
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   193
    connected_component_set S x \<inter> T \<noteq> {};
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   194
    connected_component_set S y \<inter> T \<noteq> {}\<rbrakk>
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   195
    \<Longrightarrow> connected_component_set S x = connected_component_set S y"
77223
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   196
  by (metis (full_types) subsetD connected_component_eq connected_component_maximal disjoint_iff_not_equal)
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   197
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   198
lemma Union_connected_component: "\<Union>(connected_component_set S ` S) = S"
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   199
proof
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   200
  show "\<Union>(connected_component_set S ` S) \<subseteq> S"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   201
    by (simp add: SUP_least connected_component_subset)
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   202
qed (use connected_component_refl_eq in force)
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   203
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   204
lemma complement_connected_component_unions:
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   205
    "S - connected_component_set S x =
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   206
     \<Union>(connected_component_set S ` S - {connected_component_set S x})"
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   207
    (is "?lhs = ?rhs")
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   208
proof
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   209
  show "?lhs \<subseteq> ?rhs"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   210
    by (metis Diff_subset Diff_subset_conv Sup_insert Union_connected_component insert_Diff_single)
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   211
  show "?rhs \<subseteq> ?lhs"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   212
    by clarsimp (metis connected_component_eq_eq connected_component_in)
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   213
qed
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   214
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   215
lemma connected_component_intermediate_subset:
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   216
        "\<lbrakk>connected_component_set U a \<subseteq> T; T \<subseteq> U\<rbrakk>
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   217
        \<Longrightarrow> connected_component_set T a = connected_component_set U a"
77223
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   218
  by (metis connected_component_idemp connected_component_mono subset_antisym)
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   219
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   220
lemma connected_component_homeomorphismI:
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   221
  assumes "homeomorphism A B f g" "connected_component A x y"
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   222
  shows   "connected_component B (f x) (f y)"
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   223
proof -
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   224
  from assms obtain T where T: "connected T" "T \<subseteq> A" "x \<in> T" "y \<in> T"
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   225
    unfolding connected_component_def by blast
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   226
  have "connected (f ` T)" "f ` T \<subseteq> B" "f x \<in> f ` T" "f y \<in> f ` T"
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   227
    using assms T continuous_on_subset[of A f T]
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   228
    by (auto intro!: connected_continuous_image simp: homeomorphism_def)
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   229
  thus ?thesis
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   230
    unfolding connected_component_def by blast
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   231
qed
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   232
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   233
lemma connected_component_homeomorphism_iff:
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   234
  assumes "homeomorphism A B f g"
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   235
  shows   "connected_component A x y \<longleftrightarrow> x \<in> A \<and> y \<in> A \<and> connected_component B (f x) (f y)"
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   236
  by (metis assms connected_component_homeomorphismI connected_component_in homeomorphism_apply1 homeomorphism_sym)
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   237
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   238
lemma connected_component_set_homeomorphism:
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   239
  assumes "homeomorphism A B f g" "x \<in> A"
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   240
  shows   "connected_component_set B (f x) = f ` connected_component_set A x" (is "?lhs = ?rhs")
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   241
proof -
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   242
  have "y \<in> ?lhs \<longleftrightarrow> y \<in> ?rhs" for y
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   243
    by (smt (verit, best) assms connected_component_homeomorphism_iff homeomorphism_def image_iff mem_Collect_eq)
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   244
  thus ?thesis
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   245
    by blast
607e1e345e8f Lots of new material chiefly about complex analysis
paulson <lp15@cam.ac.uk>
parents: 73932
diff changeset
   246
qed
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   247
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   248
subsection \<open>The set of connected components of a set\<close>
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   249
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69922
diff changeset
   250
definition\<^marker>\<open>tag important\<close> components:: "'a::topological_space set \<Rightarrow> 'a set set"
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   251
  where "components S \<equiv> connected_component_set S ` S"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   252
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   253
lemma components_iff: "S \<in> components U \<longleftrightarrow> (\<exists>x. x \<in> U \<and> S = connected_component_set U x)"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   254
  by (auto simp: components_def)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   255
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   256
lemma componentsI: "x \<in> U \<Longrightarrow> connected_component_set U x \<in> components U"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   257
  by (auto simp: components_def)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   258
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   259
lemma componentsE:
72228
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   260
  assumes "S \<in> components U"
aa7cb84983e9 minor tidying, also s->S and t->T
paulson <lp15@cam.ac.uk>
parents: 71172
diff changeset
   261
  obtains x where "x \<in> U" "S = connected_component_set U x"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   262
  using assms by (auto simp: components_def)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   263
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   264
lemma Union_components [simp]: "\<Union>(components U) = U"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   265
  by (simp add: Union_connected_component components_def)
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   266
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   267
lemma pairwise_disjoint_components: "pairwise (\<lambda>X Y. X \<inter> Y = {}) (components U)"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   268
  unfolding pairwise_def
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   269
  by (metis (full_types) components_iff connected_component_nonoverlap)
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   270
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   271
lemma in_components_nonempty: "C \<in> components S \<Longrightarrow> C \<noteq> {}"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   272
    by (metis components_iff connected_component_eq_empty)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   273
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   274
lemma in_components_subset: "C \<in> components S \<Longrightarrow> C \<subseteq> S"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   275
  using Union_components by blast
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   276
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   277
lemma in_components_connected: "C \<in> components S \<Longrightarrow> connected C"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   278
  by (metis components_iff connected_connected_component)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   279
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   280
lemma in_components_maximal:
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   281
  "C \<in> components S \<longleftrightarrow>
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   282
    C \<noteq> {} \<and> C \<subseteq> S \<and> connected C \<and> (\<forall>d. d \<noteq> {} \<and> C \<subseteq> d \<and> d \<subseteq> S \<and> connected d \<longrightarrow> d = C)"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   283
(is "?lhs \<longleftrightarrow> ?rhs")
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   284
proof
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   285
  assume L: ?lhs
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   286
  then have "C \<subseteq> S" "connected C"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   287
    by (simp_all add: in_components_subset in_components_connected)
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   288
  then show ?rhs
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   289
    by (metis (full_types) L components_iff connected_component_maximal connected_component_refl empty_iff mem_Collect_eq subsetD subset_antisym)
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   290
next
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   291
  show "?rhs \<Longrightarrow> ?lhs"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   292
    by (metis bot.extremum_uniqueI components_iff connected_component_eq_empty connected_component_maximal connected_component_subset connected_connected_component subset_emptyI)
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   293
qed
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   294
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   295
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   296
lemma joinable_components_eq:
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   297
  "connected T \<and> T \<subseteq> S \<and> c1 \<in> components S \<and> c2 \<in> components S \<and> c1 \<inter> T \<noteq> {} \<and> c2 \<inter> T \<noteq> {} \<Longrightarrow> c1 = c2"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   298
  by (metis (full_types) components_iff joinable_connected_component_eq)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   299
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   300
lemma closed_components: "\<lbrakk>closed S; C \<in> components S\<rbrakk> \<Longrightarrow> closed C"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   301
  by (metis closed_connected_component components_iff)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   302
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   303
lemma components_nonoverlap:
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   304
    "\<lbrakk>C \<in> components S; C' \<in> components S\<rbrakk> \<Longrightarrow> (C \<inter> C' = {}) \<longleftrightarrow> (C \<noteq> C')"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   305
  by (metis (full_types) components_iff connected_component_nonoverlap)
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   306
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   307
lemma components_eq: "\<lbrakk>C \<in> components S; C' \<in> components S\<rbrakk> \<Longrightarrow> (C = C' \<longleftrightarrow> C \<inter> C' \<noteq> {})"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   308
  by (metis components_nonoverlap)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   309
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   310
lemma components_eq_empty [simp]: "components S = {} \<longleftrightarrow> S = {}"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   311
  by (simp add: components_def)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   312
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   313
lemma components_empty [simp]: "components {} = {}"
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   314
  by simp
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   315
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   316
lemma connected_eq_connected_components_eq: "connected S \<longleftrightarrow> (\<forall>C \<in> components S. \<forall>C' \<in> components S. C = C')"
73932
fd21b4a93043 added opaque_combs and renamed hide_lams to opaque_lifting
desharna
parents: 72228
diff changeset
   317
  by (metis (no_types, opaque_lifting) components_iff connected_component_eq_eq connected_iff_connected_component)
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   318
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   319
lemma components_eq_sing_iff: "components S = {S} \<longleftrightarrow> connected S \<and> S \<noteq> {}" (is "?lhs \<longleftrightarrow> ?rhs")
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   320
proof
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   321
  show "?rhs \<Longrightarrow> ?lhs"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   322
    by (metis components_iff connected_component_eq_self equals0I insert_iff mk_disjoint_insert)
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   323
qed (use in_components_connected in fastforce)
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   324
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   325
lemma components_eq_sing_exists: "(\<exists>a. components S = {a}) \<longleftrightarrow> connected S \<and> S \<noteq> {}"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   326
  by (metis Union_components ccpo_Sup_singleton components_eq_sing_iff)
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   327
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   328
lemma connected_eq_components_subset_sing: "connected S \<longleftrightarrow> components S \<subseteq> {S}"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   329
  by (metis components_eq_empty components_eq_sing_iff connected_empty subset_singleton_iff)
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   330
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   331
lemma connected_eq_components_subset_sing_exists: "connected S \<longleftrightarrow> (\<exists>a. components S \<subseteq> {a})"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   332
  by (metis components_eq_sing_exists connected_eq_components_subset_sing subset_singleton_iff)
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   333
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   334
lemma in_components_self: "S \<in> components S \<longleftrightarrow> connected S \<and> S \<noteq> {}"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   335
  by (metis components_empty components_eq_sing_iff empty_iff in_components_connected insertI1)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   336
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   337
lemma components_maximal: "\<lbrakk>C \<in> components S; connected T; T \<subseteq> S; C \<inter> T \<noteq> {}\<rbrakk> \<Longrightarrow> T \<subseteq> C"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   338
  by (smt (verit, best) Int_Un_eq(4) Un_upper1 bot_eq_sup_iff connected_Un in_components_maximal inf.orderE sup.mono sup.orderI)
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   339
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   340
lemma exists_component_superset: "\<lbrakk>T \<subseteq> S; S \<noteq> {}; connected T\<rbrakk> \<Longrightarrow> \<exists>C. C \<in> components S \<and> T \<subseteq> C"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   341
  by (meson componentsI connected_component_maximal equals0I subset_eq)
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   342
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   343
lemma components_intermediate_subset: "\<lbrakk>S \<in> components U; S \<subseteq> T; T \<subseteq> U\<rbrakk> \<Longrightarrow> S \<in> components T"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   344
  by (smt (verit, best) dual_order.trans in_components_maximal)
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   345
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   346
lemma in_components_unions_complement: "C \<in> components S \<Longrightarrow> S - C = \<Union>(components S - {C})"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   347
  by (metis complement_connected_component_unions components_def components_iff)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   348
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   349
lemma connected_intermediate_closure:
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   350
  assumes cs: "connected S" and st: "S \<subseteq> T" and ts: "T \<subseteq> closure S"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   351
  shows "connected T"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   352
  using assms unfolding connected_def
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   353
  by (smt (verit) Int_assoc inf.absorb_iff2 inf_bot_left open_Int_closure_eq_empty)
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   354
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   355
lemma closedin_connected_component: "closedin (top_of_set S) (connected_component_set S x)"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   356
proof (cases "connected_component_set S x = {}")
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   357
  case True
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   358
  then show ?thesis
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   359
    by (metis closedin_empty)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   360
next
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   361
  case False
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   362
  then obtain y where y: "connected_component S x y" and "x \<in> S"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   363
    using connected_component_eq_empty by blast
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   364
  have *: "connected_component_set S x \<subseteq> S \<inter> closure (connected_component_set S x)"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   365
    by (auto simp: closure_def connected_component_in)
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   366
  have **: "x \<in> closure (connected_component_set S x)"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   367
    by (simp add: \<open>x \<in> S\<close> closure_def)
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   368
  have "S \<inter> closure (connected_component_set S x) \<subseteq> connected_component_set S x" if "connected_component S x y"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   369
  proof (rule connected_component_maximal)
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   370
    show "connected (S \<inter> closure (connected_component_set S x))"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   371
      using "*" connected_intermediate_closure by blast
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   372
  qed (use \<open>x \<in> S\<close> ** in auto)
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   373
  with y * show ?thesis
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   374
    by (auto simp: closedin_closed)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   375
qed
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   376
66939
04678058308f New results in topology, mostly from HOL Light's moretop.ml
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
   377
lemma closedin_component:
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   378
   "C \<in> components S \<Longrightarrow> closedin (top_of_set S) C"
66939
04678058308f New results in topology, mostly from HOL Light's moretop.ml
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
   379
  using closedin_connected_component componentsE by blast
04678058308f New results in topology, mostly from HOL Light's moretop.ml
paulson <lp15@cam.ac.uk>
parents: 66884
diff changeset
   380
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   381
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69922
diff changeset
   382
subsection\<^marker>\<open>tag unimportant\<close> \<open>Proving a function is constant on a connected set
69615
e502cd4d7062 moved material from Connected.thy to more appropriate places
immler
parents: 69614
diff changeset
   383
  by proving that a level set is open\<close>
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   384
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   385
lemma continuous_levelset_openin_cases:
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   386
  fixes f :: "_ \<Rightarrow> 'b::t1_space"
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   387
  shows "connected S \<Longrightarrow> continuous_on S f \<Longrightarrow>
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   388
        openin (top_of_set S) {x \<in> S. f x = a}
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   389
        \<Longrightarrow> (\<forall>x \<in> S. f x \<noteq> a) \<or> (\<forall>x \<in> S. f x = a)"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   390
  unfolding connected_clopen
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   391
  using continuous_closedin_preimage_constant by auto
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   392
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   393
lemma continuous_levelset_openin:
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   394
  fixes f :: "_ \<Rightarrow> 'b::t1_space"
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   395
  shows "connected S \<Longrightarrow> continuous_on S f \<Longrightarrow>
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   396
        openin (top_of_set S) {x \<in> S. f x = a} \<Longrightarrow>
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   397
        (\<exists>x \<in> S. f x = a)  \<Longrightarrow> (\<forall>x \<in> S. f x = a)"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   398
  using continuous_levelset_openin_cases[of S f ]
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   399
  by meson
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   400
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   401
lemma continuous_levelset_open:
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   402
  fixes f :: "_ \<Rightarrow> 'b::t1_space"
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   403
  assumes S: "connected S" "continuous_on S f"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   404
    and a: "open {x \<in> S. f x = a}" "\<exists>x \<in> S.  f x = a"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   405
  shows "\<forall>x \<in> S. f x = a"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   406
  using a continuous_levelset_openin[OF S, of a, unfolded openin_open]
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   407
  by fast
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   408
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   409
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69922
diff changeset
   410
subsection\<^marker>\<open>tag unimportant\<close> \<open>Preservation of Connectedness\<close>
67727
ce3e87a51488 moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
immler
parents: 67707
diff changeset
   411
ce3e87a51488 moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
immler
parents: 67707
diff changeset
   412
lemma homeomorphic_connectedness:
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   413
  assumes "S homeomorphic T"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   414
  shows "connected S \<longleftrightarrow> connected T"
67727
ce3e87a51488 moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
immler
parents: 67707
diff changeset
   415
using assms unfolding homeomorphic_def homeomorphism_def by (metis connected_continuous_image)
ce3e87a51488 moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
immler
parents: 67707
diff changeset
   416
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   417
lemma connected_monotone_quotient_preimage:
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   418
  assumes "connected T"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   419
      and contf: "continuous_on S f" and fim: "f ` S = T"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   420
      and opT: "\<And>U. U \<subseteq> T
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   421
                 \<Longrightarrow> openin (top_of_set S) (S \<inter> f -` U) \<longleftrightarrow>
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   422
                     openin (top_of_set T) U"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   423
      and connT: "\<And>y. y \<in> T \<Longrightarrow> connected (S \<inter> f -` {y})"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   424
    shows "connected S"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   425
proof (rule connectedI)
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   426
  fix U V
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   427
  assume "open U" and "open V" and "U \<inter> S \<noteq> {}" and "V \<inter> S \<noteq> {}"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   428
    and "U \<inter> V \<inter> S = {}" and "S \<subseteq> U \<union> V"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   429
  moreover
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   430
  have disjoint: "f ` (S \<inter> U) \<inter> f ` (S \<inter> V) = {}"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   431
  proof -
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   432
    have False if "y \<in> f ` (S \<inter> U) \<inter> f ` (S \<inter> V)" for y
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   433
    proof -
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   434
      have "y \<in> T"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   435
        using fim that by blast
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   436
      show ?thesis
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   437
        using connectedD [OF connT [OF \<open>y \<in> T\<close>] \<open>open U\<close> \<open>open V\<close>]
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   438
              \<open>S \<subseteq> U \<union> V\<close> \<open>U \<inter> V \<inter> S = {}\<close> that by fastforce
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   439
    qed
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   440
    then show ?thesis by blast
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   441
  qed
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   442
  ultimately have UU: "(S \<inter> f -` f ` (S \<inter> U)) = S \<inter> U" and VV: "(S \<inter> f -` f ` (S \<inter> V)) = S \<inter> V"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   443
    by auto
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   444
  have opeU: "openin (top_of_set T) (f ` (S \<inter> U))"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   445
    by (metis UU \<open>open U\<close> fim image_Int_subset le_inf_iff opT openin_open_Int)
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   446
  have opeV: "openin (top_of_set T) (f ` (S \<inter> V))"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   447
    by (metis opT fim VV \<open>open V\<close> openin_open_Int image_Int_subset inf.bounded_iff)
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   448
  have "T \<subseteq> f ` (S \<inter> U) \<union> f ` (S \<inter> V)"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   449
    using \<open>S \<subseteq> U \<union> V\<close> fim by auto
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   450
  then show False
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   451
    using \<open>connected T\<close> disjoint opeU opeV \<open>U \<inter> S \<noteq> {}\<close> \<open>V \<inter> S \<noteq> {}\<close>
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   452
    by (auto simp: connected_openin)
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   453
qed
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   454
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   455
lemma connected_open_monotone_preimage:
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   456
  assumes contf: "continuous_on S f" and fim: "f ` S = T"
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   457
    and ST: "\<And>C. openin (top_of_set S) C \<Longrightarrow> openin (top_of_set T) (f ` C)"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   458
    and connT: "\<And>y. y \<in> T \<Longrightarrow> connected (S \<inter> f -` {y})"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   459
    and "connected C" "C \<subseteq> T"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   460
  shows "connected (S \<inter> f -` C)"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   461
proof -
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   462
  have contf': "continuous_on (S \<inter> f -` C) f"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   463
    by (meson contf continuous_on_subset inf_le1)
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   464
  have eqC: "f ` (S \<inter> f -` C) = C"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   465
    using \<open>C \<subseteq> T\<close> fim by blast
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   466
  show ?thesis
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   467
  proof (rule connected_monotone_quotient_preimage [OF \<open>connected C\<close> contf' eqC])
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   468
    show "connected (S \<inter> f -` C \<inter> f -` {y})" if "y \<in> C" for y
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   469
      by (metis Int_assoc Int_empty_right Int_insert_right_if1 assms(6) connT in_mono that vimage_Int)
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   470
    have "\<And>U. openin (top_of_set (S \<inter> f -` C)) U
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   471
               \<Longrightarrow> openin (top_of_set C) (f ` U)"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   472
      using open_map_restrict [OF _ ST \<open>C \<subseteq> T\<close>] by metis
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   473
    then show "\<And>D. D \<subseteq> C
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   474
          \<Longrightarrow> openin (top_of_set (S \<inter> f -` C)) (S \<inter> f -` C \<inter> f -` D) =
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   475
              openin (top_of_set C) D"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   476
      using open_map_imp_quotient_map [of "(S \<inter> f -` C)" f] contf' by (simp add: eqC)
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   477
  qed
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   478
qed
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   479
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   480
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   481
lemma connected_closed_monotone_preimage:
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   482
  assumes contf: "continuous_on S f" and fim: "f ` S = T"
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   483
    and ST: "\<And>C. closedin (top_of_set S) C \<Longrightarrow> closedin (top_of_set T) (f ` C)"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   484
    and connT: "\<And>y. y \<in> T \<Longrightarrow> connected (S \<inter> f -` {y})"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   485
    and "connected C" "C \<subseteq> T"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   486
  shows "connected (S \<inter> f -` C)"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   487
proof -
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   488
  have contf': "continuous_on (S \<inter> f -` C) f"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   489
    by (meson contf continuous_on_subset inf_le1)
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   490
  have eqC: "f ` (S \<inter> f -` C) = C"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   491
    using \<open>C \<subseteq> T\<close> fim by blast
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   492
  show ?thesis
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   493
  proof (rule connected_monotone_quotient_preimage [OF \<open>connected C\<close> contf' eqC])
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   494
    show "connected (S \<inter> f -` C \<inter> f -` {y})" if "y \<in> C" for y
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   495
      by (metis Int_assoc Int_empty_right Int_insert_right_if1 \<open>C \<subseteq> T\<close> connT subsetD that vimage_Int)
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   496
    have "\<And>U. closedin (top_of_set (S \<inter> f -` C)) U
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   497
               \<Longrightarrow> closedin (top_of_set C) (f ` U)"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   498
      using closed_map_restrict [OF _ ST \<open>C \<subseteq> T\<close>] by metis
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   499
    then show "\<And>D. D \<subseteq> C
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   500
          \<Longrightarrow> openin (top_of_set (S \<inter> f -` C)) (S \<inter> f -` C \<inter> f -` D) =
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   501
              openin (top_of_set C) D"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   502
      using closed_map_imp_quotient_map [of "(S \<inter> f -` C)" f] contf' by (simp add: eqC)
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   503
  qed
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   504
qed
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   505
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   506
71137
nipkow
parents: 70136
diff changeset
   507
subsection\<open>Lemmas about components\<close>
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   508
71137
nipkow
parents: 70136
diff changeset
   509
text  \<open>See Newman IV, 3.3 and 3.4.\<close>
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   510
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   511
lemma connected_Un_clopen_in_complement:
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   512
  fixes S U :: "'a::metric_space set"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   513
  assumes "connected S" "connected U" "S \<subseteq> U" 
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   514
      and opeT: "openin (top_of_set (U - S)) T" 
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   515
      and cloT: "closedin (top_of_set (U - S)) T"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   516
    shows "connected (S \<union> T)"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   517
proof -
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   518
  have *: "\<lbrakk>\<And>x y. P x y \<longleftrightarrow> P y x; \<And>x y. P x y \<Longrightarrow> S \<subseteq> x \<or> S \<subseteq> y;
69508
2a4c8a2a3f8e tuned headers; ~ -> \<not>
nipkow
parents: 69325
diff changeset
   519
            \<And>x y. \<lbrakk>P x y; S \<subseteq> x\<rbrakk> \<Longrightarrow> False\<rbrakk> \<Longrightarrow> \<not>(\<exists>x y. (P x y))" for P
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   520
    by metis
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   521
  show ?thesis
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   522
    unfolding connected_closedin_eq
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   523
  proof (rule *)
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   524
    fix H1 H2
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   525
    assume H: "closedin (top_of_set (S \<union> T)) H1 \<and> 
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   526
               closedin (top_of_set (S \<union> T)) H2 \<and>
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   527
               H1 \<union> H2 = S \<union> T \<and> H1 \<inter> H2 = {} \<and> H1 \<noteq> {} \<and> H2 \<noteq> {}"
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   528
    then have clo: "closedin (top_of_set S) (S \<inter> H1)"
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   529
                   "closedin (top_of_set S) (S \<inter> H2)"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   530
      by (metis Un_upper1 closedin_closed_subset inf_commute)+
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   531
    moreover have "S \<inter> ((S \<union> T) \<inter> H1) \<union> S \<inter> ((S \<union> T) \<inter> H2) = S"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   532
      using H by blast
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   533
    moreover have "H1 \<inter> (S \<inter> ((S \<union> T) \<inter> H2)) = {}"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   534
      using H by blast
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   535
    ultimately have "S \<inter> H1 = {} \<or> S \<inter> H2 = {}"
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   536
      by (smt (verit) Int_assoc \<open>connected S\<close> connected_closedin_eq inf_commute inf_sup_absorb)
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   537
    then show "S \<subseteq> H1 \<or> S \<subseteq> H2"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   538
      using H \<open>connected S\<close> unfolding connected_closedin by blast
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   539
  next
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   540
    fix H1 H2
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   541
    assume H: "closedin (top_of_set (S \<union> T)) H1 \<and>
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   542
               closedin (top_of_set (S \<union> T)) H2 \<and>
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   543
               H1 \<union> H2 = S \<union> T \<and> H1 \<inter> H2 = {} \<and> H1 \<noteq> {} \<and> H2 \<noteq> {}" 
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   544
       and "S \<subseteq> H1"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   545
    then have H2T: "H2 \<subseteq> T"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   546
      by auto
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   547
    have "T \<subseteq> U"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   548
      using Diff_iff opeT openin_imp_subset by auto
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   549
    with \<open>S \<subseteq> U\<close> have Ueq: "U = (U - S) \<union> (S \<union> T)" 
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   550
      by auto
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   551
    have "openin (top_of_set ((U - S) \<union> (S \<union> T))) H2"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   552
    proof (rule openin_subtopology_Un)
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   553
      show "openin (top_of_set (S \<union> T)) H2"
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   554
        by (metis Diff_cancel H Un_Diff Un_Diff_Int closedin_subset openin_closedin_eq topspace_euclidean_subtopology)
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   555
      then show "openin (top_of_set (U - S)) H2"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   556
        by (meson H2T Un_upper2 opeT openin_subset_trans openin_trans)
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   557
    qed
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   558
    moreover have "closedin (top_of_set ((U - S) \<union> (S \<union> T))) H2"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   559
    proof (rule closedin_subtopology_Un)
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   560
      show "closedin (top_of_set (U - S)) H2"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   561
        using H H2T cloT closedin_subset_trans 
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   562
        by (blast intro: closedin_subtopology_Un closedin_trans)
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   563
    qed (simp add: H)
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   564
    ultimately have H2: "H2 = {} \<or> H2 = U"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   565
      using Ueq \<open>connected U\<close> unfolding connected_clopen by metis   
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   566
    then have "H2 \<subseteq> S"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   567
      by (metis Diff_partition H Un_Diff_cancel Un_subset_iff \<open>H2 \<subseteq> T\<close> assms(3) inf.orderE opeT openin_imp_subset)
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   568
    moreover have "T \<subseteq> H2 - S"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   569
      by (metis (no_types) H2 H opeT openin_closedin_eq topspace_euclidean_subtopology)
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   570
    ultimately show False
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   571
      using H \<open>S \<subseteq> H1\<close> by blast
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   572
  qed blast
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   573
qed
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   574
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   575
68607
67bb59e49834 make theorem, corollary, and proposition %important for HOL-Analysis manual
immler
parents: 68527
diff changeset
   576
proposition component_diff_connected:
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   577
  fixes S :: "'a::metric_space set"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   578
  assumes "connected S" "connected U" "S \<subseteq> U" and C: "C \<in> components (U - S)"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   579
  shows "connected(U - C)"
68607
67bb59e49834 make theorem, corollary, and proposition %important for HOL-Analysis manual
immler
parents: 68527
diff changeset
   580
  using \<open>connected S\<close> unfolding connected_closedin_eq not_ex de_Morgan_conj
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   581
proof clarify
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   582
  fix H3 H4 
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   583
  assume clo3: "closedin (top_of_set (U - C)) H3" 
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   584
    and clo4: "closedin (top_of_set (U - C)) H4" 
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   585
    and H34: "H3 \<union> H4 = U - C" "H3 \<inter> H4 = {}" and "H3 \<noteq> {}" and "H4 \<noteq> {}"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   586
    and * [rule_format]:
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   587
    "\<forall>H1 H2. \<not> closedin (top_of_set S) H1 \<or>
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   588
                      \<not> closedin (top_of_set S) H2 \<or>
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   589
                      H1 \<union> H2 \<noteq> S \<or> H1 \<inter> H2 \<noteq> {} \<or> \<not> H1 \<noteq> {} \<or> \<not> H2 \<noteq> {}"
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   590
  then have "H3 \<subseteq> U-C" and ope3: "openin (top_of_set (U - C)) (U - C - H3)"
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   591
    and "H4 \<subseteq> U-C" and ope4: "openin (top_of_set (U - C)) (U - C - H4)"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   592
    by (auto simp: closedin_def)
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   593
  have "C \<noteq> {}" "C \<subseteq> U-S" "connected C"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   594
    using C in_components_nonempty in_components_subset in_components_maximal by blast+
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   595
  have cCH3: "connected (C \<union> H3)"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   596
  proof (rule connected_Un_clopen_in_complement [OF \<open>connected C\<close> \<open>connected U\<close> _ _ clo3])
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   597
    show "openin (top_of_set (U - C)) H3"
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   598
      by (metis Diff_cancel Un_Diff Un_Diff_Int \<open>H3 \<inter> H4 = {}\<close> \<open>H3 \<union> H4 = U - C\<close> ope4)
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   599
  qed (use clo3 \<open>C \<subseteq> U - S\<close> in auto)
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   600
  have cCH4: "connected (C \<union> H4)"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   601
  proof (rule connected_Un_clopen_in_complement [OF \<open>connected C\<close> \<open>connected U\<close> _ _ clo4])
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   602
    show "openin (top_of_set (U - C)) H4"
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   603
      by (metis Diff_cancel Diff_triv Int_Un_eq(2) Un_Diff H34 inf_commute ope3)
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   604
  qed (use clo4 \<open>C \<subseteq> U - S\<close> in auto)
69922
4a9167f377b0 new material about topology, etc.; also fixes for yesterday's
paulson <lp15@cam.ac.uk>
parents: 69617
diff changeset
   605
  have "closedin (top_of_set S) (S \<inter> H3)" "closedin (top_of_set S) (S \<inter> H4)"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   606
    using clo3 clo4 \<open>S \<subseteq> U\<close> \<open>C \<subseteq> U - S\<close> by (auto simp: closedin_closed)
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   607
  moreover have "S \<inter> H3 \<noteq> {}"      
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   608
    using components_maximal [OF C cCH3] \<open>C \<noteq> {}\<close> \<open>C \<subseteq> U - S\<close> \<open>H3 \<noteq> {}\<close> \<open>H3 \<subseteq> U - C\<close> by auto
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   609
  moreover have "S \<inter> H4 \<noteq> {}"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   610
    using components_maximal [OF C cCH4] \<open>C \<noteq> {}\<close> \<open>C \<subseteq> U - S\<close> \<open>H4 \<noteq> {}\<close> \<open>H4 \<subseteq> U - C\<close> by auto
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   611
  ultimately show False
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   612
    using * [of "S \<inter> H3" "S \<inter> H4"] \<open>H3 \<inter> H4 = {}\<close> \<open>C \<subseteq> U - S\<close> \<open>H3 \<union> H4 = U - C\<close> \<open>S \<subseteq> U\<close> 
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   613
    by auto
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   614
qed
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   615
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   616
70136
f03a01a18c6e modernized tags: default scope excludes proof;
wenzelm
parents: 69922
diff changeset
   617
subsection\<^marker>\<open>tag unimportant\<close>\<open>Constancy of a function from a connected set into a finite, disconnected or discrete set\<close>
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   618
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   619
text\<open>Still missing: versions for a set that is smaller than R, or countable.\<close>
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   620
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   621
lemma continuous_disconnected_range_constant:
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   622
  assumes S: "connected S"
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   623
      and conf: "continuous_on S f"
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   624
      and fim: "f \<in> S \<rightarrow> T"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   625
      and cct: "\<And>y. y \<in> T \<Longrightarrow> connected_component_set T y = {y}"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   626
    shows "f constant_on S"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   627
proof (cases "S = {}")
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   628
  case True then show ?thesis
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   629
    by (simp add: constant_on_def)
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   630
next
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   631
  case False
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   632
  then have "f ` S \<subseteq> {f x}" if "x \<in> S" for x
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   633
    by (metis PiE S cct connected_component_maximal connected_continuous_image [OF conf] fim image_eqI 
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   634
        image_subset_iff that)
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   635
  with False show ?thesis
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   636
    unfolding constant_on_def by blast
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   637
qed
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   638
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   639
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   640
text\<open>This proof requires the existence of two separate values of the range type.\<close>
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   641
lemma finite_range_constant_imp_connected:
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   642
  assumes "\<And>f::'a::topological_space \<Rightarrow> 'b::real_normed_algebra_1.
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   643
              \<lbrakk>continuous_on S f; finite(f ` S)\<rbrakk> \<Longrightarrow> f constant_on S"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   644
    shows "connected S"
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   645
proof -
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   646
  { fix T U
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   647
    assume clt: "closedin (top_of_set S) T"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   648
       and clu: "closedin (top_of_set S) U"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   649
       and tue: "T \<inter> U = {}" and tus: "T \<union> U = S"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   650
    have "continuous_on (T \<union> U) (\<lambda>x. if x \<in> T then 0 else 1)"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   651
      using clt clu tue by (intro continuous_on_cases_local) (auto simp: tus)
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   652
    then have conif: "continuous_on S (\<lambda>x. if x \<in> T then 0 else 1)"
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   653
      using tus by blast
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   654
    have fi: "finite ((\<lambda>x. if x \<in> T then 0 else 1) ` S)"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   655
      by (rule finite_subset [of _ "{0,1}"]) auto
78475
a5f6d2fc1b1f More cosmetic changes
paulson <lp15@cam.ac.uk>
parents: 77223
diff changeset
   656
    have "T = {} \<or> U = {}"
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   657
      using assms [OF conif fi] tus [symmetric]
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66835
diff changeset
   658
      by (auto simp: Ball_def constant_on_def) (metis IntI empty_iff one_neq_zero tue)
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   659
  }
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   660
  then show ?thesis
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   661
    by (simp add: connected_closedin_eq)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   662
qed
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   663
69617
63ee37c519a3 reduced dependencies of Connected.thy
immler
parents: 69616
diff changeset
   664
end