src/HOL/Library/Topology_Euclidean_Space.thy
author haftmann
Thu, 25 Jun 2009 14:59:29 +0200
changeset 31804 627d142fce19
parent 31658 f5ffe064412a
child 32685 29e4e567b5f4
permissions -rw-r--r--
arbitrary farewell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
     1
(* Title:      Topology
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
     2
   Author:     Amine Chaieb, University of Cambridge
30267
171b3bd93c90 removed old/broken CVS Ids;
wenzelm
parents: 30262
diff changeset
     3
   Author:     Robert Himmelmann, TU Muenchen
171b3bd93c90 removed old/broken CVS Ids;
wenzelm
parents: 30262
diff changeset
     4
*)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
     5
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
     6
header {* Elementary topology in Euclidean space. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
     7
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
     8
theory Topology_Euclidean_Space
31560
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
     9
imports SEQ Euclidean_Space Product_Vector
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    10
begin
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    11
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    12
declare fstcart_pastecart[simp] sndcart_pastecart[simp]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    13
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    14
subsection{* General notion of a topology *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    15
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    16
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)"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
    17
typedef (open) 'a topology = "{L::('a set) set. istopology L}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    18
  morphisms "openin" "topology"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    19
  unfolding istopology_def by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    20
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    21
lemma istopology_open_in[intro]: "istopology(openin U)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    22
  using openin[of U] by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    23
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    24
lemma topology_inverse': "istopology U \<Longrightarrow> openin (topology U) = U"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    25
  using topology_inverse[unfolded mem_def Collect_def] .
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    26
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    27
lemma topology_inverse_iff: "istopology U \<longleftrightarrow> openin (topology U) = U"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    28
  using topology_inverse[of U] istopology_open_in[of "topology U"] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    29
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    30
lemma topology_eq: "T1 = T2 \<longleftrightarrow> (\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    31
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    32
  {assume "T1=T2" hence "\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S" by simp}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    33
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    34
  {assume H: "\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    35
    hence "openin T1 = openin T2" by (metis mem_def set_ext)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    36
    hence "topology (openin T1) = topology (openin T2)" by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    37
    hence "T1 = T2" unfolding openin_inverse .}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    38
  ultimately show ?thesis by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    39
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    40
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    41
text{* Infer the "universe" from union of all sets in the topology. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    42
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    43
definition "topspace T =  \<Union>{S. openin T S}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    44
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    45
subsection{* Main properties of open sets *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    46
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    47
lemma openin_clauses:
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    48
  fixes U :: "'a topology"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    49
  shows "openin U {}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    50
  "\<And>S T. openin U S \<Longrightarrow> openin U T \<Longrightarrow> openin U (S\<inter>T)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    51
  "\<And>K. (\<forall>S \<in> K. openin U S) \<Longrightarrow> openin U (\<Union>K)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    52
  using openin[of U] unfolding istopology_def Collect_def mem_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    53
  by (metis mem_def subset_eq)+
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    54
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    55
lemma openin_subset[intro]: "openin U S \<Longrightarrow> S \<subseteq> topspace U"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    56
  unfolding topspace_def by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    57
lemma openin_empty[simp]: "openin U {}" by (simp add: openin_clauses)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    58
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    59
lemma openin_Int[intro]: "openin U S \<Longrightarrow> openin U T \<Longrightarrow> openin U (S \<inter> T)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    60
  by (simp add: openin_clauses)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    61
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    62
lemma openin_Union[intro]: "(\<forall>S \<in>K. openin U S) \<Longrightarrow> openin U (\<Union> K)" by (simp add: openin_clauses)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    63
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    64
lemma openin_Un[intro]: "openin U S \<Longrightarrow> openin U T \<Longrightarrow> openin U (S \<union> T)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    65
  using openin_Union[of "{S,T}" U] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    66
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    67
lemma openin_topspace[intro, simp]: "openin U (topspace U)" by (simp add: openin_Union topspace_def)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    68
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    69
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")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    70
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    71
  {assume ?lhs then have ?rhs by auto }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    72
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    73
  {assume H: ?rhs
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
    74
    then obtain t where t: "\<forall>x\<in>S. openin U (t x) \<and> x \<in> t x \<and> t x \<subseteq> S"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    75
      unfolding Ball_def ex_simps(6)[symmetric] choice_iff by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    76
    from t have th0: "\<forall>x\<in> t`S. openin U x" by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
    77
    have "\<Union> t`S = S" using t by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    78
    with openin_Union[OF th0] have "openin U S" by simp }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    79
  ultimately show ?thesis by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    80
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    81
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    82
subsection{* Closed sets *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    83
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    84
definition "closedin U S \<longleftrightarrow> S \<subseteq> topspace U \<and> openin U (topspace U - S)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    85
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    86
lemma closedin_subset: "closedin U S \<Longrightarrow> S \<subseteq> topspace U" by (metis closedin_def)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    87
lemma closedin_empty[simp]: "closedin U {}" by (simp add: closedin_def)
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
    88
lemma closedin_topspace[intro,simp]:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    89
  "closedin U (topspace U)" by (simp add: closedin_def)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    90
lemma closedin_Un[intro]: "closedin U S \<Longrightarrow> closedin U T \<Longrightarrow> closedin U (S \<union> T)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    91
  by (auto simp add: Diff_Un closedin_def)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    92
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    93
lemma Diff_Inter[intro]: "A - \<Inter>S = \<Union> {A - s|s. s\<in>S}" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    94
lemma closedin_Inter[intro]: assumes Ke: "K \<noteq> {}" and Kc: "\<forall>S \<in>K. closedin U S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    95
  shows "closedin U (\<Inter> K)"  using Ke Kc unfolding closedin_def Diff_Inter by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    96
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    97
lemma closedin_Int[intro]: "closedin U S \<Longrightarrow> closedin U T \<Longrightarrow> closedin U (S \<inter> T)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    98
  using closedin_Inter[of "{S,T}" U] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
    99
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   100
lemma Diff_Diff_Int: "A - (A - B) = A \<inter> B" by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   101
lemma openin_closedin_eq: "openin U S \<longleftrightarrow> S \<subseteq> topspace U \<and> closedin U (topspace U - S)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   102
  apply (auto simp add: closedin_def)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   103
  apply (metis openin_subset subset_eq)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   104
  apply (auto simp add: Diff_Diff_Int)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   105
  apply (subgoal_tac "topspace U \<inter> S = S")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   106
  by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   107
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   108
lemma openin_closedin:  "S \<subseteq> topspace U \<Longrightarrow> (openin U S \<longleftrightarrow> closedin U (topspace U - S))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   109
  by (simp add: openin_closedin_eq)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   110
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   111
lemma openin_diff[intro]: assumes oS: "openin U S" and cT: "closedin U T" shows "openin U (S - T)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   112
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   113
  have "S - T = S \<inter> (topspace U - T)" using openin_subset[of U S]  oS cT
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   114
    by (auto simp add: topspace_def openin_subset)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   115
  then show ?thesis using oS cT by (auto simp add: closedin_def)
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   116
qed
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   117
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   118
lemma closedin_diff[intro]: assumes oS: "closedin U S" and cT: "openin U T" shows "closedin U (S - T)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   119
proof-
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   120
  have "S - T = S \<inter> (topspace U - T)" using closedin_subset[of U S]  oS cT
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   121
    by (auto simp add: topspace_def )
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   122
  then show ?thesis using oS cT by (auto simp add: openin_closedin_eq)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   123
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   124
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   125
subsection{* Subspace topology. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   126
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   127
definition "subtopology U V = topology {S \<inter> V |S. openin U S}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   128
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   129
lemma istopology_subtopology: "istopology {S \<inter> V |S. openin U S}" (is "istopology ?L")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   130
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   131
  have "{} \<in> ?L" by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   132
  {fix A B assume A: "A \<in> ?L" and B: "B \<in> ?L"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   133
    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
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   134
    have "A\<inter>B = (Sa \<inter> Sb) \<inter> V" "openin U (Sa \<inter> Sb)"  using Sa Sb by blast+
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   135
    then have "A \<inter> B \<in> ?L" by blast}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   136
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   137
  {fix K assume K: "K \<subseteq> ?L"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   138
    have th0: "?L = (\<lambda>S. S \<inter> V) ` openin U "
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   139
      apply (rule set_ext)
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   140
      apply (simp add: Ball_def image_iff)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   141
      by (metis mem_def)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   142
    from K[unfolded th0 subset_image_iff]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   143
    obtain Sk where Sk: "Sk \<subseteq> openin U" "K = (\<lambda>S. S \<inter> V) ` Sk" by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   144
    have "\<Union>K = (\<Union>Sk) \<inter> V" using Sk by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   145
    moreover have "openin U (\<Union> Sk)" using Sk by (auto simp add: subset_eq mem_def)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   146
    ultimately have "\<Union>K \<in> ?L" by blast}
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   147
  ultimately show ?thesis unfolding istopology_def by blast
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   148
qed
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   149
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   150
lemma openin_subtopology:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   151
  "openin (subtopology U V) S \<longleftrightarrow> (\<exists> T. (openin U T) \<and> (S = T \<inter> V))"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   152
  unfolding subtopology_def topology_inverse'[OF istopology_subtopology]
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   153
  by (auto simp add: Collect_def)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   154
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   155
lemma topspace_subtopology: "topspace(subtopology U V) = topspace U \<inter> V"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   156
  by (auto simp add: topspace_def openin_subtopology)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   157
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   158
lemma closedin_subtopology:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   159
  "closedin (subtopology U V) S \<longleftrightarrow> (\<exists>T. closedin U T \<and> S = T \<inter> V)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   160
  unfolding closedin_def topspace_subtopology
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   161
  apply (simp add: openin_subtopology)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   162
  apply (rule iffI)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   163
  apply clarify
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   164
  apply (rule_tac x="topspace U - T" in exI)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   165
  by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   166
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   167
lemma openin_subtopology_refl: "openin (subtopology U V) V \<longleftrightarrow> V \<subseteq> topspace U"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   168
  unfolding openin_subtopology
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   169
  apply (rule iffI, clarify)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   170
  apply (frule openin_subset[of U])  apply blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   171
  apply (rule exI[where x="topspace U"])
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   172
  by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   173
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   174
lemma subtopology_superset: assumes UV: "topspace U \<subseteq> V"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   175
  shows "subtopology U V = U"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   176
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   177
  {fix S
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   178
    {fix T assume T: "openin U T" "S = T \<inter> V"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   179
      from T openin_subset[OF T(1)] UV have eq: "S = T" by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   180
      have "openin U S" unfolding eq using T by blast}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   181
    moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   182
    {assume S: "openin U S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   183
      hence "\<exists>T. openin U T \<and> S = T \<inter> V"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   184
	using openin_subset[OF S] UV by auto}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   185
    ultimately have "(\<exists>T. openin U T \<and> S = T \<inter> V) \<longleftrightarrow> openin U S" by blast}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   186
  then show ?thesis unfolding topology_eq openin_subtopology by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   187
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   188
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   189
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   190
lemma subtopology_topspace[simp]: "subtopology U (topspace U) = U"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   191
  by (simp add: subtopology_superset)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   192
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   193
lemma subtopology_UNIV[simp]: "subtopology U UNIV = U"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   194
  by (simp add: subtopology_superset)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   195
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   196
subsection{* The universal Euclidean versions are what we use most of the time *}
31418
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
   197
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
   198
definition
31418
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
   199
  euclidean :: "'a::topological_space topology" where
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
   200
  "euclidean = topology open"
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
   201
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   202
lemma open_openin: "open S \<longleftrightarrow> openin euclidean S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   203
  unfolding euclidean_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   204
  apply (rule cong[where x=S and y=S])
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   205
  apply (rule topology_inverse[symmetric])
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   206
  apply (auto simp add: istopology_def)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   207
  by (auto simp add: mem_def subset_eq)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   208
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   209
lemma topspace_euclidean: "topspace euclidean = UNIV"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   210
  apply (simp add: topspace_def)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   211
  apply (rule set_ext)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   212
  by (auto simp add: open_openin[symmetric])
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   213
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   214
lemma topspace_euclidean_subtopology[simp]: "topspace (subtopology euclidean S) = S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   215
  by (simp add: topspace_euclidean topspace_subtopology)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   216
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   217
lemma closed_closedin: "closed S \<longleftrightarrow> closedin euclidean S"
31490
c350f3ad6b0d move definitions of open, closed to RealVector.thy
huffman
parents: 31489
diff changeset
   218
  by (simp add: closed_def closedin_def topspace_euclidean open_openin Compl_eq_Diff_UNIV)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   219
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   220
lemma open_subopen: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>T. open T \<and> x \<in> T \<and> T \<subseteq> S)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   221
  by (simp add: open_openin openin_subopen[symmetric])
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   222
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   223
subsection{* Open and closed balls. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   224
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
   225
definition
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   226
  ball :: "'a::metric_space \<Rightarrow> real \<Rightarrow> 'a set" where
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
   227
  "ball x e = {y. dist x y < e}"
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
   228
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
   229
definition
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   230
  cball :: "'a::metric_space \<Rightarrow> real \<Rightarrow> 'a set" where
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
   231
  "cball x e = {y. dist x y \<le> e}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   232
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   233
lemma mem_ball[simp]: "y \<in> ball x e \<longleftrightarrow> dist x y < e" by (simp add: ball_def)
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   234
lemma mem_cball[simp]: "y \<in> cball x e \<longleftrightarrow> dist x y \<le> e" by (simp add: cball_def)
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   235
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   236
lemma mem_ball_0 [simp]:
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   237
  fixes x :: "'a::real_normed_vector"
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   238
  shows "x \<in> ball 0 e \<longleftrightarrow> norm x < e"
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   239
  by (simp add: dist_norm)
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   240
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   241
lemma mem_cball_0 [simp]:
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   242
  fixes x :: "'a::real_normed_vector"
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   243
  shows "x \<in> cball 0 e \<longleftrightarrow> norm x \<le> e"
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   244
  by (simp add: dist_norm)
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   245
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   246
lemma centre_in_cball[simp]: "x \<in> cball x e \<longleftrightarrow> 0\<le> e"  by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   247
lemma ball_subset_cball[simp,intro]: "ball x e \<subseteq> cball x e" by (simp add: subset_eq)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   248
lemma subset_ball[intro]: "d <= e ==> ball x d \<subseteq> ball x e" by (simp add: subset_eq)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   249
lemma subset_cball[intro]: "d <= e ==> cball x d \<subseteq> cball x e" by (simp add: subset_eq)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   250
lemma ball_max_Un: "ball a (max r s) = ball a r \<union> ball a s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   251
  by (simp add: expand_set_eq) arith
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   252
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   253
lemma ball_min_Int: "ball a (min r s) = ball a r \<inter> ball a s"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   254
  by (simp add: expand_set_eq)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   255
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   256
subsection{* Topological properties of open balls *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   257
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   258
lemma diff_less_iff: "(a::real) - b > 0 \<longleftrightarrow> a > b"
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   259
  "(a::real) - b < 0 \<longleftrightarrow> a < b"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   260
  "a - b < c \<longleftrightarrow> a < c +b" "a - b > c \<longleftrightarrow> a > c +b" by arith+
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   261
lemma diff_le_iff: "(a::real) - b \<ge> 0 \<longleftrightarrow> a \<ge> b" "(a::real) - b \<le> 0 \<longleftrightarrow> a \<le> b"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   262
  "a - b \<le> c \<longleftrightarrow> a \<le> c +b" "a - b \<ge> c \<longleftrightarrow> a \<ge> c +b"  by arith+
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   263
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   264
lemma open_ball[intro, simp]: "open (ball x e)"
31418
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
   265
  unfolding open_dist ball_def Collect_def Ball_def mem_def
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
   266
  unfolding dist_commute
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   267
  apply clarify
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   268
  apply (rule_tac x="e - dist xa x" in exI)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   269
  using dist_triangle_alt[where z=x]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   270
  apply (clarsimp simp add: diff_less_iff)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   271
  apply atomize
31492
5400beeddb55 replace 'topo' with 'open'; add extra type constraint for 'open'
huffman
parents: 31490
diff changeset
   272
  apply (erule_tac x="y" in allE)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   273
  apply (erule_tac x="xa" in allE)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   274
  by arith
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   275
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
   276
lemma centre_in_ball[simp]: "x \<in> ball x e \<longleftrightarrow> e > 0" by (metis mem_ball dist_self)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   277
lemma open_contains_ball: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e>0. ball x e \<subseteq> S)"
31418
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
   278
  unfolding open_dist subset_eq mem_ball Ball_def dist_commute ..
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   279
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   280
lemma open_contains_ball_eq: "open S \<Longrightarrow> \<forall>x. x\<in>S \<longleftrightarrow> (\<exists>e>0. ball x e \<subseteq> S)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   281
  by (metis open_contains_ball subset_eq centre_in_ball)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   282
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   283
lemma ball_eq_empty[simp]: "ball x e = {} \<longleftrightarrow> e \<le> 0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   284
  unfolding mem_ball expand_set_eq
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   285
  apply (simp add: not_less)
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
   286
  by (metis zero_le_dist order_trans dist_self)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   287
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   288
lemma ball_empty[intro]: "e \<le> 0 ==> ball x e = {}" by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   289
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   290
subsection{* Basic "localization" results are handy for connectedness. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   291
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   292
lemma openin_open: "openin (subtopology euclidean U) S \<longleftrightarrow> (\<exists>T. open T \<and> (S = U \<inter> T))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   293
  by (auto simp add: openin_subtopology open_openin[symmetric])
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   294
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   295
lemma openin_open_Int[intro]: "open S \<Longrightarrow> openin (subtopology euclidean U) (U \<inter> S)"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   296
  by (auto simp add: openin_open)
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   297
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   298
lemma open_openin_trans[trans]:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   299
 "open S \<Longrightarrow> open T \<Longrightarrow> T \<subseteq> S \<Longrightarrow> openin (subtopology euclidean S) T"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   300
  by (metis Int_absorb1  openin_open_Int)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   301
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   302
lemma open_subset:  "S \<subseteq> T \<Longrightarrow> open S \<Longrightarrow> openin (subtopology euclidean T) S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   303
  by (auto simp add: openin_open)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   304
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   305
lemma closedin_closed: "closedin (subtopology euclidean U) S \<longleftrightarrow> (\<exists>T. closed T \<and> S = U \<inter> T)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   306
  by (simp add: closedin_subtopology closed_closedin Int_ac)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   307
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   308
lemma closedin_closed_Int: "closed S ==> closedin (subtopology euclidean U) (U \<inter> S)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   309
  by (metis closedin_closed)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   310
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   311
lemma closed_closedin_trans: "closed S \<Longrightarrow> closed T \<Longrightarrow> T \<subseteq> S \<Longrightarrow> closedin (subtopology euclidean S) T"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   312
  apply (subgoal_tac "S \<inter> T = T" )
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   313
  apply auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   314
  apply (frule closedin_closed_Int[of T S])
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   315
  by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   316
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   317
lemma closed_subset: "S \<subseteq> T \<Longrightarrow> closed S \<Longrightarrow> closedin (subtopology euclidean T) S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   318
  by (auto simp add: closedin_closed)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   319
31418
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
   320
lemma openin_euclidean_subtopology_iff:
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
   321
  fixes S U :: "'a::metric_space set"
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
   322
  shows "openin (subtopology euclidean U) S
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   323
  \<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")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   324
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   325
  {assume ?lhs hence ?rhs unfolding openin_subtopology open_openin[symmetric]
31418
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
   326
      by (simp add: open_dist) blast}
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   327
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   328
  {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"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   329
    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)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   330
      by metis
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   331
    let ?T = "\<Union>{B. \<exists>x\<in>S. B = ball x (d x)}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   332
    have oT: "open ?T" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   333
    { fix x assume "x\<in>S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   334
      hence "x \<in> \<Union>{B. \<exists>x\<in>S. B = ball x (d x)}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   335
	apply simp apply(rule_tac x="ball x(d x)" in exI) apply auto
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
   336
        by (rule d [THEN conjunct1])
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   337
      hence "x\<in> ?T \<inter> U" using SU and `x\<in>S` by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   338
    moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   339
    { fix y assume "y\<in>?T"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   340
      then obtain B where "y\<in>B" "B\<in>{B. \<exists>x\<in>S. B = ball x (d x)}" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   341
      then obtain x where "x\<in>S" and x:"y \<in> ball x (d x)" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   342
      assume "y\<in>U"
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
   343
      hence "y\<in>S" using d[OF `x\<in>S`] and x by(auto simp add: dist_commute) }
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   344
    ultimately have "S = ?T \<inter> U" by blast
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   345
    with oT have ?lhs unfolding openin_subtopology open_openin[symmetric] by blast}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   346
  ultimately show ?thesis by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   347
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   348
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   349
text{* These "transitivity" results are handy too. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   350
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   351
lemma openin_trans[trans]: "openin (subtopology euclidean T) S \<Longrightarrow> openin (subtopology euclidean U) T
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   352
  \<Longrightarrow> openin (subtopology euclidean U) S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   353
  unfolding open_openin openin_open by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   354
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   355
lemma openin_open_trans: "openin (subtopology euclidean T) S \<Longrightarrow> open T \<Longrightarrow> open S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   356
  by (auto simp add: openin_open intro: openin_trans)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   357
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   358
lemma closedin_trans[trans]:
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   359
 "closedin (subtopology euclidean T) S \<Longrightarrow>
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   360
           closedin (subtopology euclidean U) T
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   361
           ==> closedin (subtopology euclidean U) S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   362
  by (auto simp add: closedin_closed closed_closedin closed_Inter Int_assoc)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   363
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   364
lemma closedin_closed_trans: "closedin (subtopology euclidean T) S \<Longrightarrow> closed T \<Longrightarrow> closed S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   365
  by (auto simp add: closedin_closed intro: closedin_trans)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   366
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   367
subsection{* Connectedness *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   368
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   369
definition "connected S \<longleftrightarrow>
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   370
  ~(\<exists>e1 e2. open e1 \<and> open e2 \<and> S \<subseteq> (e1 \<union> e2) \<and> (e1 \<inter> e2 \<inter> S = {})
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   371
  \<and> ~(e1 \<inter> S = {}) \<and> ~(e2 \<inter> S = {}))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   372
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   373
lemma connected_local:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   374
 "connected S \<longleftrightarrow> ~(\<exists>e1 e2.
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   375
                 openin (subtopology euclidean S) e1 \<and>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   376
                 openin (subtopology euclidean S) e2 \<and>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   377
                 S \<subseteq> e1 \<union> e2 \<and>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   378
                 e1 \<inter> e2 = {} \<and>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   379
                 ~(e1 = {}) \<and>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   380
                 ~(e2 = {}))"
31418
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
   381
unfolding connected_def openin_open by (safe, blast+)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   382
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   383
lemma exists_diff: "(\<exists>S. P(UNIV - S)) \<longleftrightarrow> (\<exists>S. P S)" (is "?lhs \<longleftrightarrow> ?rhs")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   384
proof-
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   385
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   386
  {assume "?lhs" hence ?rhs by blast }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   387
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   388
  {fix S assume H: "P S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   389
    have "S = UNIV - (UNIV - S)" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   390
    with H have "P (UNIV - (UNIV - S))" by metis }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   391
  ultimately show ?thesis by metis
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   392
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   393
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   394
lemma connected_clopen: "connected S \<longleftrightarrow>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   395
        (\<forall>T. openin (subtopology euclidean S) T \<and>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   396
            closedin (subtopology euclidean S) T \<longrightarrow> T = {} \<or> T = S)" (is "?lhs \<longleftrightarrow> ?rhs")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   397
proof-
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   398
  have " \<not> connected S \<longleftrightarrow> (\<exists>e1 e2. open e1 \<and> open (UNIV - e2) \<and> S \<subseteq> e1 \<union> (UNIV - e2) \<and> e1 \<inter> (UNIV - e2) \<inter> S = {} \<and> e1 \<inter> S \<noteq> {} \<and> (UNIV - e2) \<inter> S \<noteq> {})"
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   399
    unfolding connected_def openin_open closedin_closed
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   400
    apply (subst exists_diff) by blast
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   401
  hence th0: "connected S \<longleftrightarrow> \<not> (\<exists>e2 e1. closed e2 \<and> open e1 \<and> S \<subseteq> e1 \<union> (UNIV - e2) \<and> e1 \<inter> (UNIV - e2) \<inter> S = {} \<and> e1 \<inter> S \<noteq> {} \<and> (UNIV - e2) \<inter> S \<noteq> {})"
31490
c350f3ad6b0d move definitions of open, closed to RealVector.thy
huffman
parents: 31489
diff changeset
   402
    (is " _ \<longleftrightarrow> \<not> (\<exists>e2 e1. ?P e2 e1)") apply (simp add: closed_def Compl_eq_Diff_UNIV) by metis
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   403
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   404
  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'))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   405
    (is "_ \<longleftrightarrow> \<not> (\<exists>t' t. ?Q t' t)")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   406
    unfolding connected_def openin_open closedin_closed by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   407
  {fix e2
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   408
    {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)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   409
	by auto}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   410
    then have "(\<exists>e1. ?P e2 e1) \<longleftrightarrow> (\<exists>t. ?Q e2 t)" by metis}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   411
  then have "\<forall>e2. (\<exists>e1. ?P e2 e1) \<longleftrightarrow> (\<exists>t. ?Q e2 t)" by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   412
  then show ?thesis unfolding th0 th1 by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   413
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   414
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   415
lemma connected_empty[simp, intro]: "connected {}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   416
  by (simp add: connected_def)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   417
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   418
subsection{* Hausdorff and other separation properties *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   419
31457
d1cb222438d8 class replaces axclass
haftmann
parents: 31421
diff changeset
   420
class t0_space =
d1cb222438d8 class replaces axclass
haftmann
parents: 31421
diff changeset
   421
  assumes t0_space: "x \<noteq> y \<Longrightarrow> \<exists>U. open U \<and> \<not> (x \<in> U \<longleftrightarrow> y \<in> U)"
d1cb222438d8 class replaces axclass
haftmann
parents: 31421
diff changeset
   422
d1cb222438d8 class replaces axclass
haftmann
parents: 31421
diff changeset
   423
class t1_space =
d1cb222438d8 class replaces axclass
haftmann
parents: 31421
diff changeset
   424
  assumes t1_space: "x \<noteq> y \<Longrightarrow> \<exists>U V. open U \<and> open V \<and> x \<in> U \<and> y \<notin> U \<and> x \<notin> V \<and> y \<in> V"
d1cb222438d8 class replaces axclass
haftmann
parents: 31421
diff changeset
   425
begin
d1cb222438d8 class replaces axclass
haftmann
parents: 31421
diff changeset
   426
d1cb222438d8 class replaces axclass
haftmann
parents: 31421
diff changeset
   427
subclass t0_space
d1cb222438d8 class replaces axclass
haftmann
parents: 31421
diff changeset
   428
proof
d1cb222438d8 class replaces axclass
haftmann
parents: 31421
diff changeset
   429
qed (fast dest: t1_space)
d1cb222438d8 class replaces axclass
haftmann
parents: 31421
diff changeset
   430
d1cb222438d8 class replaces axclass
haftmann
parents: 31421
diff changeset
   431
end
31421
1501fc26f11b add classes for t0, t1, and t2 spaces
huffman
parents: 31420
diff changeset
   432
1501fc26f11b add classes for t0, t1, and t2 spaces
huffman
parents: 31420
diff changeset
   433
text {* T2 spaces are also known as Hausdorff spaces. *}
1501fc26f11b add classes for t0, t1, and t2 spaces
huffman
parents: 31420
diff changeset
   434
31457
d1cb222438d8 class replaces axclass
haftmann
parents: 31421
diff changeset
   435
class t2_space =
d1cb222438d8 class replaces axclass
haftmann
parents: 31421
diff changeset
   436
  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 = {}"
d1cb222438d8 class replaces axclass
haftmann
parents: 31421
diff changeset
   437
begin
d1cb222438d8 class replaces axclass
haftmann
parents: 31421
diff changeset
   438
d1cb222438d8 class replaces axclass
haftmann
parents: 31421
diff changeset
   439
subclass t1_space
d1cb222438d8 class replaces axclass
haftmann
parents: 31421
diff changeset
   440
proof
d1cb222438d8 class replaces axclass
haftmann
parents: 31421
diff changeset
   441
qed (fast dest: hausdorff)
d1cb222438d8 class replaces axclass
haftmann
parents: 31421
diff changeset
   442
d1cb222438d8 class replaces axclass
haftmann
parents: 31421
diff changeset
   443
end
31421
1501fc26f11b add classes for t0, t1, and t2 spaces
huffman
parents: 31420
diff changeset
   444
1501fc26f11b add classes for t0, t1, and t2 spaces
huffman
parents: 31420
diff changeset
   445
instance metric_space \<subseteq> t2_space
1501fc26f11b add classes for t0, t1, and t2 spaces
huffman
parents: 31420
diff changeset
   446
proof
1501fc26f11b add classes for t0, t1, and t2 spaces
huffman
parents: 31420
diff changeset
   447
  fix x y :: "'a::metric_space"
1501fc26f11b add classes for t0, t1, and t2 spaces
huffman
parents: 31420
diff changeset
   448
  assume xy: "x \<noteq> y"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   449
  let ?U = "ball x (dist x y / 2)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   450
  let ?V = "ball y (dist x y / 2)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   451
  have th0: "\<And>d x y z. (d x z :: real) <= d x y + d y z \<Longrightarrow> d y z = d z y
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   452
               ==> ~(d x y * 2 < d x z \<and> d z y * 2 < d x z)" by arith
31421
1501fc26f11b add classes for t0, t1, and t2 spaces
huffman
parents: 31420
diff changeset
   453
  have "open ?U \<and> open ?V \<and> x \<in> ?U \<and> y \<in> ?V \<and> ?U \<inter> ?V = {}"
1501fc26f11b add classes for t0, t1, and t2 spaces
huffman
parents: 31420
diff changeset
   454
    using dist_pos_lt[OF xy] th0[of dist,OF dist_triangle dist_commute]
1501fc26f11b add classes for t0, t1, and t2 spaces
huffman
parents: 31420
diff changeset
   455
    by (auto simp add: expand_set_eq)
1501fc26f11b add classes for t0, t1, and t2 spaces
huffman
parents: 31420
diff changeset
   456
  then show "\<exists>U V. open U \<and> open V \<and> x \<in> U \<and> y \<in> V \<and> U \<inter> V = {}"
1501fc26f11b add classes for t0, t1, and t2 spaces
huffman
parents: 31420
diff changeset
   457
    by blast
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   458
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   459
31418
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
   460
lemma separation_t2:
31421
1501fc26f11b add classes for t0, t1, and t2 spaces
huffman
parents: 31420
diff changeset
   461
  fixes x y :: "'a::t2_space"
31418
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
   462
  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 = {})"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   463
  using hausdorff[of x y] by blast
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   464
31418
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
   465
lemma separation_t1:
31421
1501fc26f11b add classes for t0, t1, and t2 spaces
huffman
parents: 31420
diff changeset
   466
  fixes x y :: "'a::t1_space"
31418
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
   467
  shows "x \<noteq> y \<longleftrightarrow> (\<exists>U V. open U \<and> open V \<and> x \<in>U \<and> y\<notin> U \<and> x\<notin>V \<and> y\<in>V)"
31421
1501fc26f11b add classes for t0, t1, and t2 spaces
huffman
parents: 31420
diff changeset
   468
  using t1_space[of x y] by blast
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   469
31418
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
   470
lemma separation_t0:
31421
1501fc26f11b add classes for t0, t1, and t2 spaces
huffman
parents: 31420
diff changeset
   471
  fixes x y :: "'a::t0_space"
1501fc26f11b add classes for t0, t1, and t2 spaces
huffman
parents: 31420
diff changeset
   472
  shows "x \<noteq> y \<longleftrightarrow> (\<exists>U. open U \<and> ~(x\<in>U \<longleftrightarrow> y\<in>U))"
1501fc26f11b add classes for t0, t1, and t2 spaces
huffman
parents: 31420
diff changeset
   473
  using t0_space[of x y] by blast
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   474
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   475
subsection{* Limit points *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   476
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   477
definition
31420
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
   478
  islimpt:: "'a::topological_space \<Rightarrow> 'a set \<Rightarrow> bool"
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
   479
    (infixr "islimpt" 60) where
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   480
  "x islimpt S \<longleftrightarrow> (\<forall>T. x\<in>T \<longrightarrow> open T \<longrightarrow> (\<exists>y\<in>S. y\<in>T \<and> y\<noteq>x))"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   481
31489
10080e31b294 lemmas islimptI, islimptE; generalize open_inter_closure_subset
huffman
parents: 31488
diff changeset
   482
lemma islimptI:
10080e31b294 lemmas islimptI, islimptE; generalize open_inter_closure_subset
huffman
parents: 31488
diff changeset
   483
  assumes "\<And>T. x \<in> T \<Longrightarrow> open T \<Longrightarrow> \<exists>y\<in>S. y \<in> T \<and> y \<noteq> x"
10080e31b294 lemmas islimptI, islimptE; generalize open_inter_closure_subset
huffman
parents: 31488
diff changeset
   484
  shows "x islimpt S"
10080e31b294 lemmas islimptI, islimptE; generalize open_inter_closure_subset
huffman
parents: 31488
diff changeset
   485
  using assms unfolding islimpt_def by auto
10080e31b294 lemmas islimptI, islimptE; generalize open_inter_closure_subset
huffman
parents: 31488
diff changeset
   486
10080e31b294 lemmas islimptI, islimptE; generalize open_inter_closure_subset
huffman
parents: 31488
diff changeset
   487
lemma islimptE:
10080e31b294 lemmas islimptI, islimptE; generalize open_inter_closure_subset
huffman
parents: 31488
diff changeset
   488
  assumes "x islimpt S" and "x \<in> T" and "open T"
10080e31b294 lemmas islimptI, islimptE; generalize open_inter_closure_subset
huffman
parents: 31488
diff changeset
   489
  obtains y where "y \<in> S" and "y \<in> T" and "y \<noteq> x"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   490
  using assms unfolding islimpt_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   491
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   492
lemma islimpt_subset: "x islimpt S \<Longrightarrow> S \<subseteq> T ==> x islimpt T" by (auto simp add: islimpt_def)
31420
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
   493
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
   494
lemma islimpt_approachable:
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
   495
  fixes x :: "'a::metric_space"
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
   496
  shows "x islimpt S \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   497
  unfolding islimpt_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   498
  apply auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   499
  apply(erule_tac x="ball x e" in allE)
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
   500
  apply auto
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
   501
  apply(rule_tac x=y in bexI)
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
   502
  apply (auto simp add: dist_commute)
31418
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
   503
  apply (simp add: open_dist, drule (1) bspec)
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
   504
  apply (clarify, drule spec, drule (1) mp, auto)
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
   505
  done
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   506
31420
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
   507
lemma islimpt_approachable_le:
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
   508
  fixes x :: "'a::metric_space"
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
   509
  shows "x islimpt S \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in> S. x' \<noteq> x \<and> dist x' x <= e)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   510
  unfolding islimpt_approachable
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   511
  using approachable_lt_le[where f="\<lambda>x'. dist x' x" and P="\<lambda>x'. \<not> (x'\<in>S \<and> x'\<noteq>x)"]
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
   512
  by metis (* FIXME: VERY slow! *)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   513
31457
d1cb222438d8 class replaces axclass
haftmann
parents: 31421
diff changeset
   514
class perfect_space =
31420
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
   515
  (* FIXME: perfect_space should inherit from topological_space *)
31457
d1cb222438d8 class replaces axclass
haftmann
parents: 31421
diff changeset
   516
  assumes islimpt_UNIV [simp, intro]: "(x::'a::metric_space) islimpt UNIV"
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   517
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   518
lemma perfect_choose_dist:
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   519
  fixes x :: "'a::perfect_space"
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   520
  shows "0 < r \<Longrightarrow> \<exists>a. a \<noteq> x \<and> dist a x < r"
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   521
using islimpt_UNIV [of x]
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   522
by (simp add: islimpt_approachable)
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   523
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   524
instance real :: perfect_space
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   525
apply default
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   526
apply (rule islimpt_approachable [THEN iffD2])
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   527
apply (clarify, rule_tac x="x + e/2" in bexI)
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   528
apply (auto simp add: dist_norm)
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   529
done
31420
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
   530
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   531
instance "^" :: (perfect_space, finite) perfect_space
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   532
proof
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   533
  fix x :: "'a ^ 'b"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   534
  {
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   535
    fix e :: real assume "0 < e"
31804
627d142fce19 arbitrary farewell
haftmann
parents: 31658
diff changeset
   536
    def a \<equiv> "x $ undefined"
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   537
    have "a islimpt UNIV" by (rule islimpt_UNIV)
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   538
    with `0 < e` obtain b where "b \<noteq> a" and "dist b a < e"
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   539
      unfolding islimpt_approachable by auto
31804
627d142fce19 arbitrary farewell
haftmann
parents: 31658
diff changeset
   540
    def y \<equiv> "Cart_lambda ((Cart_nth x)(undefined := b))"
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   541
    from `b \<noteq> a` have "y \<noteq> x"
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   542
      unfolding a_def y_def by (simp add: Cart_eq)
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   543
    from `dist b a < e` have "dist y x < e"
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   544
      unfolding dist_vector_def a_def y_def
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   545
      apply simp
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   546
      apply (rule le_less_trans [OF setL2_le_setsum [OF zero_le_dist]])
31804
627d142fce19 arbitrary farewell
haftmann
parents: 31658
diff changeset
   547
      apply (subst setsum_diff1' [where a=undefined], simp, simp, simp)
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   548
      done
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   549
    from `y \<noteq> x` and `dist y x < e`
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   550
    have "\<exists>y\<in>UNIV. y \<noteq> x \<and> dist y x < e" by auto
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   551
  }
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   552
  then show "x islimpt UNIV" unfolding islimpt_approachable by blast
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   553
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   554
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   555
lemma closed_limpt: "closed S \<longleftrightarrow> (\<forall>x. x islimpt S \<longrightarrow> x \<in> S)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   556
  unfolding closed_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   557
  apply (subst open_subopen)
31490
c350f3ad6b0d move definitions of open, closed to RealVector.thy
huffman
parents: 31489
diff changeset
   558
  apply (simp add: islimpt_def subset_eq Compl_eq_Diff_UNIV)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   559
  by (metis DiffE DiffI UNIV_I insertCI insert_absorb mem_def)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   560
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   561
lemma islimpt_EMPTY[simp]: "\<not> x islimpt {}"
31420
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
   562
  unfolding islimpt_def by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   563
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
   564
lemma closed_positive_orthant: "closed {x::real^'n::finite. \<forall>i. 0 \<le>x$i}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   565
proof-
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
   566
  let ?U = "UNIV :: 'n set"
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
   567
  let ?O = "{x::real^'n. \<forall>i. x$i\<ge>0}"
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
   568
  {fix x:: "real^'n" and i::'n assume H: "\<forall>e>0. \<exists>x'\<in>?O. x' \<noteq> x \<and> dist x' x < e"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   569
    and xi: "x$i < 0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   570
    from xi have th0: "-x$i > 0" by arith
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   571
    from H[rule_format, OF th0] obtain x' where x': "x' \<in>?O" "x' \<noteq> x" "dist x' x < -x $ i" by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   572
      have th:" \<And>b a (x::real). abs x <= b \<Longrightarrow> b <= a ==> ~(a + x < 0)" by arith
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   573
      have th': "\<And>x (y::real). x < 0 \<Longrightarrow> 0 <= y ==> abs x <= abs (y - x)" by arith
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
   574
      have th1: "\<bar>x$i\<bar> \<le> \<bar>(x' - x)$i\<bar>" using x'(1) xi
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   575
	apply (simp only: vector_component)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   576
	by (rule th') auto
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
   577
      have th2: "\<bar>dist x x'\<bar> \<ge> \<bar>(x' - x)$i\<bar>" using  component_le_norm[of "x'-x" i]
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
   578
	apply (simp add: dist_norm) by norm
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
   579
      from th[OF th1 th2] x'(3) have False by (simp add: dist_commute) }
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   580
  then show ?thesis unfolding closed_limpt islimpt_approachable
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   581
    unfolding not_le[symmetric] by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   582
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   583
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
   584
lemma finite_set_avoid:
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   585
  fixes a :: "'a::metric_space"
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
   586
  assumes fS: "finite S" shows  "\<exists>d>0. \<forall>x\<in>S. x \<noteq> a \<longrightarrow> d <= dist a x"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   587
proof(induct rule: finite_induct[OF fS])
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   588
  case 1 thus ?case apply auto by ferrack
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   589
next
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   590
  case (2 x F)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   591
  from 2 obtain d where d: "d >0" "\<forall>x\<in>F. x\<noteq>a \<longrightarrow> d \<le> dist a x" by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   592
  {assume "x = a" hence ?case using d by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   593
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   594
  {assume xa: "x\<noteq>a"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   595
    let ?d = "min d (dist a x)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   596
    have dp: "?d > 0" using xa d(1) using dist_nz by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   597
    from d have d': "\<forall>x\<in>F. x\<noteq>a \<longrightarrow> ?d \<le> dist a x" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   598
    with dp xa have ?case by(auto intro!: exI[where x="?d"]) }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   599
  ultimately show ?case by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   600
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   601
31420
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
   602
lemma islimpt_finite:
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
   603
  fixes S :: "'a::metric_space set"
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
   604
  assumes fS: "finite S" shows "\<not> a islimpt S"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   605
  unfolding islimpt_approachable
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
   606
  using finite_set_avoid[OF fS, of a] by (metis dist_commute  not_le)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   607
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   608
lemma islimpt_Un: "x islimpt (S \<union> T) \<longleftrightarrow> x islimpt S \<or> x islimpt T"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   609
  apply (rule iffI)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   610
  defer
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   611
  apply (metis Un_upper1 Un_upper2 islimpt_subset)
31420
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
   612
  unfolding islimpt_def
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
   613
  apply (rule ccontr, clarsimp, rename_tac A B)
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
   614
  apply (drule_tac x="A \<inter> B" in spec)
31490
c350f3ad6b0d move definitions of open, closed to RealVector.thy
huffman
parents: 31489
diff changeset
   615
  apply (auto simp add: open_Int)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   616
  done
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   617
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   618
lemma discrete_imp_closed:
31418
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
   619
  fixes S :: "'a::metric_space set"
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   620
  assumes e: "0 < e" and d: "\<forall>x \<in> S. \<forall>y \<in> S. dist y x < e \<longrightarrow> y = x"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   621
  shows "closed S"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   622
proof-
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   623
  {fix x assume C: "\<forall>e>0. \<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   624
    from e have e2: "e/2 > 0" by arith
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   625
    from C[rule_format, OF e2] obtain y where y: "y \<in> S" "y\<noteq>x" "dist y x < e/2" by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   626
    let ?m = "min (e/2) (dist x y) "
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   627
    from e2 y(2) have mp: "?m > 0" by (simp add: dist_nz[THEN sym])
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   628
    from C[rule_format, OF mp] obtain z where z: "z \<in> S" "z\<noteq>x" "dist z x < ?m" by blast
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   629
    have th: "dist z y < e" using z y
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
   630
      by (intro dist_triangle_lt [where z=x], simp)
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   631
    from d[rule_format, OF y(1) z(1) th] y z
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
   632
    have False by (auto simp add: dist_commute)}
31420
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
   633
  then show ?thesis by (metis islimpt_approachable closed_limpt [where 'a='a])
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   634
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   635
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   636
subsection{* Interior of a Set *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   637
definition "interior S = {x. \<exists>T. open T \<and> x \<in> T \<and> T \<subseteq> S}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   638
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   639
lemma interior_eq: "interior S = S \<longleftrightarrow> open S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   640
  apply (simp add: expand_set_eq interior_def)
31418
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
   641
  apply (subst (2) open_subopen) by (safe, blast+)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   642
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   643
lemma interior_open: "open S ==> (interior S = S)" by (metis interior_eq)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   644
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   645
lemma interior_empty[simp]: "interior {} = {}" by (simp add: interior_def)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   646
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   647
lemma open_interior[simp, intro]: "open(interior S)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   648
  apply (simp add: interior_def)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   649
  apply (subst open_subopen) by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   650
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   651
lemma interior_interior[simp]: "interior(interior S) = interior S" by (metis interior_eq open_interior)
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   652
lemma interior_subset: "interior S \<subseteq> S" by (auto simp add: interior_def)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   653
lemma subset_interior: "S \<subseteq> T ==> (interior S) \<subseteq> (interior T)" by (auto simp add: interior_def)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   654
lemma interior_maximal: "T \<subseteq> S \<Longrightarrow> open T ==> T \<subseteq> (interior S)" by (auto simp add: interior_def)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   655
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"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   656
  by (metis equalityI interior_maximal interior_subset open_interior)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   657
lemma mem_interior: "x \<in> interior S \<longleftrightarrow> (\<exists>e. 0 < e \<and> ball x e \<subseteq> S)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   658
  apply (simp add: interior_def)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   659
  by (metis open_contains_ball centre_in_ball open_ball subset_trans)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   660
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   661
lemma open_subset_interior: "open S ==> S \<subseteq> interior T \<longleftrightarrow> S \<subseteq> T"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   662
  by (metis interior_maximal interior_subset subset_trans)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   663
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   664
lemma interior_inter[simp]: "interior(S \<inter> T) = interior S \<inter> interior T"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   665
  apply (rule equalityI, simp)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   666
  apply (metis Int_lower1 Int_lower2 subset_interior)
31490
c350f3ad6b0d move definitions of open, closed to RealVector.thy
huffman
parents: 31489
diff changeset
   667
  by (metis Int_mono interior_subset open_Int open_interior open_subset_interior)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   668
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   669
lemma interior_limit_point [intro]:
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   670
  fixes x :: "'a::perfect_space"
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   671
  assumes x: "x \<in> interior S" shows "x islimpt S"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   672
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   673
  from x obtain e where e: "e>0" "\<forall>x'. dist x x' < e \<longrightarrow> x' \<in> S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   674
    unfolding mem_interior subset_eq Ball_def mem_ball by blast
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   675
  {
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   676
    fix d::real assume d: "d>0"
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   677
    let ?m = "min d e"
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   678
    have mde2: "0 < ?m" using e(1) d(1) by simp
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   679
    from perfect_choose_dist [OF mde2, of x]
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   680
    obtain y where "y \<noteq> x" and "dist y x < ?m" by blast
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   681
    then have "dist y x < e" "dist y x < d" by simp_all
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   682
    from `dist y x < e` e(2) have "y \<in> S" by (simp add: dist_commute)
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   683
    have "\<exists>x'\<in>S. x'\<noteq> x \<and> dist x' x < d"
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   684
      using `y \<in> S` `y \<noteq> x` `dist y x < d` by fast
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   685
  }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   686
  then show ?thesis unfolding islimpt_approachable by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   687
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   688
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   689
lemma interior_closed_Un_empty_interior:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   690
  assumes cS: "closed S" and iT: "interior T = {}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   691
  shows "interior(S \<union> T) = interior S"
31394
8d8417abb14f generalize lemma interior_closed_Un_empty_interior
huffman
parents: 31393
diff changeset
   692
proof
8d8417abb14f generalize lemma interior_closed_Un_empty_interior
huffman
parents: 31393
diff changeset
   693
  show "interior S \<subseteq> interior (S\<union>T)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   694
    by (rule subset_interior, blast)
31394
8d8417abb14f generalize lemma interior_closed_Un_empty_interior
huffman
parents: 31393
diff changeset
   695
next
8d8417abb14f generalize lemma interior_closed_Un_empty_interior
huffman
parents: 31393
diff changeset
   696
  show "interior (S \<union> T) \<subseteq> interior S"
8d8417abb14f generalize lemma interior_closed_Un_empty_interior
huffman
parents: 31393
diff changeset
   697
  proof
8d8417abb14f generalize lemma interior_closed_Un_empty_interior
huffman
parents: 31393
diff changeset
   698
    fix x assume "x \<in> interior (S \<union> T)"
8d8417abb14f generalize lemma interior_closed_Un_empty_interior
huffman
parents: 31393
diff changeset
   699
    then obtain R where "open R" "x \<in> R" "R \<subseteq> S \<union> T"
8d8417abb14f generalize lemma interior_closed_Un_empty_interior
huffman
parents: 31393
diff changeset
   700
      unfolding interior_def by fast
8d8417abb14f generalize lemma interior_closed_Un_empty_interior
huffman
parents: 31393
diff changeset
   701
    show "x \<in> interior S"
8d8417abb14f generalize lemma interior_closed_Un_empty_interior
huffman
parents: 31393
diff changeset
   702
    proof (rule ccontr)
8d8417abb14f generalize lemma interior_closed_Un_empty_interior
huffman
parents: 31393
diff changeset
   703
      assume "x \<notin> interior S"
8d8417abb14f generalize lemma interior_closed_Un_empty_interior
huffman
parents: 31393
diff changeset
   704
      with `x \<in> R` `open R` obtain y where "y \<in> R - S"
8d8417abb14f generalize lemma interior_closed_Un_empty_interior
huffman
parents: 31393
diff changeset
   705
        unfolding interior_def expand_set_eq by fast
31490
c350f3ad6b0d move definitions of open, closed to RealVector.thy
huffman
parents: 31489
diff changeset
   706
      from `open R` `closed S` have "open (R - S)" by (rule open_Diff)
31394
8d8417abb14f generalize lemma interior_closed_Un_empty_interior
huffman
parents: 31393
diff changeset
   707
      from `R \<subseteq> S \<union> T` have "R - S \<subseteq> T" by fast
8d8417abb14f generalize lemma interior_closed_Un_empty_interior
huffman
parents: 31393
diff changeset
   708
      from `y \<in> R - S` `open (R - S)` `R - S \<subseteq> T` `interior T = {}`
8d8417abb14f generalize lemma interior_closed_Un_empty_interior
huffman
parents: 31393
diff changeset
   709
      show "False" unfolding interior_def by fast
8d8417abb14f generalize lemma interior_closed_Un_empty_interior
huffman
parents: 31393
diff changeset
   710
    qed
8d8417abb14f generalize lemma interior_closed_Un_empty_interior
huffman
parents: 31393
diff changeset
   711
  qed
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   712
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   713
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   714
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   715
subsection{* Closure of a Set *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   716
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   717
definition "closure S = S \<union> {x | x. x islimpt S}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   718
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   719
lemma closure_interior: "closure S = UNIV - interior (UNIV - S)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   720
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   721
  { fix x
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   722
    have "x\<in>UNIV - interior (UNIV - S) \<longleftrightarrow> x \<in> closure S"  (is "?lhs = ?rhs")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   723
    proof
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   724
      let ?exT = "\<lambda> y. (\<exists>T. open T \<and> y \<in> T \<and> T \<subseteq> UNIV - S)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   725
      assume "?lhs"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   726
      hence *:"\<not> ?exT x"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   727
	unfolding interior_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   728
	by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   729
      { assume "\<not> ?rhs"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   730
	hence False using *
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   731
	  unfolding closure_def islimpt_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   732
	  by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   733
      }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   734
      thus "?rhs"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   735
	by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   736
    next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   737
      assume "?rhs" thus "?lhs"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   738
	unfolding closure_def interior_def islimpt_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   739
	by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   740
    qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   741
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   742
  thus ?thesis
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   743
    by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   744
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   745
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   746
lemma interior_closure: "interior S = UNIV - (closure (UNIV - S))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   747
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   748
  { fix x
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   749
    have "x \<in> interior S \<longleftrightarrow> x \<in> UNIV - (closure (UNIV - S))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   750
      unfolding interior_def closure_def islimpt_def
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
   751
      by blast (* FIXME: VERY slow! *)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   752
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   753
  thus ?thesis
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   754
    by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   755
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   756
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   757
lemma closed_closure[simp, intro]: "closed (closure S)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   758
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   759
  have "closed (UNIV - interior (UNIV -S))" by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   760
  thus ?thesis using closure_interior[of S] by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   761
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   762
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   763
lemma closure_hull: "closure S = closed hull S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   764
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   765
  have "S \<subseteq> closure S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   766
    unfolding closure_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   767
    by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   768
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   769
  have "closed (closure S)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   770
    using closed_closure[of S]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   771
    by assumption
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   772
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   773
  { fix t
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   774
    assume *:"S \<subseteq> t" "closed t"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   775
    { fix x
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   776
      assume "x islimpt S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   777
      hence "x islimpt t" using *(1)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   778
	using islimpt_subset[of x, of S, of t]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   779
	by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   780
    }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   781
    with * have "closure S \<subseteq> t"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   782
      unfolding closure_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   783
      using closed_limpt[of t]
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
   784
      by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   785
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   786
  ultimately show ?thesis
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   787
    using hull_unique[of S, of "closure S", of closed]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   788
    unfolding mem_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   789
    by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   790
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   791
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   792
lemma closure_eq: "closure S = S \<longleftrightarrow> closed S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   793
  unfolding closure_hull
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   794
  using hull_eq[of closed, unfolded mem_def, OF  closed_Inter, of S]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   795
  by (metis mem_def subset_eq)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   796
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   797
lemma closure_closed[simp]: "closed S \<Longrightarrow> closure S = S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   798
  using closure_eq[of S]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   799
  by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   800
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   801
lemma closure_closure[simp]: "closure (closure S) = closure S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   802
  unfolding closure_hull
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   803
  using hull_hull[of closed S]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   804
  by assumption
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   805
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   806
lemma closure_subset: "S \<subseteq> closure S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   807
  unfolding closure_hull
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   808
  using hull_subset[of S closed]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   809
  by assumption
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   810
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   811
lemma subset_closure: "S \<subseteq> T \<Longrightarrow> closure S \<subseteq> closure T"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   812
  unfolding closure_hull
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   813
  using hull_mono[of S T closed]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   814
  by assumption
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   815
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   816
lemma closure_minimal: "S \<subseteq> T \<Longrightarrow>  closed T \<Longrightarrow> closure S \<subseteq> T"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   817
  using hull_minimal[of S T closed]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   818
  unfolding closure_hull mem_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   819
  by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   820
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   821
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"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   822
  using hull_unique[of S T closed]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   823
  unfolding closure_hull mem_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   824
  by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   825
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   826
lemma closure_empty[simp]: "closure {} = {}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   827
  using closed_empty closure_closed[of "{}"]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   828
  by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   829
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   830
lemma closure_univ[simp]: "closure UNIV = UNIV"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   831
  using closure_closed[of UNIV]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   832
  by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   833
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   834
lemma closure_eq_empty: "closure S = {} \<longleftrightarrow> S = {}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   835
  using closure_empty closure_subset[of S]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   836
  by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   837
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   838
lemma closure_subset_eq: "closure S \<subseteq> S \<longleftrightarrow> closed S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   839
  using closure_eq[of S] closure_subset[of S]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   840
  by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   841
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   842
lemma open_inter_closure_eq_empty:
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   843
  "open S \<Longrightarrow> (S \<inter> closure T) = {} \<longleftrightarrow> S \<inter> T = {}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   844
  using open_subset_interior[of S "UNIV - T"]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   845
  using interior_subset[of "UNIV - T"]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   846
  unfolding closure_interior
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   847
  by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   848
31420
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
   849
lemma open_inter_closure_subset:
31489
10080e31b294 lemmas islimptI, islimptE; generalize open_inter_closure_subset
huffman
parents: 31488
diff changeset
   850
  "open S \<Longrightarrow> (S \<inter> (closure T)) \<subseteq> closure(S \<inter> T)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   851
proof
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   852
  fix x
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   853
  assume as: "open S" "x \<in> S \<inter> closure T"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   854
  { assume *:"x islimpt T"
31489
10080e31b294 lemmas islimptI, islimptE; generalize open_inter_closure_subset
huffman
parents: 31488
diff changeset
   855
    have "x islimpt (S \<inter> T)"
10080e31b294 lemmas islimptI, islimptE; generalize open_inter_closure_subset
huffman
parents: 31488
diff changeset
   856
    proof (rule islimptI)
10080e31b294 lemmas islimptI, islimptE; generalize open_inter_closure_subset
huffman
parents: 31488
diff changeset
   857
      fix A
10080e31b294 lemmas islimptI, islimptE; generalize open_inter_closure_subset
huffman
parents: 31488
diff changeset
   858
      assume "x \<in> A" "open A"
10080e31b294 lemmas islimptI, islimptE; generalize open_inter_closure_subset
huffman
parents: 31488
diff changeset
   859
      with as have "x \<in> A \<inter> S" "open (A \<inter> S)"
31490
c350f3ad6b0d move definitions of open, closed to RealVector.thy
huffman
parents: 31489
diff changeset
   860
        by (simp_all add: open_Int)
31489
10080e31b294 lemmas islimptI, islimptE; generalize open_inter_closure_subset
huffman
parents: 31488
diff changeset
   861
      with * obtain y where "y \<in> T" "y \<in> A \<inter> S" "y \<noteq> x"
10080e31b294 lemmas islimptI, islimptE; generalize open_inter_closure_subset
huffman
parents: 31488
diff changeset
   862
        by (rule islimptE)
10080e31b294 lemmas islimptI, islimptE; generalize open_inter_closure_subset
huffman
parents: 31488
diff changeset
   863
      hence "y \<in> S \<inter> T" "y \<in> A \<and> y \<noteq> x"
10080e31b294 lemmas islimptI, islimptE; generalize open_inter_closure_subset
huffman
parents: 31488
diff changeset
   864
        by simp_all
10080e31b294 lemmas islimptI, islimptE; generalize open_inter_closure_subset
huffman
parents: 31488
diff changeset
   865
      thus "\<exists>y\<in>(S \<inter> T). y \<in> A \<and> y \<noteq> x" ..
10080e31b294 lemmas islimptI, islimptE; generalize open_inter_closure_subset
huffman
parents: 31488
diff changeset
   866
    qed
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   867
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   868
  then show "x \<in> closure (S \<inter> T)" using as
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   869
    unfolding closure_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   870
    by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   871
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   872
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   873
lemma closure_complement: "closure(UNIV - S) = UNIV - interior(S)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   874
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   875
  have "S = UNIV - (UNIV - S)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   876
    by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   877
  thus ?thesis
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   878
    unfolding closure_interior
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   879
    by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   880
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   881
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   882
lemma interior_complement: "interior(UNIV - S) = UNIV - closure(S)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   883
  unfolding closure_interior
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   884
  by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   885
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   886
subsection{* Frontier (aka boundary) *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   887
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   888
definition "frontier S = closure S - interior S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   889
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   890
lemma frontier_closed: "closed(frontier S)"
31490
c350f3ad6b0d move definitions of open, closed to RealVector.thy
huffman
parents: 31489
diff changeset
   891
  by (simp add: frontier_def closed_Diff)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   892
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   893
lemma frontier_closures: "frontier S = (closure S) \<inter> (closure(UNIV - S))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   894
  by (auto simp add: frontier_def interior_closure)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   895
31420
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
   896
lemma frontier_straddle:
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
   897
  fixes a :: "'a::metric_space"
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
   898
  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")
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   899
proof
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   900
  assume "?lhs"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   901
  { fix e::real
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   902
    assume "e > 0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   903
    let ?rhse = "(\<exists>x\<in>S. dist a x < e) \<and> (\<exists>x. x \<notin> S \<and> dist a x < e)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   904
    { assume "a\<in>S"
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
   905
      have "\<exists>x\<in>S. dist a x < e" using `e>0` `a\<in>S` by(rule_tac x=a in bexI) auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   906
      moreover have "\<exists>x. x \<notin> S \<and> dist a x < e" using `?lhs` `a\<in>S`
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
   907
	unfolding frontier_closures closure_def islimpt_def using `e>0`
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   908
	by (auto, erule_tac x="ball a e" in allE, auto)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   909
      ultimately have ?rhse by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   910
    }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   911
    moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   912
    { assume "a\<notin>S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   913
      hence ?rhse using `?lhs`
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   914
	unfolding frontier_closures closure_def islimpt_def
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
   915
	using open_ball[of a e] `e > 0`
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
   916
	by (auto, erule_tac x = "ball a e" in allE, auto) (* FIXME: VERY slow! *)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   917
    }
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   918
    ultimately have ?rhse by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   919
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   920
  thus ?rhs by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   921
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   922
  assume ?rhs
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   923
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   924
  { fix T assume "a\<notin>S" and
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   925
    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"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   926
    from `open T` `a \<in> T` have "\<exists>e>0. ball a e \<subseteq> T" unfolding open_contains_ball[of T] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   927
    then obtain e where "e>0" "ball a e \<subseteq> T" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   928
    then obtain y where y:"y\<in>S" "dist a y < e"  using as(1) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   929
    have "\<exists>y\<in>S. y \<in> T \<and> y \<noteq> a"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   930
      using `dist a y < e` `ball a e \<subseteq> T` unfolding ball_def using `y\<in>S` `a\<notin>S` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   931
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   932
  hence "a \<in> closure S" unfolding closure_def islimpt_def using `?rhs` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   933
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   934
  { fix T assume "a \<in> T"  "open T" "a\<in>S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   935
    then obtain e where "e>0" and balle: "ball a e \<subseteq> T" unfolding open_contains_ball using `?rhs` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   936
    obtain x where "x \<notin> S" "dist a x < e" using `?rhs` using `e>0` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   937
    hence "\<exists>y\<in>UNIV - S. y \<in> T \<and> y \<noteq> a" using balle `a\<in>S` unfolding ball_def by (rule_tac x=x in bexI)auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   938
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   939
  hence "a islimpt (UNIV - S) \<or> a\<notin>S" unfolding islimpt_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   940
  ultimately show ?lhs unfolding frontier_closures using closure_def[of "UNIV - S"] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   941
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   942
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   943
lemma frontier_subset_closed: "closed S \<Longrightarrow> frontier S \<subseteq> S"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   944
  by (metis frontier_def closure_closed Diff_subset)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   945
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   946
lemma frontier_empty: "frontier {} = {}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   947
  by (simp add: frontier_def closure_empty)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   948
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   949
lemma frontier_subset_eq: "frontier S \<subseteq> S \<longleftrightarrow> closed S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   950
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   951
  { assume "frontier S \<subseteq> S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   952
    hence "closure S \<subseteq> S" using interior_subset unfolding frontier_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   953
    hence "closed S" using closure_subset_eq by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   954
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   955
  thus ?thesis using frontier_subset_closed[of S] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   956
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   957
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   958
lemma frontier_complement: "frontier(UNIV - S) = frontier S"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   959
  by (auto simp add: frontier_def closure_complement interior_complement)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   960
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   961
lemma frontier_disjoint_eq: "frontier S \<inter> S = {} \<longleftrightarrow> open S"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
   962
  using frontier_complement frontier_subset_eq[of "UNIV - S"]
31490
c350f3ad6b0d move definitions of open, closed to RealVector.thy
huffman
parents: 31489
diff changeset
   963
  unfolding open_closed Compl_eq_Diff_UNIV by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   964
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   965
subsection{* Common nets and The "within" modifier for nets. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   966
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
   967
definition
31346
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
   968
  at_infinity :: "'a::real_normed_vector net" where
31390
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
   969
  "at_infinity = Abs_net (range (\<lambda>r. {x. r \<le> norm x}))"
31346
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
   970
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
   971
definition
31530
e31d63c66f55 generalize constant 'indirection'
huffman
parents: 31529
diff changeset
   972
  indirection :: "'a::real_normed_vector \<Rightarrow> 'a \<Rightarrow> 'a net" (infixr "indirection" 70) where
e31d63c66f55 generalize constant 'indirection'
huffman
parents: 31529
diff changeset
   973
  "a indirection v = (at a) within {b. \<exists>c\<ge>0. b - a = scaleR c v}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   974
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   975
text{* Prove That They are all nets. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   976
31390
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
   977
lemma Rep_net_at_infinity:
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
   978
  "Rep_net at_infinity = range (\<lambda>r. {x. r \<le> norm x})"
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
   979
unfolding at_infinity_def
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
   980
apply (rule Abs_net_inverse')
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
   981
apply (rule image_nonempty, simp)
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
   982
apply (clarsimp, rename_tac r s)
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
   983
apply (rule_tac x="max r s" in exI, auto)
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
   984
done
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
   985
31346
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
   986
lemma within_UNIV: "net within UNIV = net"
31390
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
   987
  by (simp add: Rep_net_inject [symmetric] Rep_net_within)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   988
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   989
subsection{* Identify Trivial limits, where we can't approach arbitrarily closely. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
   990
31346
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
   991
definition
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
   992
  trivial_limit :: "'a net \<Rightarrow> bool" where
31390
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
   993
  "trivial_limit net \<longleftrightarrow> {} \<in> Rep_net net"
31346
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
   994
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
   995
lemma trivial_limit_within:
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
   996
  shows "trivial_limit (at a within S) \<longleftrightarrow> \<not> a islimpt S"
31390
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
   997
proof
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
   998
  assume "trivial_limit (at a within S)"
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
   999
  thus "\<not> a islimpt S"
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1000
    unfolding trivial_limit_def
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1001
    unfolding Rep_net_within Rep_net_at
31492
5400beeddb55 replace 'topo' with 'open'; add extra type constraint for 'open'
huffman
parents: 31490
diff changeset
  1002
    unfolding islimpt_def
31447
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1003
    apply (clarsimp simp add: expand_set_eq)
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1004
    apply (rename_tac T, rule_tac x=T in exI)
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1005
    apply (clarsimp, drule_tac x=y in spec, simp)
31390
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1006
    done
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1007
next
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1008
  assume "\<not> a islimpt S"
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1009
  thus "trivial_limit (at a within S)"
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1010
    unfolding trivial_limit_def
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1011
    unfolding Rep_net_within Rep_net_at
31492
5400beeddb55 replace 'topo' with 'open'; add extra type constraint for 'open'
huffman
parents: 31490
diff changeset
  1012
    unfolding islimpt_def
31447
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1013
    apply (clarsimp simp add: image_image)
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1014
    apply (rule_tac x=T in image_eqI)
31390
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1015
    apply (auto simp add: expand_set_eq)
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1016
    done
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1017
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1018
31391
97a2a3d4088e generalize type of 'at' to metric_space
huffman
parents: 31390
diff changeset
  1019
lemma trivial_limit_at_iff: "trivial_limit (at a) \<longleftrightarrow> \<not> a islimpt UNIV"
31346
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
  1020
  using trivial_limit_within [of a UNIV]
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
  1021
  by (simp add: within_UNIV)
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
  1022
31391
97a2a3d4088e generalize type of 'at' to metric_space
huffman
parents: 31390
diff changeset
  1023
lemma trivial_limit_at:
97a2a3d4088e generalize type of 'at' to metric_space
huffman
parents: 31390
diff changeset
  1024
  fixes a :: "'a::perfect_space"
97a2a3d4088e generalize type of 'at' to metric_space
huffman
parents: 31390
diff changeset
  1025
  shows "\<not> trivial_limit (at a)"
97a2a3d4088e generalize type of 'at' to metric_space
huffman
parents: 31390
diff changeset
  1026
  by (simp add: trivial_limit_at_iff)
97a2a3d4088e generalize type of 'at' to metric_space
huffman
parents: 31390
diff changeset
  1027
31346
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
  1028
lemma trivial_limit_at_infinity:
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
  1029
  "\<not> trivial_limit (at_infinity :: ('a::{real_normed_vector,zero_neq_one}) net)"
31391
97a2a3d4088e generalize type of 'at' to metric_space
huffman
parents: 31390
diff changeset
  1030
  (* FIXME: find a more appropriate type class *)
31390
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1031
  unfolding trivial_limit_def Rep_net_at_infinity
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1032
  apply (clarsimp simp add: expand_set_eq)
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1033
  apply (drule_tac x="scaleR r (sgn 1)" in spec)
31587
a7e187205fc0 remove simp add: norm_scaleR
huffman
parents: 31585
diff changeset
  1034
  apply (simp add: norm_sgn)
31390
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1035
  done
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1036
31346
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
  1037
lemma trivial_limit_sequentially: "\<not> trivial_limit sequentially"
31390
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1038
  by (auto simp add: trivial_limit_def Rep_net_sequentially)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1039
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1040
subsection{* Some property holds "sufficiently close" to the limit point. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1041
31447
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1042
lemma eventually_at: (* FIXME: this replaces Limits.eventually_at *)
31390
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1043
  "eventually P (at a) \<longleftrightarrow> (\<exists>d>0. \<forall>x. 0 < dist x a \<and> dist x a < d \<longrightarrow> P x)"
31447
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1044
unfolding eventually_at dist_nz by auto
31390
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1045
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1046
lemma eventually_at_infinity:
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1047
  "eventually P at_infinity \<longleftrightarrow> (\<exists>b. \<forall>x. norm x >= b \<longrightarrow> P x)"
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1048
unfolding eventually_def Rep_net_at_infinity by auto
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1049
31346
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
  1050
lemma eventually_within: "eventually P (at a within S) \<longleftrightarrow>
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1051
        (\<exists>d>0. \<forall>x\<in>S. 0 < dist x a \<and> dist x a < d \<longrightarrow> P x)"
31393
b8570dead501 reuse definition of nets from Limits.thy
huffman
parents: 31391
diff changeset
  1052
unfolding eventually_within eventually_at dist_nz by auto
31390
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1053
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1054
lemma eventually_within_le: "eventually P (at a within S) \<longleftrightarrow>
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1055
        (\<exists>d>0. \<forall>x\<in>S. 0 < dist x a \<and> dist x a <= d \<longrightarrow> P x)" (is "?lhs = ?rhs")
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1056
unfolding eventually_within
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1057
apply safe
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1058
apply (rule_tac x="d/2" in exI, simp)
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1059
apply (rule_tac x="d" in exI, simp)
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1060
done
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1061
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1062
lemma eventually_happens: "eventually P net ==> trivial_limit net \<or> (\<exists>x. P x)"
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1063
  unfolding eventually_def trivial_limit_def
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1064
  using Rep_net_nonempty [of net] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1065
31347
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1066
lemma always_eventually: "(\<forall>x. P x) ==> eventually P net"
31390
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1067
  unfolding eventually_def trivial_limit_def
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1068
  using Rep_net_nonempty [of net] by auto
31347
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1069
31348
738eb25e1dd8 more abstract properties of eventually
huffman
parents: 31347
diff changeset
  1070
lemma trivial_limit_eventually: "trivial_limit net \<Longrightarrow> eventually P net"
31390
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1071
  unfolding trivial_limit_def eventually_def by auto
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1072
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1073
lemma eventually_False: "eventually (\<lambda>x. False) net \<longleftrightarrow> trivial_limit net"
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1074
  unfolding trivial_limit_def eventually_def by auto
31348
738eb25e1dd8 more abstract properties of eventually
huffman
parents: 31347
diff changeset
  1075
738eb25e1dd8 more abstract properties of eventually
huffman
parents: 31347
diff changeset
  1076
lemma trivial_limit_eq: "trivial_limit net \<longleftrightarrow> (\<forall>P. eventually P net)"
31390
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1077
  apply (safe elim!: trivial_limit_eventually)
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1078
  apply (simp add: eventually_False [symmetric])
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1079
  done
31348
738eb25e1dd8 more abstract properties of eventually
huffman
parents: 31347
diff changeset
  1080
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1081
text{* Combining theorems for "eventually" *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1082
31390
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1083
lemma eventually_conjI:
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1084
  "\<lbrakk>eventually (\<lambda>x. P x) net; eventually (\<lambda>x. Q x) net\<rbrakk>
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1085
    \<Longrightarrow> eventually (\<lambda>x. P x \<and> Q x) net"
31393
b8570dead501 reuse definition of nets from Limits.thy
huffman
parents: 31391
diff changeset
  1086
by (rule eventually_conj)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1087
31390
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1088
lemma eventually_rev_mono:
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1089
  "eventually P net \<Longrightarrow> (\<forall>x. P x \<longrightarrow> Q x) \<Longrightarrow> eventually Q net"
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1090
using eventually_mono [of P Q] by fast
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1091
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1092
lemma eventually_and: " eventually (\<lambda>x. P x \<and> Q x) net \<longleftrightarrow> eventually P net \<and> eventually Q net"
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1093
  by (auto intro!: eventually_conjI elim: eventually_rev_mono)
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1094
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1095
lemma eventually_false: "eventually (\<lambda>x. False) net \<longleftrightarrow> trivial_limit net"
31390
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1096
  by (auto simp add: eventually_False)
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1097
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1098
lemma not_eventually: "(\<forall>x. \<not> P x ) \<Longrightarrow> ~(trivial_limit net) ==> ~(eventually (\<lambda>x. P x) net)"
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1099
  by (simp add: eventually_False)
31347
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1100
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1101
subsection{* Limits, defined as vacuously true when the limit is trivial. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1102
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1103
  text{* Notation Lim to avoid collition with lim defined in analysis *}
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1104
definition
31654
83662a8604c2 generalize lemma Lim_unique to t2_space
huffman
parents: 31592
diff changeset
  1105
  Lim :: "'a net \<Rightarrow> ('a \<Rightarrow> 'b::t2_space) \<Rightarrow> 'b" where
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1106
  "Lim net f = (THE l. (f ---> l) net)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1107
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1108
lemma Lim:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1109
 "(f ---> l) net \<longleftrightarrow>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1110
        trivial_limit net \<or>
31348
738eb25e1dd8 more abstract properties of eventually
huffman
parents: 31347
diff changeset
  1111
        (\<forall>e>0. eventually (\<lambda>x. dist (f x) l < e) net)"
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1112
  unfolding tendsto_iff trivial_limit_eq by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1113
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1114
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1115
text{* Show that they yield usual definitions in the various cases. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1116
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1117
lemma Lim_within_le: "(f ---> l)(at a within S) \<longleftrightarrow>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1118
           (\<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)"
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1119
  by (auto simp add: tendsto_iff eventually_within_le)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1120
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1121
lemma Lim_within: "(f ---> l) (at a within S) \<longleftrightarrow>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1122
        (\<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)"
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1123
  by (auto simp add: tendsto_iff eventually_within)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1124
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1125
lemma Lim_at: "(f ---> l) (at a) \<longleftrightarrow>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1126
        (\<forall>e >0. \<exists>d>0. \<forall>x. 0 < dist x a  \<and> dist x a  < d  \<longrightarrow> dist (f x) l < e)"
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1127
  by (auto simp add: tendsto_iff eventually_at)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1128
31342
b7941738e3a1 add lemmas Lim_at_iff_LIM, Lim_sequentially_iff_LIMSEQ
huffman
parents: 31341
diff changeset
  1129
lemma Lim_at_iff_LIM: "(f ---> l) (at a) \<longleftrightarrow> f -- a --> l"
b7941738e3a1 add lemmas Lim_at_iff_LIM, Lim_sequentially_iff_LIMSEQ
huffman
parents: 31341
diff changeset
  1130
  unfolding Lim_at LIM_def by (simp only: zero_less_dist_iff)
b7941738e3a1 add lemmas Lim_at_iff_LIM, Lim_sequentially_iff_LIMSEQ
huffman
parents: 31341
diff changeset
  1131
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1132
lemma Lim_at_infinity:
31531
fc78714d14e1 generalize more lemmas
huffman
parents: 31530
diff changeset
  1133
  "(f ---> l) at_infinity \<longleftrightarrow> (\<forall>e>0. \<exists>b. \<forall>x. norm x >= b \<longrightarrow> dist (f x) l < e)"
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1134
  by (auto simp add: tendsto_iff eventually_at_infinity)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1135
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1136
lemma Lim_sequentially:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1137
 "(S ---> l) sequentially \<longleftrightarrow>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1138
          (\<forall>e>0. \<exists>N. \<forall>n\<ge>N. dist (S n) l < e)"
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1139
  by (auto simp add: tendsto_iff eventually_sequentially)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1140
31342
b7941738e3a1 add lemmas Lim_at_iff_LIM, Lim_sequentially_iff_LIMSEQ
huffman
parents: 31341
diff changeset
  1141
lemma Lim_sequentially_iff_LIMSEQ: "(S ---> l) sequentially \<longleftrightarrow> S ----> l"
b7941738e3a1 add lemmas Lim_at_iff_LIM, Lim_sequentially_iff_LIMSEQ
huffman
parents: 31341
diff changeset
  1142
  unfolding Lim_sequentially LIMSEQ_def ..
b7941738e3a1 add lemmas Lim_at_iff_LIM, Lim_sequentially_iff_LIMSEQ
huffman
parents: 31341
diff changeset
  1143
31525
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1144
lemma Lim_eventually: "eventually (\<lambda>x. f x = l) net \<Longrightarrow> (f ---> l) net"
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1145
  by (rule topological_tendstoI, auto elim: eventually_rev_mono)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1146
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1147
text{* The expected monotonicity property. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1148
31447
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1149
lemma Lim_within_empty: "(f ---> l) (net within {})"
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1150
  unfolding tendsto_def Limits.eventually_within by simp
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1151
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1152
lemma Lim_within_subset: "(f ---> l) (net within S) \<Longrightarrow> T \<subseteq> S \<Longrightarrow> (f ---> l) (net within T)"
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1153
  unfolding tendsto_def Limits.eventually_within
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1154
  by (auto elim!: eventually_elim1)
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1155
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1156
lemma Lim_Un: assumes "(f ---> l) (net within S)" "(f ---> l) (net within T)"
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1157
  shows "(f ---> l) (net within (S \<union> T))"
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1158
  using assms unfolding tendsto_def Limits.eventually_within
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1159
  apply clarify
31492
5400beeddb55 replace 'topo' with 'open'; add extra type constraint for 'open'
huffman
parents: 31490
diff changeset
  1160
  apply (drule spec, drule (1) mp, drule (1) mp)
5400beeddb55 replace 'topo' with 'open'; add extra type constraint for 'open'
huffman
parents: 31490
diff changeset
  1161
  apply (drule spec, drule (1) mp, drule (1) mp)
31447
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1162
  apply (auto elim: eventually_elim2)
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1163
  done
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1164
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1165
lemma Lim_Un_univ:
31447
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1166
 "(f ---> l) (net within S) \<Longrightarrow> (f ---> l) (net within T) \<Longrightarrow>  S \<union> T = UNIV
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1167
        ==> (f ---> l) net"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1168
  by (metis Lim_Un within_UNIV)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1169
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1170
text{* Interrelations between restricted and unrestricted limits. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1171
31447
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1172
lemma Lim_at_within: "(f ---> l) net ==> (f ---> l)(net within S)"
31525
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1173
  (* FIXME: rename *)
31447
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1174
  unfolding tendsto_def Limits.eventually_within
31492
5400beeddb55 replace 'topo' with 'open'; add extra type constraint for 'open'
huffman
parents: 31490
diff changeset
  1175
  apply (clarify, drule spec, drule (1) mp, drule (1) mp)
31447
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1176
  by (auto elim!: eventually_elim1)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1177
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1178
lemma Lim_within_open:
31525
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1179
  fixes f :: "'a::topological_space \<Rightarrow> 'b::topological_space"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1180
  assumes"a \<in> S" "open S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1181
  shows "(f ---> l)(at a within S) \<longleftrightarrow> (f ---> l)(at a)" (is "?lhs \<longleftrightarrow> ?rhs")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1182
proof
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1183
  assume ?lhs
31525
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1184
  { fix A assume "open A" "l \<in> A"
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1185
    with `?lhs` have "eventually (\<lambda>x. f x \<in> A) (at a within S)"
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1186
      by (rule topological_tendstoD)
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1187
    hence "eventually (\<lambda>x. x \<in> S \<longrightarrow> f x \<in> A) (at a)"
31447
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1188
      unfolding Limits.eventually_within .
31525
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1189
    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"
31492
5400beeddb55 replace 'topo' with 'open'; add extra type constraint for 'open'
huffman
parents: 31490
diff changeset
  1190
      unfolding eventually_at_topological by fast
31525
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1191
    hence "open (T \<inter> S)" "a \<in> T \<inter> S" "\<forall>x\<in>(T \<inter> S). x \<noteq> a \<longrightarrow> f x \<in> A"
31447
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1192
      using assms by auto
31525
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1193
    hence "\<exists>T. open T \<and> a \<in> T \<and> (\<forall>x\<in>T. x \<noteq> a \<longrightarrow> f x \<in> A)"
31447
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1194
      by fast
31525
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1195
    hence "eventually (\<lambda>x. f x \<in> A) (at a)"
31492
5400beeddb55 replace 'topo' with 'open'; add extra type constraint for 'open'
huffman
parents: 31490
diff changeset
  1196
      unfolding eventually_at_topological .
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1197
  }
31525
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1198
  thus ?rhs by (rule topological_tendstoI)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1199
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1200
  assume ?rhs
31447
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1201
  thus ?lhs by (rule Lim_at_within)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1202
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1203
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1204
text{* Another limit point characterization. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1205
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1206
lemma islimpt_sequential:
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1207
  fixes x :: "'a::metric_space" (* FIXME: generalize to topological_space *)
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1208
  shows "x islimpt S \<longleftrightarrow> (\<exists>f. (\<forall>n::nat. f n \<in> S -{x}) \<and> (f ---> x) sequentially)"
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1209
    (is "?lhs = ?rhs")
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1210
proof
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1211
  assume ?lhs
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1212
  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"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1213
    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
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1214
  { fix n::nat
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1215
    have "f (inverse (real n + 1)) \<in> S - {x}" using f by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1216
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1217
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1218
  { fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1219
    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
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1220
    then obtain N::nat where "inverse (real (N + 1)) < e" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1221
    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)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1222
    moreover have "\<forall>n\<ge>N. dist (f (inverse (real n + 1))) x < (inverse (real n + 1))" using f `e>0` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1223
    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
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1224
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1225
  hence " ((\<lambda>n. f (inverse (real n + 1))) ---> x) sequentially"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1226
    unfolding Lim_sequentially using f by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1227
  ultimately show ?rhs apply (rule_tac x="(\<lambda>n::nat. f (inverse (real n + 1)))" in exI) by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1228
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1229
  assume ?rhs
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1230
  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
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1231
  { fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1232
    then obtain N where "dist (f N) x < e" using f(2) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1233
    moreover have "f N\<in>S" "f N \<noteq> x" using f(1) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1234
    ultimately have "\<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1235
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1236
  thus ?lhs unfolding islimpt_approachable by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1237
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1238
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1239
text{* Basic arithmetical combining theorems for limits. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1240
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  1241
lemma Lim_linear:
31657
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  1242
  assumes "(f ---> l) net" "bounded_linear h"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1243
  shows "((\<lambda>x. h (f x)) ---> h l) net"
31657
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  1244
using `bounded_linear h` `(f ---> l) net`
31529
689f5dae1f41 lemmas about linear, bilinear
huffman
parents: 31528
diff changeset
  1245
by (rule bounded_linear.tendsto)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1246
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  1247
lemma Lim_ident_at: "((\<lambda>x. x) ---> a) (at a)"
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  1248
  unfolding tendsto_def Limits.eventually_at_topological by fast
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  1249
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1250
lemma Lim_const: "((\<lambda>x. a) ---> a) net"
31525
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1251
  by (rule tendsto_const)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1252
31343
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1253
lemma Lim_cmul:
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  1254
  fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  1255
  shows "(f ---> l) net ==> ((\<lambda>x. c *\<^sub>R f x) ---> c *\<^sub>R l) net"
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  1256
  by (intro tendsto_intros)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1257
31343
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1258
lemma Lim_neg:
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1259
  fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1260
  shows "(f ---> l) net ==> ((\<lambda>x. -(f x)) ---> -l) net"
31525
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1261
  by (rule tendsto_minus)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1262
31343
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1263
lemma Lim_add: fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" shows
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1264
 "(f ---> l) net \<Longrightarrow> (g ---> m) net \<Longrightarrow> ((\<lambda>x. f(x) + g(x)) ---> l + m) net"
31525
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1265
  by (rule tendsto_add)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1266
31343
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1267
lemma Lim_sub:
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1268
  fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1269
  shows "(f ---> l) net \<Longrightarrow> (g ---> m) net \<Longrightarrow> ((\<lambda>x. f(x) - g(x)) ---> l - m) net"
31525
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1270
  by (rule tendsto_diff)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1271
31343
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1272
lemma Lim_null:
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1273
  fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1274
  shows "(f ---> l) net \<longleftrightarrow> ((\<lambda>x. f(x) - l) ---> 0) net" by (simp add: Lim dist_norm)
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1275
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1276
lemma Lim_null_norm:
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1277
  fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  1278
  shows "(f ---> 0) net \<longleftrightarrow> ((\<lambda>x. norm(f x)) ---> 0) net"
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  1279
  by (simp add: Lim dist_norm)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1280
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1281
lemma Lim_null_comparison:
31343
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1282
  fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  1283
  assumes "eventually (\<lambda>x. norm (f x) \<le> g x) net" "(g ---> 0) net"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1284
  shows "(f ---> 0) net"
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1285
proof(simp add: tendsto_iff, rule+)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1286
  fix e::real assume "0<e"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1287
  { fix x
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  1288
    assume "norm (f x) \<le> g x" "dist (g x) 0 < e"
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  1289
    hence "dist (f x) 0 < e" by (simp add: dist_norm)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1290
  }
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1291
  thus "eventually (\<lambda>x. dist (f x) 0 < e) net"
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  1292
    using eventually_and[of "\<lambda>x. norm(f x) <= g x" "\<lambda>x. dist (g x) 0 < e" net]
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  1293
    using eventually_mono[of "(\<lambda>x. norm (f x) \<le> g x \<and> dist (g x) 0 < e)" "(\<lambda>x. dist (f x) 0 < e)" net]
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1294
    using assms `e>0` unfolding tendsto_iff by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1295
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1296
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  1297
lemma Lim_component:
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  1298
  fixes f :: "'a \<Rightarrow> 'b::metric_space ^ 'n::finite"
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  1299
  shows "(f ---> l) net \<Longrightarrow> ((\<lambda>a. f a $i) ---> l$i) net"
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1300
  unfolding tendsto_iff
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  1301
  apply (clarify)
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  1302
  apply (drule spec, drule (1) mp)
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  1303
  apply (erule eventually_elim1)
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  1304
  apply (erule le_less_trans [OF dist_nth_le])
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  1305
  done
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1306
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1307
lemma Lim_transform_bound:
31343
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1308
  fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1309
  fixes g :: "'a \<Rightarrow> 'c::real_normed_vector"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1310
  assumes "eventually (\<lambda>n. norm(f n) <= norm(g n)) net"  "(g ---> 0) net"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1311
  shows "(f ---> 0) net"
31525
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1312
proof (rule tendstoI)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1313
  fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1314
  { fix x
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1315
    assume "norm (f x) \<le> norm (g x)" "dist (g x) 0 < e"
31343
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1316
    hence "dist (f x) 0 < e" by (simp add: dist_norm)}
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1317
  thus "eventually (\<lambda>x. dist (f x) 0 < e) net"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1318
    using eventually_and[of "\<lambda>x. norm (f x) \<le> norm (g x)" "\<lambda>x. dist (g x) 0 < e" net]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1319
    using eventually_mono[of "\<lambda>x. norm (f x) \<le> norm (g x) \<and> dist (g x) 0 < e" "\<lambda>x. dist (f x) 0 < e" net]
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1320
    using assms `e>0` unfolding tendsto_iff by blast
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1321
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1322
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1323
text{* Deducing things about the limit from the elements. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1324
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1325
lemma Lim_in_closed_set:
31525
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1326
  assumes "closed S" "eventually (\<lambda>x. f(x) \<in> S) net" "\<not>(trivial_limit net)" "(f ---> l) net"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1327
  shows "l \<in> S"
31347
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1328
proof (rule ccontr)
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1329
  assume "l \<notin> S"
31525
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1330
  with `closed S` have "open (- S)" "l \<in> - S"
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1331
    by (simp_all add: open_Compl)
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1332
  with assms(4) have "eventually (\<lambda>x. f x \<in> - S) net"
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1333
    by (rule topological_tendstoD)
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1334
  with assms(2) have "eventually (\<lambda>x. False) net"
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1335
    by (rule eventually_elim2) simp
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1336
  with assms(3) show "False"
472b844f8607 generalize some lemmas
huffman
parents: 31492
diff changeset
  1337
    by (simp add: eventually_False)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1338
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1339
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1340
text{* Need to prove closed(cball(x,e)) before deducing this as a corollary. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1341
31533
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1342
lemma Lim_dist_ubound:
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1343
  assumes "\<not>(trivial_limit net)" "(f ---> l) net" "eventually (\<lambda>x. dist a (f x) <= e) net"
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1344
  shows "dist a l <= e"
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1345
proof (rule ccontr)
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1346
  assume "\<not> dist a l \<le> e"
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1347
  then have "0 < dist a l - e" by simp
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1348
  with assms(2) have "eventually (\<lambda>x. dist (f x) l < dist a l - e) net"
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1349
    by (rule tendstoD)
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1350
  with assms(3) have "eventually (\<lambda>x. dist a (f x) \<le> e \<and> dist (f x) l < dist a l - e) net"
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1351
    by (rule eventually_conjI)
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1352
  then obtain w where "dist a (f w) \<le> e" "dist (f w) l < dist a l - e"
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1353
    using assms(1) eventually_happens by auto
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1354
  hence "dist a (f w) + dist (f w) l < e + (dist a l - e)"
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1355
    by (rule add_le_less_mono)
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1356
  hence "dist a (f w) + dist (f w) l < dist a l"
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1357
    by simp
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1358
  also have "\<dots> \<le> dist a (f w) + dist (f w) l"
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1359
    by (rule dist_triangle)
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1360
  finally show False by simp
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1361
qed
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1362
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1363
lemma Lim_norm_ubound:
31343
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1364
  fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1365
  assumes "\<not>(trivial_limit net)" "(f ---> l) net" "eventually (\<lambda>x. norm(f x) <= e) net"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1366
  shows "norm(l) <= e"
31347
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1367
proof (rule ccontr)
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1368
  assume "\<not> norm l \<le> e"
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1369
  then have "0 < norm l - e" by simp
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1370
  with assms(2) have "eventually (\<lambda>x. dist (f x) l < norm l - e) net"
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1371
    by (rule tendstoD)
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1372
  with assms(3) have "eventually (\<lambda>x. norm (f x) \<le> e \<and> dist (f x) l < norm l - e) net"
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1373
    by (rule eventually_conjI)
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1374
  then obtain w where "norm (f w) \<le> e" "dist (f w) l < norm l - e"
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1375
    using assms(1) eventually_happens by auto
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1376
  hence "norm (f w - l) < norm l - e" "norm (f w) \<le> e" by (simp_all add: dist_norm)
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1377
  hence "norm (f w - l) + norm (f w) < norm l" by simp
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1378
  hence "norm (f w - l - f w) < norm l" by (rule le_less_trans [OF norm_triangle_ineq4])
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1379
  thus False using `\<not> norm l \<le> e` by simp
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1380
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1381
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1382
lemma Lim_norm_lbound:
31343
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1383
  fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1384
  assumes "\<not> (trivial_limit net)"  "(f ---> l) net"  "eventually (\<lambda>x. e <= norm(f x)) net"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1385
  shows "e \<le> norm l"
31347
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1386
proof (rule ccontr)
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1387
  assume "\<not> e \<le> norm l"
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1388
  then have "0 < e - norm l" by simp
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1389
  with assms(2) have "eventually (\<lambda>x. dist (f x) l < e - norm l) net"
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1390
    by (rule tendstoD)
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1391
  with assms(3) have "eventually (\<lambda>x. e \<le> norm (f x) \<and> dist (f x) l < e - norm l) net"
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1392
    by (rule eventually_conjI)
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1393
  then obtain w where "e \<le> norm (f w)" "dist (f w) l < e - norm l"
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1394
    using assms(1) eventually_happens by auto
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1395
  hence "norm (f w - l) + norm l < e" "e \<le> norm (f w)" by (simp_all add: dist_norm)
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1396
  hence "norm (f w - l) + norm l < norm (f w)" by (rule less_le_trans)
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1397
  hence "norm (f w - l + l) < norm (f w)" by (rule le_less_trans [OF norm_triangle_ineq])
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1398
  thus False by simp
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1399
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1400
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1401
text{* Uniqueness of the limit, when nontrivial. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1402
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1403
lemma Lim_unique:
31654
83662a8604c2 generalize lemma Lim_unique to t2_space
huffman
parents: 31592
diff changeset
  1404
  fixes f :: "'a \<Rightarrow> 'b::t2_space"
31397
8f3921c59792 generalize lemma Lim_unique
huffman
parents: 31396
diff changeset
  1405
  assumes "\<not> trivial_limit net"  "(f ---> l) net"  "(f ---> l') net"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1406
  shows "l = l'"
31397
8f3921c59792 generalize lemma Lim_unique
huffman
parents: 31396
diff changeset
  1407
proof (rule ccontr)
8f3921c59792 generalize lemma Lim_unique
huffman
parents: 31396
diff changeset
  1408
  assume "l \<noteq> l'"
31654
83662a8604c2 generalize lemma Lim_unique to t2_space
huffman
parents: 31592
diff changeset
  1409
  obtain U V where "open U" "open V" "l \<in> U" "l' \<in> V" "U \<inter> V = {}"
83662a8604c2 generalize lemma Lim_unique to t2_space
huffman
parents: 31592
diff changeset
  1410
    using hausdorff [OF `l \<noteq> l'`] by fast
83662a8604c2 generalize lemma Lim_unique to t2_space
huffman
parents: 31592
diff changeset
  1411
  have "eventually (\<lambda>x. f x \<in> U) net"
83662a8604c2 generalize lemma Lim_unique to t2_space
huffman
parents: 31592
diff changeset
  1412
    using `(f ---> l) net` `open U` `l \<in> U` by (rule topological_tendstoD)
31397
8f3921c59792 generalize lemma Lim_unique
huffman
parents: 31396
diff changeset
  1413
  moreover
31654
83662a8604c2 generalize lemma Lim_unique to t2_space
huffman
parents: 31592
diff changeset
  1414
  have "eventually (\<lambda>x. f x \<in> V) net"
83662a8604c2 generalize lemma Lim_unique to t2_space
huffman
parents: 31592
diff changeset
  1415
    using `(f ---> l') net` `open V` `l' \<in> V` by (rule topological_tendstoD)
31397
8f3921c59792 generalize lemma Lim_unique
huffman
parents: 31396
diff changeset
  1416
  ultimately
8f3921c59792 generalize lemma Lim_unique
huffman
parents: 31396
diff changeset
  1417
  have "eventually (\<lambda>x. False) net"
8f3921c59792 generalize lemma Lim_unique
huffman
parents: 31396
diff changeset
  1418
  proof (rule eventually_elim2)
8f3921c59792 generalize lemma Lim_unique
huffman
parents: 31396
diff changeset
  1419
    fix x
31654
83662a8604c2 generalize lemma Lim_unique to t2_space
huffman
parents: 31592
diff changeset
  1420
    assume "f x \<in> U" "f x \<in> V"
83662a8604c2 generalize lemma Lim_unique to t2_space
huffman
parents: 31592
diff changeset
  1421
    hence "f x \<in> U \<inter> V" by simp
83662a8604c2 generalize lemma Lim_unique to t2_space
huffman
parents: 31592
diff changeset
  1422
    with `U \<inter> V = {}` show "False" by simp
31397
8f3921c59792 generalize lemma Lim_unique
huffman
parents: 31396
diff changeset
  1423
  qed
8f3921c59792 generalize lemma Lim_unique
huffman
parents: 31396
diff changeset
  1424
  with `\<not> trivial_limit net` show "False"
8f3921c59792 generalize lemma Lim_unique
huffman
parents: 31396
diff changeset
  1425
    by (simp add: eventually_False)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1426
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1427
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1428
lemma tendsto_Lim:
31654
83662a8604c2 generalize lemma Lim_unique to t2_space
huffman
parents: 31592
diff changeset
  1429
  fixes f :: "'a \<Rightarrow> 'b::t2_space"
31343
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1430
  shows "~(trivial_limit net) \<Longrightarrow> (f ---> l) net ==> Lim net f = l"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1431
  unfolding Lim_def using Lim_unique[of net f] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1432
31529
689f5dae1f41 lemmas about linear, bilinear
huffman
parents: 31528
diff changeset
  1433
text{* Limit under bilinear function *}
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1434
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1435
lemma Lim_bilinear:
31657
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  1436
  assumes "(f ---> l) net" and "(g ---> m) net" and "bounded_bilinear h"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1437
  shows "((\<lambda>x. h (f x) (g x)) ---> (h l m)) net"
31657
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  1438
using `bounded_bilinear h` `(f ---> l) net` `(g ---> m) net`
31529
689f5dae1f41 lemmas about linear, bilinear
huffman
parents: 31528
diff changeset
  1439
by (rule bounded_bilinear.tendsto)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1440
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1441
text{* These are special for limits out of the same vector space. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1442
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1443
lemma Lim_within_id: "(id ---> a) (at a within s)"
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1444
  unfolding tendsto_def Limits.eventually_within eventually_at_topological
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1445
  by auto
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1446
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1447
lemma Lim_at_id: "(id ---> a) (at a)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1448
apply (subst within_UNIV[symmetric]) by (simp add: Lim_within_id)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1449
31346
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
  1450
lemma Lim_at_zero:
31391
97a2a3d4088e generalize type of 'at' to metric_space
huffman
parents: 31390
diff changeset
  1451
  fixes a :: "'a::real_normed_vector"
31526
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1452
  fixes l :: "'b::topological_space"
31346
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
  1453
  shows "(f ---> l) (at a) \<longleftrightarrow> ((\<lambda>x. f(a + x)) ---> l) (at 0)" (is "?lhs = ?rhs")
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1454
proof
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1455
  assume "?lhs"
31526
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1456
  { fix S assume "open S" "l \<in> S"
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1457
    with `?lhs` have "eventually (\<lambda>x. f x \<in> S) (at a)"
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1458
      by (rule topological_tendstoD)
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1459
    then obtain d where d: "d>0" "\<forall>x. x \<noteq> a \<and> dist x a < d \<longrightarrow> f x \<in> S"
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1460
      unfolding Limits.eventually_at by fast
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1461
    { fix x::"'a" assume "x \<noteq> 0 \<and> dist x 0 < d"
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1462
      hence "f (a + x) \<in> S" using d
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1463
      apply(erule_tac x="x+a" in allE)
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1464
      by(auto simp add: comm_monoid_add.mult_commute dist_norm dist_commute)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1465
    }
31526
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1466
    hence "\<exists>d>0. \<forall>x. x \<noteq> 0 \<and> dist x 0 < d \<longrightarrow> f (a + x) \<in> S"
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1467
      using d(1) by auto
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1468
    hence "eventually (\<lambda>x. f (a + x) \<in> S) (at 0)"
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1469
      unfolding Limits.eventually_at .
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1470
  }
31526
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1471
  thus "?rhs" by (rule topological_tendstoI)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1472
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1473
  assume "?rhs"
31526
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1474
  { fix S assume "open S" "l \<in> S"
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1475
    with `?rhs` have "eventually (\<lambda>x. f (a + x) \<in> S) (at 0)"
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1476
      by (rule topological_tendstoD)
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1477
    then obtain d where d: "d>0" "\<forall>x. x \<noteq> 0 \<and> dist x 0 < d \<longrightarrow> f (a + x) \<in> S"
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1478
      unfolding Limits.eventually_at by fast
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1479
    { fix x::"'a" assume "x \<noteq> a \<and> dist x a < d"
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1480
      hence "f x \<in> S" using d apply(erule_tac x="x-a" in allE)
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  1481
	by(auto simp add: comm_monoid_add.mult_commute dist_norm dist_commute)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1482
    }
31526
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1483
    hence "\<exists>d>0. \<forall>x. x \<noteq> a \<and> dist x a < d \<longrightarrow> f x \<in> S" using d(1) by auto
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1484
    hence "eventually (\<lambda>x. f x \<in> S) (at a)" unfolding Limits.eventually_at .
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1485
  }
31526
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1486
  thus "?lhs" by (rule topological_tendstoI)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1487
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1488
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1489
text{* It's also sometimes useful to extract the limit point from the net.  *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1490
31390
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1491
definition
31655
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  1492
  netlimit :: "'a::t2_space net \<Rightarrow> 'a" where
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  1493
  "netlimit net = (SOME a. ((\<lambda>x. x) ---> a) net)"
31390
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1494
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1495
lemma netlimit_within:
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1496
  assumes "\<not> trivial_limit (at a within S)"
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1497
  shows "netlimit (at a within S) = a"
31655
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  1498
unfolding netlimit_def
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  1499
apply (rule some_equality)
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  1500
apply (rule Lim_at_within)
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  1501
apply (rule Lim_ident_at)
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  1502
apply (erule Lim_unique [OF assms])
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  1503
apply (rule Lim_at_within)
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  1504
apply (rule Lim_ident_at)
31390
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  1505
done
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1506
31391
97a2a3d4088e generalize type of 'at' to metric_space
huffman
parents: 31390
diff changeset
  1507
lemma netlimit_at:
97a2a3d4088e generalize type of 'at' to metric_space
huffman
parents: 31390
diff changeset
  1508
  fixes a :: "'a::perfect_space"
97a2a3d4088e generalize type of 'at' to metric_space
huffman
parents: 31390
diff changeset
  1509
  shows "netlimit (at a) = a"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1510
  apply (subst within_UNIV[symmetric])
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1511
  using netlimit_within[of a UNIV]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1512
  by (simp add: trivial_limit_at within_UNIV)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1513
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1514
text{* Transformation of limit. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1515
31343
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1516
lemma Lim_transform:
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1517
  fixes f g :: "'a::type \<Rightarrow> 'b::real_normed_vector"
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1518
  assumes "((\<lambda>x. f x - g x) ---> 0) net" "(f ---> l) net"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1519
  shows "(g ---> l) net"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1520
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1521
  from assms have "((\<lambda>x. f x - g x - f x) ---> 0 - l) net" using Lim_sub[of "\<lambda>x. f x - g x" 0 net f l] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1522
  thus "?thesis" using Lim_neg [of "\<lambda> x. - g x" "-l" net] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1523
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1524
31343
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1525
lemma Lim_transform_eventually:
31526
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1526
  "eventually (\<lambda>x. f x = g x) net \<Longrightarrow> (f ---> l) net ==> (g ---> l) net"
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1527
  apply (rule topological_tendstoI)
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1528
  apply (drule (2) topological_tendstoD)
31395
8cbcab09ce2a generalize Lim_transform lemmas
huffman
parents: 31394
diff changeset
  1529
  apply (erule (1) eventually_elim2, simp)
8cbcab09ce2a generalize Lim_transform lemmas
huffman
parents: 31394
diff changeset
  1530
  done
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1531
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1532
lemma Lim_transform_within:
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1533
  fixes l :: "'b::metric_space" (* TODO: generalize *)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1534
  assumes "0 < d" "(\<forall>x'\<in>S. 0 < dist x' x \<and> dist x' x < d \<longrightarrow> f x' = g x')"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1535
          "(f ---> l) (at x within S)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1536
  shows   "(g ---> l) (at x within S)"
31395
8cbcab09ce2a generalize Lim_transform lemmas
huffman
parents: 31394
diff changeset
  1537
  using assms(1,3) unfolding Lim_within
8cbcab09ce2a generalize Lim_transform lemmas
huffman
parents: 31394
diff changeset
  1538
  apply -
8cbcab09ce2a generalize Lim_transform lemmas
huffman
parents: 31394
diff changeset
  1539
  apply (clarify, rename_tac e)
8cbcab09ce2a generalize Lim_transform lemmas
huffman
parents: 31394
diff changeset
  1540
  apply (drule_tac x=e in spec, clarsimp, rename_tac r)
8cbcab09ce2a generalize Lim_transform lemmas
huffman
parents: 31394
diff changeset
  1541
  apply (rule_tac x="min d r" in exI, clarsimp, rename_tac y)
8cbcab09ce2a generalize Lim_transform lemmas
huffman
parents: 31394
diff changeset
  1542
  apply (drule_tac x=y in bspec, assumption, clarsimp)
8cbcab09ce2a generalize Lim_transform lemmas
huffman
parents: 31394
diff changeset
  1543
  apply (simp add: assms(2))
8cbcab09ce2a generalize Lim_transform lemmas
huffman
parents: 31394
diff changeset
  1544
  done
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1545
31343
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1546
lemma Lim_transform_at:
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1547
  fixes l :: "'b::metric_space" (* TODO: generalize *)
31343
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  1548
  shows "0 < d \<Longrightarrow> (\<forall>x'. 0 < dist x' x \<and> dist x' x < d \<longrightarrow> f x' = g x') \<Longrightarrow>
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1549
  (f ---> l) (at x) ==> (g ---> l) (at x)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1550
  apply (subst within_UNIV[symmetric])
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1551
  using Lim_transform_within[of d UNIV x f g l]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1552
  by (auto simp add: within_UNIV)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1553
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1554
text{* Common case assuming being away from some crucial point like 0. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1555
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1556
lemma Lim_transform_away_within:
31447
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1557
  fixes a b :: "'a::metric_space"
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1558
  fixes l :: "'b::metric_space" (* TODO: generalize *)
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1559
  assumes "a\<noteq>b" "\<forall>x\<in> S. x \<noteq> a \<and> x \<noteq> b \<longrightarrow> f x = g x"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1560
  and "(f ---> l) (at a within S)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1561
  shows "(g ---> l) (at a within S)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1562
proof-
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1563
  have "\<forall>x'\<in>S. 0 < dist x' a \<and> dist x' a < dist a b \<longrightarrow> f x' = g x'" using assms(2)
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  1564
    apply auto apply(erule_tac x=x' in ballE) by (auto simp add: dist_commute)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1565
  thus ?thesis using Lim_transform_within[of "dist a b" S a f g l] using assms(1,3) unfolding dist_nz by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1566
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1567
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1568
lemma Lim_transform_away_at:
31447
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1569
  fixes a b :: "'a::metric_space"
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1570
  fixes l :: "'b::metric_space" (* TODO: generalize *)
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1571
  assumes ab: "a\<noteq>b" and fg: "\<forall>x. x \<noteq> a \<and> x \<noteq> b \<longrightarrow> f x = g x"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1572
  and fl: "(f ---> l) (at a)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1573
  shows "(g ---> l) (at a)"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1574
  using Lim_transform_away_within[OF ab, of UNIV f g l] fg fl
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1575
  by (auto simp add: within_UNIV)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1576
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1577
text{* Alternatively, within an open set. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1578
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1579
lemma Lim_transform_within_open:
31447
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1580
  fixes a :: "'a::metric_space"
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1581
  fixes l :: "'b::metric_space" (* TODO: generalize *)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1582
  assumes "open S"  "a \<in> S"  "\<forall>x\<in>S. x \<noteq> a \<longrightarrow> f x = g x"  "(f ---> l) (at a)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1583
  shows "(g ---> l) (at a)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1584
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1585
  from assms(1,2) obtain e::real where "e>0" and e:"ball a e \<subseteq> S" unfolding open_contains_ball by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1586
  hence "\<forall>x'. 0 < dist x' a \<and> dist x' a < e \<longrightarrow> f x' = g x'" using assms(3)
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  1587
    unfolding ball_def subset_eq apply auto apply(erule_tac x=x' in allE) apply(erule_tac x=x' in ballE) by(auto simp add: dist_commute)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1588
  thus ?thesis using Lim_transform_at[of e a f g l] `e>0` assms(4) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1589
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1590
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1591
text{* A congruence rule allowing us to transform limits assuming not at point. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1592
31395
8cbcab09ce2a generalize Lim_transform lemmas
huffman
parents: 31394
diff changeset
  1593
(* FIXME: Only one congruence rule for tendsto can be used at a time! *)
8cbcab09ce2a generalize Lim_transform lemmas
huffman
parents: 31394
diff changeset
  1594
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1595
lemma Lim_cong_within[cong add]:
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1596
  fixes a :: "'a::metric_space"
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1597
  fixes l :: "'b::metric_space" (* TODO: generalize *)
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1598
  shows "(\<And>x. x \<noteq> a \<Longrightarrow> f x = g x) ==> ((\<lambda>x. f x) ---> l) (at a within S) \<longleftrightarrow> ((g ---> l) (at a within S))"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1599
  by (simp add: Lim_within dist_nz[symmetric])
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1600
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1601
lemma Lim_cong_at[cong add]:
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1602
  fixes a :: "'a::metric_space"
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1603
  fixes l :: "'b::metric_space" (* TODO: generalize *)
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1604
  shows "(\<And>x. x \<noteq> a ==> f x = g x) ==> (((\<lambda>x. f x) ---> l) (at a) \<longleftrightarrow> ((g ---> l) (at a)))"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1605
  by (simp add: Lim_at dist_nz[symmetric])
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1606
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1607
text{* Useful lemmas on closure and set of possible sequential limits.*}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1608
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1609
lemma closure_sequential:
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1610
  fixes l :: "'a::metric_space" (* TODO: generalize *)
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1611
  shows "l \<in> closure S \<longleftrightarrow> (\<exists>x. (\<forall>n. x n \<in> S) \<and> (x ---> l) sequentially)" (is "?lhs = ?rhs")
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1612
proof
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1613
  assume "?lhs" moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1614
  { assume "l \<in> S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1615
    hence "?rhs" using Lim_const[of l sequentially] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1616
  } moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1617
  { assume "l islimpt S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1618
    hence "?rhs" unfolding islimpt_sequential by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1619
  } ultimately
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1620
  show "?rhs" unfolding closure_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1621
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1622
  assume "?rhs"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1623
  thus "?lhs" unfolding closure_def unfolding islimpt_sequential by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1624
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1625
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1626
lemma closed_sequential_limits:
31420
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
  1627
  fixes S :: "'a::metric_space set"
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
  1628
  shows "closed S \<longleftrightarrow> (\<forall>x l. (\<forall>n. x n \<in> S) \<and> (x ---> l) sequentially \<longrightarrow> l \<in> S)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1629
  unfolding closed_limpt
31420
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
  1630
  using closure_sequential [where 'a='a] closure_closed [where 'a='a] closed_limpt [where 'a='a] islimpt_sequential [where 'a='a] mem_delete [where 'a='a]
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
  1631
  by metis
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
  1632
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
  1633
lemma closure_approachable:
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
  1634
  fixes S :: "'a::metric_space set"
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
  1635
  shows "x \<in> closure S \<longleftrightarrow> (\<forall>e>0. \<exists>y\<in>S. dist y x < e)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1636
  apply (auto simp add: closure_def islimpt_approachable)
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  1637
  by (metis dist_self)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1638
31418
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
  1639
lemma closed_approachable:
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
  1640
  fixes S :: "'a::metric_space set"
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
  1641
  shows "closed S ==> (\<forall>e>0. \<exists>y\<in>S. dist y x < e) \<longleftrightarrow> x \<in> S"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1642
  by (metis closure_closed closure_approachable)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1643
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1644
text{* Some other lemmas about sequences. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1645
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1646
lemma seq_offset:
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1647
  fixes l :: "'a::metric_space" (* TODO: generalize *)
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1648
  shows "(f ---> l) sequentially ==> ((\<lambda>i. f( i + k)) ---> l) sequentially"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1649
  apply (auto simp add: Lim_sequentially)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1650
  by (metis trans_le_add1 )
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1651
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1652
lemma seq_offset_neg:
31526
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1653
  "(f ---> l) sequentially ==> ((\<lambda>i. f(i - k)) ---> l) sequentially"
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1654
  apply (rule topological_tendstoI)
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1655
  apply (drule (2) topological_tendstoD)
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1656
  apply (simp only: eventually_sequentially)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1657
  apply (subgoal_tac "\<And>N k (n::nat). N + k <= n ==> N <= n - k")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1658
  apply metis
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1659
  by arith
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1660
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  1661
lemma seq_offset_rev:
31526
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1662
  "((\<lambda>i. f(i + k)) ---> l) sequentially ==> (f ---> l) sequentially"
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1663
  apply (rule topological_tendstoI)
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1664
  apply (drule (2) topological_tendstoD)
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1665
  apply (simp only: eventually_sequentially)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1666
  apply (subgoal_tac "\<And>N k (n::nat). N + k <= n ==> N <= n - k \<and> (n - k) + k = n")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1667
  by metis arith
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1668
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  1669
lemma seq_harmonic: "((\<lambda>n. inverse (real n)) ---> 0) sequentially"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1670
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1671
  { fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1672
    hence "\<exists>N::nat. \<forall>n::nat\<ge>N. inverse (real n) < e"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1673
      using real_arch_inv[of e] apply auto apply(rule_tac x=n in exI)
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  1674
      by (metis not_le le_imp_inverse_le not_less real_of_nat_gt_zero_cancel_iff real_of_nat_less_iff xt1(7))
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1675
  }
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  1676
  thus ?thesis unfolding Lim_sequentially dist_norm by simp
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1677
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1678
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1679
text{* More properties of closed balls. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1680
31396
f7c7bf82b12f generalize lemma closed_cball
huffman
parents: 31395
diff changeset
  1681
lemma closed_cball: "closed (cball x e)"
31526
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1682
unfolding cball_def closed_def
31396
f7c7bf82b12f generalize lemma closed_cball
huffman
parents: 31395
diff changeset
  1683
unfolding Collect_neg_eq [symmetric] not_le
31418
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
  1684
apply (clarsimp simp add: open_dist, rename_tac y)
31396
f7c7bf82b12f generalize lemma closed_cball
huffman
parents: 31395
diff changeset
  1685
apply (rule_tac x="dist x y - e" in exI, clarsimp)
31492
5400beeddb55 replace 'topo' with 'open'; add extra type constraint for 'open'
huffman
parents: 31490
diff changeset
  1686
apply (rename_tac x')
31396
f7c7bf82b12f generalize lemma closed_cball
huffman
parents: 31395
diff changeset
  1687
apply (cut_tac x=x and y=x' and z=y in dist_triangle)
f7c7bf82b12f generalize lemma closed_cball
huffman
parents: 31395
diff changeset
  1688
apply simp
f7c7bf82b12f generalize lemma closed_cball
huffman
parents: 31395
diff changeset
  1689
done
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1690
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1691
lemma open_contains_cball: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e>0.  cball x e \<subseteq> S)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1692
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1693
  { fix x and e::real assume "x\<in>S" "e>0" "ball x e \<subseteq> S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1694
    hence "\<exists>d>0. cball x d \<subseteq> S" unfolding subset_eq by (rule_tac x="e/2" in exI, auto)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1695
  } moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1696
  { fix x and e::real assume "x\<in>S" "e>0" "cball x e \<subseteq> S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1697
    hence "\<exists>d>0. ball x d \<subseteq> S" unfolding subset_eq apply(rule_tac x="e/2" in exI) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1698
  } ultimately
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1699
  show ?thesis unfolding open_contains_ball by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1700
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1701
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1702
lemma open_contains_cball_eq: "open S ==> (\<forall>x. x \<in> S \<longleftrightarrow> (\<exists>e>0. cball x e \<subseteq> S))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1703
  by (metis open_contains_cball subset_eq order_less_imp_le centre_in_cball mem_def)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1704
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1705
lemma mem_interior_cball: "x \<in> interior S \<longleftrightarrow> (\<exists>e>0. cball x e \<subseteq> S)"
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1706
  apply (simp add: interior_def, safe)
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1707
  apply (force simp add: open_contains_cball)
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1708
  apply (rule_tac x="ball x e" in exI)
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1709
  apply (simp add: open_ball centre_in_ball subset_trans [OF ball_subset_cball])
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1710
  done
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1711
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1712
lemma islimpt_ball:
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1713
  fixes x y :: "'a::{real_normed_vector,perfect_space}"
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1714
  shows "y islimpt ball x e \<longleftrightarrow> 0 < e \<and> y \<in> cball x e" (is "?lhs = ?rhs")
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1715
proof
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1716
  assume "?lhs"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1717
  { assume "e \<le> 0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1718
    hence *:"ball x e = {}" using ball_eq_empty[of x e] by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1719
    have False using `?lhs` unfolding * using islimpt_EMPTY[of y] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1720
  }
31526
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1721
  hence "e > 0" by (metis not_less)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1722
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1723
  have "y \<in> cball x e" using closed_cball[of x e] islimpt_subset[of y "ball x e" "cball x e"] ball_subset_cball[of x e] `?lhs` unfolding closed_limpt by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1724
  ultimately show "?rhs" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1725
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1726
  assume "?rhs" hence "e>0"  by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1727
  { fix d::real assume "d>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1728
    have "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1729
    proof(cases "d \<le> dist x y")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1730
      case True thus "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1731
      proof(cases "x=y")
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  1732
	case True hence False using `d \<le> dist x y` `d>0` by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1733
	thus "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1734
      next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1735
	case False
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1736
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1737
	have "dist x (y - (d / (2 * dist y x)) *\<^sub>R (y - x))
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1738
	      = norm (x - y + (d / (2 * norm (y - x))) *\<^sub>R (y - x))"
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  1739
	  unfolding mem_cball mem_ball dist_norm diff_diff_eq2 diff_add_eq[THEN sym] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1740
	also have "\<dots> = \<bar>- 1 + d / (2 * norm (x - y))\<bar> * norm (x - y)"
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1741
	  using scaleR_left_distrib[of "- 1" "d / (2 * norm (y - x))", THEN sym, of "y - x"]
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1742
	  unfolding scaleR_minus_left scaleR_one
31587
a7e187205fc0 remove simp add: norm_scaleR
huffman
parents: 31585
diff changeset
  1743
	  by (auto simp add: norm_minus_commute)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1744
	also have "\<dots> = \<bar>- norm (x - y) + d / 2\<bar>"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1745
	  unfolding abs_mult_pos[of "norm (x - y)", OF norm_ge_zero[of "x - y"]]
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  1746
	  unfolding real_add_mult_distrib using `x\<noteq>y`[unfolded dist_nz, unfolded dist_norm] by auto
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  1747
	also have "\<dots> \<le> e - d/2" using `d \<le> dist x y` and `d>0` and `?rhs` by(auto simp add: dist_norm)
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1748
	finally have "y - (d / (2 * dist y x)) *\<^sub>R (y - x) \<in> ball x e" using `d>0` by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1749
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1750
	moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1751
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1752
	have "(d / (2*dist y x)) *\<^sub>R (y - x) \<noteq> 0"
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1753
	  using `x\<noteq>y`[unfolded dist_nz] `d>0` unfolding scaleR_eq_0_iff by (auto simp add: dist_commute)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1754
	moreover
31587
a7e187205fc0 remove simp add: norm_scaleR
huffman
parents: 31585
diff changeset
  1755
	have "dist (y - (d / (2 * dist y x)) *\<^sub>R (y - x)) y < d" unfolding dist_norm apply simp unfolding norm_minus_cancel
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  1756
	  using `d>0` `x\<noteq>y`[unfolded dist_nz] dist_commute[of x y]
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  1757
	  unfolding dist_norm by auto
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1758
	ultimately show "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d" by (rule_tac  x="y - (d / (2*dist y x)) *\<^sub>R (y - x)" in bexI) auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1759
      qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1760
    next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1761
      case False hence "d > dist x y" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1762
      show "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1763
      proof(cases "x=y")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1764
	case True
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1765
	obtain z where **: "z \<noteq> y" "dist z y < min e d"
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1766
          using perfect_choose_dist[of "min e d" y]
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  1767
	  using `d > 0` `e>0` by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1768
	show "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d"
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1769
          unfolding `x = y`
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1770
          using `z \<noteq> y` **
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1771
          by (rule_tac x=z in bexI, auto simp add: dist_commute)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1772
      next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1773
	case False thus "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d"
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  1774
	  using `d>0` `d > dist x y` `?rhs` by(rule_tac x=x in bexI, auto)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1775
      qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1776
    qed  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1777
  thus "?lhs" unfolding mem_cball islimpt_approachable mem_ball by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1778
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1779
31526
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1780
lemma closure_ball_lemma:
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1781
  fixes x y :: "'a::real_normed_vector"
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1782
  assumes "x \<noteq> y" shows "y islimpt ball x (dist x y)"
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1783
proof (rule islimptI)
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1784
  fix T assume "y \<in> T" "open T"
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1785
  then obtain r where "0 < r" "\<forall>z. dist z y < r \<longrightarrow> z \<in> T"
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1786
    unfolding open_dist by fast
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1787
  (* choose point between x and y, within distance r of y. *)
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1788
  def k \<equiv> "min 1 (r / (2 * dist x y))"
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1789
  def z \<equiv> "y + scaleR k (x - y)"
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1790
  have z_def2: "z = x + scaleR (1 - k) (y - x)"
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1791
    unfolding z_def by (simp add: algebra_simps)
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1792
  have "dist z y < r"
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1793
    unfolding z_def k_def using `0 < r`
31587
a7e187205fc0 remove simp add: norm_scaleR
huffman
parents: 31585
diff changeset
  1794
    by (simp add: dist_norm min_def)
31526
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1795
  hence "z \<in> T" using `\<forall>z. dist z y < r \<longrightarrow> z \<in> T` by simp
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1796
  have "dist x z < dist x y"
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1797
    unfolding z_def2 dist_norm
31587
a7e187205fc0 remove simp add: norm_scaleR
huffman
parents: 31585
diff changeset
  1798
    apply (simp add: norm_minus_commute)
31526
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1799
    apply (simp only: dist_norm [symmetric])
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1800
    apply (subgoal_tac "\<bar>1 - k\<bar> * dist x y < 1 * dist x y", simp)
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1801
    apply (rule mult_strict_right_mono)
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1802
    apply (simp add: k_def divide_pos_pos zero_less_dist_iff `0 < r` `x \<noteq> y`)
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1803
    apply (simp add: zero_less_dist_iff `x \<noteq> y`)
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1804
    done
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1805
  hence "z \<in> ball x (dist x y)" by simp
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1806
  have "z \<noteq> y"
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1807
    unfolding z_def k_def using `x \<noteq> y` `0 < r`
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1808
    by (simp add: min_def)
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1809
  show "\<exists>z\<in>ball x (dist x y). z \<in> T \<and> z \<noteq> y"
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1810
    using `z \<in> ball x (dist x y)` `z \<in> T` `z \<noteq> y`
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1811
    by fast
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1812
qed
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1813
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1814
lemma closure_ball:
31526
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1815
  fixes x :: "'a::real_normed_vector"
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1816
  shows "0 < e \<Longrightarrow> closure (ball x e) = cball x e"
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1817
apply (rule equalityI)
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1818
apply (rule closure_minimal)
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1819
apply (rule ball_subset_cball)
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1820
apply (rule closed_cball)
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1821
apply (rule subsetI, rename_tac y)
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1822
apply (simp add: le_less [where 'a=real])
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1823
apply (erule disjE)
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1824
apply (rule subsetD [OF closure_subset], simp)
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1825
apply (simp add: closure_def)
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1826
apply clarify
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1827
apply (rule closure_ball_lemma)
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1828
apply (simp add: zero_less_dist_iff)
2ce3583b9261 generalize more lemmas
huffman
parents: 31525
diff changeset
  1829
done
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1830
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  1831
(* In a trivial vector space, this fails for e = 0. *)
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1832
lemma interior_cball:
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  1833
  fixes x :: "'a::{real_normed_vector, perfect_space}"
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  1834
  shows "interior (cball x e) = ball x e"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1835
proof(cases "e\<ge>0")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1836
  case False note cs = this
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1837
  from cs have "ball x e = {}" using ball_empty[of e x] by auto moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1838
  { fix y assume "y \<in> cball x e"
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  1839
    hence False unfolding mem_cball using dist_nz[of x y] cs by auto  }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1840
  hence "cball x e = {}" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1841
  hence "interior (cball x e) = {}" using interior_empty by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1842
  ultimately show ?thesis by blast
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1843
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1844
  case True note cs = this
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1845
  have "ball x e \<subseteq> cball x e" using ball_subset_cball by auto moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1846
  { fix S y assume as: "S \<subseteq> cball x e" "open S" "y\<in>S"
31418
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
  1847
    then obtain d where "d>0" and d:"\<forall>x'. dist x' y < d \<longrightarrow> x' \<in> S" unfolding open_dist by blast
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1848
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  1849
    then obtain xa where xa_y: "xa \<noteq> y" and xa: "dist xa y < d"
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  1850
      using perfect_choose_dist [of d] by auto
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  1851
    have "xa\<in>S" using d[THEN spec[where x=xa]] using xa by(auto simp add: dist_commute)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1852
    hence xa_cball:"xa \<in> cball x e" using as(1) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1853
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1854
    hence "y \<in> ball x e" proof(cases "x = y")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1855
      case True
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  1856
      hence "e>0" using xa_y[unfolded dist_nz] xa_cball[unfolded mem_cball] by (auto simp add: dist_commute)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1857
      thus "y \<in> ball x e" using `x = y ` by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1858
    next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1859
      case False
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  1860
      have "dist (y + (d / 2 / dist y x) *\<^sub>R (y - x)) y < d" unfolding dist_norm
31587
a7e187205fc0 remove simp add: norm_scaleR
huffman
parents: 31585
diff changeset
  1861
	using `d>0` norm_ge_zero[of "y - x"] `x \<noteq> y` by auto
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  1862
      hence *:"y + (d / 2 / dist y x) *\<^sub>R (y - x) \<in> cball x e" using d as(1)[unfolded subset_eq] by blast
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1863
      have "y - x \<noteq> 0" using `x \<noteq> y` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1864
      hence **:"d / (2 * norm (y - x)) > 0" unfolding zero_less_norm_iff[THEN sym]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1865
	using `d>0` divide_pos_pos[of d "2*norm (y - x)"] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1866
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  1867
      have "dist (y + (d / 2 / dist y x) *\<^sub>R (y - x)) x = norm (y + (d / (2 * norm (y - x))) *\<^sub>R y - (d / (2 * norm (y - x))) *\<^sub>R x - x)"
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  1868
        by (auto simp add: dist_norm algebra_simps)
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  1869
      also have "\<dots> = norm ((1 + d / (2 * norm (y - x))) *\<^sub>R (y - x))"
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  1870
        by (auto simp add: algebra_simps)
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  1871
      also have "\<dots> = \<bar>1 + d / (2 * norm (y - x))\<bar> * norm (y - x)"
31587
a7e187205fc0 remove simp add: norm_scaleR
huffman
parents: 31585
diff changeset
  1872
        using ** by auto
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  1873
      also have "\<dots> = (dist y x) + d/2"using ** by (auto simp add: left_distrib dist_norm)
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  1874
      finally have "e \<ge> dist x y +d/2" using *[unfolded mem_cball] by (auto simp add: dist_commute)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1875
      thus "y \<in> ball x e" unfolding mem_ball using `d>0` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1876
    qed  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1877
  hence "\<forall>S \<subseteq> cball x e. open S \<longrightarrow> S \<subseteq> ball x e" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1878
  ultimately show ?thesis using interior_unique[of "ball x e" "cball x e"] using open_ball[of x e] by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1879
qed
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1880
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1881
lemma frontier_ball:
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  1882
  fixes a :: "'a::real_normed_vector"
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1883
  shows "0 < e ==> frontier(ball a e) = {x. dist a x = e}"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  1884
  apply (simp add: frontier_def closure_ball interior_open open_ball order_less_imp_le)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1885
  apply (simp add: expand_set_eq)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1886
  by arith
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1887
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1888
lemma frontier_cball:
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  1889
  fixes a :: "'a::{real_normed_vector, perfect_space}"
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1890
  shows "frontier(cball a e) = {x. dist a x = e}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1891
  apply (simp add: frontier_def interior_cball closed_cball closure_closed order_less_imp_le)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1892
  apply (simp add: expand_set_eq)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1893
  by arith
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1894
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1895
lemma cball_eq_empty: "(cball x e = {}) \<longleftrightarrow> e < 0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1896
  apply (simp add: expand_set_eq not_le)
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  1897
  by (metis zero_le_dist dist_self order_less_le_trans)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1898
lemma cball_empty: "e < 0 ==> cball x e = {}" by (simp add: cball_eq_empty)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1899
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1900
lemma cball_eq_sing:
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  1901
  fixes x :: "'a::perfect_space"
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1902
  shows "(cball x e = {x}) \<longleftrightarrow> e = 0"
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  1903
proof (rule linorder_cases)
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  1904
  assume e: "0 < e"
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  1905
  obtain a where "a \<noteq> x" "dist a x < e"
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  1906
    using perfect_choose_dist [OF e] by auto
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  1907
  hence "a \<noteq> x" "dist x a \<le> e" by (auto simp add: dist_commute)
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  1908
  with e show ?thesis by (auto simp add: expand_set_eq)
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  1909
qed auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1910
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  1911
lemma cball_sing:
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  1912
  fixes x :: "'a::metric_space"
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  1913
  shows "e = 0 ==> cball x e = {x}"
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  1914
  by (auto simp add: expand_set_eq)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1915
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1916
text{* For points in the interior, localization of limits makes no difference.   *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1917
31447
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1918
lemma eventually_within_interior:
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1919
  assumes "x \<in> interior S"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1920
  shows "eventually P (at x within S) \<longleftrightarrow> eventually P (at x)" (is "?lhs = ?rhs")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1921
proof-
31527
a971fd7d8e45 generalize lemmas eventually_within_interior, lim_within_interior
huffman
parents: 31526
diff changeset
  1922
  from assms obtain T where T: "open T" "x \<in> T" "T \<subseteq> S"
a971fd7d8e45 generalize lemmas eventually_within_interior, lim_within_interior
huffman
parents: 31526
diff changeset
  1923
    unfolding interior_def by fast
a971fd7d8e45 generalize lemmas eventually_within_interior, lim_within_interior
huffman
parents: 31526
diff changeset
  1924
  { assume "?lhs"
a971fd7d8e45 generalize lemmas eventually_within_interior, lim_within_interior
huffman
parents: 31526
diff changeset
  1925
    then obtain A where "open A" "x \<in> A" "\<forall>y\<in>A. y \<noteq> x \<longrightarrow> y \<in> S \<longrightarrow> P y"
a971fd7d8e45 generalize lemmas eventually_within_interior, lim_within_interior
huffman
parents: 31526
diff changeset
  1926
      unfolding Limits.eventually_within Limits.eventually_at_topological
a971fd7d8e45 generalize lemmas eventually_within_interior, lim_within_interior
huffman
parents: 31526
diff changeset
  1927
      by auto
a971fd7d8e45 generalize lemmas eventually_within_interior, lim_within_interior
huffman
parents: 31526
diff changeset
  1928
    with T have "open (A \<inter> T)" "x \<in> A \<inter> T" "\<forall>y\<in>(A \<inter> T). y \<noteq> x \<longrightarrow> P y"
a971fd7d8e45 generalize lemmas eventually_within_interior, lim_within_interior
huffman
parents: 31526
diff changeset
  1929
      by auto
a971fd7d8e45 generalize lemmas eventually_within_interior, lim_within_interior
huffman
parents: 31526
diff changeset
  1930
    then have "?rhs"
a971fd7d8e45 generalize lemmas eventually_within_interior, lim_within_interior
huffman
parents: 31526
diff changeset
  1931
      unfolding Limits.eventually_at_topological by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1932
  } moreover
31527
a971fd7d8e45 generalize lemmas eventually_within_interior, lim_within_interior
huffman
parents: 31526
diff changeset
  1933
  { assume "?rhs" hence "?lhs"
a971fd7d8e45 generalize lemmas eventually_within_interior, lim_within_interior
huffman
parents: 31526
diff changeset
  1934
      unfolding Limits.eventually_within
a971fd7d8e45 generalize lemmas eventually_within_interior, lim_within_interior
huffman
parents: 31526
diff changeset
  1935
      by (auto elim: eventually_elim1)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1936
  } ultimately
31527
a971fd7d8e45 generalize lemmas eventually_within_interior, lim_within_interior
huffman
parents: 31526
diff changeset
  1937
  show "?thesis" ..
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1938
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1939
31447
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  1940
lemma lim_within_interior:
31527
a971fd7d8e45 generalize lemmas eventually_within_interior, lim_within_interior
huffman
parents: 31526
diff changeset
  1941
  "x \<in> interior S \<Longrightarrow> (f ---> l) (at x within S) \<longleftrightarrow> (f ---> l) (at x)"
a971fd7d8e45 generalize lemmas eventually_within_interior, lim_within_interior
huffman
parents: 31526
diff changeset
  1942
  unfolding tendsto_def by (simp add: eventually_within_interior)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1943
31346
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
  1944
lemma netlimit_within_interior:
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
  1945
  fixes x :: "'a::{perfect_space, real_normed_vector}"
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
  1946
    (* FIXME: generalize to perfect_space *)
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
  1947
  assumes "x \<in> interior S"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1948
  shows "netlimit(at x within S) = x" (is "?lhs = ?rhs")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1949
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1950
  from assms obtain e::real where e:"e>0" "ball x e \<subseteq> S" using open_interior[of S] unfolding open_contains_ball using interior_subset[of S] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1951
  hence "\<not> trivial_limit (at x within S)" using islimpt_subset[of x "ball x e" S] unfolding trivial_limit_within islimpt_ball centre_in_cball by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1952
  thus ?thesis using netlimit_within by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1953
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1954
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1955
subsection{* Boundedness. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1956
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1957
  (* FIXME: This has to be unified with BSEQ!! *)
31400
d671d74b2d1d generalize type of bounded
huffman
parents: 31397
diff changeset
  1958
definition
31533
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1959
  bounded :: "'a::metric_space set \<Rightarrow> bool" where
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1960
  "bounded S \<longleftrightarrow> (\<exists>x e. \<forall>y\<in>S. dist x y \<le> e)"
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1961
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1962
lemma bounded_any_center: "bounded S \<longleftrightarrow> (\<exists>e. \<forall>y\<in>S. dist a y \<le> e)"
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1963
unfolding bounded_def
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1964
apply safe
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1965
apply (rule_tac x="dist a x + e" in exI, clarify)
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1966
apply (drule (1) bspec)
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1967
apply (erule order_trans [OF dist_triangle add_left_mono])
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1968
apply auto
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1969
done
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1970
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1971
lemma bounded_iff: "bounded S \<longleftrightarrow> (\<exists>a. \<forall>x\<in>S. norm x \<le> a)"
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1972
unfolding bounded_any_center [where a=0]
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1973
by (simp add: dist_norm)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1974
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1975
lemma bounded_empty[simp]: "bounded {}" by (simp add: bounded_def)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1976
lemma bounded_subset: "bounded T \<Longrightarrow> S \<subseteq> T ==> bounded S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1977
  by (metis bounded_def subset_eq)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1978
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1979
lemma bounded_interior[intro]: "bounded S ==> bounded(interior S)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1980
  by (metis bounded_subset interior_subset)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1981
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1982
lemma bounded_closure[intro]: assumes "bounded S" shows "bounded(closure S)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1983
proof-
31533
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1984
  from assms obtain x and a where a: "\<forall>y\<in>S. dist x y \<le> a" unfolding bounded_def by auto
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1985
  { fix y assume "y \<in> closure S"
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1986
    then obtain f where f: "\<forall>n. f n \<in> S"  "(f ---> y) sequentially"
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1987
      unfolding closure_sequential by auto
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1988
    have "\<forall>n. f n \<in> S \<longrightarrow> dist x (f n) \<le> a" using a by simp
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1989
    hence "eventually (\<lambda>n. dist x (f n) \<le> a) sequentially"
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1990
      by (rule eventually_mono, simp add: f(1))
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1991
    have "dist x y \<le> a"
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1992
      apply (rule Lim_dist_ubound [of sequentially f])
31347
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1993
      apply (rule trivial_limit_sequentially)
31533
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  1994
      apply (rule f(2))
31347
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1995
      apply fact
357d58c5743a new lemmas about eventually; rewrite Lim proofs to use more abstract properties of eventually
huffman
parents: 31346
diff changeset
  1996
      done
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1997
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1998
  thus ?thesis unfolding bounded_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  1999
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2000
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2001
lemma bounded_cball[simp,intro]: "bounded (cball x e)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2002
  apply (simp add: bounded_def)
31533
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2003
  apply (rule_tac x=x in exI)
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2004
  apply (rule_tac x=e in exI)
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2005
  apply auto
31400
d671d74b2d1d generalize type of bounded
huffman
parents: 31397
diff changeset
  2006
  done
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2007
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2008
lemma bounded_ball[simp,intro]: "bounded(ball x e)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2009
  by (metis ball_subset_cball bounded_cball bounded_subset)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2010
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2011
lemma finite_imp_bounded[intro]: assumes "finite S" shows "bounded S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2012
proof-
31533
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2013
  { fix a F assume as:"bounded F"
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2014
    then obtain x e where "\<forall>y\<in>F. dist x y \<le> e" unfolding bounded_def by auto
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2015
    hence "\<forall>y\<in>(insert a F). dist x y \<le> max e (dist x a)" by auto
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2016
    hence "bounded (insert a F)" unfolding bounded_def by (intro exI)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2017
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2018
  thus ?thesis using finite_induct[of S bounded]  using bounded_empty assms by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2019
qed
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2020
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2021
lemma bounded_Un[simp]: "bounded (S \<union> T) \<longleftrightarrow> bounded S \<and> bounded T"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2022
  apply (auto simp add: bounded_def)
31533
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2023
  apply (rename_tac x y r s)
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2024
  apply (rule_tac x=x in exI)
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2025
  apply (rule_tac x="max r (dist x y + s)" in exI)
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2026
  apply (rule ballI, rename_tac z, safe)
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2027
  apply (drule (1) bspec, simp)
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2028
  apply (drule (1) bspec)
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2029
  apply (rule min_max.le_supI2)
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2030
  apply (erule order_trans [OF dist_triangle add_left_mono])
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2031
  done
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2032
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2033
lemma bounded_Union[intro]: "finite F \<Longrightarrow> (\<forall>S\<in>F. bounded S) \<Longrightarrow> bounded(\<Union>F)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2034
  by (induct rule: finite_induct[of F], auto)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2035
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2036
lemma bounded_pos: "bounded S \<longleftrightarrow> (\<exists>b>0. \<forall>x\<in> S. norm x <= b)"
31533
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2037
  apply (simp add: bounded_iff)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2038
  apply (subgoal_tac "\<And>x (y::real). 0 < 1 + abs y \<and> (x <= y \<longrightarrow> x <= 1 + abs y)")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2039
  by metis arith
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2040
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2041
lemma bounded_Int[intro]: "bounded S \<or> bounded T \<Longrightarrow> bounded (S \<inter> T)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2042
  by (metis Int_lower1 Int_lower2 bounded_subset)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2043
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2044
lemma bounded_diff[intro]: "bounded S ==> bounded (S - T)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2045
apply (metis Diff_subset bounded_subset)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2046
done
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2047
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2048
lemma bounded_insert[intro]:"bounded(insert x S) \<longleftrightarrow> bounded S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2049
  by (metis Diff_cancel Un_empty_right Un_insert_right bounded_Un bounded_subset finite.emptyI finite_imp_bounded infinite_remove subset_insertI)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2050
31531
fc78714d14e1 generalize more lemmas
huffman
parents: 31530
diff changeset
  2051
lemma not_bounded_UNIV[simp, intro]:
fc78714d14e1 generalize more lemmas
huffman
parents: 31530
diff changeset
  2052
  "\<not> bounded (UNIV :: 'a::{real_normed_vector, perfect_space} set)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2053
proof(auto simp add: bounded_pos not_le)
31531
fc78714d14e1 generalize more lemmas
huffman
parents: 31530
diff changeset
  2054
  obtain x :: 'a where "x \<noteq> 0"
fc78714d14e1 generalize more lemmas
huffman
parents: 31530
diff changeset
  2055
    using perfect_choose_dist [OF zero_less_one] by fast
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2056
  fix b::real  assume b: "b >0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2057
  have b1: "b +1 \<ge> 0" using b by simp
31531
fc78714d14e1 generalize more lemmas
huffman
parents: 31530
diff changeset
  2058
  with `x \<noteq> 0` have "b < norm (scaleR (b + 1) (sgn x))"
31587
a7e187205fc0 remove simp add: norm_scaleR
huffman
parents: 31585
diff changeset
  2059
    by (simp add: norm_sgn)
31531
fc78714d14e1 generalize more lemmas
huffman
parents: 31530
diff changeset
  2060
  then show "\<exists>x::'a. b < norm x" ..
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2061
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2062
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2063
lemma bounded_linear_image:
31657
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  2064
  assumes "bounded S" "bounded_linear f"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2065
  shows "bounded(f ` S)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2066
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2067
  from assms(1) obtain b where b:"b>0" "\<forall>x\<in>S. norm x \<le> b" unfolding bounded_pos by auto
31657
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  2068
  from assms(2) obtain B where B:"B>0" "\<forall>x. norm (f x) \<le> B * norm x" using bounded_linear.pos_bounded by (auto simp add: mult_ac)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2069
  { fix x assume "x\<in>S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2070
    hence "norm x \<le> b" using b by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2071
    hence "norm (f x) \<le> B * b" using B(2) apply(erule_tac x=x in allE)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2072
      by (metis B(1) B(2) real_le_trans real_mult_le_cancel_iff2)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2073
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2074
  thus ?thesis unfolding bounded_pos apply(rule_tac x="b*B" in exI)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2075
    using b B real_mult_order[of b B] by (auto simp add: real_mult_commute)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2076
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2077
31400
d671d74b2d1d generalize type of bounded
huffman
parents: 31397
diff changeset
  2078
lemma bounded_scaling:
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  2079
  fixes S :: "'a::real_normed_vector set"
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  2080
  shows "bounded S \<Longrightarrow> bounded ((\<lambda>x. c *\<^sub>R x) ` S)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2081
  apply (rule bounded_linear_image, assumption)
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  2082
  apply (rule scaleR.bounded_linear_right)
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  2083
  done
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2084
31533
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2085
lemma bounded_translation:
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2086
  fixes S :: "'a::real_normed_vector set"
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2087
  assumes "bounded S" shows "bounded ((\<lambda>x. a + x) ` S)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2088
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2089
  from assms obtain b where b:"b>0" "\<forall>x\<in>S. norm x \<le> b" unfolding bounded_pos by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2090
  { fix x assume "x\<in>S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2091
    hence "norm (a + x) \<le> b + norm a" using norm_triangle_ineq[of a x] b by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2092
  }
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2093
  thus ?thesis unfolding bounded_pos using norm_ge_zero[of a] b(1) using add_strict_increasing[of b 0 "norm a"]
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2094
    by (auto intro!: add exI[of _ "b + norm a"])
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2095
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2096
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2097
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2098
text{* Some theorems on sups and infs using the notion "bounded". *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2099
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  2100
lemma bounded_real:
31400
d671d74b2d1d generalize type of bounded
huffman
parents: 31397
diff changeset
  2101
  fixes S :: "real set"
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  2102
  shows "bounded S \<longleftrightarrow>  (\<exists>a. \<forall>x\<in>S. abs x <= a)"
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  2103
  by (simp add: bounded_iff)
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  2104
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  2105
lemma bounded_has_rsup: assumes "bounded S" "S \<noteq> {}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2106
  shows "\<forall>x\<in>S. x <= rsup S" and "\<forall>b. (\<forall>x\<in>S. x <= b) \<longrightarrow> rsup S <= b"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2107
proof
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2108
  fix x assume "x\<in>S"
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  2109
  from assms(1) obtain a where a:"\<forall>x\<in>S. \<bar>x\<bar> \<le> a" unfolding bounded_real by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2110
  hence *:"S *<= a" using setleI[of S a] by (metis abs_le_interval_iff mem_def)
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  2111
  thus "x \<le> rsup S" using rsup[OF `S\<noteq>{}`] using assms(1)[unfolded bounded_real] using isLubD2[of UNIV S "rsup S" x] using `x\<in>S` by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2112
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2113
  show "\<forall>b. (\<forall>x\<in>S. x \<le> b) \<longrightarrow> rsup S \<le> b" using assms
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2114
  using rsup[of S, unfolded isLub_def isUb_def leastP_def setle_def setge_def]
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  2115
  apply (auto simp add: bounded_real)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2116
  by (auto simp add: isLub_def isUb_def leastP_def setle_def setge_def)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2117
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2118
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  2119
lemma rsup_insert: assumes "bounded S"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2120
  shows "rsup(insert x S) = (if S = {} then x else max x (rsup S))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2121
proof(cases "S={}")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2122
  case True thus ?thesis using rsup_finite_in[of "{x}"] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2123
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2124
  let ?S = "insert x S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2125
  case False
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2126
  hence *:"\<forall>x\<in>S. x \<le> rsup S" using bounded_has_rsup(1)[of S] using assms by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2127
  hence "insert x S *<= max x (rsup S)" unfolding setle_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2128
  hence "isLub UNIV ?S (rsup ?S)" using rsup[of ?S] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2129
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2130
  have **:"isUb UNIV ?S (max x (rsup S))" unfolding isUb_def setle_def using * by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2131
  { fix y assume as:"isUb UNIV (insert x S) y"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2132
    hence "max x (rsup S) \<le> y" unfolding isUb_def using rsup_le[OF `S\<noteq>{}`]
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2133
      unfolding setle_def by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2134
  hence "max x (rsup S) <=* isUb UNIV (insert x S)" unfolding setge_def Ball_def mem_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2135
  hence "isLub UNIV ?S (max x (rsup S))" using ** isLubI2[of UNIV ?S "max x (rsup S)"] unfolding Collect_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2136
  ultimately show ?thesis using real_isLub_unique[of UNIV ?S] using `S\<noteq>{}` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2137
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2138
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2139
lemma sup_insert_finite: "finite S \<Longrightarrow> rsup(insert x S) = (if S = {} then x else max x (rsup S))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2140
  apply (rule rsup_insert)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2141
  apply (rule finite_imp_bounded)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2142
  by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2143
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2144
lemma bounded_has_rinf:
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  2145
  assumes "bounded S"  "S \<noteq> {}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2146
  shows "\<forall>x\<in>S. x >= rinf S" and "\<forall>b. (\<forall>x\<in>S. x >= b) \<longrightarrow> rinf S >= b"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2147
proof
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2148
  fix x assume "x\<in>S"
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  2149
  from assms(1) obtain a where a:"\<forall>x\<in>S. \<bar>x\<bar> \<le> a" unfolding bounded_real by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2150
  hence *:"- a <=* S" using setgeI[of S "-a"] unfolding abs_le_interval_iff by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2151
  thus "x \<ge> rinf S" using rinf[OF `S\<noteq>{}`] using isGlbD2[of UNIV S "rinf S" x] using `x\<in>S` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2152
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2153
  show "\<forall>b. (\<forall>x\<in>S. x >= b) \<longrightarrow> rinf S \<ge> b" using assms
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2154
  using rinf[of S, unfolded isGlb_def isLb_def greatestP_def setle_def setge_def]
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  2155
  apply (auto simp add: bounded_real)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2156
  by (auto simp add: isGlb_def isLb_def greatestP_def setle_def setge_def)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2157
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2158
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2159
(* TODO: Move this to RComplete.thy -- would need to include Glb into RComplete *)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2160
lemma real_isGlb_unique: "[| isGlb R S x; isGlb R S y |] ==> x = (y::real)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2161
  apply (frule isGlb_isLb)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2162
  apply (frule_tac x = y in isGlb_isLb)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2163
  apply (blast intro!: order_antisym dest!: isGlb_le_isLb)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2164
  done
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2165
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  2166
lemma rinf_insert: assumes "bounded S"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2167
  shows "rinf(insert x S) = (if S = {} then x else min x (rinf S))" (is "?lhs = ?rhs")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2168
proof(cases "S={}")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2169
  case True thus ?thesis using rinf_finite_in[of "{x}"] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2170
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2171
  let ?S = "insert x S"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2172
  case False
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2173
  hence *:"\<forall>x\<in>S. x \<ge> rinf S" using bounded_has_rinf(1)[of S] using assms by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2174
  hence "min x (rinf S) <=* insert x S" unfolding setge_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2175
  hence "isGlb UNIV ?S (rinf ?S)" using rinf[of ?S] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2176
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2177
  have **:"isLb UNIV ?S (min x (rinf S))" unfolding isLb_def setge_def using * by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2178
  { fix y assume as:"isLb UNIV (insert x S) y"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2179
    hence "min x (rinf S) \<ge> y" unfolding isLb_def using rinf_ge[OF `S\<noteq>{}`]
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2180
      unfolding setge_def by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2181
  hence "isLb UNIV (insert x S) *<= min x (rinf S)" unfolding setle_def Ball_def mem_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2182
  hence "isGlb UNIV ?S (min x (rinf S))" using ** isGlbI2[of UNIV ?S "min x (rinf S)"] unfolding Collect_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2183
  ultimately show ?thesis using real_isGlb_unique[of UNIV ?S] using `S\<noteq>{}` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2184
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2185
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2186
lemma inf_insert_finite: "finite S ==> rinf(insert x S) = (if S = {} then x else min x (rinf S))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2187
  by (rule rinf_insert, rule finite_imp_bounded, simp)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2188
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2189
subsection{* Compactness (the definition is the one based on convegent subsequences). *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2190
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  2191
definition
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  2192
  compact :: "'a::metric_space set \<Rightarrow> bool" where (* TODO: generalize *)
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  2193
  "compact S \<longleftrightarrow>
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2194
   (\<forall>f. (\<forall>n. f n \<in> S) \<longrightarrow>
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2195
       (\<exists>l\<in>S. \<exists>r. subseq r \<and> ((f o r) ---> l) sequentially))"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2196
31536
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2197
text {*
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2198
  A metric space (or topological vector space) is said to have the
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2199
  Heine-Borel property if every closed and bounded subset is compact.
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2200
*}
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2201
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2202
class heine_borel =
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2203
  assumes bounded_imp_convergent_subsequence:
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2204
    "bounded s \<Longrightarrow> \<forall>n. f n \<in> s
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2205
      \<Longrightarrow> \<exists>l r. subseq r \<and> ((f \<circ> r) ---> l) sequentially"
31536
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2206
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2207
lemma bounded_closed_imp_compact:
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2208
  fixes s::"'a::heine_borel set"
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2209
  assumes "bounded s" and "closed s" shows "compact s"
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2210
proof (unfold compact_def, clarify)
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2211
  fix f :: "nat \<Rightarrow> 'a" assume f: "\<forall>n. f n \<in> s"
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2212
  obtain l r where r: "subseq r" and l: "((f \<circ> r) ---> l) sequentially"
31536
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2213
    using bounded_imp_convergent_subsequence [OF `bounded s` `\<forall>n. f n \<in> s`] by auto
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2214
  from f have fr: "\<forall>n. (f \<circ> r) n \<in> s" by simp
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2215
  have "l \<in> s" using `closed s` fr l
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2216
    unfolding closed_sequential_limits by blast
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2217
  show "\<exists>l\<in>s. \<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially"
31536
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2218
    using `l \<in> s` r l by blast
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2219
qed
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2220
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2221
lemma subseq_bigger: assumes "subseq r" shows "n \<le> r n"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2222
proof(induct n)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2223
  show "0 \<le> r 0" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2224
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2225
  fix n assume "n \<le> r n"
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2226
  moreover have "r n < r (Suc n)"
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2227
    using assms [unfolded subseq_def] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2228
  ultimately show "Suc n \<le> r (Suc n)" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2229
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2230
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2231
lemma eventually_subseq:
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2232
  assumes r: "subseq r"
31536
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2233
  shows "eventually P sequentially \<Longrightarrow> eventually (\<lambda>n. P (r n)) sequentially"
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2234
unfolding eventually_sequentially
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2235
by (metis subseq_bigger [OF r] le_trans)
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2236
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2237
lemma lim_subseq:
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2238
  "subseq r \<Longrightarrow> (s ---> l) sequentially \<Longrightarrow> ((s o r) ---> l) sequentially"
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2239
unfolding tendsto_def eventually_sequentially o_def
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2240
by (metis subseq_bigger le_trans)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2241
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2242
lemma num_Axiom: "EX! g. g 0 = e \<and> (\<forall>n. g (Suc n) = f n (g n))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2243
  unfolding Ex1_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2244
  apply (rule_tac x="nat_rec e f" in exI)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2245
  apply (rule conjI)+
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2246
apply (rule def_nat_rec_0, simp)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2247
apply (rule allI, rule def_nat_rec_Suc, simp)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2248
apply (rule allI, rule impI, rule ext)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2249
apply (erule conjE)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2250
apply (induct_tac x)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2251
apply (simp add: nat_rec_0)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2252
apply (erule_tac x="n" in allE)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2253
apply (simp)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2254
done
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2255
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2256
lemma convergent_bounded_increasing: fixes s ::"nat\<Rightarrow>real"
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2257
  assumes "incseq s" and "\<forall>n. abs(s n) \<le> b"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2258
  shows "\<exists> l. \<forall>e::real>0. \<exists> N. \<forall>n \<ge> N.  abs(s n - l) < e"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2259
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2260
  have "isUb UNIV (range s) b" using assms(2) and abs_le_D1 unfolding isUb_def and setle_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2261
  then obtain t where t:"isLub UNIV (range s) t" using reals_complete[of "range s" ] by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2262
  { fix e::real assume "e>0" and as:"\<forall>N. \<exists>n\<ge>N. \<not> \<bar>s n - t\<bar> < e"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2263
    { fix n::nat
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2264
      obtain N where "N\<ge>n" and n:"\<bar>s N - t\<bar> \<ge> e" using as[THEN spec[where x=n]] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2265
      have "t \<ge> s N" using isLub_isUb[OF t, unfolded isUb_def setle_def] by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2266
      with n have "s N \<le> t - e" using `e>0` by auto
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2267
      hence "s n \<le> t - e" using assms(1)[unfolded incseq_def, THEN spec[where x=n], THEN spec[where x=N]] using `n\<le>N` by auto  }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2268
    hence "isUb UNIV (range s) (t - e)" unfolding isUb_def and setle_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2269
    hence False using isLub_le_isUb[OF t, of "t - e"] and `e>0` by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2270
  thus ?thesis by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2271
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2272
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2273
lemma convergent_bounded_monotone: fixes s::"nat \<Rightarrow> real"
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2274
  assumes "\<forall>n. abs(s n) \<le> b" and "monoseq s"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2275
  shows "\<exists>l. \<forall>e::real>0. \<exists>N. \<forall>n\<ge>N. abs(s n - l) < e"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2276
  using convergent_bounded_increasing[of s b] assms using convergent_bounded_increasing[of "\<lambda>n. - s n" b]
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2277
  unfolding monoseq_def incseq_def
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2278
  apply auto unfolding minus_add_distrib[THEN sym, unfolded diff_minus[THEN sym]]
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2279
  unfolding abs_minus_cancel by(rule_tac x="-l" in exI)auto
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2280
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2281
lemma compact_real_lemma:
31536
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2282
  assumes "\<forall>n::nat. abs(s n) \<le> b"
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2283
  shows "\<exists>(l::real) r. subseq r \<and> ((s \<circ> r) ---> l) sequentially"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2284
proof-
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2285
  obtain r where r:"subseq r" "monoseq (\<lambda>n. s (r n))"
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2286
    using seq_monosub[of s] by auto
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2287
  thus ?thesis using convergent_bounded_monotone[of "\<lambda>n. s (r n)" b] and assms
31536
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2288
    unfolding tendsto_iff dist_norm eventually_sequentially by auto
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2289
qed
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2290
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2291
instance real :: heine_borel
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2292
proof
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2293
  fix s :: "real set" and f :: "nat \<Rightarrow> real"
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2294
  assume s: "bounded s" and f: "\<forall>n. f n \<in> s"
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2295
  then obtain b where b: "\<forall>n. abs (f n) \<le> b"
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2296
    unfolding bounded_iff by auto
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2297
  obtain l :: real and r :: "nat \<Rightarrow> nat" where
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2298
    r: "subseq r" and l: "((f \<circ> r) ---> l) sequentially"
31536
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2299
    using compact_real_lemma [OF b] by auto
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2300
  thus "\<exists>l r. subseq r \<and> ((f \<circ> r) ---> l) sequentially"
31536
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2301
    by auto
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2302
qed
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2303
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2304
lemma bounded_component: "bounded s \<Longrightarrow> bounded ((\<lambda>x. x $ i) ` s)"
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2305
unfolding bounded_def
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2306
apply clarify
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2307
apply (rule_tac x="x $ i" in exI)
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2308
apply (rule_tac x="e" in exI)
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2309
apply clarify
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2310
apply (rule order_trans [OF dist_nth_le], simp)
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2311
done
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2312
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2313
lemma compact_lemma:
31536
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2314
  fixes f :: "nat \<Rightarrow> 'a::heine_borel ^ 'n::finite"
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2315
  assumes "bounded s" and "\<forall>n. f n \<in> s"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  2316
  shows "\<forall>d.
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2317
        \<exists>l r. subseq r \<and>
31536
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2318
        (\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r n) $ i) (l $ i) < e) sequentially)"
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2319
proof
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2320
  fix d::"'n set" have "finite d" by simp
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2321
  thus "\<exists>l::'a ^ 'n. \<exists>r. subseq r \<and>
31536
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2322
      (\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r n) $ i) (l $ i) < e) sequentially)"
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2323
  proof(induct d) case empty thus ?case unfolding subseq_def by auto
31536
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2324
  next case (insert k d)
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2325
    have s': "bounded ((\<lambda>x. x $ k) ` s)" using `bounded s` by (rule bounded_component)
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2326
    obtain l1::"'a^'n" and r1 where r1:"subseq r1" and lr1:"\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 n) $ i) (l1 $ i) < e) sequentially"
31536
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2327
      using insert(3) by auto
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2328
    have f': "\<forall>n. f (r1 n) $ k \<in> (\<lambda>x. x $ k) ` s" using `\<forall>n. f n \<in> s` by simp
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2329
    obtain l2 r2 where r2:"subseq r2" and lr2:"((\<lambda>i. f (r1 (r2 i)) $ k) ---> l2) sequentially"
31536
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2330
      using bounded_imp_convergent_subsequence[OF s' f'] unfolding o_def by auto
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2331
    def r \<equiv> "r1 \<circ> r2" have r:"subseq r"
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2332
      using r1 and r2 unfolding r_def o_def subseq_def by auto
31536
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2333
    moreover
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2334
    def l \<equiv> "(\<chi> i. if i = k then l2 else l1$i)::'a^'n"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2335
    { fix e::real assume "e>0"
31536
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2336
      from lr1 `e>0` have N1:"eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 n) $ i) (l1 $ i) < e) sequentially" by blast
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2337
      from lr2 `e>0` have N2:"eventually (\<lambda>n. dist (f (r1 (r2 n)) $ k) l2 < e) sequentially" by (rule tendstoD)
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2338
      from r2 N1 have N1': "eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 (r2 n)) $ i) (l1 $ i) < e) sequentially"
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2339
        by (rule eventually_subseq)
31536
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2340
      have "eventually (\<lambda>n. \<forall>i\<in>(insert k d). dist (f (r n) $ i) (l $ i) < e) sequentially"
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2341
        using N1' N2 by (rule eventually_elim2, simp add: l_def r_def)
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2342
    }
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2343
    ultimately show ?case by auto
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2344
  qed
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2345
qed
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2346
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2347
instance "^" :: (heine_borel, finite) heine_borel
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2348
proof
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2349
  fix s :: "('a ^ 'b) set" and f :: "nat \<Rightarrow> 'a ^ 'b"
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2350
  assume s: "bounded s" and f: "\<forall>n. f n \<in> s"
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2351
  then obtain l r where r: "subseq r"
31536
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2352
    and l: "\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>UNIV. dist (f (r n) $ i) (l $ i) < e) sequentially"
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2353
    using compact_lemma [OF s f] by blast
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2354
  let ?d = "UNIV::'b set"
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2355
  { fix e::real assume "e>0"
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2356
    hence "0 < e / (real_of_nat (card ?d))"
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2357
      using zero_less_card_finite using divide_pos_pos[of e, of "real_of_nat (card ?d)"] by auto
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2358
    with l have "eventually (\<lambda>n. \<forall>i. dist (f (r n) $ i) (l $ i) < e / (real_of_nat (card ?d))) sequentially"
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2359
      by simp
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2360
    moreover
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2361
    { fix n assume n: "\<forall>i. dist (f (r n) $ i) (l $ i) < e / (real_of_nat (card ?d))"
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2362
      have "dist (f (r n)) l \<le> (\<Sum>i\<in>?d. dist (f (r n) $ i) (l $ i))"
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2363
        unfolding dist_vector_def using zero_le_dist by (rule setL2_le_setsum)
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2364
      also have "\<dots> < (\<Sum>i\<in>?d. e / (real_of_nat (card ?d)))"
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2365
        by (rule setsum_strict_mono) (simp_all add: n)
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2366
      finally have "dist (f (r n)) l < e" by simp
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2367
    }
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2368
    ultimately have "eventually (\<lambda>n. dist (f (r n)) l < e) sequentially"
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2369
      by (rule eventually_elim1)
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2370
  }
d1b7f1f682ce new class heine_borel for lemma bounded_closed_imp_compact; instances for real, ^
huffman
parents: 31535
diff changeset
  2371
  hence *:"((f \<circ> r) ---> l) sequentially" unfolding o_def tendsto_iff by simp
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2372
  with r show "\<exists>l r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2373
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2374
31560
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2375
lemma bounded_fst: "bounded s \<Longrightarrow> bounded (fst ` s)"
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2376
unfolding bounded_def
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2377
apply clarify
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2378
apply (rule_tac x="a" in exI)
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2379
apply (rule_tac x="e" in exI)
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2380
apply clarsimp
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2381
apply (drule (1) bspec)
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2382
apply (simp add: dist_Pair_Pair)
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2383
apply (erule order_trans [OF real_sqrt_sum_squares_ge1])
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2384
done
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2385
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2386
lemma bounded_snd: "bounded s \<Longrightarrow> bounded (snd ` s)"
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2387
unfolding bounded_def
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2388
apply clarify
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2389
apply (rule_tac x="b" in exI)
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2390
apply (rule_tac x="e" in exI)
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2391
apply clarsimp
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2392
apply (drule (1) bspec)
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2393
apply (simp add: dist_Pair_Pair)
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2394
apply (erule order_trans [OF real_sqrt_sum_squares_ge2])
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2395
done
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2396
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2397
instance "*" :: (heine_borel, heine_borel) heine_borel
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2398
proof
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2399
  fix s :: "('a * 'b) set" and f :: "nat \<Rightarrow> 'a * 'b"
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2400
  assume s: "bounded s" and f: "\<forall>n. f n \<in> s"
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2401
  from s have s1: "bounded (fst ` s)" by (rule bounded_fst)
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2402
  from f have f1: "\<forall>n. fst (f n) \<in> fst ` s" by simp
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2403
  obtain l1 r1 where r1: "subseq r1"
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2404
    and l1: "((\<lambda>n. fst (f (r1 n))) ---> l1) sequentially"
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2405
    using bounded_imp_convergent_subsequence [OF s1 f1]
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2406
    unfolding o_def by fast
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2407
  from s have s2: "bounded (snd ` s)" by (rule bounded_snd)
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2408
  from f have f2: "\<forall>n. snd (f (r1 n)) \<in> snd ` s" by simp
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2409
  obtain l2 r2 where r2: "subseq r2"
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2410
    and l2: "((\<lambda>n. snd (f (r1 (r2 n)))) ---> l2) sequentially"
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2411
    using bounded_imp_convergent_subsequence [OF s2 f2]
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2412
    unfolding o_def by fast
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2413
  have l1': "((\<lambda>n. fst (f (r1 (r2 n)))) ---> l1) sequentially"
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2414
    using lim_subseq [OF r2 l1] unfolding o_def .
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2415
  have l: "((f \<circ> (r1 \<circ> r2)) ---> (l1, l2)) sequentially"
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2416
    using tendsto_Pair [OF l1' l2] unfolding o_def by simp
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2417
  have r: "subseq (r1 \<circ> r2)"
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2418
    using r1 r2 unfolding subseq_def by simp
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2419
  show "\<exists>l r. subseq r \<and> ((f \<circ> r) ---> l) sequentially"
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2420
    using l r by fast
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2421
qed
88347c12e267 heine_borel instance for products
huffman
parents: 31559
diff changeset
  2422
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2423
subsection{* Completeness. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2424
31341
c13b080bfb34 remove duplicate cauchy constant
huffman
parents: 31289
diff changeset
  2425
lemma cauchy_def:
c13b080bfb34 remove duplicate cauchy constant
huffman
parents: 31289
diff changeset
  2426
  "Cauchy s \<longleftrightarrow> (\<forall>e>0. \<exists>N. \<forall>m n. m \<ge> N \<and> n \<ge> N --> dist(s m)(s n) < e)"
c13b080bfb34 remove duplicate cauchy constant
huffman
parents: 31289
diff changeset
  2427
unfolding Cauchy_def by blast
c13b080bfb34 remove duplicate cauchy constant
huffman
parents: 31289
diff changeset
  2428
31528
c701f4085ca4 generalize constant 'complete'
huffman
parents: 31527
diff changeset
  2429
definition
c701f4085ca4 generalize constant 'complete'
huffman
parents: 31527
diff changeset
  2430
  complete :: "'a::metric_space set \<Rightarrow> bool" where
c701f4085ca4 generalize constant 'complete'
huffman
parents: 31527
diff changeset
  2431
  "complete s \<longleftrightarrow> (\<forall>f. (\<forall>n. f n \<in> s) \<and> Cauchy f
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2432
                      --> (\<exists>l \<in> s. (f ---> l) sequentially))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2433
31341
c13b080bfb34 remove duplicate cauchy constant
huffman
parents: 31289
diff changeset
  2434
lemma cauchy: "Cauchy s \<longleftrightarrow> (\<forall>e>0.\<exists> N::nat. \<forall>n\<ge>N. dist(s n)(s N) < e)" (is "?lhs = ?rhs")
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2435
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2436
  { assume ?rhs
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2437
    { fix e::real
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2438
      assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2439
      with `?rhs` obtain N where N:"\<forall>n\<ge>N. dist (s n) (s N) < e/2"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2440
	by (erule_tac x="e/2" in allE) auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2441
      { fix n m
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2442
	assume nm:"N \<le> m \<and> N \<le> n"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2443
	hence "dist (s m) (s n) < e" using N
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2444
	  using dist_triangle_half_l[of "s m" "s N" "e" "s n"]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2445
	  by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2446
      }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2447
      hence "\<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (s m) (s n) < e"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2448
	by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2449
    }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2450
    hence ?lhs
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2451
      unfolding cauchy_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2452
      by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2453
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2454
  thus ?thesis
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2455
    unfolding cauchy_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2456
    using dist_triangle_half_l
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2457
    by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2458
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2459
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2460
lemma convergent_imp_cauchy:
31341
c13b080bfb34 remove duplicate cauchy constant
huffman
parents: 31289
diff changeset
  2461
 "(s ---> l) sequentially ==> Cauchy s"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2462
proof(simp only: cauchy_def, rule, rule)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2463
  fix e::real assume "e>0" "(s ---> l) sequentially"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2464
  then obtain N::nat where N:"\<forall>n\<ge>N. dist (s n) l < e/2" unfolding Lim_sequentially by(erule_tac x="e/2" in allE) auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2465
  thus "\<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (s m) (s n) < e"  using dist_triangle_half_l[of _ l e _] by (rule_tac x=N in exI) auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2466
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2467
31341
c13b080bfb34 remove duplicate cauchy constant
huffman
parents: 31289
diff changeset
  2468
lemma cauchy_imp_bounded: assumes "Cauchy s" shows "bounded {y. (\<exists>n::nat. y = s n)}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2469
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2470
  from assms obtain N::nat where "\<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (s m) (s n) < 1" unfolding cauchy_def apply(erule_tac x= 1 in allE) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2471
  hence N:"\<forall>n. N \<le> n \<longrightarrow> dist (s N) (s n) < 1" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2472
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2473
  have "bounded (s ` {0..N})" using finite_imp_bounded[of "s ` {1..N}"] by auto
31533
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2474
  then obtain a where a:"\<forall>x\<in>s ` {0..N}. dist (s N) x \<le> a"
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2475
    unfolding bounded_any_center [where a="s N"] by auto
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2476
  ultimately show "?thesis"
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2477
    unfolding bounded_any_center [where a="s N"]
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2478
    apply(rule_tac x="max a 1" in exI) apply auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2479
    apply(erule_tac x=n in allE) apply(erule_tac x=n in ballE) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2480
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2481
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2482
lemma compact_imp_complete: assumes "compact s" shows "complete s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2483
proof-
31341
c13b080bfb34 remove duplicate cauchy constant
huffman
parents: 31289
diff changeset
  2484
  { fix f assume as: "(\<forall>n::nat. f n \<in> s)" "Cauchy f"
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2485
    from as(1) obtain l r where lr: "l\<in>s" "subseq r" "((f \<circ> r) ---> l) sequentially" using assms unfolding compact_def by blast
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2486
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2487
    note lr' = subseq_bigger [OF lr(2)]
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2488
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2489
    { fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2490
      from as(2) obtain N where N:"\<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (f m) (f n) < e/2" unfolding cauchy_def using `e>0` apply (erule_tac x="e/2" in allE) by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2491
      from lr(3)[unfolded Lim_sequentially, THEN spec[where x="e/2"]] obtain M where M:"\<forall>n\<ge>M. dist ((f \<circ> r) n) l < e/2" using `e>0` by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2492
      { fix n::nat assume n:"n \<ge> max N M"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2493
	have "dist ((f \<circ> r) n) l < e/2" using n M by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2494
	moreover have "r n \<ge> N" using lr'[of n] n by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2495
	hence "dist (f n) ((f \<circ> r) n) < e / 2" using N using n by auto
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  2496
	ultimately have "dist (f n) l < e" using dist_triangle_half_r[of "f (r n)" "f n" e l] by (auto simp add: dist_commute)  }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2497
      hence "\<exists>N. \<forall>n\<ge>N. dist (f n) l < e" by blast  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2498
    hence "\<exists>l\<in>s. (f ---> l) sequentially" using `l\<in>s` unfolding Lim_sequentially by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2499
  thus ?thesis unfolding complete_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2500
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2501
31537
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2502
instance heine_borel < complete_space
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2503
proof
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2504
  fix f :: "nat \<Rightarrow> 'a" assume "Cauchy f"
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2505
  hence "bounded (range f)" unfolding image_def
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2506
    using cauchy_imp_bounded [of f] by auto
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2507
  hence "compact (closure (range f))"
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2508
    using bounded_closed_imp_compact [of "closure (range f)"] by auto
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2509
  hence "complete (closure (range f))"
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2510
    using compact_imp_complete by auto
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2511
  moreover have "\<forall>n. f n \<in> closure (range f)"
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2512
    using closure_subset [of "range f"] by auto
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2513
  ultimately have "\<exists>l\<in>closure (range f). (f ---> l) sequentially"
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2514
    using `Cauchy f` unfolding complete_def by auto
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2515
  then show "convergent f"
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2516
    unfolding convergent_def LIMSEQ_conv_tendsto [symmetric] by auto
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2517
qed
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2518
31528
c701f4085ca4 generalize constant 'complete'
huffman
parents: 31527
diff changeset
  2519
lemma complete_univ: "complete (UNIV :: 'a::complete_space set)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2520
proof(simp add: complete_def, rule, rule)
31528
c701f4085ca4 generalize constant 'complete'
huffman
parents: 31527
diff changeset
  2521
  fix f :: "nat \<Rightarrow> 'a" assume "Cauchy f"
c701f4085ca4 generalize constant 'complete'
huffman
parents: 31527
diff changeset
  2522
  hence "convergent f" by (rule Cauchy_convergent)
c701f4085ca4 generalize constant 'complete'
huffman
parents: 31527
diff changeset
  2523
  hence "\<exists>l. f ----> l" unfolding convergent_def .  
c701f4085ca4 generalize constant 'complete'
huffman
parents: 31527
diff changeset
  2524
  thus "\<exists>l. (f ---> l) sequentially" unfolding LIMSEQ_conv_tendsto .
c701f4085ca4 generalize constant 'complete'
huffman
parents: 31527
diff changeset
  2525
qed
c701f4085ca4 generalize constant 'complete'
huffman
parents: 31527
diff changeset
  2526
31534
0de814d2ff95 add lemma complete_imp_closed
huffman
parents: 31533
diff changeset
  2527
lemma complete_imp_closed: assumes "complete s" shows "closed s"
0de814d2ff95 add lemma complete_imp_closed
huffman
parents: 31533
diff changeset
  2528
proof -
0de814d2ff95 add lemma complete_imp_closed
huffman
parents: 31533
diff changeset
  2529
  { fix x assume "x islimpt s"
0de814d2ff95 add lemma complete_imp_closed
huffman
parents: 31533
diff changeset
  2530
    then obtain f where f: "\<forall>n. f n \<in> s - {x}" "(f ---> x) sequentially"
0de814d2ff95 add lemma complete_imp_closed
huffman
parents: 31533
diff changeset
  2531
      unfolding islimpt_sequential by auto
0de814d2ff95 add lemma complete_imp_closed
huffman
parents: 31533
diff changeset
  2532
    then obtain l where l: "l\<in>s" "(f ---> l) sequentially"
0de814d2ff95 add lemma complete_imp_closed
huffman
parents: 31533
diff changeset
  2533
      using `complete s`[unfolded complete_def] using convergent_imp_cauchy[of f x] by auto
0de814d2ff95 add lemma complete_imp_closed
huffman
parents: 31533
diff changeset
  2534
    hence "x \<in> s"  using Lim_unique[of sequentially f l x] trivial_limit_sequentially f(2) by auto
0de814d2ff95 add lemma complete_imp_closed
huffman
parents: 31533
diff changeset
  2535
  }
0de814d2ff95 add lemma complete_imp_closed
huffman
parents: 31533
diff changeset
  2536
  thus "closed s" unfolding closed_limpt by auto
0de814d2ff95 add lemma complete_imp_closed
huffman
parents: 31533
diff changeset
  2537
qed
0de814d2ff95 add lemma complete_imp_closed
huffman
parents: 31533
diff changeset
  2538
31528
c701f4085ca4 generalize constant 'complete'
huffman
parents: 31527
diff changeset
  2539
lemma complete_eq_closed:
c701f4085ca4 generalize constant 'complete'
huffman
parents: 31527
diff changeset
  2540
  fixes s :: "'a::complete_space set"
c701f4085ca4 generalize constant 'complete'
huffman
parents: 31527
diff changeset
  2541
  shows "complete s \<longleftrightarrow> closed s" (is "?lhs = ?rhs")
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2542
proof
31534
0de814d2ff95 add lemma complete_imp_closed
huffman
parents: 31533
diff changeset
  2543
  assume ?lhs thus ?rhs by (rule complete_imp_closed)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2544
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2545
  assume ?rhs
31341
c13b080bfb34 remove duplicate cauchy constant
huffman
parents: 31289
diff changeset
  2546
  { fix f assume as:"\<forall>n::nat. f n \<in> s" "Cauchy f"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2547
    then obtain l where "(f ---> l) sequentially" using complete_univ[unfolded complete_def, THEN spec[where x=f]] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2548
    hence "\<exists>l\<in>s. (f ---> l) sequentially" using `?rhs`[unfolded closed_sequential_limits, THEN spec[where x=f], THEN spec[where x=l]] using as(1) by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2549
  thus ?lhs unfolding complete_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2550
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2551
31343
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  2552
lemma convergent_eq_cauchy:
31528
c701f4085ca4 generalize constant 'complete'
huffman
parents: 31527
diff changeset
  2553
  fixes s :: "nat \<Rightarrow> 'a::complete_space"
31343
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  2554
  shows "(\<exists>l. (s ---> l) sequentially) \<longleftrightarrow> Cauchy s" (is "?lhs = ?rhs")
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2555
proof
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2556
  assume ?lhs then obtain l where "(s ---> l) sequentially" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2557
  thus ?rhs using convergent_imp_cauchy by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2558
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2559
  assume ?rhs thus ?lhs using complete_univ[unfolded complete_def, THEN spec[where x=s]] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2560
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2561
31400
d671d74b2d1d generalize type of bounded
huffman
parents: 31397
diff changeset
  2562
lemma convergent_imp_bounded:
31533
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2563
  fixes s :: "nat \<Rightarrow> 'a::metric_space"
31400
d671d74b2d1d generalize type of bounded
huffman
parents: 31397
diff changeset
  2564
  shows "(s ---> l) sequentially ==> bounded (s ` (UNIV::(nat set)))"
31528
c701f4085ca4 generalize constant 'complete'
huffman
parents: 31527
diff changeset
  2565
  using convergent_imp_cauchy[of s]
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2566
  using cauchy_imp_bounded[of s]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2567
  unfolding image_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2568
  by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2569
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2570
subsection{* Total boundedness. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2571
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  2572
fun helper_1::"('a::metric_space set) \<Rightarrow> real \<Rightarrow> nat \<Rightarrow> 'a" where
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  2573
  "helper_1 s e n = (SOME y::'a. y \<in> s \<and> (\<forall>m<n. \<not> (dist (helper_1 s e m) y < e)))"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2574
declare helper_1.simps[simp del]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2575
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2576
lemma compact_imp_totally_bounded:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2577
  assumes "compact s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2578
  shows "\<forall>e>0. \<exists>k. finite k \<and> k \<subseteq> s \<and> s \<subseteq> (\<Union>((\<lambda>x. ball x e) ` k))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2579
proof(rule, rule, rule ccontr)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2580
  fix e::real assume "e>0" and assm:"\<not> (\<exists>k. finite k \<and> k \<subseteq> s \<and> s \<subseteq> \<Union>(\<lambda>x. ball x e) ` k)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2581
  def x \<equiv> "helper_1 s e"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2582
  { fix n
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2583
    have "x n \<in> s \<and> (\<forall>m<n. \<not> dist (x m) (x n) < e)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2584
    proof(induct_tac rule:nat_less_induct)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2585
      fix n  def Q \<equiv> "(\<lambda>y. y \<in> s \<and> (\<forall>m<n. \<not> dist (x m) y < e))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2586
      assume as:"\<forall>m<n. x m \<in> s \<and> (\<forall>ma<m. \<not> dist (x ma) (x m) < e)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2587
      have "\<not> s \<subseteq> (\<Union>x\<in>x ` {0..<n}. ball x e)" using assm apply simp apply(erule_tac x="x ` {0 ..< n}" in allE) using as by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2588
      then obtain z where z:"z\<in>s" "z \<notin> (\<Union>x\<in>x ` {0..<n}. ball x e)" unfolding subset_eq by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2589
      have "Q (x n)" unfolding x_def and helper_1.simps[of s e n]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2590
	apply(rule someI2[where a=z]) unfolding x_def[symmetric] and Q_def using z by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2591
      thus "x n \<in> s \<and> (\<forall>m<n. \<not> dist (x m) (x n) < e)" unfolding Q_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2592
    qed }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2593
  hence "\<forall>n::nat. x n \<in> s" and x:"\<forall>n. \<forall>m < n. \<not> (dist (x m) (x n) < e)" by blast+
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2594
  then obtain l r where "l\<in>s" and r:"subseq r" and "((x \<circ> r) ---> l) sequentially" using assms(1)[unfolded compact_def, THEN spec[where x=x]] by auto
31341
c13b080bfb34 remove duplicate cauchy constant
huffman
parents: 31289
diff changeset
  2595
  from this(3) have "Cauchy (x \<circ> r)" using convergent_imp_cauchy by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2596
  then obtain N::nat where N:"\<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist ((x \<circ> r) m) ((x \<circ> r) n) < e" unfolding cauchy_def using `e>0` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2597
  show False
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2598
    using N[THEN spec[where x=N], THEN spec[where x="N+1"]]
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2599
    using r[unfolded subseq_def, THEN spec[where x=N], THEN spec[where x="N+1"]]
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2600
    using x[THEN spec[where x="r (N+1)"], THEN spec[where x="r (N)"]] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2601
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2602
30268
5af6ed62385b fixed document;
wenzelm
parents: 30267
diff changeset
  2603
subsection{* Heine-Borel theorem (following Burkill \& Burkill vol. 2) *}
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2604
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  2605
lemma heine_borel_lemma: fixes s::"'a::metric_space set"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2606
  assumes "compact s"  "s \<subseteq> (\<Union> t)"  "\<forall>b \<in> t. open b"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2607
  shows "\<exists>e>0. \<forall>x \<in> s. \<exists>b \<in> t. ball x e \<subseteq> b"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2608
proof(rule ccontr)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2609
  assume "\<not> (\<exists>e>0. \<forall>x\<in>s. \<exists>b\<in>t. ball x e \<subseteq> b)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2610
  hence cont:"\<forall>e>0. \<exists>x\<in>s. \<forall>xa\<in>t. \<not> (ball x e \<subseteq> xa)" by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2611
  { fix n::nat
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2612
    have "1 / real (n + 1) > 0" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2613
    hence "\<exists>x. x\<in>s \<and> (\<forall>xa\<in>t. \<not> (ball x (inverse (real (n+1))) \<subseteq> xa))" using cont unfolding Bex_def by auto }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2614
  hence "\<forall>n::nat. \<exists>x. x \<in> s \<and> (\<forall>xa\<in>t. \<not> ball x (inverse (real (n + 1))) \<subseteq> xa)" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2615
  then obtain f where f:"\<forall>n::nat. f n \<in> s \<and> (\<forall>xa\<in>t. \<not> ball (f n) (inverse (real (n + 1))) \<subseteq> xa)"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2616
    using choice[of "\<lambda>n::nat. \<lambda>x. x\<in>s \<and> (\<forall>xa\<in>t. \<not> ball x (inverse (real (n + 1))) \<subseteq> xa)"] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2617
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2618
  then obtain l r where l:"l\<in>s" and r:"subseq r" and lr:"((f \<circ> r) ---> l) sequentially"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2619
    using assms(1)[unfolded compact_def, THEN spec[where x=f]] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2620
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2621
  obtain b where "l\<in>b" "b\<in>t" using assms(2) and l by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2622
  then obtain e where "e>0" and e:"\<forall>z. dist z l < e \<longrightarrow> z\<in>b"
31418
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
  2623
    using assms(3)[THEN bspec[where x=b]] unfolding open_dist by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2624
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2625
  then obtain N1 where N1:"\<forall>n\<ge>N1. dist ((f \<circ> r) n) l < e / 2"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2626
    using lr[unfolded Lim_sequentially, THEN spec[where x="e/2"]] by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2627
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2628
  obtain N2::nat where N2:"N2>0" "inverse (real N2) < e /2" using real_arch_inv[of "e/2"] and `e>0` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2629
  have N2':"inverse (real (r (N1 + N2) +1 )) < e/2"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2630
    apply(rule order_less_trans) apply(rule less_imp_inverse_less) using N2
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2631
    using subseq_bigger[OF r, of "N1 + N2"] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2632
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2633
  def x \<equiv> "(f (r (N1 + N2)))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2634
  have x:"\<not> ball x (inverse (real (r (N1 + N2) + 1))) \<subseteq> b" unfolding x_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2635
    using f[THEN spec[where x="r (N1 + N2)"]] using `b\<in>t` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2636
  have "\<exists>y\<in>ball x (inverse (real (r (N1 + N2) + 1))). y\<notin>b" apply(rule ccontr) using x by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2637
  then obtain y where y:"y \<in> ball x (inverse (real (r (N1 + N2) + 1)))" "y \<notin> b" by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2638
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2639
  have "dist x l < e/2" using N1 unfolding x_def o_def by auto
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  2640
  hence "dist y l < e" using y N2' using dist_triangle[of y l x]by (auto simp add:dist_commute)
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2641
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2642
  thus False using e and `y\<notin>b` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2643
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2644
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2645
lemma compact_imp_heine_borel: "compact s ==> (\<forall>f. (\<forall>t \<in> f. open t) \<and> s \<subseteq> (\<Union> f)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2646
               \<longrightarrow> (\<exists>f'. f' \<subseteq> f \<and> finite f' \<and> s \<subseteq> (\<Union> f')))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2647
proof clarify
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2648
  fix f assume "compact s" " \<forall>t\<in>f. open t" "s \<subseteq> \<Union>f"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2649
  then obtain e::real where "e>0" and "\<forall>x\<in>s. \<exists>b\<in>f. ball x e \<subseteq> b" using heine_borel_lemma[of s f] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2650
  hence "\<forall>x\<in>s. \<exists>b. b\<in>f \<and> ball x e \<subseteq> b" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2651
  hence "\<exists>bb. \<forall>x\<in>s. bb x \<in>f \<and> ball x e \<subseteq> bb x" using bchoice[of s "\<lambda>x b. b\<in>f \<and> ball x e \<subseteq> b"] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2652
  then obtain  bb where bb:"\<forall>x\<in>s. (bb x) \<in> f \<and> ball x e \<subseteq> (bb x)" by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2653
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2654
  from `compact s` have  "\<exists> k. finite k \<and> k \<subseteq> s \<and> s \<subseteq> \<Union>(\<lambda>x. ball x e) ` k" using compact_imp_totally_bounded[of s] `e>0` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2655
  then obtain k where k:"finite k" "k \<subseteq> s" "s \<subseteq> \<Union>(\<lambda>x. ball x e) ` k" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2656
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2657
  have "finite (bb ` k)" using k(1) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2658
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2659
  { fix x assume "x\<in>s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2660
    hence "x\<in>\<Union>(\<lambda>x. ball x e) ` k" using k(3)  unfolding subset_eq by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2661
    hence "\<exists>X\<in>bb ` k. x \<in> X" using bb k(2) by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2662
    hence "x \<in> \<Union>(bb ` k)" using  Union_iff[of x "bb ` k"] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2663
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2664
  ultimately show "\<exists>f'\<subseteq>f. finite f' \<and> s \<subseteq> \<Union>f'" using bb k(2) by (rule_tac x="bb ` k" in exI) auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2665
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2666
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2667
subsection{* Bolzano-Weierstrass property. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2668
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2669
lemma heine_borel_imp_bolzano_weierstrass:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2670
  assumes "\<forall>f. (\<forall>t \<in> f. open t) \<and> s \<subseteq> (\<Union> f) --> (\<exists>f'. f' \<subseteq> f \<and> finite f' \<and> s \<subseteq> (\<Union> f'))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2671
          "infinite t"  "t \<subseteq> s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2672
  shows "\<exists>x \<in> s. x islimpt t"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2673
proof(rule ccontr)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2674
  assume "\<not> (\<exists>x \<in> s. x islimpt t)"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2675
  then obtain f where f:"\<forall>x\<in>s. x \<in> f x \<and> open (f x) \<and> (\<forall>y\<in>t. y \<in> f x \<longrightarrow> y = x)" unfolding islimpt_def
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2676
    using bchoice[of s "\<lambda> x T. x \<in> T \<and> open T \<and> (\<forall>y\<in>t. y \<in> T \<longrightarrow> y = x)"] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2677
  obtain g where g:"g\<subseteq>{t. \<exists>x. x \<in> s \<and> t = f x}" "finite g" "s \<subseteq> \<Union>g"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2678
    using assms(1)[THEN spec[where x="{t. \<exists>x. x\<in>s \<and> t = f x}"]] using f by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2679
  from g(1,3) have g':"\<forall>x\<in>g. \<exists>xa \<in> s. x = f xa" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2680
  { fix x y assume "x\<in>t" "y\<in>t" "f x = f y"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2681
    hence "x \<in> f x"  "y \<in> f x \<longrightarrow> y = x" using f[THEN bspec[where x=x]] and `t\<subseteq>s` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2682
    hence "x = y" using `f x = f y` and f[THEN bspec[where x=y]] and `y\<in>t` and `t\<subseteq>s` by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2683
  hence "infinite (f ` t)" using assms(2) using finite_imageD[unfolded inj_on_def, of f t] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2684
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2685
  { fix x assume "x\<in>t" "f x \<notin> g"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2686
    from g(3) assms(3) `x\<in>t` obtain h where "h\<in>g" and "x\<in>h" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2687
    then obtain y where "y\<in>s" "h = f y" using g'[THEN bspec[where x=h]] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2688
    hence "y = x" using f[THEN bspec[where x=y]] and `x\<in>t` and `x\<in>h`[unfolded `h = f y`] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2689
    hence False using `f x \<notin> g` `h\<in>g` unfolding `h = f y` by auto  }
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2690
  hence "f ` t \<subseteq> g" by auto
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2691
  ultimately show False using g(2) using finite_subset by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2692
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2693
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2694
subsection{* Complete the chain of compactness variants. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2695
31533
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2696
primrec helper_2::"(real \<Rightarrow> 'a::metric_space) \<Rightarrow> nat \<Rightarrow> 'a" where
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2697
  "helper_2 beyond 0 = beyond 0" |
31804
627d142fce19 arbitrary farewell
haftmann
parents: 31658
diff changeset
  2698
  "helper_2 beyond (Suc n) = beyond (dist undefined (helper_2 beyond n) + 1 )"
31533
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2699
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2700
lemma bolzano_weierstrass_imp_bounded: fixes s::"'a::metric_space set"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2701
  assumes "\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2702
  shows "bounded s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2703
proof(rule ccontr)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2704
  assume "\<not> bounded s"
31804
627d142fce19 arbitrary farewell
haftmann
parents: 31658
diff changeset
  2705
  then obtain beyond where "\<forall>a. beyond a \<in>s \<and> \<not> dist undefined (beyond a) \<le> a"
627d142fce19 arbitrary farewell
haftmann
parents: 31658
diff changeset
  2706
    unfolding bounded_any_center [where a=undefined]
627d142fce19 arbitrary farewell
haftmann
parents: 31658
diff changeset
  2707
    apply simp using choice[of "\<lambda>a x. x\<in>s \<and> \<not> dist undefined x \<le> a"] by auto
627d142fce19 arbitrary farewell
haftmann
parents: 31658
diff changeset
  2708
  hence beyond:"\<And>a. beyond a \<in>s" "\<And>a. dist undefined (beyond a) > a"
31533
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2709
    unfolding linorder_not_le by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2710
  def x \<equiv> "helper_2 beyond"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2711
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2712
  { fix m n ::nat assume "m<n"
31804
627d142fce19 arbitrary farewell
haftmann
parents: 31658
diff changeset
  2713
    hence "dist undefined (x m) + 1 < dist undefined (x n)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2714
    proof(induct n)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2715
      case 0 thus ?case by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2716
    next
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2717
      case (Suc n)
31804
627d142fce19 arbitrary farewell
haftmann
parents: 31658
diff changeset
  2718
      have *:"dist undefined (x n) + 1 < dist undefined (x (Suc n))"
31533
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2719
        unfolding x_def and helper_2.simps
31804
627d142fce19 arbitrary farewell
haftmann
parents: 31658
diff changeset
  2720
	using beyond(2)[of "dist undefined (helper_2 beyond n) + 1"] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2721
      thus ?case proof(cases "m < n")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2722
	case True thus ?thesis using Suc and * by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2723
      next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2724
	case False hence "m = n" using Suc(2) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2725
	thus ?thesis using * by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2726
      qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2727
    qed  } note * = this
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2728
  { fix m n ::nat assume "m\<noteq>n"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2729
    have "1 < dist (x m) (x n)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2730
    proof(cases "m<n")
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2731
      case True
31804
627d142fce19 arbitrary farewell
haftmann
parents: 31658
diff changeset
  2732
      hence "1 < dist undefined (x n) - dist undefined (x m)" using *[of m n] by auto
627d142fce19 arbitrary farewell
haftmann
parents: 31658
diff changeset
  2733
      thus ?thesis using dist_triangle [of undefined "x n" "x m"] by arith
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2734
    next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2735
      case False hence "n<m" using `m\<noteq>n` by auto
31804
627d142fce19 arbitrary farewell
haftmann
parents: 31658
diff changeset
  2736
      hence "1 < dist undefined (x m) - dist undefined (x n)" using *[of n m] by auto
627d142fce19 arbitrary farewell
haftmann
parents: 31658
diff changeset
  2737
      thus ?thesis using dist_triangle2 [of undefined "x m" "x n"] by arith
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2738
    qed  } note ** = this
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2739
  { fix a b assume "x a = x b" "a \<noteq> b"
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  2740
    hence False using **[of a b] by auto  }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2741
  hence "inj x" unfolding inj_on_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2742
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2743
  { fix n::nat
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2744
    have "x n \<in> s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2745
    proof(cases "n = 0")
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2746
      case True thus ?thesis unfolding x_def using beyond by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2747
    next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2748
      case False then obtain z where "n = Suc z" using not0_implies_Suc by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2749
      thus ?thesis unfolding x_def using beyond by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2750
    qed  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2751
  ultimately have "infinite (range x) \<and> range x \<subseteq> s" unfolding x_def using range_inj_infinite[of "helper_2 beyond"] using beyond(1) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2752
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2753
  then obtain l where "l\<in>s" and l:"l islimpt range x" using assms[THEN spec[where x="range x"]] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2754
  then obtain y where "x y \<noteq> l" and y:"dist (x y) l < 1/2" unfolding islimpt_approachable apply(erule_tac x="1/2" in allE) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2755
  then obtain z where "x z \<noteq> l" and z:"dist (x z) l < dist (x y) l" using l[unfolded islimpt_approachable, THEN spec[where x="dist (x y) l"]]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2756
    unfolding dist_nz by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2757
  show False using y and z and dist_triangle_half_l[of "x y" l 1 "x z"] and **[of y z] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2758
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2759
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2760
lemma sequence_infinite_lemma:
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  2761
  fixes l :: "'a::metric_space" (* TODO: generalize *)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2762
  assumes "\<forall>n::nat. (f n  \<noteq> l)"  "(f ---> l) sequentially"
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  2763
  shows "infinite {y. (\<exists> n. y = f n)}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2764
proof(rule ccontr)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2765
  let ?A = "(\<lambda>x. dist x l) ` {y. \<exists>n. y = f n}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2766
  assume "\<not> infinite {y. \<exists>n. y = f n}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2767
  hence **:"finite ?A" "?A \<noteq> {}" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2768
  obtain k where k:"dist (f k) l = Min ?A" using Min_in[OF **] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2769
  have "0 < Min ?A" using assms(1) unfolding dist_nz unfolding Min_gr_iff[OF **] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2770
  then obtain N where "dist (f N) l < Min ?A" using assms(2)[unfolded Lim_sequentially, THEN spec[where x="Min ?A"]] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2771
  moreover have "dist (f N) l \<in> ?A" by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2772
  ultimately show False using Min_le[OF **(1), of "dist (f N) l"] by auto
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2773
qed
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2774
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2775
lemma sequence_unique_limpt:
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  2776
  fixes l :: "'a::metric_space" (* TODO: generalize *)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2777
  assumes "\<forall>n::nat. (f n \<noteq> l)"  "(f ---> l) sequentially"  "l' islimpt {y.  (\<exists>n. y = f n)}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2778
  shows "l' = l"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2779
proof(rule ccontr)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2780
  def e \<equiv> "dist l' l"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2781
  assume "l' \<noteq> l" hence "e>0" unfolding dist_nz e_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2782
  then obtain N::nat where N:"\<forall>n\<ge>N. dist (f n) l < e / 2"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2783
    using assms(2)[unfolded Lim_sequentially, THEN spec[where x="e/2"]] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2784
  def d \<equiv> "Min (insert (e/2) ((\<lambda>n. if dist (f n) l' = 0 then e/2 else dist (f n) l') ` {0 .. N}))"
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  2785
  have "d>0" using `e>0` unfolding d_def e_def using zero_le_dist[of _ l', unfolded order_le_less] by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2786
  obtain k where k:"f k \<noteq> l'"  "dist (f k) l' < d" using `d>0` and assms(3)[unfolded islimpt_approachable, THEN spec[where x="d"]] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2787
  have "k\<ge>N" using k(1)[unfolded dist_nz] using k(2)[unfolded d_def]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2788
    by force
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2789
  hence "dist l' l < e" using N[THEN spec[where x=k]] using k(2)[unfolded d_def] and dist_triangle_half_r[of "f k" l' e l] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2790
  thus False unfolding e_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2791
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2792
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2793
lemma bolzano_weierstrass_imp_closed:
31420
4c22ef11078b generalize type of islimpt
huffman
parents: 31418
diff changeset
  2794
  fixes s :: "'a::metric_space set" (* TODO: can this be generalized? *)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2795
  assumes "\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2796
  shows "closed s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2797
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2798
  { fix x l assume as: "\<forall>n::nat. x n \<in> s" "(x ---> l) sequentially"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2799
    hence "l \<in> s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2800
    proof(cases "\<forall>n. x n \<noteq> l")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2801
      case False thus "l\<in>s" using as(1) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2802
    next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2803
      case True note cas = this
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2804
      with as(2) have "infinite {y. \<exists>n. y = x n}" using sequence_infinite_lemma[of x l] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2805
      then obtain l' where "l'\<in>s" "l' islimpt {y. \<exists>n. y = x n}" using assms[THEN spec[where x="{y. \<exists>n. y = x n}"]] as(1) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2806
      thus "l\<in>s" using sequence_unique_limpt[of x l l'] using as cas by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2807
    qed  }
31534
0de814d2ff95 add lemma complete_imp_closed
huffman
parents: 31533
diff changeset
  2808
  thus ?thesis unfolding closed_sequential_limits by fast
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2809
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2810
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2811
text{* Hence express everything as an equivalence.   *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2812
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  2813
lemma compact_eq_heine_borel:
31537
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2814
  fixes s :: "'a::heine_borel set"
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  2815
  shows "compact s \<longleftrightarrow>
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2816
           (\<forall>f. (\<forall>t \<in> f. open t) \<and> s \<subseteq> (\<Union> f)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2817
               --> (\<exists>f'. f' \<subseteq> f \<and> finite f' \<and> s \<subseteq> (\<Union> f')))" (is "?lhs = ?rhs")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2818
proof
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2819
  assume ?lhs thus ?rhs using compact_imp_heine_borel[of s] by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2820
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2821
  assume ?rhs
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  2822
  hence "\<forall>t. infinite t \<and> t \<subseteq> s \<longrightarrow> (\<exists>x\<in>s. x islimpt t)"
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  2823
    by (blast intro: heine_borel_imp_bolzano_weierstrass[of s])
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2824
  thus ?lhs using bolzano_weierstrass_imp_bounded[of s] bolzano_weierstrass_imp_closed[of s] bounded_closed_imp_compact[of s] by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2825
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2826
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2827
lemma compact_eq_bolzano_weierstrass:
31537
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2828
  fixes s :: "'a::heine_borel set"
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  2829
  shows "compact s \<longleftrightarrow> (\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t))" (is "?lhs = ?rhs")
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2830
proof
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2831
  assume ?lhs thus ?rhs unfolding compact_eq_heine_borel using heine_borel_imp_bolzano_weierstrass[of s] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2832
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2833
  assume ?rhs thus ?lhs using bolzano_weierstrass_imp_bounded bolzano_weierstrass_imp_closed bounded_closed_imp_compact by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2834
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2835
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2836
lemma compact_eq_bounded_closed:
31537
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2837
  fixes s :: "'a::heine_borel set"
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  2838
  shows "compact s \<longleftrightarrow> bounded s \<and> closed s"  (is "?lhs = ?rhs")
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2839
proof
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2840
  assume ?lhs thus ?rhs unfolding compact_eq_bolzano_weierstrass using bolzano_weierstrass_imp_bounded bolzano_weierstrass_imp_closed by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2841
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2842
  assume ?rhs thus ?lhs using bounded_closed_imp_compact by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2843
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2844
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2845
lemma compact_imp_bounded:
31533
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  2846
  fixes s :: "'a::metric_space set"
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  2847
  shows "compact s ==> bounded s"
31532
43e8d4bfde26 generalize lemmas compact_imp_bounded, compact_imp_closed
huffman
parents: 31531
diff changeset
  2848
proof -
43e8d4bfde26 generalize lemmas compact_imp_bounded, compact_imp_closed
huffman
parents: 31531
diff changeset
  2849
  assume "compact s"
43e8d4bfde26 generalize lemmas compact_imp_bounded, compact_imp_closed
huffman
parents: 31531
diff changeset
  2850
  hence "\<forall>f. (\<forall>t\<in>f. open t) \<and> s \<subseteq> \<Union>f \<longrightarrow> (\<exists>f'\<subseteq>f. finite f' \<and> s \<subseteq> \<Union>f')"
43e8d4bfde26 generalize lemmas compact_imp_bounded, compact_imp_closed
huffman
parents: 31531
diff changeset
  2851
    by (rule compact_imp_heine_borel)
43e8d4bfde26 generalize lemmas compact_imp_bounded, compact_imp_closed
huffman
parents: 31531
diff changeset
  2852
  hence "\<forall>t. infinite t \<and> t \<subseteq> s \<longrightarrow> (\<exists>x \<in> s. x islimpt t)"
43e8d4bfde26 generalize lemmas compact_imp_bounded, compact_imp_closed
huffman
parents: 31531
diff changeset
  2853
    using heine_borel_imp_bolzano_weierstrass[of s] by auto
43e8d4bfde26 generalize lemmas compact_imp_bounded, compact_imp_closed
huffman
parents: 31531
diff changeset
  2854
  thus "bounded s"
43e8d4bfde26 generalize lemmas compact_imp_bounded, compact_imp_closed
huffman
parents: 31531
diff changeset
  2855
    by (rule bolzano_weierstrass_imp_bounded)
43e8d4bfde26 generalize lemmas compact_imp_bounded, compact_imp_closed
huffman
parents: 31531
diff changeset
  2856
qed
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2857
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2858
lemma compact_imp_closed:
31532
43e8d4bfde26 generalize lemmas compact_imp_bounded, compact_imp_closed
huffman
parents: 31531
diff changeset
  2859
  fixes s :: "'a::metric_space set"
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  2860
  shows "compact s ==> closed s"
31532
43e8d4bfde26 generalize lemmas compact_imp_bounded, compact_imp_closed
huffman
parents: 31531
diff changeset
  2861
proof -
43e8d4bfde26 generalize lemmas compact_imp_bounded, compact_imp_closed
huffman
parents: 31531
diff changeset
  2862
  assume "compact s"
43e8d4bfde26 generalize lemmas compact_imp_bounded, compact_imp_closed
huffman
parents: 31531
diff changeset
  2863
  hence "\<forall>f. (\<forall>t\<in>f. open t) \<and> s \<subseteq> \<Union>f \<longrightarrow> (\<exists>f'\<subseteq>f. finite f' \<and> s \<subseteq> \<Union>f')"
43e8d4bfde26 generalize lemmas compact_imp_bounded, compact_imp_closed
huffman
parents: 31531
diff changeset
  2864
    by (rule compact_imp_heine_borel)
43e8d4bfde26 generalize lemmas compact_imp_bounded, compact_imp_closed
huffman
parents: 31531
diff changeset
  2865
  hence "\<forall>t. infinite t \<and> t \<subseteq> s \<longrightarrow> (\<exists>x \<in> s. x islimpt t)"
43e8d4bfde26 generalize lemmas compact_imp_bounded, compact_imp_closed
huffman
parents: 31531
diff changeset
  2866
    using heine_borel_imp_bolzano_weierstrass[of s] by auto
43e8d4bfde26 generalize lemmas compact_imp_bounded, compact_imp_closed
huffman
parents: 31531
diff changeset
  2867
  thus "closed s"
43e8d4bfde26 generalize lemmas compact_imp_bounded, compact_imp_closed
huffman
parents: 31531
diff changeset
  2868
    by (rule bolzano_weierstrass_imp_closed)
43e8d4bfde26 generalize lemmas compact_imp_bounded, compact_imp_closed
huffman
parents: 31531
diff changeset
  2869
qed
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2870
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2871
text{* In particular, some common special cases. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2872
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2873
lemma compact_empty[simp]:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2874
 "compact {}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2875
  unfolding compact_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2876
  by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2877
31537
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2878
(* TODO: can any of the next 3 lemmas be generalized to metric spaces? *)
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2879
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2880
  (* FIXME : Rename *)
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2881
lemma compact_union[intro]:
31537
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2882
  fixes s t :: "'a::heine_borel set"
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  2883
  shows "compact s \<Longrightarrow> compact t ==> compact (s \<union> t)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2884
  unfolding compact_eq_bounded_closed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2885
  using bounded_Un[of s t]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2886
  using closed_Un[of s t]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2887
  by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2888
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2889
lemma compact_inter[intro]:
31537
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2890
  fixes s t :: "'a::heine_borel set"
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  2891
  shows "compact s \<Longrightarrow> compact t ==> compact (s \<inter> t)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2892
  unfolding compact_eq_bounded_closed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2893
  using bounded_Int[of s t]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2894
  using closed_Int[of s t]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2895
  by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2896
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2897
lemma compact_inter_closed[intro]:
31537
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2898
  fixes s t :: "'a::heine_borel set"
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  2899
  shows "compact s \<Longrightarrow> closed t ==> compact (s \<inter> t)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2900
  unfolding compact_eq_bounded_closed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2901
  using closed_Int[of s t]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2902
  using bounded_subset[of "s \<inter> t" s]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2903
  by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2904
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2905
lemma closed_inter_compact[intro]:
31537
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2906
  fixes s t :: "'a::heine_borel set"
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  2907
  shows "closed s \<Longrightarrow> compact t ==> compact (s \<inter> t)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2908
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2909
  assume "closed s" "compact t"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2910
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2911
  have "s \<inter> t = t \<inter> s" by auto ultimately
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2912
  show ?thesis
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2913
    using compact_inter_closed[of t s]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2914
    by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2915
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2916
31418
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
  2917
lemma closed_sing [simp]:
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
  2918
  fixes a :: "'a::metric_space"
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
  2919
  shows "closed {a}"
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
  2920
  apply (clarsimp simp add: closed_def open_dist)
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  2921
  apply (rule ccontr)
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  2922
  apply (drule_tac x="dist x a" in spec)
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  2923
  apply (simp add: dist_nz dist_commute)
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  2924
  done
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2925
31537
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2926
lemma finite_imp_closed:
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2927
  fixes s :: "'a::metric_space set"
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2928
  shows "finite s ==> closed s"
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2929
proof (induct set: finite)
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2930
  case empty show "closed {}" by simp
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2931
next
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2932
  case (insert x F)
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2933
  hence "closed ({x} \<union> F)" by (simp only: closed_Un closed_sing)
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2934
  thus "closed (insert x F)" by simp
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2935
qed
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2936
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2937
lemma finite_imp_compact:
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2938
  fixes s :: "'a::heine_borel set"
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2939
  shows "finite s ==> compact s"
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2940
  unfolding compact_eq_bounded_closed
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2941
  using finite_imp_closed finite_imp_bounded
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2942
  by blast
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2943
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2944
lemma compact_sing [simp]: "compact {a}"
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  2945
  unfolding compact_def o_def subseq_def
31537
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2946
  by (auto simp add: tendsto_const)
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2947
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2948
lemma compact_cball[simp]:
31537
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2949
  fixes x :: "'a::heine_borel"
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  2950
  shows "compact(cball x e)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2951
  using compact_eq_bounded_closed bounded_cball closed_cball
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2952
  by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2953
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2954
lemma compact_frontier_bounded[intro]:
31537
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2955
  fixes s :: "'a::heine_borel set"
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  2956
  shows "bounded s ==> compact(frontier s)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2957
  unfolding frontier_def
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2958
  using compact_eq_bounded_closed
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2959
  by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2960
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2961
lemma compact_frontier[intro]:
31537
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2962
  fixes s :: "'a::heine_borel set"
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  2963
  shows "compact s ==> compact (frontier s)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2964
  using compact_eq_bounded_closed compact_frontier_bounded
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2965
  by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2966
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2967
lemma frontier_subset_compact:
31537
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2968
  fixes s :: "'a::heine_borel set"
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  2969
  shows "compact s ==> frontier s \<subseteq> s"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2970
  using frontier_subset_closed compact_eq_bounded_closed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2971
  by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2972
31418
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
  2973
lemma open_delete:
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
  2974
  fixes s :: "'a::metric_space set"
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
  2975
  shows "open s ==> open(s - {x})"
31490
c350f3ad6b0d move definitions of open, closed to RealVector.thy
huffman
parents: 31489
diff changeset
  2976
  using open_Diff[of s "{x}"] closed_sing
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2977
  by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2978
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2979
text{* Finite intersection property. I could make it an equivalence in fact. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2980
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2981
lemma compact_imp_fip:
31537
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  2982
  fixes s :: "'a::heine_borel set"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2983
  assumes "compact s"  "\<forall>t \<in> f. closed t"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2984
        "\<forall>f'. finite f' \<and> f' \<subseteq> f --> (s \<inter> (\<Inter> f') \<noteq> {})"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2985
  shows "s \<inter> (\<Inter> f) \<noteq> {}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2986
proof
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2987
  assume as:"s \<inter> (\<Inter> f) = {}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2988
  hence "s \<subseteq> \<Union>op - UNIV ` f" by auto
31490
c350f3ad6b0d move definitions of open, closed to RealVector.thy
huffman
parents: 31489
diff changeset
  2989
  moreover have "Ball (op - UNIV ` f) open" using open_Diff closed_Diff using assms(2) by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2990
  ultimately obtain f' where f':"f' \<subseteq> op - UNIV ` f"  "finite f'"  "s \<subseteq> \<Union>f'" using assms(1)[unfolded compact_eq_heine_borel, THEN spec[where x="(\<lambda>t. UNIV - t) ` f"]] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2991
  hence "finite (op - UNIV ` f') \<and> op - UNIV ` f' \<subseteq> f" by(auto simp add: Diff_Diff_Int)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2992
  hence "s \<inter> \<Inter>op - UNIV ` f' \<noteq> {}" using assms(3)[THEN spec[where x="op - UNIV ` f'"]] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2993
  thus False using f'(3) unfolding subset_eq and Union_iff by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2994
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2995
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2996
subsection{* Bounded closed nest property (proof does not use Heine-Borel).            *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2997
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  2998
lemma bounded_closed_nest:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  2999
  assumes "\<forall>n. closed(s n)" "\<forall>n. (s n \<noteq> {})"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3000
  "(\<forall>m n. m \<le> n --> s n \<subseteq> s m)"  "bounded(s 0)"
31537
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  3001
  shows "\<exists>a::'a::heine_borel. \<forall>n::nat. a \<in> s(n)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3002
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3003
  from assms(2) obtain x where x:"\<forall>n::nat. x n \<in> s n" using choice[of "\<lambda>n x. x\<in> s n"] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3004
  from assms(4,1) have *:"compact (s 0)" using bounded_closed_imp_compact[of "s 0"] by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3005
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  3006
  then obtain l r where lr:"l\<in>s 0" "subseq r" "((x \<circ> r) ---> l) sequentially"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3007
    unfolding compact_def apply(erule_tac x=x in allE)  using x using assms(3) by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3008
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3009
  { fix n::nat
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3010
    { fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3011
      with lr(3) obtain N where N:"\<forall>m\<ge>N. dist ((x \<circ> r) m) l < e" unfolding Lim_sequentially by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3012
      hence "dist ((x \<circ> r) (max N n)) l < e" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3013
      moreover
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  3014
      have "r (max N n) \<ge> n" using lr(2) using subseq_bigger[of r "max N n"] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3015
      hence "(x \<circ> r) (max N n) \<in> s n"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3016
	using x apply(erule_tac x=n in allE)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3017
	using x apply(erule_tac x="r (max N n)" in allE)
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3018
	using assms(3) apply(erule_tac x=n in allE)apply( erule_tac x="r (max N n)" in allE) by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3019
      ultimately have "\<exists>y\<in>s n. dist y l < e" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3020
    }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3021
    hence "l \<in> s n" using closed_approachable[of "s n" l] assms(1) by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3022
  }
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3023
  thus ?thesis by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3024
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3025
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3026
text{* Decreasing case does not even need compactness, just completeness.        *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3027
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3028
lemma decreasing_closed_nest:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3029
  assumes "\<forall>n. closed(s n)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3030
          "\<forall>n. (s n \<noteq> {})"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3031
          "\<forall>m n. m \<le> n --> s n \<subseteq> s m"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3032
          "\<forall>e>0. \<exists>n. \<forall>x \<in> (s n). \<forall> y \<in> (s n). dist x y < e"
31537
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  3033
  shows "\<exists>a::'a::heine_borel. \<forall>n::nat. a \<in> s n"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3034
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3035
  have "\<forall>n. \<exists> x. x\<in>s n" using assms(2) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3036
  hence "\<exists>t. \<forall>n. t n \<in> s n" using choice[of "\<lambda> n x. x \<in> s n"] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3037
  then obtain t where t: "\<forall>n. t n \<in> s n" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3038
  { fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3039
    then obtain N where N:"\<forall>x\<in>s N. \<forall>y\<in>s N. dist x y < e" using assms(4) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3040
    { fix m n ::nat assume "N \<le> m \<and> N \<le> n"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3041
      hence "t m \<in> s N" "t n \<in> s N" using assms(3) t unfolding  subset_eq t by blast+
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3042
      hence "dist (t m) (t n) < e" using N by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3043
    }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3044
    hence "\<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (t m) (t n) < e" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3045
  }
31341
c13b080bfb34 remove duplicate cauchy constant
huffman
parents: 31289
diff changeset
  3046
  hence  "Cauchy t" unfolding cauchy_def by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3047
  then obtain l where l:"(t ---> l) sequentially" using complete_univ unfolding complete_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3048
  { fix n::nat
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3049
    { fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3050
      then obtain N::nat where N:"\<forall>n\<ge>N. dist (t n) l < e" using l[unfolded Lim_sequentially] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3051
      have "t (max n N) \<in> s n" using assms(3) unfolding subset_eq apply(erule_tac x=n in allE) apply (erule_tac x="max n N" in allE) using t by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3052
      hence "\<exists>y\<in>s n. dist y l < e" apply(rule_tac x="t (max n N)" in bexI) using N by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3053
    }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3054
    hence "l \<in> s n" using closed_approachable[of "s n" l] assms(1) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3055
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3056
  then show ?thesis by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3057
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3058
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3059
text{* Strengthen it to the intersection actually being a singleton.             *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3060
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3061
lemma decreasing_closed_nest_sing:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3062
  assumes "\<forall>n. closed(s n)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3063
          "\<forall>n. s n \<noteq> {}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3064
          "\<forall>m n. m \<le> n --> s n \<subseteq> s m"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3065
          "\<forall>e>0. \<exists>n. \<forall>x \<in> (s n). \<forall> y\<in>(s n). dist x y < e"
31537
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  3066
  shows "\<exists>a::'a::heine_borel. \<Inter> {t. (\<exists>n::nat. t = s n)} = {a}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3067
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3068
  obtain a where a:"\<forall>n. a \<in> s n" using decreasing_closed_nest[of s] using assms by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3069
  { fix b assume b:"b \<in> \<Inter>{t. \<exists>n. t = s n}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3070
    { fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3071
      hence "dist a b < e" using assms(4 )using b using a by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3072
    }
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3073
    hence "dist a b = 0" by (metis dist_eq_0_iff dist_nz real_less_def)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3074
  }
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3075
  with a have "\<Inter>{t. \<exists>n. t = s n} = {a}"  by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3076
  thus ?thesis by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3077
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3078
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3079
text{* Cauchy-type criteria for uniform convergence. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3080
31537
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  3081
lemma uniformly_convergent_eq_cauchy: fixes s::"nat \<Rightarrow> 'b \<Rightarrow> 'a::heine_borel" shows
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3082
 "(\<exists>l. \<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> P x --> dist(s n x)(l x) < e) \<longleftrightarrow>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3083
  (\<forall>e>0. \<exists>N. \<forall>m n x. N \<le> m \<and> N \<le> n \<and> P x  --> dist (s m x) (s n x) < e)" (is "?lhs = ?rhs")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3084
proof(rule)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3085
  assume ?lhs
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3086
  then obtain l where l:"\<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> P x \<longrightarrow> dist (s n x) (l x) < e" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3087
  { fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3088
    then obtain N::nat where N:"\<forall>n x. N \<le> n \<and> P x \<longrightarrow> dist (s n x) (l x) < e / 2" using l[THEN spec[where x="e/2"]] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3089
    { fix n m::nat and x::"'b" assume "N \<le> m \<and> N \<le> n \<and> P x"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3090
      hence "dist (s m x) (s n x) < e"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3091
	using N[THEN spec[where x=m], THEN spec[where x=x]]
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3092
	using N[THEN spec[where x=n], THEN spec[where x=x]]
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3093
	using dist_triangle_half_l[of "s m x" "l x" e "s n x"] by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3094
    hence "\<exists>N. \<forall>m n x. N \<le> m \<and> N \<le> n \<and> P x  --> dist (s m x) (s n x) < e"  by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3095
  thus ?rhs by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3096
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3097
  assume ?rhs
31341
c13b080bfb34 remove duplicate cauchy constant
huffman
parents: 31289
diff changeset
  3098
  hence "\<forall>x. P x \<longrightarrow> Cauchy (\<lambda>n. s n x)" unfolding cauchy_def apply auto by (erule_tac x=e in allE)auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3099
  then obtain l where l:"\<forall>x. P x \<longrightarrow> ((\<lambda>n. s n x) ---> l x) sequentially" unfolding convergent_eq_cauchy[THEN sym]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3100
    using choice[of "\<lambda>x l. P x \<longrightarrow> ((\<lambda>n. s n x) ---> l) sequentially"] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3101
  { fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3102
    then obtain N where N:"\<forall>m n x. N \<le> m \<and> N \<le> n \<and> P x \<longrightarrow> dist (s m x) (s n x) < e/2"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3103
      using `?rhs`[THEN spec[where x="e/2"]] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3104
    { fix x assume "P x"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3105
      then obtain M where M:"\<forall>n\<ge>M. dist (s n x) (l x) < e/2"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3106
	using l[THEN spec[where x=x], unfolded Lim_sequentially] using `e>0` by(auto elim!: allE[where x="e/2"])
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3107
      fix n::nat assume "n\<ge>N"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3108
      hence "dist(s n x)(l x) < e"  using `P x`and N[THEN spec[where x=n], THEN spec[where x="N+M"], THEN spec[where x=x]]
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3109
	using M[THEN spec[where x="N+M"]] and dist_triangle_half_l[of "s n x" "s (N+M) x" e "l x"] by (auto simp add: dist_commute)  }
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3110
    hence "\<exists>N. \<forall>n x. N \<le> n \<and> P x \<longrightarrow> dist(s n x)(l x) < e" by auto }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3111
  thus ?lhs by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3112
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3113
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3114
lemma uniformly_cauchy_imp_uniformly_convergent:
31537
feec2711da4e instance heine_borel < complete_space; generalize many lemmas to class heine_borel
huffman
parents: 31536
diff changeset
  3115
  fixes s :: "nat \<Rightarrow> 'a \<Rightarrow> 'b::heine_borel"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3116
  assumes "\<forall>e>0.\<exists>N. \<forall>m (n::nat) x. N \<le> m \<and> N \<le> n \<and> P x --> dist(s m x)(s n x) < e"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3117
          "\<forall>x. P x --> (\<forall>e>0. \<exists>N. \<forall>n. N \<le> n --> dist(s n x)(l x) < e)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3118
  shows "\<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> P x --> dist(s n x)(l x) < e"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3119
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3120
  obtain l' where l:"\<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> P x \<longrightarrow> dist (s n x) (l' x) < e"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3121
    using assms(1) unfolding uniformly_convergent_eq_cauchy[THEN sym] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3122
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3123
  { fix x assume "P x"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3124
    hence "l x = l' x" using Lim_unique[OF trivial_limit_sequentially, of "\<lambda>n. s n x" "l x" "l' x"]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3125
      using l and assms(2) unfolding Lim_sequentially by blast  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3126
  ultimately show ?thesis by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3127
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3128
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3129
subsection{* Define continuity over a net to take in restrictions of the set. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3130
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  3131
definition
31655
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3132
  continuous :: "'a::t2_space net \<Rightarrow> ('a \<Rightarrow> 'b::topological_space) \<Rightarrow> bool" where
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  3133
  "continuous net f \<longleftrightarrow> (f ---> f(netlimit net)) net"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3134
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3135
lemma continuous_trivial_limit:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3136
 "trivial_limit net ==> continuous net f"
31655
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3137
  unfolding continuous_def tendsto_def trivial_limit_eq by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3138
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3139
lemma continuous_within: "continuous (at x within s) f \<longleftrightarrow> (f ---> f(x)) (at x within s)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3140
  unfolding continuous_def
31655
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3141
  unfolding tendsto_def
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3142
  using netlimit_within[of x s]
31348
738eb25e1dd8 more abstract properties of eventually
huffman
parents: 31347
diff changeset
  3143
  by (cases "trivial_limit (at x within s)") (auto simp add: trivial_limit_eventually)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3144
31346
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
  3145
lemma continuous_at: "continuous (at x) f \<longleftrightarrow> (f ---> f(x)) (at x)"
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
  3146
  using continuous_within [of x UNIV f] by (simp add: within_UNIV)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3147
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3148
lemma continuous_at_within:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3149
  assumes "continuous (at x) f"  shows "continuous (at x within s) f"
31655
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3150
  using assms unfolding continuous_at continuous_within
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3151
  by (rule Lim_at_within)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3152
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3153
text{* Derive the epsilon-delta forms, which we often use as "definitions" *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3154
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3155
lemma continuous_within_eps_delta:
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3156
  "continuous (at x within s) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. \<forall>x'\<in> s.  dist x' x < d --> dist (f x') (f x) < e)"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3157
  unfolding continuous_within and Lim_within
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3158
  apply auto unfolding dist_nz[THEN sym] apply(auto elim!:allE) apply(rule_tac x=d in exI) by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3159
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3160
lemma continuous_at_eps_delta: "continuous (at x) f \<longleftrightarrow>  (\<forall>e>0. \<exists>d>0.
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3161
                           \<forall>x'. dist x' x < d --> dist(f x')(f x) < e)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3162
  using continuous_within_eps_delta[of x UNIV f]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3163
  unfolding within_UNIV by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3164
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3165
text{* Versions in terms of open balls. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3166
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3167
lemma continuous_within_ball:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3168
 "continuous (at x within s) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0.
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3169
                            f ` (ball x d \<inter> s) \<subseteq> ball (f x) e)" (is "?lhs = ?rhs")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3170
proof
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3171
  assume ?lhs
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3172
  { fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3173
    then obtain d where d: "d>0" "\<forall>xa\<in>s. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> dist (f xa) (f x) < e"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3174
      using `?lhs`[unfolded continuous_within Lim_within] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3175
    { fix y assume "y\<in>f ` (ball x d \<inter> s)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3176
      hence "y \<in> ball (f x) e" using d(2) unfolding dist_nz[THEN sym]
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3177
	apply (auto simp add: dist_commute mem_ball) apply(erule_tac x=xa in ballE) apply auto using `e>0` by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3178
    }
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3179
    hence "\<exists>d>0. f ` (ball x d \<inter> s) \<subseteq> ball (f x) e" using `d>0` unfolding subset_eq ball_def by (auto simp add: dist_commute)  }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3180
  thus ?rhs by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3181
next
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3182
  assume ?rhs thus ?lhs unfolding continuous_within Lim_within ball_def subset_eq
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3183
    apply (auto simp add: dist_commute) apply(erule_tac x=e in allE) by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3184
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3185
31346
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
  3186
lemma continuous_at_ball:
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
  3187
  "continuous (at x) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. f ` (ball x d) \<subseteq> ball (f x) e)" (is "?lhs = ?rhs")
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3188
proof
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3189
  assume ?lhs thus ?rhs unfolding continuous_at Lim_at subset_eq Ball_def Bex_def image_iff mem_ball
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3190
    apply auto apply(erule_tac x=e in allE) apply auto apply(rule_tac x=d in exI) apply auto apply(erule_tac x=xa in allE) apply (auto simp add: dist_commute dist_nz)
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3191
    unfolding dist_nz[THEN sym] by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3192
next
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3193
  assume ?rhs thus ?lhs unfolding continuous_at Lim_at subset_eq Ball_def Bex_def image_iff mem_ball
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3194
    apply auto apply(erule_tac x=e in allE) apply auto apply(rule_tac x=d in exI) apply auto apply(erule_tac x="f xa" in allE) by (auto simp add: dist_commute dist_nz)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3195
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3196
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3197
text{* For setwise continuity, just start from the epsilon-delta definitions. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3198
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3199
definition
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  3200
  continuous_on :: "'a::metric_space set \<Rightarrow> ('a \<Rightarrow> 'b::metric_space) \<Rightarrow> bool" where
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3201
  "continuous_on s f \<longleftrightarrow> (\<forall>x \<in> s. \<forall>e>0. \<exists>d::real>0. \<forall>x' \<in> s. dist x' x < d --> dist (f x') (f x) < e)"
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3202
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3203
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3204
definition
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3205
  uniformly_continuous_on ::
31402
e37967787a4f generalize constant uniformly_continuous_on
huffman
parents: 31401
diff changeset
  3206
    "'a::metric_space set \<Rightarrow> ('a \<Rightarrow> 'b::metric_space) \<Rightarrow> bool" where
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3207
  "uniformly_continuous_on s f \<longleftrightarrow>
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3208
        (\<forall>e>0. \<exists>d>0. \<forall>x\<in>s. \<forall> x'\<in>s. dist x' x < d
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3209
                           --> dist (f x') (f x) < e)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3210
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3211
text{* Some simple consequential lemmas. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3212
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3213
lemma uniformly_continuous_imp_continuous:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3214
 " uniformly_continuous_on s f ==> continuous_on s f"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3215
  unfolding uniformly_continuous_on_def continuous_on_def by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3216
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3217
lemma continuous_at_imp_continuous_within:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3218
 "continuous (at x) f ==> continuous (at x within s) f"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3219
  unfolding continuous_within continuous_at using Lim_at_within by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3220
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3221
lemma continuous_at_imp_continuous_on: assumes "(\<forall>x \<in> s. continuous (at x) f)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3222
  shows "continuous_on s f"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3223
proof(simp add: continuous_at continuous_on_def, rule, rule, rule)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3224
  fix x and e::real assume "x\<in>s" "e>0"
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  3225
  hence "eventually (\<lambda>xa. dist (f xa) (f x) < e) (at x)" using assms unfolding continuous_at tendsto_iff by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3226
  then obtain d where d:"d>0" "\<forall>xa. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> dist (f xa) (f x) < e" unfolding eventually_at by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3227
  { fix x' assume "\<not> 0 < dist x' x"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3228
    hence "x=x'"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3229
      using dist_nz[of x' x] by auto
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3230
    hence "dist (f x') (f x) < e" using `e>0` by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3231
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3232
  thus "\<exists>d>0. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f x') (f x) < e" using d by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3233
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3234
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3235
lemma continuous_on_eq_continuous_within:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3236
 "continuous_on s f \<longleftrightarrow> (\<forall>x \<in> s. continuous (at x within s) f)" (is "?lhs = ?rhs")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3237
proof
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3238
  assume ?rhs
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3239
  { fix x assume "x\<in>s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3240
    fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3241
    assume "\<exists>d>0. \<forall>xa\<in>s. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> dist (f xa) (f x) < e"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3242
    then obtain d where "d>0" and d:"\<forall>xa\<in>s. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> dist (f xa) (f x) < e" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3243
    { fix x' assume as:"x'\<in>s" "dist x' x < d"
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3244
      hence "dist (f x') (f x) < e" using `e>0` d `x'\<in>s` dist_eq_0_iff[of x' x] zero_le_dist[of x' x] as(2) by (metis dist_eq_0_iff dist_nz) }
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3245
    hence "\<exists>d>0. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f x') (f x) < e" using `d>0` by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3246
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3247
  thus ?lhs using `?rhs` unfolding continuous_on_def continuous_within Lim_within by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3248
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3249
  assume ?lhs
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3250
  thus ?rhs unfolding continuous_on_def continuous_within Lim_within by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3251
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3252
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3253
lemma continuous_on:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3254
 "continuous_on s f \<longleftrightarrow> (\<forall>x \<in> s. (f ---> f(x)) (at x within s))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3255
  by (auto simp add: continuous_on_eq_continuous_within continuous_within)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3256
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3257
lemma continuous_on_eq_continuous_at:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3258
 "open s ==> (continuous_on s f \<longleftrightarrow> (\<forall>x \<in> s. continuous (at x) f))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3259
  by (auto simp add: continuous_on continuous_at Lim_within_open)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3260
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3261
lemma continuous_within_subset:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3262
 "continuous (at x within s) f \<Longrightarrow> t \<subseteq> s
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3263
             ==> continuous (at x within t) f"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3264
  unfolding continuous_within by(metis Lim_within_subset)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3265
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3266
lemma continuous_on_subset:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3267
 "continuous_on s f \<Longrightarrow> t \<subseteq> s ==> continuous_on t f"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3268
  unfolding continuous_on by (metis subset_eq Lim_within_subset)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3269
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3270
lemma continuous_on_interior:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3271
 "continuous_on s f \<Longrightarrow> x \<in> interior s ==> continuous (at x) f"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3272
unfolding interior_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3273
apply simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3274
by (meson continuous_on_eq_continuous_at continuous_on_subset)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3275
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3276
lemma continuous_on_eq:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3277
 "(\<forall>x \<in> s. f x = g x) \<Longrightarrow> continuous_on s f
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3278
           ==> continuous_on s g"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3279
  by (simp add: continuous_on_def)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3280
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3281
text{* Characterization of various kinds of continuity in terms of sequences.  *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3282
31655
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3283
(* \<longrightarrow> could be generalized, but \<longleftarrow> requires metric space *)
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3284
lemma continuous_within_sequentially:
31655
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3285
  fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space"
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3286
  shows "continuous (at a within s) f \<longleftrightarrow>
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3287
                (\<forall>x. (\<forall>n::nat. x n \<in> s) \<and> (x ---> a) sequentially
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3288
                     --> ((f o x) ---> f a) sequentially)" (is "?lhs = ?rhs")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3289
proof
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3290
  assume ?lhs
31346
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
  3291
  { fix x::"nat \<Rightarrow> 'a" assume x:"\<forall>n. x n \<in> s" "\<forall>e>0. \<exists>N. \<forall>n\<ge>N. dist (x n) a < e"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3292
    fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3293
    from `?lhs` obtain d where "d>0" and d:"\<forall>x\<in>s. 0 < dist x a \<and> dist x a < d \<longrightarrow> dist (f x) (f a) < e" unfolding continuous_within Lim_within using `e>0` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3294
    from x(2) `d>0` obtain N where N:"\<forall>n\<ge>N. dist (x n) a < d" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3295
    hence "\<exists>N. \<forall>n\<ge>N. dist ((f \<circ> x) n) (f a) < e"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3296
      apply(rule_tac  x=N in exI) using N d  apply auto using x(1)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3297
      apply(erule_tac x=n in allE) apply(erule_tac x=n in allE)
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3298
      apply(erule_tac x="x n" in ballE)  apply auto unfolding dist_nz[THEN sym] apply auto using `e>0` by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3299
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3300
  thus ?rhs unfolding continuous_within unfolding Lim_sequentially by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3301
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3302
  assume ?rhs
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3303
  { fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3304
    assume "\<not> (\<exists>d>0. \<forall>x\<in>s. 0 < dist x a \<and> dist x a < d \<longrightarrow> dist (f x) (f a) < e)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3305
    hence "\<forall>d. \<exists>x. d>0 \<longrightarrow> x\<in>s \<and> (0 < dist x a \<and> dist x a < d \<and> \<not> dist (f x) (f a) < e)" by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3306
    then obtain x where x:"\<forall>d>0. x d \<in> s \<and> (0 < dist (x d) a \<and> dist (x d) a < d \<and> \<not> dist (f (x d)) (f a) < e)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3307
      using choice[of "\<lambda>d x.0<d \<longrightarrow> x\<in>s \<and> (0 < dist x a \<and> dist x a < d \<and> \<not> dist (f x) (f a) < e)"] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3308
    { fix d::real assume "d>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3309
      hence "\<exists>N::nat. inverse (real (N + 1)) < d" using real_arch_inv[of d] by (auto, rule_tac x="n - 1" in exI)auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3310
      then obtain N::nat where N:"inverse (real (N + 1)) < d" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3311
      { fix n::nat assume n:"n\<ge>N"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3312
	hence "dist (x (inverse (real (n + 1)))) a < inverse (real (n + 1))" using x[THEN spec[where x="inverse (real (n + 1))"]] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3313
	moreover have "inverse (real (n + 1)) < d" using N n 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)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3314
	ultimately have "dist (x (inverse (real (n + 1)))) a < d" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3315
      }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3316
      hence "\<exists>N::nat. \<forall>n\<ge>N. dist (x (inverse (real (n + 1)))) a < d" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3317
    }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3318
    hence "(\<forall>n::nat. x (inverse (real (n + 1))) \<in> s) \<and> (\<forall>e>0. \<exists>N::nat. \<forall>n\<ge>N. dist (x (inverse (real (n + 1)))) a < e)" using x by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3319
    hence "\<forall>e>0. \<exists>N::nat. \<forall>n\<ge>N. dist (f (x (inverse (real (n + 1))))) (f a) < e"  using `?rhs`[THEN spec[where x="\<lambda>n::nat. x (inverse (real (n+1)))"], unfolded Lim_sequentially] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3320
    hence "False" apply(erule_tac x=e in allE) using `e>0` using x by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3321
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3322
  thus ?lhs  unfolding continuous_within unfolding Lim_within unfolding Lim_sequentially by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3323
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3324
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3325
lemma continuous_at_sequentially:
31655
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3326
  fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space"
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3327
  shows "continuous (at a) f \<longleftrightarrow> (\<forall>x. (x ---> a) sequentially
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3328
                  --> ((f o x) ---> f a) sequentially)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3329
  using continuous_within_sequentially[of a UNIV f] unfolding within_UNIV by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3330
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3331
lemma continuous_on_sequentially:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3332
 "continuous_on s f \<longleftrightarrow>  (\<forall>x. \<forall>a \<in> s. (\<forall>n. x(n) \<in> s) \<and> (x ---> a) sequentially
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3333
                    --> ((f o x) ---> f(a)) sequentially)" (is "?lhs = ?rhs")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3334
proof
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3335
  assume ?rhs thus ?lhs using continuous_within_sequentially[of _ s f] unfolding continuous_on_eq_continuous_within by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3336
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3337
  assume ?lhs thus ?rhs unfolding continuous_on_eq_continuous_within using continuous_within_sequentially[of _ s f] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3338
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3339
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3340
lemma uniformly_continuous_on_sequentially:
31402
e37967787a4f generalize constant uniformly_continuous_on
huffman
parents: 31401
diff changeset
  3341
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
e37967787a4f generalize constant uniformly_continuous_on
huffman
parents: 31401
diff changeset
  3342
  shows "uniformly_continuous_on s f \<longleftrightarrow> (\<forall>x y. (\<forall>n. x n \<in> s) \<and> (\<forall>n. y n \<in> s) \<and>
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3343
                    ((\<lambda>n. x n - y n) ---> 0) sequentially
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3344
                    \<longrightarrow> ((\<lambda>n. f(x n) - f(y n)) ---> 0) sequentially)" (is "?lhs = ?rhs")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3345
proof
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3346
  assume ?lhs
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3347
  { fix x y assume x:"\<forall>n. x n \<in> s" and y:"\<forall>n. y n \<in> s" and xy:"((\<lambda>n. x n - y n) ---> 0) sequentially"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3348
    { fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3349
      then obtain d where "d>0" and d:"\<forall>x\<in>s. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f x') (f x) < e"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3350
	using `?lhs`[unfolded uniformly_continuous_on_def, THEN spec[where x=e]] by auto
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  3351
      obtain N where N:"\<forall>n\<ge>N. norm (x n - y n - 0) < d" using xy[unfolded Lim_sequentially dist_norm] and `d>0` by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3352
      { fix n assume "n\<ge>N"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3353
	hence "norm (f (x n) - f (y n) - 0) < e"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3354
	  using N[THEN spec[where x=n]] using d[THEN bspec[where x="x n"], THEN bspec[where x="y n"]] using x and y
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  3355
	  unfolding dist_commute and dist_norm by simp  }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3356
      hence "\<exists>N. \<forall>n\<ge>N. norm (f (x n) - f (y n) - 0) < e"  by auto  }
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  3357
    hence "((\<lambda>n. f(x n) - f(y n)) ---> 0) sequentially" unfolding Lim_sequentially and dist_norm by auto  }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3358
  thus ?rhs by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3359
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3360
  assume ?rhs
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3361
  { assume "\<not> ?lhs"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3362
    then obtain e where "e>0" "\<forall>d>0. \<exists>x\<in>s. \<exists>x'\<in>s. dist x' x < d \<and> \<not> dist (f x') (f x) < e" unfolding uniformly_continuous_on_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3363
    then obtain fa where fa:"\<forall>x.  0 < x \<longrightarrow> fst (fa x) \<in> s \<and> snd (fa x) \<in> s \<and> dist (fst (fa x)) (snd (fa x)) < x \<and> \<not> dist (f (fst (fa x))) (f (snd (fa x))) < e"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3364
      using choice[of "\<lambda>d x. d>0 \<longrightarrow> fst x \<in> s \<and> snd x \<in> s \<and> dist (snd x) (fst x) < d \<and> \<not> dist (f (snd x)) (f (fst x)) < e"] unfolding Bex_def
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3365
      by (auto simp add: dist_commute)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3366
    def x \<equiv> "\<lambda>n::nat. fst (fa (inverse (real n + 1)))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3367
    def y \<equiv> "\<lambda>n::nat. snd (fa (inverse (real n + 1)))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3368
    have xyn:"\<forall>n. x n \<in> s \<and> y n \<in> s" and xy0:"\<forall>n. dist (x n) (y n) < inverse (real n + 1)" and fxy:"\<forall>n. \<not> dist (f (x n)) (f (y n)) < e"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3369
      unfolding x_def and y_def using fa by auto
31402
e37967787a4f generalize constant uniformly_continuous_on
huffman
parents: 31401
diff changeset
  3370
    have 1:"\<And>(x::'a) y. dist (x - y) 0 = dist x y" unfolding dist_norm by auto
e37967787a4f generalize constant uniformly_continuous_on
huffman
parents: 31401
diff changeset
  3371
    have 2:"\<And>(x::'b) y. dist (x - y) 0 = dist x y" unfolding dist_norm by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3372
    { fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3373
      then obtain N::nat where "N \<noteq> 0" and N:"0 < inverse (real N) \<and> inverse (real N) < e" unfolding real_arch_inv[of e]   by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3374
      { fix n::nat assume "n\<ge>N"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3375
	hence "inverse (real n + 1) < inverse (real N)" using real_of_nat_ge_zero and `N\<noteq>0` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3376
	also have "\<dots> < e" using N by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3377
	finally have "inverse (real n + 1) < e" by auto
31402
e37967787a4f generalize constant uniformly_continuous_on
huffman
parents: 31401
diff changeset
  3378
	hence "dist (x n - y n) 0 < e" unfolding 1 using xy0[THEN spec[where x=n]] by auto  }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3379
      hence "\<exists>N. \<forall>n\<ge>N. dist (x n - y n) 0 < e" by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3380
    hence "\<forall>e>0. \<exists>N. \<forall>n\<ge>N. dist (f (x n) - f (y n)) 0 < e" using `?rhs`[THEN spec[where x=x], THEN spec[where x=y]] and xyn unfolding Lim_sequentially by auto
31402
e37967787a4f generalize constant uniformly_continuous_on
huffman
parents: 31401
diff changeset
  3381
    hence False unfolding 2 using fxy and `e>0` by auto  }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3382
  thus ?lhs unfolding uniformly_continuous_on_def by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3383
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3384
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3385
text{* The usual transformation theorems. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3386
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3387
lemma continuous_transform_within:
31402
e37967787a4f generalize constant uniformly_continuous_on
huffman
parents: 31401
diff changeset
  3388
  fixes f g :: "'a::metric_space \<Rightarrow> 'b::metric_space"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3389
  assumes "0 < d" "x \<in> s" "\<forall>x' \<in> s. dist x' x < d --> f x' = g x'"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3390
          "continuous (at x within s) f"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3391
  shows "continuous (at x within s) g"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3392
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3393
  { fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3394
    then obtain d' where d':"d'>0" "\<forall>xa\<in>s. 0 < dist xa x \<and> dist xa x < d' \<longrightarrow> dist (f xa) (f x) < e" using assms(4) unfolding continuous_within Lim_within by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3395
    { fix x' assume "x'\<in>s" "0 < dist x' x" "dist x' x < (min d d')"
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3396
      hence "dist (f x') (g x) < e" using assms(2,3) apply(erule_tac x=x in ballE) using d' by auto  }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3397
    hence "\<forall>xa\<in>s. 0 < dist xa x \<and> dist xa x < (min d d') \<longrightarrow> dist (f xa) (g x) < e" by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3398
    hence "\<exists>d>0. \<forall>xa\<in>s. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> dist (f xa) (g x) < e" using `d>0` `d'>0` by(rule_tac x="min d d'" in exI)auto  }
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3399
  hence "(f ---> g x) (at x within s)" unfolding Lim_within using assms(1) by auto
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3400
  thus ?thesis unfolding continuous_within using Lim_transform_within[of d s x f g "g x"] using assms by blast
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3401
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3402
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3403
lemma continuous_transform_at:
31402
e37967787a4f generalize constant uniformly_continuous_on
huffman
parents: 31401
diff changeset
  3404
  fixes f g :: "'a::metric_space \<Rightarrow> 'b::metric_space"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3405
  assumes "0 < d" "\<forall>x'. dist x' x < d --> f x' = g x'"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3406
          "continuous (at x) f"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3407
  shows "continuous (at x) g"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3408
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3409
  { fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3410
    then obtain d' where d':"d'>0" "\<forall>xa. 0 < dist xa x \<and> dist xa x < d' \<longrightarrow> dist (f xa) (f x) < e" using assms(3) unfolding continuous_at Lim_at by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3411
    { fix x' assume "0 < dist x' x" "dist x' x < (min d d')"
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3412
      hence "dist (f x') (g x) < e" using assms(2) apply(erule_tac x=x in allE) using d' by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3413
    }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3414
    hence "\<forall>xa. 0 < dist xa x \<and> dist xa x < (min d d') \<longrightarrow> dist (f xa) (g x) < e" by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3415
    hence "\<exists>d>0. \<forall>xa. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> dist (f xa) (g x) < e" using `d>0` `d'>0` by(rule_tac x="min d d'" in exI)auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3416
  }
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3417
  hence "(f ---> g x) (at x)" unfolding Lim_at using assms(1) by auto
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3418
  thus ?thesis unfolding continuous_at using Lim_transform_at[of d x f g "g x"] using assms by blast
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3419
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3420
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3421
text{* Combination results for pointwise continuity. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3422
31390
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  3423
lemma continuous_const: "continuous net (\<lambda>x. c)"
31343
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  3424
  by (auto simp add: continuous_def Lim_const)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3425
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3426
lemma continuous_cmul:
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  3427
  fixes f :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector"
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  3428
  shows "continuous net f ==> continuous net (\<lambda>x. c *\<^sub>R f x)"
31343
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  3429
  by (auto simp add: continuous_def Lim_cmul)
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3430
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3431
lemma continuous_neg:
31655
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3432
  fixes f :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector"
31343
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  3433
  shows "continuous net f ==> continuous net (\<lambda>x. -(f x))"
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  3434
  by (auto simp add: continuous_def Lim_neg)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3435
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3436
lemma continuous_add:
31655
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3437
  fixes f g :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector"
31343
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  3438
  shows "continuous net f \<Longrightarrow> continuous net g \<Longrightarrow> continuous net (\<lambda>x. f x + g x)"
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  3439
  by (auto simp add: continuous_def Lim_add)
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3440
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3441
lemma continuous_sub:
31655
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3442
  fixes f g :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector"
31343
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  3443
  shows "continuous net f \<Longrightarrow> continuous net g \<Longrightarrow> continuous net (\<lambda>x. f x - g x)"
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  3444
  by (auto simp add: continuous_def Lim_sub)
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3445
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3446
text{* Same thing for setwise continuity. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3447
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3448
lemma continuous_on_const:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3449
 "continuous_on s (\<lambda>x. c)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3450
  unfolding continuous_on_eq_continuous_within using continuous_const by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3451
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3452
lemma continuous_on_cmul:
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  3453
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  3454
  shows "continuous_on s f ==>  continuous_on s (\<lambda>x. c *\<^sub>R (f x))"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3455
  unfolding continuous_on_eq_continuous_within using continuous_cmul by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3456
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3457
lemma continuous_on_neg:
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  3458
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  3459
  shows "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. - f x)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3460
  unfolding continuous_on_eq_continuous_within using continuous_neg by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3461
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3462
lemma continuous_on_add:
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  3463
  fixes f g :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  3464
  shows "continuous_on s f \<Longrightarrow> continuous_on s g
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  3465
           \<Longrightarrow> continuous_on s (\<lambda>x. f x + g x)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3466
  unfolding continuous_on_eq_continuous_within using continuous_add by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3467
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3468
lemma continuous_on_sub:
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  3469
  fixes f g :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  3470
  shows "continuous_on s f \<Longrightarrow> continuous_on s g
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  3471
           \<Longrightarrow> continuous_on s (\<lambda>x. f x - g x)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3472
  unfolding continuous_on_eq_continuous_within using continuous_sub by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3473
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3474
text{* Same thing for uniform continuity, using sequential formulations. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3475
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3476
lemma uniformly_continuous_on_const:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3477
 "uniformly_continuous_on s (\<lambda>x. c)"
31402
e37967787a4f generalize constant uniformly_continuous_on
huffman
parents: 31401
diff changeset
  3478
  unfolding uniformly_continuous_on_def by simp
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3479
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3480
lemma uniformly_continuous_on_cmul:
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  3481
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  3482
    (* FIXME: generalize 'a to metric_space *)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3483
  assumes "uniformly_continuous_on s f"
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  3484
  shows "uniformly_continuous_on s (\<lambda>x. c *\<^sub>R f(x))"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3485
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3486
  { fix x y assume "((\<lambda>n. f (x n) - f (y n)) ---> 0) sequentially"
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  3487
    hence "((\<lambda>n. c *\<^sub>R f (x n) - c *\<^sub>R f (y n)) ---> 0) sequentially"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3488
      using Lim_cmul[of "(\<lambda>n. f (x n) - f (y n))" 0 sequentially c]
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  3489
      unfolding scaleR_zero_right scaleR_right_diff_distrib by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3490
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3491
  thus ?thesis using assms unfolding uniformly_continuous_on_sequentially by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3492
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3493
31445
c8a474a919a7 generalize norm method to work over class real_normed_vector
huffman
parents: 31421
diff changeset
  3494
lemma dist_minus:
c8a474a919a7 generalize norm method to work over class real_normed_vector
huffman
parents: 31421
diff changeset
  3495
  fixes x y :: "'a::real_normed_vector"
c8a474a919a7 generalize norm method to work over class real_normed_vector
huffman
parents: 31421
diff changeset
  3496
  shows "dist (- x) (- y) = dist x y"
c8a474a919a7 generalize norm method to work over class real_normed_vector
huffman
parents: 31421
diff changeset
  3497
  unfolding dist_norm minus_diff_minus norm_minus_cancel ..
c8a474a919a7 generalize norm method to work over class real_normed_vector
huffman
parents: 31421
diff changeset
  3498
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3499
lemma uniformly_continuous_on_neg:
31531
fc78714d14e1 generalize more lemmas
huffman
parents: 31530
diff changeset
  3500
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
31402
e37967787a4f generalize constant uniformly_continuous_on
huffman
parents: 31401
diff changeset
  3501
  shows "uniformly_continuous_on s f
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3502
         ==> uniformly_continuous_on s (\<lambda>x. -(f x))"
31445
c8a474a919a7 generalize norm method to work over class real_normed_vector
huffman
parents: 31421
diff changeset
  3503
  unfolding uniformly_continuous_on_def dist_minus .
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3504
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3505
lemma uniformly_continuous_on_add:
31531
fc78714d14e1 generalize more lemmas
huffman
parents: 31530
diff changeset
  3506
  fixes f g :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector" (* FIXME: generalize 'a *)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3507
  assumes "uniformly_continuous_on s f" "uniformly_continuous_on s g"
31402
e37967787a4f generalize constant uniformly_continuous_on
huffman
parents: 31401
diff changeset
  3508
  shows "uniformly_continuous_on s (\<lambda>x. f x + g x)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3509
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3510
  {  fix x y assume "((\<lambda>n. f (x n) - f (y n)) ---> 0) sequentially"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3511
                    "((\<lambda>n. g (x n) - g (y n)) ---> 0) sequentially"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3512
    hence "((\<lambda>xa. f (x xa) - f (y xa) + (g (x xa) - g (y xa))) ---> 0 + 0) sequentially"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3513
      using Lim_add[of "\<lambda> n. f (x n) - f (y n)" 0  sequentially "\<lambda> n. g (x n) - g (y n)" 0] by auto
31402
e37967787a4f generalize constant uniformly_continuous_on
huffman
parents: 31401
diff changeset
  3514
    hence "((\<lambda>n. f (x n) + g (x n) - (f (y n) + g (y n))) ---> 0) sequentially" unfolding Lim_sequentially and add_diff_add [symmetric] by auto  }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3515
  thus ?thesis using assms unfolding uniformly_continuous_on_sequentially by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3516
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3517
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3518
lemma uniformly_continuous_on_sub:
31531
fc78714d14e1 generalize more lemmas
huffman
parents: 31530
diff changeset
  3519
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector" (* FIXME: generalize 'a *)
31402
e37967787a4f generalize constant uniformly_continuous_on
huffman
parents: 31401
diff changeset
  3520
  shows "uniformly_continuous_on s f \<Longrightarrow> uniformly_continuous_on s g
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3521
           ==> uniformly_continuous_on s  (\<lambda>x. f x - g x)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3522
  unfolding ab_diff_minus
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3523
  using uniformly_continuous_on_add[of s f "\<lambda>x. - g x"]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3524
  using uniformly_continuous_on_neg[of s g] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3525
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3526
text{* Identity function is continuous in every sense. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3527
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3528
lemma continuous_within_id:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3529
 "continuous (at a within s) (\<lambda>x. x)"
31655
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3530
  unfolding continuous_within by (rule Lim_at_within [OF Lim_ident_at])
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3531
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3532
lemma continuous_at_id:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3533
 "continuous (at a) (\<lambda>x. x)"
31655
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3534
  unfolding continuous_at by (rule Lim_ident_at)
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3535
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3536
lemma continuous_on_id:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3537
 "continuous_on s (\<lambda>x. x)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3538
  unfolding continuous_on Lim_within by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3539
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3540
lemma uniformly_continuous_on_id:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3541
 "uniformly_continuous_on s (\<lambda>x. x)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3542
  unfolding uniformly_continuous_on_def by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3543
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3544
text{* Continuity of all kinds is preserved under composition. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3545
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3546
lemma continuous_within_compose:
31655
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3547
  fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* FIXME: generalize *)
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3548
  fixes g :: "'b::metric_space \<Rightarrow> 'c::metric_space"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3549
  assumes "continuous (at x within s) f"   "continuous (at (f x) within f ` s) g"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3550
  shows "continuous (at x within s) (g o f)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3551
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3552
  { fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3553
    with assms(2)[unfolded continuous_within Lim_within] obtain d  where "d>0" and d:"\<forall>xa\<in>f ` s. 0 < dist xa (f x) \<and> dist xa (f x) < d \<longrightarrow> dist (g xa) (g (f x)) < e" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3554
    from assms(1)[unfolded continuous_within Lim_within] obtain d' where "d'>0" and d':"\<forall>xa\<in>s. 0 < dist xa x \<and> dist xa x < d' \<longrightarrow> dist (f xa) (f x) < d" using `d>0` by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3555
    { fix y assume as:"y\<in>s"  "0 < dist y x"  "dist y x < d'"
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3556
      hence "dist (f y) (f x) < d" using d'[THEN bspec[where x=y]] by (auto simp add:dist_commute)
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3557
      hence "dist (g (f y)) (g (f x)) < e" using as(1) d[THEN bspec[where x="f y"]] unfolding dist_nz[THEN sym] using `e>0` by auto   }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3558
    hence "\<exists>d>0. \<forall>xa\<in>s. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> dist (g (f xa)) (g (f x)) < e" using `d'>0` by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3559
  thus ?thesis unfolding continuous_within Lim_within by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3560
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3561
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3562
lemma continuous_at_compose:
31655
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3563
  fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* FIXME: generalize *)
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3564
  fixes g :: "'b::metric_space \<Rightarrow> 'c::metric_space"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3565
  assumes "continuous (at x) f"  "continuous (at (f x)) g"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3566
  shows "continuous (at x) (g o f)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3567
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3568
  have " continuous (at (f x) within range f) g" using assms(2) using continuous_within_subset[of "f x" UNIV g "range f", unfolded within_UNIV] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3569
  thus ?thesis using assms(1) using continuous_within_compose[of x UNIV f g, unfolded within_UNIV] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3570
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3571
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3572
lemma continuous_on_compose:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3573
 "continuous_on s f \<Longrightarrow> continuous_on (f ` s) g \<Longrightarrow> continuous_on s (g o f)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3574
  unfolding continuous_on_eq_continuous_within using continuous_within_compose[of _ s f g] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3575
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3576
lemma uniformly_continuous_on_compose:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3577
  assumes "uniformly_continuous_on s f"  "uniformly_continuous_on (f ` s) g"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3578
  shows "uniformly_continuous_on s (g o f)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3579
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3580
  { fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3581
    then obtain d where "d>0" and d:"\<forall>x\<in>f ` s. \<forall>x'\<in>f ` s. dist x' x < d \<longrightarrow> dist (g x') (g x) < e" using assms(2) unfolding uniformly_continuous_on_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3582
    obtain d' where "d'>0" "\<forall>x\<in>s. \<forall>x'\<in>s. dist x' x < d' \<longrightarrow> dist (f x') (f x) < d" using `d>0` using assms(1) unfolding uniformly_continuous_on_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3583
    hence "\<exists>d>0. \<forall>x\<in>s. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist ((g \<circ> f) x') ((g \<circ> f) x) < e" using `d>0` using d by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3584
  thus ?thesis using assms unfolding uniformly_continuous_on_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3585
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3586
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3587
text{* Continuity in terms of open preimages. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3588
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3589
lemma continuous_at_open:
31655
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3590
  fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* FIXME: generalize *)
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3591
  shows "continuous (at x) f \<longleftrightarrow> (\<forall>t. open t \<and> f x \<in> t --> (\<exists>s. open s \<and> x \<in> s \<and> (\<forall>x' \<in> s. (f x') \<in> t)))" (is "?lhs = ?rhs")
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3592
proof
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3593
  assume ?lhs
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3594
  { fix t assume as: "open t" "f x \<in> t"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3595
    then obtain e where "e>0" and e:"ball (f x) e \<subseteq> t" unfolding open_contains_ball by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3596
31418
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
  3597
    obtain d where "d>0" and d:"\<forall>y. 0 < dist y x \<and> dist y x < d \<longrightarrow> dist (f y) (f x) < e" using `e>0` using `?lhs`[unfolded continuous_at Lim_at open_dist] by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3598
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3599
    have "open (ball x d)" using open_ball by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3600
    moreover have "x \<in> ball x d" unfolding centre_in_ball using `d>0` by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3601
    moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3602
    { fix x' assume "x'\<in>ball x d" hence "f x' \<in> t"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3603
	using e[unfolded subset_eq Ball_def mem_ball, THEN spec[where x="f x'"]]    d[THEN spec[where x=x']]
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3604
	unfolding mem_ball apply (auto simp add: dist_commute)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3605
	unfolding dist_nz[THEN sym] using as(2) by auto  }
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3606
    hence "\<forall>x'\<in>ball x d. f x' \<in> t" by auto
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3607
    ultimately have "\<exists>s. open s \<and> x \<in> s \<and> (\<forall>x'\<in>s. f x' \<in> t)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3608
      apply(rule_tac x="ball x d" in exI) by simp  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3609
  thus ?rhs by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3610
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3611
  assume ?rhs
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3612
  { fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3613
    then obtain s where s: "open s"  "x \<in> s"  "\<forall>x'\<in>s. f x' \<in> ball (f x) e" using `?rhs`[unfolded continuous_at Lim_at, THEN spec[where x="ball (f x) e"]]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3614
      unfolding centre_in_ball[of "f x" e, THEN sym] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3615
    then obtain d where "d>0" and d:"ball x d \<subseteq> s" unfolding open_contains_ball by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3616
    { fix y assume "0 < dist y x \<and> dist y x < d"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3617
      hence "dist (f y) (f x) < e" using d[unfolded subset_eq Ball_def mem_ball, THEN spec[where x=y]]
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3618
	using s(3)[THEN bspec[where x=y], unfolded mem_ball] by (auto simp add: dist_commute)  }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3619
    hence "\<exists>d>0. \<forall>xa. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> dist (f xa) (f x) < e" using `d>0` by auto  }
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3620
  thus ?lhs unfolding continuous_at Lim_at by auto
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3621
qed
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3622
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3623
lemma continuous_on_open:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3624
 "continuous_on s f \<longleftrightarrow>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3625
        (\<forall>t. openin (subtopology euclidean (f ` s)) t
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3626
            --> openin (subtopology euclidean s) {x \<in> s. f x \<in> t})" (is "?lhs = ?rhs")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3627
proof
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3628
  assume ?lhs
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3629
  { fix t assume as:"openin (subtopology euclidean (f ` s)) t"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3630
    have "{x \<in> s. f x \<in> t} \<subseteq> s" using as[unfolded openin_euclidean_subtopology_iff] by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3631
    moreover
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3632
    { fix x assume as':"x\<in>{x \<in> s. f x \<in> t}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3633
      then obtain e where e: "e>0" "\<forall>x'\<in>f ` s. dist x' (f x) < e \<longrightarrow> x' \<in> t" using as[unfolded openin_euclidean_subtopology_iff, THEN conjunct2, THEN bspec[where x="f x"]] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3634
      from this(1) obtain d where d: "d>0" "\<forall>xa\<in>s. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> dist (f xa) (f x) < e" using `?lhs`[unfolded continuous_on Lim_within, THEN bspec[where x=x]] using as' by auto
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3635
      have "\<exists>e>0. \<forall>x'\<in>s. dist x' x < e \<longrightarrow> x' \<in> {x \<in> s. f x \<in> t}" using d e unfolding dist_nz[THEN sym] by (rule_tac x=d in exI, auto)  }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3636
    ultimately have "openin (subtopology euclidean s) {x \<in> s. f x \<in> t}" unfolding openin_euclidean_subtopology_iff by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3637
  thus ?rhs unfolding continuous_on Lim_within using openin by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3638
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3639
  assume ?rhs
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3640
  { fix e::real and x assume "x\<in>s" "e>0"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3641
    { fix xa x' assume "dist (f xa) (f x) < e" "xa \<in> s" "x' \<in> s" "dist (f xa) (f x') < e - dist (f xa) (f x)"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3642
      hence "dist (f x') (f x) < e" using dist_triangle[of "f x'" "f x" "f xa"]
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3643
	by (auto simp add: dist_commute)  }
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3644
    hence "ball (f x) e \<inter> f ` s \<subseteq> f ` s \<and> (\<forall>xa\<in>ball (f x) e \<inter> f ` s. \<exists>ea>0. \<forall>x'\<in>f ` s. dist x' xa < ea \<longrightarrow> x' \<in> ball (f x) e \<inter> f ` s)" apply auto
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3645
      apply(rule_tac x="e - dist (f xa) (f x)" in exI) using `e>0` by (auto simp add: dist_commute)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3646
    hence "\<forall>xa\<in>{xa \<in> s. f xa \<in> ball (f x) e \<inter> f ` s}. \<exists>ea>0. \<forall>x'\<in>s. dist x' xa < ea \<longrightarrow> x' \<in> {xa \<in> s. f xa \<in> ball (f x) e \<inter> f ` s}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3647
      using `?rhs`[unfolded openin_euclidean_subtopology_iff, THEN spec[where x="ball (f x) e \<inter> f ` s"]] by auto
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3648
    hence "\<exists>d>0. \<forall>xa\<in>s. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> dist (f xa) (f x) < e" apply(erule_tac x=x in ballE) apply auto using `e>0` `x\<in>s` by (auto simp add: dist_commute)  }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3649
  thus ?lhs unfolding continuous_on Lim_within by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3650
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3651
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3652
(* ------------------------------------------------------------------------- *)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3653
(* Similarly in terms of closed sets.                                        *)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3654
(* ------------------------------------------------------------------------- *)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3655
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3656
lemma continuous_on_closed:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3657
 "continuous_on s f \<longleftrightarrow>  (\<forall>t. closedin (subtopology euclidean (f ` s)) t  --> closedin (subtopology euclidean s) {x \<in> s. f x \<in> t})" (is "?lhs = ?rhs")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3658
proof
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3659
  assume ?lhs
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3660
  { fix t
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3661
    have *:"s - {x \<in> s. f x \<in> f ` s - t} = {x \<in> s. f x \<in> t}" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3662
    have **:"f ` s - (f ` s - (f ` s - t)) = f ` s - t" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3663
    assume as:"closedin (subtopology euclidean (f ` s)) t"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3664
    hence "closedin (subtopology euclidean (f ` s)) (f ` s - (f ` s - t))" unfolding closedin_def topspace_euclidean_subtopology unfolding ** by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3665
    hence "closedin (subtopology euclidean s) {x \<in> s. f x \<in> t}" using `?lhs`[unfolded continuous_on_open, THEN spec[where x="(f ` s) - t"]]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3666
      unfolding openin_closedin_eq topspace_euclidean_subtopology unfolding * by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3667
  thus ?rhs by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3668
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3669
  assume ?rhs
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3670
  { fix t
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3671
    have *:"s - {x \<in> s. f x \<in> f ` s - t} = {x \<in> s. f x \<in> t}" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3672
    assume as:"openin (subtopology euclidean (f ` s)) t"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3673
    hence "openin (subtopology euclidean s) {x \<in> s. f x \<in> t}" using `?rhs`[THEN spec[where x="(f ` s) - t"]]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3674
      unfolding openin_closedin_eq topspace_euclidean_subtopology *[THEN sym] closedin_subtopology by auto }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3675
  thus ?lhs unfolding continuous_on_open by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3676
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3677
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3678
text{* Half-global and completely global cases.                                  *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3679
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3680
lemma continuous_open_in_preimage:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3681
  assumes "continuous_on s f"  "open t"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3682
  shows "openin (subtopology euclidean s) {x \<in> s. f x \<in> t}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3683
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3684
  have *:"\<forall>x. x \<in> s \<and> f x \<in> t \<longleftrightarrow> x \<in> s \<and> f x \<in> (t \<inter> f ` s)" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3685
  have "openin (subtopology euclidean (f ` s)) (t \<inter> f ` s)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3686
    using openin_open_Int[of t "f ` s", OF assms(2)] unfolding openin_open by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3687
  thus ?thesis using assms(1)[unfolded continuous_on_open, THEN spec[where x="t \<inter> f ` s"]] using * by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3688
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3689
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3690
lemma continuous_closed_in_preimage:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3691
  assumes "continuous_on s f"  "closed t"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3692
  shows "closedin (subtopology euclidean s) {x \<in> s. f x \<in> t}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3693
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3694
  have *:"\<forall>x. x \<in> s \<and> f x \<in> t \<longleftrightarrow> x \<in> s \<and> f x \<in> (t \<inter> f ` s)" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3695
  have "closedin (subtopology euclidean (f ` s)) (t \<inter> f ` s)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3696
    using closedin_closed_Int[of t "f ` s", OF assms(2)] unfolding Int_commute by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3697
  thus ?thesis
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3698
    using assms(1)[unfolded continuous_on_closed, THEN spec[where x="t \<inter> f ` s"]] using * by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3699
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3700
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3701
lemma continuous_open_preimage:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3702
  assumes "continuous_on s f" "open s" "open t"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3703
  shows "open {x \<in> s. f x \<in> t}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3704
proof-
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3705
  obtain T where T: "open T" "{x \<in> s. f x \<in> t} = s \<inter> T"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3706
    using continuous_open_in_preimage[OF assms(1,3)] unfolding openin_open by auto
31490
c350f3ad6b0d move definitions of open, closed to RealVector.thy
huffman
parents: 31489
diff changeset
  3707
  thus ?thesis using open_Int[of s T, OF assms(2)] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3708
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3709
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3710
lemma continuous_closed_preimage:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3711
  assumes "continuous_on s f" "closed s" "closed t"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3712
  shows "closed {x \<in> s. f x \<in> t}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3713
proof-
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3714
  obtain T where T: "closed T" "{x \<in> s. f x \<in> t} = s \<inter> T"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3715
    using continuous_closed_in_preimage[OF assms(1,3)] unfolding closedin_closed by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3716
  thus ?thesis using closed_Int[of s T, OF assms(2)] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3717
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3718
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3719
lemma continuous_open_preimage_univ:
31655
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3720
  fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* FIXME: generalize *)
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3721
  shows "\<forall>x. continuous (at x) f \<Longrightarrow> open s \<Longrightarrow> open {x. f x \<in> s}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3722
  using continuous_open_preimage[of UNIV f s] open_UNIV continuous_at_imp_continuous_on by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3723
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3724
lemma continuous_closed_preimage_univ:
31655
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3725
  fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* FIXME: generalize *)
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3726
  shows "(\<forall>x. continuous (at x) f) \<Longrightarrow> closed s ==> closed {x. f x \<in> s}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3727
  using continuous_closed_preimage[of UNIV f s] closed_UNIV continuous_at_imp_continuous_on by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3728
31656
abadaf4922f8 new continuous/vimage lemmas; cleaned up proofs
huffman
parents: 31655
diff changeset
  3729
lemma continuous_open_vimage:
abadaf4922f8 new continuous/vimage lemmas; cleaned up proofs
huffman
parents: 31655
diff changeset
  3730
  fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* FIXME: generalize *)
abadaf4922f8 new continuous/vimage lemmas; cleaned up proofs
huffman
parents: 31655
diff changeset
  3731
  shows "\<forall>x. continuous (at x) f \<Longrightarrow> open s \<Longrightarrow> open (f -` s)"
abadaf4922f8 new continuous/vimage lemmas; cleaned up proofs
huffman
parents: 31655
diff changeset
  3732
  unfolding vimage_def by (rule continuous_open_preimage_univ)
abadaf4922f8 new continuous/vimage lemmas; cleaned up proofs
huffman
parents: 31655
diff changeset
  3733
abadaf4922f8 new continuous/vimage lemmas; cleaned up proofs
huffman
parents: 31655
diff changeset
  3734
lemma continuous_closed_vimage:
abadaf4922f8 new continuous/vimage lemmas; cleaned up proofs
huffman
parents: 31655
diff changeset
  3735
  fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* FIXME: generalize *)
abadaf4922f8 new continuous/vimage lemmas; cleaned up proofs
huffman
parents: 31655
diff changeset
  3736
  shows "\<forall>x. continuous (at x) f \<Longrightarrow> closed s \<Longrightarrow> closed (f -` s)"
abadaf4922f8 new continuous/vimage lemmas; cleaned up proofs
huffman
parents: 31655
diff changeset
  3737
  unfolding vimage_def by (rule continuous_closed_preimage_univ)
abadaf4922f8 new continuous/vimage lemmas; cleaned up proofs
huffman
parents: 31655
diff changeset
  3738
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3739
text{* Equality of continuous functions on closure and related results.          *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3740
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3741
lemma continuous_closed_in_preimage_constant:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3742
 "continuous_on s f ==> closedin (subtopology euclidean s) {x \<in> s. f x = a}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3743
  using continuous_closed_in_preimage[of s f "{a}"] closed_sing by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3744
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3745
lemma continuous_closed_preimage_constant:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3746
 "continuous_on s f \<Longrightarrow> closed s ==> closed {x \<in> s. f x = a}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3747
  using continuous_closed_preimage[of s f "{a}"] closed_sing by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3748
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3749
lemma continuous_constant_on_closure:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3750
  assumes "continuous_on (closure s) f"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3751
          "\<forall>x \<in> s. f x = a"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3752
  shows "\<forall>x \<in> (closure s). f x = a"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3753
    using continuous_closed_preimage_constant[of "closure s" f a]
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3754
    assms closure_minimal[of s "{x \<in> closure s. f x = a}"] closure_subset unfolding subset_eq by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3755
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3756
lemma image_closure_subset:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3757
  assumes "continuous_on (closure s) f"  "closed t"  "(f ` s) \<subseteq> t"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3758
  shows "f ` (closure s) \<subseteq> t"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3759
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3760
  have "s \<subseteq> {x \<in> closure s. f x \<in> t}" using assms(3) closure_subset by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3761
  moreover have "closed {x \<in> closure s. f x \<in> t}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3762
    using continuous_closed_preimage[OF assms(1)] and assms(2) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3763
  ultimately have "closure s = {x \<in> closure s . f x \<in> t}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3764
    using closure_minimal[of s "{x \<in> closure s. f x \<in> t}"] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3765
  thus ?thesis by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3766
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3767
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3768
lemma continuous_on_closure_norm_le:
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  3769
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3770
  assumes "continuous_on (closure s) f"  "\<forall>y \<in> s. norm(f y) \<le> b"  "x \<in> (closure s)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3771
  shows "norm(f x) \<le> b"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3772
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3773
  have *:"f ` s \<subseteq> cball 0 b" using assms(2)[unfolded mem_cball_0[THEN sym]] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3774
  show ?thesis
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3775
    using image_closure_subset[OF assms(1) closed_cball[of 0 b] *] assms(3)
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  3776
    unfolding subset_eq apply(erule_tac x="f x" in ballE) by (auto simp add: dist_norm)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3777
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3778
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3779
text{* Making a continuous function avoid some value in a neighbourhood.         *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3780
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3781
lemma continuous_within_avoid:
31655
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3782
  fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* FIXME: generalize *)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3783
  assumes "continuous (at x within s) f"  "x \<in> s"  "f x \<noteq> a"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3784
  shows "\<exists>e>0. \<forall>y \<in> s. dist x y < e --> f y \<noteq> a"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3785
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3786
  obtain d where "d>0" and d:"\<forall>xa\<in>s. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> dist (f xa) (f x) < dist (f x) a"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3787
    using assms(1)[unfolded continuous_within Lim_within, THEN spec[where x="dist (f x) a"]] assms(3)[unfolded dist_nz] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3788
  { fix y assume " y\<in>s"  "dist x y < d"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3789
    hence "f y \<noteq> a" using d[THEN bspec[where x=y]] assms(3)[unfolded dist_nz]
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3790
      apply auto unfolding dist_nz[THEN sym] by (auto simp add: dist_commute) }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3791
  thus ?thesis using `d>0` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3792
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3793
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3794
lemma continuous_at_avoid:
31655
bcb1eb2197f8 generalize constants netlimit and continuous
huffman
parents: 31654
diff changeset
  3795
  fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" (* FIXME: generalize *)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3796
  assumes "continuous (at x) f"  "f x \<noteq> a"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3797
  shows "\<exists>e>0. \<forall>y. dist x y < e \<longrightarrow> f y \<noteq> a"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3798
using assms using continuous_within_avoid[of x UNIV f a, unfolded within_UNIV] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3799
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3800
lemma continuous_on_avoid:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3801
  assumes "continuous_on s f"  "x \<in> s"  "f x \<noteq> a"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3802
  shows "\<exists>e>0. \<forall>y \<in> s. dist x y < e \<longrightarrow> f y \<noteq> a"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3803
using assms(1)[unfolded continuous_on_eq_continuous_within, THEN bspec[where x=x], OF assms(2)]  continuous_within_avoid[of x s f a]  assms(2,3) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3804
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3805
lemma continuous_on_open_avoid:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3806
  assumes "continuous_on s f"  "open s"  "x \<in> s"  "f x \<noteq> a"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3807
  shows "\<exists>e>0. \<forall>y. dist x y < e \<longrightarrow> f y \<noteq> a"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3808
using assms(1)[unfolded continuous_on_eq_continuous_at[OF assms(2)], THEN bspec[where x=x], OF assms(3)]  continuous_at_avoid[of x f a]  assms(3,4) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3809
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3810
text{* Proving a function is constant by proving open-ness of level set.         *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3811
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3812
lemma continuous_levelset_open_in_cases:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3813
 "connected s \<Longrightarrow> continuous_on s f \<Longrightarrow>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3814
        openin (subtopology euclidean s) {x \<in> s. f x = a}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3815
        ==> (\<forall>x \<in> s. f x \<noteq> a) \<or> (\<forall>x \<in> s. f x = a)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3816
unfolding connected_clopen using continuous_closed_in_preimage_constant by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3817
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3818
lemma continuous_levelset_open_in:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3819
 "connected s \<Longrightarrow> continuous_on s f \<Longrightarrow>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3820
        openin (subtopology euclidean s) {x \<in> s. f x = a} \<Longrightarrow>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3821
        (\<exists>x \<in> s. f x = a)  ==> (\<forall>x \<in> s. f x = a)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3822
using continuous_levelset_open_in_cases[of s f ]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3823
by meson
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3824
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3825
lemma continuous_levelset_open:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3826
  assumes "connected s"  "continuous_on s f"  "open {x \<in> s. f x = a}"  "\<exists>x \<in> s.  f x = a"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3827
  shows "\<forall>x \<in> s. f x = a"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3828
using continuous_levelset_open_in[OF assms(1,2), of a, unfolded openin_open] using assms (3,4) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3829
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3830
text{* Some arithmetical combinations (more to prove).                           *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3831
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3832
lemma open_scaling[intro]:
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  3833
  fixes s :: "'a::real_normed_vector set"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3834
  assumes "c \<noteq> 0"  "open s"
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  3835
  shows "open((\<lambda>x. c *\<^sub>R x) ` s)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3836
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3837
  { fix x assume "x \<in> s"
31418
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
  3838
    then obtain e where "e>0" and e:"\<forall>x'. dist x' x < e \<longrightarrow> x' \<in> s" using assms(2)[unfolded open_dist, THEN bspec[where x=x]] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3839
    have "e * abs c > 0" using assms(1)[unfolded zero_less_abs_iff[THEN sym]] using real_mult_order[OF `e>0`] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3840
    moreover
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  3841
    { fix y assume "dist y (c *\<^sub>R x) < e * \<bar>c\<bar>"
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  3842
      hence "norm ((1 / c) *\<^sub>R y - x) < e" unfolding dist_norm
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  3843
	using norm_scaleR[of c "(1 / c) *\<^sub>R y - x", unfolded scaleR_right_diff_distrib, unfolded scaleR_scaleR] assms(1)
30649
57753e0ec1d4 1. New cancellation simprocs for common factors in inequations
nipkow
parents: 30582
diff changeset
  3844
	  assms(1)[unfolded zero_less_abs_iff[THEN sym]] by (simp del:zero_less_abs_iff)
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  3845
      hence "y \<in> op *\<^sub>R c ` s" using rev_image_eqI[of "(1 / c) *\<^sub>R y" s y "op *\<^sub>R c"]  e[THEN spec[where x="(1 / c) *\<^sub>R y"]]  assms(1) unfolding dist_norm scaleR_scaleR by auto  }
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  3846
    ultimately have "\<exists>e>0. \<forall>x'. dist x' (c *\<^sub>R x) < e \<longrightarrow> x' \<in> op *\<^sub>R c ` s" apply(rule_tac x="e * abs c" in exI) by auto  }
31418
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
  3847
  thus ?thesis unfolding open_dist by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3848
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3849
31445
c8a474a919a7 generalize norm method to work over class real_normed_vector
huffman
parents: 31421
diff changeset
  3850
lemma minus_image_eq_vimage:
c8a474a919a7 generalize norm method to work over class real_normed_vector
huffman
parents: 31421
diff changeset
  3851
  fixes A :: "'a::ab_group_add set"
c8a474a919a7 generalize norm method to work over class real_normed_vector
huffman
parents: 31421
diff changeset
  3852
  shows "(\<lambda>x. - x) ` A = (\<lambda>x. - x) -` A"
c8a474a919a7 generalize norm method to work over class real_normed_vector
huffman
parents: 31421
diff changeset
  3853
  by (auto intro!: image_eqI [where f="\<lambda>x. - x"])
c8a474a919a7 generalize norm method to work over class real_normed_vector
huffman
parents: 31421
diff changeset
  3854
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3855
lemma open_negations:
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  3856
  fixes s :: "'a::real_normed_vector set"
31445
c8a474a919a7 generalize norm method to work over class real_normed_vector
huffman
parents: 31421
diff changeset
  3857
  shows "open s ==> open ((\<lambda> x. -x) ` s)"
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  3858
  unfolding scaleR_minus1_left [symmetric]
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  3859
  by (rule open_scaling, auto)
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3860
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3861
lemma open_translation:
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  3862
  fixes s :: "'a::real_normed_vector set"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3863
  assumes "open s"  shows "open((\<lambda>x. a + x) ` s)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3864
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3865
  { fix x have "continuous (at x) (\<lambda>x. x - a)" using continuous_sub[of "at x" "\<lambda>x. x" "\<lambda>x. a"] continuous_at_id[of x] continuous_const[of "at x" a] by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3866
  moreover have "{x. x - a \<in> s}  = op + a ` s" apply auto unfolding image_iff apply(rule_tac x="x - a" in bexI) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3867
  ultimately show ?thesis using continuous_open_preimage_univ[of "\<lambda>x. x - a" s] using assms by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3868
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3869
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3870
lemma open_affinity:
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  3871
  fixes s :: "'a::real_normed_vector set"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3872
  assumes "open s"  "c \<noteq> 0"
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  3873
  shows "open ((\<lambda>x. a + c *\<^sub>R x) ` s)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3874
proof-
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  3875
  have *:"(\<lambda>x. a + c *\<^sub>R x) = (\<lambda>x. a + x) \<circ> (\<lambda>x. c *\<^sub>R x)" unfolding o_def ..
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  3876
  have "op + a ` op *\<^sub>R c ` s = (op + a \<circ> op *\<^sub>R c) ` s" by auto
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  3877
  thus ?thesis using assms open_translation[of "op *\<^sub>R c ` s" a] unfolding * by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3878
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3879
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  3880
lemma interior_translation:
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  3881
  fixes s :: "'a::real_normed_vector set"
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  3882
  shows "interior ((\<lambda>x. a + x) ` s) = (\<lambda>x. a + x) ` (interior s)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3883
proof (rule set_ext, rule)
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3884
  fix x assume "x \<in> interior (op + a ` s)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3885
  then obtain e where "e>0" and e:"ball x e \<subseteq> op + a ` s" unfolding mem_interior by auto
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  3886
  hence "ball (x - a) e \<subseteq> s" unfolding subset_eq Ball_def mem_ball dist_norm apply auto apply(erule_tac x="a + xa" in allE) unfolding ab_group_add_class.diff_diff_eq[THEN sym] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3887
  thus "x \<in> op + a ` interior s" unfolding image_iff apply(rule_tac x="x - a" in bexI) unfolding mem_interior using `e > 0` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3888
next
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3889
  fix x assume "x \<in> op + a ` interior s"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3890
  then obtain y e where "e>0" and e:"ball y e \<subseteq> s" and y:"x = a + y" unfolding image_iff Bex_def mem_interior by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3891
  { fix z have *:"a + y - z = y + a - z" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3892
    assume "z\<in>ball x e"
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  3893
    hence "z - a \<in> s" using e[unfolded subset_eq, THEN bspec[where x="z - a"]] unfolding mem_ball dist_norm y ab_group_add_class.diff_diff_eq2 * by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3894
    hence "z \<in> op + a ` s" unfolding image_iff by(auto intro!: bexI[where x="z - a"])  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3895
  hence "ball x e \<subseteq> op + a ` s" unfolding subset_eq by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3896
  thus "x \<in> interior (op + a ` s)" unfolding mem_interior using `e>0` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3897
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3898
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3899
subsection {* Preservation of compactness and connectedness under continuous function.  *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3900
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3901
lemma compact_continuous_image:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3902
  assumes "continuous_on s f"  "compact s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3903
  shows "compact(f ` s)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3904
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3905
  { fix x assume x:"\<forall>n::nat. x n \<in> f ` s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3906
    then obtain y where y:"\<forall>n. y n \<in> s \<and> x n = f (y n)" unfolding image_iff Bex_def using choice[of "\<lambda>n xa. xa \<in> s \<and> x n = f xa"] by auto
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  3907
    then obtain l r where "l\<in>s" and r:"subseq r" and lr:"((y \<circ> r) ---> l) sequentially" using assms(2)[unfolded compact_def, THEN spec[where x=y]] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3908
    { fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3909
      then obtain d where "d>0" and d:"\<forall>x'\<in>s. dist x' l < d \<longrightarrow> dist (f x') (f l) < e" using assms(1)[unfolded continuous_on_def, THEN bspec[where x=l], OF `l\<in>s`] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3910
      then obtain N::nat where N:"\<forall>n\<ge>N. dist ((y \<circ> r) n) l < d" using lr[unfolded Lim_sequentially, THEN spec[where x=d]] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3911
      { fix n::nat assume "n\<ge>N" hence "dist ((x \<circ> r) n) (f l) < e" using N[THEN spec[where x=n]] d[THEN bspec[where x="y (r n)"]] y[THEN spec[where x="r n"]] by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3912
      hence "\<exists>N. \<forall>n\<ge>N. dist ((x \<circ> r) n) (f l) < e" by auto  }
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  3913
    hence "\<exists>l\<in>f ` s. \<exists>r. subseq r \<and> ((x \<circ> r) ---> l) sequentially" unfolding Lim_sequentially using r lr `l\<in>s` by auto  }
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3914
  thus ?thesis unfolding compact_def by auto
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3915
qed
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3916
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3917
lemma connected_continuous_image:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3918
  assumes "continuous_on s f"  "connected s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3919
  shows "connected(f ` s)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3920
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3921
  { fix T assume as: "T \<noteq> {}"  "T \<noteq> f ` s"  "openin (subtopology euclidean (f ` s)) T"  "closedin (subtopology euclidean (f ` s)) T"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3922
    have "{x \<in> s. f x \<in> T} = {} \<or> {x \<in> s. f x \<in> T} = s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3923
      using assms(1)[unfolded continuous_on_open, THEN spec[where x=T]]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3924
      using assms(1)[unfolded continuous_on_closed, THEN spec[where x=T]]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3925
      using assms(2)[unfolded connected_clopen, THEN spec[where x="{x \<in> s. f x \<in> T}"]] as(3,4) by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3926
    hence False using as(1,2)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3927
      using as(4)[unfolded closedin_def topspace_euclidean_subtopology] by auto }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3928
  thus ?thesis unfolding connected_clopen by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3929
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3930
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3931
text{* Continuity implies uniform continuity on a compact domain.                *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3932
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3933
lemma compact_uniformly_continuous:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3934
  assumes "continuous_on s f"  "compact s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3935
  shows "uniformly_continuous_on s f"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3936
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3937
    { fix x assume x:"x\<in>s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3938
      hence "\<forall>xa. \<exists>y. 0 < xa \<longrightarrow> (y > 0 \<and> (\<forall>x'\<in>s. dist x' x < y \<longrightarrow> dist (f x') (f x) < xa))" using assms(1)[unfolded continuous_on_def, THEN bspec[where x=x]] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3939
      hence "\<exists>fa. \<forall>xa>0. \<forall>x'\<in>s. fa xa > 0 \<and> (dist x' x < fa xa \<longrightarrow> dist (f x') (f x) < xa)" using choice[of "\<lambda>e d. e>0 \<longrightarrow> d>0 \<and>(\<forall>x'\<in>s. (dist x' x < d \<longrightarrow> dist (f x') (f x) < e))"] by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3940
    then have "\<forall>x\<in>s. \<exists>y. \<forall>xa. 0 < xa \<longrightarrow> (\<forall>x'\<in>s. y xa > 0 \<and> (dist x' x < y xa \<longrightarrow> dist (f x') (f x) < xa))" by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3941
    then obtain d where d:"\<forall>e>0. \<forall>x\<in>s. \<forall>x'\<in>s. d x e > 0 \<and> (dist x' x < d x e \<longrightarrow> dist (f x') (f x) < e)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3942
      using bchoice[of s "\<lambda>x fa. \<forall>xa>0. \<forall>x'\<in>s. fa xa > 0 \<and> (dist x' x < fa xa \<longrightarrow> dist (f x') (f x) < xa)"] by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3943
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3944
  { fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3945
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3946
    { fix x assume "x\<in>s" hence "x \<in> ball x (d x (e / 2))" unfolding centre_in_ball using d[THEN spec[where x="e/2"]] using `e>0` by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3947
    hence "s \<subseteq> \<Union>{ball x (d x (e / 2)) |x. x \<in> s}" unfolding subset_eq by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3948
    moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3949
    { fix b assume "b\<in>{ball x (d x (e / 2)) |x. x \<in> s}" hence "open b" by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3950
    ultimately obtain ea where "ea>0" and ea:"\<forall>x\<in>s. \<exists>b\<in>{ball x (d x (e / 2)) |x. x \<in> s}. ball x ea \<subseteq> b" using heine_borel_lemma[OF assms(2), of "{ball x (d x (e / 2)) | x. x\<in>s }"] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3951
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3952
    { fix x y assume "x\<in>s" "y\<in>s" and as:"dist y x < ea"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3953
      obtain z where "z\<in>s" and z:"ball x ea \<subseteq> ball z (d z (e / 2))" using ea[THEN bspec[where x=x]] and `x\<in>s` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3954
      hence "x\<in>ball z (d z (e / 2))" using `ea>0` unfolding subset_eq by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3955
      hence "dist (f z) (f x) < e / 2" using d[THEN spec[where x="e/2"]] and `e>0` and `x\<in>s` and `z\<in>s`
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3956
	by (auto  simp add: dist_commute)
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3957
      moreover have "y\<in>ball z (d z (e / 2))" using as and `ea>0` and z[unfolded subset_eq]
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3958
	by (auto simp add: dist_commute)
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3959
      hence "dist (f z) (f y) < e / 2" using d[THEN spec[where x="e/2"]] and `e>0` and `y\<in>s` and `z\<in>s`
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3960
	by (auto  simp add: dist_commute)
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3961
      ultimately have "dist (f y) (f x) < e" using dist_triangle_half_r[of "f z" "f x" e "f y"]
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  3962
	by (auto simp add: dist_commute)  }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3963
    then have "\<exists>d>0. \<forall>x\<in>s. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f x') (f x) < e" using `ea>0` by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3964
  thus ?thesis unfolding uniformly_continuous_on_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3965
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3966
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3967
text{* Continuity of inverse function on compact domain. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3968
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3969
lemma continuous_on_inverse:
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  3970
  fixes f :: "'a::heine_borel \<Rightarrow> 'b::heine_borel"
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  3971
    (* TODO: can this be generalized more? *)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3972
  assumes "continuous_on s f"  "compact s"  "\<forall>x \<in> s. g (f x) = x"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3973
  shows "continuous_on (f ` s) g"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3974
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3975
  have *:"g ` f ` s = s" using assms(3) by (auto simp add: image_iff)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3976
  { fix t assume t:"closedin (subtopology euclidean (g ` f ` s)) t"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3977
    then obtain T where T: "closed T" "t = s \<inter> T" unfolding closedin_closed unfolding * by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3978
    have "continuous_on (s \<inter> T) f" using continuous_on_subset[OF assms(1), of "s \<inter> t"]
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3979
      unfolding T(2) and Int_left_absorb by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3980
    moreover have "compact (s \<inter> T)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3981
      using assms(2) unfolding compact_eq_bounded_closed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3982
      using bounded_subset[of s "s \<inter> T"] and T(1) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3983
    ultimately have "closed (f ` t)" using T(1) unfolding T(2)
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  3984
      using compact_continuous_image [of "s \<inter> T" f] unfolding compact_eq_bounded_closed by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3985
    moreover have "{x \<in> f ` s. g x \<in> t} = f ` s \<inter> f ` t" using assms(3) unfolding T(2) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3986
    ultimately have "closedin (subtopology euclidean (f ` s)) {x \<in> f ` s. g x \<in> t}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3987
      unfolding closedin_closed by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3988
  thus ?thesis unfolding continuous_on_closed by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3989
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3990
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3991
subsection{* A uniformly convergent limit of continuous functions is continuous.       *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  3992
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  3993
lemma norm_triangle_lt:
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  3994
  fixes x y :: "'a::real_normed_vector"
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  3995
  shows "norm x + norm y < e \<Longrightarrow> norm (x + y) < e"
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  3996
by (rule le_less_trans [OF norm_triangle_ineq])
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  3997
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  3998
lemma continuous_uniform_limit:
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  3999
  fixes f :: "'a \<Rightarrow> 'b::metric_space \<Rightarrow> 'c::real_normed_vector"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4000
  assumes "\<not> (trivial_limit net)"  "eventually (\<lambda>n. continuous_on s (f n)) net"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4001
  "\<forall>e>0. eventually (\<lambda>n. \<forall>x \<in> s. norm(f n x - g x) < e) net"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4002
  shows "continuous_on s g"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4003
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4004
  { fix x and e::real assume "x\<in>s" "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4005
    have "eventually (\<lambda>n. \<forall>x\<in>s. norm (f n x - g x) < e / 3) net" using `e>0` assms(3)[THEN spec[where x="e/3"]] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4006
    then obtain n where n:"\<forall>xa\<in>s. norm (f n xa - g xa) < e / 3"  "continuous_on s (f n)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4007
      using eventually_and[of "(\<lambda>n. \<forall>x\<in>s. norm (f n x - g x) < e / 3)" "(\<lambda>n. continuous_on s (f n))" net] assms(1,2) eventually_happens by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4008
    have "e / 3 > 0" using `e>0` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4009
    then obtain d where "d>0" and d:"\<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f n x') (f n x) < e / 3"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4010
      using n(2)[unfolded continuous_on_def, THEN bspec[where x=x], OF `x\<in>s`, THEN spec[where x="e/3"]] by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4011
    { fix y assume "y\<in>s" "dist y x < d"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4012
      hence "dist (f n y) (f n x) < e / 3" using d[THEN bspec[where x=y]] by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4013
      hence "norm (f n y - g x) < 2 * e / 3" using norm_triangle_lt[of "f n y - f n x" "f n x - g x" "2*e/3"]
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  4014
	using n(1)[THEN bspec[where x=x], OF `x\<in>s`] unfolding dist_norm unfolding ab_group_add_class.ab_diff_minus by auto
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  4015
      hence "dist (g y) (g x) < e" unfolding dist_norm using n(1)[THEN bspec[where x=y], OF `y\<in>s`]
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4016
	unfolding norm_minus_cancel[of "f n y - g y", THEN sym] using norm_triangle_lt[of "f n y - g x" "g y - f n y" e] by (auto simp add: uminus_add_conv_diff)  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4017
    hence "\<exists>d>0. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (g x') (g x) < e" using `d>0` by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4018
  thus ?thesis unfolding continuous_on_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4019
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4020
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4021
subsection{* Topological properties of linear functions.                               *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4022
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  4023
lemma linear_lim_0:
31657
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  4024
  assumes "bounded_linear f" shows "(f ---> 0) (at (0))"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4025
proof-
31657
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  4026
  interpret f: bounded_linear f by fact
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  4027
  have "(f ---> f 0) (at 0)"
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  4028
    using tendsto_ident_at by (rule f.tendsto)
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  4029
  thus ?thesis unfolding f.zero .
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4030
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4031
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  4032
lemma linear_continuous_at:
31535
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4033
  assumes "bounded_linear f"  shows "continuous (at a) f"
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4034
  unfolding continuous_at using assms
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4035
  apply (rule bounded_linear.tendsto)
31657
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  4036
  apply (rule tendsto_ident_at)
31535
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4037
  done
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4038
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4039
lemma linear_continuous_within:
31657
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  4040
  shows "bounded_linear f ==> continuous (at x within s) f"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4041
  using continuous_at_imp_continuous_within[of x f s] using linear_continuous_at[of f] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4042
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4043
lemma linear_continuous_on:
31657
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  4044
  shows "bounded_linear f ==> continuous_on s f"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4045
  using continuous_at_imp_continuous_on[of s f] using linear_continuous_at[of f] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4046
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4047
text{* Also bilinear functions, in composition form.                             *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4048
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4049
lemma bilinear_continuous_at_compose:
31657
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  4050
  shows "continuous (at x) f \<Longrightarrow> continuous (at x) g \<Longrightarrow> bounded_bilinear h
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4051
        ==> continuous (at x) (\<lambda>x. h (f x) (g x))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4052
  unfolding continuous_at using Lim_bilinear[of f "f x" "(at x)" g "g x" h] by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4053
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4054
lemma bilinear_continuous_within_compose:
31657
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  4055
  shows "continuous (at x within s) f \<Longrightarrow> continuous (at x within s) g \<Longrightarrow> bounded_bilinear h
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4056
        ==> continuous (at x within s) (\<lambda>x. h (f x) (g x))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4057
  unfolding continuous_within using Lim_bilinear[of f "f x"] by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4058
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4059
lemma bilinear_continuous_on_compose:
31657
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  4060
  shows "continuous_on s f \<Longrightarrow> continuous_on s g \<Longrightarrow> bounded_bilinear h
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4061
             ==> continuous_on s (\<lambda>x. h (f x) (g x))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4062
  unfolding continuous_on_eq_continuous_within apply auto apply(erule_tac x=x in ballE) apply auto apply(erule_tac x=x in ballE) apply auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4063
  using bilinear_continuous_within_compose[of _ s f g h] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4064
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4065
subsection{* Topological stuff lifted from and dropped to R                            *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4066
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4067
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4068
lemma open_real:
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  4069
  fixes s :: "real set" shows
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4070
 "open s \<longleftrightarrow>
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4071
        (\<forall>x \<in> s. \<exists>e>0. \<forall>x'. abs(x' - x) < e --> x' \<in> s)" (is "?lhs = ?rhs")
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4072
  unfolding open_dist dist_norm by simp
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4073
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4074
lemma islimpt_approachable_real:
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4075
  fixes s :: "real set"
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4076
  shows "x islimpt s \<longleftrightarrow> (\<forall>e>0.  \<exists>x'\<in> s. x' \<noteq> x \<and> abs(x' - x) < e)"
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4077
  unfolding islimpt_approachable dist_norm by simp
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4078
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4079
lemma closed_real:
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4080
  fixes s :: "real set"
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4081
  shows "closed s \<longleftrightarrow>
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4082
        (\<forall>x. (\<forall>e>0.  \<exists>x' \<in> s. x' \<noteq> x \<and> abs(x' - x) < e)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4083
            --> x \<in> s)"
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4084
  unfolding closed_limpt islimpt_approachable dist_norm by simp
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4085
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4086
lemma continuous_at_real_range:
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4087
  fixes f :: "'a::real_normed_vector \<Rightarrow> real"
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4088
  shows "continuous (at x) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0.
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4089
        \<forall>x'. norm(x' - x) < d --> abs(f x' - f x) < e)"
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4090
  unfolding continuous_at unfolding Lim_at
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4091
  unfolding dist_nz[THEN sym] unfolding dist_norm apply auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4092
  apply(erule_tac x=e in allE) apply auto apply (rule_tac x=d in exI) apply auto apply (erule_tac x=x' in allE) apply auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4093
  apply(erule_tac x=e in allE) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4094
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4095
lemma continuous_on_real_range:
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  4096
  fixes f :: "'a::real_normed_vector \<Rightarrow> real"
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4097
  shows "continuous_on s f \<longleftrightarrow> (\<forall>x \<in> s. \<forall>e>0. \<exists>d>0. (\<forall>x' \<in> s. norm(x' - x) < d --> abs(f x' - f x) < e))"
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4098
  unfolding continuous_on_def dist_norm by simp
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4099
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4100
lemma continuous_at_norm: "continuous (at x) norm"
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4101
  unfolding continuous_at by (intro tendsto_intros)
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4102
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4103
lemma continuous_on_norm: "continuous_on s norm"
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4104
unfolding continuous_on by (intro ballI tendsto_intros)
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4105
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4106
lemma continuous_at_component: "continuous (at a) (\<lambda>x. x $ i)"
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4107
unfolding continuous_at by (intro tendsto_intros)
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4108
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4109
lemma continuous_on_component: "continuous_on s (\<lambda>x. x $ i)"
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4110
unfolding continuous_on by (intro ballI tendsto_intros)
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4111
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4112
lemma continuous_at_infnorm: "continuous (at x) infnorm"
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4113
  unfolding continuous_at Lim_at o_def unfolding dist_norm
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4114
  apply auto apply (rule_tac x=e in exI) apply auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4115
  using order_trans[OF real_abs_sub_infnorm infnorm_le_norm, of _ x] by (metis xt1(7))
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4116
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4117
text{* Hence some handy theorems on distance, diameter etc. of/from a set.       *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4118
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4119
lemma compact_attains_sup:
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  4120
  fixes s :: "real set"
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4121
  assumes "compact s"  "s \<noteq> {}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4122
  shows "\<exists>x \<in> s. \<forall>y \<in> s. y \<le> x"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4123
proof-
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4124
  from assms(1) have a:"bounded s" "closed s" unfolding compact_eq_bounded_closed by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4125
  { fix e::real assume as: "\<forall>x\<in>s. x \<le> rsup s" "rsup s \<notin> s"  "0 < e" "\<forall>x'\<in>s. x' = rsup s \<or> \<not> rsup s - x' < e"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4126
    have "isLub UNIV s (rsup s)" using rsup[OF assms(2)] unfolding setle_def using as(1) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4127
    moreover have "isUb UNIV s (rsup s - e)" unfolding isUb_def unfolding setle_def using as(4,2) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4128
    ultimately have False using isLub_le_isUb[of UNIV s "rsup s" "rsup s - e"] using `e>0` by auto  }
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4129
  thus ?thesis using bounded_has_rsup(1)[OF a(1) assms(2)] using a(2)[unfolded closed_real, THEN spec[where x="rsup s"]]
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4130
    apply(rule_tac x="rsup s" in bexI) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4131
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4132
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4133
lemma compact_attains_inf:
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  4134
  fixes s :: "real set"
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4135
  assumes "compact s" "s \<noteq> {}"  shows "\<exists>x \<in> s. \<forall>y \<in> s. x \<le> y"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4136
proof-
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4137
  from assms(1) have a:"bounded s" "closed s" unfolding compact_eq_bounded_closed by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4138
  { fix e::real assume as: "\<forall>x\<in>s. x \<ge> rinf s"  "rinf s \<notin> s"  "0 < e"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4139
      "\<forall>x'\<in>s. x' = rinf s \<or> \<not> abs (x' - rinf s) < e"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4140
    have "isGlb UNIV s (rinf s)" using rinf[OF assms(2)] unfolding setge_def using as(1) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4141
    moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4142
    { fix x assume "x \<in> s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4143
      hence *:"abs (x - rinf s) = x - rinf s" using as(1)[THEN bspec[where x=x]] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4144
      have "rinf s + e \<le> x" using as(4)[THEN bspec[where x=x]] using as(2) `x\<in>s` unfolding * by auto }
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4145
    hence "isLb UNIV s (rinf s + e)" unfolding isLb_def and setge_def by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4146
    ultimately have False using isGlb_le_isLb[of UNIV s "rinf s" "rinf s + e"] using `e>0` by auto  }
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4147
  thus ?thesis using bounded_has_rinf(1)[OF a(1) assms(2)] using a(2)[unfolded closed_real, THEN spec[where x="rinf s"]]
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4148
    apply(rule_tac x="rinf s" in bexI) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4149
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4150
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4151
lemma continuous_attains_sup:
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  4152
  fixes f :: "'a::metric_space \<Rightarrow> real"
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4153
  shows "compact s \<Longrightarrow> s \<noteq> {} \<Longrightarrow> continuous_on s f
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4154
        ==> (\<exists>x \<in> s. \<forall>y \<in> s.  f y \<le> f x)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4155
  using compact_attains_sup[of "f ` s"]
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4156
  using compact_continuous_image[of s f] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4157
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4158
lemma continuous_attains_inf:
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  4159
  fixes f :: "'a::metric_space \<Rightarrow> real"
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4160
  shows "compact s \<Longrightarrow> s \<noteq> {} \<Longrightarrow> continuous_on s f
31282
b98cbfabe824 Moved some lemmas about intervals to Topology
himmelma
parents: 31281
diff changeset
  4161
        \<Longrightarrow> (\<exists>x \<in> s. \<forall>y \<in> s. f x \<le> f y)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4162
  using compact_attains_inf[of "f ` s"]
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4163
  using compact_continuous_image[of s f] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4164
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4165
lemma distance_attains_sup:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4166
  assumes "compact s" "s \<noteq> {}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4167
  shows "\<exists>x \<in> s. \<forall>y \<in> s. dist a y \<le> dist a x"
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4168
proof (rule continuous_attains_sup [OF assms])
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4169
  { fix x assume "x\<in>s"
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4170
    have "(dist a ---> dist a x) (at x within s)"
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4171
      by (intro tendsto_dist tendsto_const Lim_at_within Lim_ident_at)
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4172
  }
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4173
  thus "continuous_on s (dist a)"
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4174
    unfolding continuous_on ..
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4175
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4176
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4177
text{* For *minimal* distance, we only need closure, not compactness.            *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4178
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4179
lemma distance_attains_inf:
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4180
  fixes a :: "'a::heine_borel"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4181
  assumes "closed s"  "s \<noteq> {}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4182
  shows "\<exists>x \<in> s. \<forall>y \<in> s. dist a x \<le> dist a y"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4183
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4184
  from assms(2) obtain b where "b\<in>s" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4185
  let ?B = "cball a (dist b a) \<inter> s"
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  4186
  have "b \<in> ?B" using `b\<in>s` by (simp add: dist_commute)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4187
  hence "?B \<noteq> {}" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4188
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4189
  { fix x assume "x\<in>?B"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4190
    fix e::real assume "e>0"
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4191
    { fix x' assume "x'\<in>?B" and as:"dist x' x < e"
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4192
      from as have "\<bar>dist a x' - dist a x\<bar> < e"
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4193
        unfolding abs_less_iff minus_diff_eq
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4194
        using dist_triangle2 [of a x' x]
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4195
        using dist_triangle [of a x x']
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4196
        by arith
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4197
    }
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4198
    hence "\<exists>d>0. \<forall>x'\<in>?B. dist x' x < d \<longrightarrow> \<bar>dist a x' - dist a x\<bar> < e"
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4199
      using `e>0` by auto
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4200
  }
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4201
  hence "continuous_on (cball a (dist b a) \<inter> s) (dist a)"
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4202
    unfolding continuous_on Lim_within dist_norm real_norm_def
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4203
    by fast
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4204
  moreover have "compact ?B"
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4205
    using compact_cball[of a "dist b a"]
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4206
    unfolding compact_eq_bounded_closed
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4207
    using bounded_Int and closed_Int and assms(1) by auto
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4208
  ultimately obtain x where "x\<in>cball a (dist b a) \<inter> s" "\<forall>y\<in>cball a (dist b a) \<inter> s. dist a x \<le> dist a y"
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4209
    using continuous_attains_inf[of ?B "dist a"] by fastsimp
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4210
  thus ?thesis by fastsimp
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4211
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4212
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4213
subsection{* We can now extend limit compositions to consider the scalar multiplier.   *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4214
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4215
lemma Lim_mul:
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  4216
  fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4217
  assumes "(c ---> d) net"  "(f ---> l) net"
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4218
  shows "((\<lambda>x. c(x) *\<^sub>R f x) ---> (d *\<^sub>R l)) net"
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  4219
  using assms by (rule scaleR.tendsto)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4220
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4221
lemma Lim_vmul:
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4222
  fixes c :: "'a \<Rightarrow> real" and v :: "'b::real_normed_vector"
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4223
  shows "(c ---> d) net ==> ((\<lambda>x. c(x) *\<^sub>R v) ---> d *\<^sub>R v) net"
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4224
  by (intro tendsto_intros)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4225
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4226
lemma continuous_vmul:
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4227
  fixes c :: "'a::metric_space \<Rightarrow> real" and v :: "'b::real_normed_vector"
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4228
  shows "continuous net c ==> continuous net (\<lambda>x. c(x) *\<^sub>R v)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4229
  unfolding continuous_def using Lim_vmul[of c] by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4230
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4231
lemma continuous_mul:
31390
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  4232
  fixes c :: "'a::metric_space \<Rightarrow> real"
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4233
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4234
  shows "continuous net c \<Longrightarrow> continuous net f
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4235
             ==> continuous net (\<lambda>x. c(x) *\<^sub>R f x) "
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4236
  unfolding continuous_def by (intro tendsto_intros)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4237
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4238
lemma continuous_on_vmul:
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4239
  fixes c :: "'a::metric_space \<Rightarrow> real" and v :: "'b::real_normed_vector"
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4240
  shows "continuous_on s c ==> continuous_on s (\<lambda>x. c(x) *\<^sub>R v)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4241
  unfolding continuous_on_eq_continuous_within using continuous_vmul[of _ c] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4242
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4243
lemma continuous_on_mul:
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  4244
  fixes c :: "'a::metric_space \<Rightarrow> real"
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4245
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4246
  shows "continuous_on s c \<Longrightarrow> continuous_on s f
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4247
             ==> continuous_on s (\<lambda>x. c(x) *\<^sub>R f x)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4248
  unfolding continuous_on_eq_continuous_within using continuous_mul[of _ c] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4249
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4250
text{* And so we have continuity of inverse.                                     *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4251
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4252
lemma Lim_inv:
31343
9983f648f9bb generalize tendsto and related constants to class metric_space
huffman
parents: 31342
diff changeset
  4253
  fixes f :: "'a \<Rightarrow> real"
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4254
  assumes "(f ---> l) (net::'a net)"  "l \<noteq> 0"
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4255
  shows "((inverse o f) ---> inverse l) net"
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4256
  unfolding o_def using assms by (rule tendsto_inverse)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4257
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4258
lemma continuous_inv:
31390
1d0478b16613 redefine nets as filter bases
huffman
parents: 31348
diff changeset
  4259
  fixes f :: "'a::metric_space \<Rightarrow> real"
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4260
  shows "continuous net f \<Longrightarrow> f(netlimit net) \<noteq> 0
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4261
           ==> continuous net (inverse o f)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4262
  unfolding continuous_def using Lim_inv by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4263
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4264
lemma continuous_at_within_inv:
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4265
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_field"
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4266
  assumes "continuous (at a within s) f" "f a \<noteq> 0"
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4267
  shows "continuous (at a within s) (inverse o f)"
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4268
  using assms unfolding continuous_within o_def
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4269
  by (intro tendsto_intros)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4270
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4271
lemma continuous_at_inv:
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4272
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_field"
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4273
  shows "continuous (at a) f \<Longrightarrow> f a \<noteq> 0
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4274
         ==> continuous (at a) (inverse o f) "
31346
fa93996e9572 generalize at function to class perfect_space
huffman
parents: 31345
diff changeset
  4275
  using within_UNIV[THEN sym, of "at a"] using continuous_at_within_inv[of a UNIV] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4276
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4277
subsection{* Preservation properties for pasted sets.                                  *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4278
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4279
lemma bounded_pastecart:
31533
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  4280
  fixes s :: "('a::real_normed_vector ^ _) set" (* FIXME: generalize to metric_space *)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4281
  assumes "bounded s" "bounded t"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4282
  shows "bounded { pastecart x y | x y . (x \<in> s \<and> y \<in> t)}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4283
proof-
31533
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  4284
  obtain a b where ab:"\<forall>x\<in>s. norm x \<le> a" "\<forall>x\<in>t. norm x \<le> b" using assms[unfolded bounded_iff] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4285
  { fix x y assume "x\<in>s" "y\<in>t"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4286
    hence "norm x \<le> a" "norm y \<le> b" using ab by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4287
    hence "norm (pastecart x y) \<le> a + b" using norm_pastecart[of x y] by auto }
31533
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  4288
  thus ?thesis unfolding bounded_iff by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4289
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4290
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4291
lemma bounded_Times:
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4292
  assumes "bounded s" "bounded t" shows "bounded (s \<times> t)"
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4293
proof-
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4294
  obtain x y a b where "\<forall>z\<in>s. dist x z \<le> a" "\<forall>z\<in>t. dist y z \<le> b"
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4295
    using assms [unfolded bounded_def] by auto
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4296
  then have "\<forall>z\<in>s \<times> t. dist (x, y) z \<le> sqrt (a\<twosuperior> + b\<twosuperior>)"
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4297
    by (auto simp add: dist_Pair_Pair real_sqrt_le_mono add_mono power_mono)
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4298
  thus ?thesis unfolding bounded_any_center [where a="(x, y)"] by auto
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4299
qed
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4300
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4301
lemma closed_pastecart:
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  4302
  fixes s :: "(real ^ 'a::finite) set" (* FIXME: generalize *)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4303
  assumes "closed s"  "closed t"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4304
  shows "closed {pastecart x y | x y . x \<in> s \<and> y \<in> t}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4305
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4306
  { fix x l assume as:"\<forall>n::nat. x n \<in> {pastecart x y |x y. x \<in> s \<and> y \<in> t}"  "(x ---> l) sequentially"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4307
    { fix n::nat have "fstcart (x n) \<in> s" "sndcart (x n) \<in> t" using as(1)[THEN spec[where x=n]] by auto } note * = this
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4308
    moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4309
    { fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4310
      then obtain N::nat where N:"\<forall>n\<ge>N. dist (x n) l < e" using as(2)[unfolded Lim_sequentially, THEN spec[where x=e]] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4311
      { fix n::nat assume "n\<ge>N"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4312
	hence "dist (fstcart (x n)) (fstcart l) < e" "dist (sndcart (x n)) (sndcart l) < e"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4313
	  using N[THEN spec[where x=n]] dist_fstcart[of "x n" l] dist_sndcart[of "x n" l] by auto   }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4314
      hence "\<exists>N. \<forall>n\<ge>N. dist (fstcart (x n)) (fstcart l) < e" "\<exists>N. \<forall>n\<ge>N. dist (sndcart (x n)) (sndcart l) < e" by auto  }
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4315
    ultimately have "fstcart l \<in> s" "sndcart l \<in> t"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4316
      using assms(1)[unfolded closed_sequential_limits, THEN spec[where x="\<lambda>n. fstcart (x n)"], THEN spec[where x="fstcart l"]]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4317
      using assms(2)[unfolded closed_sequential_limits, THEN spec[where x="\<lambda>n. sndcart (x n)"], THEN spec[where x="sndcart l"]]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4318
      unfolding Lim_sequentially by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4319
    hence "l \<in> {pastecart x y |x y. x \<in> s \<and> y \<in> t}" using pastecart_fst_snd[THEN sym, of l] by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4320
  thus ?thesis unfolding closed_sequential_limits by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4321
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4322
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4323
lemma compact_pastecart:
31401
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  4324
  fixes s t :: "(real ^ _) set"
2da6a7684e66 generalize more constants
huffman
parents: 31400
diff changeset
  4325
  shows "compact s \<Longrightarrow> compact t ==> compact {pastecart x y | x y . x \<in> s \<and> y \<in> t}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4326
  unfolding compact_eq_bounded_closed using bounded_pastecart[of s t] closed_pastecart[of s t] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4327
31571
fd09da741833 move lemma compact_Times; generalize more lemmas
huffman
parents: 31570
diff changeset
  4328
lemma mem_Times_iff: "x \<in> A \<times> B \<longleftrightarrow> fst x \<in> A \<and> snd x \<in> B"
fd09da741833 move lemma compact_Times; generalize more lemmas
huffman
parents: 31570
diff changeset
  4329
by (induct x) simp
fd09da741833 move lemma compact_Times; generalize more lemmas
huffman
parents: 31570
diff changeset
  4330
fd09da741833 move lemma compact_Times; generalize more lemmas
huffman
parents: 31570
diff changeset
  4331
lemma compact_Times: "compact s \<Longrightarrow> compact t \<Longrightarrow> compact (s \<times> t)"
fd09da741833 move lemma compact_Times; generalize more lemmas
huffman
parents: 31570
diff changeset
  4332
unfolding compact_def
fd09da741833 move lemma compact_Times; generalize more lemmas
huffman
parents: 31570
diff changeset
  4333
apply clarify
fd09da741833 move lemma compact_Times; generalize more lemmas
huffman
parents: 31570
diff changeset
  4334
apply (drule_tac x="fst \<circ> f" in spec)
fd09da741833 move lemma compact_Times; generalize more lemmas
huffman
parents: 31570
diff changeset
  4335
apply (drule mp, simp add: mem_Times_iff)
fd09da741833 move lemma compact_Times; generalize more lemmas
huffman
parents: 31570
diff changeset
  4336
apply (clarify, rename_tac l1 r1)
fd09da741833 move lemma compact_Times; generalize more lemmas
huffman
parents: 31570
diff changeset
  4337
apply (drule_tac x="snd \<circ> f \<circ> r1" in spec)
fd09da741833 move lemma compact_Times; generalize more lemmas
huffman
parents: 31570
diff changeset
  4338
apply (drule mp, simp add: mem_Times_iff)
fd09da741833 move lemma compact_Times; generalize more lemmas
huffman
parents: 31570
diff changeset
  4339
apply (clarify, rename_tac l2 r2)
fd09da741833 move lemma compact_Times; generalize more lemmas
huffman
parents: 31570
diff changeset
  4340
apply (rule_tac x="(l1, l2)" in rev_bexI, simp)
fd09da741833 move lemma compact_Times; generalize more lemmas
huffman
parents: 31570
diff changeset
  4341
apply (rule_tac x="r1 \<circ> r2" in exI)
fd09da741833 move lemma compact_Times; generalize more lemmas
huffman
parents: 31570
diff changeset
  4342
apply (rule conjI, simp add: subseq_def)
fd09da741833 move lemma compact_Times; generalize more lemmas
huffman
parents: 31570
diff changeset
  4343
apply (drule_tac r=r2 in lim_subseq [COMP swap_prems_rl], assumption)
fd09da741833 move lemma compact_Times; generalize more lemmas
huffman
parents: 31570
diff changeset
  4344
apply (drule (1) tendsto_Pair) back
fd09da741833 move lemma compact_Times; generalize more lemmas
huffman
parents: 31570
diff changeset
  4345
apply (simp add: o_def)
fd09da741833 move lemma compact_Times; generalize more lemmas
huffman
parents: 31570
diff changeset
  4346
done
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4347
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4348
text{* Hence some useful properties follow quite easily.                         *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4349
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  4350
lemma compact_scaling:
31535
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4351
  fixes s :: "'a::real_normed_vector set"
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  4352
  assumes "compact s"  shows "compact ((\<lambda>x. c *\<^sub>R x) ` s)"
31535
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4353
proof-
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4354
  let ?f = "\<lambda>x. scaleR c x"
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4355
  have *:"bounded_linear ?f" by (rule scaleR.bounded_linear_right)
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4356
  show ?thesis using compact_continuous_image[of s ?f] continuous_at_imp_continuous_on[of s ?f]
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  4357
    using linear_continuous_at[OF *] assms by auto
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  4358
qed
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4359
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4360
lemma compact_negations:
31535
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4361
  fixes s :: "'a::real_normed_vector set"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4362
  assumes "compact s"  shows "compact ((\<lambda>x. -x) ` s)"
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  4363
  using compact_scaling [OF assms, of "- 1"] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4364
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4365
lemma compact_sums:
31571
fd09da741833 move lemma compact_Times; generalize more lemmas
huffman
parents: 31570
diff changeset
  4366
  fixes s t :: "'a::real_normed_vector set"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4367
  assumes "compact s"  "compact t"  shows "compact {x + y | x y. x \<in> s \<and> y \<in> t}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4368
proof-
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4369
  have *:"{x + y | x y. x \<in> s \<and> y \<in> t} = (\<lambda>z. fst z + snd z) ` (s \<times> t)"
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4370
    apply auto unfolding image_iff apply(rule_tac x="(xa, y)" in bexI) by auto
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4371
  have "continuous_on (s \<times> t) (\<lambda>z. fst z + snd z)"
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4372
    unfolding continuous_on by (rule ballI) (intro tendsto_intros)
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4373
  thus ?thesis unfolding * using compact_continuous_image compact_Times [OF assms] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4374
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4375
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4376
lemma compact_differences:
31571
fd09da741833 move lemma compact_Times; generalize more lemmas
huffman
parents: 31570
diff changeset
  4377
  fixes s t :: "'a::real_normed_vector set"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4378
  assumes "compact s" "compact t"  shows "compact {x - y | x y. x \<in> s \<and> y \<in> t}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4379
proof-
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4380
  have "{x - y | x y. x\<in>s \<and> y \<in> t} =  {x + y | x y. x \<in> s \<and> y \<in> (uminus ` t)}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4381
    apply auto apply(rule_tac x= xa in exI) apply auto apply(rule_tac x=xa in exI) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4382
  thus ?thesis using compact_sums[OF assms(1) compact_negations[OF assms(2)]] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4383
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4384
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4385
lemma compact_translation:
31571
fd09da741833 move lemma compact_Times; generalize more lemmas
huffman
parents: 31570
diff changeset
  4386
  fixes s :: "'a::real_normed_vector set"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4387
  assumes "compact s"  shows "compact ((\<lambda>x. a + x) ` s)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4388
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4389
  have "{x + y |x y. x \<in> s \<and> y \<in> {a}} = (\<lambda>x. a + x) ` s" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4390
  thus ?thesis using compact_sums[OF assms compact_sing[of a]] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4391
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4392
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4393
lemma compact_affinity:
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  4394
  fixes s :: "'a::real_normed_vector set"
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4395
  assumes "compact s"  shows "compact ((\<lambda>x. a + c *\<^sub>R x) ` s)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4396
proof-
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4397
  have "op + a ` op *\<^sub>R c ` s = (\<lambda>x. a + c *\<^sub>R x) ` s" by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4398
  thus ?thesis using compact_translation[OF compact_scaling[OF assms], of a c] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4399
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4400
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4401
text{* Hence we get the following.                                               *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4402
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4403
lemma compact_sup_maxdistance:
31571
fd09da741833 move lemma compact_Times; generalize more lemmas
huffman
parents: 31570
diff changeset
  4404
  fixes s :: "'a::real_normed_vector set"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4405
  assumes "compact s"  "s \<noteq> {}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4406
  shows "\<exists>x\<in>s. \<exists>y\<in>s. \<forall>u\<in>s. \<forall>v\<in>s. norm(u - v) \<le> norm(x - y)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4407
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4408
  have "{x - y | x y . x\<in>s \<and> y\<in>s} \<noteq> {}" using `s \<noteq> {}` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4409
  then obtain x where x:"x\<in>{x - y |x y. x \<in> s \<and> y \<in> s}"  "\<forall>y\<in>{x - y |x y. x \<in> s \<and> y \<in> s}. norm y \<le> norm x"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4410
    using compact_differences[OF assms(1) assms(1)]
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4411
    using distance_attains_sup[where 'a="'a", unfolded dist_norm, of "{x - y | x y . x\<in>s \<and> y\<in>s}" 0] by(auto simp add: norm_minus_cancel)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4412
  from x(1) obtain a b where "a\<in>s" "b\<in>s" "x = a - b" by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4413
  thus ?thesis using x(2)[unfolded `x = a - b`] by blast
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4414
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4415
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4416
text{* We can state this in terms of diameter of a set.                          *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4417
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4418
definition "diameter s = (if s = {} then 0::real else rsup {norm(x - y) | x y. x \<in> s \<and> y \<in> s})"
31533
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  4419
  (* TODO: generalize to class metric_space *)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4420
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4421
lemma diameter_bounded:
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4422
  assumes "bounded s"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4423
  shows "\<forall>x\<in>s. \<forall>y\<in>s. norm(x - y) \<le> diameter s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4424
        "\<forall>d>0. d < diameter s --> (\<exists>x\<in>s. \<exists>y\<in>s. norm(x - y) > d)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4425
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4426
  let ?D = "{norm (x - y) |x y. x \<in> s \<and> y \<in> s}"
31533
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  4427
  obtain a where a:"\<forall>x\<in>s. norm x \<le> a" using assms[unfolded bounded_iff] by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4428
  { fix x y assume "x \<in> s" "y \<in> s"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4429
    hence "norm (x - y) \<le> 2 * a" using norm_triangle_ineq[of x "-y", unfolded norm_minus_cancel] a[THEN bspec[where x=x]] a[THEN bspec[where x=y]] by (auto simp add: ring_simps)  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4430
  note * = this
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4431
  { fix x y assume "x\<in>s" "y\<in>s"  hence "s \<noteq> {}" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4432
    have lub:"isLub UNIV ?D (rsup ?D)" using * rsup[of ?D] using `s\<noteq>{}` unfolding setle_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4433
    have "norm(x - y) \<le> diameter s" unfolding diameter_def using `s\<noteq>{}` *[OF `x\<in>s` `y\<in>s`] `x\<in>s` `y\<in>s` isLubD1[OF lub] unfolding setle_def by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4434
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4435
  { fix d::real assume "d>0" "d < diameter s"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4436
    hence "s\<noteq>{}" unfolding diameter_def by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4437
    hence lub:"isLub UNIV ?D (rsup ?D)" using * rsup[of ?D] unfolding setle_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4438
    have "\<exists>d' \<in> ?D. d' > d"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4439
    proof(rule ccontr)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4440
      assume "\<not> (\<exists>d'\<in>{norm (x - y) |x y. x \<in> s \<and> y \<in> s}. d < d')"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4441
      hence as:"\<forall>d'\<in>?D. d' \<le> d" apply auto apply(erule_tac x="norm (x - y)" in allE) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4442
      hence "isUb UNIV ?D d" unfolding isUb_def unfolding setle_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4443
      thus False using `d < diameter s` `s\<noteq>{}` isLub_le_isUb[OF lub, of d] unfolding diameter_def  by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4444
    qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4445
    hence "\<exists>x\<in>s. \<exists>y\<in>s. norm(x - y) > d" by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4446
  ultimately show "\<forall>x\<in>s. \<forall>y\<in>s. norm(x - y) \<le> diameter s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4447
        "\<forall>d>0. d < diameter s --> (\<exists>x\<in>s. \<exists>y\<in>s. norm(x - y) > d)" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4448
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4449
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4450
lemma diameter_bounded_bound:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4451
 "bounded s \<Longrightarrow> x \<in> s \<Longrightarrow> y \<in> s ==> norm(x - y) \<le> diameter s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4452
  using diameter_bounded by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4453
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4454
lemma diameter_compact_attained:
31571
fd09da741833 move lemma compact_Times; generalize more lemmas
huffman
parents: 31570
diff changeset
  4455
  fixes s :: "'a::real_normed_vector set"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4456
  assumes "compact s"  "s \<noteq> {}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4457
  shows "\<exists>x\<in>s. \<exists>y\<in>s. (norm(x - y) = diameter s)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4458
proof-
31571
fd09da741833 move lemma compact_Times; generalize more lemmas
huffman
parents: 31570
diff changeset
  4459
  have b:"bounded s" using assms(1) by (rule compact_imp_bounded)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4460
  then obtain x y where xys:"x\<in>s" "y\<in>s" and xy:"\<forall>u\<in>s. \<forall>v\<in>s. norm (u - v) \<le> norm (x - y)" using compact_sup_maxdistance[OF assms] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4461
  hence "diameter s \<le> norm (x - y)" using rsup_le[of "{norm (x - y) |x y. x \<in> s \<and> y \<in> s}" "norm (x - y)"]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4462
    unfolding setle_def and diameter_def by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4463
  thus ?thesis using diameter_bounded(1)[OF b, THEN bspec[where x=x], THEN bspec[where x=y], OF xys] and xys by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4464
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4465
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4466
text{* Related results with closure as the conclusion.                           *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4467
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  4468
lemma closed_scaling:
31535
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4469
  fixes s :: "'a::real_normed_vector set"
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  4470
  assumes "closed s" shows "closed ((\<lambda>x. c *\<^sub>R x) ` s)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4471
proof(cases "s={}")
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4472
  case True thus ?thesis by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4473
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4474
  case False
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4475
  show ?thesis
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4476
  proof(cases "c=0")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4477
    have *:"(\<lambda>x. 0) ` s = {0}" using `s\<noteq>{}` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4478
    case True thus ?thesis apply auto unfolding * using closed_sing by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4479
  next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4480
    case False
31535
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4481
    { fix x l assume as:"\<forall>n::nat. x n \<in> scaleR c ` s"  "(x ---> l) sequentially"
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4482
      { fix n::nat have "scaleR (1 / c) (x n) \<in> s"
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4483
          using as(1)[THEN spec[where x=n]]
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4484
          using `c\<noteq>0` by (auto simp add: vector_smult_assoc)
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4485
      }
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4486
      moreover
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4487
      { fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4488
	hence "0 < e *\<bar>c\<bar>"  using `c\<noteq>0` mult_pos_pos[of e "abs c"] by auto
31535
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4489
	then obtain N where "\<forall>n\<ge>N. dist (x n) l < e * \<bar>c\<bar>"
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4490
          using as(2)[unfolded Lim_sequentially, THEN spec[where x="e * abs c"]] by auto
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4491
	hence "\<exists>N. \<forall>n\<ge>N. dist (scaleR (1 / c) (x n)) (scaleR (1 / c) l) < e"
31587
a7e187205fc0 remove simp add: norm_scaleR
huffman
parents: 31585
diff changeset
  4492
          unfolding dist_norm unfolding scaleR_right_diff_distrib[THEN sym]
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4493
	  using mult_imp_div_pos_less[of "abs c" _ e] `c\<noteq>0` by auto  }
31535
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4494
      hence "((\<lambda>n. scaleR (1 / c) (x n)) ---> scaleR (1 / c) l) sequentially" unfolding Lim_sequentially by auto
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4495
      ultimately have "l \<in> scaleR c ` s"
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4496
        using assms[unfolded closed_sequential_limits, THEN spec[where x="\<lambda>n. scaleR (1/c) (x n)"], THEN spec[where x="scaleR (1/c) l"]]
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4497
	unfolding image_iff using `c\<noteq>0` apply(rule_tac x="scaleR (1 / c) l" in bexI) by auto  }
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4498
    thus ?thesis unfolding closed_sequential_limits by fast
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4499
  qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4500
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4501
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4502
lemma closed_negations:
31535
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4503
  fixes s :: "'a::real_normed_vector set"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4504
  assumes "closed s"  shows "closed ((\<lambda>x. -x) ` s)"
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  4505
  using closed_scaling[OF assms, of "- 1"] by simp
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4506
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4507
lemma compact_closed_sums:
31535
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4508
  fixes s :: "'a::real_normed_vector set"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4509
  assumes "compact s"  "closed t"  shows "closed {x + y | x y. x \<in> s \<and> y \<in> t}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4510
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4511
  let ?S = "{x + y |x y. x \<in> s \<and> y \<in> t}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4512
  { fix x l assume as:"\<forall>n. x n \<in> ?S"  "(x ---> l) sequentially"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4513
    from as(1) obtain f where f:"\<forall>n. x n = fst (f n) + snd (f n)"  "\<forall>n. fst (f n) \<in> s"  "\<forall>n. snd (f n) \<in> t"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4514
      using choice[of "\<lambda>n y. x n = (fst y) + (snd y) \<and> fst y \<in> s \<and> snd y \<in> t"] by auto
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  4515
    obtain l' r where "l'\<in>s" and r:"subseq r" and lr:"(((\<lambda>n. fst (f n)) \<circ> r) ---> l') sequentially"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4516
      using assms(1)[unfolded compact_def, THEN spec[where x="\<lambda> n. fst (f n)"]] using f(2) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4517
    have "((\<lambda>n. snd (f (r n))) ---> l - l') sequentially"
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  4518
      using Lim_sub[OF lim_subseq[OF r as(2)] lr] and f(1) unfolding o_def by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4519
    hence "l - l' \<in> t"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4520
      using assms(2)[unfolded closed_sequential_limits, THEN spec[where x="\<lambda> n. snd (f (r n))"], THEN spec[where x="l - l'"]]
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4521
      using f(3) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4522
    hence "l \<in> ?S" using `l' \<in> s` apply auto apply(rule_tac x=l' in exI) apply(rule_tac x="l - l'" in exI) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4523
  }
31535
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4524
  thus ?thesis unfolding closed_sequential_limits by fast
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4525
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4526
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4527
lemma closed_compact_sums:
31535
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4528
  fixes s t :: "'a::real_normed_vector set"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4529
  assumes "closed s"  "compact t"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4530
  shows "closed {x + y | x y. x \<in> s \<and> y \<in> t}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4531
proof-
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4532
  have "{x + y |x y. x \<in> t \<and> y \<in> s} = {x + y |x y. x \<in> s \<and> y \<in> t}" apply auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4533
    apply(rule_tac x=y in exI) apply auto apply(rule_tac x=y in exI) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4534
  thus ?thesis using compact_closed_sums[OF assms(2,1)] by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4535
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4536
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4537
lemma compact_closed_differences:
31535
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4538
  fixes s t :: "'a::real_normed_vector set"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4539
  assumes "compact s"  "closed t"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4540
  shows "closed {x - y | x y. x \<in> s \<and> y \<in> t}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4541
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4542
  have "{x + y |x y. x \<in> s \<and> y \<in> uminus ` t} =  {x - y |x y. x \<in> s \<and> y \<in> t}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4543
    apply auto apply(rule_tac x=xa in exI) apply auto apply(rule_tac x=xa in exI) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4544
  thus ?thesis using compact_closed_sums[OF assms(1) closed_negations[OF assms(2)]] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4545
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4546
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4547
lemma closed_compact_differences:
31535
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4548
  fixes s t :: "'a::real_normed_vector set"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4549
  assumes "closed s" "compact t"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4550
  shows "closed {x - y | x y. x \<in> s \<and> y \<in> t}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4551
proof-
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4552
  have "{x + y |x y. x \<in> s \<and> y \<in> uminus ` t} = {x - y |x y. x \<in> s \<and> y \<in> t}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4553
    apply auto apply(rule_tac x=xa in exI) apply auto apply(rule_tac x=xa in exI) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4554
 thus ?thesis using closed_compact_sums[OF assms(1) compact_negations[OF assms(2)]] by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4555
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4556
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4557
lemma closed_translation:
31535
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4558
  fixes a :: "'a::real_normed_vector"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4559
  assumes "closed s"  shows "closed ((\<lambda>x. a + x) ` s)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4560
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4561
  have "{a + y |y. y \<in> s} = (op + a ` s)" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4562
  thus ?thesis using compact_closed_sums[OF compact_sing[of a] assms] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4563
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4564
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4565
lemma translation_UNIV:
31535
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4566
  fixes a :: "'a::ab_group_add" shows "range (\<lambda>x. a + x) = UNIV"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4567
  apply (auto simp add: image_iff) apply(rule_tac x="x - a" in exI) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4568
31535
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4569
lemma translation_diff:
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4570
  fixes a :: "'a::ab_group_add"
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4571
  shows "(\<lambda>x. a + x) ` (s - t) = ((\<lambda>x. a + x) ` s) - ((\<lambda>x. a + x) ` t)"
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4572
  by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4573
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4574
lemma closure_translation:
31535
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4575
  fixes a :: "'a::real_normed_vector"
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  4576
  shows "closure ((\<lambda>x. a + x) ` s) = (\<lambda>x. a + x) ` (closure s)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4577
proof-
31535
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4578
  have *:"op + a ` (UNIV - s) = UNIV - op + a ` s"
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4579
    apply auto unfolding image_iff apply(rule_tac x="x - a" in bexI) by auto
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4580
  show ?thesis unfolding closure_interior translation_diff translation_UNIV
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4581
    using interior_translation[of a "UNIV - s"] unfolding * by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4582
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4583
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4584
lemma frontier_translation:
31535
f5bde0d3c385 generalize compact/closure lemmas
huffman
parents: 31534
diff changeset
  4585
  fixes a :: "'a::real_normed_vector"
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  4586
  shows "frontier((\<lambda>x. a + x) ` s) = (\<lambda>x. a + x) ` (frontier s)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4587
  unfolding frontier_def translation_diff interior_translation closure_translation by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4588
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4589
subsection{* Separation between points and sets.                                       *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4590
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4591
lemma separate_point_closed:
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4592
  fixes s :: "'a::heine_borel set"
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  4593
  shows "closed s \<Longrightarrow> a \<notin> s  ==> (\<exists>d>0. \<forall>x\<in>s. d \<le> dist a x)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4594
proof(cases "s = {}")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4595
  case True
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4596
  thus ?thesis by(auto intro!: exI[where x=1])
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4597
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4598
  case False
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4599
  assume "closed s" "a \<notin> s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4600
  then obtain x where "x\<in>s" "\<forall>y\<in>s. dist a x \<le> dist a y" using `s \<noteq> {}` distance_attains_inf [of s a] by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4601
  with `x\<in>s` show ?thesis using dist_pos_lt[of a x] and`a \<notin> s` by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4602
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4603
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4604
lemma separate_compact_closed:
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4605
  fixes s t :: "'a::{heine_borel, real_normed_vector} set"
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4606
    (* TODO: does this generalize to heine_borel? *)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4607
  assumes "compact s" and "closed t" and "s \<inter> t = {}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4608
  shows "\<exists>d>0. \<forall>x\<in>s. \<forall>y\<in>t. d \<le> dist x y"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4609
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4610
  have "0 \<notin> {x - y |x y. x \<in> s \<and> y \<in> t}" using assms(3) by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4611
  then obtain d where "d>0" and d:"\<forall>x\<in>{x - y |x y. x \<in> s \<and> y \<in> t}. d \<le> dist 0 x"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4612
    using separate_point_closed[OF compact_closed_differences[OF assms(1,2)], of 0] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4613
  { fix x y assume "x\<in>s" "y\<in>t"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4614
    hence "x - y \<in> {x - y |x y. x \<in> s \<and> y \<in> t}" by auto
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  4615
    hence "d \<le> dist (x - y) 0" using d[THEN bspec[where x="x - y"]] using dist_commute
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  4616
      by (auto  simp add: dist_commute)
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  4617
    hence "d \<le> dist x y" unfolding dist_norm by auto  }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4618
  thus ?thesis using `d>0` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4619
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4620
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4621
lemma separate_closed_compact:
31569
f11a849bab61 generalize lemmas
huffman
parents: 31565
diff changeset
  4622
  fixes s t :: "'a::{heine_borel, real_normed_vector} set"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4623
  assumes "closed s" and "compact t" and "s \<inter> t = {}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4624
  shows "\<exists>d>0. \<forall>x\<in>s. \<forall>y\<in>t. d \<le> dist x y"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4625
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4626
  have *:"t \<inter> s = {}" using assms(3) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4627
  show ?thesis using separate_compact_closed[OF assms(2,1) *]
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4628
    apply auto apply(rule_tac x=d in exI) apply auto apply (erule_tac x=y in ballE)
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  4629
    by (auto simp add: dist_commute)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4630
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4631
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4632
(* A cute way of denoting open and closed intervals using overloading.       *)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4633
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4634
lemma interval: fixes a :: "'a::ord^'n::finite" shows
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4635
  "{a <..< b} = {x::'a^'n. \<forall>i. a$i < x$i \<and> x$i < b$i}" and
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4636
  "{a .. b} = {x::'a^'n. \<forall>i. a$i \<le> x$i \<and> x$i \<le> b$i}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4637
  by (auto simp add: expand_set_eq vector_less_def vector_less_eq_def)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4638
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4639
lemma mem_interval: fixes a :: "'a::ord^'n::finite" shows
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4640
  "x \<in> {a<..<b} \<longleftrightarrow> (\<forall>i. a$i < x$i \<and> x$i < b$i)"
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4641
  "x \<in> {a .. b} \<longleftrightarrow> (\<forall>i. a$i \<le> x$i \<and> x$i \<le> b$i)"
31282
b98cbfabe824 Moved some lemmas about intervals to Topology
himmelma
parents: 31281
diff changeset
  4642
  using interval[of a b] by(auto simp add: expand_set_eq vector_less_def vector_less_eq_def)
b98cbfabe824 Moved some lemmas about intervals to Topology
himmelma
parents: 31281
diff changeset
  4643
b98cbfabe824 Moved some lemmas about intervals to Topology
himmelma
parents: 31281
diff changeset
  4644
lemma mem_interval_1: fixes x :: "real^1" shows
b98cbfabe824 Moved some lemmas about intervals to Topology
himmelma
parents: 31281
diff changeset
  4645
 "(x \<in> {a .. b} \<longleftrightarrow> dest_vec1 a \<le> dest_vec1 x \<and> dest_vec1 x \<le> dest_vec1 b)"
b98cbfabe824 Moved some lemmas about intervals to Topology
himmelma
parents: 31281
diff changeset
  4646
 "(x \<in> {a<..<b} \<longleftrightarrow> dest_vec1 a < dest_vec1 x \<and> dest_vec1 x < dest_vec1 b)"
b98cbfabe824 Moved some lemmas about intervals to Topology
himmelma
parents: 31281
diff changeset
  4647
by(simp_all add: Cart_eq vector_less_def vector_less_eq_def dest_vec1_def forall_1)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4648
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4649
lemma interval_eq_empty: fixes a :: "real^'n::finite" shows
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4650
 "({a <..< b} = {} \<longleftrightarrow> (\<exists>i. b$i \<le> a$i))" (is ?th1) and
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4651
 "({a  ..  b} = {} \<longleftrightarrow> (\<exists>i. b$i < a$i))" (is ?th2)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4652
proof-
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4653
  { fix i x assume as:"b$i \<le> a$i" and x:"x\<in>{a <..< b}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4654
    hence "a $ i < x $ i \<and> x $ i < b $ i" unfolding mem_interval by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4655
    hence "a$i < b$i" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4656
    hence False using as by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4657
  moreover
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4658
  { assume as:"\<forall>i. \<not> (b$i \<le> a$i)"
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4659
    let ?x = "(1/2) *\<^sub>R (a + b)"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4660
    { fix i
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4661
      have "a$i < b$i" using as[THEN spec[where x=i]] by auto
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4662
      hence "a$i < ((1/2) *\<^sub>R (a+b)) $ i" "((1/2) *\<^sub>R (a+b)) $ i < b$i"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4663
	unfolding vector_smult_component and vector_add_component
30654
254478a8dd05 dropped theory Arith_Tools
haftmann
parents: 30582
diff changeset
  4664
	by (auto simp add: less_divide_eq_number_of1)  }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4665
    hence "{a <..< b} \<noteq> {}" using mem_interval(1)[of "?x" a b] by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4666
  ultimately show ?th1 by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4667
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4668
  { fix i x assume as:"b$i < a$i" and x:"x\<in>{a .. b}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4669
    hence "a $ i \<le> x $ i \<and> x $ i \<le> b $ i" unfolding mem_interval by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4670
    hence "a$i \<le> b$i" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4671
    hence False using as by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4672
  moreover
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4673
  { assume as:"\<forall>i. \<not> (b$i < a$i)"
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4674
    let ?x = "(1/2) *\<^sub>R (a + b)"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4675
    { fix i
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4676
      have "a$i \<le> b$i" using as[THEN spec[where x=i]] by auto
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4677
      hence "a$i \<le> ((1/2) *\<^sub>R (a+b)) $ i" "((1/2) *\<^sub>R (a+b)) $ i \<le> b$i"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4678
	unfolding vector_smult_component and vector_add_component
30654
254478a8dd05 dropped theory Arith_Tools
haftmann
parents: 30582
diff changeset
  4679
	by (auto simp add: less_divide_eq_number_of1)  }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4680
    hence "{a .. b} \<noteq> {}" using mem_interval(2)[of "?x" a b] by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4681
  ultimately show ?th2 by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4682
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4683
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4684
lemma interval_ne_empty: fixes a :: "real^'n::finite" shows
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4685
  "{a  ..  b} \<noteq> {} \<longleftrightarrow> (\<forall>i. a$i \<le> b$i)" and
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4686
  "{a <..< b} \<noteq> {} \<longleftrightarrow> (\<forall>i. a$i < b$i)"
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4687
  unfolding interval_eq_empty[of a b] by (auto simp add: not_less not_le) (* BH: Why doesn't just "auto" work here? *)
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4688
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4689
lemma subset_interval_imp: fixes a :: "real^'n::finite" shows
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4690
 "(\<forall>i. a$i \<le> c$i \<and> d$i \<le> b$i) \<Longrightarrow> {c .. d} \<subseteq> {a .. b}" and
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4691
 "(\<forall>i. a$i < c$i \<and> d$i < b$i) \<Longrightarrow> {c .. d} \<subseteq> {a<..<b}" and
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4692
 "(\<forall>i. a$i \<le> c$i \<and> d$i \<le> b$i) \<Longrightarrow> {c<..<d} \<subseteq> {a .. b}" and
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4693
 "(\<forall>i. a$i \<le> c$i \<and> d$i \<le> b$i) \<Longrightarrow> {c<..<d} \<subseteq> {a<..<b}"
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4694
  unfolding subset_eq[unfolded Ball_def] unfolding mem_interval
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4695
  by (auto intro: order_trans less_le_trans le_less_trans less_imp_le) (* BH: Why doesn't just "auto" work here? *)
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4696
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4697
lemma interval_sing: fixes a :: "'a::linorder^'n::finite" shows
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4698
 "{a .. a} = {a} \<and> {a<..<a} = {}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4699
apply(auto simp add: expand_set_eq vector_less_def vector_less_eq_def Cart_eq)
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4700
apply (simp add: order_eq_iff)
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4701
apply (auto simp add: not_less less_imp_le)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4702
done
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4703
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4704
lemma interval_open_subset_closed:  fixes a :: "'a::preorder^'n::finite" shows
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4705
 "{a<..<b} \<subseteq> {a .. b}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4706
proof(simp add: subset_eq, rule)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4707
  fix x
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4708
  assume x:"x \<in>{a<..<b}"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4709
  { fix i
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4710
    have "a $ i \<le> x $ i"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4711
      using x order_less_imp_le[of "a$i" "x$i"]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4712
      by(simp add: expand_set_eq vector_less_def vector_less_eq_def Cart_eq)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4713
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4714
  moreover
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4715
  { fix i
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4716
    have "x $ i \<le> b $ i"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4717
      using x order_less_imp_le[of "x$i" "b$i"]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4718
      by(simp add: expand_set_eq vector_less_def vector_less_eq_def Cart_eq)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4719
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4720
  ultimately
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4721
  show "a \<le> x \<and> x \<le> b"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4722
    by(simp add: expand_set_eq vector_less_def vector_less_eq_def Cart_eq)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4723
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4724
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4725
lemma subset_interval: fixes a :: "real^'n::finite" shows
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4726
 "{c .. d} \<subseteq> {a .. b} \<longleftrightarrow> (\<forall>i. c$i \<le> d$i) --> (\<forall>i. a$i \<le> c$i \<and> d$i \<le> b$i)" (is ?th1) and
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4727
 "{c .. d} \<subseteq> {a<..<b} \<longleftrightarrow> (\<forall>i. c$i \<le> d$i) --> (\<forall>i. a$i < c$i \<and> d$i < b$i)" (is ?th2) and
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4728
 "{c<..<d} \<subseteq> {a .. b} \<longleftrightarrow> (\<forall>i. c$i < d$i) --> (\<forall>i. a$i \<le> c$i \<and> d$i \<le> b$i)" (is ?th3) and
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4729
 "{c<..<d} \<subseteq> {a<..<b} \<longleftrightarrow> (\<forall>i. c$i < d$i) --> (\<forall>i. a$i \<le> c$i \<and> d$i \<le> b$i)" (is ?th4)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4730
proof-
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4731
  show ?th1 unfolding subset_eq and Ball_def and mem_interval by (auto intro: order_trans)
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4732
  show ?th2 unfolding subset_eq and Ball_def and mem_interval by (auto intro: le_less_trans less_le_trans order_trans less_imp_le)
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4733
  { assume as: "{c<..<d} \<subseteq> {a .. b}" "\<forall>i. c$i < d$i"
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4734
    hence "{c<..<d} \<noteq> {}" unfolding interval_eq_empty by (auto, drule_tac x=i in spec, simp) (* BH: Why doesn't just "auto" work? *)
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4735
    fix i
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4736
    (** TODO combine the following two parts as done in the HOL_light version. **)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4737
    { let ?x = "(\<chi> j. (if j=i then ((min (a$j) (d$j))+c$j)/2 else (c$j+d$j)/2))::real^'n"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4738
      assume as2: "a$i > c$i"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4739
      { fix j
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4740
	have "c $ j < ?x $ j \<and> ?x $ j < d $ j" unfolding Cart_lambda_beta
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4741
	  apply(cases "j=i") using as(2)[THEN spec[where x=j]]
30654
254478a8dd05 dropped theory Arith_Tools
haftmann
parents: 30582
diff changeset
  4742
	  by (auto simp add: less_divide_eq_number_of1 as2)  }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4743
      hence "?x\<in>{c<..<d}" unfolding mem_interval by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4744
      moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4745
      have "?x\<notin>{a .. b}"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4746
	unfolding mem_interval apply auto apply(rule_tac x=i in exI)
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4747
	using as(2)[THEN spec[where x=i]] and as2
30654
254478a8dd05 dropped theory Arith_Tools
haftmann
parents: 30582
diff changeset
  4748
	by (auto simp add: less_divide_eq_number_of1)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4749
      ultimately have False using as by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4750
    hence "a$i \<le> c$i" by(rule ccontr)auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4751
    moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4752
    { let ?x = "(\<chi> j. (if j=i then ((max (b$j) (c$j))+d$j)/2 else (c$j+d$j)/2))::real^'n"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4753
      assume as2: "b$i < d$i"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4754
      { fix j
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4755
	have "d $ j > ?x $ j \<and> ?x $ j > c $ j" unfolding Cart_lambda_beta
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4756
	  apply(cases "j=i") using as(2)[THEN spec[where x=j]]
30654
254478a8dd05 dropped theory Arith_Tools
haftmann
parents: 30582
diff changeset
  4757
	  by (auto simp add: less_divide_eq_number_of1 as2)  }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4758
      hence "?x\<in>{c<..<d}" unfolding mem_interval by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4759
      moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4760
      have "?x\<notin>{a .. b}"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4761
	unfolding mem_interval apply auto apply(rule_tac x=i in exI)
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4762
	using as(2)[THEN spec[where x=i]] and as2
30654
254478a8dd05 dropped theory Arith_Tools
haftmann
parents: 30582
diff changeset
  4763
	by (auto simp add: less_divide_eq_number_of1)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4764
      ultimately have False using as by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4765
    hence "b$i \<ge> d$i" by(rule ccontr)auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4766
    ultimately
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4767
    have "a$i \<le> c$i \<and> d$i \<le> b$i" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4768
  } note part1 = this
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4769
  thus ?th3 unfolding subset_eq and Ball_def and mem_interval apply auto apply (erule_tac x=ia in allE, simp)+ by (erule_tac x=i in allE, erule_tac x=i in allE, simp)+
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4770
  { assume as:"{c<..<d} \<subseteq> {a<..<b}" "\<forall>i. c$i < d$i"
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4771
    fix i
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4772
    from as(1) have "{c<..<d} \<subseteq> {a..b}" using interval_open_subset_closed[of a b] by auto
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4773
    hence "a$i \<le> c$i \<and> d$i \<le> b$i" using part1 and as(2) by auto  } note * = this
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4774
  thus ?th4 unfolding subset_eq and Ball_def and mem_interval apply auto apply (erule_tac x=ia in allE, simp)+ by (erule_tac x=i in allE, erule_tac x=i in allE, simp)+
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4775
qed
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4776
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4777
lemma disjoint_interval: fixes a::"real^'n::finite" shows
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4778
  "{a .. b} \<inter> {c .. d} = {} \<longleftrightarrow> (\<exists>i. (b$i < a$i \<or> d$i < c$i \<or> b$i < c$i \<or> d$i < a$i))" (is ?th1) and
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4779
  "{a .. b} \<inter> {c<..<d} = {} \<longleftrightarrow> (\<exists>i. (b$i < a$i \<or> d$i \<le> c$i \<or> b$i \<le> c$i \<or> d$i \<le> a$i))" (is ?th2) and
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4780
  "{a<..<b} \<inter> {c .. d} = {} \<longleftrightarrow> (\<exists>i. (b$i \<le> a$i \<or> d$i < c$i \<or> b$i \<le> c$i \<or> d$i \<le> a$i))" (is ?th3) and
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4781
  "{a<..<b} \<inter> {c<..<d} = {} \<longleftrightarrow> (\<exists>i. (b$i \<le> a$i \<or> d$i \<le> c$i \<or> b$i \<le> c$i \<or> d$i \<le> a$i))" (is ?th4)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4782
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4783
  let ?z = "(\<chi> i. ((max (a$i) (c$i)) + (min (b$i) (d$i))) / 2)::real^'n"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4784
  show ?th1 ?th2 ?th3 ?th4
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4785
  unfolding expand_set_eq and Int_iff and empty_iff and mem_interval and all_conj_distrib[THEN sym] and eq_False
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4786
  apply (auto elim!: allE[where x="?z"])
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4787
  apply ((rule_tac x=x in exI, force) | (rule_tac x=i in exI, force))+
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4788
  done
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4789
qed
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4790
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4791
lemma inter_interval: fixes a :: "'a::linorder^'n::finite" shows
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4792
 "{a .. b} \<inter> {c .. d} =  {(\<chi> i. max (a$i) (c$i)) .. (\<chi> i. min (b$i) (d$i))}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4793
  unfolding expand_set_eq and Int_iff and mem_interval
30654
254478a8dd05 dropped theory Arith_Tools
haftmann
parents: 30582
diff changeset
  4794
  by (auto simp add: less_divide_eq_number_of1 intro!: bexI)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4795
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4796
(* Moved interval_open_subset_closed a bit upwards *)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4797
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4798
lemma open_interval_lemma: fixes x :: "real" shows
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4799
 "a < x \<Longrightarrow> x < b ==> (\<exists>d>0. \<forall>x'. abs(x' - x) < d --> a < x' \<and> x' < b)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4800
  by(rule_tac x="min (x - a) (b - x)" in exI, auto)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4801
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4802
lemma open_interval: fixes a :: "real^'n::finite" shows "open {a<..<b}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4803
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4804
  { fix x assume x:"x\<in>{a<..<b}"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4805
    { fix i
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4806
      have "\<exists>d>0. \<forall>x'. abs (x' - (x$i)) < d \<longrightarrow> a$i < x' \<and> x' < b$i"
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4807
	using x[unfolded mem_interval, THEN spec[where x=i]]
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4808
	using open_interval_lemma[of "a$i" "x$i" "b$i"] by auto  }
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4809
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4810
    hence "\<forall>i. \<exists>d>0. \<forall>x'. abs (x' - (x$i)) < d \<longrightarrow> a$i < x' \<and> x' < b$i" by auto
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4811
    then obtain d where d:"\<forall>i. 0 < d i \<and> (\<forall>x'. \<bar>x' - x $ i\<bar> < d i \<longrightarrow> a $ i < x' \<and> x' < b $ i)"
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4812
      using bchoice[of "UNIV" "\<lambda>i d. d>0 \<and> (\<forall>x'. \<bar>x' - x $ i\<bar> < d \<longrightarrow> a $ i < x' \<and> x' < b $ i)"] by auto
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4813
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4814
    let ?d = "Min (range d)"
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4815
    have **:"finite (range d)" "range d \<noteq> {}" by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4816
    have "?d>0" unfolding Min_gr_iff[OF **] using d by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4817
    moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4818
    { fix x' assume as:"dist x' x < ?d"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4819
      { fix i
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4820
	have "\<bar>x'$i - x $ i\<bar> < d i"
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  4821
	  using norm_bound_component_lt[OF as[unfolded dist_norm], of i]
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4822
	  unfolding vector_minus_component and Min_gr_iff[OF **] by auto
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4823
	hence "a $ i < x' $ i" "x' $ i < b $ i" using d[THEN spec[where x=i]] by auto  }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4824
      hence "a < x' \<and> x' < b" unfolding vector_less_def by auto  }
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4825
    ultimately have "\<exists>e>0. \<forall>x'. dist x' x < e \<longrightarrow> x' \<in> {a<..<b}" by (auto, rule_tac x="?d" in exI, simp)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4826
  }
31418
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
  4827
  thus ?thesis unfolding open_dist using open_interval_lemma by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4828
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4829
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4830
lemma closed_interval: fixes a :: "real^'n::finite" shows "closed {a .. b}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4831
proof-
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4832
  { fix x i assume as:"\<forall>e>0. \<exists>x'\<in>{a..b}. x' \<noteq> x \<and> dist x' x < e"(* and xab:"a$i > x$i \<or> b$i < x$i"*)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4833
    { assume xa:"a$i > x$i"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4834
      with as obtain y where y:"y\<in>{a..b}" "y \<noteq> x" "dist y x < a$i - x$i" by(erule_tac x="a$i - x$i" in allE)auto
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  4835
      hence False unfolding mem_interval and dist_norm
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4836
	using component_le_norm[of "y-x" i, unfolded vector_minus_component] and xa by(auto elim!: allE[where x=i])
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4837
    } hence "a$i \<le> x$i" by(rule ccontr)auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4838
    moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4839
    { assume xb:"b$i < x$i"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4840
      with as obtain y where y:"y\<in>{a..b}" "y \<noteq> x" "dist y x < x$i - b$i" by(erule_tac x="x$i - b$i" in allE)auto
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  4841
      hence False unfolding mem_interval and dist_norm
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4842
	using component_le_norm[of "y-x" i, unfolded vector_minus_component] and xb by(auto elim!: allE[where x=i])
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4843
    } hence "x$i \<le> b$i" by(rule ccontr)auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4844
    ultimately
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4845
    have "a $ i \<le> x $ i \<and> x $ i \<le> b $ i" by auto }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4846
  thus ?thesis unfolding closed_limpt islimpt_approachable mem_interval by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4847
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4848
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4849
lemma interior_closed_interval: fixes a :: "real^'n::finite" shows
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4850
 "interior {a .. b} = {a<..<b}" (is "?L = ?R")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4851
proof(rule subset_antisym)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4852
  show "?R \<subseteq> ?L" using interior_maximal[OF interval_open_subset_closed open_interval] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4853
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4854
  { fix x assume "\<exists>T. open T \<and> x \<in> T \<and> T \<subseteq> {a..b}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4855
    then obtain s where s:"open s" "x \<in> s" "s \<subseteq> {a..b}" by auto
31418
9baa48bad81c generalize some constants and lemmas to class topological_space
huffman
parents: 31402
diff changeset
  4856
    then obtain e where "e>0" and e:"\<forall>x'. dist x' x < e \<longrightarrow> x' \<in> {a..b}" unfolding open_dist and subset_eq by auto
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4857
    { fix i
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4858
      have "dist (x - (e / 2) *\<^sub>R basis i) x < e"
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4859
	   "dist (x + (e / 2) *\<^sub>R basis i) x < e"
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  4860
	unfolding dist_norm apply auto
31587
a7e187205fc0 remove simp add: norm_scaleR
huffman
parents: 31585
diff changeset
  4861
	unfolding norm_minus_cancel using norm_basis[of i] and `e>0` by auto
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4862
      hence "a $ i \<le> (x - (e / 2) *\<^sub>R basis i) $ i"
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4863
                    "(x + (e / 2) *\<^sub>R basis i) $ i \<le> b $ i"
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4864
	using e[THEN spec[where x="x - (e/2) *\<^sub>R basis i"]]
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4865
	and   e[THEN spec[where x="x + (e/2) *\<^sub>R basis i"]]
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4866
	unfolding mem_interval by (auto elim!: allE[where x=i])
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4867
      hence "a $ i < x $ i" and "x $ i < b $ i"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4868
	unfolding vector_minus_component and vector_add_component
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4869
	unfolding vector_smult_component and basis_component using `e>0` by auto   }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4870
    hence "x \<in> {a<..<b}" unfolding mem_interval by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4871
  thus "?L \<subseteq> ?R" unfolding interior_def and subset_eq by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4872
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4873
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4874
lemma bounded_closed_interval: fixes a :: "real^'n::finite" shows
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4875
 "bounded {a .. b}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4876
proof-
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4877
  let ?b = "\<Sum>i\<in>UNIV. \<bar>a$i\<bar> + \<bar>b$i\<bar>"
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4878
  { fix x::"real^'n" assume x:"\<forall>i. a $ i \<le> x $ i \<and> x $ i \<le> b $ i"
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4879
    { fix i
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4880
      have "\<bar>x$i\<bar> \<le> \<bar>a$i\<bar> + \<bar>b$i\<bar>" using x[THEN spec[where x=i]] by auto  }
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4881
    hence "(\<Sum>i\<in>UNIV. \<bar>x $ i\<bar>) \<le> ?b" by(rule setsum_mono)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4882
    hence "norm x \<le> ?b" using norm_le_l1[of x] by auto  }
31533
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  4883
  thus ?thesis unfolding interval and bounded_iff by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4884
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4885
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4886
lemma bounded_interval: fixes a :: "real^'n::finite" shows
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4887
 "bounded {a .. b} \<and> bounded {a<..<b}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4888
  using bounded_closed_interval[of a b]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4889
  using interval_open_subset_closed[of a b]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4890
  using bounded_subset[of "{a..b}" "{a<..<b}"]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4891
  by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4892
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4893
lemma not_interval_univ: fixes a :: "real^'n::finite" shows
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4894
 "({a .. b} \<noteq> UNIV) \<and> ({a<..<b} \<noteq> UNIV)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4895
  using bounded_interval[of a b]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4896
  by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4897
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4898
lemma compact_interval: fixes a :: "real^'n::finite" shows
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4899
 "compact {a .. b}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4900
  using bounded_closed_imp_compact using bounded_interval[of a b] using closed_interval[of a b] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4901
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4902
lemma open_interval_midpoint: fixes a :: "real^'n::finite"
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4903
  assumes "{a<..<b} \<noteq> {}" shows "((1/2) *\<^sub>R (a + b)) \<in> {a<..<b}"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4904
proof-
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4905
  { fix i
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4906
    have "a $ i < ((1 / 2) *\<^sub>R (a + b)) $ i \<and> ((1 / 2) *\<^sub>R (a + b)) $ i < b $ i"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4907
      using assms[unfolded interval_ne_empty, THEN spec[where x=i]]
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4908
      unfolding vector_smult_component and vector_add_component
30654
254478a8dd05 dropped theory Arith_Tools
haftmann
parents: 30582
diff changeset
  4909
      by(auto simp add: less_divide_eq_number_of1)  }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4910
  thus ?thesis unfolding mem_interval by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4911
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4912
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4913
lemma open_closed_interval_convex: fixes x :: "real^'n::finite"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4914
  assumes x:"x \<in> {a<..<b}" and y:"y \<in> {a .. b}" and e:"0 < e" "e \<le> 1"
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4915
  shows "(e *\<^sub>R x + (1 - e) *\<^sub>R y) \<in> {a<..<b}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4916
proof-
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4917
  { fix i
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4918
    have "a $ i = e * a$i + (1 - e) * a$i" unfolding left_diff_distrib by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4919
    also have "\<dots> < e * x $ i + (1 - e) * y $ i" apply(rule add_less_le_mono)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4920
      using e unfolding mult_less_cancel_left and mult_le_cancel_left apply simp_all
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4921
      using x unfolding mem_interval  apply simp
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4922
      using y unfolding mem_interval  apply simp
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4923
      done
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4924
    finally have "a $ i < (e *\<^sub>R x + (1 - e) *\<^sub>R y) $ i" by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4925
    moreover {
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4926
    have "b $ i = e * b$i + (1 - e) * b$i" unfolding left_diff_distrib by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4927
    also have "\<dots> > e * x $ i + (1 - e) * y $ i" apply(rule add_less_le_mono)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4928
      using e unfolding mult_less_cancel_left and mult_le_cancel_left apply simp_all
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4929
      using x unfolding mem_interval  apply simp
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4930
      using y unfolding mem_interval  apply simp
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4931
      done
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4932
    finally have "(e *\<^sub>R x + (1 - e) *\<^sub>R y) $ i < b $ i" by auto
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4933
    } ultimately have "a $ i < (e *\<^sub>R x + (1 - e) *\<^sub>R y) $ i \<and> (e *\<^sub>R x + (1 - e) *\<^sub>R y) $ i < b $ i" by auto }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4934
  thus ?thesis unfolding mem_interval by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4935
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4936
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4937
lemma closure_open_interval: fixes a :: "real^'n::finite"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4938
  assumes "{a<..<b} \<noteq> {}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4939
  shows "closure {a<..<b} = {a .. b}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4940
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4941
  have ab:"a < b" using assms[unfolded interval_ne_empty] unfolding vector_less_def by auto
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4942
  let ?c = "(1 / 2) *\<^sub>R (a + b)"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4943
  { fix x assume as:"x \<in> {a .. b}"
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4944
    def f == "\<lambda>n::nat. x + (inverse (real n + 1)) *\<^sub>R (?c - x)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4945
    { fix n assume fn:"f n < b \<longrightarrow> a < f n \<longrightarrow> f n = x" and xc:"x \<noteq> ?c"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4946
      have *:"0 < inverse (real n + 1)" "inverse (real n + 1) \<le> 1" unfolding inverse_le_1_iff by auto
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4947
      have "(inverse (real n + 1)) *\<^sub>R ((1 / 2) *\<^sub>R (a + b)) + (1 - inverse (real n + 1)) *\<^sub>R x =
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4948
	x + (inverse (real n + 1)) *\<^sub>R (((1 / 2) *\<^sub>R (a + b)) - x)"
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4949
        by (auto simp add: algebra_simps)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4950
      hence "f n < b" and "a < f n" using open_closed_interval_convex[OF open_interval_midpoint[OF assms] as *] unfolding f_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4951
      hence False using fn unfolding f_def using xc by(auto simp add: vector_mul_lcancel vector_ssub_ldistrib)  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4952
    moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4953
    { assume "\<not> (f ---> x) sequentially"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4954
      { fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4955
	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
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4956
	then obtain N::nat where "inverse (real (N + 1)) < e" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4957
	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)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4958
	hence "\<exists>N::nat. \<forall>n\<ge>N. inverse (real n + 1) < e" by auto  }
31558
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4959
      hence "((\<lambda>n. inverse (real n + 1)) ---> 0) sequentially"
e7a282113145 remove uses of vec1 in continuity lemmas
huffman
parents: 31537
diff changeset
  4960
	unfolding Lim_sequentially by(auto simp add: dist_norm)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4961
      hence "(f ---> x) sequentially" unfolding f_def
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4962
	using Lim_add[OF Lim_const, of "\<lambda>n::nat. (inverse (real n + 1)) *\<^sub>R ((1 / 2) *\<^sub>R (a + b) - x)" 0 sequentially x]
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  4963
	using Lim_vmul[of "\<lambda>n::nat. inverse (real n + 1)" 0 sequentially "((1 / 2) *\<^sub>R (a + b) - x)"] by auto  }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4964
    ultimately have "x \<in> closure {a<..<b}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4965
      using as and open_interval_midpoint[OF assms] unfolding closure_def unfolding islimpt_sequential by(cases "x=?c")auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4966
  thus ?thesis using closure_minimal[OF interval_open_subset_closed closed_interval, of a b] by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4967
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4968
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4969
lemma bounded_subset_open_interval_symmetric: fixes s::"(real^'n::finite) set"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4970
  assumes "bounded s"  shows "\<exists>a. s \<subseteq> {-a<..<a}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4971
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4972
  obtain b where "b>0" and b:"\<forall>x\<in>s. norm x \<le> b" using assms[unfolded bounded_pos] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4973
  def a \<equiv> "(\<chi> i. b+1)::real^'n"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4974
  { fix x assume "x\<in>s"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4975
    fix i
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4976
    have "(-a)$i < x$i" and "x$i < a$i" using b[THEN bspec[where x=x], OF `x\<in>s`] and component_le_norm[of x i]
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  4977
      unfolding vector_uminus_component and a_def and Cart_lambda_beta by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4978
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4979
  thus ?thesis by(auto intro: exI[where x=a] simp add: vector_less_def)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4980
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4981
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4982
lemma bounded_subset_open_interval:
31400
d671d74b2d1d generalize type of bounded
huffman
parents: 31397
diff changeset
  4983
  fixes s :: "(real ^ 'n::finite) set"
d671d74b2d1d generalize type of bounded
huffman
parents: 31397
diff changeset
  4984
  shows "bounded s ==> (\<exists>a b. s \<subseteq> {a<..<b})"
d671d74b2d1d generalize type of bounded
huffman
parents: 31397
diff changeset
  4985
  by (auto dest!: bounded_subset_open_interval_symmetric)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4986
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4987
lemma bounded_subset_closed_interval_symmetric:
31400
d671d74b2d1d generalize type of bounded
huffman
parents: 31397
diff changeset
  4988
  fixes s :: "(real ^ 'n::finite) set"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4989
  assumes "bounded s" shows "\<exists>a. s \<subseteq> {-a .. a}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4990
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4991
  obtain a where "s \<subseteq> {- a<..<a}" using bounded_subset_open_interval_symmetric[OF assms] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4992
  thus ?thesis using interval_open_subset_closed[of "-a" a] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4993
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4994
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  4995
lemma bounded_subset_closed_interval:
31400
d671d74b2d1d generalize type of bounded
huffman
parents: 31397
diff changeset
  4996
  fixes s :: "(real ^ 'n::finite) set"
d671d74b2d1d generalize type of bounded
huffman
parents: 31397
diff changeset
  4997
  shows "bounded s ==> (\<exists>a b. s \<subseteq> {a .. b})"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4998
  using bounded_subset_closed_interval_symmetric[of s] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  4999
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5000
lemma frontier_closed_interval:
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  5001
  fixes a b :: "real ^ _"
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  5002
  shows "frontier {a .. b} = {a .. b} - {a<..<b}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5003
  unfolding frontier_def unfolding interior_closed_interval and closure_closed[OF closed_interval] ..
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5004
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5005
lemma frontier_open_interval:
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  5006
  fixes a b :: "real ^ _"
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  5007
  shows "frontier {a<..<b} = (if {a<..<b} = {} then {} else {a .. b} - {a<..<b})"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5008
proof(cases "{a<..<b} = {}")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5009
  case True thus ?thesis using frontier_empty by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5010
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5011
  case False thus ?thesis unfolding frontier_def and closure_open_interval[OF False] and interior_open[OF open_interval] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5012
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5013
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5014
lemma inter_interval_mixed_eq_empty: fixes a :: "real^'n::finite"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5015
  assumes "{c<..<d} \<noteq> {}"  shows "{a<..<b} \<inter> {c .. d} = {} \<longleftrightarrow> {a<..<b} \<inter> {c<..<d} = {}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5016
  unfolding closure_open_interval[OF assms, THEN sym] unfolding open_inter_closure_eq_empty[OF open_interval] ..
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5017
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5018
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5019
(* Some special cases for intervals in R^1.                                  *)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5020
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5021
lemma all_1: "(\<forall>x::1. P x) \<longleftrightarrow> P 1"
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5022
  by (metis num1_eq_iff)
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5023
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5024
lemma ex_1: "(\<exists>x::1. P x) \<longleftrightarrow> P 1"
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5025
  by auto (metis num1_eq_iff)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5026
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5027
lemma interval_cases_1: fixes x :: "real^1" shows
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5028
 "x \<in> {a .. b} ==> x \<in> {a<..<b} \<or> (x = a) \<or> (x = b)"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5029
  by(simp add:  Cart_eq vector_less_def vector_less_eq_def all_1, auto)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5030
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5031
lemma in_interval_1: fixes x :: "real^1" shows
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5032
 "(x \<in> {a .. b} \<longleftrightarrow> dest_vec1 a \<le> dest_vec1 x \<and> dest_vec1 x \<le> dest_vec1 b) \<and>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5033
  (x \<in> {a<..<b} \<longleftrightarrow> dest_vec1 a < dest_vec1 x \<and> dest_vec1 x < dest_vec1 b)"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5034
by(simp add: Cart_eq vector_less_def vector_less_eq_def all_1 dest_vec1_def)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5035
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5036
lemma interval_eq_empty_1: fixes a :: "real^1" shows
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5037
  "{a .. b} = {} \<longleftrightarrow> dest_vec1 b < dest_vec1 a"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5038
  "{a<..<b} = {} \<longleftrightarrow> dest_vec1 b \<le> dest_vec1 a"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5039
  unfolding interval_eq_empty and ex_1 and dest_vec1_def by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5040
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5041
lemma subset_interval_1: fixes a :: "real^1" shows
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5042
 "({a .. b} \<subseteq> {c .. d} \<longleftrightarrow>  dest_vec1 b < dest_vec1 a \<or>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5043
                dest_vec1 c \<le> dest_vec1 a \<and> dest_vec1 a \<le> dest_vec1 b \<and> dest_vec1 b \<le> dest_vec1 d)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5044
 "({a .. b} \<subseteq> {c<..<d} \<longleftrightarrow>  dest_vec1 b < dest_vec1 a \<or>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5045
                dest_vec1 c < dest_vec1 a \<and> dest_vec1 a \<le> dest_vec1 b \<and> dest_vec1 b < dest_vec1 d)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5046
 "({a<..<b} \<subseteq> {c .. d} \<longleftrightarrow>  dest_vec1 b \<le> dest_vec1 a \<or>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5047
                dest_vec1 c \<le> dest_vec1 a \<and> dest_vec1 a < dest_vec1 b \<and> dest_vec1 b \<le> dest_vec1 d)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5048
 "({a<..<b} \<subseteq> {c<..<d} \<longleftrightarrow> dest_vec1 b \<le> dest_vec1 a \<or>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5049
                dest_vec1 c \<le> dest_vec1 a \<and> dest_vec1 a < dest_vec1 b \<and> dest_vec1 b \<le> dest_vec1 d)"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5050
  unfolding subset_interval[of a b c d] unfolding all_1 and dest_vec1_def by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5051
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5052
lemma eq_interval_1: fixes a :: "real^1" shows
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5053
 "{a .. b} = {c .. d} \<longleftrightarrow>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5054
          dest_vec1 b < dest_vec1 a \<and> dest_vec1 d < dest_vec1 c \<or>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5055
          dest_vec1 a = dest_vec1 c \<and> dest_vec1 b = dest_vec1 d"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5056
using set_eq_subset[of "{a .. b}" "{c .. d}"]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5057
using subset_interval_1(1)[of a b c d]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5058
using subset_interval_1(1)[of c d a b]
31341
c13b080bfb34 remove duplicate cauchy constant
huffman
parents: 31289
diff changeset
  5059
by auto (* FIXME: slow *)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5060
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5061
lemma disjoint_interval_1: fixes a :: "real^1" shows
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5062
  "{a .. b} \<inter> {c .. d} = {} \<longleftrightarrow> dest_vec1 b < dest_vec1 a \<or> dest_vec1 d < dest_vec1 c  \<or>  dest_vec1 b < dest_vec1 c \<or> dest_vec1 d < dest_vec1 a"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5063
  "{a .. b} \<inter> {c<..<d} = {} \<longleftrightarrow> dest_vec1 b < dest_vec1 a \<or> dest_vec1 d \<le> dest_vec1 c  \<or>  dest_vec1 b \<le> dest_vec1 c \<or> dest_vec1 d \<le> dest_vec1 a"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5064
  "{a<..<b} \<inter> {c .. d} = {} \<longleftrightarrow> dest_vec1 b \<le> dest_vec1 a \<or> dest_vec1 d < dest_vec1 c  \<or>  dest_vec1 b \<le> dest_vec1 c \<or> dest_vec1 d \<le> dest_vec1 a"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5065
  "{a<..<b} \<inter> {c<..<d} = {} \<longleftrightarrow> dest_vec1 b \<le> dest_vec1 a \<or> dest_vec1 d \<le> dest_vec1 c  \<or>  dest_vec1 b \<le> dest_vec1 c \<or> dest_vec1 d \<le> dest_vec1 a"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5066
  unfolding disjoint_interval and dest_vec1_def ex_1 by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5067
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5068
lemma open_closed_interval_1: fixes a :: "real^1" shows
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5069
 "{a<..<b} = {a .. b} - {a, b}"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5070
  unfolding expand_set_eq apply simp unfolding vector_less_def and vector_less_eq_def and all_1 and dest_vec1_eq[THEN sym] and dest_vec1_def by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5071
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5072
lemma closed_open_interval_1: "dest_vec1 (a::real^1) \<le> dest_vec1 b ==> {a .. b} = {a<..<b} \<union> {a,b}"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5073
  unfolding expand_set_eq apply simp unfolding vector_less_def and vector_less_eq_def and all_1 and dest_vec1_eq[THEN sym] and dest_vec1_def by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5074
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5075
(* Some stuff for half-infinite intervals too; FIXME: notation?  *)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5076
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5077
lemma closed_interval_left: fixes b::"real^'n::finite"
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5078
  shows "closed {x::real^'n. \<forall>i. x$i \<le> b$i}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5079
proof-
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5080
  { fix i
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5081
    fix x::"real^'n" assume x:"\<forall>e>0. \<exists>x'\<in>{x. \<forall>i. x $ i \<le> b $ i}. x' \<noteq> x \<and> dist x' x < e"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5082
    { assume "x$i > b$i"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5083
      then obtain y where "y $ i \<le> b $ i"  "y \<noteq> x"  "dist y x < x$i - b$i" using x[THEN spec[where x="x$i - b$i"]] by auto
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  5084
      hence False using component_le_norm[of "y - x" i] unfolding dist_norm and vector_minus_component by auto   }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5085
    hence "x$i \<le> b$i" by(rule ccontr)auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5086
  thus ?thesis unfolding closed_limpt unfolding islimpt_approachable by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5087
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5088
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5089
lemma closed_interval_right: fixes a::"real^'n::finite"
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5090
  shows "closed {x::real^'n. \<forall>i. a$i \<le> x$i}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5091
proof-
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5092
  { fix i
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5093
    fix x::"real^'n" assume x:"\<forall>e>0. \<exists>x'\<in>{x. \<forall>i. a $ i \<le> x $ i}. x' \<noteq> x \<and> dist x' x < e"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5094
    { assume "a$i > x$i"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5095
      then obtain y where "a $ i \<le> y $ i"  "y \<noteq> x"  "dist y x < a$i - x$i" using x[THEN spec[where x="a$i - x$i"]] by auto
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  5096
      hence False using component_le_norm[of "y - x" i] unfolding dist_norm and vector_minus_component by auto   }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5097
    hence "a$i \<le> x$i" by(rule ccontr)auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5098
  thus ?thesis unfolding closed_limpt unfolding islimpt_approachable by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5099
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5100
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5101
subsection{* Intervals in general, including infinite and mixtures of open and closed. *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5102
31281
b4d4dbc5b04f Corrected definition of is_interval
himmelma
parents: 31275
diff changeset
  5103
definition "is_interval s \<longleftrightarrow> (\<forall>a\<in>s. \<forall>b\<in>s. \<forall>x. (\<forall>i. ((a$i \<le> x$i \<and> x$i \<le> b$i) \<or> (b$i \<le> x$i \<and> x$i \<le> a$i)))  \<longrightarrow> x \<in> s)"
b4d4dbc5b04f Corrected definition of is_interval
himmelma
parents: 31275
diff changeset
  5104
b4d4dbc5b04f Corrected definition of is_interval
himmelma
parents: 31275
diff changeset
  5105
lemma is_interval_interval: "is_interval {a .. b::real^'n::finite}" (is ?th1) "is_interval {a<..<b}" (is ?th2) proof - 
b4d4dbc5b04f Corrected definition of is_interval
himmelma
parents: 31275
diff changeset
  5106
  have *:"\<And>x y z::real. x < y \<Longrightarrow> y < z \<Longrightarrow> x < z" by auto
b4d4dbc5b04f Corrected definition of is_interval
himmelma
parents: 31275
diff changeset
  5107
  show ?th1 ?th2  unfolding is_interval_def mem_interval Ball_def atLeastAtMost_iff
b4d4dbc5b04f Corrected definition of is_interval
himmelma
parents: 31275
diff changeset
  5108
    by(meson real_le_trans le_less_trans less_le_trans *)+ qed
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5109
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5110
lemma is_interval_empty:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5111
 "is_interval {}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5112
  unfolding is_interval_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5113
  by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5114
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5115
lemma is_interval_univ:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5116
 "is_interval UNIV"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5117
  unfolding is_interval_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5118
  by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5119
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5120
subsection{* Closure of halfspaces and hyperplanes.                                    *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5121
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  5122
lemma Lim_inner:
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  5123
  assumes "(f ---> l) net"  shows "((\<lambda>y. inner a (f y)) ---> inner a l) net"
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  5124
  by (intro tendsto_intros assms)
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  5125
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  5126
lemma continuous_at_inner: "continuous (at x) (inner a)"
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  5127
  unfolding continuous_at by (intro tendsto_intros)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5128
31591
c8c96efa4488 replace all occurrences of dot at type real^'n with inner
huffman
parents: 31589
diff changeset
  5129
lemma continuous_on_inner:
31592
61ee6256d863 generalize lemmas about inner
huffman
parents: 31591
diff changeset
  5130
  fixes s :: "'a::real_inner set"
31591
c8c96efa4488 replace all occurrences of dot at type real^'n with inner
huffman
parents: 31589
diff changeset
  5131
  shows "continuous_on s (inner a)"
c8c96efa4488 replace all occurrences of dot at type real^'n with inner
huffman
parents: 31589
diff changeset
  5132
  unfolding continuous_on by (rule ballI) (intro tendsto_intros)
c8c96efa4488 replace all occurrences of dot at type real^'n with inner
huffman
parents: 31589
diff changeset
  5133
31592
61ee6256d863 generalize lemmas about inner
huffman
parents: 31591
diff changeset
  5134
lemma closed_halfspace_le: "closed {x. inner a x \<le> b}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5135
proof-
31656
abadaf4922f8 new continuous/vimage lemmas; cleaned up proofs
huffman
parents: 31655
diff changeset
  5136
  have "\<forall>x. continuous (at x) (inner a)"
abadaf4922f8 new continuous/vimage lemmas; cleaned up proofs
huffman
parents: 31655
diff changeset
  5137
    unfolding continuous_at by (rule allI) (intro tendsto_intros)
abadaf4922f8 new continuous/vimage lemmas; cleaned up proofs
huffman
parents: 31655
diff changeset
  5138
  hence "closed (inner a -` {..b})"
abadaf4922f8 new continuous/vimage lemmas; cleaned up proofs
huffman
parents: 31655
diff changeset
  5139
    using closed_real_atMost by (rule continuous_closed_vimage)
abadaf4922f8 new continuous/vimage lemmas; cleaned up proofs
huffman
parents: 31655
diff changeset
  5140
  moreover have "{x. inner a x \<le> b} = inner a -` {..b}" by auto
abadaf4922f8 new continuous/vimage lemmas; cleaned up proofs
huffman
parents: 31655
diff changeset
  5141
  ultimately show ?thesis by simp
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5142
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5143
31592
61ee6256d863 generalize lemmas about inner
huffman
parents: 31591
diff changeset
  5144
lemma closed_halfspace_ge: "closed {x. inner a x \<ge> b}"
31591
c8c96efa4488 replace all occurrences of dot at type real^'n with inner
huffman
parents: 31589
diff changeset
  5145
  using closed_halfspace_le[of "-a" "-b"] unfolding inner_minus_left by auto
c8c96efa4488 replace all occurrences of dot at type real^'n with inner
huffman
parents: 31589
diff changeset
  5146
31592
61ee6256d863 generalize lemmas about inner
huffman
parents: 31591
diff changeset
  5147
lemma closed_hyperplane: "closed {x. inner a x = b}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5148
proof-
31591
c8c96efa4488 replace all occurrences of dot at type real^'n with inner
huffman
parents: 31589
diff changeset
  5149
  have "{x. inner a x = b} = {x. inner a x \<ge> b} \<inter> {x. inner a x \<le> b}" by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5150
  thus ?thesis using closed_halfspace_le[of a b] and closed_halfspace_ge[of b a] using closed_Int by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5151
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5152
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5153
lemma closed_halfspace_component_le:
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5154
  shows "closed {x::real^'n::finite. x$i \<le> a}"
31591
c8c96efa4488 replace all occurrences of dot at type real^'n with inner
huffman
parents: 31589
diff changeset
  5155
  using closed_halfspace_le[of "(basis i)::real^'n" a] unfolding inner_basis[OF assms] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5156
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5157
lemma closed_halfspace_component_ge:
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5158
  shows "closed {x::real^'n::finite. x$i \<ge> a}"
31591
c8c96efa4488 replace all occurrences of dot at type real^'n with inner
huffman
parents: 31589
diff changeset
  5159
  using closed_halfspace_ge[of a "(basis i)::real^'n"] unfolding inner_basis[OF assms] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5160
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5161
text{* Openness of halfspaces.                                                   *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5162
31592
61ee6256d863 generalize lemmas about inner
huffman
parents: 31591
diff changeset
  5163
lemma open_halfspace_lt: "open {x. inner a x < b}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5164
proof-
31591
c8c96efa4488 replace all occurrences of dot at type real^'n with inner
huffman
parents: 31589
diff changeset
  5165
  have "UNIV - {x. b \<le> inner a x} = {x. inner a x < b}" by auto
31490
c350f3ad6b0d move definitions of open, closed to RealVector.thy
huffman
parents: 31489
diff changeset
  5166
  thus ?thesis using closed_halfspace_ge[unfolded closed_def Compl_eq_Diff_UNIV, of b a] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5167
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5168
31592
61ee6256d863 generalize lemmas about inner
huffman
parents: 31591
diff changeset
  5169
lemma open_halfspace_gt: "open {x. inner a x > b}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5170
proof-
31591
c8c96efa4488 replace all occurrences of dot at type real^'n with inner
huffman
parents: 31589
diff changeset
  5171
  have "UNIV - {x. b \<ge> inner a x} = {x. inner a x > b}" by auto
31490
c350f3ad6b0d move definitions of open, closed to RealVector.thy
huffman
parents: 31489
diff changeset
  5172
  thus ?thesis using closed_halfspace_le[unfolded closed_def Compl_eq_Diff_UNIV, of a b] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5173
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5174
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5175
lemma open_halfspace_component_lt:
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5176
  shows "open {x::real^'n::finite. x$i < a}"
31591
c8c96efa4488 replace all occurrences of dot at type real^'n with inner
huffman
parents: 31589
diff changeset
  5177
  using open_halfspace_lt[of "(basis i)::real^'n" a] unfolding inner_basis[OF assms] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5178
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5179
lemma open_halfspace_component_gt:
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5180
  shows "open {x::real^'n::finite. x$i  > a}"
31591
c8c96efa4488 replace all occurrences of dot at type real^'n with inner
huffman
parents: 31589
diff changeset
  5181
  using open_halfspace_gt[of a "(basis i)::real^'n"] unfolding inner_basis[OF assms] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5182
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5183
text{* This gives a simple derivation of limit component bounds.                 *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5184
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5185
lemma Lim_component_le: fixes f :: "'a \<Rightarrow> real^'n::finite"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5186
  assumes "(f ---> l) net" "\<not> (trivial_limit net)"  "eventually (\<lambda>x. f(x)$i \<le> b) net"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5187
  shows "l$i \<le> b"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5188
proof-
31591
c8c96efa4488 replace all occurrences of dot at type real^'n with inner
huffman
parents: 31589
diff changeset
  5189
  { fix x have "x \<in> {x::real^'n. inner (basis i) x \<le> b} \<longleftrightarrow> x$i \<le> b" unfolding inner_basis by auto } note * = this
c8c96efa4488 replace all occurrences of dot at type real^'n with inner
huffman
parents: 31589
diff changeset
  5190
  show ?thesis using Lim_in_closed_set[of "{x. inner (basis i) x \<le> b}" f net l] unfolding *
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5191
    using closed_halfspace_le[of "(basis i)::real^'n" b] and assms(1,2,3) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5192
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5193
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5194
lemma Lim_component_ge: fixes f :: "'a \<Rightarrow> real^'n::finite"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5195
  assumes "(f ---> l) net"  "\<not> (trivial_limit net)"  "eventually (\<lambda>x. b \<le> (f x)$i) net"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5196
  shows "b \<le> l$i"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5197
proof-
31591
c8c96efa4488 replace all occurrences of dot at type real^'n with inner
huffman
parents: 31589
diff changeset
  5198
  { fix x have "x \<in> {x::real^'n. inner (basis i) x \<ge> b} \<longleftrightarrow> x$i \<ge> b" unfolding inner_basis by auto } note * = this
c8c96efa4488 replace all occurrences of dot at type real^'n with inner
huffman
parents: 31589
diff changeset
  5199
  show ?thesis using Lim_in_closed_set[of "{x. inner (basis i) x \<ge> b}" f net l] unfolding *
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5200
    using closed_halfspace_ge[of b "(basis i)::real^'n"] and assms(1,2,3) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5201
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5202
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5203
lemma Lim_component_eq: fixes f :: "'a \<Rightarrow> real^'n::finite"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5204
  assumes net:"(f ---> l) net" "~(trivial_limit net)" and ev:"eventually (\<lambda>x. f(x)$i = b) net"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5205
  shows "l$i = b"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5206
  using ev[unfolded order_eq_iff eventually_and] using Lim_component_ge[OF net, of b i] and Lim_component_le[OF net, of i b] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5207
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5208
lemma Lim_drop_le: fixes f :: "'a \<Rightarrow> real^1" shows
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5209
  "(f ---> l) net \<Longrightarrow> ~(trivial_limit net) \<Longrightarrow> eventually (\<lambda>x. dest_vec1 (f x) \<le> b) net ==> dest_vec1 l \<le> b"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5210
  using Lim_component_le[of f l net 1 b] unfolding dest_vec1_def by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5211
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5212
lemma Lim_drop_ge: fixes f :: "'a \<Rightarrow> real^1" shows
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5213
 "(f ---> l) net \<Longrightarrow> ~(trivial_limit net) \<Longrightarrow> eventually (\<lambda>x. b \<le> dest_vec1 (f x)) net ==> b \<le> dest_vec1 l"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5214
  using Lim_component_ge[of f l net b 1] unfolding dest_vec1_def by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5215
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5216
text{* Limits relative to a union.                                               *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5217
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  5218
lemma eventually_within_Un:
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  5219
  "eventually P (net within (s \<union> t)) \<longleftrightarrow>
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  5220
    eventually P (net within s) \<and> eventually P (net within t)"
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  5221
  unfolding Limits.eventually_within
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  5222
  by (auto elim!: eventually_rev_mp)
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  5223
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5224
lemma Lim_within_union:
31447
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  5225
 "(f ---> l) (net within (s \<union> t)) \<longleftrightarrow>
97bab1ac463e generalize type of 'at' to topological_space; generalize some lemmas
huffman
parents: 31445
diff changeset
  5226
  (f ---> l) (net within s) \<and> (f ---> l) (net within t)"
31488
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  5227
  unfolding tendsto_def
5691ccb8d6b5 generalize tendsto to class topological_space
huffman
parents: 31487
diff changeset
  5228
  by (auto simp add: eventually_within_Un)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5229
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5230
lemma continuous_on_union:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5231
  assumes "closed s" "closed t" "continuous_on s f" "continuous_on t f"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5232
  shows "continuous_on (s \<union> t) f"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5233
  using assms unfolding continuous_on unfolding Lim_within_union
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5234
  unfolding Lim unfolding trivial_limit_within unfolding closed_limpt by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5235
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  5236
lemma continuous_on_cases:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5237
  assumes "closed s" "closed t" "continuous_on s f" "continuous_on t g"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5238
          "\<forall>x. (x\<in>s \<and> \<not> P x) \<or> (x \<in> t \<and> P x) \<longrightarrow> f x = g x"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5239
  shows "continuous_on (s \<union> t) (\<lambda>x. if P x then f x else g x)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5240
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5241
  let ?h = "(\<lambda>x. if P x then f x else g x)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5242
  have "\<forall>x\<in>s. f x = (if P x then f x else g x)" using assms(5) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5243
  hence "continuous_on s ?h" using continuous_on_eq[of s f ?h] using assms(3) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5244
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5245
  have "\<forall>x\<in>t. g x = (if P x then f x else g x)" using assms(5) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5246
  hence "continuous_on t ?h" using continuous_on_eq[of t g ?h] using assms(4) by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5247
  ultimately show ?thesis using continuous_on_union[OF assms(1,2), of ?h] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5248
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5249
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5250
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5251
text{* Some more convenient intermediate-value theorem formulations.             *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5252
31592
61ee6256d863 generalize lemmas about inner
huffman
parents: 31591
diff changeset
  5253
lemma connected_ivt_hyperplane:
31591
c8c96efa4488 replace all occurrences of dot at type real^'n with inner
huffman
parents: 31589
diff changeset
  5254
  assumes "connected s" "x \<in> s" "y \<in> s" "inner a x \<le> b" "b \<le> inner a y"
c8c96efa4488 replace all occurrences of dot at type real^'n with inner
huffman
parents: 31589
diff changeset
  5255
  shows "\<exists>z \<in> s. inner a z = b"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5256
proof(rule ccontr)
31591
c8c96efa4488 replace all occurrences of dot at type real^'n with inner
huffman
parents: 31589
diff changeset
  5257
  assume as:"\<not> (\<exists>z\<in>s. inner a z = b)"
31592
61ee6256d863 generalize lemmas about inner
huffman
parents: 31591
diff changeset
  5258
  let ?A = "{x. inner a x < b}"
61ee6256d863 generalize lemmas about inner
huffman
parents: 31591
diff changeset
  5259
  let ?B = "{x. inner a x > b}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5260
  have "open ?A" "open ?B" using open_halfspace_lt and open_halfspace_gt by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5261
  moreover have "?A \<inter> ?B = {}" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5262
  moreover have "s \<subseteq> ?A \<union> ?B" using as by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5263
  ultimately show False using assms(1)[unfolded connected_def not_ex, THEN spec[where x="?A"], THEN spec[where x="?B"]] and assms(2-5) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5264
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5265
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5266
lemma connected_ivt_component: fixes x::"real^'n::finite" shows
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5267
 "connected s \<Longrightarrow> x \<in> s \<Longrightarrow> y \<in> s \<Longrightarrow> x$k \<le> a \<Longrightarrow> a \<le> y$k \<Longrightarrow> (\<exists>z\<in>s.  z$k = a)"
31591
c8c96efa4488 replace all occurrences of dot at type real^'n with inner
huffman
parents: 31589
diff changeset
  5268
  using connected_ivt_hyperplane[of s x y "(basis k)::real^'n" a] by (auto simp add: inner_basis)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5269
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5270
text{* Also more convenient formulations of monotone convergence.                *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5271
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5272
lemma bounded_increasing_convergent: fixes s::"nat \<Rightarrow> real^1"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5273
  assumes "bounded {s n| n::nat. True}"  "\<forall>n. dest_vec1(s n) \<le> dest_vec1(s(Suc n))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5274
  shows "\<exists>l. (s ---> l) sequentially"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5275
proof-
31533
2cce9283ba72 generalize constant 'bounded' to class metric_space
huffman
parents: 31532
diff changeset
  5276
  obtain a where a:"\<forall>n. \<bar>dest_vec1 (s n)\<bar> \<le>  a" using assms(1)[unfolded bounded_iff abs_dest_vec1] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5277
  { fix m::nat
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5278
    have "\<And> n. n\<ge>m \<longrightarrow> dest_vec1 (s m) \<le> dest_vec1 (s n)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5279
      apply(induct_tac n) apply simp using assms(2) apply(erule_tac x="na" in allE) by(auto simp add: not_less_eq_eq)  }
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5280
  hence "\<forall>m n. m \<le> n \<longrightarrow> dest_vec1 (s m) \<le> dest_vec1 (s n)" by auto
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  5281
  then obtain l where "\<forall>e>0. \<exists>N. \<forall>n\<ge>N. \<bar>dest_vec1 (s n) - l\<bar> < e" using convergent_bounded_monotone[OF a] unfolding monoseq_def by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5282
  thus ?thesis unfolding Lim_sequentially apply(rule_tac x="vec1 l" in exI)
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  5283
    unfolding dist_norm unfolding abs_dest_vec1 and dest_vec1_sub by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5284
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5285
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5286
subsection{* Basic homeomorphism definitions.                                          *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5287
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5288
definition "homeomorphism s t f g \<equiv>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5289
     (\<forall>x\<in>s. (g(f x) = x)) \<and> (f ` s = t) \<and> continuous_on s f \<and>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5290
     (\<forall>y\<in>t. (f(g y) = y)) \<and> (g ` t = s) \<and> continuous_on t g"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5291
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  5292
definition
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  5293
  homeomorphic :: "'a::metric_space set \<Rightarrow> 'b::metric_space set \<Rightarrow> bool"
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  5294
    (infixr "homeomorphic" 60) where
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5295
  homeomorphic_def: "s homeomorphic t \<equiv> (\<exists>f g. homeomorphism s t f g)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5296
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5297
lemma homeomorphic_refl: "s homeomorphic s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5298
  unfolding homeomorphic_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5299
  unfolding homeomorphism_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5300
  using continuous_on_id
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  5301
  apply(rule_tac x = "(\<lambda>x. x)" in exI)
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  5302
  apply(rule_tac x = "(\<lambda>x. x)" in exI)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5303
  by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5304
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5305
lemma homeomorphic_sym:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5306
 "s homeomorphic t \<longleftrightarrow> t homeomorphic s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5307
unfolding homeomorphic_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5308
unfolding homeomorphism_def
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  5309
by blast (* FIXME: slow *)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5310
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5311
lemma homeomorphic_trans:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5312
  assumes "s homeomorphic t" "t homeomorphic u" shows "s homeomorphic u"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5313
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5314
  obtain f1 g1 where fg1:"\<forall>x\<in>s. g1 (f1 x) = x"  "f1 ` s = t" "continuous_on s f1" "\<forall>y\<in>t. f1 (g1 y) = y" "g1 ` t = s" "continuous_on t g1"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5315
    using assms(1) unfolding homeomorphic_def homeomorphism_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5316
  obtain f2 g2 where fg2:"\<forall>x\<in>t. g2 (f2 x) = x"  "f2 ` t = u" "continuous_on t f2" "\<forall>y\<in>u. f2 (g2 y) = y" "g2 ` u = t" "continuous_on u g2"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5317
    using assms(2) unfolding homeomorphic_def homeomorphism_def by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5318
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5319
  { fix x assume "x\<in>s" hence "(g1 \<circ> g2) ((f2 \<circ> f1) x) = x" using fg1(1)[THEN bspec[where x=x]] and fg2(1)[THEN bspec[where x="f1 x"]] and fg1(2) by auto }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5320
  moreover have "(f2 \<circ> f1) ` s = u" using fg1(2) fg2(2) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5321
  moreover have "continuous_on s (f2 \<circ> f1)" using continuous_on_compose[OF fg1(3)] and fg2(3) unfolding fg1(2) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5322
  moreover { fix y assume "y\<in>u" hence "(f2 \<circ> f1) ((g1 \<circ> g2) y) = y" using fg2(4)[THEN bspec[where x=y]] and fg1(4)[THEN bspec[where x="g2 y"]] and fg2(5) by auto }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5323
  moreover have "(g1 \<circ> g2) ` u = s" using fg1(5) fg2(5) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5324
  moreover have "continuous_on u (g1 \<circ> g2)" using continuous_on_compose[OF fg2(6)] and fg1(6)  unfolding fg2(5) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5325
  ultimately show ?thesis unfolding homeomorphic_def homeomorphism_def apply(rule_tac x="f2 \<circ> f1" in exI) apply(rule_tac x="g1 \<circ> g2" in exI) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5326
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5327
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5328
lemma homeomorphic_minimal:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5329
 "s homeomorphic t \<longleftrightarrow>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5330
    (\<exists>f g. (\<forall>x\<in>s. f(x) \<in> t \<and> (g(f(x)) = x)) \<and>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5331
           (\<forall>y\<in>t. g(y) \<in> s \<and> (f(g(y)) = y)) \<and>
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5332
           continuous_on s f \<and> continuous_on t g)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5333
unfolding homeomorphic_def homeomorphism_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5334
apply auto apply (rule_tac x=f in exI) apply (rule_tac x=g in exI)
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5335
apply auto apply (rule_tac x=f in exI) apply (rule_tac x=g in exI) apply auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5336
unfolding image_iff
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5337
apply(erule_tac x="g x" in ballE) apply(erule_tac x="x" in ballE)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5338
apply auto apply(rule_tac x="g x" in bexI) apply auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5339
apply(erule_tac x="f x" in ballE) apply(erule_tac x="x" in ballE)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5340
apply auto apply(rule_tac x="f x" in bexI) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5341
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5342
subsection{* Relatively weak hypotheses if a set is compact.                           *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5343
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5344
definition "inv_on f s = (\<lambda>x. SOME y. y\<in>s \<and> f y = x)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5345
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5346
lemma assumes "inj_on f s" "x\<in>s"
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5347
  shows "inv_on f s (f x) = x"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5348
 using assms unfolding inj_on_def inv_on_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5349
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5350
lemma homeomorphism_compact:
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  5351
  fixes f :: "'a::heine_borel \<Rightarrow> 'b::heine_borel"
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  5352
    (* class constraint due to continuous_on_inverse *)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5353
  assumes "compact s" "continuous_on s f"  "f ` s = t"  "inj_on f s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5354
  shows "\<exists>g. homeomorphism s t f g"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5355
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5356
  def g \<equiv> "\<lambda>x. SOME y. y\<in>s \<and> f y = x"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5357
  have g:"\<forall>x\<in>s. g (f x) = x" using assms(3) assms(4)[unfolded inj_on_def] unfolding g_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5358
  { fix y assume "y\<in>t"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5359
    then obtain x where x:"f x = y" "x\<in>s" using assms(3) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5360
    hence "g (f x) = x" using g by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5361
    hence "f (g y) = y" unfolding x(1)[THEN sym] by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5362
  hence g':"\<forall>x\<in>t. f (g x) = x" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5363
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5364
  { fix x
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5365
    have "x\<in>s \<Longrightarrow> x \<in> g ` t" using g[THEN bspec[where x=x]] unfolding image_iff using assms(3) by(auto intro!: bexI[where x="f x"])
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5366
    moreover
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5367
    { assume "x\<in>g ` t"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5368
      then obtain y where y:"y\<in>t" "g y = x" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5369
      then obtain x' where x':"x'\<in>s" "f x' = y" using assms(3) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5370
      hence "x \<in> s" unfolding g_def using someI2[of "\<lambda>b. b\<in>s \<and> f b = y" x' "\<lambda>x. x\<in>s"] unfolding y(2)[THEN sym] and g_def by auto }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5371
    ultimately have "x\<in>s \<longleftrightarrow> x \<in> g ` t" by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5372
  hence "g ` t = s" by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5373
  ultimately
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5374
  show ?thesis unfolding homeomorphism_def homeomorphic_def
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5375
    apply(rule_tac x=g in exI) using g and assms(3) and continuous_on_inverse[OF assms(2,1), of g, unfolded assms(3)] and assms(2) by auto
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5376
qed
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5377
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5378
lemma homeomorphic_compact:
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  5379
  fixes f :: "'a::heine_borel \<Rightarrow> 'b::heine_borel"
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  5380
    (* class constraint due to continuous_on_inverse *)
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  5381
  shows "compact s \<Longrightarrow> continuous_on s f \<Longrightarrow> (f ` s = t) \<Longrightarrow> inj_on f s
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5382
          \<Longrightarrow> s homeomorphic t"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5383
  unfolding homeomorphic_def by(metis homeomorphism_compact)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5384
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5385
text{* Preservation of topological properties.                                   *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5386
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5387
lemma homeomorphic_compactness:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5388
 "s homeomorphic t ==> (compact s \<longleftrightarrow> compact t)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5389
unfolding homeomorphic_def homeomorphism_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5390
by (metis compact_continuous_image)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5391
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5392
text{* Results on translation, scaling etc.                                      *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5393
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5394
lemma homeomorphic_scaling:
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  5395
  fixes s :: "'a::real_normed_vector set"
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5396
  assumes "c \<noteq> 0"  shows "s homeomorphic ((\<lambda>x. c *\<^sub>R x) ` s)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5397
  unfolding homeomorphic_minimal
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5398
  apply(rule_tac x="\<lambda>x. c *\<^sub>R x" in exI)
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5399
  apply(rule_tac x="\<lambda>x. (1 / c) *\<^sub>R x" in exI)
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5400
  using assms apply auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5401
  using continuous_on_cmul[OF continuous_on_id] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5402
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5403
lemma homeomorphic_translation:
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  5404
  fixes s :: "'a::real_normed_vector set"
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  5405
  shows "s homeomorphic ((\<lambda>x. a + x) ` s)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5406
  unfolding homeomorphic_minimal
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5407
  apply(rule_tac x="\<lambda>x. a + x" in exI)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5408
  apply(rule_tac x="\<lambda>x. -a + x" in exI)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5409
  using continuous_on_add[OF continuous_on_const continuous_on_id] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5410
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5411
lemma homeomorphic_affinity:
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  5412
  fixes s :: "'a::real_normed_vector set"
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5413
  assumes "c \<noteq> 0"  shows "s homeomorphic ((\<lambda>x. a + c *\<^sub>R x) ` s)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5414
proof-
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5415
  have *:"op + a ` op *\<^sub>R c ` s = (\<lambda>x. a + c *\<^sub>R x) ` s" by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5416
  show ?thesis
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5417
    using homeomorphic_trans
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5418
    using homeomorphic_scaling[OF assms, of s]
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5419
    using homeomorphic_translation[of "(\<lambda>x. c *\<^sub>R x) ` s" a] unfolding * by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5420
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5421
31658
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  5422
lemma homeomorphic_balls:
f5ffe064412a generalize lemmas
huffman
parents: 31657
diff changeset
  5423
  fixes a b ::"'a::real_normed_vector" (* FIXME: generalize to metric_space *)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5424
  assumes "0 < d"  "0 < e"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5425
  shows "(ball a d) homeomorphic  (ball b e)" (is ?th)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5426
        "(cball a d) homeomorphic (cball b e)" (is ?cth)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5427
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5428
  have *:"\<bar>e / d\<bar> > 0" "\<bar>d / e\<bar> >0" using assms using divide_pos_pos by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5429
  show ?th unfolding homeomorphic_minimal
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5430
    apply(rule_tac x="\<lambda>x. b + (e/d) *\<^sub>R (x - a)" in exI)
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5431
    apply(rule_tac x="\<lambda>x. a + (d/e) *\<^sub>R (x - b)" in exI)
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5432
    using assms apply (auto simp add: dist_commute)
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5433
    unfolding dist_norm
31587
a7e187205fc0 remove simp add: norm_scaleR
huffman
parents: 31585
diff changeset
  5434
    apply (auto simp add: pos_divide_less_eq mult_strict_left_mono)
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5435
    unfolding continuous_on
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5436
    by (intro ballI tendsto_intros, simp, assumption)+
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5437
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5438
  have *:"\<bar>e / d\<bar> > 0" "\<bar>d / e\<bar> >0" using assms using divide_pos_pos by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5439
  show ?cth unfolding homeomorphic_minimal
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5440
    apply(rule_tac x="\<lambda>x. b + (e/d) *\<^sub>R (x - a)" in exI)
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5441
    apply(rule_tac x="\<lambda>x. a + (d/e) *\<^sub>R (x - b)" in exI)
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5442
    using assms apply (auto simp add: dist_commute)
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5443
    unfolding dist_norm
31587
a7e187205fc0 remove simp add: norm_scaleR
huffman
parents: 31585
diff changeset
  5444
    apply (auto simp add: pos_divide_le_eq)
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5445
    unfolding continuous_on
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5446
    by (intro ballI tendsto_intros, simp, assumption)+
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5447
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5448
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5449
text{* "Isometry" (up to constant bounds) of injective linear map etc.           *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5450
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5451
lemma cauchy_isometric:
31341
c13b080bfb34 remove duplicate cauchy constant
huffman
parents: 31289
diff changeset
  5452
  fixes x :: "nat \<Rightarrow> real ^ 'n::finite"
31657
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  5453
  assumes e:"0 < e" and s:"subspace s" and f:"bounded_linear f" and normf:"\<forall>x\<in>s. norm(f x) \<ge> e * norm(x)" and xs:"\<forall>n::nat. x n \<in> s" and cf:"Cauchy(f o x)"
31341
c13b080bfb34 remove duplicate cauchy constant
huffman
parents: 31289
diff changeset
  5454
  shows "Cauchy x"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5455
proof-
31657
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  5456
  interpret f: bounded_linear f by fact
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5457
  { fix d::real assume "d>0"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5458
    then obtain N where N:"\<forall>n\<ge>N. norm (f (x n) - f (x N)) < e * d"
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  5459
      using cf[unfolded cauchy o_def dist_norm, THEN spec[where x="e*d"]] and e and mult_pos_pos[of e d] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5460
    { fix n assume "n\<ge>N"
31657
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  5461
      hence "norm (f (x n - x N)) < e * d" using N[THEN spec[where x=n]] unfolding f.diff[THEN sym] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5462
      moreover have "e * norm (x n - x N) \<le> norm (f (x n - x N))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5463
	using subspace_sub[OF s, of "x n" "x N"] using xs[THEN spec[where x=N]] and xs[THEN spec[where x=n]]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5464
	using normf[THEN bspec[where x="x n - x N"]] by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5465
      ultimately have "norm (x n - x N) < d" using `e>0`
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5466
	using mult_left_less_imp_less[of e "norm (x n - x N)" d] by auto   }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5467
    hence "\<exists>N. \<forall>n\<ge>N. norm (x n - x N) < d" by auto }
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  5468
  thus ?thesis unfolding cauchy and dist_norm by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5469
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5470
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5471
lemma complete_isometric_image:
31528
c701f4085ca4 generalize constant 'complete'
huffman
parents: 31527
diff changeset
  5472
  fixes f :: "real ^ _ \<Rightarrow> real ^ _"
31657
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  5473
  assumes "0 < e" and s:"subspace s" and f:"bounded_linear f" and normf:"\<forall>x\<in>s. norm(f x) \<ge> e * norm(x)" and cs:"complete s"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5474
  shows "complete(f ` s)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5475
proof-
31341
c13b080bfb34 remove duplicate cauchy constant
huffman
parents: 31289
diff changeset
  5476
  { fix g assume as:"\<forall>n::nat. g n \<in> f ` s" and cfg:"Cauchy g"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5477
    then obtain x where "\<forall>n. x n \<in> s \<and> g n = f (x n)" unfolding image_iff and Bex_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5478
      using choice[of "\<lambda> n xa. xa \<in> s \<and> g n = f xa"] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5479
    hence x:"\<forall>n. x n \<in> s"  "\<forall>n. g n = f (x n)" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5480
    hence "f \<circ> x = g" unfolding expand_fun_eq by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5481
    then obtain l where "l\<in>s" and l:"(x ---> l) sequentially"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5482
      using cs[unfolded complete_def, THEN spec[where x="x"]]
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5483
      using cauchy_isometric[OF `0<e` s f normf] and cfg and x(1) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5484
    hence "\<exists>l\<in>f ` s. (g ---> l) sequentially"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5485
      using linear_continuous_at[OF f, unfolded continuous_at_sequentially, THEN spec[where x=x], of l]
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5486
      unfolding `f \<circ> x = g` by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5487
  thus ?thesis unfolding complete_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5488
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5489
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  5490
lemma dist_0_norm:
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  5491
  fixes x :: "'a::real_normed_vector"
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  5492
  shows "dist 0 x = norm x"
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  5493
unfolding dist_norm by simp
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5494
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5495
lemma injective_imp_isometric: fixes f::"real^'m::finite \<Rightarrow> real^'n::finite"
31657
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  5496
  assumes s:"closed s"  "subspace s"  and f:"bounded_linear f" "\<forall>x\<in>s. (f x = 0) \<longrightarrow> (x = 0)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5497
  shows "\<exists>e>0. \<forall>x\<in>s. norm (f x) \<ge> e * norm(x)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5498
proof(cases "s \<subseteq> {0::real^'m}")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5499
  case True
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5500
  { fix x assume "x \<in> s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5501
    hence "x = 0" using True by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5502
    hence "norm x \<le> norm (f x)" by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5503
  thus ?thesis by(auto intro!: exI[where x=1])
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5504
next
31657
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  5505
  interpret f: bounded_linear f by fact
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5506
  case False
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5507
  then obtain a where a:"a\<noteq>0" "a\<in>s" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5508
  from False have "s \<noteq> {}" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5509
  let ?S = "{f x| x. (x \<in> s \<and> norm x = norm a)}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5510
  let ?S' = "{x::real^'m. x\<in>s \<and> norm x = norm a}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5511
  let ?S'' = "{x::real^'m. norm x = norm a}"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5512
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  5513
  have "?S'' = frontier(cball 0 (norm a))" unfolding frontier_cball and dist_norm by (auto simp add: norm_minus_cancel)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5514
  hence "compact ?S''" using compact_frontier[OF compact_cball, of 0 "norm a"] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5515
  moreover have "?S' = s \<inter> ?S''" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5516
  ultimately have "compact ?S'" using closed_inter_compact[of s ?S''] using s(1) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5517
  moreover have *:"f ` ?S' = ?S" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5518
  ultimately have "compact ?S" using compact_continuous_image[OF linear_continuous_on[OF f(1)], of ?S'] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5519
  hence "closed ?S" using compact_imp_closed by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5520
  moreover have "?S \<noteq> {}" using a by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5521
  ultimately obtain b' where "b'\<in>?S" "\<forall>y\<in>?S. norm b' \<le> norm y" using distance_attains_inf[of ?S 0] unfolding dist_0_norm by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5522
  then obtain b where "b\<in>s" and ba:"norm b = norm a" and b:"\<forall>x\<in>{x \<in> s. norm x = norm a}. norm (f b) \<le> norm (f x)" unfolding *[THEN sym] unfolding image_iff by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5523
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5524
  let ?e = "norm (f b) / norm b"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5525
  have "norm b > 0" using ba and a and norm_ge_zero by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5526
  moreover have "norm (f b) > 0" using f(2)[THEN bspec[where x=b], OF `b\<in>s`] using `norm b >0` unfolding zero_less_norm_iff by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5527
  ultimately have "0 < norm (f b) / norm b" by(simp only: divide_pos_pos)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5528
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5529
  { fix x assume "x\<in>s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5530
    hence "norm (f b) / norm b * norm x \<le> norm (f x)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5531
    proof(cases "x=0")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5532
      case True thus "norm (f b) / norm b * norm x \<le> norm (f x)" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5533
    next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5534
      case False
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5535
      hence *:"0 < norm a / norm x" using `a\<noteq>0` unfolding zero_less_norm_iff[THEN sym] by(simp only: divide_pos_pos)
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5536
      have "\<forall>c. \<forall>x\<in>s. c *\<^sub>R x \<in> s" using s[unfolded subspace_def smult_conv_scaleR] by auto
31587
a7e187205fc0 remove simp add: norm_scaleR
huffman
parents: 31585
diff changeset
  5537
      hence "(norm a / norm x) *\<^sub>R x \<in> {x \<in> s. norm x = norm a}" using `x\<in>s` and `x\<noteq>0` by auto
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5538
      thus "norm (f b) / norm b * norm x \<le> norm (f x)" using b[THEN bspec[where x="(norm a / norm x) *\<^sub>R x"]]
31657
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  5539
	unfolding f.scaleR and ba using `x\<noteq>0` `a\<noteq>0`
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5540
	by (auto simp add: real_mult_commute pos_le_divide_eq pos_divide_le_eq)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5541
    qed }
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5542
  ultimately
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5543
  show ?thesis by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5544
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5545
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5546
lemma closed_injective_image_subspace:
31657
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  5547
  fixes f :: "real ^ _ \<Rightarrow> real ^ _"
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  5548
  assumes "subspace s" "bounded_linear f" "\<forall>x\<in>s. f x = 0 --> x = 0" "closed s"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5549
  shows "closed(f ` s)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5550
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5551
  obtain e where "e>0" and e:"\<forall>x\<in>s. e * norm x \<le> norm (f x)" using injective_imp_isometric[OF assms(4,1,2,3)] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5552
  show ?thesis using complete_isometric_image[OF `e>0` assms(1,2) e] and assms(4)
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5553
    unfolding complete_eq_closed[THEN sym] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5554
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5555
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5556
subsection{* Some properties of a canonical subspace.                                  *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5557
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5558
lemma subspace_substandard:
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5559
 "subspace {x::real^'n. (\<forall>i. P i \<longrightarrow> x$i = 0)}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5560
  unfolding subspace_def by(auto simp add: vector_add_component vector_smult_component elim!: ballE)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5561
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5562
lemma closed_substandard:
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5563
 "closed {x::real^'n::finite. \<forall>i. P i --> x$i = 0}" (is "closed ?A")
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5564
proof-
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5565
  let ?D = "{i. P i}"
31591
c8c96efa4488 replace all occurrences of dot at type real^'n with inner
huffman
parents: 31589
diff changeset
  5566
  let ?Bs = "{{x::real^'n. inner (basis i) x = 0}| i. i \<in> ?D}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5567
  { fix x
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5568
    { assume "x\<in>?A"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5569
      hence x:"\<forall>i\<in>?D. x $ i = 0" by auto
31591
c8c96efa4488 replace all occurrences of dot at type real^'n with inner
huffman
parents: 31589
diff changeset
  5570
      hence "x\<in> \<Inter> ?Bs" by(auto simp add: inner_basis x) }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5571
    moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5572
    { assume x:"x\<in>\<Inter>?Bs"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5573
      { fix i assume i:"i \<in> ?D"
31591
c8c96efa4488 replace all occurrences of dot at type real^'n with inner
huffman
parents: 31589
diff changeset
  5574
	then obtain B where BB:"B \<in> ?Bs" and B:"B = {x::real^'n. inner (basis i) x = 0}" by auto
c8c96efa4488 replace all occurrences of dot at type real^'n with inner
huffman
parents: 31589
diff changeset
  5575
	hence "x $ i = 0" unfolding B using x unfolding inner_basis by auto  }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5576
      hence "x\<in>?A" by auto }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5577
    ultimately have "x\<in>?A \<longleftrightarrow> x\<in> \<Inter>?Bs" by auto }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5578
  hence "?A = \<Inter> ?Bs" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5579
  thus ?thesis by(auto simp add: closed_Inter closed_hyperplane)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5580
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5581
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5582
lemma dim_substandard:
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5583
  shows "dim {x::real^'n::finite. \<forall>i. i \<notin> d \<longrightarrow> x$i = 0} = card d" (is "dim ?A = _")
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5584
proof-
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5585
  let ?D = "UNIV::'n set"
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5586
  let ?B = "(basis::'n\<Rightarrow>real^'n) ` d"
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5587
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5588
    let ?bas = "basis::'n \<Rightarrow> real^'n"
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5589
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5590
  have "?B \<subseteq> ?A" by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5591
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5592
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5593
  { fix x::"real^'n" assume "x\<in>?A"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5594
    with finite[of d]
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5595
    have "x\<in> span ?B"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5596
    proof(induct d arbitrary: x)
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5597
      case empty hence "x=0" unfolding Cart_eq by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5598
      thus ?case using subspace_0[OF subspace_span[of "{}"]] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5599
    next
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5600
      case (insert k F)
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5601
      hence *:"\<forall>i. i \<notin> insert k F \<longrightarrow> x $ i = 0" by auto
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5602
      have **:"F \<subseteq> insert k F" by auto
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5603
      def y \<equiv> "x - x$k *\<^sub>R basis k"
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5604
      have y:"x = y + (x$k) *\<^sub>R basis k" unfolding y_def by auto
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5605
      { fix i assume i':"i \<notin> F"
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5606
	hence "y $ i = 0" unfolding y_def unfolding vector_minus_component
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5607
	  and vector_smult_component and basis_component
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5608
	  using *[THEN spec[where x=i]] by auto }
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5609
      hence "y \<in> span (basis ` (insert k F))" using insert(3)
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5610
	using span_mono[of "?bas ` F" "?bas ` (insert k F)"]
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5611
	using image_mono[OF **, of basis] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5612
      moreover
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5613
      have "basis k \<in> span (?bas ` (insert k F))" by(rule span_superset, auto)
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5614
      hence "x$k *\<^sub>R basis k \<in> span (?bas ` (insert k F))"
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5615
        using span_mul [where 'a=real, unfolded smult_conv_scaleR] by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5616
      ultimately
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5617
      have "y + x$k *\<^sub>R basis k \<in> span (?bas ` (insert k F))"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5618
	using span_add by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5619
      thus ?case using y by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5620
    qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5621
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5622
  hence "?A \<subseteq> span ?B" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5623
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5624
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5625
  { fix x assume "x \<in> ?B"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5626
    hence "x\<in>{(basis i)::real^'n |i. i \<in> ?D}" using assms by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5627
  hence "independent ?B" using independent_mono[OF independent_stdbasis, of ?B] and assms by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5628
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5629
  moreover
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5630
  have "d \<subseteq> ?D" unfolding subset_eq using assms by auto
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5631
  hence *:"inj_on (basis::'n\<Rightarrow>real^'n) d" using subset_inj_on[OF basis_inj, of "d"] by auto
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5632
  have "?B hassize (card d)" unfolding hassize_def and card_image[OF *] by auto
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5633
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5634
  ultimately show ?thesis using dim_unique[of "basis ` d" ?A] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5635
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5636
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5637
text{* Hence closure and completeness of all subspaces.                          *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5638
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5639
lemma closed_subspace_lemma: "n \<le> card (UNIV::'n::finite set) \<Longrightarrow> \<exists>A::'n set. card A = n"
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5640
apply (induct n)
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5641
apply (rule_tac x="{}" in exI, simp)
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5642
apply clarsimp
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5643
apply (subgoal_tac "\<exists>x. x \<notin> A")
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5644
apply (erule exE)
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5645
apply (rule_tac x="insert x A" in exI, simp)
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5646
apply (subgoal_tac "A \<noteq> UNIV", auto)
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5647
done
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5648
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5649
lemma closed_subspace: fixes s::"(real^'n::finite) set"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5650
  assumes "subspace s" shows "closed s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5651
proof-
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5652
  have "dim s \<le> card (UNIV :: 'n set)" using dim_subset_univ by auto
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5653
  then obtain d::"'n set" where t: "card d = dim s"
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5654
    using closed_subspace_lemma by auto
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5655
  let ?t = "{x::real^'n. \<forall>i. i \<notin> d \<longrightarrow> x$i = 0}"
31657
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  5656
  obtain f where f:"bounded_linear f"  "f ` ?t = s" "inj_on f ?t"
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  5657
    using subspace_isomorphism[unfolded linear_conv_bounded_linear, OF subspace_substandard[of "\<lambda>i. i \<notin> d"] assms]
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5658
    using dim_substandard[of d] and t by auto
31657
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  5659
  interpret f: bounded_linear f by fact
1dfa55a46d7d replace uses of (bi)linear with bounded_(bi)linear
huffman
parents: 31656
diff changeset
  5660
  have "\<forall>x\<in>?t. f x = 0 \<longrightarrow> x = 0" using f.zero using f(3)[unfolded inj_on_def]
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5661
    by(erule_tac x=0 in ballE) auto
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5662
  moreover have "closed ?t" using closed_substandard .
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5663
  moreover have "subspace ?t" using subspace_substandard .
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5664
  ultimately show ?thesis using closed_injective_image_subspace[of ?t f]
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5665
    unfolding f(2) using f(1) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5666
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5667
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5668
lemma complete_subspace:
31528
c701f4085ca4 generalize constant 'complete'
huffman
parents: 31527
diff changeset
  5669
  fixes s :: "(real ^ _) set" shows "subspace s ==> complete s"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5670
  using complete_eq_closed closed_subspace
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5671
  by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5672
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5673
lemma dim_closure:
31345
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  5674
  fixes s :: "(real ^ _) set"
80667d5bee32 generalize topological notions to class metric_space; add class perfect_space
huffman
parents: 31344
diff changeset
  5675
  shows "dim(closure s) = dim s" (is "?dc = ?d")
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5676
proof-
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5677
  have "?dc \<le> ?d" using closure_minimal[OF span_inc, of s]
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5678
    using closed_subspace[OF subspace_span, of s]
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5679
    using dim_subset[of "closure s" "span s"] unfolding dim_span by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5680
  thus ?thesis using dim_subset[OF closure_subset, of s] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5681
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5682
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5683
text{* Affine transformations of intervals.                                      *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5684
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5685
lemma affinity_inverses:
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5686
  assumes m0: "m \<noteq> (0::'a::field)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5687
  shows "(\<lambda>x. m *s x + c) o (\<lambda>x. inverse(m) *s x + (-(inverse(m) *s c))) = id"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5688
  "(\<lambda>x. inverse(m) *s x + (-(inverse(m) *s c))) o (\<lambda>x. m *s x + c) = id"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5689
  using m0
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5690
apply (auto simp add: expand_fun_eq vector_add_ldistrib vector_smult_assoc)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5691
by (simp add: vector_smult_lneg[symmetric] vector_smult_assoc vector_sneg_minus1[symmetric])
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5692
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5693
lemma real_affinity_le:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5694
 "0 < (m::'a::ordered_field) ==> (m * x + c \<le> y \<longleftrightarrow> x \<le> inverse(m) * y + -(c / m))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5695
  by (simp add: field_simps inverse_eq_divide)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5696
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5697
lemma real_le_affinity:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5698
 "0 < (m::'a::ordered_field) ==> (y \<le> m * x + c \<longleftrightarrow> inverse(m) * y + -(c / m) \<le> x)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5699
  by (simp add: field_simps inverse_eq_divide)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5700
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5701
lemma real_affinity_lt:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5702
 "0 < (m::'a::ordered_field) ==> (m * x + c < y \<longleftrightarrow> x < inverse(m) * y + -(c / m))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5703
  by (simp add: field_simps inverse_eq_divide)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5704
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5705
lemma real_lt_affinity:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5706
 "0 < (m::'a::ordered_field) ==> (y < m * x + c \<longleftrightarrow> inverse(m) * y + -(c / m) < x)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5707
  by (simp add: field_simps inverse_eq_divide)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5708
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5709
lemma real_affinity_eq:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5710
 "(m::'a::ordered_field) \<noteq> 0 ==> (m * x + c = y \<longleftrightarrow> x = inverse(m) * y + -(c / m))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5711
  by (simp add: field_simps inverse_eq_divide)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5712
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5713
lemma real_eq_affinity:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5714
 "(m::'a::ordered_field) \<noteq> 0 ==> (y = m * x + c  \<longleftrightarrow> inverse(m) * y + -(c / m) = x)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5715
  by (simp add: field_simps inverse_eq_divide)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5716
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5717
lemma vector_affinity_eq:
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5718
  assumes m0: "(m::'a::field) \<noteq> 0"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5719
  shows "m *s x + c = y \<longleftrightarrow> x = inverse m *s y + -(inverse m *s c)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5720
proof
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5721
  assume h: "m *s x + c = y"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5722
  hence "m *s x = y - c" by (simp add: ring_simps)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5723
  hence "inverse m *s (m *s x) = inverse m *s (y - c)" by simp
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5724
  then show "x = inverse m *s y + - (inverse m *s c)"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5725
    using m0 by (simp add: vector_smult_assoc vector_ssub_ldistrib)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5726
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5727
  assume h: "x = inverse m *s y + - (inverse m *s c)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5728
  show "m *s x + c = y" unfolding h diff_minus[symmetric]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5729
    using m0 by (simp add: vector_smult_assoc vector_ssub_ldistrib)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5730
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5731
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5732
lemma vector_eq_affinity:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5733
 "(m::'a::field) \<noteq> 0 ==> (y = m *s x + c \<longleftrightarrow> inverse(m) *s y + -(inverse(m) *s c) = x)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5734
  using vector_affinity_eq[where m=m and x=x and y=y and c=c]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5735
  by metis
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5736
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5737
lemma image_affinity_interval: fixes m::real
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5738
  fixes a b c :: "real^'n::finite"
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5739
  shows "(\<lambda>x. m *\<^sub>R x + c) ` {a .. b} =
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5740
            (if {a .. b} = {} then {}
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5741
            else (if 0 \<le> m then {m *\<^sub>R a + c .. m *\<^sub>R b + c}
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5742
            else {m *\<^sub>R b + c .. m *\<^sub>R a + c}))"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5743
proof(cases "m=0")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5744
  { fix x assume "x \<le> c" "c \<le> x"
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5745
    hence "x=c" unfolding vector_less_eq_def and Cart_eq by (auto intro: order_antisym) }
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5746
  moreover case True
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5747
  moreover have "c \<in> {m *\<^sub>R a + c..m *\<^sub>R b + c}" unfolding True by(auto simp add: vector_less_eq_def)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5748
  ultimately show ?thesis by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5749
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5750
  case False
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5751
  { fix y assume "a \<le> y" "y \<le> b" "m > 0"
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5752
    hence "m *\<^sub>R a + c \<le> m *\<^sub>R y + c"  "m *\<^sub>R y + c \<le> m *\<^sub>R b + c"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5753
      unfolding vector_less_eq_def by(auto simp add: vector_smult_component vector_add_component)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5754
  } moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5755
  { fix y assume "a \<le> y" "y \<le> b" "m < 0"
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5756
    hence "m *\<^sub>R b + c \<le> m *\<^sub>R y + c"  "m *\<^sub>R y + c \<le> m *\<^sub>R a + c"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5757
      unfolding vector_less_eq_def by(auto simp add: vector_smult_component vector_add_component mult_left_mono_neg elim!:ballE)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5758
  } moreover
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5759
  { fix y assume "m > 0"  "m *\<^sub>R a + c \<le> y"  "y \<le> m *\<^sub>R b + c"
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5760
    hence "y \<in> (\<lambda>x. m *\<^sub>R x + c) ` {a..b}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5761
      unfolding image_iff Bex_def mem_interval vector_less_eq_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5762
      apply(auto simp add: vector_smult_component vector_add_component vector_minus_component vector_smult_assoc pth_3[symmetric]
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5763
	intro!: exI[where x="(1 / m) *\<^sub>R (y - c)"])
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5764
      by(auto simp add: pos_le_divide_eq pos_divide_le_eq real_mult_commute diff_le_iff)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5765
  } moreover
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5766
  { fix y assume "m *\<^sub>R b + c \<le> y" "y \<le> m *\<^sub>R a + c" "m < 0"
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5767
    hence "y \<in> (\<lambda>x. m *\<^sub>R x + c) ` {a..b}"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5768
      unfolding image_iff Bex_def mem_interval vector_less_eq_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5769
      apply(auto simp add: vector_smult_component vector_add_component vector_minus_component vector_smult_assoc pth_3[symmetric]
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5770
	intro!: exI[where x="(1 / m) *\<^sub>R (y - c)"])
30582
638b088bb840 imported patch euclidean
huffman
parents: 30549
diff changeset
  5771
      by(auto simp add: neg_le_divide_eq neg_divide_le_eq real_mult_commute diff_le_iff)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5772
  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5773
  ultimately show ?thesis using False by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5774
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5775
31585
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5776
lemma image_smult_interval:"(\<lambda>x. m *\<^sub>R (x::real^'n::finite)) ` {a..b} =
0e4906ccf280 replace all occurrences of 'op *s' at type real^'n with scaleR
huffman
parents: 31571
diff changeset
  5777
  (if {a..b} = {} then {} else if 0 \<le> m then {m *\<^sub>R a..m *\<^sub>R b} else {m *\<^sub>R b..m *\<^sub>R a})"
31282
b98cbfabe824 Moved some lemmas about intervals to Topology
himmelma
parents: 31281
diff changeset
  5778
  using image_affinity_interval[of m 0 a b] by auto
b98cbfabe824 Moved some lemmas about intervals to Topology
himmelma
parents: 31281
diff changeset
  5779
b98cbfabe824 Moved some lemmas about intervals to Topology
himmelma
parents: 31281
diff changeset
  5780
subsection{* Banach fixed point theorem (not really topological...) *}
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5781
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5782
lemma banach_fix:
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5783
  assumes s:"complete s" "s \<noteq> {}" and c:"0 \<le> c" "c < 1" and f:"(f ` s) \<subseteq> s" and
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5784
          lipschitz:"\<forall>x\<in>s. \<forall>y\<in>s. dist (f x) (f y) \<le> c * dist x y"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5785
  shows "\<exists>! x\<in>s. (f x = x)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5786
proof-
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5787
  have "1 - c > 0" using c by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5788
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5789
  from s(2) obtain z0 where "z0 \<in> s" by auto
30974
415f2fe37f62 removed confusion around funpow
haftmann
parents: 30952
diff changeset
  5790
  def z \<equiv> "\<lambda>n. (f ^^ n) z0"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5791
  { fix n::nat
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5792
    have "z n \<in> s" unfolding z_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5793
    proof(induct n) case 0 thus ?case using `z0 \<in>s` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5794
    next case Suc thus ?case using f by auto qed }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5795
  note z_in_s = this
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5796
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5797
  def d \<equiv> "dist (z 0) (z 1)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5798
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5799
  have fzn:"\<And>n. f (z n) = z (Suc n)" unfolding z_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5800
  { fix n::nat
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5801
    have "dist (z n) (z (Suc n)) \<le> (c ^ n) * d"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5802
    proof(induct n)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5803
      case 0 thus ?case unfolding d_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5804
    next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5805
      case (Suc m)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5806
      hence "c * dist (z m) (z (Suc m)) \<le> c ^ Suc m * d"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5807
	using `0 \<le> c` using mult_mono1_class.mult_mono1[of "dist (z m) (z (Suc m))" "c ^ m * d" c] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5808
      thus ?case using lipschitz[THEN bspec[where x="z m"], OF z_in_s, THEN bspec[where x="z (Suc m)"], OF z_in_s]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5809
	unfolding fzn and mult_le_cancel_left by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5810
    qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5811
  } note cf_z = this
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5812
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5813
  { fix n m::nat
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5814
    have "(1 - c) * dist (z m) (z (m+n)) \<le> (c ^ m) * d * (1 - c ^ n)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5815
    proof(induct n)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5816
      case 0 show ?case by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5817
    next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5818
      case (Suc k)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5819
      have "(1 - c) * dist (z m) (z (m + Suc k)) \<le> (1 - c) * (dist (z m) (z (m + k)) + dist (z (m + k)) (z (Suc (m + k))))"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5820
	using dist_triangle and c by(auto simp add: dist_triangle)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5821
      also have "\<dots> \<le> (1 - c) * (dist (z m) (z (m + k)) + c ^ (m + k) * d)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5822
	using cf_z[of "m + k"] and c by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5823
      also have "\<dots> \<le> c ^ m * d * (1 - c ^ k) + (1 - c) * c ^ (m + k) * d"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5824
	using Suc by (auto simp add: ring_simps)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5825
      also have "\<dots> = (c ^ m) * (d * (1 - c ^ k) + (1 - c) * c ^ k * d)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5826
	unfolding power_add by (auto simp add: ring_simps)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5827
      also have "\<dots> \<le> (c ^ m) * d * (1 - c ^ Suc k)"
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  5828
	using c by (auto simp add: ring_simps)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5829
      finally show ?case by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5830
    qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5831
  } note cf_z2 = this
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5832
  { fix e::real assume "e>0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5833
    hence "\<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (z m) (z n) < e"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5834
    proof(cases "d = 0")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5835
      case True
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  5836
      hence "\<And>n. z n = z0" using cf_z2[of 0] and c unfolding z_def by (auto simp add: pos_prod_le[OF `1 - c > 0`])
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5837
      thus ?thesis using `e>0` by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5838
    next
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  5839
      case False hence "d>0" unfolding d_def using zero_le_dist[of "z 0" "z 1"]
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5840
	by (metis False d_def real_less_def)
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5841
      hence "0 < e * (1 - c) / d" using `e>0` and `1-c>0`
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5842
	using divide_pos_pos[of "e * (1 - c)" d] and mult_pos_pos[of e "1 - c"] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5843
      then obtain N where N:"c ^ N < e * (1 - c) / d" using real_arch_pow_inv[of "e * (1 - c) / d" c] and c by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5844
      { fix m n::nat assume "m>n" and as:"m\<ge>N" "n\<ge>N"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5845
	have *:"c ^ n \<le> c ^ N" using `n\<ge>N` and c using power_decreasing[OF `n\<ge>N`, of c] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5846
	have "1 - c ^ (m - n) > 0" using c and power_strict_mono[of c 1 "m - n"] using `m>n` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5847
	hence **:"d * (1 - c ^ (m - n)) / (1 - c) > 0"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5848
	  using real_mult_order[OF `d>0`, of "1 - c ^ (m - n)"]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5849
	  using divide_pos_pos[of "d * (1 - c ^ (m - n))" "1 - c"]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5850
	  using `0 < 1 - c` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5851
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5852
	have "dist (z m) (z n) \<le> c ^ n * d * (1 - c ^ (m - n)) / (1 - c)"
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5853
	  using cf_z2[of n "m - n"] and `m>n` unfolding pos_le_divide_eq[OF `1-c>0`]
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  5854
	  by (auto simp add: real_mult_commute dist_commute)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5855
	also have "\<dots> \<le> c ^ N * d * (1 - c ^ (m - n)) / (1 - c)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5856
	  using mult_right_mono[OF * order_less_imp_le[OF **]]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5857
	  unfolding real_mult_assoc by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5858
	also have "\<dots> < (e * (1 - c) / d) * d * (1 - c ^ (m - n)) / (1 - c)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5859
	  using mult_strict_right_mono[OF N **] unfolding real_mult_assoc by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5860
	also have "\<dots> = e * (1 - c ^ (m - n))" using c and `d>0` and `1 - c > 0` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5861
	also have "\<dots> \<le> e" using c and `1 - c ^ (m - n) > 0` and `e>0` using mult_right_le_one_le[of e "1 - c ^ (m - n)"] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5862
	finally have  "dist (z m) (z n) < e" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5863
      } note * = this
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5864
      { fix m n::nat assume as:"N\<le>m" "N\<le>n"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5865
	hence "dist (z n) (z m) < e"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5866
	proof(cases "n = m")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5867
	  case True thus ?thesis using `e>0` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5868
	next
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  5869
	  case False thus ?thesis using as and *[of n m] *[of m n] unfolding nat_neq_iff by (auto simp add: dist_commute)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5870
	qed }
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5871
      thus ?thesis by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5872
    qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5873
  }
31341
c13b080bfb34 remove duplicate cauchy constant
huffman
parents: 31289
diff changeset
  5874
  hence "Cauchy z" unfolding cauchy_def by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5875
  then obtain x where "x\<in>s" and x:"(z ---> x) sequentially" using s(1)[unfolded compact_def complete_def, THEN spec[where x=z]] and z_in_s by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5876
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5877
  def e \<equiv> "dist (f x) x"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5878
  have "e = 0" proof(rule ccontr)
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  5879
    assume "e \<noteq> 0" hence "e>0" unfolding e_def using zero_le_dist[of "f x" x]
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  5880
      by (metis dist_eq_0_iff dist_nz e_def)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5881
    then obtain N where N:"\<forall>n\<ge>N. dist (z n) x < e / 2"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5882
      using x[unfolded Lim_sequentially, THEN spec[where x="e/2"]] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5883
    hence N':"dist (z N) x < e / 2" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5884
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5885
    have *:"c * dist (z N) x \<le> dist (z N) x" unfolding mult_le_cancel_right2
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  5886
      using zero_le_dist[of "z N" x] and c
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  5887
      by (metis dist_eq_0_iff dist_nz order_less_asym real_less_def)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5888
    have "dist (f (z N)) (f x) \<le> c * dist (z N) x" using lipschitz[THEN bspec[where x="z N"], THEN bspec[where x=x]]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5889
      using z_in_s[of N] `x\<in>s` using c by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5890
    also have "\<dots> < e / 2" using N' and c using * by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5891
    finally show False unfolding fzn
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5892
      using N[THEN spec[where x="Suc N"]] and dist_triangle_half_r[of "z (Suc N)" "f x" e x]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5893
      unfolding e_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5894
  qed
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  5895
  hence "f x = x" unfolding e_def by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5896
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5897
  { fix y assume "f y = y" "y\<in>s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5898
    hence "dist x y \<le> c * dist x y" using lipschitz[THEN bspec[where x=x], THEN bspec[where x=y]]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5899
      using `x\<in>s` and `f x = x` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5900
    hence "dist x y = 0" unfolding mult_le_cancel_right1
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  5901
      using c and zero_le_dist[of x y] by auto
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  5902
    hence "y = x" by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5903
  }
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5904
  ultimately show ?thesis unfolding Bex1_def using `x\<in>s` by blast+
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5905
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5906
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5907
subsection{* Edelstein fixed point theorem.                                            *}
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5908
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5909
lemma edelstein_fix:
31571
fd09da741833 move lemma compact_Times; generalize more lemmas
huffman
parents: 31570
diff changeset
  5910
  fixes s :: "'a::real_normed_vector set"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5911
  assumes s:"compact s" "s \<noteq> {}" and gs:"(g ` s) \<subseteq> s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5912
      and dist:"\<forall>x\<in>s. \<forall>y\<in>s. x \<noteq> y \<longrightarrow> dist (g x) (g y) < dist x y"
31570
784decc70e07 generalize lemma edelstein_fix
huffman
parents: 31569
diff changeset
  5913
  shows "\<exists>! x\<in>s. g x = x"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5914
proof(cases "\<exists>x\<in>s. g x \<noteq> x")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5915
  obtain x where "x\<in>s" using s(2) by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5916
  case False hence g:"\<forall>x\<in>s. g x = x" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5917
  { fix y assume "y\<in>s"
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5918
    hence "x = y" using `x\<in>s` and dist[THEN bspec[where x=x], THEN bspec[where x=y]]
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5919
      unfolding g[THEN bspec[where x=x], OF `x\<in>s`]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5920
      unfolding g[THEN bspec[where x=y], OF `y\<in>s`] by auto  }
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5921
  thus ?thesis unfolding Bex1_def using `x\<in>s` and g by blast+
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5922
next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5923
  case True
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5924
  then obtain x where [simp]:"x\<in>s" and "g x \<noteq> x" by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5925
  { fix x y assume "x \<in> s" "y \<in> s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5926
    hence "dist (g x) (g y) \<le> dist x y"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5927
      using dist[THEN bspec[where x=x], THEN bspec[where x=y]] by auto } note dist' = this
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5928
  def y \<equiv> "g x"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5929
  have [simp]:"y\<in>s" unfolding y_def using gs[unfolded image_subset_iff] and `x\<in>s` by blast
30974
415f2fe37f62 removed confusion around funpow
haftmann
parents: 30952
diff changeset
  5930
  def f \<equiv> "\<lambda>n. g ^^ n"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5931
  have [simp]:"\<And>n z. g (f n z) = f (Suc n) z" unfolding f_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5932
  have [simp]:"\<And>z. f 0 z = z" unfolding f_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5933
  { fix n::nat and z assume "z\<in>s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5934
    have "f n z \<in> s" unfolding f_def
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5935
    proof(induct n)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5936
      case 0 thus ?case using `z\<in>s` by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5937
    next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5938
      case (Suc n) thus ?case using gs[unfolded image_subset_iff] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5939
    qed } note fs = this
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5940
  { fix m n ::nat assume "m\<le>n"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5941
    fix w z assume "w\<in>s" "z\<in>s"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5942
    have "dist (f n w) (f n z) \<le> dist (f m w) (f m z)" using `m\<le>n`
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5943
    proof(induct n)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5944
      case 0 thus ?case by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5945
    next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5946
      case (Suc n)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5947
      thus ?case proof(cases "m\<le>n")
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5948
	case True thus ?thesis using Suc(1)
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5949
	  using dist'[OF fs fs, OF `w\<in>s` `z\<in>s`, of n n] by auto
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5950
      next
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5951
	case False hence mn:"m = Suc n" using Suc(2) by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5952
	show ?thesis unfolding mn  by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5953
      qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5954
    qed } note distf = this
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5955
31570
784decc70e07 generalize lemma edelstein_fix
huffman
parents: 31569
diff changeset
  5956
  def h \<equiv> "\<lambda>n. (f n x, f n y)"
784decc70e07 generalize lemma edelstein_fix
huffman
parents: 31569
diff changeset
  5957
  let ?s2 = "s \<times> s"
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  5958
  obtain l r where "l\<in>?s2" and r:"subseq r" and lr:"((h \<circ> r) ---> l) sequentially"
31570
784decc70e07 generalize lemma edelstein_fix
huffman
parents: 31569
diff changeset
  5959
    using compact_Times [OF s(1) s(1), unfolded compact_def, THEN spec[where x=h]] unfolding  h_def
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5960
    using fs[OF `x\<in>s`] and fs[OF `y\<in>s`] by blast
31570
784decc70e07 generalize lemma edelstein_fix
huffman
parents: 31569
diff changeset
  5961
  def a \<equiv> "fst l" def b \<equiv> "snd l"
784decc70e07 generalize lemma edelstein_fix
huffman
parents: 31569
diff changeset
  5962
  have lab:"l = (a, b)" unfolding a_def b_def by simp
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5963
  have [simp]:"a\<in>s" "b\<in>s" unfolding a_def b_def using `l\<in>?s2` by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5964
31570
784decc70e07 generalize lemma edelstein_fix
huffman
parents: 31569
diff changeset
  5965
  have lima:"((fst \<circ> (h \<circ> r)) ---> a) sequentially"
784decc70e07 generalize lemma edelstein_fix
huffman
parents: 31569
diff changeset
  5966
   and limb:"((snd \<circ> (h \<circ> r)) ---> b) sequentially"
784decc70e07 generalize lemma edelstein_fix
huffman
parents: 31569
diff changeset
  5967
    using lr
784decc70e07 generalize lemma edelstein_fix
huffman
parents: 31569
diff changeset
  5968
    unfolding o_def a_def b_def by (simp_all add: tendsto_intros)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5969
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5970
  { fix n::nat
31570
784decc70e07 generalize lemma edelstein_fix
huffman
parents: 31569
diff changeset
  5971
    have *:"\<And>fx fy (x::'a) y. dist fx fy \<le> dist x y \<Longrightarrow> \<not> (dist (fx - fy) (a - b) < dist a b - dist x y)" unfolding dist_norm by norm
784decc70e07 generalize lemma edelstein_fix
huffman
parents: 31569
diff changeset
  5972
    { fix x y :: 'a
31289
847f00f435d4 move dist operation to new metric_space class
huffman
parents: 31286
diff changeset
  5973
      have "dist (-x) (-y) = dist x y" unfolding dist_norm
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5974
	using norm_minus_cancel[of "x - y"] by (auto simp add: uminus_add_conv_diff) } note ** = this
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  5975
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5976
    { assume as:"dist a b > dist (f n x) (f n y)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5977
      then obtain Na Nb where "\<forall>m\<ge>Na. dist (f (r m) x) a < (dist a b - dist (f n x) (f n y)) / 2"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5978
	and "\<forall>m\<ge>Nb. dist (f (r m) y) b < (dist a b - dist (f n x) (f n y)) / 2"
30654
254478a8dd05 dropped theory Arith_Tools
haftmann
parents: 30582
diff changeset
  5979
	using lima limb unfolding h_def Lim_sequentially by (fastsimp simp del: less_divide_eq_number_of1)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5980
      hence "dist (f (r (Na + Nb + n)) x - f (r (Na + Nb + n)) y) (a - b) < dist a b - dist (f n x) (f n y)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5981
	apply(erule_tac x="Na+Nb+n" in allE)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5982
	apply(erule_tac x="Na+Nb+n" in allE) apply simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5983
	using dist_triangle_add_half[of a "f (r (Na + Nb + n)) x" "dist a b - dist (f n x) (f n y)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5984
          "-b"  "- f (r (Na + Nb + n)) y"]
31285
0a3f9ee4117c generalize dist function to class real_normed_vector
huffman
parents: 31275
diff changeset
  5985
	unfolding ** unfolding group_simps(12) by (auto simp add: dist_commute)
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5986
      moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5987
      have "dist (f (r (Na + Nb + n)) x - f (r (Na + Nb + n)) y) (a - b) \<ge> dist a b - dist (f n x) (f n y)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5988
	using distf[of n "r (Na+Nb+n)", OF _ `x\<in>s` `y\<in>s`]
31559
ca9e56897403 use constants subseq, incseq, monoseq
huffman
parents: 31558
diff changeset
  5989
	using subseq_bigger[OF r, of "Na+Nb+n"]
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5990
	using *[of "f (r (Na + Nb + n)) x" "f (r (Na + Nb + n)) y" "f n x" "f n y"] by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5991
      ultimately have False by simp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5992
    }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5993
    hence "dist a b \<le> dist (f n x) (f n y)" by(rule ccontr)auto }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5994
  note ab_fn = this
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5995
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5996
  have [simp]:"a = b" proof(rule ccontr)
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5997
    def e \<equiv> "dist a b - dist (g a) (g b)"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5998
    assume "a\<noteq>b" hence "e > 0" unfolding e_def using dist by fastsimp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  5999
    hence "\<exists>n. dist (f n x) a < e/2 \<and> dist (f n y) b < e/2"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  6000
      using lima limb unfolding Lim_sequentially
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  6001
      apply (auto elim!: allE[where x="e/2"]) apply(rule_tac x="r (max N Na)" in exI) unfolding h_def by fastsimp
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  6002
    then obtain n where n:"dist (f n x) a < e/2 \<and> dist (f n y) b < e/2" by auto
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  6003
    have "dist (f (Suc n) x) (g a) \<le> dist (f n x) a"
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  6004
      using dist[THEN bspec[where x="f n x"], THEN bspec[where x="a"]] and fs by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  6005
    moreover have "dist (f (Suc n) y) (g b) \<le> dist (f n y) b"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  6006
      using dist[THEN bspec[where x="f n y"], THEN bspec[where x="b"]] and fs by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  6007
    ultimately have "dist (f (Suc n) x) (g a) + dist (f (Suc n) y) (g b) < e" using n by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  6008
    thus False unfolding e_def using ab_fn[of "Suc n"] by norm
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  6009
  qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  6010
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  6011
  have [simp]:"\<And>n. f (Suc n) x = f n y" unfolding f_def y_def by(induct_tac n)auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  6012
  { fix x y assume "x\<in>s" "y\<in>s" moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  6013
    fix e::real assume "e>0" ultimately
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  6014
    have "dist y x < e \<longrightarrow> dist (g y) (g x) < e" using dist by fastsimp }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  6015
  hence "continuous_on s g" unfolding continuous_on_def by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  6016
31570
784decc70e07 generalize lemma edelstein_fix
huffman
parents: 31569
diff changeset
  6017
  hence "((snd \<circ> h \<circ> r) ---> g a) sequentially" unfolding continuous_on_sequentially
784decc70e07 generalize lemma edelstein_fix
huffman
parents: 31569
diff changeset
  6018
    apply (rule allE[where x="\<lambda>n. (fst \<circ> h \<circ> r) n"]) apply (erule ballE[where x=a])
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  6019
    using lima unfolding h_def o_def using fs[OF `x\<in>s`] by (auto simp add: y_def)
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  6020
  hence "g a = a" using Lim_unique[OF trivial_limit_sequentially limb, of "g a"]
30262
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  6021
    unfolding `a=b` and o_assoc by auto
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  6022
  moreover
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  6023
  { fix x assume "x\<in>s" "g x = x" "x\<noteq>a"
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  6024
    hence "False" using dist[THEN bspec[where x=a], THEN bspec[where x=x]]
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  6025
      using `g a = a` and `a\<in>s` by auto  }
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  6026
  ultimately show "\<exists>!x\<in>s. g x = x" unfolding Bex1_def using `a\<in>s` by blast
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  6027
qed
5794fee816c3 A formalization of Topology on Euclidean spaces, Includes limits (nets) , continuity, fixpoint theorems, homeomorphisms
chaieb
parents:
diff changeset
  6028
30488
5c4c3a9e9102 remove trailing spaces
huffman
parents: 30268
diff changeset
  6029
end