src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy
author haftmann
Thu, 17 Jun 2010 19:32:05 +0200
changeset 37452 8f515d6aded5
parent 36778 739a9379e29b
child 37486 b993fac7985b
child 37489 44e42d392c6e
permissions -rw-r--r--
replaced unreliable metis proof
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
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
     4
*)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
     5
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
     6
header {* Elementary topology in Euclidean space. *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
     7
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
     8
theory Topology_Euclidean_Space
36623
d26348b667f2 Moved Convex theory to library.
hoelzl
parents: 36593
diff changeset
     9
imports SEQ Euclidean_Space Glbs
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    10
begin
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    11
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    12
subsection{* General notion of a topology *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    13
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    14
definition "istopology L \<longleftrightarrow> {} \<in> L \<and> (\<forall>S \<in>L. \<forall>T \<in>L. S \<inter> T \<in> L) \<and> (\<forall>K. K \<subseteq>L \<longrightarrow> \<Union> K \<in> L)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    15
typedef (open) 'a topology = "{L::('a set) set. istopology L}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    16
  morphisms "openin" "topology"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    17
  unfolding istopology_def by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    18
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    19
lemma istopology_open_in[intro]: "istopology(openin U)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    20
  using openin[of U] by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    21
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    22
lemma topology_inverse': "istopology U \<Longrightarrow> openin (topology U) = U"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    23
  using topology_inverse[unfolded mem_def Collect_def] .
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    24
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    25
lemma topology_inverse_iff: "istopology U \<longleftrightarrow> openin (topology U) = U"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    26
  using topology_inverse[of U] istopology_open_in[of "topology U"] by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    27
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    28
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
    29
proof-
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    30
  {assume "T1=T2" hence "\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S" by simp}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    31
  moreover
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    32
  {assume H: "\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    33
    hence "openin T1 = openin T2" by (metis mem_def set_ext)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    34
    hence "topology (openin T1) = topology (openin T2)" by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    35
    hence "T1 = T2" unfolding openin_inverse .}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    36
  ultimately show ?thesis by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    37
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    38
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    39
text{* Infer the "universe" from union of all sets in the topology. *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    40
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    41
definition "topspace T =  \<Union>{S. openin T S}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    42
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    43
subsection{* Main properties of open sets *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    44
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    45
lemma openin_clauses:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    46
  fixes U :: "'a topology"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    47
  shows "openin U {}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    48
  "\<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
    49
  "\<And>K. (\<forall>S \<in> K. openin U S) \<Longrightarrow> openin U (\<Union>K)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    50
  using openin[of U] unfolding istopology_def Collect_def mem_def
36362
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36360
diff changeset
    51
  unfolding subset_eq Ball_def mem_def by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    52
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    53
lemma openin_subset[intro]: "openin U S \<Longrightarrow> S \<subseteq> topspace U"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    54
  unfolding topspace_def by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    55
lemma openin_empty[simp]: "openin U {}" by (simp add: openin_clauses)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    56
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    57
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
    58
  using openin_clauses by simp
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36360
diff changeset
    59
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36360
diff changeset
    60
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
    61
  using openin_clauses by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    62
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    63
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
    64
  using openin_Union[of "{S,T}" U] by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    65
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    66
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
    67
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    68
lemma openin_subopen: "openin U S \<longleftrightarrow> (\<forall>x \<in> S. \<exists>T. openin U T \<and> x \<in> T \<and> T \<subseteq> S)" (is "?lhs \<longleftrightarrow> ?rhs")
36584
1535841fc2e9 prove lemma openin_subopen without using choice
huffman
parents: 36442
diff changeset
    69
proof
1535841fc2e9 prove lemma openin_subopen without using choice
huffman
parents: 36442
diff changeset
    70
  assume ?lhs then show ?rhs by auto
1535841fc2e9 prove lemma openin_subopen without using choice
huffman
parents: 36442
diff changeset
    71
next
1535841fc2e9 prove lemma openin_subopen without using choice
huffman
parents: 36442
diff changeset
    72
  assume H: ?rhs
1535841fc2e9 prove lemma openin_subopen without using choice
huffman
parents: 36442
diff changeset
    73
  let ?t = "\<Union>{T. openin U T \<and> T \<subseteq> S}"
1535841fc2e9 prove lemma openin_subopen without using choice
huffman
parents: 36442
diff changeset
    74
  have "openin U ?t" by (simp add: openin_Union)
1535841fc2e9 prove lemma openin_subopen without using choice
huffman
parents: 36442
diff changeset
    75
  also have "?t = S" using H by auto
1535841fc2e9 prove lemma openin_subopen without using choice
huffman
parents: 36442
diff changeset
    76
  finally show "openin U S" .
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    77
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    78
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    79
subsection{* Closed sets *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    80
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    81
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
    82
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    83
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
    84
lemma closedin_empty[simp]: "closedin U {}" by (simp add: closedin_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    85
lemma closedin_topspace[intro,simp]:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    86
  "closedin U (topspace U)" by (simp add: closedin_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    87
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
    88
  by (auto simp add: Diff_Un closedin_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    89
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    90
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
    91
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
    92
  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
    93
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    94
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
    95
  using closedin_Inter[of "{S,T}" U] by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    96
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    97
lemma Diff_Diff_Int: "A - (A - B) = A \<inter> B" by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
    98
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
    99
  apply (auto simp add: closedin_def Diff_Diff_Int inf_absorb2)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   100
  apply (metis openin_subset subset_eq)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   101
  done
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   102
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   103
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
   104
  by (simp add: openin_closedin_eq)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   105
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   106
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
   107
proof-
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   108
  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
   109
    by (auto simp add: topspace_def openin_subset)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   110
  then show ?thesis using oS cT by (auto simp add: closedin_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   111
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   112
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   113
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
   114
proof-
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   115
  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
   116
    by (auto simp add: topspace_def )
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   117
  then show ?thesis using oS cT by (auto simp add: openin_closedin_eq)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   118
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   119
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   120
subsection{* Subspace topology. *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   121
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   122
definition "subtopology U V = topology {S \<inter> V |S. openin U S}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   123
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   124
lemma istopology_subtopology: "istopology {S \<inter> V |S. openin U S}" (is "istopology ?L")
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   125
proof-
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   126
  have "{} \<in> ?L" by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   127
  {fix A B assume A: "A \<in> ?L" and B: "B \<in> ?L"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   128
    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
   129
    have "A\<inter>B = (Sa \<inter> Sb) \<inter> V" "openin U (Sa \<inter> Sb)"  using Sa Sb by blast+
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   130
    then have "A \<inter> B \<in> ?L" by blast}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   131
  moreover
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   132
  {fix K assume K: "K \<subseteq> ?L"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   133
    have th0: "?L = (\<lambda>S. S \<inter> V) ` openin U "
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   134
      apply (rule set_ext)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   135
      apply (simp add: Ball_def image_iff)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   136
      by (metis mem_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   137
    from K[unfolded th0 subset_image_iff]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   138
    obtain Sk where Sk: "Sk \<subseteq> openin U" "K = (\<lambda>S. S \<inter> V) ` Sk" by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   139
    have "\<Union>K = (\<Union>Sk) \<inter> V" using Sk by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   140
    moreover have "openin U (\<Union> Sk)" using Sk by (auto simp add: subset_eq mem_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   141
    ultimately have "\<Union>K \<in> ?L" by blast}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   142
  ultimately show ?thesis unfolding istopology_def by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   143
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   144
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   145
lemma openin_subtopology:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   146
  "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
   147
  unfolding subtopology_def topology_inverse'[OF istopology_subtopology]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   148
  by (auto simp add: Collect_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   149
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   150
lemma topspace_subtopology: "topspace(subtopology U V) = topspace U \<inter> V"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   151
  by (auto simp add: topspace_def openin_subtopology)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   152
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   153
lemma closedin_subtopology:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   154
  "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
   155
  unfolding closedin_def topspace_subtopology
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   156
  apply (simp add: openin_subtopology)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   157
  apply (rule iffI)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   158
  apply clarify
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   159
  apply (rule_tac x="topspace U - T" in exI)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   160
  by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   161
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   162
lemma openin_subtopology_refl: "openin (subtopology U V) V \<longleftrightarrow> V \<subseteq> topspace U"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   163
  unfolding openin_subtopology
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   164
  apply (rule iffI, clarify)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   165
  apply (frule openin_subset[of U])  apply blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   166
  apply (rule exI[where x="topspace U"])
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   167
  by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   168
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   169
lemma subtopology_superset: assumes UV: "topspace U \<subseteq> V"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   170
  shows "subtopology U V = U"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   171
proof-
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   172
  {fix S
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   173
    {fix T assume T: "openin U T" "S = T \<inter> V"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   174
      from T openin_subset[OF T(1)] UV have eq: "S = T" by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   175
      have "openin U S" unfolding eq using T by blast}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   176
    moreover
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   177
    {assume S: "openin U S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   178
      hence "\<exists>T. openin U T \<and> S = T \<inter> V"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   179
        using openin_subset[OF S] UV by auto}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   180
    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
   181
  then show ?thesis unfolding topology_eq openin_subtopology by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   182
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   183
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   184
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   185
lemma subtopology_topspace[simp]: "subtopology U (topspace U) = U"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   186
  by (simp add: subtopology_superset)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   187
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   188
lemma subtopology_UNIV[simp]: "subtopology U UNIV = U"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   189
  by (simp add: subtopology_superset)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   190
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   191
subsection{* The universal Euclidean versions are what we use most of the time *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   192
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   193
definition
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   194
  euclidean :: "'a::topological_space topology" where
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   195
  "euclidean = topology open"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   196
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   197
lemma open_openin: "open S \<longleftrightarrow> openin euclidean S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   198
  unfolding euclidean_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   199
  apply (rule cong[where x=S and y=S])
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   200
  apply (rule topology_inverse[symmetric])
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   201
  apply (auto simp add: istopology_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   202
  by (auto simp add: mem_def subset_eq)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   203
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   204
lemma topspace_euclidean: "topspace euclidean = UNIV"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   205
  apply (simp add: topspace_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   206
  apply (rule set_ext)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   207
  by (auto simp add: open_openin[symmetric])
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   208
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   209
lemma topspace_euclidean_subtopology[simp]: "topspace (subtopology euclidean S) = S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   210
  by (simp add: topspace_euclidean topspace_subtopology)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   211
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   212
lemma closed_closedin: "closed S \<longleftrightarrow> closedin euclidean S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   213
  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
   214
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   215
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
   216
  by (simp add: open_openin openin_subopen[symmetric])
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   217
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   218
subsection{* Open and closed balls. *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   219
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   220
definition
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   221
  ball :: "'a::metric_space \<Rightarrow> real \<Rightarrow> 'a set" where
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   222
  "ball x e = {y. dist x y < e}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   223
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   224
definition
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   225
  cball :: "'a::metric_space \<Rightarrow> real \<Rightarrow> 'a set" where
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   226
  "cball x e = {y. dist x y \<le> e}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   227
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   228
lemma mem_ball[simp]: "y \<in> ball x e \<longleftrightarrow> dist x y < e" by (simp add: ball_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   229
lemma mem_cball[simp]: "y \<in> cball x e \<longleftrightarrow> dist x y \<le> e" by (simp add: cball_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   230
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   231
lemma mem_ball_0 [simp]:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   232
  fixes x :: "'a::real_normed_vector"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   233
  shows "x \<in> ball 0 e \<longleftrightarrow> norm x < e"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   234
  by (simp add: dist_norm)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   235
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   236
lemma mem_cball_0 [simp]:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   237
  fixes x :: "'a::real_normed_vector"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   238
  shows "x \<in> cball 0 e \<longleftrightarrow> norm x \<le> e"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   239
  by (simp add: dist_norm)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   240
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   241
lemma centre_in_cball[simp]: "x \<in> cball x e \<longleftrightarrow> 0\<le> e"  by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   242
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
   243
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
   244
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
   245
lemma ball_max_Un: "ball a (max r s) = ball a r \<union> ball a s"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   246
  by (simp add: expand_set_eq) arith
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   247
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   248
lemma ball_min_Int: "ball a (min r s) = ball a r \<inter> ball a s"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   249
  by (simp add: expand_set_eq)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   250
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   251
lemma diff_less_iff: "(a::real) - b > 0 \<longleftrightarrow> a > b"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   252
  "(a::real) - b < 0 \<longleftrightarrow> a < b"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   253
  "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
   254
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
   255
  "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
   256
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   257
lemma open_ball[intro, simp]: "open (ball x e)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   258
  unfolding open_dist ball_def Collect_def Ball_def mem_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   259
  unfolding dist_commute
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   260
  apply clarify
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   261
  apply (rule_tac x="e - dist xa x" in exI)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   262
  using dist_triangle_alt[where z=x]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   263
  apply (clarsimp simp add: diff_less_iff)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   264
  apply atomize
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   265
  apply (erule_tac x="y" in allE)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   266
  apply (erule_tac x="xa" in allE)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   267
  by arith
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   268
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   269
lemma centre_in_ball[simp]: "x \<in> ball x e \<longleftrightarrow> e > 0" by (metis mem_ball dist_self)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   270
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
   271
  unfolding open_dist subset_eq mem_ball Ball_def dist_commute ..
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   272
33714
eb2574ac4173 Added new lemmas to Euclidean Space by Robert Himmelmann
hoelzl
parents: 33324
diff changeset
   273
lemma openE[elim?]:
eb2574ac4173 Added new lemmas to Euclidean Space by Robert Himmelmann
hoelzl
parents: 33324
diff changeset
   274
  assumes "open S" "x\<in>S" 
eb2574ac4173 Added new lemmas to Euclidean Space by Robert Himmelmann
hoelzl
parents: 33324
diff changeset
   275
  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
   276
  using assms unfolding open_contains_ball by auto
eb2574ac4173 Added new lemmas to Euclidean Space by Robert Himmelmann
hoelzl
parents: 33324
diff changeset
   277
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   278
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
   279
  by (metis open_contains_ball subset_eq centre_in_ball)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   280
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   281
lemma ball_eq_empty[simp]: "ball x e = {} \<longleftrightarrow> e \<le> 0"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   282
  unfolding mem_ball expand_set_eq
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   283
  apply (simp add: not_less)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   284
  by (metis zero_le_dist order_trans dist_self)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   285
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   286
lemma ball_empty[intro]: "e \<le> 0 ==> ball x e = {}" by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   287
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   288
subsection{* Basic "localization" results are handy for connectedness. *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   289
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   290
lemma openin_open: "openin (subtopology euclidean U) S \<longleftrightarrow> (\<exists>T. open T \<and> (S = U \<inter> T))"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   291
  by (auto simp add: openin_subtopology open_openin[symmetric])
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   292
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   293
lemma openin_open_Int[intro]: "open S \<Longrightarrow> openin (subtopology euclidean U) (U \<inter> S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   294
  by (auto simp add: openin_open)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   295
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   296
lemma open_openin_trans[trans]:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   297
 "open S \<Longrightarrow> open T \<Longrightarrow> T \<subseteq> S \<Longrightarrow> openin (subtopology euclidean S) T"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   298
  by (metis Int_absorb1  openin_open_Int)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   299
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   300
lemma open_subset:  "S \<subseteq> T \<Longrightarrow> open S \<Longrightarrow> openin (subtopology euclidean T) S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   301
  by (auto simp add: openin_open)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   302
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   303
lemma closedin_closed: "closedin (subtopology euclidean U) S \<longleftrightarrow> (\<exists>T. closed T \<and> S = U \<inter> T)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   304
  by (simp add: closedin_subtopology closed_closedin Int_ac)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   305
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   306
lemma closedin_closed_Int: "closed S ==> closedin (subtopology euclidean U) (U \<inter> S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   307
  by (metis closedin_closed)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   308
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   309
lemma closed_closedin_trans: "closed S \<Longrightarrow> closed T \<Longrightarrow> T \<subseteq> S \<Longrightarrow> closedin (subtopology euclidean S) T"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   310
  apply (subgoal_tac "S \<inter> T = T" )
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   311
  apply auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   312
  apply (frule closedin_closed_Int[of T S])
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   313
  by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   314
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   315
lemma closed_subset: "S \<subseteq> T \<Longrightarrow> closed S \<Longrightarrow> closedin (subtopology euclidean T) S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   316
  by (auto simp add: closedin_closed)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   317
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   318
lemma openin_euclidean_subtopology_iff:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   319
  fixes S U :: "'a::metric_space set"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   320
  shows "openin (subtopology euclidean U) S
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   321
  \<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")
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   322
proof-
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   323
  {assume ?lhs hence ?rhs unfolding openin_subtopology open_openin[symmetric]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   324
      by (simp add: open_dist) blast}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   325
  moreover
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   326
  {assume SU: "S \<subseteq> U" and H: "\<And>x. x \<in> S \<Longrightarrow> \<exists>e>0. \<forall>x'\<in>U. dist x' x < e \<longrightarrow> x' \<in> S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   327
    from H obtain d where d: "\<And>x . x\<in> S \<Longrightarrow> d x > 0 \<and> (\<forall>x' \<in> U. dist x' x < d x \<longrightarrow> x' \<in> S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   328
      by metis
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   329
    let ?T = "\<Union>{B. \<exists>x\<in>S. B = ball x (d x)}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   330
    have oT: "open ?T" by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   331
    { fix x assume "x\<in>S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   332
      hence "x \<in> \<Union>{B. \<exists>x\<in>S. B = ball x (d x)}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   333
        apply simp apply(rule_tac x="ball x(d x)" in exI) apply auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   334
        by (rule d [THEN conjunct1])
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   335
      hence "x\<in> ?T \<inter> U" using SU and `x\<in>S` by auto  }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   336
    moreover
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   337
    { fix y assume "y\<in>?T"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   338
      then obtain B where "y\<in>B" "B\<in>{B. \<exists>x\<in>S. B = ball x (d x)}" by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   339
      then obtain x where "x\<in>S" and x:"y \<in> ball x (d x)" by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   340
      assume "y\<in>U"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   341
      hence "y\<in>S" using d[OF `x\<in>S`] and x by(auto simp add: dist_commute) }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   342
    ultimately have "S = ?T \<inter> U" by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   343
    with oT have ?lhs unfolding openin_subtopology open_openin[symmetric] by blast}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   344
  ultimately show ?thesis by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   345
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   346
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   347
text{* These "transitivity" results are handy too. *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   348
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   349
lemma openin_trans[trans]: "openin (subtopology euclidean T) S \<Longrightarrow> openin (subtopology euclidean U) T
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   350
  \<Longrightarrow> openin (subtopology euclidean U) S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   351
  unfolding open_openin openin_open by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   352
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   353
lemma openin_open_trans: "openin (subtopology euclidean T) S \<Longrightarrow> open T \<Longrightarrow> open S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   354
  by (auto simp add: openin_open intro: openin_trans)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   355
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   356
lemma closedin_trans[trans]:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   357
 "closedin (subtopology euclidean T) S \<Longrightarrow>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   358
           closedin (subtopology euclidean U) T
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   359
           ==> closedin (subtopology euclidean U) S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   360
  by (auto simp add: closedin_closed closed_closedin closed_Inter Int_assoc)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   361
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   362
lemma closedin_closed_trans: "closedin (subtopology euclidean T) S \<Longrightarrow> closed T \<Longrightarrow> closed S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   363
  by (auto simp add: closedin_closed intro: closedin_trans)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   364
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   365
subsection{* Connectedness *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   366
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   367
definition "connected S \<longleftrightarrow>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   368
  ~(\<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
   369
  \<and> ~(e1 \<inter> S = {}) \<and> ~(e2 \<inter> S = {}))"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   370
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   371
lemma connected_local:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   372
 "connected S \<longleftrightarrow> ~(\<exists>e1 e2.
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   373
                 openin (subtopology euclidean S) e1 \<and>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   374
                 openin (subtopology euclidean S) e2 \<and>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   375
                 S \<subseteq> e1 \<union> e2 \<and>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   376
                 e1 \<inter> e2 = {} \<and>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   377
                 ~(e1 = {}) \<and>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   378
                 ~(e2 = {}))"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   379
unfolding connected_def openin_open by (safe, blast+)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   380
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   381
lemma exists_diff:
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   382
  fixes P :: "'a set \<Rightarrow> bool"
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   383
  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
   384
proof-
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   385
  {assume "?lhs" hence ?rhs by blast }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   386
  moreover
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   387
  {fix S assume H: "P S"
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   388
    have "S = - (- S)" by auto
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   389
    with H have "P (- (- S))" by metis }
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   390
  ultimately show ?thesis by metis
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   391
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   392
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   393
lemma connected_clopen: "connected S \<longleftrightarrow>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   394
        (\<forall>T. openin (subtopology euclidean S) T \<and>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   395
            closedin (subtopology euclidean S) T \<longrightarrow> T = {} \<or> T = S)" (is "?lhs \<longleftrightarrow> ?rhs")
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   396
proof-
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   397
  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
   398
    unfolding connected_def openin_open closedin_closed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   399
    apply (subst exists_diff) by blast
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   400
  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
   401
    (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
   402
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   403
  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
   404
    (is "_ \<longleftrightarrow> \<not> (\<exists>t' t. ?Q t' t)")
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   405
    unfolding connected_def openin_open closedin_closed by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   406
  {fix e2
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   407
    {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
   408
        by auto}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   409
    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
   410
  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
   411
  then show ?thesis unfolding th0 th1 by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   412
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   413
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   414
lemma connected_empty[simp, intro]: "connected {}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   415
  by (simp add: connected_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   416
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   417
subsection{* Hausdorff and other separation properties *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   418
36668
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   419
class t0_space = topological_space +
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   420
  assumes t0_space: "x \<noteq> y \<Longrightarrow> \<exists>U. open U \<and> \<not> (x \<in> U \<longleftrightarrow> y \<in> U)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   421
36668
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   422
class t1_space = topological_space +
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   423
  assumes t1_space: "x \<noteq> y \<Longrightarrow> \<exists>U. open U \<and> x \<in> U \<and> y \<notin> U"
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   424
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   425
instance t1_space \<subseteq> t0_space
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   426
proof qed (fast dest: t1_space)
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   427
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   428
lemma separation_t1:
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   429
  fixes x y :: "'a::t1_space"
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   430
  shows "x \<noteq> y \<longleftrightarrow> (\<exists>U. open U \<and> x \<in> U \<and> y \<notin> U)"
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   431
  using t1_space[of x y] by blast
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   432
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   433
lemma closed_sing:
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   434
  fixes a :: "'a::t1_space"
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   435
  shows "closed {a}"
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   436
proof -
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   437
  let ?T = "\<Union>{S. open S \<and> a \<notin> S}"
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   438
  have "open ?T" by (simp add: open_Union)
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   439
  also have "?T = - {a}"
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   440
    by (simp add: expand_set_eq separation_t1, auto)
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   441
  finally show "closed {a}" unfolding closed_def .
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   442
qed
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   443
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   444
lemma closed_insert [simp]:
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   445
  fixes a :: "'a::t1_space"
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   446
  assumes "closed S" shows "closed (insert a S)"
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   447
proof -
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   448
  from closed_sing assms
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   449
  have "closed ({a} \<union> S)" by (rule closed_Un)
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   450
  thus "closed (insert a S)" by simp
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   451
qed
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   452
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   453
lemma finite_imp_closed:
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   454
  fixes S :: "'a::t1_space set"
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   455
  shows "finite S \<Longrightarrow> closed S"
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   456
by (induct set: finite, simp_all)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   457
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   458
text {* T2 spaces are also known as Hausdorff spaces. *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   459
36668
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   460
class t2_space = topological_space +
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   461
  assumes hausdorff: "x \<noteq> y \<Longrightarrow> \<exists>U V. open U \<and> open V \<and> x \<in> U \<and> y \<in> V \<and> U \<inter> V = {}"
36668
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   462
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   463
instance t2_space \<subseteq> t1_space
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
   464
proof qed (fast dest: hausdorff)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   465
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   466
instance metric_space \<subseteq> t2_space
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   467
proof
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   468
  fix x y :: "'a::metric_space"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   469
  assume xy: "x \<noteq> y"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   470
  let ?U = "ball x (dist x y / 2)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   471
  let ?V = "ball y (dist x y / 2)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   472
  have th0: "\<And>d x y z. (d x z :: real) <= d x y + d y z \<Longrightarrow> d y z = d z y
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   473
               ==> ~(d x y * 2 < d x z \<and> d z y * 2 < d x z)" by arith
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   474
  have "open ?U \<and> open ?V \<and> x \<in> ?U \<and> y \<in> ?V \<and> ?U \<inter> ?V = {}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   475
    using dist_pos_lt[OF xy] th0[of dist,OF dist_triangle dist_commute]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   476
    by (auto simp add: expand_set_eq)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   477
  then show "\<exists>U V. open U \<and> open V \<and> x \<in> U \<and> y \<in> V \<and> U \<inter> V = {}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   478
    by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   479
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   480
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   481
lemma separation_t2:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   482
  fixes x y :: "'a::t2_space"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   483
  shows "x \<noteq> y \<longleftrightarrow> (\<exists>U V. open U \<and> open V \<and> x \<in> U \<and> y \<in> V \<and> U \<inter> V = {})"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   484
  using hausdorff[of x y] by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   485
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   486
lemma separation_t0:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   487
  fixes x y :: "'a::t0_space"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   488
  shows "x \<noteq> y \<longleftrightarrow> (\<exists>U. open U \<and> ~(x\<in>U \<longleftrightarrow> y\<in>U))"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   489
  using t0_space[of x y] by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   490
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   491
subsection{* Limit points *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   492
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   493
definition
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   494
  islimpt:: "'a::topological_space \<Rightarrow> 'a set \<Rightarrow> bool"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   495
    (infixr "islimpt" 60) where
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   496
  "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
   497
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   498
lemma islimptI:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   499
  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
   500
  shows "x islimpt S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   501
  using assms unfolding islimpt_def by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   502
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   503
lemma islimptE:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   504
  assumes "x islimpt S" and "x \<in> T" and "open T"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   505
  obtains y where "y \<in> S" and "y \<in> T" and "y \<noteq> x"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   506
  using assms unfolding islimpt_def by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   507
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   508
lemma islimpt_subset: "x islimpt S \<Longrightarrow> S \<subseteq> T ==> x islimpt T" by (auto simp add: islimpt_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   509
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   510
lemma islimpt_approachable:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   511
  fixes x :: "'a::metric_space"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   512
  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
   513
  unfolding islimpt_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   514
  apply auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   515
  apply(erule_tac x="ball x e" in allE)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   516
  apply auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   517
  apply(rule_tac x=y in bexI)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   518
  apply (auto simp add: dist_commute)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   519
  apply (simp add: open_dist, drule (1) bspec)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   520
  apply (clarify, drule spec, drule (1) mp, auto)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   521
  done
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   522
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   523
lemma islimpt_approachable_le:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   524
  fixes x :: "'a::metric_space"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   525
  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
   526
  unfolding islimpt_approachable
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   527
  using approachable_lt_le[where f="\<lambda>x'. dist x' x" and P="\<lambda>x'. \<not> (x'\<in>S \<and> x'\<noteq>x)"]
33324
51eb2ffa2189 Tidied up some very ugly proofs
paulson
parents: 33270
diff changeset
   528
  by metis 
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   529
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   530
class perfect_space =
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   531
  (* FIXME: perfect_space should inherit from topological_space *)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   532
  assumes islimpt_UNIV [simp, intro]: "(x::'a::metric_space) islimpt UNIV"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   533
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   534
lemma perfect_choose_dist:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   535
  fixes x :: "'a::perfect_space"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   536
  shows "0 < r \<Longrightarrow> \<exists>a. a \<noteq> x \<and> dist a x < r"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   537
using islimpt_UNIV [of x]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   538
by (simp add: islimpt_approachable)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   539
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   540
instance real :: perfect_space
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   541
apply default
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   542
apply (rule islimpt_approachable [THEN iffD2])
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   543
apply (clarify, rule_tac x="x + e/2" in bexI)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   544
apply (auto simp add: dist_norm)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   545
done
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   546
34291
4e896680897e finite annotation on cartesian product is now implicit.
hoelzl
parents: 34289
diff changeset
   547
instance cart :: (perfect_space, finite) perfect_space
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   548
proof
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   549
  fix x :: "'a ^ 'b"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   550
  {
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   551
    fix e :: real assume "0 < e"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   552
    def a \<equiv> "x $ undefined"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   553
    have "a islimpt UNIV" by (rule islimpt_UNIV)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   554
    with `0 < e` obtain b where "b \<noteq> a" and "dist b a < e"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   555
      unfolding islimpt_approachable by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   556
    def y \<equiv> "Cart_lambda ((Cart_nth x)(undefined := b))"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   557
    from `b \<noteq> a` have "y \<noteq> x"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   558
      unfolding a_def y_def by (simp add: Cart_eq)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   559
    from `dist b a < e` have "dist y x < e"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   560
      unfolding dist_vector_def a_def y_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   561
      apply simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   562
      apply (rule le_less_trans [OF setL2_le_setsum [OF zero_le_dist]])
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   563
      apply (subst setsum_diff1' [where a=undefined], simp, simp, simp)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   564
      done
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   565
    from `y \<noteq> x` and `dist y x < e`
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   566
    have "\<exists>y\<in>UNIV. y \<noteq> x \<and> dist y x < e" by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   567
  }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   568
  then show "x islimpt UNIV" unfolding islimpt_approachable by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   569
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   570
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   571
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
   572
  unfolding closed_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   573
  apply (subst open_subopen)
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   574
  apply (simp add: islimpt_def subset_eq)
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   575
  by (metis ComplE ComplI insertCI insert_absorb mem_def)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   576
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   577
lemma islimpt_EMPTY[simp]: "\<not> x islimpt {}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   578
  unfolding islimpt_def by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   579
34291
4e896680897e finite annotation on cartesian product is now implicit.
hoelzl
parents: 34289
diff changeset
   580
lemma closed_positive_orthant: "closed {x::real^'n. \<forall>i. 0 \<le>x$i}"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   581
proof-
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   582
  let ?U = "UNIV :: 'n set"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   583
  let ?O = "{x::real^'n. \<forall>i. x$i\<ge>0}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   584
  {fix x:: "real^'n" and i::'n assume H: "\<forall>e>0. \<exists>x'\<in>?O. x' \<noteq> x \<and> dist x' x < e"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   585
    and xi: "x$i < 0"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   586
    from xi have th0: "-x$i > 0" by arith
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   587
    from H[rule_format, OF th0] obtain x' where x': "x' \<in>?O" "x' \<noteq> x" "dist x' x < -x $ i" by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   588
      have th:" \<And>b a (x::real). abs x <= b \<Longrightarrow> b <= a ==> ~(a + x < 0)" by arith
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   589
      have th': "\<And>x (y::real). x < 0 \<Longrightarrow> 0 <= y ==> abs x <= abs (y - x)" by arith
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   590
      have th1: "\<bar>x$i\<bar> \<le> \<bar>(x' - x)$i\<bar>" using x'(1) xi
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   591
        apply (simp only: vector_component)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   592
        by (rule th') auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   593
      have th2: "\<bar>dist x x'\<bar> \<ge> \<bar>(x' - x)$i\<bar>" using  component_le_norm[of "x'-x" i]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   594
        apply (simp add: dist_norm) by norm
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   595
      from th[OF th1 th2] x'(3) have False by (simp add: dist_commute) }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   596
  then show ?thesis unfolding closed_limpt islimpt_approachable
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   597
    unfolding not_le[symmetric] by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   598
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   599
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   600
lemma finite_set_avoid:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   601
  fixes a :: "'a::metric_space"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   602
  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
   603
proof(induct rule: finite_induct[OF fS])
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   604
  case 1 thus ?case apply auto by ferrack
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   605
next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   606
  case (2 x F)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   607
  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
   608
  {assume "x = a" hence ?case using d by auto  }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   609
  moreover
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   610
  {assume xa: "x\<noteq>a"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   611
    let ?d = "min d (dist a x)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   612
    have dp: "?d > 0" using xa d(1) using dist_nz by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   613
    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
   614
    with dp xa have ?case by(auto intro!: exI[where x="?d"]) }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   615
  ultimately show ?case by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   616
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   617
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   618
lemma islimpt_finite:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   619
  fixes S :: "'a::metric_space set"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   620
  assumes fS: "finite S" shows "\<not> a islimpt S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   621
  unfolding islimpt_approachable
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   622
  using finite_set_avoid[OF fS, of a] by (metis dist_commute  not_le)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   623
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   624
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
   625
  apply (rule iffI)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   626
  defer
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   627
  apply (metis Un_upper1 Un_upper2 islimpt_subset)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   628
  unfolding islimpt_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   629
  apply (rule ccontr, clarsimp, rename_tac A B)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   630
  apply (drule_tac x="A \<inter> B" in spec)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   631
  apply (auto simp add: open_Int)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   632
  done
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   633
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   634
lemma discrete_imp_closed:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   635
  fixes S :: "'a::metric_space set"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   636
  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
   637
  shows "closed S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   638
proof-
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   639
  {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
   640
    from e have e2: "e/2 > 0" by arith
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   641
    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
   642
    let ?m = "min (e/2) (dist x y) "
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   643
    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
   644
    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
   645
    have th: "dist z y < e" using z y
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   646
      by (intro dist_triangle_lt [where z=x], simp)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   647
    from d[rule_format, OF y(1) z(1) th] y z
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   648
    have False by (auto simp add: dist_commute)}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   649
  then show ?thesis by (metis islimpt_approachable closed_limpt [where 'a='a])
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   650
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   651
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   652
subsection{* Interior of a Set *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   653
definition "interior S = {x. \<exists>T. open T \<and> x \<in> T \<and> T \<subseteq> S}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   654
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   655
lemma interior_eq: "interior S = S \<longleftrightarrow> open S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   656
  apply (simp add: expand_set_eq interior_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   657
  apply (subst (2) open_subopen) by (safe, blast+)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   658
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   659
lemma interior_open: "open S ==> (interior S = S)" by (metis interior_eq)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   660
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   661
lemma interior_empty[simp]: "interior {} = {}" by (simp add: interior_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   662
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   663
lemma open_interior[simp, intro]: "open(interior S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   664
  apply (simp add: interior_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   665
  apply (subst open_subopen) by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   666
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   667
lemma interior_interior[simp]: "interior(interior S) = interior S" by (metis interior_eq open_interior)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   668
lemma interior_subset: "interior S \<subseteq> S" by (auto simp add: interior_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   669
lemma subset_interior: "S \<subseteq> T ==> (interior S) \<subseteq> (interior T)" by (auto simp add: interior_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   670
lemma interior_maximal: "T \<subseteq> S \<Longrightarrow> open T ==> T \<subseteq> (interior S)" by (auto simp add: interior_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   671
lemma interior_unique: "T \<subseteq> S \<Longrightarrow> open T  \<Longrightarrow> (\<forall>T'. T' \<subseteq> S \<and> open T' \<longrightarrow> T' \<subseteq> T) \<Longrightarrow> interior S = T"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   672
  by (metis equalityI interior_maximal interior_subset open_interior)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   673
lemma mem_interior: "x \<in> interior S \<longleftrightarrow> (\<exists>e. 0 < e \<and> ball x e \<subseteq> S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   674
  apply (simp add: interior_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   675
  by (metis open_contains_ball centre_in_ball open_ball subset_trans)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   676
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   677
lemma open_subset_interior: "open S ==> S \<subseteq> interior T \<longleftrightarrow> S \<subseteq> T"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   678
  by (metis interior_maximal interior_subset subset_trans)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   679
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   680
lemma interior_inter[simp]: "interior(S \<inter> T) = interior S \<inter> interior T"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   681
  apply (rule equalityI, simp)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   682
  apply (metis Int_lower1 Int_lower2 subset_interior)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   683
  by (metis Int_mono interior_subset open_Int open_interior open_subset_interior)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   684
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   685
lemma interior_limit_point [intro]:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   686
  fixes x :: "'a::perfect_space"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   687
  assumes x: "x \<in> interior S" shows "x islimpt S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   688
proof-
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   689
  from x obtain e where e: "e>0" "\<forall>x'. dist x x' < e \<longrightarrow> x' \<in> S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   690
    unfolding mem_interior subset_eq Ball_def mem_ball by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   691
  {
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   692
    fix d::real assume d: "d>0"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   693
    let ?m = "min d e"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   694
    have mde2: "0 < ?m" using e(1) d(1) by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   695
    from perfect_choose_dist [OF mde2, of x]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   696
    obtain y where "y \<noteq> x" and "dist y x < ?m" by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   697
    then have "dist y x < e" "dist y x < d" by simp_all
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   698
    from `dist y x < e` e(2) have "y \<in> S" by (simp add: dist_commute)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   699
    have "\<exists>x'\<in>S. x'\<noteq> x \<and> dist x' x < d"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   700
      using `y \<in> S` `y \<noteq> x` `dist y x < d` by fast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   701
  }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   702
  then show ?thesis unfolding islimpt_approachable by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   703
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   704
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   705
lemma interior_closed_Un_empty_interior:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   706
  assumes cS: "closed S" and iT: "interior T = {}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   707
  shows "interior(S \<union> T) = interior S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   708
proof
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   709
  show "interior S \<subseteq> interior (S\<union>T)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   710
    by (rule subset_interior, blast)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   711
next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   712
  show "interior (S \<union> T) \<subseteq> interior S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   713
  proof
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   714
    fix x assume "x \<in> interior (S \<union> T)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   715
    then obtain R where "open R" "x \<in> R" "R \<subseteq> S \<union> T"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   716
      unfolding interior_def by fast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   717
    show "x \<in> interior S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   718
    proof (rule ccontr)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   719
      assume "x \<notin> interior S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   720
      with `x \<in> R` `open R` obtain y where "y \<in> R - S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   721
        unfolding interior_def expand_set_eq by fast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   722
      from `open R` `closed S` have "open (R - S)" by (rule open_Diff)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   723
      from `R \<subseteq> S \<union> T` have "R - S \<subseteq> T" by fast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   724
      from `y \<in> R - S` `open (R - S)` `R - S \<subseteq> T` `interior T = {}`
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   725
      show "False" unfolding interior_def by fast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   726
    qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   727
  qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   728
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   729
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   730
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   731
subsection{* Closure of a Set *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   732
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   733
definition "closure S = S \<union> {x | x. x islimpt S}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   734
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   735
lemma closure_interior: "closure S = - interior (- S)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   736
proof-
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   737
  { fix x
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   738
    have "x\<in>- interior (- S) \<longleftrightarrow> x \<in> closure S"  (is "?lhs = ?rhs")
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   739
    proof
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   740
      let ?exT = "\<lambda> y. (\<exists>T. open T \<and> y \<in> T \<and> T \<subseteq> - S)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   741
      assume "?lhs"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   742
      hence *:"\<not> ?exT x"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   743
        unfolding interior_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   744
        by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   745
      { assume "\<not> ?rhs"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   746
        hence False using *
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   747
          unfolding closure_def islimpt_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   748
          by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   749
      }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   750
      thus "?rhs"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   751
        by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   752
    next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   753
      assume "?rhs" thus "?lhs"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   754
        unfolding closure_def interior_def islimpt_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   755
        by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   756
    qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   757
  }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   758
  thus ?thesis
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   759
    by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   760
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   761
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   762
lemma interior_closure: "interior S = - (closure (- S))"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   763
proof-
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   764
  { fix x
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   765
    have "x \<in> interior S \<longleftrightarrow> x \<in> - (closure (- S))"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   766
      unfolding interior_def closure_def islimpt_def
33324
51eb2ffa2189 Tidied up some very ugly proofs
paulson
parents: 33270
diff changeset
   767
      by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   768
  }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   769
  thus ?thesis
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   770
    by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   771
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   772
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   773
lemma closed_closure[simp, intro]: "closed (closure S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   774
proof-
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   775
  have "closed (- interior (-S))" by blast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   776
  thus ?thesis using closure_interior[of S] by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   777
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   778
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   779
lemma closure_hull: "closure S = closed hull S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   780
proof-
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   781
  have "S \<subseteq> closure S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   782
    unfolding closure_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   783
    by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   784
  moreover
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   785
  have "closed (closure S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   786
    using closed_closure[of S]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   787
    by assumption
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   788
  moreover
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   789
  { fix t
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   790
    assume *:"S \<subseteq> t" "closed t"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   791
    { fix x
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   792
      assume "x islimpt S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   793
      hence "x islimpt t" using *(1)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   794
        using islimpt_subset[of x, of S, of t]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   795
        by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   796
    }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   797
    with * have "closure S \<subseteq> t"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   798
      unfolding closure_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   799
      using closed_limpt[of t]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   800
      by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   801
  }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   802
  ultimately show ?thesis
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   803
    using hull_unique[of S, of "closure S", of closed]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   804
    unfolding mem_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   805
    by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   806
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   807
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   808
lemma closure_eq: "closure S = S \<longleftrightarrow> closed S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   809
  unfolding closure_hull
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   810
  using hull_eq[of closed, unfolded mem_def, OF  closed_Inter, of S]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   811
  by (metis mem_def subset_eq)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   812
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   813
lemma closure_closed[simp]: "closed S \<Longrightarrow> closure S = S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   814
  using closure_eq[of S]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   815
  by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   816
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   817
lemma closure_closure[simp]: "closure (closure S) = closure S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   818
  unfolding closure_hull
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   819
  using hull_hull[of closed S]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   820
  by assumption
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   821
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   822
lemma closure_subset: "S \<subseteq> closure S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   823
  unfolding closure_hull
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   824
  using hull_subset[of S closed]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   825
  by assumption
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   826
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   827
lemma subset_closure: "S \<subseteq> T \<Longrightarrow> closure S \<subseteq> closure T"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   828
  unfolding closure_hull
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   829
  using hull_mono[of S T closed]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   830
  by assumption
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   831
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   832
lemma closure_minimal: "S \<subseteq> T \<Longrightarrow>  closed T \<Longrightarrow> closure S \<subseteq> T"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   833
  using hull_minimal[of S T closed]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   834
  unfolding closure_hull mem_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   835
  by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   836
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   837
lemma closure_unique: "S \<subseteq> T \<and> closed T \<and> (\<forall> T'. S \<subseteq> T' \<and> closed T' \<longrightarrow> T \<subseteq> T') \<Longrightarrow> closure S = T"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   838
  using hull_unique[of S T closed]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   839
  unfolding closure_hull mem_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   840
  by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   841
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   842
lemma closure_empty[simp]: "closure {} = {}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   843
  using closed_empty closure_closed[of "{}"]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   844
  by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   845
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   846
lemma closure_univ[simp]: "closure UNIV = UNIV"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   847
  using closure_closed[of UNIV]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   848
  by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   849
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   850
lemma closure_eq_empty: "closure S = {} \<longleftrightarrow> S = {}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   851
  using closure_empty closure_subset[of S]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   852
  by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   853
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   854
lemma closure_subset_eq: "closure S \<subseteq> S \<longleftrightarrow> closed S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   855
  using closure_eq[of S] closure_subset[of S]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   856
  by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   857
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   858
lemma open_inter_closure_eq_empty:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   859
  "open S \<Longrightarrow> (S \<inter> closure T) = {} \<longleftrightarrow> S \<inter> T = {}"
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   860
  using open_subset_interior[of S "- T"]
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   861
  using interior_subset[of "- T"]
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   862
  unfolding closure_interior
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   863
  by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   864
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   865
lemma open_inter_closure_subset:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   866
  "open S \<Longrightarrow> (S \<inter> (closure T)) \<subseteq> closure(S \<inter> T)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   867
proof
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   868
  fix x
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   869
  assume as: "open S" "x \<in> S \<inter> closure T"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   870
  { assume *:"x islimpt T"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   871
    have "x islimpt (S \<inter> T)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   872
    proof (rule islimptI)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   873
      fix A
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   874
      assume "x \<in> A" "open A"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   875
      with as have "x \<in> A \<inter> S" "open (A \<inter> S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   876
        by (simp_all add: open_Int)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   877
      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
   878
        by (rule islimptE)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   879
      hence "y \<in> S \<inter> T" "y \<in> A \<and> y \<noteq> x"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   880
        by simp_all
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   881
      thus "\<exists>y\<in>(S \<inter> T). y \<in> A \<and> y \<noteq> x" ..
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   882
    qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   883
  }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   884
  then show "x \<in> closure (S \<inter> T)" using as
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   885
    unfolding closure_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   886
    by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   887
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   888
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   889
lemma closure_complement: "closure(- S) = - interior(S)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   890
proof-
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   891
  have "S = - (- S)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   892
    by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   893
  thus ?thesis
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   894
    unfolding closure_interior
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   895
    by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   896
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   897
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   898
lemma interior_complement: "interior(- S) = - closure(S)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   899
  unfolding closure_interior
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   900
  by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   901
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   902
subsection{* Frontier (aka boundary) *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   903
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   904
definition "frontier S = closure S - interior S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   905
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   906
lemma frontier_closed: "closed(frontier S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   907
  by (simp add: frontier_def closed_Diff)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   908
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   909
lemma frontier_closures: "frontier S = (closure S) \<inter> (closure(- S))"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   910
  by (auto simp add: frontier_def interior_closure)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   911
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   912
lemma frontier_straddle:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   913
  fixes a :: "'a::metric_space"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   914
  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))" (is "?lhs \<longleftrightarrow> ?rhs")
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   915
proof
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   916
  assume "?lhs"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   917
  { fix e::real
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   918
    assume "e > 0"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   919
    let ?rhse = "(\<exists>x\<in>S. dist a x < e) \<and> (\<exists>x. x \<notin> S \<and> dist a x < e)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   920
    { assume "a\<in>S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   921
      have "\<exists>x\<in>S. dist a x < e" using `e>0` `a\<in>S` by(rule_tac x=a in bexI) auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   922
      moreover have "\<exists>x. x \<notin> S \<and> dist a x < e" using `?lhs` `a\<in>S`
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   923
        unfolding frontier_closures closure_def islimpt_def using `e>0`
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   924
        by (auto, erule_tac x="ball a e" in allE, auto)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   925
      ultimately have ?rhse by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   926
    }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   927
    moreover
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   928
    { assume "a\<notin>S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   929
      hence ?rhse using `?lhs`
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   930
        unfolding frontier_closures closure_def islimpt_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   931
        using open_ball[of a e] `e > 0`
33324
51eb2ffa2189 Tidied up some very ugly proofs
paulson
parents: 33270
diff changeset
   932
          by simp (metis centre_in_ball mem_ball open_ball) 
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   933
    }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   934
    ultimately have ?rhse by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   935
  }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   936
  thus ?rhs by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   937
next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   938
  assume ?rhs
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   939
  moreover
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   940
  { fix T assume "a\<notin>S" and
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   941
    as:"\<forall>e>0. (\<exists>x\<in>S. dist a x < e) \<and> (\<exists>x. x \<notin> S \<and> dist a x < e)" "a \<notin> S" "a \<in> T" "open T"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   942
    from `open T` `a \<in> T` have "\<exists>e>0. ball a e \<subseteq> T" unfolding open_contains_ball[of T] by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   943
    then obtain e where "e>0" "ball a e \<subseteq> T" by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   944
    then obtain y where y:"y\<in>S" "dist a y < e"  using as(1) by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   945
    have "\<exists>y\<in>S. y \<in> T \<and> y \<noteq> a"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   946
      using `dist a y < e` `ball a e \<subseteq> T` unfolding ball_def using `y\<in>S` `a\<notin>S` by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   947
  }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   948
  hence "a \<in> closure S" unfolding closure_def islimpt_def using `?rhs` by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   949
  moreover
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   950
  { fix T assume "a \<in> T"  "open T" "a\<in>S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   951
    then obtain e where "e>0" and balle: "ball a e \<subseteq> T" unfolding open_contains_ball using `?rhs` by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   952
    obtain x where "x \<notin> S" "dist a x < e" using `?rhs` using `e>0` by auto
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   953
    hence "\<exists>y\<in>- S. y \<in> T \<and> y \<noteq> a" using balle `a\<in>S` unfolding ball_def by (rule_tac x=x in bexI)auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   954
  }
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   955
  hence "a islimpt (- S) \<or> a\<notin>S" unfolding islimpt_def by auto
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   956
  ultimately show ?lhs unfolding frontier_closures using closure_def[of "- S"] by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   957
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   958
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   959
lemma frontier_subset_closed: "closed S \<Longrightarrow> frontier S \<subseteq> S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   960
  by (metis frontier_def closure_closed Diff_subset)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   961
34964
4e8be3c04d37 Replaced vec1 and dest_vec1 by abbreviation.
hoelzl
parents: 34291
diff changeset
   962
lemma frontier_empty[simp]: "frontier {} = {}"
36362
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36360
diff changeset
   963
  by (simp add: frontier_def)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   964
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   965
lemma frontier_subset_eq: "frontier S \<subseteq> S \<longleftrightarrow> closed S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   966
proof-
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   967
  { assume "frontier S \<subseteq> S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   968
    hence "closure S \<subseteq> S" using interior_subset unfolding frontier_def by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   969
    hence "closed S" using closure_subset_eq by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   970
  }
36362
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36360
diff changeset
   971
  thus ?thesis using frontier_subset_closed[of S] ..
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   972
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   973
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   974
lemma frontier_complement: "frontier(- S) = frontier S"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   975
  by (auto simp add: frontier_def closure_complement interior_complement)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   976
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   977
lemma frontier_disjoint_eq: "frontier S \<inter> S = {} \<longleftrightarrow> open S"
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   978
  using frontier_complement frontier_subset_eq[of "- S"]
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
   979
  unfolding open_closed by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   980
36437
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
   981
subsection {* Nets and the ``eventually true'' quantifier *}
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
   982
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
   983
text {* Common nets and The "within" modifier for nets. *}
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   984
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   985
definition
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   986
  at_infinity :: "'a::real_normed_vector net" where
36358
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
   987
  "at_infinity = Abs_net (\<lambda>P. \<exists>r. \<forall>x. r \<le> norm x \<longrightarrow> P x)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   988
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   989
definition
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   990
  indirection :: "'a::real_normed_vector \<Rightarrow> 'a \<Rightarrow> 'a net" (infixr "indirection" 70) where
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   991
  "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
   992
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   993
text{* Prove That They are all nets. *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   994
36358
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
   995
lemma eventually_at_infinity:
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
   996
  "eventually P at_infinity \<longleftrightarrow> (\<exists>b. \<forall>x. norm x >= b \<longrightarrow> P x)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   997
unfolding at_infinity_def
36358
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
   998
proof (rule eventually_Abs_net, rule is_filter.intro)
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
   999
  fix P Q :: "'a \<Rightarrow> bool"
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1000
  assume "\<exists>r. \<forall>x. r \<le> norm x \<longrightarrow> P x" and "\<exists>s. \<forall>x. s \<le> norm x \<longrightarrow> Q x"
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1001
  then obtain r s where
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1002
    "\<forall>x. r \<le> norm x \<longrightarrow> P x" and "\<forall>x. s \<le> norm x \<longrightarrow> Q x" by auto
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1003
  then have "\<forall>x. max r s \<le> norm x \<longrightarrow> P x \<and> Q x" by simp
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1004
  then show "\<exists>r. \<forall>x. r \<le> norm x \<longrightarrow> P x \<and> Q x" ..
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1005
qed auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1006
36437
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  1007
text {* Identify Trivial limits, where we can't approach arbitrarily closely. *}
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1008
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1009
definition
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1010
  trivial_limit :: "'a net \<Rightarrow> bool" where
36358
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1011
  "trivial_limit net \<longleftrightarrow> eventually (\<lambda>x. False) net"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1012
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1013
lemma trivial_limit_within:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1014
  shows "trivial_limit (at a within S) \<longleftrightarrow> \<not> a islimpt S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1015
proof
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1016
  assume "trivial_limit (at a within S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1017
  thus "\<not> a islimpt S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1018
    unfolding trivial_limit_def
36358
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1019
    unfolding eventually_within eventually_at_topological
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1020
    unfolding islimpt_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1021
    apply (clarsimp simp add: expand_set_eq)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1022
    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
  1023
    apply (clarsimp, drule_tac x=y in bspec, simp_all)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1024
    done
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1025
next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1026
  assume "\<not> a islimpt S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1027
  thus "trivial_limit (at a within S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1028
    unfolding trivial_limit_def
36358
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1029
    unfolding eventually_within eventually_at_topological
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1030
    unfolding islimpt_def
36358
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1031
    apply clarsimp
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1032
    apply (rule_tac x=T in exI)
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1033
    apply auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1034
    done
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1035
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1036
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1037
lemma trivial_limit_at_iff: "trivial_limit (at a) \<longleftrightarrow> \<not> a islimpt UNIV"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1038
  using trivial_limit_within [of a UNIV]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1039
  by (simp add: within_UNIV)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1040
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1041
lemma trivial_limit_at:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1042
  fixes a :: "'a::perfect_space"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1043
  shows "\<not> trivial_limit (at a)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1044
  by (simp add: trivial_limit_at_iff)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1045
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1046
lemma trivial_limit_at_infinity:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1047
  "\<not> trivial_limit (at_infinity :: ('a::{real_normed_vector,zero_neq_one}) net)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1048
  (* FIXME: find a more appropriate type class *)
36358
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1049
  unfolding trivial_limit_def eventually_at_infinity
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1050
  apply clarsimp
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1051
  apply (rule_tac x="scaleR b (sgn 1)" in exI)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1052
  apply (simp add: norm_sgn)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1053
  done
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1054
34964
4e8be3c04d37 Replaced vec1 and dest_vec1 by abbreviation.
hoelzl
parents: 34291
diff changeset
  1055
lemma trivial_limit_sequentially[intro]: "\<not> trivial_limit sequentially"
36358
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1056
  by (auto simp add: trivial_limit_def eventually_sequentially)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1057
36437
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  1058
text {* Some property holds "sufficiently close" to the limit point. *}
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1059
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1060
lemma eventually_at: (* FIXME: this replaces Limits.eventually_at *)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1061
  "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
  1062
unfolding eventually_at dist_nz by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1063
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1064
lemma eventually_within: "eventually P (at a within S) \<longleftrightarrow>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1065
        (\<exists>d>0. \<forall>x\<in>S. 0 < dist x a \<and> dist x a < d \<longrightarrow> P x)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1066
unfolding eventually_within eventually_at dist_nz by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1067
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1068
lemma eventually_within_le: "eventually P (at a within S) \<longleftrightarrow>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1069
        (\<exists>d>0. \<forall>x\<in>S. 0 < dist x a \<and> dist x a <= d \<longrightarrow> P x)" (is "?lhs = ?rhs")
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1070
unfolding eventually_within
33324
51eb2ffa2189 Tidied up some very ugly proofs
paulson
parents: 33270
diff changeset
  1071
by auto (metis Rats_dense_in_nn_real order_le_less_trans order_refl) 
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1072
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1073
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
  1074
  unfolding trivial_limit_def
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1075
  by (auto elim: eventually_rev_mp)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1076
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1077
lemma always_eventually: "(\<forall>x. P x) ==> eventually P net"
36358
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1078
proof -
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1079
  assume "\<forall>x. P x" hence "P = (\<lambda>x. True)" by (simp add: ext)
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1080
  thus "eventually P net" by simp
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1081
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1082
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1083
lemma trivial_limit_eventually: "trivial_limit net \<Longrightarrow> eventually P net"
36358
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1084
  unfolding trivial_limit_def by (auto elim: eventually_rev_mp)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1085
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1086
lemma eventually_False: "eventually (\<lambda>x. False) net \<longleftrightarrow> trivial_limit net"
36358
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  1087
  unfolding trivial_limit_def ..
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1088
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1089
lemma trivial_limit_eq: "trivial_limit net \<longleftrightarrow> (\<forall>P. eventually P net)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1090
  apply (safe elim!: trivial_limit_eventually)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1091
  apply (simp add: eventually_False [symmetric])
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1092
  done
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1093
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1094
text{* Combining theorems for "eventually" *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1095
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1096
lemma eventually_conjI:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1097
  "\<lbrakk>eventually (\<lambda>x. P x) net; eventually (\<lambda>x. Q x) net\<rbrakk>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1098
    \<Longrightarrow> eventually (\<lambda>x. P x \<and> Q x) net"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1099
by (rule eventually_conj)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1100
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1101
lemma eventually_rev_mono:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1102
  "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
  1103
using eventually_mono [of P Q] by fast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1104
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1105
lemma eventually_and: " eventually (\<lambda>x. P x \<and> Q x) net \<longleftrightarrow> eventually P net \<and> eventually Q net"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1106
  by (auto intro!: eventually_conjI elim: eventually_rev_mono)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1107
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1108
lemma eventually_false: "eventually (\<lambda>x. False) net \<longleftrightarrow> trivial_limit net"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1109
  by (auto simp add: eventually_False)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1110
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1111
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
  1112
  by (simp add: eventually_False)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1113
36437
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  1114
subsection {* Limits *}
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1115
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1116
  text{* Notation Lim to avoid collition with lim defined in analysis *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1117
definition
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1118
  Lim :: "'a net \<Rightarrow> ('a \<Rightarrow> 'b::t2_space) \<Rightarrow> 'b" where
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1119
  "Lim net f = (THE l. (f ---> l) net)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1120
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1121
lemma Lim:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1122
 "(f ---> l) net \<longleftrightarrow>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1123
        trivial_limit net \<or>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1124
        (\<forall>e>0. eventually (\<lambda>x. dist (f x) l < e) net)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1125
  unfolding tendsto_iff trivial_limit_eq by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1126
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1127
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1128
text{* Show that they yield usual definitions in the various cases. *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1129
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1130
lemma Lim_within_le: "(f ---> l)(at a within S) \<longleftrightarrow>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1131
           (\<forall>e>0. \<exists>d>0. \<forall>x\<in>S. 0 < dist x a  \<and> dist x a  <= d \<longrightarrow> dist (f x) l < e)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1132
  by (auto simp add: tendsto_iff eventually_within_le)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1133
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1134
lemma Lim_within: "(f ---> l) (at a within S) \<longleftrightarrow>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1135
        (\<forall>e >0. \<exists>d>0. \<forall>x \<in> S. 0 < dist x a  \<and> dist x a  < d  \<longrightarrow> dist (f x) l < e)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1136
  by (auto simp add: tendsto_iff eventually_within)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1137
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1138
lemma Lim_at: "(f ---> l) (at a) \<longleftrightarrow>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1139
        (\<forall>e >0. \<exists>d>0. \<forall>x. 0 < dist x a  \<and> dist x a  < d  \<longrightarrow> dist (f x) l < e)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1140
  by (auto simp add: tendsto_iff eventually_at)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1141
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1142
lemma Lim_at_iff_LIM: "(f ---> l) (at a) \<longleftrightarrow> f -- a --> l"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1143
  unfolding Lim_at LIM_def by (simp only: zero_less_dist_iff)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1144
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1145
lemma Lim_at_infinity:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1146
  "(f ---> l) at_infinity \<longleftrightarrow> (\<forall>e>0. \<exists>b. \<forall>x. norm x >= b \<longrightarrow> dist (f x) l < e)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1147
  by (auto simp add: tendsto_iff eventually_at_infinity)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1148
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1149
lemma Lim_sequentially:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1150
 "(S ---> l) sequentially \<longleftrightarrow>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1151
          (\<forall>e>0. \<exists>N. \<forall>n\<ge>N. dist (S n) l < e)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1152
  by (auto simp add: tendsto_iff eventually_sequentially)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1153
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1154
lemma Lim_sequentially_iff_LIMSEQ: "(S ---> l) sequentially \<longleftrightarrow> S ----> l"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1155
  unfolding Lim_sequentially LIMSEQ_def ..
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1156
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1157
lemma Lim_eventually: "eventually (\<lambda>x. f x = l) net \<Longrightarrow> (f ---> l) net"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1158
  by (rule topological_tendstoI, auto elim: eventually_rev_mono)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1159
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1160
text{* The expected monotonicity property. *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1161
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1162
lemma Lim_within_empty: "(f ---> l) (net within {})"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1163
  unfolding tendsto_def Limits.eventually_within by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1164
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1165
lemma Lim_within_subset: "(f ---> l) (net within S) \<Longrightarrow> T \<subseteq> S \<Longrightarrow> (f ---> l) (net within T)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1166
  unfolding tendsto_def Limits.eventually_within
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1167
  by (auto elim!: eventually_elim1)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1168
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1169
lemma Lim_Un: assumes "(f ---> l) (net within S)" "(f ---> l) (net within T)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1170
  shows "(f ---> l) (net within (S \<union> T))"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1171
  using assms unfolding tendsto_def Limits.eventually_within
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1172
  apply clarify
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1173
  apply (drule spec, drule (1) mp, drule (1) mp)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1174
  apply (drule spec, drule (1) mp, drule (1) mp)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1175
  apply (auto elim: eventually_elim2)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1176
  done
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1177
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1178
lemma Lim_Un_univ:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1179
 "(f ---> l) (net within S) \<Longrightarrow> (f ---> l) (net within T) \<Longrightarrow>  S \<union> T = UNIV
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1180
        ==> (f ---> l) net"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1181
  by (metis Lim_Un within_UNIV)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1182
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1183
text{* Interrelations between restricted and unrestricted limits. *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1184
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1185
lemma Lim_at_within: "(f ---> l) net ==> (f ---> l)(net within S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1186
  (* FIXME: rename *)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1187
  unfolding tendsto_def Limits.eventually_within
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1188
  apply (clarify, drule spec, drule (1) mp, drule (1) mp)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1189
  by (auto elim!: eventually_elim1)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1190
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1191
lemma Lim_within_open:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1192
  fixes f :: "'a::topological_space \<Rightarrow> 'b::topological_space"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1193
  assumes"a \<in> S" "open S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1194
  shows "(f ---> l)(at a within S) \<longleftrightarrow> (f ---> l)(at a)" (is "?lhs \<longleftrightarrow> ?rhs")
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1195
proof
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1196
  assume ?lhs
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1197
  { fix A assume "open A" "l \<in> A"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1198
    with `?lhs` have "eventually (\<lambda>x. f x \<in> A) (at a within S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1199
      by (rule topological_tendstoD)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1200
    hence "eventually (\<lambda>x. x \<in> S \<longrightarrow> f x \<in> A) (at a)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1201
      unfolding Limits.eventually_within .
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1202
    then obtain T where "open T" "a \<in> T" "\<forall>x\<in>T. x \<noteq> a \<longrightarrow> x \<in> S \<longrightarrow> f x \<in> A"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1203
      unfolding eventually_at_topological by fast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1204
    hence "open (T \<inter> S)" "a \<in> T \<inter> S" "\<forall>x\<in>(T \<inter> S). x \<noteq> a \<longrightarrow> f x \<in> A"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1205
      using assms by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1206
    hence "\<exists>T. open T \<and> a \<in> T \<and> (\<forall>x\<in>T. x \<noteq> a \<longrightarrow> f x \<in> A)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1207
      by fast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1208
    hence "eventually (\<lambda>x. f x \<in> A) (at a)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1209
      unfolding eventually_at_topological .
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1210
  }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1211
  thus ?rhs by (rule topological_tendstoI)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1212
next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1213
  assume ?rhs
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1214
  thus ?lhs by (rule Lim_at_within)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1215
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1216
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1217
text{* Another limit point characterization. *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1218
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1219
lemma islimpt_sequential:
36667
21404f7dec59 generalize some lemmas
huffman
parents: 36660
diff changeset
  1220
  fixes x :: "'a::metric_space"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1221
  shows "x islimpt S \<longleftrightarrow> (\<exists>f. (\<forall>n::nat. f n \<in> S -{x}) \<and> (f ---> x) sequentially)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1222
    (is "?lhs = ?rhs")
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1223
proof
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1224
  assume ?lhs
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1225
  then obtain f where f:"\<forall>y. y>0 \<longrightarrow> f y \<in> S \<and> f y \<noteq> x \<and> dist (f y) x < y"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1226
    unfolding islimpt_approachable using choice[of "\<lambda>e y. e>0 \<longrightarrow> y\<in>S \<and> y\<noteq>x \<and> dist y x < e"] by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1227
  { fix n::nat
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1228
    have "f (inverse (real n + 1)) \<in> S - {x}" using f by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1229
  }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1230
  moreover
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1231
  { fix e::real assume "e>0"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1232
    hence "\<exists>N::nat. inverse (real (N + 1)) < e" using real_arch_inv[of e] apply (auto simp add: Suc_pred') apply(rule_tac x="n - 1" in exI) by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1233
    then obtain N::nat where "inverse (real (N + 1)) < e" by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1234
    hence "\<forall>n\<ge>N. inverse (real n + 1) < e" by (auto, metis Suc_le_mono le_SucE less_imp_inverse_less nat_le_real_less order_less_trans real_of_nat_Suc real_of_nat_Suc_gt_zero)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1235
    moreover have "\<forall>n\<ge>N. dist (f (inverse (real n + 1))) x < (inverse (real n + 1))" using f `e>0` by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1236
    ultimately have "\<exists>N::nat. \<forall>n\<ge>N. dist (f (inverse (real n + 1))) x < e" apply(rule_tac x=N in exI) apply auto apply(erule_tac x=n in allE)+ by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1237
  }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1238
  hence " ((\<lambda>n. f (inverse (real n + 1))) ---> x) sequentially"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1239
    unfolding Lim_sequentially using f by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1240
  ultimately show ?rhs apply (rule_tac x="(\<lambda>n::nat. f (inverse (real n + 1)))" in exI) by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1241
next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1242
  assume ?rhs
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1243
  then obtain f::"nat\<Rightarrow>'a"  where f:"(\<forall>n. f n \<in> S - {x})" "(\<forall>e>0. \<exists>N. \<forall>n\<ge>N. dist (f n) x < e)" unfolding Lim_sequentially by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1244
  { fix e::real assume "e>0"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1245
    then obtain N where "dist (f N) x < e" using f(2) by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1246
    moreover have "f N\<in>S" "f N \<noteq> x" using f(1) by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1247
    ultimately have "\<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e" by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1248
  }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1249
  thus ?lhs unfolding islimpt_approachable by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1250
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1251
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1252
text{* Basic arithmetical combining theorems for limits. *}
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1253
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1254
lemma Lim_linear:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1255
  assumes "(f ---> l) net" "bounded_linear h"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1256
  shows "((\<lambda>x. h (f x)) ---> h l) net"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1257
using `bounded_linear h` `(f ---> l) net`
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1258
by (rule bounded_linear.tendsto)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1259
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1260
lemma Lim_ident_at: "((\<lambda>x. x) ---> a) (at a)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1261
  unfolding tendsto_def Limits.eventually_at_topological by fast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1262
34964
4e8be3c04d37 Replaced vec1 and dest_vec1 by abbreviation.
hoelzl
parents: 34291
diff changeset
  1263
lemma Lim_const[intro]: "((\<lambda>x. a) ---> a) net" by (rule tendsto_const)
4e8be3c04d37 Replaced vec1 and dest_vec1 by abbreviation.
hoelzl
parents: 34291
diff changeset
  1264
4e8be3c04d37 Replaced vec1 and dest_vec1 by abbreviation.
hoelzl
parents: 34291
diff changeset
  1265
lemma Lim_cmul[intro]:
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1266
  fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1267
  shows "(f ---> l) net ==> ((\<lambda>x. c *\<^sub>R f x) ---> c *\<^sub>R l) net"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1268
  by (intro tendsto_intros)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1269
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1270
lemma Lim_neg:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1271
  fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1272
  shows "(f ---> l) net ==> ((\<lambda>x. -(f x)) ---> -l) net"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1273
  by (rule tendsto_minus)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1274
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1275
lemma Lim_add: fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" shows
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1276
 "(f ---> l) net \<Longrightarrow> (g ---> m) net \<Longrightarrow> ((\<lambda>x. f(x) + g(x)) ---> l + m) net"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1277
  by (rule tendsto_add)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1278
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1279
lemma Lim_sub:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset