src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy
author hoelzl
Mon, 14 Jan 2013 17:29:04 +0100
changeset 50881 ae630bab13da
parent 50526 899c9c4e4a4c
child 50882 a382bf90867e
permissions -rw-r--r--
renamed countable_basis_space to second_countable_topology
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33714
eb2574ac4173 Added new lemmas to Euclidean Space by Robert Himmelmann
hoelzl
parents: 33324
diff changeset
     1
(*  title:      HOL/Library/Topology_Euclidian_Space.thy
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
     2
    Author:     Amine Chaieb, University of Cambridge
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
     3
    Author:     Robert Himmelmann, TU Muenchen
44075
5952bd355779 generalize more lemmas about compactness
huffman
parents: 44074
diff changeset
     4
    Author:     Brian Huffman, Portland State University
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
     5
*)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
     6
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
     7
header {* Elementary topology in Euclidean space. *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
     8
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
     9
theory Topology_Euclidean_Space
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    10
imports
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    11
  SEQ
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    12
  "~~/src/HOL/Library/Diagonal_Subsequence"
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
    13
  "~~/src/HOL/Library/Countable_Set"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    14
  Linear_Algebra
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    15
  "~~/src/HOL/Library/Glbs"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
    16
  "~~/src/HOL/Library/FuncSet"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    17
  Norm_Arith
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    18
begin
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    19
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
    20
lemma countable_PiE: 
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
    21
  "finite I \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> countable (F i)) \<Longrightarrow> countable (PiE I F)"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
    22
  by (induct I arbitrary: F rule: finite_induct) (auto simp: PiE_insert_eq)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
    23
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
    24
lemma countable_rat: "countable \<rat>"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
    25
  unfolding Rats_def by auto
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
    26
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    27
subsection {* Topological Basis *}
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    28
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    29
context topological_space
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    30
begin
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    31
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    32
definition "topological_basis B =
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    33
  ((\<forall>b\<in>B. open b) \<and> (\<forall>x. open x \<longrightarrow> (\<exists>B'. B' \<subseteq> B \<and> Union B' = x)))"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    34
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    35
lemma topological_basis_iff:
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    36
  assumes "\<And>B'. B' \<in> B \<Longrightarrow> open B'"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    37
  shows "topological_basis B \<longleftrightarrow> (\<forall>O'. open O' \<longrightarrow> (\<forall>x\<in>O'. \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O'))"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    38
    (is "_ \<longleftrightarrow> ?rhs")
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    39
proof safe
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    40
  fix O' and x::'a
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    41
  assume H: "topological_basis B" "open O'" "x \<in> O'"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    42
  hence "(\<exists>B'\<subseteq>B. \<Union>B' = O')" by (simp add: topological_basis_def)
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    43
  then obtain B' where "B' \<subseteq> B" "O' = \<Union>B'" by auto
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    44
  thus "\<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O'" using H by auto
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    45
next
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    46
  assume H: ?rhs
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    47
  show "topological_basis B" using assms unfolding topological_basis_def
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    48
  proof safe
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    49
    fix O'::"'a set" assume "open O'"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    50
    with H obtain f where "\<forall>x\<in>O'. f x \<in> B \<and> x \<in> f x \<and> f x \<subseteq> O'"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    51
      by (force intro: bchoice simp: Bex_def)
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    52
    thus "\<exists>B'\<subseteq>B. \<Union>B' = O'"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    53
      by (auto intro: exI[where x="{f x |x. x \<in> O'}"])
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    54
  qed
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    55
qed
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    56
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    57
lemma topological_basisI:
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    58
  assumes "\<And>B'. B' \<in> B \<Longrightarrow> open B'"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    59
  assumes "\<And>O' x. open O' \<Longrightarrow> x \<in> O' \<Longrightarrow> \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O'"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    60
  shows "topological_basis B"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    61
  using assms by (subst topological_basis_iff) auto
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    62
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    63
lemma topological_basisE:
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    64
  fixes O'
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    65
  assumes "topological_basis B"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    66
  assumes "open O'"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    67
  assumes "x \<in> O'"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    68
  obtains B' where "B' \<in> B" "x \<in> B'" "B' \<subseteq> O'"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    69
proof atomize_elim
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    70
  from assms have "\<And>B'. B'\<in>B \<Longrightarrow> open B'" by (simp add: topological_basis_def)
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    71
  with topological_basis_iff assms
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    72
  show  "\<exists>B'. B' \<in> B \<and> x \<in> B' \<and> B' \<subseteq> O'" using assms by (simp add: Bex_def)
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    73
qed
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    74
50094
84ddcf5364b4 allow arbitrary enumerations of basis in locale for generation of borel sets
immler
parents: 50087
diff changeset
    75
lemma topological_basis_open:
84ddcf5364b4 allow arbitrary enumerations of basis in locale for generation of borel sets
immler
parents: 50087
diff changeset
    76
  assumes "topological_basis B"
84ddcf5364b4 allow arbitrary enumerations of basis in locale for generation of borel sets
immler
parents: 50087
diff changeset
    77
  assumes "X \<in> B"
84ddcf5364b4 allow arbitrary enumerations of basis in locale for generation of borel sets
immler
parents: 50087
diff changeset
    78
  shows "open X"
84ddcf5364b4 allow arbitrary enumerations of basis in locale for generation of borel sets
immler
parents: 50087
diff changeset
    79
  using assms
84ddcf5364b4 allow arbitrary enumerations of basis in locale for generation of borel sets
immler
parents: 50087
diff changeset
    80
  by (simp add: topological_basis_def)
84ddcf5364b4 allow arbitrary enumerations of basis in locale for generation of borel sets
immler
parents: 50087
diff changeset
    81
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
    82
lemma basis_dense:
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
    83
  fixes B::"'a set set" and f::"'a set \<Rightarrow> 'a"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
    84
  assumes "topological_basis B"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
    85
  assumes choosefrom_basis: "\<And>B'. B' \<noteq> {} \<Longrightarrow> f B' \<in> B'"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
    86
  shows "(\<forall>X. open X \<longrightarrow> X \<noteq> {} \<longrightarrow> (\<exists>B' \<in> B. f B' \<in> X))"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
    87
proof (intro allI impI)
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
    88
  fix X::"'a set" assume "open X" "X \<noteq> {}"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
    89
  from topological_basisE[OF `topological_basis B` `open X` choosefrom_basis[OF `X \<noteq> {}`]]
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
    90
  guess B' . note B' = this
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
    91
  thus "\<exists>B'\<in>B. f B' \<in> X" by (auto intro!: choosefrom_basis)
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
    92
qed
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
    93
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    94
end
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    95
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
    96
subsection {* Countable Basis *}
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
    97
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
    98
locale countable_basis =
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
    99
  fixes B::"'a::topological_space set set"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   100
  assumes is_basis: "topological_basis B"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   101
  assumes countable_basis: "countable B"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   102
begin
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   103
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   104
lemma open_countable_basis_ex:
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   105
  assumes "open X"
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   106
  shows "\<exists>B' \<subseteq> B. X = Union B'"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   107
  using assms countable_basis is_basis unfolding topological_basis_def by blast
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   108
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   109
lemma open_countable_basisE:
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   110
  assumes "open X"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   111
  obtains B' where "B' \<subseteq> B" "X = Union B'"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   112
  using assms open_countable_basis_ex by (atomize_elim) simp
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   113
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   114
lemma countable_dense_exists:
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   115
  shows "\<exists>D::'a set. countable D \<and> (\<forall>X. open X \<longrightarrow> X \<noteq> {} \<longrightarrow> (\<exists>d \<in> D. d \<in> X))"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   116
proof -
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   117
  let ?f = "(\<lambda>B'. SOME x. x \<in> B')"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   118
  have "countable (?f ` B)" using countable_basis by simp
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   119
  with basis_dense[OF is_basis, of ?f] show ?thesis
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   120
    by (intro exI[where x="?f ` B"]) (metis (mono_tags) all_not_in_conv imageI someI)
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   121
qed
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   122
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   123
lemma countable_dense_setE:
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   124
  obtains D :: "'a set"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   125
  where "countable D" "\<And>X. open X \<Longrightarrow> X \<noteq> {} \<Longrightarrow> \<exists>d \<in> D. d \<in> X"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   126
  using countable_dense_exists by blast
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   127
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   128
text {* Construction of an increasing sequence approximating open sets,
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   129
  therefore basis which is closed under union. *}
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   130
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   131
definition union_closed_basis::"'a set set" where
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   132
  "union_closed_basis = (\<lambda>l. \<Union>set l) ` lists B"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   133
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   134
lemma basis_union_closed_basis: "topological_basis union_closed_basis"
50094
84ddcf5364b4 allow arbitrary enumerations of basis in locale for generation of borel sets
immler
parents: 50087
diff changeset
   135
proof (rule topological_basisI)
84ddcf5364b4 allow arbitrary enumerations of basis in locale for generation of borel sets
immler
parents: 50087
diff changeset
   136
  fix O' and x::'a assume "open O'" "x \<in> O'"
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   137
  from topological_basisE[OF is_basis this] guess B' . note B' = this
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   138
  thus "\<exists>B'\<in>union_closed_basis. x \<in> B' \<and> B' \<subseteq> O'" unfolding union_closed_basis_def
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   139
    by (auto intro!: bexI[where x="[B']"])
50094
84ddcf5364b4 allow arbitrary enumerations of basis in locale for generation of borel sets
immler
parents: 50087
diff changeset
   140
next
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   141
  fix B' assume "B' \<in> union_closed_basis"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   142
  thus "open B'"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   143
    using topological_basis_open[OF is_basis]
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   144
    by (auto simp: union_closed_basis_def)
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   145
qed
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   146
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   147
lemma countable_union_closed_basis: "countable union_closed_basis"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   148
  unfolding union_closed_basis_def using countable_basis by simp
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   149
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   150
lemmas open_union_closed_basis = topological_basis_open[OF basis_union_closed_basis]
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   151
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   152
lemma union_closed_basis_ex:
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   153
 assumes X: "X \<in> union_closed_basis"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   154
 shows "\<exists>B'. finite B' \<and> X = \<Union>B' \<and> B' \<subseteq> B"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   155
proof -
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   156
  from X obtain l where "\<And>x. x\<in>set l \<Longrightarrow> x\<in>B" "X = \<Union>set l" by (auto simp: union_closed_basis_def)
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   157
  thus ?thesis by auto
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   158
qed
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   159
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   160
lemma union_closed_basisE:
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   161
  assumes "X \<in> union_closed_basis"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   162
  obtains B' where "finite B'" "X = \<Union>B'" "B' \<subseteq> B" using union_closed_basis_ex[OF assms] by blast
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   163
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   164
lemma union_closed_basisI:
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   165
  assumes "finite B'" "X = \<Union>B'" "B' \<subseteq> B"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   166
  shows "X \<in> union_closed_basis"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   167
proof -
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   168
  from finite_list[OF `finite B'`] guess l ..
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   169
  thus ?thesis using assms unfolding union_closed_basis_def by (auto intro!: image_eqI[where x=l])
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   170
qed
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   171
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   172
lemma empty_basisI[intro]: "{} \<in> union_closed_basis"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   173
  by (rule union_closed_basisI[of "{}"]) auto
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   174
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   175
lemma union_basisI[intro]:
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   176
  assumes "X \<in> union_closed_basis" "Y \<in> union_closed_basis"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   177
  shows "X \<union> Y \<in> union_closed_basis"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   178
  using assms by (auto intro: union_closed_basisI elim!:union_closed_basisE)
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   179
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   180
lemma open_imp_Union_of_incseq:
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   181
  assumes "open X"
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   182
  shows "\<exists>S. incseq S \<and> (\<Union>j. S j) = X \<and> range S \<subseteq> union_closed_basis"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   183
proof -
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   184
  from open_countable_basis_ex[OF `open X`]
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   185
  obtain B' where B': "B'\<subseteq>B" "X = \<Union>B'" by auto
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   186
  from this(1) countable_basis have "countable B'" by (rule countable_subset)
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   187
  show ?thesis
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   188
  proof cases
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   189
    assume "B' \<noteq> {}"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   190
    def S \<equiv> "\<lambda>n. \<Union>i\<in>{0..n}. from_nat_into B' i"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   191
    have S:"\<And>n. S n = \<Union>{from_nat_into B' i|i. i\<in>{0..n}}" unfolding S_def by force
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   192
    have "incseq S" by (force simp: S_def incseq_Suc_iff)
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   193
    moreover
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   194
    have "(\<Union>j. S j) = X" unfolding B'
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   195
    proof safe
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   196
      fix x X assume "X \<in> B'" "x \<in> X"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   197
      then obtain n where "X = from_nat_into B' n"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   198
        by (metis `countable B'` from_nat_into_surj)
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   199
      also have "\<dots> \<subseteq> S n" by (auto simp: S_def)
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   200
      finally show "x \<in> (\<Union>j. S j)" using `x \<in> X` by auto
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   201
    next
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   202
      fix x n
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   203
      assume "x \<in> S n"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   204
      also have "\<dots> = (\<Union>i\<in>{0..n}. from_nat_into B' i)"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   205
        by (simp add: S_def)
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   206
      also have "\<dots> \<subseteq> (\<Union>i. from_nat_into B' i)" by auto
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   207
      also have "\<dots> \<subseteq> \<Union>B'" using `B' \<noteq> {}` by (auto intro: from_nat_into)
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   208
      finally show "x \<in> \<Union>B'" .
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   209
    qed
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   210
    moreover have "range S \<subseteq> union_closed_basis" using B'
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   211
      by (auto intro!: union_closed_basisI[OF _ S] simp: from_nat_into `B' \<noteq> {}`)
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   212
    ultimately show ?thesis by auto
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   213
  qed (auto simp: B')
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   214
qed
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   215
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   216
lemma open_incseqE:
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   217
  assumes "open X"
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   218
  obtains S where "incseq S" "(\<Union>j. S j) = X" "range S \<subseteq> union_closed_basis"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   219
  using open_imp_Union_of_incseq assms by atomize_elim
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   220
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   221
end
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   222
50881
ae630bab13da renamed countable_basis_space to second_countable_topology
hoelzl
parents: 50526
diff changeset
   223
class second_countable_topology = topological_space +
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   224
  assumes ex_countable_basis:
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   225
    "\<exists>B::'a::topological_space set set. countable B \<and> topological_basis B"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   226
50881
ae630bab13da renamed countable_basis_space to second_countable_topology
hoelzl
parents: 50526
diff changeset
   227
sublocale second_countable_topology < countable_basis "SOME B. countable B \<and> topological_basis B"
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   228
  using someI_ex[OF ex_countable_basis] by unfold_locales safe
50094
84ddcf5364b4 allow arbitrary enumerations of basis in locale for generation of borel sets
immler
parents: 50087
diff changeset
   229
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   230
subsection {* Polish spaces *}
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   231
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   232
text {* Textbooks define Polish spaces as completely metrizable.
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   233
  We assume the topology to be complete for a given metric. *}
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   234
50881
ae630bab13da renamed countable_basis_space to second_countable_topology
hoelzl
parents: 50526
diff changeset
   235
class polish_space = complete_space + second_countable_topology
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   236
44517
68e8eb0ce8aa minimize imports
huffman
parents: 44516
diff changeset
   237
subsection {* General notion of a topology as a value *}
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   238
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   239
definition "istopology L \<longleftrightarrow> L {} \<and> (\<forall>S T. L S \<longrightarrow> L T \<longrightarrow> L (S \<inter> T)) \<and> (\<forall>K. Ball K L \<longrightarrow> L (\<Union> K))"
49834
b27bbb021df1 discontinued obsolete typedef (open) syntax;
wenzelm
parents: 49711
diff changeset
   240
typedef 'a topology = "{L::('a set) \<Rightarrow> bool. istopology L}"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   241
  morphisms "openin" "topology"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   242
  unfolding istopology_def by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   243
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   244
lemma istopology_open_in[intro]: "istopology(openin U)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   245
  using openin[of U] by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   246
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   247
lemma topology_inverse': "istopology U \<Longrightarrow> openin (topology U) = U"
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   248
  using topology_inverse[unfolded mem_Collect_eq] .
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   249
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   250
lemma topology_inverse_iff: "istopology U \<longleftrightarrow> openin (topology U) = U"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   251
  using topology_inverse[of U] istopology_open_in[of "topology U"] by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   252
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   253
lemma topology_eq: "T1 = T2 \<longleftrightarrow> (\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   254
proof-
49711
e5aaae7eadc9 tuned proofs;
wenzelm
parents: 48125
diff changeset
   255
  { assume "T1=T2"
e5aaae7eadc9 tuned proofs;
wenzelm
parents: 48125
diff changeset
   256
    hence "\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S" by simp }
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   257
  moreover
49711
e5aaae7eadc9 tuned proofs;
wenzelm
parents: 48125
diff changeset
   258
  { assume H: "\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S"
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   259
    hence "openin T1 = openin T2" by (simp add: fun_eq_iff)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   260
    hence "topology (openin T1) = topology (openin T2)" by simp
49711
e5aaae7eadc9 tuned proofs;
wenzelm
parents: 48125
diff changeset
   261
    hence "T1 = T2" unfolding openin_inverse .
e5aaae7eadc9 tuned proofs;
wenzelm
parents: 48125
diff changeset
   262
  }
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   263
  ultimately show ?thesis by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   264
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   265
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   266
text{* Infer the "universe" from union of all sets in the topology. *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   267
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   268
definition "topspace T =  \<Union>{S. openin T S}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   269
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   270
subsubsection {* Main properties of open sets *}
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   271
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   272
lemma openin_clauses:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   273
  fixes U :: "'a topology"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   274
  shows "openin U {}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   275
  "\<And>S T. openin U S \<Longrightarrow> openin U T \<Longrightarrow> openin U (S\<inter>T)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   276
  "\<And>K. (\<forall>S \<in> K. openin U S) \<Longrightarrow> openin U (\<Union>K)"
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   277
  using openin[of U] unfolding istopology_def mem_Collect_eq
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   278
  by fast+
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   279
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   280
lemma openin_subset[intro]: "openin U S \<Longrightarrow> S \<subseteq> topspace U"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   281
  unfolding topspace_def by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   282
lemma openin_empty[simp]: "openin U {}" by (simp add: openin_clauses)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   283
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   284
lemma openin_Int[intro]: "openin U S \<Longrightarrow> openin U T \<Longrightarrow> openin U (S \<inter> T)"
36362
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36360
diff changeset
   285
  using openin_clauses by simp
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36360
diff changeset
   286
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36360
diff changeset
   287
lemma openin_Union[intro]: "(\<forall>S \<in>K. openin U S) \<Longrightarrow> openin U (\<Union> K)"
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36360
diff changeset
   288
  using openin_clauses by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   289
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   290
lemma openin_Un[intro]: "openin U S \<Longrightarrow> openin U T \<Longrightarrow> openin U (S \<union> T)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   291
  using openin_Union[of "{S,T}" U] by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   292
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   293
lemma openin_topspace[intro, simp]: "openin U (topspace U)" by (simp add: openin_Union topspace_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   294
49711
e5aaae7eadc9 tuned proofs;
wenzelm
parents: 48125
diff changeset
   295
lemma openin_subopen: "openin U S \<longleftrightarrow> (\<forall>x \<in> S. \<exists>T. openin U T \<and> x \<in> T \<and> T \<subseteq> S)"
e5aaae7eadc9 tuned proofs;
wenzelm
parents: 48125
diff changeset
   296
  (is "?lhs \<longleftrightarrow> ?rhs")
36584
1535841fc2e9 prove lemma openin_subopen without using choice
huffman
parents: 36442
diff changeset
   297
proof
49711
e5aaae7eadc9 tuned proofs;
wenzelm
parents: 48125
diff changeset
   298
  assume ?lhs
e5aaae7eadc9 tuned proofs;
wenzelm
parents: 48125
diff changeset
   299
  then show ?rhs by auto
36584
1535841fc2e9 prove lemma openin_subopen without using choice
huffman
parents: 36442
diff changeset
   300
next
1535841fc2e9 prove lemma openin_subopen without using choice
huffman
parents: 36442
diff changeset
   301
  assume H: ?rhs
1535841fc2e9 prove lemma openin_subopen without using choice
huffman
parents: 36442
diff changeset
   302
  let ?t = "\<Union>{T. openin U T \<and> T \<subseteq> S}"
1535841fc2e9 prove lemma openin_subopen without using choice
huffman
parents: 36442
diff changeset
   303
  have "openin U ?t" by (simp add: openin_Union)
1535841fc2e9 prove lemma openin_subopen without using choice
huffman
parents: 36442
diff changeset
   304
  also have "?t = S" using H by auto
1535841fc2e9 prove lemma openin_subopen without using choice
huffman
parents: 36442
diff changeset
   305
  finally show "openin U S" .
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   306
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   307
49711
e5aaae7eadc9 tuned proofs;
wenzelm
parents: 48125
diff changeset
   308
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   309
subsubsection {* Closed sets *}
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   310
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   311
definition "closedin U S \<longleftrightarrow> S \<subseteq> topspace U \<and> openin U (topspace U - S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   312
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   313
lemma closedin_subset: "closedin U S \<Longrightarrow> S \<subseteq> topspace U" by (metis closedin_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   314
lemma closedin_empty[simp]: "closedin U {}" by (simp add: closedin_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   315
lemma closedin_topspace[intro,simp]:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   316
  "closedin U (topspace U)" by (simp add: closedin_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   317
lemma closedin_Un[intro]: "closedin U S \<Longrightarrow> closedin U T \<Longrightarrow> closedin U (S \<union> T)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   318
  by (auto simp add: Diff_Un closedin_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   319
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   320
lemma Diff_Inter[intro]: "A - \<Inter>S = \<Union> {A - s|s. s\<in>S}" by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   321
lemma closedin_Inter[intro]: assumes Ke: "K \<noteq> {}" and Kc: "\<forall>S \<in>K. closedin U S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   322
  shows "closedin U (\<Inter> K)"  using Ke Kc unfolding closedin_def Diff_Inter by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   323
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   324
lemma closedin_Int[intro]: "closedin U S \<Longrightarrow> closedin U T \<Longrightarrow> closedin U (S \<inter> T)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   325
  using closedin_Inter[of "{S,T}" U] by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   326
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   327
lemma Diff_Diff_Int: "A - (A - B) = A \<inter> B" by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   328
lemma openin_closedin_eq: "openin U S \<longleftrightarrow> S \<subseteq> topspace U \<and> closedin U (topspace U - S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   329
  apply (auto simp add: closedin_def Diff_Diff_Int inf_absorb2)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   330
  apply (metis openin_subset subset_eq)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   331
  done
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   332
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   333
lemma openin_closedin:  "S \<subseteq> topspace U \<Longrightarrow> (openin U S \<longleftrightarrow> closedin U (topspace U - S))"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   334
  by (simp add: openin_closedin_eq)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   335
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   336
lemma openin_diff[intro]: assumes oS: "openin U S" and cT: "closedin U T" shows "openin U (S - T)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   337
proof-
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   338
  have "S - T = S \<inter> (topspace U - T)" using openin_subset[of U S]  oS cT
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   339
    by (auto simp add: topspace_def openin_subset)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   340
  then show ?thesis using oS cT by (auto simp add: closedin_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   341
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   342
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   343
lemma closedin_diff[intro]: assumes oS: "closedin U S" and cT: "openin U T" shows "closedin U (S - T)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   344
proof-
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   345
  have "S - T = S \<inter> (topspace U - T)" using closedin_subset[of U S]  oS cT
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   346
    by (auto simp add: topspace_def )
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   347
  then show ?thesis using oS cT by (auto simp add: openin_closedin_eq)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   348
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   349
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   350
subsubsection {* Subspace topology *}
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   351
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   352
definition "subtopology U V = topology (\<lambda>T. \<exists>S. T = S \<inter> V \<and> openin U S)"
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   353
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   354
lemma istopology_subtopology: "istopology (\<lambda>T. \<exists>S. T = S \<inter> V \<and> openin U S)"
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   355
  (is "istopology ?L")
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   356
proof-
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   357
  have "?L {}" by blast
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   358
  {fix A B assume A: "?L A" and B: "?L B"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   359
    from A B obtain Sa and Sb where Sa: "openin U Sa" "A = Sa \<inter> V" and Sb: "openin U Sb" "B = Sb \<inter> V" by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   360
    have "A\<inter>B = (Sa \<inter> Sb) \<inter> V" "openin U (Sa \<inter> Sb)"  using Sa Sb by blast+
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   361
    then have "?L (A \<inter> B)" by blast}
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   362
  moreover
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   363
  {fix K assume K: "K \<subseteq> Collect ?L"
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   364
    have th0: "Collect ?L = (\<lambda>S. S \<inter> V) ` Collect (openin U)"
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39198
diff changeset
   365
      apply (rule set_eqI)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   366
      apply (simp add: Ball_def image_iff)
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   367
      by metis
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   368
    from K[unfolded th0 subset_image_iff]
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   369
    obtain Sk where Sk: "Sk \<subseteq> Collect (openin U)" "K = (\<lambda>S. S \<inter> V) ` Sk" by blast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   370
    have "\<Union>K = (\<Union>Sk) \<inter> V" using Sk by auto
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   371
    moreover have "openin U (\<Union> Sk)" using Sk by (auto simp add: subset_eq)
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   372
    ultimately have "?L (\<Union>K)" by blast}
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   373
  ultimately show ?thesis
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   374
    unfolding subset_eq mem_Collect_eq istopology_def by blast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   375
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   376
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   377
lemma openin_subtopology:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   378
  "openin (subtopology U V) S \<longleftrightarrow> (\<exists> T. (openin U T) \<and> (S = T \<inter> V))"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   379
  unfolding subtopology_def topology_inverse'[OF istopology_subtopology]
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   380
  by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   381
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   382
lemma topspace_subtopology: "topspace(subtopology U V) = topspace U \<inter> V"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   383
  by (auto simp add: topspace_def openin_subtopology)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   384
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   385
lemma closedin_subtopology:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   386
  "closedin (subtopology U V) S \<longleftrightarrow> (\<exists>T. closedin U T \<and> S = T \<inter> V)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   387
  unfolding closedin_def topspace_subtopology
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   388
  apply (simp add: openin_subtopology)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   389
  apply (rule iffI)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   390
  apply clarify
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   391
  apply (rule_tac x="topspace U - T" in exI)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   392
  by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   393
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   394
lemma openin_subtopology_refl: "openin (subtopology U V) V \<longleftrightarrow> V \<subseteq> topspace U"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   395
  unfolding openin_subtopology
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   396
  apply (rule iffI, clarify)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   397
  apply (frule openin_subset[of U])  apply blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   398
  apply (rule exI[where x="topspace U"])
49711
e5aaae7eadc9 tuned proofs;
wenzelm
parents: 48125
diff changeset
   399
  apply auto
e5aaae7eadc9 tuned proofs;
wenzelm
parents: 48125
diff changeset
   400
  done
e5aaae7eadc9 tuned proofs;
wenzelm
parents: 48125
diff changeset
   401
e5aaae7eadc9 tuned proofs;
wenzelm
parents: 48125
diff changeset
   402
lemma subtopology_superset:
e5aaae7eadc9 tuned proofs;
wenzelm
parents: 48125
diff changeset
   403
  assumes UV: "topspace U \<subseteq> V"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   404
  shows "subtopology U V = U"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   405
proof-
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   406
  {fix S
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   407
    {fix T assume T: "openin U T" "S = T \<inter> V"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   408
      from T openin_subset[OF T(1)] UV have eq: "S = T" by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   409
      have "openin U S" unfolding eq using T by blast}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   410
    moreover
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   411
    {assume S: "openin U S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   412
      hence "\<exists>T. openin U T \<and> S = T \<inter> V"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   413
        using openin_subset[OF S] UV by auto}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   414
    ultimately have "(\<exists>T. openin U T \<and> S = T \<inter> V) \<longleftrightarrow> openin U S" by blast}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   415
  then show ?thesis unfolding topology_eq openin_subtopology by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   416
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   417
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   418
lemma subtopology_topspace[simp]: "subtopology U (topspace U) = U"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   419
  by (simp add: subtopology_superset)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   420
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   421
lemma subtopology_UNIV[simp]: "subtopology U UNIV = U"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   422
  by (simp add: subtopology_superset)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   423
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   424
subsubsection {* The standard Euclidean topology *}
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   425
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   426
definition
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   427
  euclidean :: "'a::topological_space topology" where
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   428
  "euclidean = topology open"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   429
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   430
lemma open_openin: "open S \<longleftrightarrow> openin euclidean S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   431
  unfolding euclidean_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   432
  apply (rule cong[where x=S and y=S])
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   433
  apply (rule topology_inverse[symmetric])
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   434
  apply (auto simp add: istopology_def)
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   435
  done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   436
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   437
lemma topspace_euclidean: "topspace euclidean = UNIV"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   438
  apply (simp add: topspace_def)
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39198
diff changeset
   439
  apply (rule set_eqI)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   440
  by (auto simp add: open_openin[symmetric])
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   441
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   442
lemma topspace_euclidean_subtopology[simp]: "topspace (subtopology euclidean S) = S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   443
  by (simp add: topspace_euclidean topspace_subtopology)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   444
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   445
lemma closed_closedin: "closed S \<longleftrightarrow> closedin euclidean S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   446
  by (simp add: closed_def closedin_def topspace_euclidean open_openin Compl_eq_Diff_UNIV)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   447
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   448
lemma open_subopen: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>T. open T \<and> x \<in> T \<and> T \<subseteq> S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   449
  by (simp add: open_openin openin_subopen[symmetric])
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   450
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   451
text {* Basic "localization" results are handy for connectedness. *}
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   452
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   453
lemma openin_open: "openin (subtopology euclidean U) S \<longleftrightarrow> (\<exists>T. open T \<and> (S = U \<inter> T))"
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   454
  by (auto simp add: openin_subtopology open_openin[symmetric])
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   455
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   456
lemma openin_open_Int[intro]: "open S \<Longrightarrow> openin (subtopology euclidean U) (U \<inter> S)"
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   457
  by (auto simp add: openin_open)
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   458
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   459
lemma open_openin_trans[trans]:
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   460
 "open S \<Longrightarrow> open T \<Longrightarrow> T \<subseteq> S \<Longrightarrow> openin (subtopology euclidean S) T"
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   461
  by (metis Int_absorb1  openin_open_Int)
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   462
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   463
lemma open_subset:  "S \<subseteq> T \<Longrightarrow> open S \<Longrightarrow> openin (subtopology euclidean T) S"
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   464
  by (auto simp add: openin_open)
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   465
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   466
lemma closedin_closed: "closedin (subtopology euclidean U) S \<longleftrightarrow> (\<exists>T. closed T \<and> S = U \<inter> T)"
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   467
  by (simp add: closedin_subtopology closed_closedin Int_ac)
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   468
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   469
lemma closedin_closed_Int: "closed S ==> closedin (subtopology euclidean U) (U \<inter> S)"
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   470
  by (metis closedin_closed)
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   471
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   472
lemma closed_closedin_trans: "closed S \<Longrightarrow> closed T \<Longrightarrow> T \<subseteq> S \<Longrightarrow> closedin (subtopology euclidean S) T"
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   473
  apply (subgoal_tac "S \<inter> T = T" )
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   474
  apply auto
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   475
  apply (frule closedin_closed_Int[of T S])
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   476
  by simp
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   477
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   478
lemma closed_subset: "S \<subseteq> T \<Longrightarrow> closed S \<Longrightarrow> closedin (subtopology euclidean T) S"
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   479
  by (auto simp add: closedin_closed)
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   480
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   481
lemma openin_euclidean_subtopology_iff:
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   482
  fixes S U :: "'a::metric_space set"
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   483
  shows "openin (subtopology euclidean U) S
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   484
  \<longleftrightarrow> S \<subseteq> U \<and> (\<forall>x\<in>S. \<exists>e>0. \<forall>x'\<in>U. dist x' x < e \<longrightarrow> x'\<in> S)" (is "?lhs \<longleftrightarrow> ?rhs")
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   485
proof
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   486
  assume ?lhs thus ?rhs unfolding openin_open open_dist by blast
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   487
next
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   488
  def T \<equiv> "{x. \<exists>a\<in>S. \<exists>d>0. (\<forall>y\<in>U. dist y a < d \<longrightarrow> y \<in> S) \<and> dist x a < d}"
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   489
  have 1: "\<forall>x\<in>T. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> T"
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   490
    unfolding T_def
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   491
    apply clarsimp
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   492
    apply (rule_tac x="d - dist x a" in exI)
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   493
    apply (clarsimp simp add: less_diff_eq)
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   494
    apply (erule rev_bexI)
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   495
    apply (rule_tac x=d in exI, clarify)
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   496
    apply (erule le_less_trans [OF dist_triangle])
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   497
    done
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   498
  assume ?rhs hence 2: "S = U \<inter> T"
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   499
    unfolding T_def
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   500
    apply auto
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   501
    apply (drule (1) bspec, erule rev_bexI)
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   502
    apply auto
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   503
    done
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   504
  from 1 2 show ?lhs
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   505
    unfolding openin_open open_dist by fast
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   506
qed
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   507
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   508
text {* These "transitivity" results are handy too *}
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   509
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   510
lemma openin_trans[trans]: "openin (subtopology euclidean T) S \<Longrightarrow> openin (subtopology euclidean U) T
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   511
  \<Longrightarrow> openin (subtopology euclidean U) S"
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   512
  unfolding open_openin openin_open by blast
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   513
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   514
lemma openin_open_trans: "openin (subtopology euclidean T) S \<Longrightarrow> open T \<Longrightarrow> open S"
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   515
  by (auto simp add: openin_open intro: openin_trans)
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   516
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   517
lemma closedin_trans[trans]:
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   518
 "closedin (subtopology euclidean T) S \<Longrightarrow>
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   519
           closedin (subtopology euclidean U) T
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   520
           ==> closedin (subtopology euclidean U) S"
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   521
  by (auto simp add: closedin_closed closed_closedin closed_Inter Int_assoc)
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   522
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   523
lemma closedin_closed_trans: "closedin (subtopology euclidean T) S \<Longrightarrow> closed T \<Longrightarrow> closed S"
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   524
  by (auto simp add: closedin_closed intro: closedin_trans)
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   525
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   526
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   527
subsection {* Open and closed balls *}
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   528
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   529
definition
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   530
  ball :: "'a::metric_space \<Rightarrow> real \<Rightarrow> 'a set" where
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   531
  "ball x e = {y. dist x y < e}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   532
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   533
definition
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   534
  cball :: "'a::metric_space \<Rightarrow> real \<Rightarrow> 'a set" where
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   535
  "cball x e = {y. dist x y \<le> e}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   536
45776
714100f5fda4 remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
huffman
parents: 45548
diff changeset
   537
lemma mem_ball [simp]: "y \<in> ball x e \<longleftrightarrow> dist x y < e"
714100f5fda4 remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
huffman
parents: 45548
diff changeset
   538
  by (simp add: ball_def)
714100f5fda4 remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
huffman
parents: 45548
diff changeset
   539
714100f5fda4 remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
huffman
parents: 45548
diff changeset
   540
lemma mem_cball [simp]: "y \<in> cball x e \<longleftrightarrow> dist x y \<le> e"
714100f5fda4 remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
huffman
parents: 45548
diff changeset
   541
  by (simp add: cball_def)
714100f5fda4 remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
huffman
parents: 45548
diff changeset
   542
714100f5fda4 remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
huffman
parents: 45548
diff changeset
   543
lemma mem_ball_0:
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   544
  fixes x :: "'a::real_normed_vector"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   545
  shows "x \<in> ball 0 e \<longleftrightarrow> norm x < e"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   546
  by (simp add: dist_norm)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   547
45776
714100f5fda4 remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
huffman
parents: 45548
diff changeset
   548
lemma mem_cball_0:
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   549
  fixes x :: "'a::real_normed_vector"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   550
  shows "x \<in> cball 0 e \<longleftrightarrow> norm x \<le> e"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   551
  by (simp add: dist_norm)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   552
45776
714100f5fda4 remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
huffman
parents: 45548
diff changeset
   553
lemma centre_in_ball: "x \<in> ball x e \<longleftrightarrow> 0 < e"
714100f5fda4 remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
huffman
parents: 45548
diff changeset
   554
  by simp
714100f5fda4 remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
huffman
parents: 45548
diff changeset
   555
714100f5fda4 remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
huffman
parents: 45548
diff changeset
   556
lemma centre_in_cball: "x \<in> cball x e \<longleftrightarrow> 0 \<le> e"
714100f5fda4 remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
huffman
parents: 45548
diff changeset
   557
  by simp
714100f5fda4 remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
huffman
parents: 45548
diff changeset
   558
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   559
lemma ball_subset_cball[simp,intro]: "ball x e \<subseteq> cball x e" by (simp add: subset_eq)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   560
lemma subset_ball[intro]: "d <= e ==> ball x d \<subseteq> ball x e" by (simp add: subset_eq)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   561
lemma subset_cball[intro]: "d <= e ==> cball x d \<subseteq> cball x e" by (simp add: subset_eq)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   562
lemma ball_max_Un: "ball a (max r s) = ball a r \<union> ball a s"
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39198
diff changeset
   563
  by (simp add: set_eq_iff) arith
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   564
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   565
lemma ball_min_Int: "ball a (min r s) = ball a r \<inter> ball a s"
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39198
diff changeset
   566
  by (simp add: set_eq_iff)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   567
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   568
lemma diff_less_iff: "(a::real) - b > 0 \<longleftrightarrow> a > b"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   569
  "(a::real) - b < 0 \<longleftrightarrow> a < b"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   570
  "a - b < c \<longleftrightarrow> a < c +b" "a - b > c \<longleftrightarrow> a > c +b" by arith+
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   571
lemma diff_le_iff: "(a::real) - b \<ge> 0 \<longleftrightarrow> a \<ge> b" "(a::real) - b \<le> 0 \<longleftrightarrow> a \<le> b"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   572
  "a - b \<le> c \<longleftrightarrow> a \<le> c +b" "a - b \<ge> c \<longleftrightarrow> a \<ge> c +b"  by arith+
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   573
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   574
lemma open_ball[intro, simp]: "open (ball x e)"
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   575
  unfolding open_dist ball_def mem_Collect_eq Ball_def
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   576
  unfolding dist_commute
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   577
  apply clarify
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   578
  apply (rule_tac x="e - dist xa x" in exI)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   579
  using dist_triangle_alt[where z=x]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   580
  apply (clarsimp simp add: diff_less_iff)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   581
  apply atomize
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   582
  apply (erule_tac x="y" in allE)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   583
  apply (erule_tac x="xa" in allE)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   584
  by arith
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   585
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   586
lemma open_contains_ball: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e>0. ball x e \<subseteq> S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   587
  unfolding open_dist subset_eq mem_ball Ball_def dist_commute ..
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   588
33714
eb2574ac4173 Added new lemmas to Euclidean Space by Robert Himmelmann
hoelzl
parents: 33324
diff changeset
   589
lemma openE[elim?]:
eb2574ac4173 Added new lemmas to Euclidean Space by Robert Himmelmann
hoelzl
parents: 33324
diff changeset
   590
  assumes "open S" "x\<in>S" 
eb2574ac4173 Added new lemmas to Euclidean Space by Robert Himmelmann
hoelzl
parents: 33324
diff changeset
   591
  obtains e where "e>0" "ball x e \<subseteq> S"
eb2574ac4173 Added new lemmas to Euclidean Space by Robert Himmelmann
hoelzl
parents: 33324
diff changeset
   592
  using assms unfolding open_contains_ball by auto
eb2574ac4173 Added new lemmas to Euclidean Space by Robert Himmelmann
hoelzl
parents: 33324
diff changeset
   593
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   594
lemma open_contains_ball_eq: "open S \<Longrightarrow> \<forall>x. x\<in>S \<longleftrightarrow> (\<exists>e>0. ball x e \<subseteq> S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   595
  by (metis open_contains_ball subset_eq centre_in_ball)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   596
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   597
lemma ball_eq_empty[simp]: "ball x e = {} \<longleftrightarrow> e \<le> 0"
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39198
diff changeset
   598
  unfolding mem_ball set_eq_iff
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   599
  apply (simp add: not_less)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   600
  by (metis zero_le_dist order_trans dist_self)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   601
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   602
lemma ball_empty[intro]: "e \<le> 0 ==> ball x e = {}" by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   603
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   604
lemma euclidean_dist_l2:
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   605
  fixes x y :: "'a :: euclidean_space"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   606
  shows "dist x y = setL2 (\<lambda>i. dist (x \<bullet> i) (y \<bullet> i)) Basis"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   607
  unfolding dist_norm norm_eq_sqrt_inner setL2_def
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   608
  by (subst euclidean_inner) (simp add: power2_eq_square inner_diff_left)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   609
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   610
definition "box a b = {x. \<forall>i\<in>Basis. a \<bullet> i < x \<bullet> i \<and> x \<bullet> i < b \<bullet> i}"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   611
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   612
lemma rational_boxes:
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   613
  fixes x :: "'a\<Colon>euclidean_space"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   614
  assumes "0 < e"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   615
  shows "\<exists>a b. (\<forall>i\<in>Basis. a \<bullet> i \<in> \<rat> \<and> b \<bullet> i \<in> \<rat> ) \<and> x \<in> box a b \<and> box a b \<subseteq> ball x e"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   616
proof -
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   617
  def e' \<equiv> "e / (2 * sqrt (real (DIM ('a))))"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   618
  then have e: "0 < e'" using assms by (auto intro!: divide_pos_pos simp: DIM_positive)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   619
  have "\<forall>i. \<exists>y. y \<in> \<rat> \<and> y < x \<bullet> i \<and> x \<bullet> i - y < e'" (is "\<forall>i. ?th i")
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   620
  proof
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   621
    fix i from Rats_dense_in_real[of "x \<bullet> i - e'" "x \<bullet> i"] e show "?th i" by auto
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   622
  qed
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   623
  from choice[OF this] guess a .. note a = this
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   624
  have "\<forall>i. \<exists>y. y \<in> \<rat> \<and> x \<bullet> i < y \<and> y - x \<bullet> i < e'" (is "\<forall>i. ?th i")
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   625
  proof
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   626
    fix i from Rats_dense_in_real[of "x \<bullet> i" "x \<bullet> i + e'"] e show "?th i" by auto
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   627
  qed
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   628
  from choice[OF this] guess b .. note b = this
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   629
  let ?a = "\<Sum>i\<in>Basis. a i *\<^sub>R i" and ?b = "\<Sum>i\<in>Basis. b i *\<^sub>R i"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   630
  show ?thesis
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   631
  proof (rule exI[of _ ?a], rule exI[of _ ?b], safe)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   632
    fix y :: 'a assume *: "y \<in> box ?a ?b"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   633
    have "dist x y = sqrt (\<Sum>i\<in>Basis. (dist (x \<bullet> i) (y \<bullet> i))\<twosuperior>)"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   634
      unfolding setL2_def[symmetric] by (rule euclidean_dist_l2)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   635
    also have "\<dots> < sqrt (\<Sum>(i::'a)\<in>Basis. e^2 / real (DIM('a)))"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   636
    proof (rule real_sqrt_less_mono, rule setsum_strict_mono)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   637
      fix i :: "'a" assume i: "i \<in> Basis"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   638
      have "a i < y\<bullet>i \<and> y\<bullet>i < b i" using * i by (auto simp: box_def)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   639
      moreover have "a i < x\<bullet>i" "x\<bullet>i - a i < e'" using a by auto
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   640
      moreover have "x\<bullet>i < b i" "b i - x\<bullet>i < e'" using b by auto
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   641
      ultimately have "\<bar>x\<bullet>i - y\<bullet>i\<bar> < 2 * e'" by auto
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   642
      then have "dist (x \<bullet> i) (y \<bullet> i) < e/sqrt (real (DIM('a)))"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   643
        unfolding e'_def by (auto simp: dist_real_def)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   644
      then have "(dist (x \<bullet> i) (y \<bullet> i))\<twosuperior> < (e/sqrt (real (DIM('a))))\<twosuperior>"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   645
        by (rule power_strict_mono) auto
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   646
      then show "(dist (x \<bullet> i) (y \<bullet> i))\<twosuperior> < e\<twosuperior> / real DIM('a)"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   647
        by (simp add: power_divide)
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   648
    qed auto
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   649
    also have "\<dots> = e" using `0 < e` by (simp add: real_eq_of_nat)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   650
    finally show "y \<in> ball x e" by (auto simp: ball_def)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   651
  qed (insert a b, auto simp: box_def)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   652
qed
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   653
 
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   654
lemma open_UNION_box:
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   655
  fixes M :: "'a\<Colon>euclidean_space set"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   656
  assumes "open M" 
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   657
  defines "a' \<equiv> \<lambda>f :: 'a \<Rightarrow> real \<times> real. (\<Sum>(i::'a)\<in>Basis. fst (f i) *\<^sub>R i)"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   658
  defines "b' \<equiv> \<lambda>f :: 'a \<Rightarrow> real \<times> real. (\<Sum>(i::'a)\<in>Basis. snd (f i) *\<^sub>R i)"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   659
  defines "I \<equiv> {f\<in>Basis \<rightarrow>\<^isub>E \<rat> \<times> \<rat>. box (a' f) (b' f) \<subseteq> M}"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   660
  shows "M = (\<Union>f\<in>I. box (a' f) (b' f))"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   661
proof safe
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   662
  fix x assume "x \<in> M"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   663
  obtain e where e: "e > 0" "ball x e \<subseteq> M"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   664
    using openE[OF `open M` `x \<in> M`] by auto
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   665
  moreover then obtain a b where ab: "x \<in> box a b"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   666
    "\<forall>i \<in> Basis. a \<bullet> i \<in> \<rat>" "\<forall>i\<in>Basis. b \<bullet> i \<in> \<rat>" "box a b \<subseteq> ball x e"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   667
    using rational_boxes[OF e(1)] by metis
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   668
  ultimately show "x \<in> (\<Union>f\<in>I. box (a' f) (b' f))"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   669
     by (intro UN_I[of "\<lambda>i\<in>Basis. (a \<bullet> i, b \<bullet> i)"])
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   670
        (auto simp: euclidean_representation I_def a'_def b'_def)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   671
qed (auto simp: I_def)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   672
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   673
subsection{* Connectedness *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   674
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   675
definition "connected S \<longleftrightarrow>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   676
  ~(\<exists>e1 e2. open e1 \<and> open e2 \<and> S \<subseteq> (e1 \<union> e2) \<and> (e1 \<inter> e2 \<inter> S = {})
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   677
  \<and> ~(e1 \<inter> S = {}) \<and> ~(e2 \<inter> S = {}))"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   678
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   679
lemma connected_local:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   680
 "connected S \<longleftrightarrow> ~(\<exists>e1 e2.
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   681
                 openin (subtopology euclidean S) e1 \<and>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   682
                 openin (subtopology euclidean S) e2 \<and>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   683
                 S \<subseteq> e1 \<union> e2 \<and>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   684
                 e1 \<inter> e2 = {} \<and>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   685
                 ~(e1 = {}) \<and>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   686
                 ~(e2 = {}))"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   687
unfolding connected_def openin_open by (safe, blast+)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   688
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   689
lemma exists_diff:
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   690
  fixes P :: "'a set \<Rightarrow> bool"
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   691
  shows "(\<exists>S. P(- S)) \<longleftrightarrow> (\<exists>S. P S)" (is "?lhs \<longleftrightarrow> ?rhs")
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   692
proof-
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   693
  {assume "?lhs" hence ?rhs by blast }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   694
  moreover
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   695
  {fix S assume H: "P S"
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   696
    have "S = - (- S)" by auto
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   697
    with H have "P (- (- S))" by metis }
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   698
  ultimately show ?thesis by metis
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   699
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   700
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   701
lemma connected_clopen: "connected S \<longleftrightarrow>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   702
        (\<forall>T. openin (subtopology euclidean S) T \<and>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   703
            closedin (subtopology euclidean S) T \<longrightarrow> T = {} \<or> T = S)" (is "?lhs \<longleftrightarrow> ?rhs")
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   704
proof-
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   705
  have " \<not> connected S \<longleftrightarrow> (\<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> {})"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   706
    unfolding connected_def openin_open closedin_closed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   707
    apply (subst exists_diff) by blast
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   708
  hence th0: "connected S \<longleftrightarrow> \<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> {})"
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   709
    (is " _ \<longleftrightarrow> \<not> (\<exists>e2 e1. ?P e2 e1)") apply (simp add: closed_def) by metis
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   710
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   711
  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'))"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   712
    (is "_ \<longleftrightarrow> \<not> (\<exists>t' t. ?Q t' t)")
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   713
    unfolding connected_def openin_open closedin_closed by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   714
  {fix e2
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   715
    {fix e1 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)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   716
        by auto}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   717
    then have "(\<exists>e1. ?P e2 e1) \<longleftrightarrow> (\<exists>t. ?Q e2 t)" by metis}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   718
  then have "\<forall>e2. (\<exists>e1. ?P e2 e1) \<longleftrightarrow> (\<exists>t. ?Q e2 t)" by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   719
  then show ?thesis unfolding th0 th1 by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   720
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   721
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   722
lemma connected_empty[simp, intro]: "connected {}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   723
  by (simp add: connected_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   724
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   725
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   726
subsection{* Limit points *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   727
44207
ea99698c2070 locale-ize some definitions, so perfect_space and heine_borel can inherit from the proper superclasses
huffman
parents: 44170
diff changeset
   728
definition (in topological_space)
ea99698c2070 locale-ize some definitions, so perfect_space and heine_borel can inherit from the proper superclasses
huffman
parents: 44170
diff changeset
   729
  islimpt:: "'a \<Rightarrow> 'a set \<Rightarrow> bool" (infixr "islimpt" 60) where
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   730
  "x islimpt S \<longleftrightarrow> (\<forall>T. x\<in>T \<longrightarrow> open T \<longrightarrow> (\<exists>y\<in>S. y\<in>T \<and> y\<noteq>x))"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   731
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   732
lemma islimptI:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   733
  assumes "\<And>T. x \<in> T \<Longrightarrow> open T \<Longrightarrow> \<exists>y\<in>S. y \<in> T \<and> y \<noteq> x"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   734
  shows "x islimpt S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   735
  using assms unfolding islimpt_def by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   736
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   737
lemma islimptE:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   738
  assumes "x islimpt S" and "x \<in> T" and "open T"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   739
  obtains y where "y \<in> S" and "y \<in> T" and "y \<noteq> x"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   740
  using assms unfolding islimpt_def by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   741
44584
08ad27488983 simplify some proofs
huffman
parents: 44571
diff changeset
   742
lemma islimpt_iff_eventually: "x islimpt S \<longleftrightarrow> \<not> eventually (\<lambda>y. y \<notin> S) (at x)"
08ad27488983 simplify some proofs
huffman
parents: 44571
diff changeset
   743
  unfolding islimpt_def eventually_at_topological by auto
08ad27488983 simplify some proofs
huffman
parents: 44571
diff changeset
   744
08ad27488983 simplify some proofs
huffman
parents: 44571
diff changeset
   745
lemma islimpt_subset: "\<lbrakk>x islimpt S; S \<subseteq> T\<rbrakk> \<Longrightarrow> x islimpt T"
08ad27488983 simplify some proofs
huffman
parents: 44571
diff changeset
   746
  unfolding islimpt_def by fast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   747
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   748
lemma islimpt_approachable:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   749
  fixes x :: "'a::metric_space"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   750
  shows "x islimpt S \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e)"
44584
08ad27488983 simplify some proofs
huffman
parents: 44571
diff changeset
   751
  unfolding islimpt_iff_eventually eventually_at by fast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   752
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   753
lemma islimpt_approachable_le:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   754
  fixes x :: "'a::metric_space"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   755
  shows "x islimpt S \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in> S. x' \<noteq> x \<and> dist x' x <= e)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   756
  unfolding islimpt_approachable
44584
08ad27488983 simplify some proofs
huffman
parents: 44571
diff changeset
   757
  using approachable_lt_le [where f="\<lambda>y. dist y x" and P="\<lambda>y. y \<notin> S \<or> y = x",
08ad27488983 simplify some proofs
huffman
parents: 44571
diff changeset
   758
    THEN arg_cong [where f=Not]]
08ad27488983 simplify some proofs
huffman
parents: 44571
diff changeset
   759
  by (simp add: Bex_def conj_commute conj_left_commute)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   760
44571
bd91b77c4cd6 move class perfect_space into RealVector.thy;
huffman
parents: 44568
diff changeset
   761
lemma islimpt_UNIV_iff: "x islimpt UNIV \<longleftrightarrow> \<not> open {x}"
bd91b77c4cd6 move class perfect_space into RealVector.thy;
huffman
parents: 44568
diff changeset
   762
  unfolding islimpt_def by (safe, fast, case_tac "T = {x}", fast, fast)
bd91b77c4cd6 move class perfect_space into RealVector.thy;
huffman
parents: 44568
diff changeset
   763
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   764
text {* A perfect space has no isolated points. *}
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   765
44571
bd91b77c4cd6 move class perfect_space into RealVector.thy;
huffman
parents: 44568
diff changeset
   766
lemma islimpt_UNIV [simp, intro]: "(x::'a::perfect_space) islimpt UNIV"
bd91b77c4cd6 move class perfect_space into RealVector.thy;
huffman
parents: 44568
diff changeset
   767
  unfolding islimpt_UNIV_iff by (rule not_open_singleton)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   768
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   769
lemma perfect_choose_dist:
44072
5b970711fb39 class perfect_space inherits from topological_space;
huffman
parents: 43338
diff changeset
   770
  fixes x :: "'a::{perfect_space, metric_space}"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   771
  shows "0 < r \<Longrightarrow> \<exists>a. a \<noteq> x \<and> dist a x < r"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   772
using islimpt_UNIV [of x]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   773
by (simp add: islimpt_approachable)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   774
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   775
lemma closed_limpt: "closed S \<longleftrightarrow> (\<forall>x. x islimpt S \<longrightarrow> x \<in> S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   776
  unfolding closed_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   777
  apply (subst open_subopen)
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   778
  apply (simp add: islimpt_def subset_eq)
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   779
  by (metis ComplE ComplI)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   780
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   781
lemma islimpt_EMPTY[simp]: "\<not> x islimpt {}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   782
  unfolding islimpt_def by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   783
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   784
lemma finite_set_avoid:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   785
  fixes a :: "'a::metric_space"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   786
  assumes fS: "finite S" shows  "\<exists>d>0. \<forall>x\<in>S. x \<noteq> a \<longrightarrow> d <= dist a x"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   787
proof(induct rule: finite_induct[OF fS])
41863
e5104b436ea1 removed dependency on Dense_Linear_Order
boehmes
parents: 41413
diff changeset
   788
  case 1 thus ?case by (auto intro: zero_less_one)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   789
next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   790
  case (2 x F)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   791
  from 2 obtain d where d: "d >0" "\<forall>x\<in>F. x\<noteq>a \<longrightarrow> d \<le> dist a x" by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   792
  {assume "x = a" hence ?case using d by auto  }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   793
  moreover
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   794
  {assume xa: "x\<noteq>a"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   795
    let ?d = "min d (dist a x)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   796
    have dp: "?d > 0" using xa d(1) using dist_nz by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   797
    from d have d': "\<forall>x\<in>F. x\<noteq>a \<longrightarrow> ?d \<le> dist a x" by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   798
    with dp xa have ?case by(auto intro!: exI[where x="?d"]) }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   799
  ultimately show ?case by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   800
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   801
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   802
lemma islimpt_finite:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   803
  fixes S :: "'a::metric_space set"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   804
  assumes fS: "finite S" shows "\<not> a islimpt S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   805
  unfolding islimpt_approachable
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   806
  using finite_set_avoid[OF fS, of a] by (metis dist_commute  not_le)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   807
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   808
lemma islimpt_Un: "x islimpt (S \<union> T) \<longleftrightarrow> x islimpt S \<or> x islimpt T"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   809
  apply (rule iffI)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   810
  defer
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   811
  apply (metis Un_upper1 Un_upper2 islimpt_subset)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   812
  unfolding islimpt_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   813
  apply (rule ccontr, clarsimp, rename_tac A B)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   814
  apply (drule_tac x="A \<inter> B" in spec)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   815
  apply (auto simp add: open_Int)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   816
  done
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   817
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   818
lemma discrete_imp_closed:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   819
  fixes S :: "'a::metric_space set"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   820
  assumes e: "0 < e" and d: "\<forall>x \<in> S. \<forall>y \<in> S. dist y x < e \<longrightarrow> y = x"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   821
  shows "closed S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   822
proof-
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   823
  {fix x assume C: "\<forall>e>0. \<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   824
    from e have e2: "e/2 > 0" by arith
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   825
    from C[rule_format, OF e2] obtain y where y: "y \<in> S" "y\<noteq>x" "dist y x < e/2" by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   826
    let ?m = "min (e/2) (dist x y) "
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   827
    from e2 y(2) have mp: "?m > 0" by (simp add: dist_nz[THEN sym])
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   828
    from C[rule_format, OF mp] obtain z where z: "z \<in> S" "z\<noteq>x" "dist z x < ?m" by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   829
    have th: "dist z y < e" using z y
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   830
      by (intro dist_triangle_lt [where z=x], simp)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   831
    from d[rule_format, OF y(1) z(1) th] y z
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   832
    have False by (auto simp add: dist_commute)}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   833
  then show ?thesis by (metis islimpt_approachable closed_limpt [where 'a='a])
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   834
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   835
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   836
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   837
subsection {* Interior of a Set *}
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   838
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   839
definition "interior S = \<Union>{T. open T \<and> T \<subseteq> S}"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   840
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   841
lemma interiorI [intro?]:
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   842
  assumes "open T" and "x \<in> T" and "T \<subseteq> S"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   843
  shows "x \<in> interior S"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   844
  using assms unfolding interior_def by fast
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   845
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   846
lemma interiorE [elim?]:
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   847
  assumes "x \<in> interior S"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   848
  obtains T where "open T" and "x \<in> T" and "T \<subseteq> S"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   849
  using assms unfolding interior_def by fast
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   850
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   851
lemma open_interior [simp, intro]: "open (interior S)"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   852
  by (simp add: interior_def open_Union)
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   853
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   854
lemma interior_subset: "interior S \<subseteq> S"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   855
  by (auto simp add: interior_def)
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   856
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   857
lemma interior_maximal: "T \<subseteq> S \<Longrightarrow> open T \<Longrightarrow> T \<subseteq> interior S"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   858
  by (auto simp add: interior_def)
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   859
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   860
lemma interior_open: "open S \<Longrightarrow> interior S = S"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   861
  by (intro equalityI interior_subset interior_maximal subset_refl)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   862
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   863
lemma interior_eq: "interior S = S \<longleftrightarrow> open S"
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   864
  by (metis open_interior interior_open)
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   865
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   866
lemma open_subset_interior: "open S \<Longrightarrow> S \<subseteq> interior T \<longleftrightarrow> S \<subseteq> T"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   867
  by (metis interior_maximal interior_subset subset_trans)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   868
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   869
lemma interior_empty [simp]: "interior {} = {}"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   870
  using open_empty by (rule interior_open)
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   871
44522
2f7e9d890efe rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents: 44519
diff changeset
   872
lemma interior_UNIV [simp]: "interior UNIV = UNIV"
2f7e9d890efe rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents: 44519
diff changeset
   873
  using open_UNIV by (rule interior_open)
2f7e9d890efe rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents: 44519
diff changeset
   874
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   875
lemma interior_interior [simp]: "interior (interior S) = interior S"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   876
  using open_interior by (rule interior_open)
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   877
44522
2f7e9d890efe rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents: 44519
diff changeset
   878
lemma interior_mono: "S \<subseteq> T \<Longrightarrow> interior S \<subseteq> interior T"
2f7e9d890efe rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents: 44519
diff changeset
   879
  by (auto simp add: interior_def)
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   880
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   881
lemma interior_unique:
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   882
  assumes "T \<subseteq> S" and "open T"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   883
  assumes "\<And>T'. T' \<subseteq> S \<Longrightarrow> open T' \<Longrightarrow> T' \<subseteq> T"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   884
  shows "interior S = T"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   885
  by (intro equalityI assms interior_subset open_interior interior_maximal)
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   886
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   887
lemma interior_inter [simp]: "interior (S \<inter> T) = interior S \<inter> interior T"
44522
2f7e9d890efe rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents: 44519
diff changeset
   888
  by (intro equalityI Int_mono Int_greatest interior_mono Int_lower1
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   889
    Int_lower2 interior_maximal interior_subset open_Int open_interior)
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   890
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   891
lemma mem_interior: "x \<in> interior S \<longleftrightarrow> (\<exists>e>0. ball x e \<subseteq> S)"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   892
  using open_contains_ball_eq [where S="interior S"]
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   893
  by (simp add: open_subset_interior)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   894
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   895
lemma interior_limit_point [intro]:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   896
  fixes x :: "'a::perfect_space"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   897
  assumes x: "x \<in> interior S" shows "x islimpt S"
44072
5b970711fb39 class perfect_space inherits from topological_space;
huffman
parents: 43338
diff changeset
   898
  using x islimpt_UNIV [of x]
5b970711fb39 class perfect_space inherits from topological_space;
huffman
parents: 43338
diff changeset
   899
  unfolding interior_def islimpt_def
5b970711fb39 class perfect_space inherits from topological_space;
huffman
parents: 43338
diff changeset
   900
  apply (clarsimp, rename_tac T T')
5b970711fb39 class perfect_space inherits from topological_space;
huffman
parents: 43338
diff changeset
   901
  apply (drule_tac x="T \<inter> T'" in spec)
5b970711fb39 class perfect_space inherits from topological_space;
huffman
parents: 43338
diff changeset
   902
  apply (auto simp add: open_Int)
5b970711fb39 class perfect_space inherits from topological_space;
huffman
parents: 43338
diff changeset
   903
  done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   904
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   905
lemma interior_closed_Un_empty_interior:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   906
  assumes cS: "closed S" and iT: "interior T = {}"
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   907
  shows "interior (S \<union> T) = interior S"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   908
proof
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   909
  show "interior S \<subseteq> interior (S \<union> T)"
44522
2f7e9d890efe rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents: 44519
diff changeset
   910
    by (rule interior_mono, rule Un_upper1)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   911
next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   912
  show "interior (S \<union> T) \<subseteq> interior S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   913
  proof
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   914
    fix x assume "x \<in> interior (S \<union> T)"
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   915
    then obtain R where "open R" "x \<in> R" "R \<subseteq> S \<union> T" ..
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   916
    show "x \<in> interior S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   917
    proof (rule ccontr)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   918
      assume "x \<notin> interior S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   919
      with `x \<in> R` `open R` obtain y where "y \<in> R - S"
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   920
        unfolding interior_def by fast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   921
      from `open R` `closed S` have "open (R - S)" by (rule open_Diff)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   922
      from `R \<subseteq> S \<union> T` have "R - S \<subseteq> T" by fast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   923
      from `y \<in> R - S` `open (R - S)` `R - S \<subseteq> T` `interior T = {}`
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   924
      show "False" unfolding interior_def by fast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   925
    qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   926
  qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   927
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   928
44365
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
   929
lemma interior_Times: "interior (A \<times> B) = interior A \<times> interior B"
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
   930
proof (rule interior_unique)
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
   931
  show "interior A \<times> interior B \<subseteq> A \<times> B"
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
   932
    by (intro Sigma_mono interior_subset)
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
   933
  show "open (interior A \<times> interior B)"
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
   934
    by (intro open_Times open_interior)
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   935
  fix T assume "T \<subseteq> A \<times> B" and "open T" thus "T \<subseteq> interior A \<times> interior B"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   936
  proof (safe)
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   937
    fix x y assume "(x, y) \<in> T"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   938
    then obtain C D where "open C" "open D" "C \<times> D \<subseteq> T" "x \<in> C" "y \<in> D"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   939
      using `open T` unfolding open_prod_def by fast
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   940
    hence "open C" "open D" "C \<subseteq> A" "D \<subseteq> B" "x \<in> C" "y \<in> D"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   941
      using `T \<subseteq> A \<times> B` by auto
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   942
    thus "x \<in> interior A" and "y \<in> interior B"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   943
      by (auto intro: interiorI)
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   944
  qed
44365
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
   945
qed
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
   946
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   947
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   948
subsection {* Closure of a Set *}
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   949
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   950
definition "closure S = S \<union> {x | x. x islimpt S}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   951
44518
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
   952
lemma interior_closure: "interior S = - (closure (- S))"
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
   953
  unfolding interior_def closure_def islimpt_def by auto
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
   954
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   955
lemma closure_interior: "closure S = - interior (- S)"
44518
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
   956
  unfolding interior_closure by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   957
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   958
lemma closed_closure[simp, intro]: "closed (closure S)"
44518
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
   959
  unfolding closure_interior by (simp add: closed_Compl)
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
   960
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
   961
lemma closure_subset: "S \<subseteq> closure S"
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
   962
  unfolding closure_def by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   963
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   964
lemma closure_hull: "closure S = closed hull S"
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   965
  unfolding hull_def closure_interior interior_def by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   966
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   967
lemma closure_eq: "closure S = S \<longleftrightarrow> closed S"
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   968
  unfolding closure_hull using closed_Inter by (rule hull_eq)
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   969
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   970
lemma closure_closed [simp]: "closed S \<Longrightarrow> closure S = S"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   971
  unfolding closure_eq .
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   972
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   973
lemma closure_closure [simp]: "closure (closure S) = closure S"
44518
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
   974
  unfolding closure_hull by (rule hull_hull)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   975
44522
2f7e9d890efe rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents: 44519
diff changeset
   976
lemma closure_mono: "S \<subseteq> T \<Longrightarrow> closure S \<subseteq> closure T"
44518
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
   977
  unfolding closure_hull by (rule hull_mono)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   978
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   979
lemma closure_minimal: "S \<subseteq> T \<Longrightarrow> closed T \<Longrightarrow> closure S \<subseteq> T"
44518
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
   980
  unfolding closure_hull by (rule hull_minimal)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   981
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   982
lemma closure_unique:
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   983
  assumes "S \<subseteq> T" and "closed T"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   984
  assumes "\<And>T'. S \<subseteq> T' \<Longrightarrow> closed T' \<Longrightarrow> T \<subseteq> T'"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   985
  shows "closure S = T"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   986
  using assms unfolding closure_hull by (rule hull_unique)
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   987
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
   988
lemma closure_empty [simp]: "closure {} = {}"
44518
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
   989
  using closed_empty by (rule closure_closed)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   990
44522
2f7e9d890efe rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents: 44519
diff changeset
   991
lemma closure_UNIV [simp]: "closure UNIV = UNIV"
44518
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
   992
  using closed_UNIV by (rule closure_closed)
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
   993
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
   994
lemma closure_union [simp]: "closure (S \<union> T) = closure S \<union> closure T"
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
   995
  unfolding closure_interior by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   996
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   997
lemma closure_eq_empty: "closure S = {} \<longleftrightarrow> S = {}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   998
  using closure_empty closure_subset[of S]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   999
  by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1000
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1001
lemma closure_subset_eq: "closure S \<subseteq> S \<longleftrightarrow> closed S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1002
  using closure_eq[of S] closure_subset[of S]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1003
  by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1004
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1005
lemma open_inter_closure_eq_empty:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1006
  "open S \<Longrightarrow> (S \<inter> closure T) = {} \<longleftrightarrow> S \<inter> T = {}"
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
  1007
  using open_subset_interior[of S "- T"]
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
  1008
  using interior_subset[of "- T"]
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1009
  unfolding closure_interior
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1010
  by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1011
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1012
lemma open_inter_closure_subset:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1013
  "open S \<Longrightarrow> (S \<inter> (closure T)) \<subseteq> closure(S \<inter> T)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1014
proof
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1015
  fix x
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1016
  assume as: "open S" "x \<in> S \<inter> closure T"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1017
  { assume *:"x islimpt T"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1018
    have "x islimpt (S \<inter> T)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1019
    proof (rule islimptI)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1020
      fix A
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1021
      assume "x \<in> A" "open A"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1022
      with as have "x \<in> A \<inter> S" "open (A \<inter> S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1023
        by (simp_all add: open_Int)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1024
      with * obtain y where "y \<in> T" "y \<in> A \<inter> S" "y \<noteq> x"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1025
        by (rule islimptE)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1026
      hence "y \<in> S \<inter> T" "y \<in> A \<and> y \<noteq> x"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1027
        by simp_all
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1028
      thus "\<exists>y\<in>(S \<inter> T). y \<in> A \<and> y \<noteq> x" ..
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1029
    qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1030
  }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1031
  then show "x \<in> closure (S \<inter> T)" using as
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1032
    unfolding closure_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1033
    by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1034
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1035
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1036
lemma closure_complement: "closure (- S) = - interior S"
44518
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
  1037
  unfolding closure_interior by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1038
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1039
lemma interior_complement: "interior (- S) = - closure S"
44518
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
  1040
  unfolding closure_interior by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1041
44365
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1042
lemma closure_Times: "closure (A \<times> B) = closure A \<times> closure B"
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1043
proof (rule closure_unique)
44365
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1044
  show "A \<times> B \<subseteq> closure A \<times> closure B"
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1045
    by (intro Sigma_mono closure_subset)
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1046
  show "closed (closure A \<times> closure B)"
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1047
    by (intro closed_Times closed_closure)
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1048
  fix T assume "A \<times> B \<subseteq> T" and "closed T" thus "closure A \<times> closure B \<subseteq> T"
44365
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1049
    apply (simp add: closed_def open_prod_def, clarify)
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1050
    apply (rule ccontr)
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1051
    apply (drule_tac x="(a, b)" in bspec, simp, clarify, rename_tac C D)
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1052
    apply (simp add: closure_interior interior_def)
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1053
    apply (drule_tac x=C in spec)
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1054
    apply (drule_tac x=D in spec)
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1055
    apply auto
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1056
    done
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1057
qed
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1058
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  1059
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  1060
subsection {* Frontier (aka boundary) *}
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1061
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1062
definition "frontier S = closure S - interior S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1063
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1064
lemma frontier_closed: "closed(frontier S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1065
  by (simp add: frontier_def closed_Diff)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1066
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
  1067
lemma frontier_closures: "frontier S = (closure S) \<inter> (closure(- S))"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1068
  by (auto simp add: frontier_def interior_closure)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1069
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1070
lemma frontier_straddle:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1071
  fixes a :: "'a::metric_space"
44909
1f5d6eb73549 shorten proof of frontier_straddle
huffman
parents: 44907
diff changeset
  1072
  shows "a \<in> frontier S \<longleftrightarrow> (\<forall>e>0. (\<exists>x\<in>S. dist a x < e) \<and> (\<exists>x. x \<notin> S \<and> dist a x < e))"
1f5d6eb73549 shorten proof of frontier_straddle
huffman
parents: 44907
diff changeset
  1073
  unfolding frontier_def closure_interior
1f5d6eb73549 shorten proof of frontier_straddle
huffman
parents: 44907
diff changeset
  1074
  by (auto simp add: mem_interior subset_eq ball_def)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1075
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1076
lemma frontier_subset_closed: "closed S \<Longrightarrow> frontier S \<subseteq> S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1077
  by (metis frontier_def closure_closed Diff_subset)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1078
34964
4e8be3c04d37 Replaced vec1 and dest_vec1 by abbreviation.
hoelzl
parents: 34291
diff changeset
  1079
lemma frontier_empty[simp]: "frontier {} = {}"
36362
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36360
diff changeset
  1080
  by (simp add: frontier_def)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1081
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1082
lemma frontier_subset_eq: "frontier S \<subseteq> S \<longleftrightarrow> closed S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1083
proof-
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1084
  { assume "frontier S \<subseteq> S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1085
    hence "closure S \<subseteq> S" using interior_subset unfolding frontier_def by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1086
    hence "closed S" using closure_subset_eq by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1087
  }
36362
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36360
diff changeset
  1088
  thus ?thesis using frontier_subset_closed[of S] ..
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1089
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1090
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
  1091
lemma frontier_complement: "frontier(- S) = frontier S"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1092
  by (auto simp add: frontier_def closure_complement interior_complement)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1093
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1094
lemma frontier_disjoint_eq: "frontier S \<inter> S = {} \<longleftrightarrow> open S"
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
  1095
  using frontier_complement frontier_subset_eq[of "- S"]
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
  1096
  unfolding open_closed by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1097
44081
730f7cced3a6 rename type 'a net to 'a filter, following standard mathematical terminology
huffman
parents: 44076
diff changeset
  1098
subsection {* Filters and the ``eventually true'' quantifier *}
730f7cced3a6 rename type 'a net to 'a filter, following standard mathematical terminology
huffman
parents: 44076
diff changeset
  1099
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1100
definition
44081
730f7cced3a6 rename type 'a net to 'a filter, following standard mathematical terminology
huffman
parents: 44076
diff changeset
  1101
  indirection :: "'a::real_normed_vector \<Rightarrow> 'a \<Rightarrow> 'a filter"
730f7cced3a6 rename type 'a net to 'a filter, following standard mathematical terminology
huffman
parents: 44076
diff changeset
  1102
    (infixr "indirection" 70) where
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1103
  "a indirection v = (at a) within {b. \<exists>c\<ge>0. b - a = scaleR c v}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1104
36437
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  1105
text {* Identify Trivial limits, where we can't approach arbitrarily closely. *}
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1106
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1107
lemma trivial_limit_within:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1108
  shows "trivial_limit (at a within S) \<longleftrightarrow> \<not> a islimpt S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1109
proof
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1110
  assume "trivial_limit (at a within S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1111
  thus "\<not> a islimpt S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1112
    unfolding trivial_limit_def
36358
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1113
    unfolding eventually_within eventually_at_topological
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1114
    unfolding islimpt_def
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39198
diff changeset
  1115
    apply (clarsimp simp add: set_eq_iff)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1116
    apply (rename_tac T, rule_tac x=T in exI)
36358
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1117
    apply (clarsimp, drule_tac x=y in bspec, simp_all)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1118
    done
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1119
next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1120
  assume "\<not> a islimpt S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1121
  thus "trivial_limit (at a within S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1122
    unfolding trivial_limit_def
36358
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1123
    unfolding eventually_within eventually_at_topological
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1124
    unfolding islimpt_def
36358
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1125
    apply clarsimp
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1126
    apply (rule_tac x=T in exI)
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1127
    apply auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1128
    done
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1129
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1130
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1131
lemma trivial_limit_at_iff: "trivial_limit (at a) \<longleftrightarrow> \<not> a islimpt UNIV"
45031
9583f2b56f85 add lemmas within_empty and tendsto_bot;
huffman
parents: 44909
diff changeset
  1132
  using trivial_limit_within [of a UNIV] by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1133
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1134
lemma trivial_limit_at:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1135
  fixes a :: "'a::perfect_space"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1136
  shows "\<not> trivial_limit (at a)"
44571
bd91b77c4cd6 move class perfect_space into RealVector.thy;
huffman
parents: 44568
diff changeset
  1137
  by (rule at_neq_bot)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1138
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1139
lemma trivial_limit_at_infinity:
44081
730f7cced3a6 rename type 'a net to 'a filter, following standard mathematical terminology
huffman
parents: 44076
diff changeset
  1140
  "\<not> trivial_limit (at_infinity :: ('a::{real_normed_vector,perfect_space}) filter)"
36358
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1141
  unfolding trivial_limit_def eventually_at_infinity
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1142
  apply clarsimp
44072
5b970711fb39 class perfect_space inherits from topological_space;
huffman
parents: 43338
diff changeset
  1143
  apply (subgoal_tac "\<exists>x::'a. x \<noteq> 0", clarify)
5b970711fb39 class perfect_space inherits from topological_space;
huffman
parents: 43338
diff changeset
  1144
   apply (rule_tac x="scaleR (b / norm x) x" in exI, simp)
5b970711fb39 class perfect_space inherits from topological_space;
huffman
parents: 43338
diff changeset
  1145
  apply (cut_tac islimpt_UNIV [of "0::'a", unfolded islimpt_def])
5b970711fb39 class perfect_space inherits from topological_space;
huffman
parents: 43338
diff changeset
  1146
  apply (drule_tac x=UNIV in spec, simp)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1147
  done
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1148
36437
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  1149
text {* Some property holds "sufficiently close" to the limit point. *}
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1150
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1151
lemma eventually_at: (* FIXME: this replaces Limits.eventually_at *)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1152
  "eventually P (at a) \<longleftrightarrow> (\<exists>d>0. \<forall>x. 0 < dist x a \<and> dist x a < d \<longrightarrow> P x)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1153
unfolding eventually_at dist_nz by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1154
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  1155
lemma eventually_within: (* FIXME: this replaces Limits.eventually_within *)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  1156
  "eventually P (at a within S) \<longleftrightarrow>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1157
        (\<exists>d>0. \<forall>x\<in>S. 0 < dist x a \<and> dist x a < d \<longrightarrow> P x)"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  1158
  by (rule eventually_within_less)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1159
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1160
lemma eventually_happens: "eventually P net ==> trivial_limit net \<or> (\<exists>x. P x)"
36358
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1161
  unfolding trivial_limit_def
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1162
  by (auto elim: eventually_rev_mp)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1163
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1164
lemma trivial_limit_eventually: "trivial_limit net \<Longrightarrow> eventually P net"
45031
9583f2b56f85 add lemmas within_empty and tendsto_bot;
huffman
parents: 44909
diff changeset
  1165
  by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1166
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1167
lemma trivial_limit_eq: "trivial_limit net \<longleftrightarrow> (\<forall>P. eventually P net)"
44342
8321948340ea redefine constant 'trivial_limit' as an abbreviation
huffman
parents: 44286
diff changeset
  1168
  by (simp add: filter_eq_iff)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1169
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1170
text{* Combining theorems for "eventually" *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1171
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1172
lemma eventually_rev_mono:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1173
  "eventually P net \<Longrightarrow> (\<forall>x. P x \<longrightarrow> Q x) \<Longrightarrow> eventually Q net"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1174
using eventually_mono [of P Q] by fast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1176
lemma not_eventually: "(\<forall>x. \<not> P x ) \<Longrightarrow> ~(trivial_limit net) ==> ~(eventually (\<lambda>x. P x) net)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1177
  by (simp add: eventually_False)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1178
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  1179
36437
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  1180
subsection {* Limits *}
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1181
44081
730f7cced3a6 rename type 'a net to 'a filter, following standard mathematical terminology
huffman
parents: 44076
diff changeset
  1182
text{* Notation Lim to avoid collition with lim defined in analysis *}
730f7cced3a6 rename type 'a net to 'a filter, following standard mathematical terminology
huffman
parents: 44076
diff changeset
  1183
730f7cced3a6 rename type 'a net to 'a filter, following standard mathematical terminology
huffman
parents: 44076
diff changeset
  1184
definition Lim :: "'a filter \<Righ