src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy
author eberlm
Mon, 04 Jan 2016 17:45:36 +0100
changeset 62049 b0f941e207cf
parent 61973 0c7e865fa7cb
child 62083 7582b39f51ed
permissions -rw-r--r--
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33714
eb2574ac4173 Added new lemmas to Euclidean Space by Robert Himmelmann
hoelzl
parents: 33324
diff changeset
     1
(*  title:      HOL/Library/Topology_Euclidian_Space.thy
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
     2
    Author:     Amine Chaieb, University of Cambridge
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
     3
    Author:     Robert Himmelmann, TU Muenchen
44075
5952bd355779 generalize more lemmas about compactness
huffman
parents: 44074
diff changeset
     4
    Author:     Brian Huffman, Portland State University
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
     5
*)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
     6
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
     7
section \<open>Elementary topology in Euclidean space.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
     8
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
     9
theory Topology_Euclidean_Space
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    10
imports
61880
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
    11
  "~~/src/HOL/Library/Indicator_Function"
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
    12
  "~~/src/HOL/Library/Countable_Set"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
    13
  "~~/src/HOL/Library/FuncSet"
50938
hoelzl
parents: 50937
diff changeset
    14
  Linear_Algebra
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    15
  Norm_Arith
61880
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
    16
  
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    17
begin
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    18
61738
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61699
diff changeset
    19
lemma image_affinity_interval:
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61699
diff changeset
    20
  fixes c :: "'a::ordered_real_vector"
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61699
diff changeset
    21
  shows "((\<lambda>x. m *\<^sub>R x + c) ` {a..b}) = (if {a..b}={} then {}
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61699
diff changeset
    22
            else if 0 <= m then {m *\<^sub>R a + c .. m  *\<^sub>R b + c}
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61699
diff changeset
    23
            else {m *\<^sub>R b + c .. m *\<^sub>R a + c})"
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61699
diff changeset
    24
  apply (case_tac "m=0", force)
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61699
diff changeset
    25
  apply (auto simp: scaleR_left_mono)
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61699
diff changeset
    26
  apply (rule_tac x="inverse m *\<^sub>R (x-c)" in rev_image_eqI, auto simp: pos_le_divideR_eq le_diff_eq scaleR_left_mono_neg)
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61699
diff changeset
    27
  apply (metis diff_le_eq inverse_inverse_eq order.not_eq_order_implies_strict pos_le_divideR_eq positive_imp_inverse_positive)
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61699
diff changeset
    28
  apply (rule_tac x="inverse m *\<^sub>R (x-c)" in rev_image_eqI, auto simp: not_le neg_le_divideR_eq diff_le_eq)
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61699
diff changeset
    29
  using le_diff_eq scaleR_le_cancel_left_neg
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61699
diff changeset
    30
  apply fastforce
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61699
diff changeset
    31
  done
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61699
diff changeset
    32
50972
d2c6a0a7fcdf tuned proof
hoelzl
parents: 50971
diff changeset
    33
lemma dist_0_norm:
d2c6a0a7fcdf tuned proof
hoelzl
parents: 50971
diff changeset
    34
  fixes x :: "'a::real_normed_vector"
d2c6a0a7fcdf tuned proof
hoelzl
parents: 50971
diff changeset
    35
  shows "dist 0 x = norm x"
d2c6a0a7fcdf tuned proof
hoelzl
parents: 50971
diff changeset
    36
unfolding dist_norm by simp
d2c6a0a7fcdf tuned proof
hoelzl
parents: 50971
diff changeset
    37
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
    38
lemma dist_double: "dist x y < d / 2 \<Longrightarrow> dist x z < d / 2 \<Longrightarrow> dist y z < d"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
    39
  using dist_triangle[of y z x] by (simp add: dist_commute)
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
    40
50972
d2c6a0a7fcdf tuned proof
hoelzl
parents: 50971
diff changeset
    41
(* LEGACY *)
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
    42
lemma lim_subseq: "subseq r \<Longrightarrow> s \<longlonglongrightarrow> l \<Longrightarrow> (s \<circ> r) \<longlonglongrightarrow> l"
50972
d2c6a0a7fcdf tuned proof
hoelzl
parents: 50971
diff changeset
    43
  by (rule LIMSEQ_subseq_LIMSEQ)
d2c6a0a7fcdf tuned proof
hoelzl
parents: 50971
diff changeset
    44
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
    45
lemma countable_PiE:
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
    46
  "finite I \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> countable (F i)) \<Longrightarrow> countable (PiE I F)"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
    47
  by (induct I arbitrary: F rule: finite_induct) (auto simp: PiE_insert_eq)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
    48
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
    49
lemma Lim_within_open:
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
    50
  fixes f :: "'a::topological_space \<Rightarrow> 'b::topological_space"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
    51
  shows "a \<in> S \<Longrightarrow> open S \<Longrightarrow> (f \<longlongrightarrow> l)(at a within S) \<longleftrightarrow> (f \<longlongrightarrow> l)(at a)"
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
    52
  by (fact tendsto_within_open)
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
    53
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
    54
lemma continuous_on_union:
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
    55
  "closed s \<Longrightarrow> closed t \<Longrightarrow> continuous_on s f \<Longrightarrow> continuous_on t f \<Longrightarrow> continuous_on (s \<union> t) f"
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
    56
  by (fact continuous_on_closed_Un)
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
    57
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
    58
lemma continuous_on_cases:
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
    59
  "closed s \<Longrightarrow> closed t \<Longrightarrow> continuous_on s f \<Longrightarrow> continuous_on t g \<Longrightarrow>
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
    60
    \<forall>x. (x\<in>s \<and> \<not> P x) \<or> (x \<in> t \<and> P x) \<longrightarrow> f x = g x \<Longrightarrow>
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
    61
    continuous_on (s \<union> t) (\<lambda>x. if P x then f x else g x)"
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
    62
  by (rule continuous_on_If) auto
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
    63
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
    64
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
    65
subsection \<open>Topological Basis\<close>
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    66
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    67
context topological_space
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    68
begin
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    69
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
    70
definition "topological_basis B \<longleftrightarrow>
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
    71
  (\<forall>b\<in>B. open b) \<and> (\<forall>x. open x \<longrightarrow> (\<exists>B'. B' \<subseteq> B \<and> \<Union>B' = x))"
51343
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
    72
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
    73
lemma topological_basis:
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
    74
  "topological_basis B \<longleftrightarrow> (\<forall>x. open x \<longleftrightarrow> (\<exists>B'. B' \<subseteq> B \<and> \<Union>B' = x))"
50998
501200635659 simplify heine_borel type class
hoelzl
parents: 50973
diff changeset
    75
  unfolding topological_basis_def
501200635659 simplify heine_borel type class
hoelzl
parents: 50973
diff changeset
    76
  apply safe
501200635659 simplify heine_borel type class
hoelzl
parents: 50973
diff changeset
    77
     apply fastforce
501200635659 simplify heine_borel type class
hoelzl
parents: 50973
diff changeset
    78
    apply fastforce
501200635659 simplify heine_borel type class
hoelzl
parents: 50973
diff changeset
    79
   apply (erule_tac x="x" in allE)
501200635659 simplify heine_borel type class
hoelzl
parents: 50973
diff changeset
    80
   apply simp
501200635659 simplify heine_borel type class
hoelzl
parents: 50973
diff changeset
    81
   apply (rule_tac x="{x}" in exI)
501200635659 simplify heine_borel type class
hoelzl
parents: 50973
diff changeset
    82
  apply auto
501200635659 simplify heine_borel type class
hoelzl
parents: 50973
diff changeset
    83
  done
501200635659 simplify heine_borel type class
hoelzl
parents: 50973
diff changeset
    84
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    85
lemma topological_basis_iff:
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    86
  assumes "\<And>B'. B' \<in> B \<Longrightarrow> open B'"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    87
  shows "topological_basis B \<longleftrightarrow> (\<forall>O'. open O' \<longrightarrow> (\<forall>x\<in>O'. \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O'))"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    88
    (is "_ \<longleftrightarrow> ?rhs")
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    89
proof safe
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    90
  fix O' and x::'a
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    91
  assume H: "topological_basis B" "open O'" "x \<in> O'"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
    92
  then have "(\<exists>B'\<subseteq>B. \<Union>B' = O')" by (simp add: topological_basis_def)
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    93
  then obtain B' where "B' \<subseteq> B" "O' = \<Union>B'" by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
    94
  then show "\<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O'" using H by auto
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    95
next
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    96
  assume H: ?rhs
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
    97
  show "topological_basis B"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
    98
    using assms unfolding topological_basis_def
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
    99
  proof safe
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
   100
    fix O' :: "'a set"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   101
    assume "open O'"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   102
    with H obtain f where "\<forall>x\<in>O'. f x \<in> B \<and> x \<in> f x \<and> f x \<subseteq> O'"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   103
      by (force intro: bchoice simp: Bex_def)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   104
    then show "\<exists>B'\<subseteq>B. \<Union>B' = O'"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   105
      by (auto intro: exI[where x="{f x |x. x \<in> O'}"])
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   106
  qed
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   107
qed
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   108
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   109
lemma topological_basisI:
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   110
  assumes "\<And>B'. B' \<in> B \<Longrightarrow> open B'"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   111
    and "\<And>O' x. open O' \<Longrightarrow> x \<in> O' \<Longrightarrow> \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O'"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   112
  shows "topological_basis B"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   113
  using assms by (subst topological_basis_iff) auto
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   114
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   115
lemma topological_basisE:
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   116
  fixes O'
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   117
  assumes "topological_basis B"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   118
    and "open O'"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   119
    and "x \<in> O'"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   120
  obtains B' where "B' \<in> B" "x \<in> B'" "B' \<subseteq> O'"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   121
proof atomize_elim
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   122
  from assms have "\<And>B'. B'\<in>B \<Longrightarrow> open B'"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   123
    by (simp add: topological_basis_def)
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   124
  with topological_basis_iff assms
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   125
  show  "\<exists>B'. B' \<in> B \<and> x \<in> B' \<and> B' \<subseteq> O'"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   126
    using assms by (simp add: Bex_def)
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   127
qed
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   128
50094
84ddcf5364b4 allow arbitrary enumerations of basis in locale for generation of borel sets
immler
parents: 50087
diff changeset
   129
lemma topological_basis_open:
84ddcf5364b4 allow arbitrary enumerations of basis in locale for generation of borel sets
immler
parents: 50087
diff changeset
   130
  assumes "topological_basis B"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   131
    and "X \<in> B"
50094
84ddcf5364b4 allow arbitrary enumerations of basis in locale for generation of borel sets
immler
parents: 50087
diff changeset
   132
  shows "open X"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   133
  using assms by (simp add: topological_basis_def)
50094
84ddcf5364b4 allow arbitrary enumerations of basis in locale for generation of borel sets
immler
parents: 50087
diff changeset
   134
51343
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   135
lemma topological_basis_imp_subbasis:
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   136
  assumes B: "topological_basis B"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   137
  shows "open = generate_topology B"
51343
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   138
proof (intro ext iffI)
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   139
  fix S :: "'a set"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   140
  assume "open S"
51343
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   141
  with B obtain B' where "B' \<subseteq> B" "S = \<Union>B'"
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   142
    unfolding topological_basis_def by blast
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   143
  then show "generate_topology B S"
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   144
    by (auto intro: generate_topology.intros dest: topological_basis_open)
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   145
next
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   146
  fix S :: "'a set"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   147
  assume "generate_topology B S"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   148
  then show "open S"
51343
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   149
    by induct (auto dest: topological_basis_open[OF B])
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   150
qed
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   151
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   152
lemma basis_dense:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
   153
  fixes B :: "'a set set"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
   154
    and f :: "'a set \<Rightarrow> 'a"
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   155
  assumes "topological_basis B"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   156
    and choosefrom_basis: "\<And>B'. B' \<noteq> {} \<Longrightarrow> f B' \<in> B'"
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   157
  shows "\<forall>X. open X \<longrightarrow> X \<noteq> {} \<longrightarrow> (\<exists>B' \<in> B. f B' \<in> X)"
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   158
proof (intro allI impI)
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
   159
  fix X :: "'a set"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
   160
  assume "open X" and "X \<noteq> {}"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
   161
  from topological_basisE[OF \<open>topological_basis B\<close> \<open>open X\<close> choosefrom_basis[OF \<open>X \<noteq> {}\<close>]]
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   162
  obtain B' where "B' \<in> B" "f X \<in> B'" "B' \<subseteq> X" .
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   163
  then show "\<exists>B'\<in>B. f B' \<in> X"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   164
    by (auto intro!: choosefrom_basis)
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   165
qed
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   166
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   167
end
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   168
50882
a382bf90867e move prod instantiation of second_countable_topology to its definition
hoelzl
parents: 50881
diff changeset
   169
lemma topological_basis_prod:
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   170
  assumes A: "topological_basis A"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   171
    and B: "topological_basis B"
50882
a382bf90867e move prod instantiation of second_countable_topology to its definition
hoelzl
parents: 50881
diff changeset
   172
  shows "topological_basis ((\<lambda>(a, b). a \<times> b) ` (A \<times> B))"
a382bf90867e move prod instantiation of second_countable_topology to its definition
hoelzl
parents: 50881
diff changeset
   173
  unfolding topological_basis_def
a382bf90867e move prod instantiation of second_countable_topology to its definition
hoelzl
parents: 50881
diff changeset
   174
proof (safe, simp_all del: ex_simps add: subset_image_iff ex_simps(1)[symmetric])
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   175
  fix S :: "('a \<times> 'b) set"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   176
  assume "open S"
50882
a382bf90867e move prod instantiation of second_countable_topology to its definition
hoelzl
parents: 50881
diff changeset
   177
  then show "\<exists>X\<subseteq>A \<times> B. (\<Union>(a,b)\<in>X. a \<times> b) = S"
a382bf90867e move prod instantiation of second_countable_topology to its definition
hoelzl
parents: 50881
diff changeset
   178
  proof (safe intro!: exI[of _ "{x\<in>A \<times> B. fst x \<times> snd x \<subseteq> S}"])
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   179
    fix x y
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   180
    assume "(x, y) \<in> S"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
   181
    from open_prod_elim[OF \<open>open S\<close> this]
50882
a382bf90867e move prod instantiation of second_countable_topology to its definition
hoelzl
parents: 50881
diff changeset
   182
    obtain a b where a: "open a""x \<in> a" and b: "open b" "y \<in> b" and "a \<times> b \<subseteq> S"
a382bf90867e move prod instantiation of second_countable_topology to its definition
hoelzl
parents: 50881
diff changeset
   183
      by (metis mem_Sigma_iff)
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   184
    moreover
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   185
    from A a obtain A0 where "A0 \<in> A" "x \<in> A0" "A0 \<subseteq> a"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   186
      by (rule topological_basisE)
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   187
    moreover
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   188
    from B b obtain B0 where "B0 \<in> B" "y \<in> B0" "B0 \<subseteq> b"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   189
      by (rule topological_basisE)
50882
a382bf90867e move prod instantiation of second_countable_topology to its definition
hoelzl
parents: 50881
diff changeset
   190
    ultimately show "(x, y) \<in> (\<Union>(a, b)\<in>{X \<in> A \<times> B. fst X \<times> snd X \<subseteq> S}. a \<times> b)"
a382bf90867e move prod instantiation of second_countable_topology to its definition
hoelzl
parents: 50881
diff changeset
   191
      by (intro UN_I[of "(A0, B0)"]) auto
a382bf90867e move prod instantiation of second_countable_topology to its definition
hoelzl
parents: 50881
diff changeset
   192
  qed auto
a382bf90867e move prod instantiation of second_countable_topology to its definition
hoelzl
parents: 50881
diff changeset
   193
qed (metis A B topological_basis_open open_Times)
a382bf90867e move prod instantiation of second_countable_topology to its definition
hoelzl
parents: 50881
diff changeset
   194
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   195
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
   196
subsection \<open>Countable Basis\<close>
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   197
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   198
locale countable_basis =
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
   199
  fixes B :: "'a::topological_space set set"
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   200
  assumes is_basis: "topological_basis B"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   201
    and countable_basis: "countable B"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   202
begin
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   203
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   204
lemma open_countable_basis_ex:
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   205
  assumes "open X"
61952
546958347e05 prefer symbols for "Union", "Inter";
wenzelm
parents: 61945
diff changeset
   206
  shows "\<exists>B' \<subseteq> B. X = \<Union>B'"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   207
  using assms countable_basis is_basis
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   208
  unfolding topological_basis_def by blast
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   209
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   210
lemma open_countable_basisE:
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   211
  assumes "open X"
61952
546958347e05 prefer symbols for "Union", "Inter";
wenzelm
parents: 61945
diff changeset
   212
  obtains B' where "B' \<subseteq> B" "X = \<Union>B'"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   213
  using assms open_countable_basis_ex
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   214
  by (atomize_elim) simp
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   215
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   216
lemma countable_dense_exists:
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
   217
  "\<exists>D::'a set. countable D \<and> (\<forall>X. open X \<longrightarrow> X \<noteq> {} \<longrightarrow> (\<exists>d \<in> D. d \<in> X))"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   218
proof -
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   219
  let ?f = "(\<lambda>B'. SOME x. x \<in> B')"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   220
  have "countable (?f ` B)" using countable_basis by simp
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   221
  with basis_dense[OF is_basis, of ?f] show ?thesis
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   222
    by (intro exI[where x="?f ` B"]) (metis (mono_tags) all_not_in_conv imageI someI)
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   223
qed
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   224
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   225
lemma countable_dense_setE:
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   226
  obtains D :: "'a set"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   227
  where "countable D" "\<And>X. open X \<Longrightarrow> X \<noteq> {} \<Longrightarrow> \<exists>d \<in> D. d \<in> X"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   228
  using countable_dense_exists by blast
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50105
diff changeset
   229
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   230
end
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   231
50883
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
   232
lemma (in first_countable_topology) first_countable_basisE:
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
   233
  obtains A where "countable A" "\<And>a. a \<in> A \<Longrightarrow> x \<in> a" "\<And>a. a \<in> A \<Longrightarrow> open a"
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
   234
    "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> (\<exists>a\<in>A. a \<subseteq> S)"
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
   235
  using first_countable_basis[of x]
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51472
diff changeset
   236
  apply atomize_elim
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51472
diff changeset
   237
  apply (elim exE)
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51472
diff changeset
   238
  apply (rule_tac x="range A" in exI)
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51472
diff changeset
   239
  apply auto
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51472
diff changeset
   240
  done
50883
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
   241
51105
a27fcd14c384 fine grained instantiations
immler
parents: 51103
diff changeset
   242
lemma (in first_countable_topology) first_countable_basis_Int_stableE:
a27fcd14c384 fine grained instantiations
immler
parents: 51103
diff changeset
   243
  obtains A where "countable A" "\<And>a. a \<in> A \<Longrightarrow> x \<in> a" "\<And>a. a \<in> A \<Longrightarrow> open a"
a27fcd14c384 fine grained instantiations
immler
parents: 51103
diff changeset
   244
    "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> (\<exists>a\<in>A. a \<subseteq> S)"
a27fcd14c384 fine grained instantiations
immler
parents: 51103
diff changeset
   245
    "\<And>a b. a \<in> A \<Longrightarrow> b \<in> A \<Longrightarrow> a \<inter> b \<in> A"
a27fcd14c384 fine grained instantiations
immler
parents: 51103
diff changeset
   246
proof atomize_elim
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   247
  obtain A' where A':
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   248
    "countable A'"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   249
    "\<And>a. a \<in> A' \<Longrightarrow> x \<in> a"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   250
    "\<And>a. a \<in> A' \<Longrightarrow> open a"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   251
    "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> \<exists>a\<in>A'. a \<subseteq> S"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   252
    by (rule first_countable_basisE) blast
51105
a27fcd14c384 fine grained instantiations
immler
parents: 51103
diff changeset
   253
  def A \<equiv> "(\<lambda>N. \<Inter>((\<lambda>n. from_nat_into A' n) ` N)) ` (Collect finite::nat set set)"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   254
  then show "\<exists>A. countable A \<and> (\<forall>a. a \<in> A \<longrightarrow> x \<in> a) \<and> (\<forall>a. a \<in> A \<longrightarrow> open a) \<and>
51105
a27fcd14c384 fine grained instantiations
immler
parents: 51103
diff changeset
   255
        (\<forall>S. open S \<longrightarrow> x \<in> S \<longrightarrow> (\<exists>a\<in>A. a \<subseteq> S)) \<and> (\<forall>a b. a \<in> A \<longrightarrow> b \<in> A \<longrightarrow> a \<inter> b \<in> A)"
a27fcd14c384 fine grained instantiations
immler
parents: 51103
diff changeset
   256
  proof (safe intro!: exI[where x=A])
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   257
    show "countable A"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   258
      unfolding A_def by (intro countable_image countable_Collect_finite)
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   259
    fix a
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   260
    assume "a \<in> A"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   261
    then show "x \<in> a" "open a"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   262
      using A'(4)[OF open_UNIV] by (auto simp: A_def intro: A' from_nat_into)
51105
a27fcd14c384 fine grained instantiations
immler
parents: 51103
diff changeset
   263
  next
52141
eff000cab70f weaker precendence of syntax for big intersection and union on sets
haftmann
parents: 51773
diff changeset
   264
    let ?int = "\<lambda>N. \<Inter>(from_nat_into A' ` N)"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   265
    fix a b
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   266
    assume "a \<in> A" "b \<in> A"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   267
    then obtain N M where "a = ?int N" "b = ?int M" "finite (N \<union> M)"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   268
      by (auto simp: A_def)
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   269
    then show "a \<inter> b \<in> A"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   270
      by (auto simp: A_def intro!: image_eqI[where x="N \<union> M"])
51105
a27fcd14c384 fine grained instantiations
immler
parents: 51103
diff changeset
   271
  next
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   272
    fix S
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   273
    assume "open S" "x \<in> S"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   274
    then obtain a where a: "a\<in>A'" "a \<subseteq> S" using A' by blast
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   275
    then show "\<exists>a\<in>A. a \<subseteq> S" using a A'
51105
a27fcd14c384 fine grained instantiations
immler
parents: 51103
diff changeset
   276
      by (intro bexI[where x=a]) (auto simp: A_def intro: image_eqI[where x="{to_nat_on A' a}"])
a27fcd14c384 fine grained instantiations
immler
parents: 51103
diff changeset
   277
  qed
a27fcd14c384 fine grained instantiations
immler
parents: 51103
diff changeset
   278
qed
a27fcd14c384 fine grained instantiations
immler
parents: 51103
diff changeset
   279
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51472
diff changeset
   280
lemma (in topological_space) first_countableI:
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   281
  assumes "countable A"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   282
    and 1: "\<And>a. a \<in> A \<Longrightarrow> x \<in> a" "\<And>a. a \<in> A \<Longrightarrow> open a"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   283
    and 2: "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> \<exists>a\<in>A. a \<subseteq> S"
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51472
diff changeset
   284
  shows "\<exists>A::nat \<Rightarrow> 'a set. (\<forall>i. x \<in> A i \<and> open (A i)) \<and> (\<forall>S. open S \<and> x \<in> S \<longrightarrow> (\<exists>i. A i \<subseteq> S))"
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51472
diff changeset
   285
proof (safe intro!: exI[of _ "from_nat_into A"])
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   286
  fix i
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51472
diff changeset
   287
  have "A \<noteq> {}" using 2[of UNIV] by auto
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   288
  show "x \<in> from_nat_into A i" "open (from_nat_into A i)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
   289
    using range_from_nat_into_subset[OF \<open>A \<noteq> {}\<close>] 1 by auto
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   290
next
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   291
  fix S
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   292
  assume "open S" "x\<in>S" from 2[OF this]
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   293
  show "\<exists>i. from_nat_into A i \<subseteq> S"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
   294
    using subset_range_from_nat_into[OF \<open>countable A\<close>] by auto
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51472
diff changeset
   295
qed
51350
490f34774a9a eventually nhds represented using sequentially
hoelzl
parents: 51349
diff changeset
   296
50883
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
   297
instance prod :: (first_countable_topology, first_countable_topology) first_countable_topology
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
   298
proof
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
   299
  fix x :: "'a \<times> 'b"
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   300
  obtain A where A:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   301
      "countable A"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   302
      "\<And>a. a \<in> A \<Longrightarrow> fst x \<in> a"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   303
      "\<And>a. a \<in> A \<Longrightarrow> open a"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   304
      "\<And>S. open S \<Longrightarrow> fst x \<in> S \<Longrightarrow> \<exists>a\<in>A. a \<subseteq> S"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   305
    by (rule first_countable_basisE[of "fst x"]) blast
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   306
  obtain B where B:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   307
      "countable B"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   308
      "\<And>a. a \<in> B \<Longrightarrow> snd x \<in> a"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   309
      "\<And>a. a \<in> B \<Longrightarrow> open a"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   310
      "\<And>S. open S \<Longrightarrow> snd x \<in> S \<Longrightarrow> \<exists>a\<in>B. a \<subseteq> S"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   311
    by (rule first_countable_basisE[of "snd x"]) blast
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   312
  show "\<exists>A::nat \<Rightarrow> ('a \<times> 'b) set.
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   313
    (\<forall>i. x \<in> A i \<and> open (A i)) \<and> (\<forall>S. open S \<and> x \<in> S \<longrightarrow> (\<exists>i. A i \<subseteq> S))"
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51472
diff changeset
   314
  proof (rule first_countableI[of "(\<lambda>(a, b). a \<times> b) ` (A \<times> B)"], safe)
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   315
    fix a b
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   316
    assume x: "a \<in> A" "b \<in> B"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
   317
    with A(2, 3)[of a] B(2, 3)[of b] show "x \<in> a \<times> b" and "open (a \<times> b)"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
   318
      unfolding mem_Times_iff
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
   319
      by (auto intro: open_Times)
50883
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
   320
  next
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   321
    fix S
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   322
    assume "open S" "x \<in> S"
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   323
    then obtain a' b' where a'b': "open a'" "open b'" "x \<in> a' \<times> b'" "a' \<times> b' \<subseteq> S"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   324
      by (rule open_prod_elim)
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   325
    moreover
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   326
    from a'b' A(4)[of a'] B(4)[of b']
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   327
    obtain a b where "a \<in> A" "a \<subseteq> a'" "b \<in> B" "b \<subseteq> b'"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   328
      by auto
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   329
    ultimately
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   330
    show "\<exists>a\<in>(\<lambda>(a, b). a \<times> b) ` (A \<times> B). a \<subseteq> S"
50883
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
   331
      by (auto intro!: bexI[of _ "a \<times> b"] bexI[of _ a] bexI[of _ b])
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
   332
  qed (simp add: A B)
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
   333
qed
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
   334
50881
ae630bab13da renamed countable_basis_space to second_countable_topology
hoelzl
parents: 50526
diff changeset
   335
class second_countable_topology = topological_space +
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   336
  assumes ex_countable_subbasis:
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   337
    "\<exists>B::'a::topological_space set set. countable B \<and> open = generate_topology B"
51343
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   338
begin
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   339
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   340
lemma ex_countable_basis: "\<exists>B::'a set set. countable B \<and> topological_basis B"
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   341
proof -
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   342
  from ex_countable_subbasis obtain B where B: "countable B" "open = generate_topology B"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   343
    by blast
51343
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   344
  let ?B = "Inter ` {b. finite b \<and> b \<subseteq> B }"
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   345
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   346
  show ?thesis
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   347
  proof (intro exI conjI)
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   348
    show "countable ?B"
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   349
      by (intro countable_image countable_Collect_finite_subset B)
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   350
    {
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   351
      fix S
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   352
      assume "open S"
51343
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   353
      then have "\<exists>B'\<subseteq>{b. finite b \<and> b \<subseteq> B}. (\<Union>b\<in>B'. \<Inter>b) = S"
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   354
        unfolding B
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   355
      proof induct
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   356
        case UNIV
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   357
        show ?case by (intro exI[of _ "{{}}"]) simp
51343
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   358
      next
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   359
        case (Int a b)
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   360
        then obtain x y where x: "a = UNION x Inter" "\<And>i. i \<in> x \<Longrightarrow> finite i \<and> i \<subseteq> B"
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   361
          and y: "b = UNION y Inter" "\<And>i. i \<in> y \<Longrightarrow> finite i \<and> i \<subseteq> B"
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   362
          by blast
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   363
        show ?case
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   364
          unfolding x y Int_UN_distrib2
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   365
          by (intro exI[of _ "{i \<union> j| i j.  i \<in> x \<and> j \<in> y}"]) (auto dest: x(2) y(2))
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   366
      next
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   367
        case (UN K)
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   368
        then have "\<forall>k\<in>K. \<exists>B'\<subseteq>{b. finite b \<and> b \<subseteq> B}. UNION B' Inter = k" by auto
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   369
        then obtain k where
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   370
            "\<forall>ka\<in>K. k ka \<subseteq> {b. finite b \<and> b \<subseteq> B} \<and> UNION (k ka) Inter = ka"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   371
          unfolding bchoice_iff ..
51343
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   372
        then show "\<exists>B'\<subseteq>{b. finite b \<and> b \<subseteq> B}. UNION B' Inter = \<Union>K"
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   373
          by (intro exI[of _ "UNION K k"]) auto
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   374
      next
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   375
        case (Basis S)
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   376
        then show ?case
51343
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   377
          by (intro exI[of _ "{{S}}"]) auto
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   378
      qed
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   379
      then have "(\<exists>B'\<subseteq>Inter ` {b. finite b \<and> b \<subseteq> B}. \<Union>B' = S)"
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   380
        unfolding subset_image_iff by blast }
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   381
    then show "topological_basis ?B"
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   382
      unfolding topological_space_class.topological_basis_def
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   383
      by (safe intro!: topological_space_class.open_Inter)
51343
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   384
         (simp_all add: B generate_topology.Basis subset_eq)
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   385
  qed
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   386
qed
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   387
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   388
end
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   389
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   390
sublocale second_countable_topology <
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   391
  countable_basis "SOME B. countable B \<and> topological_basis B"
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   392
  using someI_ex[OF ex_countable_basis]
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   393
  by unfold_locales safe
50094
84ddcf5364b4 allow arbitrary enumerations of basis in locale for generation of borel sets
immler
parents: 50087
diff changeset
   394
50882
a382bf90867e move prod instantiation of second_countable_topology to its definition
hoelzl
parents: 50881
diff changeset
   395
instance prod :: (second_countable_topology, second_countable_topology) second_countable_topology
a382bf90867e move prod instantiation of second_countable_topology to its definition
hoelzl
parents: 50881
diff changeset
   396
proof
a382bf90867e move prod instantiation of second_countable_topology to its definition
hoelzl
parents: 50881
diff changeset
   397
  obtain A :: "'a set set" where "countable A" "topological_basis A"
a382bf90867e move prod instantiation of second_countable_topology to its definition
hoelzl
parents: 50881
diff changeset
   398
    using ex_countable_basis by auto
a382bf90867e move prod instantiation of second_countable_topology to its definition
hoelzl
parents: 50881
diff changeset
   399
  moreover
a382bf90867e move prod instantiation of second_countable_topology to its definition
hoelzl
parents: 50881
diff changeset
   400
  obtain B :: "'b set set" where "countable B" "topological_basis B"
a382bf90867e move prod instantiation of second_countable_topology to its definition
hoelzl
parents: 50881
diff changeset
   401
    using ex_countable_basis by auto
51343
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   402
  ultimately show "\<exists>B::('a \<times> 'b) set set. countable B \<and> open = generate_topology B"
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   403
    by (auto intro!: exI[of _ "(\<lambda>(a, b). a \<times> b) ` (A \<times> B)"] topological_basis_prod
b61b32f62c78 use generate_topology for second countable topologies, does not require intersection stable basis
hoelzl
parents: 51342
diff changeset
   404
      topological_basis_imp_subbasis)
50882
a382bf90867e move prod instantiation of second_countable_topology to its definition
hoelzl
parents: 50881
diff changeset
   405
qed
a382bf90867e move prod instantiation of second_countable_topology to its definition
hoelzl
parents: 50881
diff changeset
   406
50883
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
   407
instance second_countable_topology \<subseteq> first_countable_topology
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
   408
proof
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
   409
  fix x :: 'a
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
   410
  def B \<equiv> "SOME B::'a set set. countable B \<and> topological_basis B"
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
   411
  then have B: "countable B" "topological_basis B"
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
   412
    using countable_basis is_basis
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
   413
    by (auto simp: countable_basis is_basis)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   414
  then show "\<exists>A::nat \<Rightarrow> 'a set.
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   415
    (\<forall>i. x \<in> A i \<and> open (A i)) \<and> (\<forall>S. open S \<and> x \<in> S \<longrightarrow> (\<exists>i. A i \<subseteq> S))"
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51472
diff changeset
   416
    by (intro first_countableI[of "{b\<in>B. x \<in> b}"])
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51472
diff changeset
   417
       (fastforce simp: topological_space_class.topological_basis_def)+
50883
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
   418
qed
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
   419
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   420
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
   421
subsection \<open>Polish spaces\<close>
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
   422
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
   423
text \<open>Textbooks define Polish spaces as completely metrizable.
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
   424
  We assume the topology to be complete for a given metric.\<close>
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   425
50881
ae630bab13da renamed countable_basis_space to second_countable_topology
hoelzl
parents: 50526
diff changeset
   426
class polish_space = complete_space + second_countable_topology
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   427
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
   428
subsection \<open>General notion of a topology as a value\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   429
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   430
definition "istopology L \<longleftrightarrow>
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60462
diff changeset
   431
  L {} \<and> (\<forall>S T. L S \<longrightarrow> L T \<longrightarrow> L (S \<inter> T)) \<and> (\<forall>K. Ball K L \<longrightarrow> L (\<Union>K))"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   432
49834
b27bbb021df1 discontinued obsolete typedef (open) syntax;
wenzelm
parents: 49711
diff changeset
   433
typedef 'a topology = "{L::('a set) \<Rightarrow> bool. istopology L}"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   434
  morphisms "openin" "topology"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   435
  unfolding istopology_def by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   436
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   437
lemma istopology_open_in[intro]: "istopology(openin U)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   438
  using openin[of U] by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   439
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   440
lemma topology_inverse': "istopology U \<Longrightarrow> openin (topology U) = U"
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   441
  using topology_inverse[unfolded mem_Collect_eq] .
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   442
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   443
lemma topology_inverse_iff: "istopology U \<longleftrightarrow> openin (topology U) = U"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   444
  using topology_inverse[of U] istopology_open_in[of "topology U"] by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   445
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   446
lemma topology_eq: "T1 = T2 \<longleftrightarrow> (\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S)"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   447
proof
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   448
  assume "T1 = T2"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   449
  then show "\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S" by simp
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   450
next
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   451
  assume H: "\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   452
  then have "openin T1 = openin T2" by (simp add: fun_eq_iff)
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   453
  then have "topology (openin T1) = topology (openin T2)" by simp
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   454
  then show "T1 = T2" unfolding openin_inverse .
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   455
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   456
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
   457
text\<open>Infer the "universe" from union of all sets in the topology.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   458
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
   459
definition "topspace T = \<Union>{S. openin T S}"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   460
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
   461
subsubsection \<open>Main properties of open sets\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   462
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   463
lemma openin_clauses:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   464
  fixes U :: "'a topology"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   465
  shows
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   466
    "openin U {}"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   467
    "\<And>S T. openin U S \<Longrightarrow> openin U T \<Longrightarrow> openin U (S\<inter>T)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   468
    "\<And>K. (\<forall>S \<in> K. openin U S) \<Longrightarrow> openin U (\<Union>K)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   469
  using openin[of U] unfolding istopology_def mem_Collect_eq by fast+
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   470
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   471
lemma openin_subset[intro]: "openin U S \<Longrightarrow> S \<subseteq> topspace U"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   472
  unfolding topspace_def by blast
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   473
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   474
lemma openin_empty[simp]: "openin U {}"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   475
  by (simp add: openin_clauses)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   476
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   477
lemma openin_Int[intro]: "openin U S \<Longrightarrow> openin U T \<Longrightarrow> openin U (S \<inter> T)"
36362
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36360
diff changeset
   478
  using openin_clauses by simp
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36360
diff changeset
   479
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60462
diff changeset
   480
lemma openin_Union[intro]: "(\<forall>S \<in>K. openin U S) \<Longrightarrow> openin U (\<Union>K)"
36362
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36360
diff changeset
   481
  using openin_clauses by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   482
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   483
lemma openin_Un[intro]: "openin U S \<Longrightarrow> openin U T \<Longrightarrow> openin U (S \<union> T)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   484
  using openin_Union[of "{S,T}" U] by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   485
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   486
lemma openin_topspace[intro, simp]: "openin U (topspace U)"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   487
  by (simp add: openin_Union topspace_def)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   488
49711
e5aaae7eadc9 tuned proofs;
wenzelm
parents: 48125
diff changeset
   489
lemma openin_subopen: "openin U S \<longleftrightarrow> (\<forall>x \<in> S. \<exists>T. openin U T \<and> x \<in> T \<and> T \<subseteq> S)"
e5aaae7eadc9 tuned proofs;
wenzelm
parents: 48125
diff changeset
   490
  (is "?lhs \<longleftrightarrow> ?rhs")
36584
1535841fc2e9 prove lemma openin_subopen without using choice
huffman
parents: 36442
diff changeset
   491
proof
49711
e5aaae7eadc9 tuned proofs;
wenzelm
parents: 48125
diff changeset
   492
  assume ?lhs
e5aaae7eadc9 tuned proofs;
wenzelm
parents: 48125
diff changeset
   493
  then show ?rhs by auto
36584
1535841fc2e9 prove lemma openin_subopen without using choice
huffman
parents: 36442
diff changeset
   494
next
1535841fc2e9 prove lemma openin_subopen without using choice
huffman
parents: 36442
diff changeset
   495
  assume H: ?rhs
1535841fc2e9 prove lemma openin_subopen without using choice
huffman
parents: 36442
diff changeset
   496
  let ?t = "\<Union>{T. openin U T \<and> T \<subseteq> S}"
1535841fc2e9 prove lemma openin_subopen without using choice
huffman
parents: 36442
diff changeset
   497
  have "openin U ?t" by (simp add: openin_Union)
1535841fc2e9 prove lemma openin_subopen without using choice
huffman
parents: 36442
diff changeset
   498
  also have "?t = S" using H by auto
1535841fc2e9 prove lemma openin_subopen without using choice
huffman
parents: 36442
diff changeset
   499
  finally show "openin U S" .
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   500
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   501
49711
e5aaae7eadc9 tuned proofs;
wenzelm
parents: 48125
diff changeset
   502
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
   503
subsubsection \<open>Closed sets\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   504
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   505
definition "closedin U S \<longleftrightarrow> S \<subseteq> topspace U \<and> openin U (topspace U - S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   506
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   507
lemma closedin_subset: "closedin U S \<Longrightarrow> S \<subseteq> topspace U"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   508
  by (metis closedin_def)
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   509
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   510
lemma closedin_empty[simp]: "closedin U {}"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   511
  by (simp add: closedin_def)
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   512
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   513
lemma closedin_topspace[intro, simp]: "closedin U (topspace U)"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   514
  by (simp add: closedin_def)
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   515
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   516
lemma closedin_Un[intro]: "closedin U S \<Longrightarrow> closedin U T \<Longrightarrow> closedin U (S \<union> T)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   517
  by (auto simp add: Diff_Un closedin_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   518
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60462
diff changeset
   519
lemma Diff_Inter[intro]: "A - \<Inter>S = \<Union>{A - s|s. s\<in>S}"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   520
  by auto
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   521
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   522
lemma closedin_Inter[intro]:
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   523
  assumes Ke: "K \<noteq> {}"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   524
    and Kc: "\<forall>S \<in>K. closedin U S"
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60462
diff changeset
   525
  shows "closedin U (\<Inter>K)"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   526
  using Ke Kc unfolding closedin_def Diff_Inter by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   527
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   528
lemma closedin_Int[intro]: "closedin U S \<Longrightarrow> closedin U T \<Longrightarrow> closedin U (S \<inter> T)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   529
  using closedin_Inter[of "{S,T}" U] by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   530
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   531
lemma openin_closedin_eq: "openin U S \<longleftrightarrow> S \<subseteq> topspace U \<and> closedin U (topspace U - S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   532
  apply (auto simp add: closedin_def Diff_Diff_Int inf_absorb2)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   533
  apply (metis openin_subset subset_eq)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   534
  done
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   535
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   536
lemma openin_closedin: "S \<subseteq> topspace U \<Longrightarrow> (openin U S \<longleftrightarrow> closedin U (topspace U - S))"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   537
  by (simp add: openin_closedin_eq)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   538
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   539
lemma openin_diff[intro]:
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   540
  assumes oS: "openin U S"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   541
    and cT: "closedin U T"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   542
  shows "openin U (S - T)"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   543
proof -
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   544
  have "S - T = S \<inter> (topspace U - T)" using openin_subset[of U S]  oS cT
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   545
    by (auto simp add: topspace_def openin_subset)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   546
  then show ?thesis using oS cT
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   547
    by (auto simp add: closedin_def)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   548
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   549
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   550
lemma closedin_diff[intro]:
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   551
  assumes oS: "closedin U S"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   552
    and cT: "openin U T"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   553
  shows "closedin U (S - T)"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   554
proof -
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   555
  have "S - T = S \<inter> (topspace U - T)"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   556
    using closedin_subset[of U S] oS cT by (auto simp add: topspace_def)
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   557
  then show ?thesis
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   558
    using oS cT by (auto simp add: openin_closedin_eq)
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   559
qed
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   560
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   561
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
   562
subsubsection \<open>Subspace topology\<close>
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   563
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   564
definition "subtopology U V = topology (\<lambda>T. \<exists>S. T = S \<inter> V \<and> openin U S)"
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   565
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   566
lemma istopology_subtopology: "istopology (\<lambda>T. \<exists>S. T = S \<inter> V \<and> openin U S)"
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   567
  (is "istopology ?L")
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   568
proof -
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   569
  have "?L {}" by blast
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   570
  {
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   571
    fix A B
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   572
    assume A: "?L A" and B: "?L B"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   573
    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"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   574
      by blast
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   575
    have "A \<inter> B = (Sa \<inter> Sb) \<inter> V" "openin U (Sa \<inter> Sb)"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   576
      using Sa Sb by blast+
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   577
    then have "?L (A \<inter> B)" by blast
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   578
  }
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   579
  moreover
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   580
  {
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   581
    fix K
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   582
    assume K: "K \<subseteq> Collect ?L"
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   583
    have th0: "Collect ?L = (\<lambda>S. S \<inter> V) ` Collect (openin U)"
55775
1557a391a858 A bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 55522
diff changeset
   584
      by blast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   585
    from K[unfolded th0 subset_image_iff]
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   586
    obtain Sk where Sk: "Sk \<subseteq> Collect (openin U)" "K = (\<lambda>S. S \<inter> V) ` Sk"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   587
      by blast
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   588
    have "\<Union>K = (\<Union>Sk) \<inter> V"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   589
      using Sk by auto
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60462
diff changeset
   590
    moreover have "openin U (\<Union>Sk)"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   591
      using Sk by (auto simp add: subset_eq)
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   592
    ultimately have "?L (\<Union>K)" by blast
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   593
  }
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   594
  ultimately show ?thesis
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   595
    unfolding subset_eq mem_Collect_eq istopology_def by blast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   596
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   597
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   598
lemma openin_subtopology: "openin (subtopology U V) S \<longleftrightarrow> (\<exists>T. openin U T \<and> S = T \<inter> V)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   599
  unfolding subtopology_def topology_inverse'[OF istopology_subtopology]
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   600
  by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   601
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   602
lemma topspace_subtopology: "topspace (subtopology U V) = topspace U \<inter> V"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   603
  by (auto simp add: topspace_def openin_subtopology)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   604
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   605
lemma closedin_subtopology: "closedin (subtopology U V) S \<longleftrightarrow> (\<exists>T. closedin U T \<and> S = T \<inter> V)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   606
  unfolding closedin_def topspace_subtopology
55775
1557a391a858 A bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 55522
diff changeset
   607
  by (auto simp add: openin_subtopology)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   608
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   609
lemma openin_subtopology_refl: "openin (subtopology U V) V \<longleftrightarrow> V \<subseteq> topspace U"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   610
  unfolding openin_subtopology
55775
1557a391a858 A bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 55522
diff changeset
   611
  by auto (metis IntD1 in_mono openin_subset)
49711
e5aaae7eadc9 tuned proofs;
wenzelm
parents: 48125
diff changeset
   612
e5aaae7eadc9 tuned proofs;
wenzelm
parents: 48125
diff changeset
   613
lemma subtopology_superset:
e5aaae7eadc9 tuned proofs;
wenzelm
parents: 48125
diff changeset
   614
  assumes UV: "topspace U \<subseteq> V"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   615
  shows "subtopology U V = U"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   616
proof -
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   617
  {
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   618
    fix S
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   619
    {
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   620
      fix T
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   621
      assume T: "openin U T" "S = T \<inter> V"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   622
      from T openin_subset[OF T(1)] UV have eq: "S = T"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   623
        by blast
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   624
      have "openin U S"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   625
        unfolding eq using T by blast
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   626
    }
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   627
    moreover
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   628
    {
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   629
      assume S: "openin U S"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   630
      then have "\<exists>T. openin U T \<and> S = T \<inter> V"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   631
        using openin_subset[OF S] UV by auto
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   632
    }
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   633
    ultimately have "(\<exists>T. openin U T \<and> S = T \<inter> V) \<longleftrightarrow> openin U S"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   634
      by blast
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   635
  }
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   636
  then show ?thesis
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   637
    unfolding topology_eq openin_subtopology by blast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   638
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   639
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   640
lemma subtopology_topspace[simp]: "subtopology U (topspace U) = U"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   641
  by (simp add: subtopology_superset)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   642
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   643
lemma subtopology_UNIV[simp]: "subtopology U UNIV = U"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   644
  by (simp add: subtopology_superset)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   645
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   646
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
   647
subsubsection \<open>The standard Euclidean topology\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   648
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   649
definition euclidean :: "'a::topological_space topology"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   650
  where "euclidean = topology open"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   651
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   652
lemma open_openin: "open S \<longleftrightarrow> openin euclidean S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   653
  unfolding euclidean_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   654
  apply (rule cong[where x=S and y=S])
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   655
  apply (rule topology_inverse[symmetric])
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   656
  apply (auto simp add: istopology_def)
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
   657
  done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   658
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   659
lemma topspace_euclidean: "topspace euclidean = UNIV"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   660
  apply (simp add: topspace_def)
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39198
diff changeset
   661
  apply (rule set_eqI)
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   662
  apply (auto simp add: open_openin[symmetric])
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   663
  done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   664
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   665
lemma topspace_euclidean_subtopology[simp]: "topspace (subtopology euclidean S) = S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   666
  by (simp add: topspace_euclidean topspace_subtopology)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   667
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   668
lemma closed_closedin: "closed S \<longleftrightarrow> closedin euclidean S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   669
  by (simp add: closed_def closedin_def topspace_euclidean open_openin Compl_eq_Diff_UNIV)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   670
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   671
lemma open_subopen: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>T. open T \<and> x \<in> T \<and> T \<subseteq> S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   672
  by (simp add: open_openin openin_subopen[symmetric])
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   673
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
   674
text \<open>Basic "localization" results are handy for connectedness.\<close>
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   675
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   676
lemma openin_open: "openin (subtopology euclidean U) S \<longleftrightarrow> (\<exists>T. open T \<and> (S = U \<inter> T))"
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   677
  by (auto simp add: openin_subtopology open_openin[symmetric])
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   678
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   679
lemma openin_open_Int[intro]: "open S \<Longrightarrow> openin (subtopology euclidean U) (U \<inter> S)"
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   680
  by (auto simp add: openin_open)
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   681
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   682
lemma open_openin_trans[trans]:
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   683
  "open S \<Longrightarrow> open T \<Longrightarrow> T \<subseteq> S \<Longrightarrow> openin (subtopology euclidean S) T"
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   684
  by (metis Int_absorb1  openin_open_Int)
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   685
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   686
lemma open_subset: "S \<subseteq> T \<Longrightarrow> open S \<Longrightarrow> openin (subtopology euclidean T) S"
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   687
  by (auto simp add: openin_open)
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   688
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   689
lemma closedin_closed: "closedin (subtopology euclidean U) S \<longleftrightarrow> (\<exists>T. closed T \<and> S = U \<inter> T)"
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   690
  by (simp add: closedin_subtopology closed_closedin Int_ac)
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   691
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
   692
lemma closedin_closed_Int: "closed S \<Longrightarrow> closedin (subtopology euclidean U) (U \<inter> S)"
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   693
  by (metis closedin_closed)
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   694
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   695
lemma closed_closedin_trans:
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   696
  "closed S \<Longrightarrow> closed T \<Longrightarrow> T \<subseteq> S \<Longrightarrow> closedin (subtopology euclidean S) T"
55775
1557a391a858 A bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 55522
diff changeset
   697
  by (metis closedin_closed inf.absorb2)
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   698
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   699
lemma closed_subset: "S \<subseteq> T \<Longrightarrow> closed S \<Longrightarrow> closedin (subtopology euclidean T) S"
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   700
  by (auto simp add: closedin_closed)
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   701
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   702
lemma openin_euclidean_subtopology_iff:
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   703
  fixes S U :: "'a::metric_space set"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   704
  shows "openin (subtopology euclidean U) S \<longleftrightarrow>
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   705
    S \<subseteq> U \<and> (\<forall>x\<in>S. \<exists>e>0. \<forall>x'\<in>U. dist x' x < e \<longrightarrow> x'\<in> S)"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   706
  (is "?lhs \<longleftrightarrow> ?rhs")
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   707
proof
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   708
  assume ?lhs
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   709
  then show ?rhs
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   710
    unfolding openin_open open_dist by blast
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   711
next
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   712
  def T \<equiv> "{x. \<exists>a\<in>S. \<exists>d>0. (\<forall>y\<in>U. dist y a < d \<longrightarrow> y \<in> S) \<and> dist x a < d}"
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   713
  have 1: "\<forall>x\<in>T. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> T"
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   714
    unfolding T_def
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   715
    apply clarsimp
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   716
    apply (rule_tac x="d - dist x a" in exI)
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   717
    apply (clarsimp simp add: less_diff_eq)
55775
1557a391a858 A bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 55522
diff changeset
   718
    by (metis dist_commute dist_triangle_lt)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   719
  assume ?rhs then have 2: "S = U \<inter> T"
60141
833adf7db7d8 New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents: 60040
diff changeset
   720
    unfolding T_def
55775
1557a391a858 A bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 55522
diff changeset
   721
    by auto (metis dist_self)
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   722
  from 1 2 show ?lhs
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   723
    unfolding openin_open open_dist by fast
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   724
qed
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61552
diff changeset
   725
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   726
lemma connected_open_in:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   727
      "connected s \<longleftrightarrow>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   728
       ~(\<exists>e1 e2. openin (subtopology euclidean s) e1 \<and>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   729
                 openin (subtopology euclidean s) e2 \<and>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   730
                 s \<subseteq> e1 \<union> e2 \<and> e1 \<inter> e2 = {} \<and> e1 \<noteq> {} \<and> e2 \<noteq> {})"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   731
  apply (simp add: connected_def openin_open, safe)
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61806
diff changeset
   732
  apply (simp_all, blast+)  \<comment>\<open>slow\<close>
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   733
  done
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   734
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   735
lemma connected_open_in_eq:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   736
      "connected s \<longleftrightarrow>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   737
       ~(\<exists>e1 e2. openin (subtopology euclidean s) e1 \<and>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   738
                 openin (subtopology euclidean s) e2 \<and>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   739
                 e1 \<union> e2 = s \<and> e1 \<inter> e2 = {} \<and>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   740
                 e1 \<noteq> {} \<and> e2 \<noteq> {})"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   741
  apply (simp add: connected_open_in, safe)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   742
  apply blast
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   743
  by (metis Int_lower1 Un_subset_iff openin_open subset_antisym)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   744
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   745
lemma connected_closed_in:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   746
      "connected s \<longleftrightarrow>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   747
       ~(\<exists>e1 e2.
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   748
             closedin (subtopology euclidean s) e1 \<and>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   749
             closedin (subtopology euclidean s) e2 \<and>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   750
             s \<subseteq> e1 \<union> e2 \<and> e1 \<inter> e2 = {} \<and>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   751
             e1 \<noteq> {} \<and> e2 \<noteq> {})"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   752
proof -
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   753
  { fix A B x x'
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   754
    assume s_sub: "s \<subseteq> A \<union> B"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   755
       and disj: "A \<inter> B \<inter> s = {}"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   756
       and x: "x \<in> s" "x \<in> B" and x': "x' \<in> s" "x' \<in> A"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   757
       and cl: "closed A" "closed B"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   758
    assume "\<forall>e1. (\<forall>T. closed T \<longrightarrow> e1 \<noteq> s \<inter> T) \<or> (\<forall>e2. e1 \<inter> e2 = {} \<longrightarrow> s \<subseteq> e1 \<union> e2 \<longrightarrow> (\<forall>T. closed T \<longrightarrow> e2 \<noteq> s \<inter> T) \<or> e1 = {} \<or> e2 = {})"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   759
    then have "\<And>C D. s \<inter> C = {} \<or> s \<inter> D = {} \<or> s \<inter> (C \<inter> (s \<inter> D)) \<noteq> {} \<or> \<not> s \<subseteq> s \<inter> (C \<union> D) \<or> \<not> closed C \<or> \<not> closed D"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   760
      by (metis (no_types) Int_Un_distrib Int_assoc)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   761
    moreover have "s \<inter> (A \<inter> B) = {}" "s \<inter> (A \<union> B) = s" "s \<inter> B \<noteq> {}"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   762
      using disj s_sub x by blast+
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   763
    ultimately have "s \<inter> A = {}"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   764
      using cl by (metis inf.left_commute inf_bot_right order_refl)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   765
    then have False
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   766
      using x' by blast
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   767
  } note * = this
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   768
  show ?thesis
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   769
    apply (simp add: connected_closed closedin_closed)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   770
    apply (safe; simp)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   771
    apply blast
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   772
    apply (blast intro: *)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   773
    done
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   774
qed
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   775
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   776
lemma connected_closed_in_eq:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   777
      "connected s \<longleftrightarrow>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   778
           ~(\<exists>e1 e2.
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   779
                 closedin (subtopology euclidean s) e1 \<and>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   780
                 closedin (subtopology euclidean s) e2 \<and>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   781
                 e1 \<union> e2 = s \<and> e1 \<inter> e2 = {} \<and>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   782
                 e1 \<noteq> {} \<and> e2 \<noteq> {})"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   783
  apply (simp add: connected_closed_in, safe)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   784
  apply blast
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
   785
  by (metis Int_lower1 Un_subset_iff closedin_closed subset_antisym)
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61552
diff changeset
   786
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
   787
text \<open>These "transitivity" results are handy too\<close>
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   788
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   789
lemma openin_trans[trans]:
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   790
  "openin (subtopology euclidean T) S \<Longrightarrow> openin (subtopology euclidean U) T \<Longrightarrow>
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   791
    openin (subtopology euclidean U) S"
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   792
  unfolding open_openin openin_open by blast
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   793
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   794
lemma openin_open_trans: "openin (subtopology euclidean T) S \<Longrightarrow> open T \<Longrightarrow> open S"
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   795
  by (auto simp add: openin_open intro: openin_trans)
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   796
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   797
lemma closedin_trans[trans]:
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   798
  "closedin (subtopology euclidean T) S \<Longrightarrow> closedin (subtopology euclidean U) T \<Longrightarrow>
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   799
    closedin (subtopology euclidean U) S"
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   800
  by (auto simp add: closedin_closed closed_closedin closed_Inter Int_assoc)
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   801
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   802
lemma closedin_closed_trans: "closedin (subtopology euclidean T) S \<Longrightarrow> closed T \<Longrightarrow> closed S"
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   803
  by (auto simp add: closedin_closed intro: closedin_trans)
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   804
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   805
lemma openin_subtopology_inter_subset:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   806
   "openin (subtopology euclidean u) (u \<inter> s) \<and> v \<subseteq> u \<Longrightarrow> openin (subtopology euclidean v) (v \<inter> s)"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   807
  by (auto simp: openin_subtopology)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   808
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   809
lemma openin_open_eq: "open s \<Longrightarrow> (openin (subtopology euclidean s) t \<longleftrightarrow> open t \<and> t \<subseteq> s)"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   810
  using open_subset openin_open_trans openin_subset by fastforce
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   811
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
   812
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
   813
subsection \<open>Open and closed balls\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   814
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   815
definition ball :: "'a::metric_space \<Rightarrow> real \<Rightarrow> 'a set"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   816
  where "ball x e = {y. dist x y < e}"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   817
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   818
definition cball :: "'a::metric_space \<Rightarrow> real \<Rightarrow> 'a set"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   819
  where "cball x e = {y. dist x y \<le> e}"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   820
61762
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
   821
definition sphere :: "'a::metric_space \<Rightarrow> real \<Rightarrow> 'a set"
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
   822
  where "sphere x e = {y. dist x y = e}"
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
   823
45776
714100f5fda4 remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
huffman
parents: 45548
diff changeset
   824
lemma mem_ball [simp]: "y \<in> ball x e \<longleftrightarrow> dist x y < e"
714100f5fda4 remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
huffman
parents: 45548
diff changeset
   825
  by (simp add: ball_def)
714100f5fda4 remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
huffman
parents: 45548
diff changeset
   826
714100f5fda4 remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
huffman
parents: 45548
diff changeset
   827
lemma mem_cball [simp]: "y \<in> cball x e \<longleftrightarrow> dist x y \<le> e"
714100f5fda4 remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
huffman
parents: 45548
diff changeset
   828
  by (simp add: cball_def)
714100f5fda4 remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
huffman
parents: 45548
diff changeset
   829
61848
9250e546ab23 New complex analysis material
paulson <lp15@cam.ac.uk>
parents: 61824
diff changeset
   830
lemma mem_sphere [simp]: "y \<in> sphere x e \<longleftrightarrow> dist x y = e"
9250e546ab23 New complex analysis material
paulson <lp15@cam.ac.uk>
parents: 61824
diff changeset
   831
  by (simp add: sphere_def)
9250e546ab23 New complex analysis material
paulson <lp15@cam.ac.uk>
parents: 61824
diff changeset
   832
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   833
lemma ball_trivial [simp]: "ball x 0 = {}"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   834
  by (simp add: ball_def)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   835
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   836
lemma cball_trivial [simp]: "cball x 0 = {x}"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   837
  by (simp add: cball_def)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   838
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   839
lemma mem_ball_0 [simp]:
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   840
  fixes x :: "'a::real_normed_vector"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   841
  shows "x \<in> ball 0 e \<longleftrightarrow> norm x < e"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   842
  by (simp add: dist_norm)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   843
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   844
lemma mem_cball_0 [simp]:
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   845
  fixes x :: "'a::real_normed_vector"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   846
  shows "x \<in> cball 0 e \<longleftrightarrow> norm x \<le> e"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   847
  by (simp add: dist_norm)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   848
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   849
lemma centre_in_ball [simp]: "x \<in> ball x e \<longleftrightarrow> 0 < e"
45776
714100f5fda4 remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
huffman
parents: 45548
diff changeset
   850
  by simp
714100f5fda4 remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
huffman
parents: 45548
diff changeset
   851
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   852
lemma centre_in_cball [simp]: "x \<in> cball x e \<longleftrightarrow> 0 \<le> e"
45776
714100f5fda4 remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
huffman
parents: 45548
diff changeset
   853
  by simp
714100f5fda4 remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
huffman
parents: 45548
diff changeset
   854
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
   855
lemma ball_subset_cball [simp,intro]: "ball x e \<subseteq> cball x e"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   856
  by (simp add: subset_eq)
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   857
61907
f0c894ab18c9 Liouville theorem, Fundamental Theorem of Algebra, etc.
paulson <lp15@cam.ac.uk>
parents: 61880
diff changeset
   858
lemma sphere_cball [simp,intro]: "sphere z r \<subseteq> cball z r"
f0c894ab18c9 Liouville theorem, Fundamental Theorem of Algebra, etc.
paulson <lp15@cam.ac.uk>
parents: 61880
diff changeset
   859
  by force
f0c894ab18c9 Liouville theorem, Fundamental Theorem of Algebra, etc.
paulson <lp15@cam.ac.uk>
parents: 61880
diff changeset
   860
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   861
lemma subset_ball[intro]: "d \<le> e \<Longrightarrow> ball x d \<subseteq> ball x e"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   862
  by (simp add: subset_eq)
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   863
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   864
lemma subset_cball[intro]: "d \<le> e \<Longrightarrow> cball x d \<subseteq> cball x e"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   865
  by (simp add: subset_eq)
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   866
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   867
lemma ball_max_Un: "ball a (max r s) = ball a r \<union> ball a s"
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39198
diff changeset
   868
  by (simp add: set_eq_iff) arith
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   869
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   870
lemma ball_min_Int: "ball a (min r s) = ball a r \<inter> ball a s"
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39198
diff changeset
   871
  by (simp add: set_eq_iff)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   872
61426
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
   873
lemma cball_diff_eq_sphere: "cball a r - ball a r =  {x. dist x a = r}"
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
   874
  by (auto simp: cball_def ball_def dist_commute)
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
   875
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
   876
lemma open_ball [intro, simp]: "open (ball x e)"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
   877
proof -
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
   878
  have "open (dist x -` {..<e})"
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56290
diff changeset
   879
    by (intro open_vimage open_lessThan continuous_intros)
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
   880
  also have "dist x -` {..<e} = ball x e"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
   881
    by auto
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
   882
  finally show ?thesis .
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
   883
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   884
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   885
lemma open_contains_ball: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e>0. ball x e \<subseteq> S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   886
  unfolding open_dist subset_eq mem_ball Ball_def dist_commute ..
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   887
33714
eb2574ac4173 Added new lemmas to Euclidean Space by Robert Himmelmann
hoelzl
parents: 33324
diff changeset
   888
lemma openE[elim?]:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
   889
  assumes "open S" "x\<in>S"
33714
eb2574ac4173 Added new lemmas to Euclidean Space by Robert Himmelmann
hoelzl
parents: 33324
diff changeset
   890
  obtains e where "e>0" "ball x e \<subseteq> S"
eb2574ac4173 Added new lemmas to Euclidean Space by Robert Himmelmann
hoelzl
parents: 33324
diff changeset
   891
  using assms unfolding open_contains_ball by auto
eb2574ac4173 Added new lemmas to Euclidean Space by Robert Himmelmann
hoelzl
parents: 33324
diff changeset
   892
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   893
lemma open_contains_ball_eq: "open S \<Longrightarrow> \<forall>x. x\<in>S \<longleftrightarrow> (\<exists>e>0. ball x e \<subseteq> S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   894
  by (metis open_contains_ball subset_eq centre_in_ball)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   895
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   896
lemma ball_eq_empty[simp]: "ball x e = {} \<longleftrightarrow> e \<le> 0"
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39198
diff changeset
   897
  unfolding mem_ball set_eq_iff
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   898
  apply (simp add: not_less)
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
   899
  apply (metis zero_le_dist order_trans dist_self)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
   900
  done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   901
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
   902
lemma ball_empty: "e \<le> 0 \<Longrightarrow> ball x e = {}" by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
   903
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   904
lemma euclidean_dist_l2:
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   905
  fixes x y :: "'a :: euclidean_space"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   906
  shows "dist x y = setL2 (\<lambda>i. dist (x \<bullet> i) (y \<bullet> i)) Basis"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   907
  unfolding dist_norm norm_eq_sqrt_inner setL2_def
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   908
  by (subst euclidean_inner) (simp add: power2_eq_square inner_diff_left)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   909
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
   910
lemma eventually_nhds_ball: "d > 0 \<Longrightarrow> eventually (\<lambda>x. x \<in> ball z d) (nhds z)"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
   911
  by (rule eventually_nhds_in_open) simp_all
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
   912
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
   913
lemma eventually_at_ball: "d > 0 \<Longrightarrow> eventually (\<lambda>t. t \<in> ball z d \<and> t \<in> A) (at z within A)"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
   914
  unfolding eventually_at by (intro exI[of _ d]) (simp_all add: dist_commute)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
   915
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
   916
lemma eventually_at_ball': "d > 0 \<Longrightarrow> eventually (\<lambda>t. t \<in> ball z d \<and> t \<noteq> z \<and> t \<in> A) (at z within A)"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
   917
  unfolding eventually_at by (intro exI[of _ d]) (simp_all add: dist_commute)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
   918
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
   919
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
   920
subsection \<open>Boxes\<close>
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
   921
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
   922
abbreviation One :: "'a::euclidean_space"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
   923
  where "One \<equiv> \<Sum>Basis"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
   924
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54489
diff changeset
   925
definition (in euclidean_space) eucl_less (infix "<e" 50)
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54489
diff changeset
   926
  where "eucl_less a b \<longleftrightarrow> (\<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i)"
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54489
diff changeset
   927
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54489
diff changeset
   928
definition box_eucl_less: "box a b = {x. a <e x \<and> x <e b}"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56166
diff changeset
   929
definition "cbox a b = {x. \<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i}"
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54489
diff changeset
   930
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54489
diff changeset
   931
lemma box_def: "box a b = {x. \<forall>i\<in>Basis. a \<bullet> i < x \<bullet> i \<and> x \<bullet> i < b \<bullet> i}"
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54489
diff changeset
   932
  and in_box_eucl_less: "x \<in> box a b \<longleftrightarrow> a <e x \<and> x <e b"
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56166
diff changeset
   933
  and mem_box: "x \<in> box a b \<longleftrightarrow> (\<forall>i\<in>Basis. a \<bullet> i < x \<bullet> i \<and> x \<bullet> i < b \<bullet> i)"
0268784f60da use cbox to relax class constraints
immler
parents: 56166
diff changeset
   934
    "x \<in> cbox a b \<longleftrightarrow> (\<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i)"
0268784f60da use cbox to relax class constraints
immler
parents: 56166
diff changeset
   935
  by (auto simp: box_eucl_less eucl_less_def cbox_def)
0268784f60da use cbox to relax class constraints
immler
parents: 56166
diff changeset
   936
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   937
lemma cbox_Pair_eq: "cbox (a, c) (b, d) = cbox a b \<times> cbox c d"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   938
  by (force simp: cbox_def Basis_prod_def)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   939
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   940
lemma cbox_Pair_iff [iff]: "(x, y) \<in> cbox (a, c) (b, d) \<longleftrightarrow> x \<in> cbox a b \<and> y \<in> cbox c d"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   941
  by (force simp: cbox_Pair_eq)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   942
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   943
lemma cbox_Pair_eq_0: "cbox (a, c) (b, d) = {} \<longleftrightarrow> cbox a b = {} \<or> cbox c d = {}"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   944
  by (force simp: cbox_Pair_eq)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   945
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   946
lemma swap_cbox_Pair [simp]: "prod.swap ` cbox (c, a) (d, b) = cbox (a,c) (b,d)"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   947
  by auto
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
   948
56188
0268784f60da use cbox to relax class constraints
immler
parents: 56166
diff changeset
   949
lemma mem_box_real[simp]:
0268784f60da use cbox to relax class constraints
immler
parents: 56166
diff changeset
   950
  "(x::real) \<in> box a b \<longleftrightarrow> a < x \<and> x < b"
0268784f60da use cbox to relax class constraints
immler
parents: 56166
diff changeset
   951
  "(x::real) \<in> cbox a b \<longleftrightarrow> a \<le> x \<and> x \<le> b"
0268784f60da use cbox to relax class constraints
immler
parents: 56166
diff changeset
   952
  by (auto simp: mem_box)
0268784f60da use cbox to relax class constraints
immler
parents: 56166
diff changeset
   953
0268784f60da use cbox to relax class constraints
immler
parents: 56166
diff changeset
   954
lemma box_real[simp]:
0268784f60da use cbox to relax class constraints
immler
parents: 56166
diff changeset
   955
  fixes a b:: real
0268784f60da use cbox to relax class constraints
immler
parents: 56166
diff changeset
   956
  shows "box a b = {a <..< b}" "cbox a b = {a .. b}"
0268784f60da use cbox to relax class constraints
immler
parents: 56166
diff changeset
   957
  by auto
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   958
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
   959
lemma box_Int_box:
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
   960
  fixes a :: "'a::euclidean_space"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
   961
  shows "box a b \<inter> box c d =
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
   962
    box (\<Sum>i\<in>Basis. max (a\<bullet>i) (c\<bullet>i) *\<^sub>R i) (\<Sum>i\<in>Basis. min (b\<bullet>i) (d\<bullet>i) *\<^sub>R i)"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
   963
  unfolding set_eq_iff and Int_iff and mem_box by auto
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
   964
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   965
lemma rational_boxes:
61076
bdc1e2f0a86a eliminated \<Colon>;
wenzelm
parents: 60974
diff changeset
   966
  fixes x :: "'a::euclidean_space"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
   967
  assumes "e > 0"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   968
  shows "\<exists>a b. (\<forall>i\<in>Basis. a \<bullet> i \<in> \<rat> \<and> b \<bullet> i \<in> \<rat> ) \<and> x \<in> box a b \<and> box a b \<subseteq> ball x e"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   969
proof -
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   970
  def e' \<equiv> "e / (2 * sqrt (real (DIM ('a))))"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
   971
  then have e: "e' > 0"
56541
0e3abadbef39 made divide_pos_pos a simp rule
nipkow
parents: 56371
diff changeset
   972
    using assms by (auto simp: DIM_positive)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   973
  have "\<forall>i. \<exists>y. y \<in> \<rat> \<and> y < x \<bullet> i \<and> x \<bullet> i - y < e'" (is "\<forall>i. ?th i")
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   974
  proof
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   975
    fix i
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   976
    from Rats_dense_in_real[of "x \<bullet> i - e'" "x \<bullet> i"] e
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   977
    show "?th i" by auto
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   978
  qed
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   979
  from choice[OF this] obtain a where
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   980
    a: "\<forall>xa. a xa \<in> \<rat> \<and> a xa < x \<bullet> xa \<and> x \<bullet> xa - a xa < e'" ..
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   981
  have "\<forall>i. \<exists>y. y \<in> \<rat> \<and> x \<bullet> i < y \<and> y - x \<bullet> i < e'" (is "\<forall>i. ?th i")
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   982
  proof
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   983
    fix i
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   984
    from Rats_dense_in_real[of "x \<bullet> i" "x \<bullet> i + e'"] e
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   985
    show "?th i" by auto
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   986
  qed
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   987
  from choice[OF this] obtain b where
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
   988
    b: "\<forall>xa. b xa \<in> \<rat> \<and> x \<bullet> xa < b xa \<and> b xa - x \<bullet> xa < e'" ..
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   989
  let ?a = "\<Sum>i\<in>Basis. a i *\<^sub>R i" and ?b = "\<Sum>i\<in>Basis. b i *\<^sub>R i"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   990
  show ?thesis
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   991
  proof (rule exI[of _ ?a], rule exI[of _ ?b], safe)
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   992
    fix y :: 'a
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   993
    assume *: "y \<in> box ?a ?b"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 52625
diff changeset
   994
    have "dist x y = sqrt (\<Sum>i\<in>Basis. (dist (x \<bullet> i) (y \<bullet> i))\<^sup>2)"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   995
      unfolding setL2_def[symmetric] by (rule euclidean_dist_l2)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
   996
    also have "\<dots> < sqrt (\<Sum>(i::'a)\<in>Basis. e^2 / real (DIM('a)))"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
   997
    proof (rule real_sqrt_less_mono, rule setsum_strict_mono)
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   998
      fix i :: "'a"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
   999
      assume i: "i \<in> Basis"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1000
      have "a i < y\<bullet>i \<and> y\<bullet>i < b i"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1001
        using * i by (auto simp: box_def)
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1002
      moreover have "a i < x\<bullet>i" "x\<bullet>i - a i < e'"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1003
        using a by auto
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1004
      moreover have "x\<bullet>i < b i" "b i - x\<bullet>i < e'"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1005
        using b by auto
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1006
      ultimately have "\<bar>x\<bullet>i - y\<bullet>i\<bar> < 2 * e'"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1007
        by auto
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  1008
      then have "dist (x \<bullet> i) (y \<bullet> i) < e/sqrt (real (DIM('a)))"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  1009
        unfolding e'_def by (auto simp: dist_real_def)
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 52625
diff changeset
  1010
      then have "(dist (x \<bullet> i) (y \<bullet> i))\<^sup>2 < (e/sqrt (real (DIM('a))))\<^sup>2"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  1011
        by (rule power_strict_mono) auto
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 52625
diff changeset
  1012
      then show "(dist (x \<bullet> i) (y \<bullet> i))\<^sup>2 < e\<^sup>2 / real DIM('a)"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  1013
        by (simp add: power_divide)
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  1014
    qed auto
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1015
    also have "\<dots> = e"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61552
diff changeset
  1016
      using \<open>0 < e\<close> by simp
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1017
    finally show "y \<in> ball x e"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1018
      by (auto simp: ball_def)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  1019
  qed (insert a b, auto simp: box_def)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  1020
qed
51103
5dd7b89a16de generalized
immler
parents: 51102
diff changeset
  1021
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  1022
lemma open_UNION_box:
61076
bdc1e2f0a86a eliminated \<Colon>;
wenzelm
parents: 60974
diff changeset
  1023
  fixes M :: "'a::euclidean_space set"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  1024
  assumes "open M"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  1025
  defines "a' \<equiv> \<lambda>f :: 'a \<Rightarrow> real \<times> real. (\<Sum>(i::'a)\<in>Basis. fst (f i) *\<^sub>R i)"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  1026
  defines "b' \<equiv> \<lambda>f :: 'a \<Rightarrow> real \<times> real. (\<Sum>(i::'a)\<in>Basis. snd (f i) *\<^sub>R i)"
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 52625
diff changeset
  1027
  defines "I \<equiv> {f\<in>Basis \<rightarrow>\<^sub>E \<rat> \<times> \<rat>. box (a' f) (b' f) \<subseteq> M}"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  1028
  shows "M = (\<Union>f\<in>I. box (a' f) (b' f))"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  1029
proof -
60462
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  1030
  have "x \<in> (\<Union>f\<in>I. box (a' f) (b' f))" if "x \<in> M" for x
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  1031
  proof -
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  1032
    obtain e where e: "e > 0" "ball x e \<subseteq> M"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  1033
      using openE[OF \<open>open M\<close> \<open>x \<in> M\<close>] by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  1034
    moreover obtain a b where ab:
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  1035
      "x \<in> box a b"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  1036
      "\<forall>i \<in> Basis. a \<bullet> i \<in> \<rat>"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  1037
      "\<forall>i\<in>Basis. b \<bullet> i \<in> \<rat>"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  1038
      "box a b \<subseteq> ball x e"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  1039
      using rational_boxes[OF e(1)] by metis
60462
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  1040
    ultimately show ?thesis
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  1041
       by (intro UN_I[of "\<lambda>i\<in>Basis. (a \<bullet> i, b \<bullet> i)"])
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  1042
          (auto simp: euclidean_representation I_def a'_def b'_def)
60462
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  1043
  qed
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  1044
  then show ?thesis by (auto simp: I_def)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  1045
qed
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  1046
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1047
lemma box_eq_empty:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1048
  fixes a :: "'a::euclidean_space"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1049
  shows "(box a b = {} \<longleftrightarrow> (\<exists>i\<in>Basis. b\<bullet>i \<le> a\<bullet>i))" (is ?th1)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1050
    and "(cbox a b = {} \<longleftrightarrow> (\<exists>i\<in>Basis. b\<bullet>i < a\<bullet>i))" (is ?th2)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1051
proof -
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1052
  {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1053
    fix i x
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1054
    assume i: "i\<in>Basis" and as:"b\<bullet>i \<le> a\<bullet>i" and x:"x\<in>box a b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1055
    then have "a \<bullet> i < x \<bullet> i \<and> x \<bullet> i < b \<bullet> i"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1056
      unfolding mem_box by (auto simp: box_def)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1057
    then have "a\<bullet>i < b\<bullet>i" by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1058
    then have False using as by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1059
  }
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1060
  moreover
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1061
  {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1062
    assume as: "\<forall>i\<in>Basis. \<not> (b\<bullet>i \<le> a\<bullet>i)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1063
    let ?x = "(1/2) *\<^sub>R (a + b)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1064
    {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1065
      fix i :: 'a
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1066
      assume i: "i \<in> Basis"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1067
      have "a\<bullet>i < b\<bullet>i"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1068
        using as[THEN bspec[where x=i]] i by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1069
      then have "a\<bullet>i < ((1/2) *\<^sub>R (a+b)) \<bullet> i" "((1/2) *\<^sub>R (a+b)) \<bullet> i < b\<bullet>i"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1070
        by (auto simp: inner_add_left)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1071
    }
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1072
    then have "box a b \<noteq> {}"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1073
      using mem_box(1)[of "?x" a b] by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1074
  }
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1075
  ultimately show ?th1 by blast
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1076
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1077
  {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1078
    fix i x
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1079
    assume i: "i \<in> Basis" and as:"b\<bullet>i < a\<bullet>i" and x:"x\<in>cbox a b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1080
    then have "a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1081
      unfolding mem_box by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1082
    then have "a\<bullet>i \<le> b\<bullet>i" by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1083
    then have False using as by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1084
  }
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1085
  moreover
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1086
  {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1087
    assume as:"\<forall>i\<in>Basis. \<not> (b\<bullet>i < a\<bullet>i)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1088
    let ?x = "(1/2) *\<^sub>R (a + b)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1089
    {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1090
      fix i :: 'a
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1091
      assume i:"i \<in> Basis"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1092
      have "a\<bullet>i \<le> b\<bullet>i"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1093
        using as[THEN bspec[where x=i]] i by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1094
      then have "a\<bullet>i \<le> ((1/2) *\<^sub>R (a+b)) \<bullet> i" "((1/2) *\<^sub>R (a+b)) \<bullet> i \<le> b\<bullet>i"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1095
        by (auto simp: inner_add_left)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1096
    }
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1097
    then have "cbox a b \<noteq> {}"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1098
      using mem_box(2)[of "?x" a b] by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1099
  }
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1100
  ultimately show ?th2 by blast
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1101
qed
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1102
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1103
lemma box_ne_empty:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1104
  fixes a :: "'a::euclidean_space"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1105
  shows "cbox a b \<noteq> {} \<longleftrightarrow> (\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1106
  and "box a b \<noteq> {} \<longleftrightarrow> (\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1107
  unfolding box_eq_empty[of a b] by fastforce+
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1108
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1109
lemma
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1110
  fixes a :: "'a::euclidean_space"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1111
  shows cbox_sing: "cbox a a = {a}"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1112
    and box_sing: "box a a = {}"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1113
  unfolding set_eq_iff mem_box eq_iff [symmetric]
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1114
  by (auto intro!: euclidean_eqI[where 'a='a])
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1115
     (metis all_not_in_conv nonempty_Basis)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1116
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1117
lemma subset_box_imp:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1118
  fixes a :: "'a::euclidean_space"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1119
  shows "(\<forall>i\<in>Basis. a\<bullet>i \<le> c\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i) \<Longrightarrow> cbox c d \<subseteq> cbox a b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1120
    and "(\<forall>i\<in>Basis. a\<bullet>i < c\<bullet>i \<and> d\<bullet>i < b\<bullet>i) \<Longrightarrow> cbox c d \<subseteq> box a b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1121
    and "(\<forall>i\<in>Basis. a\<bullet>i \<le> c\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i) \<Longrightarrow> box c d \<subseteq> cbox a b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1122
     and "(\<forall>i\<in>Basis. a\<bullet>i \<le> c\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i) \<Longrightarrow> box c d \<subseteq> box a b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1123
  unfolding subset_eq[unfolded Ball_def] unfolding mem_box
58757
7f4924f23158 tuned whitespace;
wenzelm
parents: 58184
diff changeset
  1124
  by (best intro: order_trans less_le_trans le_less_trans less_imp_le)+
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1125
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1126
lemma box_subset_cbox:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1127
  fixes a :: "'a::euclidean_space"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1128
  shows "box a b \<subseteq> cbox a b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1129
  unfolding subset_eq [unfolded Ball_def] mem_box
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1130
  by (fast intro: less_imp_le)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1131
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1132
lemma subset_box:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1133
  fixes a :: "'a::euclidean_space"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1134
  shows "cbox c d \<subseteq> cbox a b \<longleftrightarrow> (\<forall>i\<in>Basis. c\<bullet>i \<le> d\<bullet>i) --> (\<forall>i\<in>Basis. a\<bullet>i \<le> c\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i)" (is ?th1)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1135
    and "cbox c d \<subseteq> box a b \<longleftrightarrow> (\<forall>i\<in>Basis. c\<bullet>i \<le> d\<bullet>i) --> (\<forall>i\<in>Basis. a\<bullet>i < c\<bullet>i \<and> d\<bullet>i < b\<bullet>i)" (is ?th2)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1136
    and "box c d \<subseteq> cbox a b \<longleftrightarrow> (\<forall>i\<in>Basis. c\<bullet>i < d\<bullet>i) --> (\<forall>i\<in>Basis. a\<bullet>i \<le> c\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i)" (is ?th3)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1137
    and "box c d \<subseteq> box a b \<longleftrightarrow> (\<forall>i\<in>Basis. c\<bullet>i < d\<bullet>i) --> (\<forall>i\<in>Basis. a\<bullet>i \<le> c\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i)" (is ?th4)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1138
proof -
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1139
  show ?th1
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1140
    unfolding subset_eq and Ball_def and mem_box
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1141
    by (auto intro: order_trans)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1142
  show ?th2
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1143
    unfolding subset_eq and Ball_def and mem_box
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1144
    by (auto intro: le_less_trans less_le_trans order_trans less_imp_le)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1145
  {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1146
    assume as: "box c d \<subseteq> cbox a b" "\<forall>i\<in>Basis. c\<bullet>i < d\<bullet>i"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1147
    then have "box c d \<noteq> {}"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1148
      unfolding box_eq_empty by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1149
    fix i :: 'a
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1150
    assume i: "i \<in> Basis"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1151
    (** TODO combine the following two parts as done in the HOL_light version. **)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1152
    {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1153
      let ?x = "(\<Sum>j\<in>Basis. (if j=i then ((min (a\<bullet>j) (d\<bullet>j))+c\<bullet>j)/2 else (c\<bullet>j+d\<bullet>j)/2) *\<^sub>R j)::'a"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1154
      assume as2: "a\<bullet>i > c\<bullet>i"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1155
      {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1156
        fix j :: 'a
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1157
        assume j: "j \<in> Basis"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1158
        then have "c \<bullet> j < ?x \<bullet> j \<and> ?x \<bullet> j < d \<bullet> j"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1159
          apply (cases "j = i")
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1160
          using as(2)[THEN bspec[where x=j]] i
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1161
          apply (auto simp add: as2)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1162
          done
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1163
      }
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1164
      then have "?x\<in>box c d"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1165
        using i unfolding mem_box by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1166
      moreover
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1167
      have "?x \<notin> cbox a b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1168
        unfolding mem_box
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1169
        apply auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1170
        apply (rule_tac x=i in bexI)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1171
        using as(2)[THEN bspec[where x=i]] and as2 i
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1172
        apply auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1173
        done
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1174
      ultimately have False using as by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1175
    }
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1176
    then have "a\<bullet>i \<le> c\<bullet>i" by (rule ccontr) auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1177
    moreover
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1178
    {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1179
      let ?x = "(\<Sum>j\<in>Basis. (if j=i then ((max (b\<bullet>j) (c\<bullet>j))+d\<bullet>j)/2 else (c\<bullet>j+d\<bullet>j)/2) *\<^sub>R j)::'a"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1180
      assume as2: "b\<bullet>i < d\<bullet>i"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1181
      {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1182
        fix j :: 'a
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1183
        assume "j\<in>Basis"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1184
        then have "d \<bullet> j > ?x \<bullet> j \<and> ?x \<bullet> j > c \<bullet> j"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1185
          apply (cases "j = i")
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1186
          using as(2)[THEN bspec[where x=j]]
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1187
          apply (auto simp add: as2)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1188
          done
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1189
      }
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1190
      then have "?x\<in>box c d"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1191
        unfolding mem_box by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1192
      moreover
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1193
      have "?x\<notin>cbox a b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1194
        unfolding mem_box
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1195
        apply auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1196
        apply (rule_tac x=i in bexI)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1197
        using as(2)[THEN bspec[where x=i]] and as2 using i
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1198
        apply auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1199
        done
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1200
      ultimately have False using as by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1201
    }
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1202
    then have "b\<bullet>i \<ge> d\<bullet>i" by (rule ccontr) auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1203
    ultimately
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1204
    have "a\<bullet>i \<le> c\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i" by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1205
  } note part1 = this
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1206
  show ?th3
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1207
    unfolding subset_eq and Ball_def and mem_box
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1208
    apply (rule, rule, rule, rule)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1209
    apply (rule part1)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1210
    unfolding subset_eq and Ball_def and mem_box
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1211
    prefer 4
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1212
    apply auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1213
    apply (erule_tac x=xa in allE, erule_tac x=xa in allE, fastforce)+
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1214
    done
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1215
  {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1216
    assume as: "box c d \<subseteq> box a b" "\<forall>i\<in>Basis. c\<bullet>i < d\<bullet>i"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1217
    fix i :: 'a
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1218
    assume i:"i\<in>Basis"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1219
    from as(1) have "box c d \<subseteq> cbox a b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1220
      using box_subset_cbox[of a b] by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1221
    then have "a\<bullet>i \<le> c\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1222
      using part1 and as(2) using i by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1223
  } note * = this
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1224
  show ?th4
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1225
    unfolding subset_eq and Ball_def and mem_box
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1226
    apply (rule, rule, rule, rule)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1227
    apply (rule *)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1228
    unfolding subset_eq and Ball_def and mem_box
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1229
    prefer 4
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1230
    apply auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1231
    apply (erule_tac x=xa in allE, simp)+
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1232
    done
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1233
qed
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1234
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1235
lemma inter_interval:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1236
  fixes a :: "'a::euclidean_space"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1237
  shows "cbox a b \<inter> cbox c d =
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1238
    cbox (\<Sum>i\<in>Basis. max (a\<bullet>i) (c\<bullet>i) *\<^sub>R i) (\<Sum>i\<in>Basis. min (b\<bullet>i) (d\<bullet>i) *\<^sub>R i)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1239
  unfolding set_eq_iff and Int_iff and mem_box
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1240
  by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1241
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1242
lemma disjoint_interval:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1243
  fixes a::"'a::euclidean_space"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1244
  shows "cbox a b \<inter> cbox c d = {} \<longleftrightarrow> (\<exists>i\<in>Basis. (b\<bullet>i < a\<bullet>i \<or> d\<bullet>i < c\<bullet>i \<or> b\<bullet>i < c\<bullet>i \<or> d\<bullet>i < a\<bullet>i))" (is ?th1)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1245
    and "cbox a b \<inter> box c d = {} \<longleftrightarrow> (\<exists>i\<in>Basis. (b\<bullet>i < a\<bullet>i \<or> d\<bullet>i \<le> c\<bullet>i \<or> b\<bullet>i \<le> c\<bullet>i \<or> d\<bullet>i \<le> a\<bullet>i))" (is ?th2)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1246
    and "box a b \<inter> cbox c d = {} \<longleftrightarrow> (\<exists>i\<in>Basis. (b\<bullet>i \<le> a\<bullet>i \<or> d\<bullet>i < c\<bullet>i \<or> b\<bullet>i \<le> c\<bullet>i \<or> d\<bullet>i \<le> a\<bullet>i))" (is ?th3)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1247
    and "box a b \<inter> box c d = {} \<longleftrightarrow> (\<exists>i\<in>Basis. (b\<bullet>i \<le> a\<bullet>i \<or> d\<bullet>i \<le> c\<bullet>i \<or> b\<bullet>i \<le> c\<bullet>i \<or> d\<bullet>i \<le> a\<bullet>i))" (is ?th4)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1248
proof -
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1249
  let ?z = "(\<Sum>i\<in>Basis. (((max (a\<bullet>i) (c\<bullet>i)) + (min (b\<bullet>i) (d\<bullet>i))) / 2) *\<^sub>R i)::'a"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1250
  have **: "\<And>P Q. (\<And>i :: 'a. i \<in> Basis \<Longrightarrow> Q ?z i \<Longrightarrow> P i) \<Longrightarrow>
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1251
      (\<And>i x :: 'a. i \<in> Basis \<Longrightarrow> P i \<Longrightarrow> Q x i) \<Longrightarrow> (\<forall>x. \<exists>i\<in>Basis. Q x i) \<longleftrightarrow> (\<exists>i\<in>Basis. P i)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1252
    by blast
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1253
  note * = set_eq_iff Int_iff empty_iff mem_box ball_conj_distrib[symmetric] eq_False ball_simps(10)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1254
  show ?th1 unfolding * by (intro **) auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1255
  show ?th2 unfolding * by (intro **) auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1256
  show ?th3 unfolding * by (intro **) auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1257
  show ?th4 unfolding * by (intro **) auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1258
qed
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1259
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1260
lemma UN_box_eq_UNIV: "(\<Union>i::nat. box (- (real i *\<^sub>R One)) (real i *\<^sub>R One)) = UNIV"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1261
proof -
61942
f02b26f7d39d prefer symbols for "floor", "ceiling";
wenzelm
parents: 61915
diff changeset
  1262
  have "\<bar>x \<bullet> b\<bar> < real_of_int (\<lceil>Max ((\<lambda>b. \<bar>x \<bullet> b\<bar>)`Basis)\<rceil> + 1)"
60462
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  1263
    if [simp]: "b \<in> Basis" for x b :: 'a
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  1264
  proof -
61942
f02b26f7d39d prefer symbols for "floor", "ceiling";
wenzelm
parents: 61915
diff changeset
  1265
    have "\<bar>x \<bullet> b\<bar> \<le> real_of_int \<lceil>\<bar>x \<bullet> b\<bar>\<rceil>"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61552
diff changeset
  1266
      by (rule le_of_int_ceiling)
61942
f02b26f7d39d prefer symbols for "floor", "ceiling";
wenzelm
parents: 61915
diff changeset
  1267
    also have "\<dots> \<le> real_of_int \<lceil>Max ((\<lambda>b. \<bar>x \<bullet> b\<bar>)`Basis)\<rceil>"
59587
8ea7b22525cb Removed the obsolete functions "natfloor" and "natceiling"
nipkow
parents: 58877
diff changeset
  1268
      by (auto intro!: ceiling_mono)
61942
f02b26f7d39d prefer symbols for "floor", "ceiling";
wenzelm
parents: 61915
diff changeset
  1269
    also have "\<dots> < real_of_int (\<lceil>Max ((\<lambda>b. \<bar>x \<bullet> b\<bar>)`Basis)\<rceil> + 1)"
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1270
      by simp
60462
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  1271
    finally show ?thesis .
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  1272
  qed
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  1273
  then have "\<exists>n::nat. \<forall>b\<in>Basis. \<bar>x \<bullet> b\<bar> < real n" for x :: 'a
59587
8ea7b22525cb Removed the obsolete functions "natfloor" and "natceiling"
nipkow
parents: 58877
diff changeset
  1274
    by (metis order.strict_trans reals_Archimedean2)
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1275
  moreover have "\<And>x b::'a. \<And>n::nat.  \<bar>x \<bullet> b\<bar> < real n \<longleftrightarrow> - real n < x \<bullet> b \<and> x \<bullet> b < real n"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1276
    by auto
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1277
  ultimately show ?thesis
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1278
    by (auto simp: box_def inner_setsum_left inner_Basis setsum.If_cases)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1279
qed
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  1280
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  1281
text \<open>Intervals in general, including infinite and mixtures of open and closed.\<close>
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1282
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1283
definition "is_interval (s::('a::euclidean_space) set) \<longleftrightarrow>
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1284
  (\<forall>a\<in>s. \<forall>b\<in>s. \<forall>x. (\<forall>i\<in>Basis. ((a\<bullet>i \<le> x\<bullet>i \<and> x\<bullet>i \<le> b\<bullet>i) \<or> (b\<bullet>i \<le> x\<bullet>i \<and> x\<bullet>i \<le> a\<bullet>i))) \<longrightarrow> x \<in> s)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1285
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1286
lemma is_interval_cbox: "is_interval (cbox a (b::'a::euclidean_space))" (is ?th1)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1287
  and is_interval_box: "is_interval (box a b)" (is ?th2)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1288
  unfolding is_interval_def mem_box Ball_def atLeastAtMost_iff
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1289
  by (meson order_trans le_less_trans less_le_trans less_trans)+
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1290
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61552
diff changeset
  1291
lemma is_interval_empty [iff]: "is_interval {}"
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61552
diff changeset
  1292
  unfolding is_interval_def  by simp
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61552
diff changeset
  1293
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61552
diff changeset
  1294
lemma is_interval_univ [iff]: "is_interval UNIV"
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61552
diff changeset
  1295
  unfolding is_interval_def  by simp
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1296
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1297
lemma mem_is_intervalI:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1298
  assumes "is_interval s"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1299
  assumes "a \<in> s" "b \<in> s"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1300
  assumes "\<And>i. i \<in> Basis \<Longrightarrow> a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i \<or> b \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> a \<bullet> i"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1301
  shows "x \<in> s"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1302
  by (rule assms(1)[simplified is_interval_def, rule_format, OF assms(2,3,4)])
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1303
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1304
lemma interval_subst:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1305
  fixes S::"'a::euclidean_space set"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1306
  assumes "is_interval S"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1307
  assumes "x \<in> S" "y j \<in> S"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1308
  assumes "j \<in> Basis"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1309
  shows "(\<Sum>i\<in>Basis. (if i = j then y i \<bullet> i else x \<bullet> i) *\<^sub>R i) \<in> S"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1310
  by (rule mem_is_intervalI[OF assms(1,2)]) (auto simp: assms)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1311
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1312
lemma mem_box_componentwiseI:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1313
  fixes S::"'a::euclidean_space set"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1314
  assumes "is_interval S"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1315
  assumes "\<And>i. i \<in> Basis \<Longrightarrow> x \<bullet> i \<in> ((\<lambda>x. x \<bullet> i) ` S)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1316
  shows "x \<in> S"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1317
proof -
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1318
  from assms have "\<forall>i \<in> Basis. \<exists>s \<in> S. x \<bullet> i = s \<bullet> i"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1319
    by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1320
  with finite_Basis obtain s and bs::"'a list" where
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1321
    s: "\<And>i. i \<in> Basis \<Longrightarrow> x \<bullet> i = s i \<bullet> i" "\<And>i. i \<in> Basis \<Longrightarrow> s i \<in> S" and
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1322
    bs: "set bs = Basis" "distinct bs"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1323
    by (metis finite_distinct_list)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1324
  from nonempty_Basis s obtain j where j: "j \<in> Basis" "s j \<in> S" by blast
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1325
  def y \<equiv> "rec_list
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1326
    (s j)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1327
    (\<lambda>j _ Y. (\<Sum>i\<in>Basis. (if i = j then s i \<bullet> i else Y \<bullet> i) *\<^sub>R i))"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1328
  have "x = (\<Sum>i\<in>Basis. (if i \<in> set bs then s i \<bullet> i else s j \<bullet> i) *\<^sub>R i)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1329
    using bs by (auto simp add: s(1)[symmetric] euclidean_representation)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1330
  also have [symmetric]: "y bs = \<dots>"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1331
    using bs(2) bs(1)[THEN equalityD1]
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1332
    by (induct bs) (auto simp: y_def euclidean_representation intro!: euclidean_eqI[where 'a='a])
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1333
  also have "y bs \<in> S"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1334
    using bs(1)[THEN equalityD1]
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1335
    apply (induct bs)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1336
    apply (auto simp: y_def j)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1337
    apply (rule interval_subst[OF assms(1)])
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1338
    apply (auto simp: s)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1339
    done
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1340
  finally show ?thesis .
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1341
qed
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  1342
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1343
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  1344
subsection\<open>Connectedness\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1345
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1346
lemma connected_local:
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1347
 "connected S \<longleftrightarrow>
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1348
  \<not> (\<exists>e1 e2.
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1349
      openin (subtopology euclidean S) e1 \<and>
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1350
      openin (subtopology euclidean S) e2 \<and>
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1351
      S \<subseteq> e1 \<union> e2 \<and>
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1352
      e1 \<inter> e2 = {} \<and>
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1353
      e1 \<noteq> {} \<and>
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1354
      e2 \<noteq> {})"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  1355
  unfolding connected_def openin_open
59765
26d1c71784f1 tweaked a few slow or very ugly proofs
paulson <lp15@cam.ac.uk>
parents: 59587
diff changeset
  1356
  by safe blast+
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1357
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
  1358
lemma exists_diff:
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
  1359
  fixes P :: "'a set \<Rightarrow> bool"
60462
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  1360
  shows "(\<exists>S. P (- S)) \<longleftrightarrow> (\<exists>S. P S)" (is "?lhs \<longleftrightarrow> ?rhs")
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1361
proof -
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1362
  {
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1363
    assume "?lhs"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1364
    then have ?rhs by blast
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1365
  }
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1366
  moreover
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1367
  {
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1368
    fix S
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1369
    assume H: "P S"
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
  1370
    have "S = - (- S)" by auto
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1371
    with H have "P (- (- S))" by metis
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1372
  }
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1373
  ultimately show ?thesis by metis
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1374
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1375
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1376
lemma connected_clopen: "connected S \<longleftrightarrow>
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1377
  (\<forall>T. openin (subtopology euclidean S) T \<and>
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1378
     closedin (subtopology euclidean S) T \<longrightarrow> T = {} \<or> T = S)" (is "?lhs \<longleftrightarrow> ?rhs")
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1379
proof -
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1380
  have "\<not> connected S \<longleftrightarrow>
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1381
    (\<exists>e1 e2. open e1 \<and> open (- e2) \<and> S \<subseteq> e1 \<union> (- e2) \<and> e1 \<inter> (- e2) \<inter> S = {} \<and> e1 \<inter> S \<noteq> {} \<and> (- e2) \<inter> S \<noteq> {})"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1382
    unfolding connected_def openin_open closedin_closed
55775
1557a391a858 A bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 55522
diff changeset
  1383
    by (metis double_complement)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  1384
  then have th0: "connected S \<longleftrightarrow>
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1385
    \<not> (\<exists>e2 e1. closed e2 \<and> open e1 \<and> S \<subseteq> e1 \<union> (- e2) \<and> e1 \<inter> (- e2) \<inter> S = {} \<and> e1 \<inter> S \<noteq> {} \<and> (- e2) \<inter> S \<noteq> {})"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  1386
    (is " _ \<longleftrightarrow> \<not> (\<exists>e2 e1. ?P e2 e1)")
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  1387
    apply (simp add: closed_def)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  1388
    apply metis
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  1389
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1390
  have th1: "?rhs \<longleftrightarrow> \<not> (\<exists>t' t. closed t'\<and>t = S\<inter>t' \<and> t\<noteq>{} \<and> t\<noteq>S \<and> (\<exists>t'. open t' \<and> t = S \<inter> t'))"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1391
    (is "_ \<longleftrightarrow> \<not> (\<exists>t' t. ?Q t' t)")
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1392
    unfolding connected_def openin_open closedin_closed by auto
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1393
  {
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1394
    fix e2
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1395
    {
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1396
      fix e1
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  1397
      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)"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1398
        by auto
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1399
    }
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1400
    then have "(\<exists>e1. ?P e2 e1) \<longleftrightarrow> (\<exists>t. ?Q e2 t)"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1401
      by metis
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1402
  }
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1403
  then have "\<forall>e2. (\<exists>e1. ?P e2 e1) \<longleftrightarrow> (\<exists>t. ?Q e2 t)"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1404
    by blast
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1405
  then show ?thesis
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1406
    unfolding th0 th1 by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1407
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1408
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  1409
subsection\<open>Limit points\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1410
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  1411
definition (in topological_space) islimpt:: "'a \<Rightarrow> 'a set \<Rightarrow> bool"  (infixr "islimpt" 60)
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1412
  where "x islimpt S \<longleftrightarrow> (\<forall>T. x\<in>T \<longrightarrow> open T \<longrightarrow> (\<exists>y\<in>S. y\<in>T \<and> y\<noteq>x))"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1413
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1414
lemma islimptI:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1415
  assumes "\<And>T. x \<in> T \<Longrightarrow> open T \<Longrightarrow> \<exists>y\<in>S. y \<in> T \<and> y \<noteq> x"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1416
  shows "x islimpt S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1417
  using assms unfolding islimpt_def by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1418
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1419
lemma islimptE:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1420
  assumes "x islimpt S" and "x \<in> T" and "open T"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1421
  obtains y where "y \<in> S" and "y \<in> T" and "y \<noteq> x"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1422
  using assms unfolding islimpt_def by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1423
44584
08ad27488983 simplify some proofs
huffman
parents: 44571
diff changeset
  1424
lemma islimpt_iff_eventually: "x islimpt S \<longleftrightarrow> \<not> eventually (\<lambda>y. y \<notin> S) (at x)"
08ad27488983 simplify some proofs
huffman
parents: 44571
diff changeset
  1425
  unfolding islimpt_def eventually_at_topological by auto
08ad27488983 simplify some proofs
huffman
parents: 44571
diff changeset
  1426
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1427
lemma islimpt_subset: "x islimpt S \<Longrightarrow> S \<subseteq> T \<Longrightarrow> x islimpt T"
44584
08ad27488983 simplify some proofs
huffman
parents: 44571
diff changeset
  1428
  unfolding islimpt_def by fast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1429
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1430
lemma islimpt_approachable:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1431
  fixes x :: "'a::metric_space"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1432
  shows "x islimpt S \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e)"
44584
08ad27488983 simplify some proofs
huffman
parents: 44571
diff changeset
  1433
  unfolding islimpt_iff_eventually eventually_at by fast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1434
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1435
lemma islimpt_approachable_le:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1436
  fixes x :: "'a::metric_space"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  1437
  shows "x islimpt S \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in> S. x' \<noteq> x \<and> dist x' x \<le> e)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1438
  unfolding islimpt_approachable
44584
08ad27488983 simplify some proofs
huffman
parents: 44571
diff changeset
  1439
  using approachable_lt_le [where f="\<lambda>y. dist y x" and P="\<lambda>y. y \<notin> S \<or> y = x",
08ad27488983 simplify some proofs
huffman
parents: 44571
diff changeset
  1440
    THEN arg_cong [where f=Not]]
08ad27488983 simplify some proofs
huffman
parents: 44571
diff changeset
  1441
  by (simp add: Bex_def conj_commute conj_left_commute)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1442
44571
bd91b77c4cd6 move class perfect_space into RealVector.thy;
huffman
parents: 44568
diff changeset
  1443
lemma islimpt_UNIV_iff: "x islimpt UNIV \<longleftrightarrow> \<not> open {x}"
bd91b77c4cd6 move class perfect_space into RealVector.thy;
huffman
parents: 44568
diff changeset
  1444
  unfolding islimpt_def by (safe, fast, case_tac "T = {x}", fast, fast)
bd91b77c4cd6 move class perfect_space into RealVector.thy;
huffman
parents: 44568
diff changeset
  1445
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  1446
lemma islimpt_punctured: "x islimpt S = x islimpt (S-{x})"
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  1447
  unfolding islimpt_def by blast
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  1448
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  1449
text \<open>A perfect space has no isolated points.\<close>
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  1450
44571
bd91b77c4cd6 move class perfect_space into RealVector.thy;
huffman
parents: 44568
diff changeset
  1451
lemma islimpt_UNIV [simp, intro]: "(x::'a::perfect_space) islimpt UNIV"
bd91b77c4cd6 move class perfect_space into RealVector.thy;
huffman
parents: 44568
diff changeset
  1452
  unfolding islimpt_UNIV_iff by (rule not_open_singleton)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1453
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1454
lemma perfect_choose_dist:
44072
5b970711fb39 class perfect_space inherits from topological_space;
huffman
parents: 43338
diff changeset
  1455
  fixes x :: "'a::{perfect_space, metric_space}"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1456
  shows "0 < r \<Longrightarrow> \<exists>a. a \<noteq> x \<and> dist a x < r"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1457
  using islimpt_UNIV [of x]
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1458
  by (simp add: islimpt_approachable)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1459
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1460
lemma closed_limpt: "closed S \<longleftrightarrow> (\<forall>x. x islimpt S \<longrightarrow> x \<in> S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1461
  unfolding closed_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1462
  apply (subst open_subopen)
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
  1463
  apply (simp add: islimpt_def subset_eq)
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  1464
  apply (metis ComplE ComplI)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  1465
  done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1466
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1467
lemma islimpt_EMPTY[simp]: "\<not> x islimpt {}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1468
  unfolding islimpt_def by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1469
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1470
lemma finite_set_avoid:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1471
  fixes a :: "'a::metric_space"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1472
  assumes fS: "finite S"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  1473
  shows  "\<exists>d>0. \<forall>x\<in>S. x \<noteq> a \<longrightarrow> d \<le> dist a x"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1474
proof (induct rule: finite_induct[OF fS])
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1475
  case 1
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1476
  then show ?case by (auto intro: zero_less_one)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1477
next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1478
  case (2 x F)
60462
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  1479
  from 2 obtain d where d: "d > 0" "\<forall>x\<in>F. x \<noteq> a \<longrightarrow> d \<le> dist a x"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1480
    by blast
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1481
  show ?case
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1482
  proof (cases "x = a")
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1483
    case True
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1484
    then show ?thesis using d by auto
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1485
  next
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1486
    case False
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1487
    let ?d = "min d (dist a x)"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1488
    have dp: "?d > 0"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1489
      using False d(1) using dist_nz by auto
60462
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  1490
    from d have d': "\<forall>x\<in>F. x \<noteq> a \<longrightarrow> ?d \<le> dist a x"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1491
      by auto
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1492
    with dp False show ?thesis
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1493
      by (auto intro!: exI[where x="?d"])
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1494
  qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1495
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1496
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1497
lemma islimpt_Un: "x islimpt (S \<union> T) \<longleftrightarrow> x islimpt S \<or> x islimpt T"
50897
078590669527 generalize lemma islimpt_finite to class t1_space
huffman
parents: 50884
diff changeset
  1498
  by (simp add: islimpt_iff_eventually eventually_conj_iff)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1499
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1500
lemma discrete_imp_closed:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1501
  fixes S :: "'a::metric_space set"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1502
  assumes e: "0 < e"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1503
    and d: "\<forall>x \<in> S. \<forall>y \<in> S. dist y x < e \<longrightarrow> y = x"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1504
  shows "closed S"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1505
proof -
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1506
  {
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1507
    fix x
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1508
    assume C: "\<forall>e>0. \<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1509
    from e have e2: "e/2 > 0" by arith
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  1510
    from C[rule_format, OF e2] obtain y where y: "y \<in> S" "y \<noteq> x" "dist y x < e/2"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1511
      by blast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1512
    let ?m = "min (e/2) (dist x y) "
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1513
    from e2 y(2) have mp: "?m > 0"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  1514
      by (simp add: dist_nz[symmetric])
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  1515
    from C[rule_format, OF mp] obtain z where z: "z \<in> S" "z \<noteq> x" "dist z x < ?m"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1516
      by blast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1517
    have th: "dist z y < e" using z y
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1518
      by (intro dist_triangle_lt [where z=x], simp)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1519
    from d[rule_format, OF y(1) z(1) th] y z
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1520
    have False by (auto simp add: dist_commute)}
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1521
  then show ?thesis
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1522
    by (metis islimpt_approachable closed_limpt [where 'a='a])
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1523
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1524
61524
f2e51e704a96 added many small lemmas about setsum/setprod/powr/...
eberlm
parents: 61518
diff changeset
  1525
lemma closed_of_nat_image: "closed (of_nat ` A :: 'a :: real_normed_algebra_1 set)"
f2e51e704a96 added many small lemmas about setsum/setprod/powr/...
eberlm
parents: 61518
diff changeset
  1526
  by (rule discrete_imp_closed[of 1]) (auto simp: dist_of_nat)
f2e51e704a96 added many small lemmas about setsum/setprod/powr/...
eberlm
parents: 61518
diff changeset
  1527
f2e51e704a96 added many small lemmas about setsum/setprod/powr/...
eberlm
parents: 61518
diff changeset
  1528
lemma closed_of_int_image: "closed (of_int ` A :: 'a :: real_normed_algebra_1 set)"
f2e51e704a96 added many small lemmas about setsum/setprod/powr/...
eberlm
parents: 61518
diff changeset
  1529
  by (rule discrete_imp_closed[of 1]) (auto simp: dist_of_int)
f2e51e704a96 added many small lemmas about setsum/setprod/powr/...
eberlm
parents: 61518
diff changeset
  1530
f2e51e704a96 added many small lemmas about setsum/setprod/powr/...
eberlm
parents: 61518
diff changeset
  1531
lemma closed_Nats [simp]: "closed (\<nat> :: 'a :: real_normed_algebra_1 set)"
f2e51e704a96 added many small lemmas about setsum/setprod/powr/...
eberlm
parents: 61518
diff changeset
  1532
  unfolding Nats_def by (rule closed_of_nat_image)
f2e51e704a96 added many small lemmas about setsum/setprod/powr/...
eberlm
parents: 61518
diff changeset
  1533
f2e51e704a96 added many small lemmas about setsum/setprod/powr/...
eberlm
parents: 61518
diff changeset
  1534
lemma closed_Ints [simp]: "closed (\<int> :: 'a :: real_normed_algebra_1 set)"
f2e51e704a96 added many small lemmas about setsum/setprod/powr/...
eberlm
parents: 61518
diff changeset
  1535
  unfolding Ints_def by (rule closed_of_int_image)
f2e51e704a96 added many small lemmas about setsum/setprod/powr/...
eberlm
parents: 61518
diff changeset
  1536
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  1537
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  1538
subsection \<open>Interior of a Set\<close>
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  1539
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1540
definition "interior S = \<Union>{T. open T \<and> T \<subseteq> S}"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1541
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1542
lemma interiorI [intro?]:
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1543
  assumes "open T" and "x \<in> T" and "T \<subseteq> S"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1544
  shows "x \<in> interior S"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1545
  using assms unfolding interior_def by fast
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1546
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1547
lemma interiorE [elim?]:
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1548
  assumes "x \<in> interior S"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1549
  obtains T where "open T" and "x \<in> T" and "T \<subseteq> S"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1550
  using assms unfolding interior_def by fast
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1551
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1552
lemma open_interior [simp, intro]: "open (interior S)"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1553
  by (simp add: interior_def open_Union)
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1554
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1555
lemma interior_subset: "interior S \<subseteq> S"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1556
  by (auto simp add: interior_def)
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1557
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1558
lemma interior_maximal: "T \<subseteq> S \<Longrightarrow> open T \<Longrightarrow> T \<subseteq> interior S"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1559
  by (auto simp add: interior_def)
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1560
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1561
lemma interior_open: "open S \<Longrightarrow> interior S = S"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1562
  by (intro equalityI interior_subset interior_maximal subset_refl)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1563
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1564
lemma interior_eq: "interior S = S \<longleftrightarrow> open S"
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1565
  by (metis open_interior interior_open)
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1566
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1567
lemma open_subset_interior: "open S \<Longrightarrow> S \<subseteq> interior T \<longleftrightarrow> S \<subseteq> T"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1568
  by (metis interior_maximal interior_subset subset_trans)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1569
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1570
lemma interior_empty [simp]: "interior {} = {}"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1571
  using open_empty by (rule interior_open)
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1572
44522
2f7e9d890efe rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents: 44519
diff changeset
  1573
lemma interior_UNIV [simp]: "interior UNIV = UNIV"
2f7e9d890efe rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents: 44519
diff changeset
  1574
  using open_UNIV by (rule interior_open)
2f7e9d890efe rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents: 44519
diff changeset
  1575
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1576
lemma interior_interior [simp]: "interior (interior S) = interior S"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1577
  using open_interior by (rule interior_open)
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1578
44522
2f7e9d890efe rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents: 44519
diff changeset
  1579
lemma interior_mono: "S \<subseteq> T \<Longrightarrow> interior S \<subseteq> interior T"
2f7e9d890efe rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents: 44519
diff changeset
  1580
  by (auto simp add: interior_def)
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1581
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1582
lemma interior_unique:
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1583
  assumes "T \<subseteq> S" and "open T"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1584
  assumes "\<And>T'. T' \<subseteq> S \<Longrightarrow> open T' \<Longrightarrow> T' \<subseteq> T"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1585
  shows "interior S = T"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1586
  by (intro equalityI assms interior_subset open_interior interior_maximal)
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1587
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  1588
lemma interior_singleton [simp]:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  1589
      fixes a :: "'a::perfect_space" shows "interior {a} = {}"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  1590
  apply (rule interior_unique, simp_all)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  1591
  using not_open_singleton subset_singletonD by fastforce
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  1592
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  1593
lemma interior_Int [simp]: "interior (S \<inter> T) = interior S \<inter> interior T"
44522
2f7e9d890efe rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents: 44519
diff changeset
  1594
  by (intro equalityI Int_mono Int_greatest interior_mono Int_lower1
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1595
    Int_lower2 interior_maximal interior_subset open_Int open_interior)
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1596
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1597
lemma mem_interior: "x \<in> interior S \<longleftrightarrow> (\<exists>e>0. ball x e \<subseteq> S)"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1598
  using open_contains_ball_eq [where S="interior S"]
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1599
  by (simp add: open_subset_interior)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1600
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1601
lemma eventually_nhds_in_nhd: "x \<in> interior s \<Longrightarrow> eventually (\<lambda>y. y \<in> s) (nhds x)"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1602
  using interior_subset[of s] by (subst eventually_nhds) blast
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1603
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1604
lemma interior_limit_point [intro]:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1605
  fixes x :: "'a::perfect_space"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1606
  assumes x: "x \<in> interior S"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1607
  shows "x islimpt S"
44072
5b970711fb39 class perfect_space inherits from topological_space;
huffman
parents: 43338
diff changeset
  1608
  using x islimpt_UNIV [of x]
5b970711fb39 class perfect_space inherits from topological_space;
huffman
parents: 43338
diff changeset
  1609
  unfolding interior_def islimpt_def
5b970711fb39 class perfect_space inherits from topological_space;
huffman
parents: 43338
diff changeset
  1610
  apply (clarsimp, rename_tac T T')
5b970711fb39 class perfect_space inherits from topological_space;
huffman
parents: 43338
diff changeset
  1611
  apply (drule_tac x="T \<inter> T'" in spec)
5b970711fb39 class perfect_space inherits from topological_space;
huffman
parents: 43338
diff changeset
  1612
  apply (auto simp add: open_Int)
5b970711fb39 class perfect_space inherits from topological_space;
huffman
parents: 43338
diff changeset
  1613
  done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1614
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1615
lemma interior_closed_Un_empty_interior:
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1616
  assumes cS: "closed S"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1617
    and iT: "interior T = {}"
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1618
  shows "interior (S \<union> T) = interior S"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1619
proof
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1620
  show "interior S \<subseteq> interior (S \<union> T)"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1621
    by (rule interior_mono) (rule Un_upper1)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1622
  show "interior (S \<union> T) \<subseteq> interior S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1623
  proof
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1624
    fix x
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1625
    assume "x \<in> interior (S \<union> T)"
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1626
    then obtain R where "open R" "x \<in> R" "R \<subseteq> S \<union> T" ..
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1627
    show "x \<in> interior S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1628
    proof (rule ccontr)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1629
      assume "x \<notin> interior S"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  1630
      with \<open>x \<in> R\<close> \<open>open R\<close> obtain y where "y \<in> R - S"
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1631
        unfolding interior_def by fast
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  1632
      from \<open>open R\<close> \<open>closed S\<close> have "open (R - S)"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  1633
        by (rule open_Diff)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  1634
      from \<open>R \<subseteq> S \<union> T\<close> have "R - S \<subseteq> T"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  1635
        by fast
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  1636
      from \<open>y \<in> R - S\<close> \<open>open (R - S)\<close> \<open>R - S \<subseteq> T\<close> \<open>interior T = {}\<close> show False
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  1637
        unfolding interior_def by fast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1638
    qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1639
  qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1640
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1641
44365
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1642
lemma interior_Times: "interior (A \<times> B) = interior A \<times> interior B"
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1643
proof (rule interior_unique)
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1644
  show "interior A \<times> interior B \<subseteq> A \<times> B"
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1645
    by (intro Sigma_mono interior_subset)
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1646
  show "open (interior A \<times> interior B)"
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1647
    by (intro open_Times open_interior)
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1648
  fix T
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1649
  assume "T \<subseteq> A \<times> B" and "open T"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1650
  then show "T \<subseteq> interior A \<times> interior B"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  1651
  proof safe
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1652
    fix x y
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1653
    assume "(x, y) \<in> T"
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1654
    then obtain C D where "open C" "open D" "C \<times> D \<subseteq> T" "x \<in> C" "y \<in> D"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  1655
      using \<open>open T\<close> unfolding open_prod_def by fast
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1656
    then have "open C" "open D" "C \<subseteq> A" "D \<subseteq> B" "x \<in> C" "y \<in> D"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  1657
      using \<open>T \<subseteq> A \<times> B\<close> by auto
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1658
    then show "x \<in> interior A" and "y \<in> interior B"
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1659
      by (auto intro: interiorI)
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1660
  qed
44365
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1661
qed
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1662
61245
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1663
lemma interior_Ici:
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1664
  fixes x :: "'a :: {dense_linorder, linorder_topology}"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1665
  assumes "b < x"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1666
  shows "interior { x ..} = { x <..}"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1667
proof (rule interior_unique)
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1668
  fix T assume "T \<subseteq> {x ..}" "open T"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1669
  moreover have "x \<notin> T"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1670
  proof
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1671
    assume "x \<in> T"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1672
    obtain y where "y < x" "{y <.. x} \<subseteq> T"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1673
      using open_left[OF \<open>open T\<close> \<open>x \<in> T\<close> \<open>b < x\<close>] by auto
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1674
    with dense[OF \<open>y < x\<close>] obtain z where "z \<in> T" "z < x"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1675
      by (auto simp: subset_eq Ball_def)
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1676
    with \<open>T \<subseteq> {x ..}\<close> show False by auto
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1677
  qed
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1678
  ultimately show "T \<subseteq> {x <..}"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1679
    by (auto simp: subset_eq less_le)
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1680
qed auto
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1681
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1682
lemma interior_Iic:
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1683
  fixes x :: "'a :: {dense_linorder, linorder_topology}"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1684
  assumes "x < b"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1685
  shows "interior {.. x} = {..< x}"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1686
proof (rule interior_unique)
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1687
  fix T assume "T \<subseteq> {.. x}" "open T"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1688
  moreover have "x \<notin> T"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1689
  proof
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1690
    assume "x \<in> T"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1691
    obtain y where "x < y" "{x ..< y} \<subseteq> T"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1692
      using open_right[OF \<open>open T\<close> \<open>x \<in> T\<close> \<open>x < b\<close>] by auto
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1693
    with dense[OF \<open>x < y\<close>] obtain z where "z \<in> T" "x < z"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1694
      by (auto simp: subset_eq Ball_def less_le)
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1695
    with \<open>T \<subseteq> {.. x}\<close> show False by auto
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1696
  qed
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1697
  ultimately show "T \<subseteq> {..< x}"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1698
    by (auto simp: subset_eq less_le)
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61204
diff changeset
  1699
qed auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1700
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  1701
subsection \<open>Closure of a Set\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1702
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1703
definition "closure S = S \<union> {x | x. x islimpt S}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1704
44518
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
  1705
lemma interior_closure: "interior S = - (closure (- S))"
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
  1706
  unfolding interior_def closure_def islimpt_def by auto
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
  1707
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
  1708
lemma closure_interior: "closure S = - interior (- S)"
44518
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
  1709
  unfolding interior_closure by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1710
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1711
lemma closed_closure[simp, intro]: "closed (closure S)"
44518
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
  1712
  unfolding closure_interior by (simp add: closed_Compl)
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
  1713
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
  1714
lemma closure_subset: "S \<subseteq> closure S"
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
  1715
  unfolding closure_def by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1716
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1717
lemma closure_hull: "closure S = closed hull S"
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1718
  unfolding hull_def closure_interior interior_def by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1719
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1720
lemma closure_eq: "closure S = S \<longleftrightarrow> closed S"
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1721
  unfolding closure_hull using closed_Inter by (rule hull_eq)
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1722
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1723
lemma closure_closed [simp]: "closed S \<Longrightarrow> closure S = S"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1724
  unfolding closure_eq .
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1725
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1726
lemma closure_closure [simp]: "closure (closure S) = closure S"
44518
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
  1727
  unfolding closure_hull by (rule hull_hull)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1728
44522
2f7e9d890efe rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents: 44519
diff changeset
  1729
lemma closure_mono: "S \<subseteq> T \<Longrightarrow> closure S \<subseteq> closure T"
44518
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
  1730
  unfolding closure_hull by (rule hull_mono)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1731
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1732
lemma closure_minimal: "S \<subseteq> T \<Longrightarrow> closed T \<Longrightarrow> closure S \<subseteq> T"
44518
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
  1733
  unfolding closure_hull by (rule hull_minimal)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1734
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1735
lemma closure_unique:
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1736
  assumes "S \<subseteq> T"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1737
    and "closed T"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1738
    and "\<And>T'. S \<subseteq> T' \<Longrightarrow> closed T' \<Longrightarrow> T \<subseteq> T'"
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1739
  shows "closure S = T"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1740
  using assms unfolding closure_hull by (rule hull_unique)
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1741
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1742
lemma closure_empty [simp]: "closure {} = {}"
44518
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
  1743
  using closed_empty by (rule closure_closed)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1744
44522
2f7e9d890efe rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents: 44519
diff changeset
  1745
lemma closure_UNIV [simp]: "closure UNIV = UNIV"
44518
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
  1746
  using closed_UNIV by (rule closure_closed)
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
  1747
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
  1748
lemma closure_union [simp]: "closure (S \<union> T) = closure S \<union> closure T"
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
  1749
  unfolding closure_interior by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1750
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  1751
lemma closure_eq_empty [iff]: "closure S = {} \<longleftrightarrow> S = {}"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1752
  using closure_empty closure_subset[of S]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1753
  by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1754
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1755
lemma closure_subset_eq: "closure S \<subseteq> S \<longleftrightarrow> closed S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1756
  using closure_eq[of S] closure_subset[of S]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1757
  by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1758
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1759
lemma open_inter_closure_eq_empty:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1760
  "open S \<Longrightarrow> (S \<inter> closure T) = {} \<longleftrightarrow> S \<inter> T = {}"
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
  1761
  using open_subset_interior[of S "- T"]
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
  1762
  using interior_subset[of "- T"]
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1763
  unfolding closure_interior
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1764
  by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1765
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1766
lemma open_inter_closure_subset:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1767
  "open S \<Longrightarrow> (S \<inter> (closure T)) \<subseteq> closure(S \<inter> T)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1768
proof
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1769
  fix x
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1770
  assume as: "open S" "x \<in> S \<inter> closure T"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1771
  {
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  1772
    assume *: "x islimpt T"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1773
    have "x islimpt (S \<inter> T)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1774
    proof (rule islimptI)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1775
      fix A
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1776
      assume "x \<in> A" "open A"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1777
      with as have "x \<in> A \<inter> S" "open (A \<inter> S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1778
        by (simp_all add: open_Int)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1779
      with * obtain y where "y \<in> T" "y \<in> A \<inter> S" "y \<noteq> x"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1780
        by (rule islimptE)
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1781
      then have "y \<in> S \<inter> T" "y \<in> A \<and> y \<noteq> x"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1782
        by simp_all
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  1783
      then show "\<exists>y\<in>(S \<inter> T). y \<in> A \<and> y \<noteq> x" ..
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1784
    qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1785
  }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1786
  then show "x \<in> closure (S \<inter> T)" using as
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1787
    unfolding closure_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1788
    by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1789
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1790
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1791
lemma closure_complement: "closure (- S) = - interior S"
44518
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
  1792
  unfolding closure_interior by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1793
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1794
lemma interior_complement: "interior (- S) = - closure S"
44518
219a6fe4cfae add lemma closure_union;
huffman
parents: 44517
diff changeset
  1795
  unfolding closure_interior by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  1796
44365
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1797
lemma closure_Times: "closure (A \<times> B) = closure A \<times> closure B"
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  1798
proof (rule closure_unique)
44365
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1799
  show "A \<times> B \<subseteq> closure A \<times> closure B"
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1800
    by (intro Sigma_mono closure_subset)
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1801
  show "closed (closure A \<times> closure B)"
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1802
    by (intro closed_Times closed_closure)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  1803
  fix T
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  1804
  assume "A \<times> B \<subseteq> T" and "closed T"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  1805
  then show "closure A \<times> closure B \<subseteq> T"
44365
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1806
    apply (simp add: closed_def open_prod_def, clarify)
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1807
    apply (rule ccontr)
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1808
    apply (drule_tac x="(a, b)" in bspec, simp, clarify, rename_tac C D)
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1809
    apply (simp add: closure_interior interior_def)
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1810
    apply (drule_tac x=C in spec)
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1811
    apply (drule_tac x=D in spec)
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1812
    apply auto
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1813
    done
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1814
qed
5daa55003649 add lemmas interior_Times and closure_Times
huffman
parents: 44342
diff changeset
  1815
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  1816
lemma islimpt_in_closure: "(x islimpt S) = (x:closure(S-{x}))"
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  1817
  unfolding closure_def using islimpt_punctured by blast
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  1818
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1819
lemma connected_imp_connected_closure: "connected s \<Longrightarrow> connected (closure s)"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1820
    by (rule connectedI) (meson closure_subset open_Int open_inter_closure_eq_empty subset_trans connectedD)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1821
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1822
lemma limpt_of_limpts:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1823
      fixes x :: "'a::metric_space"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1824
      shows "x islimpt {y. y islimpt s} \<Longrightarrow> x islimpt s"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1825
  apply (clarsimp simp add: islimpt_approachable)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1826
  apply (drule_tac x="e/2" in spec)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1827
  apply (auto simp: simp del: less_divide_eq_numeral1)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1828
  apply (drule_tac x="dist x' x" in spec)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1829
  apply (auto simp: zero_less_dist_iff simp del: less_divide_eq_numeral1)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1830
  apply (erule rev_bexI)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1831
  by (metis dist_commute dist_triangle_half_r less_trans less_irrefl)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1832
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1833
lemma closed_limpts:  "closed {x::'a::metric_space. x islimpt s}"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1834
  using closed_limpt limpt_of_limpts by blast
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1835
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1836
lemma limpt_of_closure:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1837
      fixes x :: "'a::metric_space"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1838
      shows "x islimpt closure s \<longleftrightarrow> x islimpt s"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1839
  by (auto simp: closure_def islimpt_Un dest: limpt_of_limpts)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1840
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1841
lemma closed_in_limpt:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1842
   "closedin (subtopology euclidean t) s \<longleftrightarrow> s \<subseteq> t \<and> (\<forall>x. x islimpt s \<and> x \<in> t \<longrightarrow> x \<in> s)"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1843
  apply (simp add: closedin_closed, safe)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1844
  apply (simp add: closed_limpt islimpt_subset)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1845
  apply (rule_tac x="closure s" in exI)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1846
  apply simp
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1847
  apply (force simp: closure_def)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1848
  done
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1849
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  1850
lemma closedin_closed_eq:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  1851
    "closed s \<Longrightarrow> (closedin (subtopology euclidean s) t \<longleftrightarrow> closed t \<and> t \<subseteq> s)"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  1852
  by (meson closed_in_limpt closed_subset closedin_closed_trans)
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  1853
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  1854
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1855
subsection\<open>Connected components, considered as a connectedness relation or a set\<close>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1856
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1857
definition
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1858
   "connected_component s x y \<equiv> \<exists>t. connected t \<and> t \<subseteq> s \<and> x \<in> t \<and> y \<in> t"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1859
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1860
abbreviation
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1861
   "connected_component_set s x \<equiv> Collect (connected_component s x)"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1862
61426
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
  1863
lemma connected_componentI:
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
  1864
    "\<lbrakk>connected t; t \<subseteq> s; x \<in> t; y \<in> t\<rbrakk> \<Longrightarrow> connected_component s x y"
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
  1865
  by (auto simp: connected_component_def)
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
  1866
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1867
lemma connected_component_in: "connected_component s x y \<Longrightarrow> x \<in> s \<and> y \<in> s"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1868
  by (auto simp: connected_component_def)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1869
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1870
lemma connected_component_refl: "x \<in> s \<Longrightarrow> connected_component s x x"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1871
  apply (auto simp: connected_component_def)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1872
  using connected_sing by blast
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1873
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1874
lemma connected_component_refl_eq [simp]: "connected_component s x x \<longleftrightarrow> x \<in> s"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1875
  by (auto simp: connected_component_refl) (auto simp: connected_component_def)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1876
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1877
lemma connected_component_sym: "connected_component s x y \<Longrightarrow> connected_component s y x"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1878
  by (auto simp: connected_component_def)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1879
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1880
lemma connected_component_trans:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1881
    "\<lbrakk>connected_component s x y; connected_component s y z\<rbrakk> \<Longrightarrow> connected_component s x z"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1882
  unfolding connected_component_def
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1883
  by (metis Int_iff Un_iff Un_subset_iff equals0D connected_Un)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1884
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1885
lemma connected_component_of_subset: "\<lbrakk>connected_component s x y; s \<subseteq> t\<rbrakk> \<Longrightarrow> connected_component t x y"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1886
  by (auto simp: connected_component_def)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1887
61952
546958347e05 prefer symbols for "Union", "Inter";
wenzelm
parents: 61945
diff changeset
  1888
lemma connected_component_Union: "connected_component_set s x = \<Union>{t. connected t \<and> x \<in> t \<and> t \<subseteq> s}"
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1889
  by (auto simp: connected_component_def)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1890
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1891
lemma connected_connected_component [iff]: "connected (connected_component_set s x)"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1892
  by (auto simp: connected_component_Union intro: connected_Union)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1893
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1894
lemma connected_iff_eq_connected_component_set: "connected s \<longleftrightarrow> (\<forall>x \<in> s. connected_component_set s x = s)"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1895
proof (cases "s={}")
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1896
  case True then show ?thesis by simp
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1897
next
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1898
  case False
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1899
  then obtain x where "x \<in> s" by auto
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1900
  show ?thesis
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1901
  proof
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1902
    assume "connected s"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1903
    then show "\<forall>x \<in> s. connected_component_set s x = s"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1904
      by (force simp: connected_component_def)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1905
  next
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1906
    assume "\<forall>x \<in> s. connected_component_set s x = s"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1907
    then show "connected s"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61806
diff changeset
  1908
      by (metis \<open>x \<in> s\<close> connected_connected_component)
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1909
  qed
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1910
qed
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1911
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1912
lemma connected_component_subset: "connected_component_set s x \<subseteq> s"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1913
  using connected_component_in by blast
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1914
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1915
lemma connected_component_eq_self: "\<lbrakk>connected s; x \<in> s\<rbrakk> \<Longrightarrow> connected_component_set s x = s"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1916
  by (simp add: connected_iff_eq_connected_component_set)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1917
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1918
lemma connected_iff_connected_component:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1919
    "connected s \<longleftrightarrow> (\<forall>x \<in> s. \<forall>y \<in> s. connected_component s x y)"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1920
  using connected_component_in by (auto simp: connected_iff_eq_connected_component_set)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1921
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1922
lemma connected_component_maximal:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1923
    "\<lbrakk>x \<in> t; connected t; t \<subseteq> s\<rbrakk> \<Longrightarrow> t \<subseteq> (connected_component_set s x)"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1924
  using connected_component_eq_self connected_component_of_subset by blast
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1925
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1926
lemma connected_component_mono:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1927
    "s \<subseteq> t \<Longrightarrow> (connected_component_set s x) \<subseteq> (connected_component_set t x)"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1928
  by (simp add: Collect_mono connected_component_of_subset)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1929
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1930
lemma connected_component_eq_empty [simp]: "connected_component_set s x = {} \<longleftrightarrow> (x \<notin> s)"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1931
  using connected_component_refl by (fastforce simp: connected_component_in)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1932
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1933
lemma connected_component_set_empty [simp]: "connected_component_set {} x = {}"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1934
  using connected_component_eq_empty by blast
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1935
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1936
lemma connected_component_eq:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1937
    "y \<in> connected_component_set s x
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1938
     \<Longrightarrow> (connected_component_set s y = connected_component_set s x)"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1939
  by (metis (no_types, lifting) Collect_cong connected_component_sym connected_component_trans mem_Collect_eq)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1940
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1941
lemma closed_connected_component:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1942
  assumes s: "closed s" shows "closed (connected_component_set s x)"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1943
proof (cases "x \<in> s")
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1944
  case False then show ?thesis
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1945
    by (metis connected_component_eq_empty closed_empty)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1946
next
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1947
  case True
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1948
  show ?thesis
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1949
    unfolding closure_eq [symmetric]
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1950
    proof
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1951
      show "closure (connected_component_set s x) \<subseteq> connected_component_set s x"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1952
        apply (rule connected_component_maximal)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1953
        apply (simp add: closure_def True)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1954
        apply (simp add: connected_imp_connected_closure)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1955
        apply (simp add: s closure_minimal connected_component_subset)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1956
        done
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1957
    next
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1958
      show "connected_component_set s x \<subseteq> closure (connected_component_set s x)"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1959
        by (simp add: closure_subset)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1960
  qed
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1961
qed
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1962
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1963
lemma connected_component_disjoint:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1964
    "(connected_component_set s a) \<inter> (connected_component_set s b) = {} \<longleftrightarrow>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1965
     a \<notin> connected_component_set s b"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1966
apply (auto simp: connected_component_eq)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1967
using connected_component_eq connected_component_sym by blast
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1968
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1969
lemma connected_component_nonoverlap:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1970
    "(connected_component_set s a) \<inter> (connected_component_set s b) = {} \<longleftrightarrow>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1971
     (a \<notin> s \<or> b \<notin> s \<or> connected_component_set s a \<noteq> connected_component_set s b)"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1972
  apply (auto simp: connected_component_in)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1973
  using connected_component_refl_eq apply blast
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1974
  apply (metis connected_component_eq mem_Collect_eq)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1975
  apply (metis connected_component_eq mem_Collect_eq)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1976
  done
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1977
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1978
lemma connected_component_overlap:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1979
    "(connected_component_set s a \<inter> connected_component_set s b \<noteq> {}) =
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1980
     (a \<in> s \<and> b \<in> s \<and> connected_component_set s a = connected_component_set s b)"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1981
  by (auto simp: connected_component_nonoverlap)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1982
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1983
lemma connected_component_sym_eq: "connected_component s x y \<longleftrightarrow> connected_component s y x"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1984
  using connected_component_sym by blast
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1985
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1986
lemma connected_component_eq_eq:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1987
    "connected_component_set s x = connected_component_set s y \<longleftrightarrow>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1988
     x \<notin> s \<and> y \<notin> s \<or> x \<in> s \<and> y \<in> s \<and> connected_component s x y"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1989
  apply (case_tac "y \<in> s")
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1990
   apply (simp add:)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1991
   apply (metis connected_component_eq connected_component_eq_empty connected_component_refl_eq mem_Collect_eq)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1992
  apply (case_tac "x \<in> s")
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1993
   apply (simp add:)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1994
   apply (metis connected_component_eq_empty)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1995
  using connected_component_eq_empty by blast
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1996
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1997
lemma connected_iff_connected_component_eq:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1998
    "connected s \<longleftrightarrow>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  1999
       (\<forall>x \<in> s. \<forall>y \<in> s. connected_component_set s x = connected_component_set s y)"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2000
  by (simp add: connected_component_eq_eq connected_iff_connected_component)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2001
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2002
lemma connected_component_idemp:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2003
    "connected_component_set (connected_component_set s x) x = connected_component_set s x"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2004
apply (rule subset_antisym)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2005
apply (simp add: connected_component_subset)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2006
by (metis connected_component_eq_empty connected_component_maximal connected_component_refl_eq connected_connected_component mem_Collect_eq set_eq_subset)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2007
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2008
lemma connected_component_unique:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2009
  "\<lbrakk>x \<in> c; c \<subseteq> s; connected c;
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2010
    \<And>c'. x \<in> c' \<and> c' \<subseteq> s \<and> connected c'
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2011
              \<Longrightarrow> c' \<subseteq> c\<rbrakk>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2012
        \<Longrightarrow> connected_component_set s x = c"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2013
apply (rule subset_antisym)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2014
apply (meson connected_component_maximal connected_component_subset connected_connected_component contra_subsetD)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2015
by (simp add: connected_component_maximal)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2016
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2017
lemma joinable_connected_component_eq:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2018
  "\<lbrakk>connected t; t \<subseteq> s;
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2019
    connected_component_set s x \<inter> t \<noteq> {};
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2020
    connected_component_set s y \<inter> t \<noteq> {}\<rbrakk>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2021
    \<Longrightarrow> connected_component_set s x = connected_component_set s y"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2022
apply (simp add: ex_in_conv [symmetric])
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2023
apply (rule connected_component_eq)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2024
by (metis (no_types, hide_lams) connected_component_eq_eq connected_component_in connected_component_maximal subsetD mem_Collect_eq)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2025
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2026
61952
546958347e05 prefer symbols for "Union", "Inter";
wenzelm
parents: 61945
diff changeset
  2027
lemma Union_connected_component: "\<Union>(connected_component_set s ` s) = s"
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2028
  apply (rule subset_antisym)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2029
  apply (simp add: SUP_least connected_component_subset)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2030
  using connected_component_refl_eq
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2031
  by force
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2032
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2033
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2034
lemma complement_connected_component_unions:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2035
    "s - connected_component_set s x =
61952
546958347e05 prefer symbols for "Union", "Inter";
wenzelm
parents: 61945
diff changeset
  2036
     \<Union>(connected_component_set s ` s - {connected_component_set s x})"
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2037
  apply (subst Union_connected_component [symmetric], auto)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2038
  apply (metis connected_component_eq_eq connected_component_in)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2039
  by (metis connected_component_eq mem_Collect_eq)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2040
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2041
lemma connected_component_intermediate_subset:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2042
        "\<lbrakk>connected_component_set u a \<subseteq> t; t \<subseteq> u\<rbrakk>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2043
        \<Longrightarrow> connected_component_set t a = connected_component_set u a"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2044
  apply (case_tac "a \<in> u")
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2045
  apply (simp add: connected_component_maximal connected_component_mono subset_antisym)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2046
  using connected_component_eq_empty by blast
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2047
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2048
subsection\<open>The set of connected components of a set\<close>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2049
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2050
definition components:: "'a::topological_space set \<Rightarrow> 'a set set" where
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2051
  "components s \<equiv> connected_component_set s ` s"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2052
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2053
lemma components_iff: "s \<in> components u \<longleftrightarrow> (\<exists>x. x \<in> u \<and> s = connected_component_set u x)"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2054
  by (auto simp: components_def)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2055
61952
546958347e05 prefer symbols for "Union", "Inter";
wenzelm
parents: 61945
diff changeset
  2056
lemma Union_components: "u = \<Union>(components u)"
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2057
  apply (rule subset_antisym)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2058
  apply (metis Union_connected_component components_def set_eq_subset)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2059
  using Union_connected_component components_def by fastforce
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2060
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2061
lemma pairwise_disjoint_components: "pairwise (\<lambda>X Y. X \<inter> Y = {}) (components u)"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2062
  apply (simp add: pairwise_def)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2063
  apply (auto simp: components_iff)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2064
  apply (metis connected_component_eq_eq connected_component_in)+
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2065
  done
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2066
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2067
lemma in_components_nonempty: "c \<in> components s \<Longrightarrow> c \<noteq> {}"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2068
    by (metis components_iff connected_component_eq_empty)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2069
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2070
lemma in_components_subset: "c \<in> components s \<Longrightarrow> c \<subseteq> s"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2071
  using Union_components by blast
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2072
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2073
lemma in_components_connected: "c \<in> components s \<Longrightarrow> connected c"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2074
  by (metis components_iff connected_connected_component)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2075
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2076
lemma in_components_maximal:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2077
     "c \<in> components s \<longleftrightarrow>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2078
      (c \<noteq> {} \<and> c \<subseteq> s \<and> connected c \<and> (\<forall>d. d \<noteq> {} \<and> c \<subseteq> d \<and> d \<subseteq> s \<and> connected d \<longrightarrow> d = c))"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2079
  apply (rule iffI)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2080
  apply (simp add: in_components_nonempty in_components_connected)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2081
  apply (metis (full_types) components_iff connected_component_eq_self connected_component_intermediate_subset connected_component_refl in_components_subset mem_Collect_eq rev_subsetD)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2082
  by (metis bot.extremum_uniqueI components_iff connected_component_eq_empty connected_component_maximal connected_component_subset connected_connected_component subset_emptyI)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2083
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2084
lemma joinable_components_eq:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2085
    "connected t \<and> t \<subseteq> s \<and> c1 \<in> components s \<and> c2 \<in> components s \<and> c1 \<inter> t \<noteq> {} \<and> c2 \<inter> t \<noteq> {} \<Longrightarrow> c1 = c2"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2086
  by (metis (full_types) components_iff joinable_connected_component_eq)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2087
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2088
lemma closed_components: "\<lbrakk>closed s; c \<in> components s\<rbrakk> \<Longrightarrow> closed c"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2089
  by (metis closed_connected_component components_iff)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2090
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2091
lemma components_nonoverlap:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2092
    "\<lbrakk>c \<in> components s; c' \<in> components s\<rbrakk> \<Longrightarrow> (c \<inter> c' = {}) \<longleftrightarrow> (c \<noteq> c')"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2093
  apply (auto simp: in_components_nonempty components_iff)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2094
    using connected_component_refl apply blast
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2095
   apply (metis connected_component_eq_eq connected_component_in)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2096
  by (metis connected_component_eq mem_Collect_eq)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2097
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2098
lemma components_eq: "\<lbrakk>c \<in> components s; c' \<in> components s\<rbrakk> \<Longrightarrow> (c = c' \<longleftrightarrow> c \<inter> c' \<noteq> {})"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2099
  by (metis components_nonoverlap)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2100
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2101
lemma components_eq_empty [simp]: "components s = {} \<longleftrightarrow> s = {}"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2102
  by (simp add: components_def)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2103
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2104
lemma components_empty [simp]: "components {} = {}"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2105
  by simp
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2106
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2107
lemma connected_eq_connected_components_eq: "connected s \<longleftrightarrow> (\<forall>c \<in> components s. \<forall>c' \<in> components s. c = c')"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2108
  by (metis (no_types, hide_lams) components_iff connected_component_eq_eq connected_iff_connected_component)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2109
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2110
lemma components_eq_sing_iff: "components s = {s} \<longleftrightarrow> connected s \<and> s \<noteq> {}"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2111
  apply (rule iffI)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2112
   using in_components_connected apply fastforce
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2113
  apply safe
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2114
    using Union_components apply fastforce
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2115
   apply (metis components_iff connected_component_eq_self)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2116
  using in_components_maximal by auto
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2117
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2118
lemma components_eq_sing_exists: "(\<exists>a. components s = {a}) \<longleftrightarrow> connected s \<and> s \<noteq> {}"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2119
  apply (rule iffI)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2120
   using connected_eq_connected_components_eq apply fastforce
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2121
  by (metis components_eq_sing_iff)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2122
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2123
lemma connected_eq_components_subset_sing: "connected s \<longleftrightarrow> components s \<subseteq> {s}"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2124
  by (metis Union_components components_empty components_eq_sing_iff connected_empty insert_subset order_refl subset_singletonD)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2125
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2126
lemma connected_eq_components_subset_sing_exists: "connected s \<longleftrightarrow> (\<exists>a. components s \<subseteq> {a})"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2127
  by (metis components_eq_sing_exists connected_eq_components_subset_sing empty_iff subset_iff subset_singletonD)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2128
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2129
lemma in_components_self: "s \<in> components s \<longleftrightarrow> connected s \<and> s \<noteq> {}"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2130
  by (metis components_empty components_eq_sing_iff empty_iff in_components_connected insertI1)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2131
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2132
lemma components_maximal: "\<lbrakk>c \<in> components s; connected t; t \<subseteq> s; c \<inter> t \<noteq> {}\<rbrakk> \<Longrightarrow> t \<subseteq> c"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2133
  apply (simp add: components_def ex_in_conv [symmetric], clarify)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2134
  by (meson connected_component_def connected_component_trans)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2135
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2136
lemma exists_component_superset: "\<lbrakk>t \<subseteq> s; s \<noteq> {}; connected t\<rbrakk> \<Longrightarrow> \<exists>c. c \<in> components s \<and> t \<subseteq> c"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2137
  apply (case_tac "t = {}")
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2138
   apply force
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2139
  by (metis components_def ex_in_conv connected_component_maximal contra_subsetD image_eqI)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2140
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2141
lemma components_intermediate_subset: "\<lbrakk>s \<in> components u; s \<subseteq> t; t \<subseteq> u\<rbrakk> \<Longrightarrow> s \<in> components t"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2142
  apply (auto simp: components_iff)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2143
  by (metis connected_component_eq_empty connected_component_intermediate_subset)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2144
61952
546958347e05 prefer symbols for "Union", "Inter";
wenzelm
parents: 61945
diff changeset
  2145
lemma in_components_unions_complement: "c \<in> components s \<Longrightarrow> s - c = \<Union>(components s - {c})"
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2146
  by (metis complement_connected_component_unions components_def components_iff)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2147
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2148
lemma connected_intermediate_closure:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2149
  assumes cs: "connected s" and st: "s \<subseteq> t" and ts: "t \<subseteq> closure s"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2150
    shows "connected t"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2151
proof (rule connectedI)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2152
  fix A B
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2153
  assume A: "open A" and B: "open B" and Alap: "A \<inter> t \<noteq> {}" and Blap: "B \<inter> t \<noteq> {}"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2154
     and disj: "A \<inter> B \<inter> t = {}" and cover: "t \<subseteq> A \<union> B"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2155
  have disjs: "A \<inter> B \<inter> s = {}"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2156
    using disj st by auto
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2157
  have "A \<inter> closure s \<noteq> {}"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2158
    using Alap Int_absorb1 ts by blast
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2159
  then have Alaps: "A \<inter> s \<noteq> {}"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2160
    by (simp add: A open_inter_closure_eq_empty)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2161
  have "B \<inter> closure s \<noteq> {}"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2162
    using Blap Int_absorb1 ts by blast
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2163
  then have Blaps: "B \<inter> s \<noteq> {}"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2164
    by (simp add: B open_inter_closure_eq_empty)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2165
  then show False
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2166
    using cs [unfolded connected_def] A B disjs Alaps Blaps cover st
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2167
    by blast
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2168
qed
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2169
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2170
lemma closed_in_connected_component: "closedin (subtopology euclidean s) (connected_component_set s x)"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2171
proof (cases "connected_component_set s x = {}")
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61552
diff changeset
  2172
  case True then show ?thesis
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2173
    by (metis closedin_empty)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2174
next
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2175
  case False
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2176
  then obtain y where y: "connected_component s x y"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2177
    by blast
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2178
  have 1: "connected_component_set s x \<subseteq> s \<inter> closure (connected_component_set s x)"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2179
    by (auto simp: closure_def connected_component_in)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2180
  have 2: "connected_component s x y \<Longrightarrow> s \<inter> closure (connected_component_set s x) \<subseteq> connected_component_set s x"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2181
    apply (rule connected_component_maximal)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2182
    apply (simp add:)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2183
    using closure_subset connected_component_in apply fastforce
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2184
    using "1" connected_intermediate_closure apply blast+
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2185
    done
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2186
  show ?thesis using y
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2187
    apply (simp add: Topology_Euclidean_Space.closedin_closed)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2188
    using 1 2 by auto
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  2189
qed
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  2190
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2191
subsection \<open>Frontier (aka boundary)\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2192
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2193
definition "frontier S = closure S - interior S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2194
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2195
lemma frontier_closed: "closed (frontier S)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2196
  by (simp add: frontier_def closed_Diff)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2197
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
  2198
lemma frontier_closures: "frontier S = (closure S) \<inter> (closure(- S))"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2199
  by (auto simp add: frontier_def interior_closure)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2200
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2201
lemma frontier_straddle:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2202
  fixes a :: "'a::metric_space"
44909
1f5d6eb73549 shorten proof of frontier_straddle
huffman
parents: 44907
diff changeset
  2203
  shows "a \<in> frontier S \<longleftrightarrow> (\<forall>e>0. (\<exists>x\<in>S. dist a x < e) \<and> (\<exists>x. x \<notin> S \<and> dist a x < e))"
1f5d6eb73549 shorten proof of frontier_straddle
huffman
parents: 44907
diff changeset
  2204
  unfolding frontier_def closure_interior
1f5d6eb73549 shorten proof of frontier_straddle
huffman
parents: 44907
diff changeset
  2205
  by (auto simp add: mem_interior subset_eq ball_def)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2206
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2207
lemma frontier_subset_closed: "closed S \<Longrightarrow> frontier S \<subseteq> S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2208
  by (metis frontier_def closure_closed Diff_subset)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2209
34964
4e8be3c04d37 Replaced vec1 and dest_vec1 by abbreviation.
hoelzl
parents: 34291
diff changeset
  2210
lemma frontier_empty[simp]: "frontier {} = {}"
36362
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36360
diff changeset
  2211
  by (simp add: frontier_def)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2212
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2213
lemma frontier_subset_eq: "frontier S \<subseteq> S \<longleftrightarrow> closed S"
58757
7f4924f23158 tuned whitespace;
wenzelm
parents: 58184
diff changeset
  2214
proof -
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2215
  {
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2216
    assume "frontier S \<subseteq> S"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2217
    then have "closure S \<subseteq> S"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2218
      using interior_subset unfolding frontier_def by auto
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2219
    then have "closed S"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2220
      using closure_subset_eq by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2221
  }
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2222
  then show ?thesis using frontier_subset_closed[of S] ..
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2223
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2224
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  2225
lemma frontier_complement  [simp]: "frontier (- S) = frontier S"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2226
  by (auto simp add: frontier_def closure_complement interior_complement)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2227
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2228
lemma frontier_disjoint_eq: "frontier S \<inter> S = {} \<longleftrightarrow> open S"
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
  2229
  using frontier_complement frontier_subset_eq[of "- S"]
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
  2230
  unfolding open_closed by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2231
58757
7f4924f23158 tuned whitespace;
wenzelm
parents: 58184
diff changeset
  2232
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2233
subsection \<open>Filters and the ``eventually true'' quantifier\<close>
44081
730f7cced3a6 rename type 'a net to 'a filter, following standard mathematical terminology
huffman
parents: 44076
diff changeset
  2234
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2235
definition indirection :: "'a::real_normed_vector \<Rightarrow> 'a \<Rightarrow> 'a filter"
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2236
    (infixr "indirection" 70)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2237
  where "a indirection v = at a within {b. \<exists>c\<ge>0. b - a = scaleR c v}"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2238
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2239
text \<open>Identify Trivial limits, where we can't approach arbitrarily closely.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2240
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2241
lemma trivial_limit_within: "trivial_limit (at a within S) \<longleftrightarrow> \<not> a islimpt S"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2242
proof
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2243
  assume "trivial_limit (at a within S)"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2244
  then show "\<not> a islimpt S"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2245
    unfolding trivial_limit_def
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51530
diff changeset
  2246
    unfolding eventually_at_topological
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2247
    unfolding islimpt_def
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39198
diff changeset
  2248
    apply (clarsimp simp add: set_eq_iff)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2249
    apply (rename_tac T, rule_tac x=T in exI)
36358
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  2250
    apply (clarsimp, drule_tac x=y in bspec, simp_all)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2251
    done
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2252
next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2253
  assume "\<not> a islimpt S"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2254
  then show "trivial_limit (at a within S)"
55775
1557a391a858 A bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 55522
diff changeset
  2255
    unfolding trivial_limit_def eventually_at_topological islimpt_def
1557a391a858 A bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 55522
diff changeset
  2256
    by metis
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2257
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2258
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2259
lemma trivial_limit_at_iff: "trivial_limit (at a) \<longleftrightarrow> \<not> a islimpt UNIV"
45031
9583f2b56f85 add lemmas within_empty and tendsto_bot;
huffman
parents: 44909
diff changeset
  2260
  using trivial_limit_within [of a UNIV] by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2261
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2262
lemma trivial_limit_at:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2263
  fixes a :: "'a::perfect_space"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2264
  shows "\<not> trivial_limit (at a)"
44571
bd91b77c4cd6 move class perfect_space into RealVector.thy;
huffman
parents: 44568
diff changeset
  2265
  by (rule at_neq_bot)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2266
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2267
lemma trivial_limit_at_infinity:
44081
730f7cced3a6 rename type 'a net to 'a filter, following standard mathematical terminology
huffman
parents: 44076
diff changeset
  2268
  "\<not> trivial_limit (at_infinity :: ('a::{real_normed_vector,perfect_space}) filter)"
36358
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  2269
  unfolding trivial_limit_def eventually_at_infinity
246493d61204 define nets directly as filters, instead of as filter bases
huffman
parents: 36336
diff changeset
  2270
  apply clarsimp
44072
5b970711fb39 class perfect_space inherits from topological_space;
huffman
parents: 43338
diff changeset
  2271
  apply (subgoal_tac "\<exists>x::'a. x \<noteq> 0", clarify)
5b970711fb39 class perfect_space inherits from topological_space;
huffman
parents: 43338
diff changeset
  2272
   apply (rule_tac x="scaleR (b / norm x) x" in exI, simp)
5b970711fb39 class perfect_space inherits from topological_space;
huffman
parents: 43338
diff changeset
  2273
  apply (cut_tac islimpt_UNIV [of "0::'a", unfolded islimpt_def])
5b970711fb39 class perfect_space inherits from topological_space;
huffman
parents: 43338
diff changeset
  2274
  apply (drule_tac x=UNIV in spec, simp)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2275
  done
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2276
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2277
lemma not_trivial_limit_within: "\<not> trivial_limit (at x within S) = (x \<in> closure (S - {x}))"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2278
  using islimpt_in_closure
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2279
  by (metis trivial_limit_within)
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  2280
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2281
lemma at_within_eq_bot_iff: "(at c within A = bot) \<longleftrightarrow> (c \<notin> closure (A - {c}))"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2282
  using not_trivial_limit_within[of c A] by blast
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61524
diff changeset
  2283
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2284
text \<open>Some property holds "sufficiently close" to the limit point.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2285
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2286
lemma trivial_limit_eventually: "trivial_limit net \<Longrightarrow> eventually P net"
45031
9583f2b56f85 add lemmas within_empty and tendsto_bot;
huffman
parents: 44909
diff changeset
  2287
  by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2288
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2289
lemma trivial_limit_eq: "trivial_limit net \<longleftrightarrow> (\<forall>P. eventually P net)"
44342
8321948340ea redefine constant 'trivial_limit' as an abbreviation
huffman
parents: 44286
diff changeset
  2290
  by (simp add: filter_eq_iff)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2291
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  2292
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2293
subsection \<open>Limits\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2294
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2295
lemma Lim:
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2296
  "(f \<longlongrightarrow> l) net \<longleftrightarrow>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2297
        trivial_limit net \<or>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2298
        (\<forall>e>0. eventually (\<lambda>x. dist (f x) l < e) net)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2299
  unfolding tendsto_iff trivial_limit_eq by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2300
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2301
text\<open>Show that they yield usual definitions in the various cases.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2302
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2303
lemma Lim_within_le: "(f \<longlongrightarrow> l)(at a within S) \<longleftrightarrow>
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2304
    (\<forall>e>0. \<exists>d>0. \<forall>x\<in>S. 0 < dist x a \<and> dist x a \<le> d \<longrightarrow> dist (f x) l < e)"
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51530
diff changeset
  2305
  by (auto simp add: tendsto_iff eventually_at_le dist_nz)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2306
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2307
lemma Lim_within: "(f \<longlongrightarrow> l) (at a within S) \<longleftrightarrow>
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2308
    (\<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)"
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51530
diff changeset
  2309
  by (auto simp add: tendsto_iff eventually_at dist_nz)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2310
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2311
lemma Lim_at: "(f \<longlongrightarrow> l) (at a) \<longleftrightarrow>
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2312
    (\<forall>e >0. \<exists>d>0. \<forall>x. 0 < dist x a \<and> dist x a < d  \<longrightarrow> dist (f x) l < e)"
51530
609914f0934a rename eventually_at / _within, to distinguish them from the lemmas in the HOL image
hoelzl
parents: 51518
diff changeset
  2313
  by (auto simp add: tendsto_iff eventually_at2)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2314
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2315
lemma Lim_at_infinity:
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2316
  "(f \<longlongrightarrow> l) at_infinity \<longleftrightarrow> (\<forall>e>0. \<exists>b. \<forall>x. norm x \<ge> b \<longrightarrow> dist (f x) l < e)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2317
  by (auto simp add: tendsto_iff eventually_at_infinity)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2318
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2319
lemma Lim_eventually: "eventually (\<lambda>x. f x = l) net \<Longrightarrow> (f \<longlongrightarrow> l) net"
61810
3c5040d5694a sorted out eventually_mono
paulson <lp15@cam.ac.uk>
parents: 61808
diff changeset
  2320
  by (rule topological_tendstoI, auto elim: eventually_mono)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2321
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2322
text\<open>The expected monotonicity property.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2323
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2324
lemma Lim_Un:
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2325
  assumes "(f \<longlongrightarrow> l) (at x within S)" "(f \<longlongrightarrow> l) (at x within T)"
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2326
  shows "(f \<longlongrightarrow> l) (at x within (S \<union> T))"
53860
f2d683432580 factor out new lemma
huffman
parents: 53859
diff changeset
  2327
  using assms unfolding at_within_union by (rule filterlim_sup)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2328
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2329
lemma Lim_Un_univ:
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2330
  "(f \<longlongrightarrow> l) (at x within S) \<Longrightarrow> (f \<longlongrightarrow> l) (at x within T) \<Longrightarrow>
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2331
    S \<union> T = UNIV \<Longrightarrow> (f \<longlongrightarrow> l) (at x)"
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51530
diff changeset
  2332
  by (metis Lim_Un)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2333
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2334
text\<open>Interrelations between restricted and unrestricted limits.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2335
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  2336
lemma Lim_at_imp_Lim_at_within:
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2337
  "(f \<longlongrightarrow> l) (at x) \<Longrightarrow> (f \<longlongrightarrow> l) (at x within S)"
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51530
diff changeset
  2338
  by (metis order_refl filterlim_mono subset_UNIV at_le)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2339
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  2340
lemma eventually_within_interior:
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  2341
  assumes "x \<in> interior S"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2342
  shows "eventually P (at x within S) \<longleftrightarrow> eventually P (at x)"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2343
  (is "?lhs = ?rhs")
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2344
proof
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  2345
  from assms obtain T where T: "open T" "x \<in> T" "T \<subseteq> S" ..
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2346
  {
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2347
    assume "?lhs"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2348
    then obtain A where "open A" and "x \<in> A" and "\<forall>y\<in>A. y \<noteq> x \<longrightarrow> y \<in> S \<longrightarrow> P y"
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51530
diff changeset
  2349
      unfolding eventually_at_topological
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  2350
      by auto
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2351
    with T have "open (A \<inter> T)" and "x \<in> A \<inter> T" and "\<forall>y \<in> A \<inter> T. y \<noteq> x \<longrightarrow> P y"
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  2352
      by auto
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2353
    then show "?rhs"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents: 51365
diff changeset
  2354
      unfolding eventually_at_topological by auto
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2355
  next
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2356
    assume "?rhs"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2357
    then show "?lhs"
61810
3c5040d5694a sorted out eventually_mono
paulson <lp15@cam.ac.uk>
parents: 61808
diff changeset
  2358
      by (auto elim: eventually_mono simp: eventually_at_filter)
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2359
  }
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  2360
qed
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  2361
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  2362
lemma at_within_interior:
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  2363
  "x \<in> interior S \<Longrightarrow> at x within S = at x"
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51530
diff changeset
  2364
  unfolding filter_eq_iff by (intro allI eventually_within_interior)
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  2365
43338
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 42165
diff changeset
  2366
lemma Lim_within_LIMSEQ:
53862
cb1094587ee4 generalize lemma
huffman
parents: 53861
diff changeset
  2367
  fixes a :: "'a::first_countable_topology"
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  2368
  assumes "\<forall>S. (\<forall>n. S n \<noteq> a \<and> S n \<in> T) \<and> S \<longlonglongrightarrow> a \<longrightarrow> (\<lambda>n. X (S n)) \<longlonglongrightarrow> L"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2369
  shows "(X \<longlongrightarrow> L) (at a within T)"
44584
08ad27488983 simplify some proofs
huffman
parents: 44571
diff changeset
  2370
  using assms unfolding tendsto_def [where l=L]
08ad27488983 simplify some proofs
huffman
parents: 44571
diff changeset
  2371
  by (simp add: sequentially_imp_eventually_within)
43338
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 42165
diff changeset
  2372
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 42165
diff changeset
  2373
lemma Lim_right_bound:
51773
9328c6681f3c spell conditional_ly_-complete lattices correct
hoelzl
parents: 51641
diff changeset
  2374
  fixes f :: "'a :: {linorder_topology, conditionally_complete_linorder, no_top} \<Rightarrow>
9328c6681f3c spell conditional_ly_-complete lattices correct
hoelzl
parents: 51641
diff changeset
  2375
    'b::{linorder_topology, conditionally_complete_linorder}"
43338
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 42165
diff changeset
  2376
  assumes mono: "\<And>a b. a \<in> I \<Longrightarrow> b \<in> I \<Longrightarrow> x < a \<Longrightarrow> a \<le> b \<Longrightarrow> f a \<le> f b"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2377
    and bnd: "\<And>a. a \<in> I \<Longrightarrow> x < a \<Longrightarrow> K \<le> f a"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2378
  shows "(f \<longlongrightarrow> Inf (f ` ({x<..} \<inter> I))) (at x within ({x<..} \<inter> I))"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2379
proof (cases "{x<..} \<inter> I = {}")
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2380
  case True
53859
e6cb01686f7b replace lemma with more general simp rule
huffman
parents: 53813
diff changeset
  2381
  then show ?thesis by simp
43338
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 42165
diff changeset
  2382
next
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2383
  case False
43338
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 42165
diff changeset
  2384
  show ?thesis
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2385
  proof (rule order_tendstoI)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2386
    fix a
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2387
    assume a: "a < Inf (f ` ({x<..} \<inter> I))"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2388
    {
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2389
      fix y
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2390
      assume "y \<in> {x<..} \<inter> I"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2391
      with False bnd have "Inf (f ` ({x<..} \<inter> I)) \<le> f y"
56166
9a241bc276cd normalising simp rules for compound operators
haftmann
parents: 56154
diff changeset
  2392
        by (auto intro!: cInf_lower bdd_belowI2 simp del: Inf_image_eq)
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2393
      with a have "a < f y"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2394
        by (blast intro: less_le_trans)
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2395
    }
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2396
    then show "eventually (\<lambda>x. a < f x) (at x within ({x<..} \<inter> I))"
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51530
diff changeset
  2397
      by (auto simp: eventually_at_filter intro: exI[of _ 1] zero_less_one)
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2398
  next
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2399
    fix a
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2400
    assume "Inf (f ` ({x<..} \<inter> I)) < a"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2401
    from cInf_lessD[OF _ this] False obtain y where y: "x < y" "y \<in> I" "f y < a"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2402
      by auto
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51530
diff changeset
  2403
    then have "eventually (\<lambda>x. x \<in> I \<longrightarrow> f x < a) (at_right x)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2404
      unfolding eventually_at_right[OF \<open>x < y\<close>] by (metis less_imp_le le_less_trans mono)
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51530
diff changeset
  2405
    then show "eventually (\<lambda>x. f x < a) (at x within ({x<..} \<inter> I))"
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51530
diff changeset
  2406
      unfolding eventually_at_filter by eventually_elim simp
43338
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 42165
diff changeset
  2407
  qed
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 42165
diff changeset
  2408
qed
a150d16bf77c lemmas about right derivative and limits
hoelzl
parents: 42165
diff changeset
  2409
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2410
text\<open>Another limit point characterization.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2411
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2412
lemma islimpt_sequential:
50883
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
  2413
  fixes x :: "'a::first_countable_topology"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2414
  shows "x islimpt S \<longleftrightarrow> (\<exists>f. (\<forall>n::nat. f n \<in> S - {x}) \<and> (f \<longlongrightarrow> x) sequentially)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2415
    (is "?lhs = ?rhs")
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2416
proof
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2417
  assume ?lhs
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  2418
  from countable_basis_at_decseq[of x] obtain A where A:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  2419
      "\<And>i. open (A i)"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  2420
      "\<And>i. x \<in> A i"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  2421
      "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> eventually (\<lambda>i. A i \<subseteq> S) sequentially"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  2422
    by blast
50883
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
  2423
  def f \<equiv> "\<lambda>n. SOME y. y \<in> S \<and> y \<in> A n \<and> x \<noteq> y"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2424
  {
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2425
    fix n
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2426
    from \<open>?lhs\<close> have "\<exists>y. y \<in> S \<and> y \<in> A n \<and> x \<noteq> y"
50883
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
  2427
      unfolding islimpt_def using A(1,2)[of n] by auto
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
  2428
    then have "f n \<in> S \<and> f n \<in> A n \<and> x \<noteq> f n"
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
  2429
      unfolding f_def by (rule someI_ex)
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2430
    then have "f n \<in> S" "f n \<in> A n" "x \<noteq> f n" by auto
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2431
  }
50883
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
  2432
  then have "\<forall>n. f n \<in> S - {x}" by auto
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  2433
  moreover have "(\<lambda>n. f n) \<longlonglongrightarrow> x"
50883
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
  2434
  proof (rule topological_tendstoI)
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2435
    fix S
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2436
    assume "open S" "x \<in> S"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2437
    from A(3)[OF this] \<open>\<And>n. f n \<in> A n\<close>
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2438
    show "eventually (\<lambda>x. f x \<in> S) sequentially"
61810
3c5040d5694a sorted out eventually_mono
paulson <lp15@cam.ac.uk>
parents: 61808
diff changeset
  2439
      by (auto elim!: eventually_mono)
44584
08ad27488983 simplify some proofs
huffman
parents: 44571
diff changeset
  2440
  qed
08ad27488983 simplify some proofs
huffman
parents: 44571
diff changeset
  2441
  ultimately show ?rhs by fast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2442
next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2443
  assume ?rhs
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  2444
  then obtain f :: "nat \<Rightarrow> 'a" where f: "\<And>n. f n \<in> S - {x}" and lim: "f \<longlonglongrightarrow> x"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2445
    by auto
50883
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
  2446
  show ?lhs
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
  2447
    unfolding islimpt_def
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
  2448
  proof safe
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2449
    fix T
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2450
    assume "open T" "x \<in> T"
50883
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
  2451
    from lim[THEN topological_tendstoD, OF this] f
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
  2452
    show "\<exists>y\<in>S. y \<in> T \<and> y \<noteq> x"
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
  2453
      unfolding eventually_sequentially by auto
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
  2454
  qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2455
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2456
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2457
lemma Lim_null:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2458
  fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2459
  shows "(f \<longlongrightarrow> l) net \<longleftrightarrow> ((\<lambda>x. f(x) - l) \<longlongrightarrow> 0) net"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2460
  by (simp add: Lim dist_norm)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2461
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2462
lemma Lim_null_comparison:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2463
  fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2464
  assumes "eventually (\<lambda>x. norm (f x) \<le> g x) net" "(g \<longlongrightarrow> 0) net"
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2465
  shows "(f \<longlongrightarrow> 0) net"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2466
  using assms(2)
44252
10362a07eb7c Topology_Euclidean_Space.thy: simplify some proofs
huffman
parents: 44250
diff changeset
  2467
proof (rule metric_tendsto_imp_tendsto)
10362a07eb7c Topology_Euclidean_Space.thy: simplify some proofs
huffman
parents: 44250
diff changeset
  2468
  show "eventually (\<lambda>x. dist (f x) 0 \<le> dist (g x) 0) net"
61810
3c5040d5694a sorted out eventually_mono
paulson <lp15@cam.ac.uk>
parents: 61808
diff changeset
  2469
    using assms(1) by (rule eventually_mono) (simp add: dist_norm)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2470
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2471
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2472
lemma Lim_transform_bound:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2473
  fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2474
    and g :: "'a \<Rightarrow> 'c::real_normed_vector"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2475
  assumes "eventually (\<lambda>n. norm (f n) \<le> norm (g n)) net"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2476
    and "(g \<longlongrightarrow> 0) net"
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2477
  shows "(f \<longlongrightarrow> 0) net"
44252
10362a07eb7c Topology_Euclidean_Space.thy: simplify some proofs
huffman
parents: 44250
diff changeset
  2478
  using assms(1) tendsto_norm_zero [OF assms(2)]
10362a07eb7c Topology_Euclidean_Space.thy: simplify some proofs
huffman
parents: 44250
diff changeset
  2479
  by (rule Lim_null_comparison)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2480
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2481
text\<open>Deducing things about the limit from the elements.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2482
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2483
lemma Lim_in_closed_set:
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2484
  assumes "closed S"
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2485
    and "eventually (\<lambda>x. f(x) \<in> S) net"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2486
    and "\<not> trivial_limit net" "(f \<longlongrightarrow> l) net"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2487
  shows "l \<in> S"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2488
proof (rule ccontr)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2489
  assume "l \<notin> S"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2490
  with \<open>closed S\<close> have "open (- S)" "l \<in> - S"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2491
    by (simp_all add: open_Compl)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2492
  with assms(4) have "eventually (\<lambda>x. f x \<in> - S) net"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2493
    by (rule topological_tendstoD)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2494
  with assms(2) have "eventually (\<lambda>x. False) net"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2495
    by (rule eventually_elim2) simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2496
  with assms(3) show "False"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2497
    by (simp add: eventually_False)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2498
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2499
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2500
text\<open>Need to prove closed(cball(x,e)) before deducing this as a corollary.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2501
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2502
lemma Lim_dist_ubound:
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2503
  assumes "\<not>(trivial_limit net)"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2504
    and "(f \<longlongrightarrow> l) net"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2505
    and "eventually (\<lambda>x. dist a (f x) \<le> e) net"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2506
  shows "dist a l \<le> e"
56290
801a72ad52d3 tuned proofs
huffman
parents: 56189
diff changeset
  2507
  using assms by (fast intro: tendsto_le tendsto_intros)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2508
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2509
lemma Lim_norm_ubound:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2510
  fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2511
  assumes "\<not>(trivial_limit net)" "(f \<longlongrightarrow> l) net" "eventually (\<lambda>x. norm(f x) \<le> e) net"
53255
addd7b9b2bff tuned proofs;
wenzelm
parents: 53015
diff changeset
  2512
  shows "norm(l) \<le> e"
56290
801a72ad52d3 tuned proofs
huffman
parents: 56189
diff changeset
  2513
  using assms by (fast intro: tendsto_le tendsto_intros)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2514
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2515
lemma Lim_norm_lbound:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2516
  fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2517
  assumes "\<not> trivial_limit net"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2518
    and "(f \<longlongrightarrow> l) net"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2519
    and "eventually (\<lambda>x. e \<le> norm (f x)) net"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2520
  shows "e \<le> norm l"
56290
801a72ad52d3 tuned proofs
huffman
parents: 56189
diff changeset
  2521
  using assms by (fast intro: tendsto_le tendsto_intros)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2522
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2523
text\<open>Limit under bilinear function\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2524
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2525
lemma Lim_bilinear:
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2526
  assumes "(f \<longlongrightarrow> l) net"
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2527
    and "(g \<longlongrightarrow> m) net"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2528
    and "bounded_bilinear h"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2529
  shows "((\<lambda>x. h (f x) (g x)) \<longlongrightarrow> (h l m)) net"
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2530
  using \<open>bounded_bilinear h\<close> \<open>(f \<longlongrightarrow> l) net\<close> \<open>(g \<longlongrightarrow> m) net\<close>
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2531
  by (rule bounded_bilinear.tendsto)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2532
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2533
text\<open>These are special for limits out of the same vector space.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2534
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2535
lemma Lim_within_id: "(id \<longlongrightarrow> a) (at a within s)"
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51530
diff changeset
  2536
  unfolding id_def by (rule tendsto_ident_at)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2537
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2538
lemma Lim_at_id: "(id \<longlongrightarrow> a) (at a)"
45031
9583f2b56f85 add lemmas within_empty and tendsto_bot;
huffman
parents: 44909
diff changeset
  2539
  unfolding id_def by (rule tendsto_ident_at)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2540
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2541
lemma Lim_at_zero:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2542
  fixes a :: "'a::real_normed_vector"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  2543
    and l :: "'b::topological_space"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2544
  shows "(f \<longlongrightarrow> l) (at a) \<longleftrightarrow> ((\<lambda>x. f(a + x)) \<longlongrightarrow> l) (at 0)"
44252
10362a07eb7c Topology_Euclidean_Space.thy: simplify some proofs
huffman
parents: 44250
diff changeset
  2545
  using LIM_offset_zero LIM_offset_zero_cancel ..
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2546
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2547
text\<open>It's also sometimes useful to extract the limit point from the filter.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2548
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2549
abbreviation netlimit :: "'a::t2_space filter \<Rightarrow> 'a"
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2550
  where "netlimit F \<equiv> Lim F (\<lambda>x. x)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2551
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2552
lemma netlimit_within: "\<not> trivial_limit (at a within S) \<Longrightarrow> netlimit (at a within S) = a"
51365
6b5250100db8 netlimit is abbreviation for Lim
hoelzl
parents: 51364
diff changeset
  2553
  by (rule tendsto_Lim) (auto intro: tendsto_intros)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2554
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2555
lemma netlimit_at:
44072
5b970711fb39 class perfect_space inherits from topological_space;
huffman
parents: 43338
diff changeset
  2556
  fixes a :: "'a::{perfect_space,t2_space}"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2557
  shows "netlimit (at a) = a"
45031
9583f2b56f85 add lemmas within_empty and tendsto_bot;
huffman
parents: 44909
diff changeset
  2558
  using netlimit_within [of a UNIV] by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2559
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  2560
lemma lim_within_interior:
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2561
  "x \<in> interior S \<Longrightarrow> (f \<longlongrightarrow> l) (at x within S) \<longleftrightarrow> (f \<longlongrightarrow> l) (at x)"
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51530
diff changeset
  2562
  by (metis at_within_interior)
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  2563
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  2564
lemma netlimit_within_interior:
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  2565
  fixes x :: "'a::{t2_space,perfect_space}"
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  2566
  assumes "x \<in> interior S"
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  2567
  shows "netlimit (at x within S) = x"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2568
  using assms by (metis at_within_interior netlimit_at)
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  2569
61824
dcbe9f756ae0 not_leE -> not_le_imp_less and other tidying
paulson <lp15@cam.ac.uk>
parents: 61810
diff changeset
  2570
lemma netlimit_at_vector:
dcbe9f756ae0 not_leE -> not_le_imp_less and other tidying
paulson <lp15@cam.ac.uk>
parents: 61810
diff changeset
  2571
  fixes a :: "'a::real_normed_vector"
dcbe9f756ae0 not_leE -> not_le_imp_less and other tidying
paulson <lp15@cam.ac.uk>
parents: 61810
diff changeset
  2572
  shows "netlimit (at a) = a"
dcbe9f756ae0 not_leE -> not_le_imp_less and other tidying
paulson <lp15@cam.ac.uk>
parents: 61810
diff changeset
  2573
proof (cases "\<exists>x. x \<noteq> a")
dcbe9f756ae0 not_leE -> not_le_imp_less and other tidying
paulson <lp15@cam.ac.uk>
parents: 61810
diff changeset
  2574
  case True then obtain x where x: "x \<noteq> a" ..
dcbe9f756ae0 not_leE -> not_le_imp_less and other tidying
paulson <lp15@cam.ac.uk>
parents: 61810
diff changeset
  2575
  have "\<not> trivial_limit (at a)"
dcbe9f756ae0 not_leE -> not_le_imp_less and other tidying
paulson <lp15@cam.ac.uk>
parents: 61810
diff changeset
  2576
    unfolding trivial_limit_def eventually_at dist_norm
dcbe9f756ae0 not_leE -> not_le_imp_less and other tidying
paulson <lp15@cam.ac.uk>
parents: 61810
diff changeset
  2577
    apply clarsimp
dcbe9f756ae0 not_leE -> not_le_imp_less and other tidying
paulson <lp15@cam.ac.uk>
parents: 61810
diff changeset
  2578
    apply (rule_tac x="a + scaleR (d / 2) (sgn (x - a))" in exI)
dcbe9f756ae0 not_leE -> not_le_imp_less and other tidying
paulson <lp15@cam.ac.uk>
parents: 61810
diff changeset
  2579
    apply (simp add: norm_sgn sgn_zero_iff x)
dcbe9f756ae0 not_leE -> not_le_imp_less and other tidying
paulson <lp15@cam.ac.uk>
parents: 61810
diff changeset
  2580
    done
dcbe9f756ae0 not_leE -> not_le_imp_less and other tidying
paulson <lp15@cam.ac.uk>
parents: 61810
diff changeset
  2581
  then show ?thesis
dcbe9f756ae0 not_leE -> not_le_imp_less and other tidying
paulson <lp15@cam.ac.uk>
parents: 61810
diff changeset
  2582
    by (rule netlimit_within [of a UNIV])
dcbe9f756ae0 not_leE -> not_le_imp_less and other tidying
paulson <lp15@cam.ac.uk>
parents: 61810
diff changeset
  2583
qed simp
dcbe9f756ae0 not_leE -> not_le_imp_less and other tidying
paulson <lp15@cam.ac.uk>
parents: 61810
diff changeset
  2584
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2585
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2586
text\<open>Useful lemmas on closure and set of possible sequential limits.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2587
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2588
lemma closure_sequential:
50883
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
  2589
  fixes l :: "'a::first_countable_topology"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2590
  shows "l \<in> closure S \<longleftrightarrow> (\<exists>x. (\<forall>n. x n \<in> S) \<and> (x \<longlongrightarrow> l) sequentially)"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  2591
  (is "?lhs = ?rhs")
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2592
proof
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2593
  assume "?lhs"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2594
  moreover
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2595
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2596
    assume "l \<in> S"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2597
    then have "?rhs" using tendsto_const[of l sequentially] by auto
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2598
  }
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2599
  moreover
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2600
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2601
    assume "l islimpt S"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2602
    then have "?rhs" unfolding islimpt_sequential by auto
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2603
  }
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2604
  ultimately show "?rhs"
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2605
    unfolding closure_def by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2606
next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2607
  assume "?rhs"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2608
  then show "?lhs" unfolding closure_def islimpt_sequential by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2609
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2610
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2611
lemma closed_sequential_limits:
50883
1421884baf5b introduce first_countable_topology typeclass
hoelzl
parents: 50882
diff changeset
  2612
  fixes S :: "'a::first_countable_topology set"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2613
  shows "closed S \<longleftrightarrow> (\<forall>x l. (\<forall>n. x n \<in> S) \<and> (x \<longlongrightarrow> l) sequentially \<longrightarrow> l \<in> S)"
55775
1557a391a858 A bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 55522
diff changeset
  2614
by (metis closure_sequential closure_subset_eq subset_iff)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2615
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2616
lemma closure_approachable:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2617
  fixes S :: "'a::metric_space set"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2618
  shows "x \<in> closure S \<longleftrightarrow> (\<forall>e>0. \<exists>y\<in>S. dist y x < e)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2619
  apply (auto simp add: closure_def islimpt_approachable)
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2620
  apply (metis dist_self)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2621
  done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2622
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2623
lemma closed_approachable:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2624
  fixes S :: "'a::metric_space set"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  2625
  shows "closed S \<Longrightarrow> (\<forall>e>0. \<exists>y\<in>S. dist y x < e) \<longleftrightarrow> x \<in> S"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2626
  by (metis closure_closed closure_approachable)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2627
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  2628
lemma closure_contains_Inf:
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  2629
  fixes S :: "real set"
54258
adfc759263ab use bdd_above and bdd_below for conditionally complete lattices
hoelzl
parents: 54230
diff changeset
  2630
  assumes "S \<noteq> {}" "bdd_below S"
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  2631
  shows "Inf S \<in> closure S"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2632
proof -
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  2633
  have *: "\<forall>x\<in>S. Inf S \<le> x"
54258
adfc759263ab use bdd_above and bdd_below for conditionally complete lattices
hoelzl
parents: 54230
diff changeset
  2634
    using cInf_lower[of _ S] assms by metis
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2635
  {
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2636
    fix e :: real
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2637
    assume "e > 0"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2638
    then have "Inf S < Inf S + e" by simp
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2639
    with assms obtain x where "x \<in> S" "x < Inf S + e"
54258
adfc759263ab use bdd_above and bdd_below for conditionally complete lattices
hoelzl
parents: 54230
diff changeset
  2640
      by (subst (asm) cInf_less_iff) auto
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2641
    with * have "\<exists>x\<in>S. dist x (Inf S) < e"
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2642
      by (intro bexI[of _ x]) (auto simp add: dist_real_def)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2643
  }
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2644
  then show ?thesis unfolding closure_approachable by auto
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  2645
qed
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  2646
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  2647
lemma closed_contains_Inf:
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  2648
  fixes S :: "real set"
54258
adfc759263ab use bdd_above and bdd_below for conditionally complete lattices
hoelzl
parents: 54230
diff changeset
  2649
  shows "S \<noteq> {} \<Longrightarrow> bdd_below S \<Longrightarrow> closed S \<Longrightarrow> Inf S \<in> S"
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  2650
  by (metis closure_contains_Inf closure_closed assms)
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  2651
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  2652
lemma not_trivial_limit_within_ball:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2653
  "\<not> trivial_limit (at x within S) \<longleftrightarrow> (\<forall>e>0. S \<inter> ball x e - {x} \<noteq> {})"
60462
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2654
  (is "?lhs \<longleftrightarrow> ?rhs")
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2655
proof
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2656
  show ?rhs if ?lhs
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2657
  proof -
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2658
    {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2659
      fix e :: real
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2660
      assume "e > 0"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2661
      then obtain y where "y \<in> S - {x}" and "dist y x < e"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2662
        using \<open>?lhs\<close> not_trivial_limit_within[of x S] closure_approachable[of x "S - {x}"]
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  2663
        by auto
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2664
      then have "y \<in> S \<inter> ball x e - {x}"
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  2665
        unfolding ball_def by (simp add: dist_commute)
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2666
      then have "S \<inter> ball x e - {x} \<noteq> {}" by blast
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2667
    }
60462
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2668
    then show ?thesis by auto
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2669
  qed
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2670
  show ?lhs if ?rhs
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2671
  proof -
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2672
    {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2673
      fix e :: real
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2674
      assume "e > 0"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2675
      then obtain y where "y \<in> S \<inter> ball x e - {x}"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2676
        using \<open>?rhs\<close> by blast
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2677
      then have "y \<in> S - {x}" and "dist y x < e"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2678
        unfolding ball_def by (simp_all add: dist_commute)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2679
      then have "\<exists>y \<in> S - {x}. dist y x < e"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2680
        by auto
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  2681
    }
60462
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2682
    then show ?thesis
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2683
      using not_trivial_limit_within[of x S] closure_approachable[of x "S - {x}"]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2684
      by auto
60462
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2685
  qed
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  2686
qed
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  2687
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2688
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2689
subsection \<open>Infimum Distance\<close>
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2690
54260
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  2691
definition "infdist x A = (if A = {} then 0 else INF a:A. dist x a)"
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  2692
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  2693
lemma bdd_below_infdist[intro, simp]: "bdd_below (dist x`A)"
54258
adfc759263ab use bdd_above and bdd_below for conditionally complete lattices
hoelzl
parents: 54230
diff changeset
  2694
  by (auto intro!: zero_le_dist)
adfc759263ab use bdd_above and bdd_below for conditionally complete lattices
hoelzl
parents: 54230
diff changeset
  2695
54260
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  2696
lemma infdist_notempty: "A \<noteq> {} \<Longrightarrow> infdist x A = (INF a:A. dist x a)"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2697
  by (simp add: infdist_def)
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2698
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2699
lemma infdist_nonneg: "0 \<le> infdist x A"
54260
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  2700
  by (auto simp add: infdist_def intro: cINF_greatest)
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  2701
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  2702
lemma infdist_le: "a \<in> A \<Longrightarrow> infdist x A \<le> dist x a"
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  2703
  by (auto intro: cINF_lower simp add: infdist_def)
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  2704
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  2705
lemma infdist_le2: "a \<in> A \<Longrightarrow> dist x a \<le> d \<Longrightarrow> infdist x A \<le> d"
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  2706
  by (auto intro!: cINF_lower2 simp add: infdist_def)
54258
adfc759263ab use bdd_above and bdd_below for conditionally complete lattices
hoelzl
parents: 54230
diff changeset
  2707
adfc759263ab use bdd_above and bdd_below for conditionally complete lattices
hoelzl
parents: 54230
diff changeset
  2708
lemma infdist_zero[simp]: "a \<in> A \<Longrightarrow> infdist a A = 0"
54260
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  2709
  by (auto intro!: antisym infdist_nonneg infdist_le2)
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2710
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2711
lemma infdist_triangle: "infdist x A \<le> infdist y A + dist x y"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2712
proof (cases "A = {}")
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2713
  case True
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2714
  then show ?thesis by (simp add: infdist_def)
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2715
next
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  2716
  case False
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2717
  then obtain a where "a \<in> A" by auto
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2718
  have "infdist x A \<le> Inf {dist x y + dist y a |a. a \<in> A}"
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51473
diff changeset
  2719
  proof (rule cInf_greatest)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2720
    from \<open>A \<noteq> {}\<close> show "{dist x y + dist y a |a. a \<in> A} \<noteq> {}"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2721
      by simp
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2722
    fix d
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2723
    assume "d \<in> {dist x y + dist y a |a. a \<in> A}"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2724
    then obtain a where d: "d = dist x y + dist y a" "a \<in> A"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2725
      by auto
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2726
    show "infdist x A \<le> d"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2727
      unfolding infdist_notempty[OF \<open>A \<noteq> {}\<close>]
54260
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  2728
    proof (rule cINF_lower2)
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  2729
      show "a \<in> A" by fact
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2730
      show "dist x a \<le> d"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2731
        unfolding d by (rule dist_triangle)
54258
adfc759263ab use bdd_above and bdd_below for conditionally complete lattices
hoelzl
parents: 54230
diff changeset
  2732
    qed simp
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2733
  qed
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2734
  also have "\<dots> = dist x y + infdist y A"
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51473
diff changeset
  2735
  proof (rule cInf_eq, safe)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2736
    fix a
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2737
    assume "a \<in> A"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2738
    then show "dist x y + infdist y A \<le> dist x y + dist y a"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2739
      by (auto intro: infdist_le)
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2740
  next
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2741
    fix i
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2742
    assume inf: "\<And>d. d \<in> {dist x y + dist y a |a. a \<in> A} \<Longrightarrow> i \<le> d"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2743
    then have "i - dist x y \<le> infdist y A"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2744
      unfolding infdist_notempty[OF \<open>A \<noteq> {}\<close>] using \<open>a \<in> A\<close>
54260
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  2745
      by (intro cINF_greatest) (auto simp: field_simps)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2746
    then show "i \<le> dist x y + infdist y A"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2747
      by simp
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2748
  qed
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2749
  finally show ?thesis by simp
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2750
qed
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2751
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51473
diff changeset
  2752
lemma in_closure_iff_infdist_zero:
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2753
  assumes "A \<noteq> {}"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2754
  shows "x \<in> closure A \<longleftrightarrow> infdist x A = 0"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2755
proof
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2756
  assume "x \<in> closure A"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2757
  show "infdist x A = 0"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2758
  proof (rule ccontr)
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2759
    assume "infdist x A \<noteq> 0"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2760
    with infdist_nonneg[of x A] have "infdist x A > 0"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2761
      by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2762
    then have "ball x (infdist x A) \<inter> closure A = {}"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2763
      apply auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2764
      apply (metis \<open>x \<in> closure A\<close> closure_approachable dist_commute infdist_le not_less)
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2765
      done
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2766
    then have "x \<notin> closure A"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2767
      by (metis \<open>0 < infdist x A\<close> centre_in_ball disjoint_iff_not_equal)
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2768
    then show False using \<open>x \<in> closure A\<close> by simp
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2769
  qed
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2770
next
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2771
  assume x: "infdist x A = 0"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2772
  then obtain a where "a \<in> A"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2773
    by atomize_elim (metis all_not_in_conv assms)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2774
  show "x \<in> closure A"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2775
    unfolding closure_approachable
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2776
    apply safe
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2777
  proof (rule ccontr)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2778
    fix e :: real
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2779
    assume "e > 0"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2780
    assume "\<not> (\<exists>y\<in>A. dist y x < e)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2781
    then have "infdist x A \<ge> e" using \<open>a \<in> A\<close>
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2782
      unfolding infdist_def
54260
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  2783
      by (force simp: dist_commute intro: cINF_greatest)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2784
    with x \<open>e > 0\<close> show False by auto
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2785
  qed
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2786
qed
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2787
51475
ebf9d4fd00ba introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents: 51473
diff changeset
  2788
lemma in_closed_iff_infdist_zero:
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2789
  assumes "closed A" "A \<noteq> {}"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2790
  shows "x \<in> A \<longleftrightarrow> infdist x A = 0"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2791
proof -
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2792
  have "x \<in> closure A \<longleftrightarrow> infdist x A = 0"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2793
    by (rule in_closure_iff_infdist_zero) fact
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2794
  with assms show ?thesis by simp
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2795
qed
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2796
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2797
lemma tendsto_infdist [tendsto_intros]:
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2798
  assumes f: "(f \<longlongrightarrow> l) F"
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2799
  shows "((\<lambda>x. infdist (f x) A) \<longlongrightarrow> infdist l A) F"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2800
proof (rule tendstoI)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2801
  fix e ::real
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2802
  assume "e > 0"
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2803
  from tendstoD[OF f this]
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2804
  show "eventually (\<lambda>x. dist (infdist (f x) A) (infdist l A) < e) F"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2805
  proof (eventually_elim)
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2806
    fix x
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2807
    from infdist_triangle[of l A "f x"] infdist_triangle[of "f x" A l]
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2808
    have "dist (infdist (f x) A) (infdist l A) \<le> dist (f x) l"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2809
      by (simp add: dist_commute dist_real_def)
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2810
    also assume "dist (f x) l < e"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2811
    finally show "dist (infdist (f x) A) (infdist l A) < e" .
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2812
  qed
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2813
qed
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  2814
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2815
text\<open>Some other lemmas about sequences.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2816
53597
ea99a7964174 remove duplicate lemmas
huffman
parents: 53374
diff changeset
  2817
lemma sequentially_offset: (* TODO: move to Topological_Spaces.thy *)
36441
1d7704c29af3 generalized many lemmas about continuity
huffman
parents: 36440
diff changeset
  2818
  assumes "eventually (\<lambda>i. P i) sequentially"
1d7704c29af3 generalized many lemmas about continuity
huffman
parents: 36440
diff changeset
  2819
  shows "eventually (\<lambda>i. P (i + k)) sequentially"
53597
ea99a7964174 remove duplicate lemmas
huffman
parents: 53374
diff changeset
  2820
  using assms by (rule eventually_sequentially_seg [THEN iffD2])
ea99a7964174 remove duplicate lemmas
huffman
parents: 53374
diff changeset
  2821
ea99a7964174 remove duplicate lemmas
huffman
parents: 53374
diff changeset
  2822
lemma seq_offset_neg: (* TODO: move to Topological_Spaces.thy *)
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2823
  "(f \<longlongrightarrow> l) sequentially \<Longrightarrow> ((\<lambda>i. f(i - k)) \<longlongrightarrow> l) sequentially"
53597
ea99a7964174 remove duplicate lemmas
huffman
parents: 53374
diff changeset
  2824
  apply (erule filterlim_compose)
ea99a7964174 remove duplicate lemmas
huffman
parents: 53374
diff changeset
  2825
  apply (simp add: filterlim_def le_sequentially eventually_filtermap eventually_sequentially)
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2826
  apply arith
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2827
  done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2828
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2829
lemma seq_harmonic: "((\<lambda>n. inverse (real n)) \<longlongrightarrow> 0) sequentially"
53597
ea99a7964174 remove duplicate lemmas
huffman
parents: 53374
diff changeset
  2830
  using LIMSEQ_inverse_real_of_nat by (rule LIMSEQ_imp_Suc) (* TODO: move to Limits.thy *)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2831
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2832
subsection \<open>More properties of closed balls\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2833
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61076
diff changeset
  2834
lemma closed_cball [iff]: "closed (cball x e)"
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  2835
proof -
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  2836
  have "closed (dist x -` {..e})"
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56290
diff changeset
  2837
    by (intro closed_vimage closed_atMost continuous_intros)
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  2838
  also have "dist x -` {..e} = cball x e"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  2839
    by auto
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  2840
  finally show ?thesis .
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  2841
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2842
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2843
lemma open_contains_cball: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e>0.  cball x e \<subseteq> S)"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2844
proof -
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2845
  {
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2846
    fix x and e::real
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2847
    assume "x\<in>S" "e>0" "ball x e \<subseteq> S"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2848
    then have "\<exists>d>0. cball x d \<subseteq> S" unfolding subset_eq by (rule_tac x="e/2" in exI, auto)
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2849
  }
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2850
  moreover
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2851
  {
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2852
    fix x and e::real
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2853
    assume "x\<in>S" "e>0" "cball x e \<subseteq> S"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2854
    then have "\<exists>d>0. ball x d \<subseteq> S"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2855
      unfolding subset_eq
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2856
      apply(rule_tac x="e/2" in exI)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2857
      apply auto
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2858
      done
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2859
  }
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2860
  ultimately show ?thesis
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  2861
    unfolding open_contains_ball by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2862
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2863
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  2864
lemma open_contains_cball_eq: "open S \<Longrightarrow> (\<forall>x. x \<in> S \<longleftrightarrow> (\<exists>e>0. cball x e \<subseteq> S))"
44170
510ac30f44c0 make Multivariate_Analysis work with separate set type
huffman
parents: 44167
diff changeset
  2865
  by (metis open_contains_cball subset_eq order_less_imp_le centre_in_cball)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2866
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2867
lemma mem_interior_cball: "x \<in> interior S \<longleftrightarrow> (\<exists>e>0. cball x e \<subseteq> S)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2868
  apply (simp add: interior_def, safe)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2869
  apply (force simp add: open_contains_cball)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2870
  apply (rule_tac x="ball x e" in exI)
36362
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36360
diff changeset
  2871
  apply (simp add: subset_trans [OF ball_subset_cball])
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2872
  done
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2873
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2874
lemma islimpt_ball:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2875
  fixes x y :: "'a::{real_normed_vector,perfect_space}"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  2876
  shows "y islimpt ball x e \<longleftrightarrow> 0 < e \<and> y \<in> cball x e"
60462
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2877
  (is "?lhs \<longleftrightarrow> ?rhs")
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2878
proof
60462
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2879
  show ?rhs if ?lhs
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2880
  proof
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2881
    {
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2882
      assume "e \<le> 0"
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2883
      then have *: "ball x e = {}"
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2884
        using ball_eq_empty[of x e] by auto
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2885
      have False using \<open>?lhs\<close>
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2886
        unfolding * using islimpt_EMPTY[of y] by auto
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2887
    }
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2888
    then show "e > 0" by (metis not_less)
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2889
    show "y \<in> cball x e"
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2890
      using closed_cball[of x e] islimpt_subset[of y "ball x e" "cball x e"]
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2891
        ball_subset_cball[of x e] \<open>?lhs\<close>
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2892
      unfolding closed_limpt by auto
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2893
  qed
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2894
  show ?lhs if ?rhs
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2895
  proof -
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2896
    from that have "e > 0" by auto
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2897
    {
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2898
      fix d :: real
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2899
      assume "d > 0"
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2900
      have "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d"
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2901
      proof (cases "d \<le> dist x y")
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2902
        case True
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2903
        then show "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d"
60462
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2904
        proof (cases "x = y")
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2905
          case True
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2906
          then have False
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2907
            using \<open>d \<le> dist x y\<close> \<open>d>0\<close> by auto
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2908
          then show "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d"
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2909
            by auto
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2910
        next
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2911
          case False
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2912
          have "dist x (y - (d / (2 * dist y x)) *\<^sub>R (y - x)) =
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2913
            norm (x - y + (d / (2 * norm (y - x))) *\<^sub>R (y - x))"
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2914
            unfolding mem_cball mem_ball dist_norm diff_diff_eq2 diff_add_eq[symmetric]
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2915
            by auto
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2916
          also have "\<dots> = \<bar>- 1 + d / (2 * norm (x - y))\<bar> * norm (x - y)"
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2917
            using scaleR_left_distrib[of "- 1" "d / (2 * norm (y - x))", symmetric, of "y - x"]
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2918
            unfolding scaleR_minus_left scaleR_one
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2919
            by (auto simp add: norm_minus_commute)
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2920
          also have "\<dots> = \<bar>- norm (x - y) + d / 2\<bar>"
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2921
            unfolding abs_mult_pos[of "norm (x - y)", OF norm_ge_zero[of "x - y"]]
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2922
            unfolding distrib_right using \<open>x\<noteq>y\<close>[unfolded dist_nz, unfolded dist_norm]
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2923
            by auto
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2924
          also have "\<dots> \<le> e - d/2" using \<open>d \<le> dist x y\<close> and \<open>d>0\<close> and \<open>?rhs\<close>
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2925
            by (auto simp add: dist_norm)
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2926
          finally have "y - (d / (2 * dist y x)) *\<^sub>R (y - x) \<in> ball x e" using \<open>d>0\<close>
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2927
            by auto
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2928
          moreover
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2929
          have "(d / (2*dist y x)) *\<^sub>R (y - x) \<noteq> 0"
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2930
            using \<open>x\<noteq>y\<close>[unfolded dist_nz] \<open>d>0\<close> unfolding scaleR_eq_0_iff
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2931
            by (auto simp add: dist_commute)
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2932
          moreover
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2933
          have "dist (y - (d / (2 * dist y x)) *\<^sub>R (y - x)) y < d"
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2934
            unfolding dist_norm
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2935
            apply simp
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2936
            unfolding norm_minus_cancel
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2937
            using \<open>d > 0\<close> \<open>x\<noteq>y\<close>[unfolded dist_nz] dist_commute[of x y]
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2938
            unfolding dist_norm
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2939
            apply auto
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2940
            done
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2941
          ultimately show "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d"
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2942
            apply (rule_tac x = "y - (d / (2*dist y x)) *\<^sub>R (y - x)" in bexI)
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2943
            apply auto
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2944
            done
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2945
        qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2946
      next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2947
        case False
60462
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2948
        then have "d > dist x y" by auto
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2949
        show "\<exists>x' \<in> ball x e. x' \<noteq> y \<and> dist x' y < d"
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2950
        proof (cases "x = y")
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2951
          case True
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2952
          obtain z where **: "z \<noteq> y" "dist z y < min e d"
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2953
            using perfect_choose_dist[of "min e d" y]
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2954
            using \<open>d > 0\<close> \<open>e>0\<close> by auto
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2955
          show "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d"
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2956
            unfolding \<open>x = y\<close>
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2957
            using \<open>z \<noteq> y\<close> **
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2958
            apply (rule_tac x=z in bexI)
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2959
            apply (auto simp add: dist_commute)
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2960
            done
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2961
        next
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2962
          case False
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2963
          then show "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d"
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2964
            using \<open>d>0\<close> \<open>d > dist x y\<close> \<open>?rhs\<close>
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2965
            apply (rule_tac x=x in bexI)
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2966
            apply auto
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2967
            done
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2968
        qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2969
      qed
60462
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2970
    }
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2971
    then show ?thesis
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2972
      unfolding mem_cball islimpt_approachable mem_ball by auto
7c5e22e6b89f tuned proofs;
wenzelm
parents: 60420
diff changeset
  2973
  qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2974
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2975
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2976
lemma closure_ball_lemma:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2977
  fixes x y :: "'a::real_normed_vector"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2978
  assumes "x \<noteq> y"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2979
  shows "y islimpt ball x (dist x y)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2980
proof (rule islimptI)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2981
  fix T
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2982
  assume "y \<in> T" "open T"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2983
  then obtain r where "0 < r" "\<forall>z. dist z y < r \<longrightarrow> z \<in> T"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2984
    unfolding open_dist by fast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2985
  (* choose point between x and y, within distance r of y. *)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2986
  def k \<equiv> "min 1 (r / (2 * dist x y))"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2987
  def z \<equiv> "y + scaleR k (x - y)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2988
  have z_def2: "z = x + scaleR (1 - k) (y - x)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2989
    unfolding z_def by (simp add: algebra_simps)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2990
  have "dist z y < r"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2991
    unfolding z_def k_def using \<open>0 < r\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2992
    by (simp add: dist_norm min_def)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  2993
  then have "z \<in> T"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  2994
    using \<open>\<forall>z. dist z y < r \<longrightarrow> z \<in> T\<close> by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2995
  have "dist x z < dist x y"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2996
    unfolding z_def2 dist_norm
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2997
    apply (simp add: norm_minus_commute)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2998
    apply (simp only: dist_norm [symmetric])
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  2999
    apply (subgoal_tac "\<bar>1 - k\<bar> * dist x y < 1 * dist x y", simp)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3000
    apply (rule mult_strict_right_mono)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3001
    apply (simp add: k_def zero_less_dist_iff \<open>0 < r\<close> \<open>x \<noteq> y\<close>)
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3002
    apply (simp add: zero_less_dist_iff \<open>x \<noteq> y\<close>)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3003
    done
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3004
  then have "z \<in> ball x (dist x y)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3005
    by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3006
  have "z \<noteq> y"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3007
    unfolding z_def k_def using \<open>x \<noteq> y\<close> \<open>0 < r\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3008
    by (simp add: min_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3009
  show "\<exists>z\<in>ball x (dist x y). z \<in> T \<and> z \<noteq> y"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3010
    using \<open>z \<in> ball x (dist x y)\<close> \<open>z \<in> T\<close> \<open>z \<noteq> y\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3011
    by fast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3012
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3013
61806
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  3014
lemma closure_ball [simp]:
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3015
  fixes x :: "'a::real_normed_vector"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3016
  shows "0 < e \<Longrightarrow> closure (ball x e) = cball x e"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3017
  apply (rule equalityI)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3018
  apply (rule closure_minimal)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3019
  apply (rule ball_subset_cball)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3020
  apply (rule closed_cball)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3021
  apply (rule subsetI, rename_tac y)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3022
  apply (simp add: le_less [where 'a=real])
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3023
  apply (erule disjE)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3024
  apply (rule subsetD [OF closure_subset], simp)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3025
  apply (simp add: closure_def)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3026
  apply clarify
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3027
  apply (rule closure_ball_lemma)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3028
  apply (simp add: zero_less_dist_iff)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3029
  done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3030
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3031
(* In a trivial vector space, this fails for e = 0. *)
61806
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  3032
lemma interior_cball [simp]:
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3033
  fixes x :: "'a::{real_normed_vector, perfect_space}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3034
  shows "interior (cball x e) = ball x e"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3035
proof (cases "e \<ge> 0")
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3036
  case False note cs = this
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3037
  from cs have "ball x e = {}"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3038
    using ball_empty[of e x] by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3039
  moreover
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3040
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3041
    fix y
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3042
    assume "y \<in> cball x e"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3043
    then have False
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3044
      unfolding mem_cball using dist_nz[of x y] cs by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3045
  }
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3046
  then have "cball x e = {}" by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3047
  then have "interior (cball x e) = {}"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3048
    using interior_empty by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3049
  ultimately show ?thesis by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3050
next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3051
  case True note cs = this
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3052
  have "ball x e \<subseteq> cball x e"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3053
    using ball_subset_cball by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3054
  moreover
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3055
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3056
    fix S y
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3057
    assume as: "S \<subseteq> cball x e" "open S" "y\<in>S"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3058
    then obtain d where "d>0" and d: "\<forall>x'. dist x' y < d \<longrightarrow> x' \<in> S"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3059
      unfolding open_dist by blast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3060
    then obtain xa where xa_y: "xa \<noteq> y" and xa: "dist xa y < d"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3061
      using perfect_choose_dist [of d] by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3062
    have "xa \<in> S"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3063
      using d[THEN spec[where x = xa]]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3064
      using xa by (auto simp add: dist_commute)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3065
    then have xa_cball: "xa \<in> cball x e"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3066
      using as(1) by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3067
    then have "y \<in> ball x e"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3068
    proof (cases "x = y")
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3069
      case True
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3070
      then have "e > 0"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3071
        using xa_y[unfolded dist_nz] xa_cball[unfolded mem_cball]
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3072
        by (auto simp add: dist_commute)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3073
      then show "y \<in> ball x e"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3074
        using \<open>x = y \<close> by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3075
    next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3076
      case False
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3077
      have "dist (y + (d / 2 / dist y x) *\<^sub>R (y - x)) y < d"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3078
        unfolding dist_norm
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3079
        using \<open>d>0\<close> norm_ge_zero[of "y - x"] \<open>x \<noteq> y\<close> by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3080
      then have *: "y + (d / 2 / dist y x) *\<^sub>R (y - x) \<in> cball x e"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3081
        using d as(1)[unfolded subset_eq] by blast
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3082
      have "y - x \<noteq> 0" using \<open>x \<noteq> y\<close> by auto
56541
0e3abadbef39 made divide_pos_pos a simp rule
nipkow
parents: 56371
diff changeset
  3083
      hence **:"d / (2 * norm (y - x)) > 0"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3084
        unfolding zero_less_norm_iff[symmetric] using \<open>d>0\<close> by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3085
      have "dist (y + (d / 2 / dist y x) *\<^sub>R (y - x)) x =
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3086
        norm (y + (d / (2 * norm (y - x))) *\<^sub>R y - (d / (2 * norm (y - x))) *\<^sub>R x - x)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3087
        by (auto simp add: dist_norm algebra_simps)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3088
      also have "\<dots> = norm ((1 + d / (2 * norm (y - x))) *\<^sub>R (y - x))"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3089
        by (auto simp add: algebra_simps)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3090
      also have "\<dots> = \<bar>1 + d / (2 * norm (y - x))\<bar> * norm (y - x)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3091
        using ** by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3092
      also have "\<dots> = (dist y x) + d/2"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3093
        using ** by (auto simp add: distrib_right dist_norm)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3094
      finally have "e \<ge> dist x y +d/2"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3095
        using *[unfolded mem_cball] by (auto simp add: dist_commute)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3096
      then show "y \<in> ball x e"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3097
        unfolding mem_ball using \<open>d>0\<close> by auto
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3098
    qed
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3099
  }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3100
  then have "\<forall>S \<subseteq> cball x e. open S \<longrightarrow> S \<subseteq> ball x e"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3101
    by auto
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3102
  ultimately show ?thesis
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3103
    using interior_unique[of "ball x e" "cball x e"]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3104
    using open_ball[of x e]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3105
    by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3106
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3107
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3108
lemma frontier_ball:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3109
  fixes a :: "'a::real_normed_vector"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  3110
  shows "0 < e \<Longrightarrow> frontier(ball a e) = {x. dist a x = e}"
36362
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36360
diff changeset
  3111
  apply (simp add: frontier_def closure_ball interior_open order_less_imp_le)
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39198
diff changeset
  3112
  apply (simp add: set_eq_iff)
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3113
  apply arith
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3114
  done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3115
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3116
lemma frontier_cball:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3117
  fixes a :: "'a::{real_normed_vector, perfect_space}"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3118
  shows "frontier (cball a e) = {x. dist a x = e}"
36362
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36360
diff changeset
  3119
  apply (simp add: frontier_def interior_cball closed_cball order_less_imp_le)
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39198
diff changeset
  3120
  apply (simp add: set_eq_iff)
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3121
  apply arith
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3122
  done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3123
61806
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  3124
lemma cball_eq_empty [simp]: "cball x e = {} \<longleftrightarrow> e < 0"
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39198
diff changeset
  3125
  apply (simp add: set_eq_iff not_le)
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3126
  apply (metis zero_le_dist dist_self order_less_le_trans)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3127
  done
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3128
61806
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  3129
lemma cball_empty [simp]: "e < 0 \<Longrightarrow> cball x e = {}"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3130
  by (simp add: cball_eq_empty)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3131
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3132
lemma cball_eq_sing:
44072
5b970711fb39 class perfect_space inherits from topological_space;
huffman
parents: 43338
diff changeset
  3133
  fixes x :: "'a::{metric_space,perfect_space}"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3134
  shows "cball x e = {x} \<longleftrightarrow> e = 0"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3135
proof (rule linorder_cases)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3136
  assume e: "0 < e"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3137
  obtain a where "a \<noteq> x" "dist a x < e"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3138
    using perfect_choose_dist [OF e] by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3139
  then have "a \<noteq> x" "dist x a \<le> e"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3140
    by (auto simp add: dist_commute)
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39198
diff changeset
  3141
  with e show ?thesis by (auto simp add: set_eq_iff)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3142
qed auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3143
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3144
lemma cball_sing:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3145
  fixes x :: "'a::metric_space"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  3146
  shows "e = 0 \<Longrightarrow> cball x e = {x}"
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39198
diff changeset
  3147
  by (auto simp add: set_eq_iff)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3148
61806
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  3149
lemma ball_divide_subset: "d \<ge> 1 \<Longrightarrow> ball x (e/d) \<subseteq> ball x e"
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  3150
  apply (cases "e \<le> 0")
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  3151
  apply (simp add: ball_empty divide_simps)
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  3152
  apply (rule subset_ball)
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  3153
  apply (simp add: divide_simps)
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  3154
  done
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  3155
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  3156
lemma ball_divide_subset_numeral: "ball x (e / numeral w) \<subseteq> ball x e"
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  3157
  using ball_divide_subset one_le_numeral by blast
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  3158
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  3159
lemma cball_divide_subset: "d \<ge> 1 \<Longrightarrow> cball x (e/d) \<subseteq> cball x e"
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  3160
  apply (cases "e < 0")
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  3161
  apply (simp add: divide_simps)
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  3162
  apply (rule subset_cball)
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  3163
  apply (metis divide_1 frac_le not_le order_refl zero_less_one)
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  3164
  done
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  3165
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  3166
lemma cball_divide_subset_numeral: "cball x (e / numeral w) \<subseteq> cball x e"
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  3167
  using cball_divide_subset one_le_numeral by blast
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  3168
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  3169
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3170
subsection \<open>Boundedness\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3171
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3172
  (* FIXME: This has to be unified with BSEQ!! *)
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3173
definition (in metric_space) bounded :: "'a set \<Rightarrow> bool"
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3174
  where "bounded S \<longleftrightarrow> (\<exists>x e. \<forall>y\<in>S. dist x y \<le> e)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3175
61426
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
  3176
lemma bounded_subset_cball: "bounded S \<longleftrightarrow> (\<exists>e x. S \<subseteq> cball x e \<and> 0 \<le> e)"
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
  3177
  unfolding bounded_def subset_eq  by auto (meson order_trans zero_le_dist)
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
  3178
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
  3179
lemma bounded_subset_ballD:
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
  3180
  assumes "bounded S" shows "\<exists>r. 0 < r \<and> S \<subseteq> ball x r"
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
  3181
proof -
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
  3182
  obtain e::real and y where "S \<subseteq> cball y e"  "0 \<le> e"
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
  3183
    using assms by (auto simp: bounded_subset_cball)
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
  3184
  then show ?thesis
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
  3185
    apply (rule_tac x="dist x y + e + 1" in exI)
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
  3186
    apply (simp add: add.commute add_pos_nonneg)
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
  3187
    apply (erule subset_trans)
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
  3188
    apply (clarsimp simp add: cball_def)
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
  3189
    by (metis add_le_cancel_right add_strict_increasing dist_commute dist_triangle_le zero_less_one)
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
  3190
qed
50998
501200635659 simplify heine_borel type class
hoelzl
parents: 50973
diff changeset
  3191
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3192
lemma bounded_any_center: "bounded S \<longleftrightarrow> (\<exists>e. \<forall>y\<in>S. dist a y \<le> e)"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3193
  unfolding bounded_def
57512
cc97b347b301 reduced name variants for assoc and commute on plus and mult
haftmann
parents: 57448
diff changeset
  3194
  by auto (metis add.commute add_le_cancel_right dist_commute dist_triangle_le)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3195
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3196
lemma bounded_iff: "bounded S \<longleftrightarrow> (\<exists>a. \<forall>x\<in>S. norm x \<le> a)"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3197
  unfolding bounded_any_center [where a=0]
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3198
  by (simp add: dist_norm)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3199
61552
980dd46a03fb Added binomial identities to CONTRIBUTORS; small lemmas on of_int/pochhammer
eberlm
parents: 61531
diff changeset
  3200
lemma bdd_above_norm: "bdd_above (norm ` X) \<longleftrightarrow> bounded X"
980dd46a03fb Added binomial identities to CONTRIBUTORS; small lemmas on of_int/pochhammer
eberlm
parents: 61531
diff changeset
  3201
  by (simp add: bounded_iff bdd_above_def)
980dd46a03fb Added binomial identities to CONTRIBUTORS; small lemmas on of_int/pochhammer
eberlm
parents: 61531
diff changeset
  3202
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3203
lemma bounded_realI:
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61942
diff changeset
  3204
  assumes "\<forall>x\<in>s. \<bar>x::real\<bar> \<le> B"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3205
  shows "bounded s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3206
  unfolding bounded_def dist_real_def
55775
1557a391a858 A bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 55522
diff changeset
  3207
  by (metis abs_minus_commute assms diff_0_right)
50104
de19856feb54 move theorems to be more generally useable
hoelzl
parents: 50094
diff changeset
  3208
50948
8c742f9de9f5 generalize topology lemmas; simplify proofs
huffman
parents: 50944
diff changeset
  3209
lemma bounded_empty [simp]: "bounded {}"
8c742f9de9f5 generalize topology lemmas; simplify proofs
huffman
parents: 50944
diff changeset
  3210
  by (simp add: bounded_def)
8c742f9de9f5 generalize topology lemmas; simplify proofs
huffman
parents: 50944
diff changeset
  3211
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  3212
lemma bounded_subset: "bounded T \<Longrightarrow> S \<subseteq> T \<Longrightarrow> bounded S"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3213
  by (metis bounded_def subset_eq)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3214
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  3215
lemma bounded_interior[intro]: "bounded S \<Longrightarrow> bounded(interior S)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3216
  by (metis bounded_subset interior_subset)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3217
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3218
lemma bounded_closure[intro]:
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3219
  assumes "bounded S"
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3220
  shows "bounded (closure S)"
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3221
proof -
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3222
  from assms obtain x and a where a: "\<forall>y\<in>S. dist x y \<le> a"
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3223
    unfolding bounded_def by auto
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3224
  {
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3225
    fix y
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3226
    assume "y \<in> closure S"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  3227
    then obtain f where f: "\<forall>n. f n \<in> S"  "(f \<longlongrightarrow> y) sequentially"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3228
      unfolding closure_sequential by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3229
    have "\<forall>n. f n \<in> S \<longrightarrow> dist x (f n) \<le> a" using a by simp
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3230
    then have "eventually (\<lambda>n. dist x (f n) \<le> a) sequentially"
61810
3c5040d5694a sorted out eventually_mono
paulson <lp15@cam.ac.uk>
parents: 61808
diff changeset
  3231
      by (simp add: f(1))
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3232
    have "dist x y \<le> a"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3233
      apply (rule Lim_dist_ubound [of sequentially f])
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3234
      apply (rule trivial_limit_sequentially)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3235
      apply (rule f(2))
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3236
      apply fact
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3237
      done
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3238
  }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3239
  then show ?thesis
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3240
    unfolding bounded_def by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3241
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3242
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3243
lemma bounded_cball[simp,intro]: "bounded (cball x e)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3244
  apply (simp add: bounded_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3245
  apply (rule_tac x=x in exI)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3246
  apply (rule_tac x=e in exI)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3247
  apply auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3248
  done
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3249
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3250
lemma bounded_ball[simp,intro]: "bounded (ball x e)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3251
  by (metis ball_subset_cball bounded_cball bounded_subset)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3252
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3253
lemma bounded_Un[simp]: "bounded (S \<union> T) \<longleftrightarrow> bounded S \<and> bounded T"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3254
  apply (auto simp add: bounded_def)
55775
1557a391a858 A bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 55522
diff changeset
  3255
  by (metis Un_iff add_le_cancel_left dist_triangle le_max_iff_disj max.order_iff)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3256
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3257
lemma bounded_Union[intro]: "finite F \<Longrightarrow> \<forall>S\<in>F. bounded S \<Longrightarrow> bounded (\<Union>F)"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3258
  by (induct rule: finite_induct[of F]) auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3259
50955
ada575c605e1 simplify proof of compact_imp_bounded
huffman
parents: 50949
diff changeset
  3260
lemma bounded_UN [intro]: "finite A \<Longrightarrow> \<forall>x\<in>A. bounded (B x) \<Longrightarrow> bounded (\<Union>x\<in>A. B x)"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3261
  by (induct set: finite) auto
50955
ada575c605e1 simplify proof of compact_imp_bounded
huffman
parents: 50949
diff changeset
  3262
50948
8c742f9de9f5 generalize topology lemmas; simplify proofs
huffman
parents: 50944
diff changeset
  3263
lemma bounded_insert [simp]: "bounded (insert x S) \<longleftrightarrow> bounded S"
8c742f9de9f5 generalize topology lemmas; simplify proofs
huffman
parents: 50944
diff changeset
  3264
proof -
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3265
  have "\<forall>y\<in>{x}. dist x y \<le> 0"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3266
    by simp
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3267
  then have "bounded {x}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3268
    unfolding bounded_def by fast
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3269
  then show ?thesis
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3270
    by (metis insert_is_Un bounded_Un)
50948
8c742f9de9f5 generalize topology lemmas; simplify proofs
huffman
parents: 50944
diff changeset
  3271
qed
8c742f9de9f5 generalize topology lemmas; simplify proofs
huffman
parents: 50944
diff changeset
  3272
8c742f9de9f5 generalize topology lemmas; simplify proofs
huffman
parents: 50944
diff changeset
  3273
lemma finite_imp_bounded [intro]: "finite S \<Longrightarrow> bounded S"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3274
  by (induct set: finite) simp_all
50948
8c742f9de9f5 generalize topology lemmas; simplify proofs
huffman
parents: 50944
diff changeset
  3275
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3276
lemma bounded_pos: "bounded S \<longleftrightarrow> (\<exists>b>0. \<forall>x\<in> S. norm x \<le> b)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3277
  apply (simp add: bounded_iff)
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61942
diff changeset
  3278
  apply (subgoal_tac "\<And>x (y::real). 0 < 1 + \<bar>y\<bar> \<and> (x \<le> y \<longrightarrow> x \<le> 1 + \<bar>y\<bar>)")
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3279
  apply metis
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3280
  apply arith
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3281
  done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3282
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60615
diff changeset
  3283
lemma bounded_pos_less: "bounded S \<longleftrightarrow> (\<exists>b>0. \<forall>x\<in> S. norm x < b)"
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60615
diff changeset
  3284
  apply (simp add: bounded_pos)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60615
diff changeset
  3285
  apply (safe; rule_tac x="b+1" in exI; force)
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60615
diff changeset
  3286
  done
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60615
diff changeset
  3287
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3288
lemma Bseq_eq_bounded:
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3289
  fixes f :: "nat \<Rightarrow> 'a::real_normed_vector"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3290
  shows "Bseq f \<longleftrightarrow> bounded (range f)"
50972
d2c6a0a7fcdf tuned proof
hoelzl
parents: 50971
diff changeset
  3291
  unfolding Bseq_def bounded_pos by auto
d2c6a0a7fcdf tuned proof
hoelzl
parents: 50971
diff changeset
  3292
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3293
lemma bounded_Int[intro]: "bounded S \<or> bounded T \<Longrightarrow> bounded (S \<inter> T)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3294
  by (metis Int_lower1 Int_lower2 bounded_subset)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3295
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  3296
lemma bounded_diff[intro]: "bounded S \<Longrightarrow> bounded (S - T)"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3297
  by (metis Diff_subset bounded_subset)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3298
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3299
lemma not_bounded_UNIV[simp, intro]:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3300
  "\<not> bounded (UNIV :: 'a::{real_normed_vector, perfect_space} set)"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3301
proof (auto simp add: bounded_pos not_le)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3302
  obtain x :: 'a where "x \<noteq> 0"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3303
    using perfect_choose_dist [OF zero_less_one] by fast
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3304
  fix b :: real
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3305
  assume b: "b >0"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3306
  have b1: "b +1 \<ge> 0"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3307
    using b by simp
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3308
  with \<open>x \<noteq> 0\<close> have "b < norm (scaleR (b + 1) (sgn x))"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3309
    by (simp add: norm_sgn)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3310
  then show "\<exists>x::'a. b < norm x" ..
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3311
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3312
61426
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
  3313
corollary cobounded_imp_unbounded:
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
  3314
    fixes S :: "'a::{real_normed_vector, perfect_space} set"
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
  3315
    shows "bounded (- S) \<Longrightarrow> ~ (bounded S)"
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
  3316
  using bounded_Un [of S "-S"]  by (simp add: sup_compl_top)
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61424
diff changeset
  3317
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3318
lemma bounded_linear_image:
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  3319
  assumes "bounded S"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  3320
    and "bounded_linear f"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  3321
  shows "bounded (f ` S)"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3322
proof -
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3323
  from assms(1) obtain b where b: "b > 0" "\<forall>x\<in>S. norm x \<le> b"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3324
    unfolding bounded_pos by auto
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3325
  from assms(2) obtain B where B: "B > 0" "\<forall>x. norm (f x) \<le> B * norm x"
57514
bdc2c6b40bf2 prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents: 57512
diff changeset
  3326
    using bounded_linear.pos_bounded by (auto simp add: ac_simps)
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3327
  {
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3328
    fix x
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3329
    assume "x \<in> S"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3330
    then have "norm x \<le> b"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3331
      using b by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3332
    then have "norm (f x) \<le> B * b"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3333
      using B(2)
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3334
      apply (erule_tac x=x in allE)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3335
      apply (metis B(1) B(2) order_trans mult_le_cancel_left_pos)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3336
      done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3337
  }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3338
  then show ?thesis
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3339
    unfolding bounded_pos
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3340
    apply (rule_tac x="b*B" in exI)
57512
cc97b347b301 reduced name variants for assoc and commute on plus and mult
haftmann
parents: 57448
diff changeset
  3341
    using b B by (auto simp add: mult.commute)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3342
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3343
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3344
lemma bounded_scaling:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3345
  fixes S :: "'a::real_normed_vector set"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3346
  shows "bounded S \<Longrightarrow> bounded ((\<lambda>x. c *\<^sub>R x) ` S)"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  3347
  apply (rule bounded_linear_image)
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  3348
  apply assumption
44282
f0de18b62d63 remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents: 44252
diff changeset
  3349
  apply (rule bounded_linear_scaleR_right)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3350
  done
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3351
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3352
lemma bounded_translation:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3353
  fixes S :: "'a::real_normed_vector set"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3354
  assumes "bounded S"
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3355
  shows "bounded ((\<lambda>x. a + x) ` S)"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3356
proof -
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3357
  from assms obtain b where b: "b > 0" "\<forall>x\<in>S. norm x \<le> b"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3358
    unfolding bounded_pos by auto
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3359
  {
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3360
    fix x
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3361
    assume "x \<in> S"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3362
    then have "norm (a + x) \<le> b + norm a"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3363
      using norm_triangle_ineq[of a x] b by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3364
  }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3365
  then show ?thesis
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3366
    unfolding bounded_pos
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3367
    using norm_ge_zero[of a] b(1) and add_strict_increasing[of b 0 "norm a"]
48048
87b94fb75198 remove stray reference to no-longer-existing theorem 'add'
huffman
parents: 47108
diff changeset
  3368
    by (auto intro!: exI[of _ "b + norm a"])
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3369
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3370
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3371
lemma bounded_uminus [simp]:
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3372
  fixes X :: "'a::euclidean_space set"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3373
  shows "bounded (uminus ` X) \<longleftrightarrow> bounded X"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3374
by (auto simp: bounded_def dist_norm; rule_tac x="-x" in exI; force simp add: add.commute norm_minus_commute)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3375
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3376
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3377
text\<open>Some theorems on sups and infs using the notion "bounded".\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3378
54258
adfc759263ab use bdd_above and bdd_below for conditionally complete lattices
hoelzl
parents: 54230
diff changeset
  3379
lemma bounded_real: "bounded (S::real set) \<longleftrightarrow> (\<exists>a. \<forall>x\<in>S. \<bar>x\<bar> \<le> a)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3380
  by (simp add: bounded_iff)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3381
54258
adfc759263ab use bdd_above and bdd_below for conditionally complete lattices
hoelzl
parents: 54230
diff changeset
  3382
lemma bounded_imp_bdd_above: "bounded S \<Longrightarrow> bdd_above (S :: real set)"
adfc759263ab use bdd_above and bdd_below for conditionally complete lattices
hoelzl
parents: 54230
diff changeset
  3383
  by (auto simp: bounded_def bdd_above_def dist_real_def)
adfc759263ab use bdd_above and bdd_below for conditionally complete lattices
hoelzl
parents: 54230
diff changeset
  3384
     (metis abs_le_D1 abs_minus_commute diff_le_eq)
adfc759263ab use bdd_above and bdd_below for conditionally complete lattices
hoelzl
parents: 54230
diff changeset
  3385
adfc759263ab use bdd_above and bdd_below for conditionally complete lattices
hoelzl
parents: 54230
diff changeset
  3386
lemma bounded_imp_bdd_below: "bounded S \<Longrightarrow> bdd_below (S :: real set)"
adfc759263ab use bdd_above and bdd_below for conditionally complete lattices
hoelzl
parents: 54230
diff changeset
  3387
  by (auto simp: bounded_def bdd_below_def dist_real_def)
57512
cc97b347b301 reduced name variants for assoc and commute on plus and mult
haftmann
parents: 57448
diff changeset
  3388
     (metis abs_le_D1 add.commute diff_le_eq)
54258
adfc759263ab use bdd_above and bdd_below for conditionally complete lattices
hoelzl
parents: 54230
diff changeset
  3389
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3390
lemma bounded_inner_imp_bdd_above:
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  3391
  assumes "bounded s"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3392
    shows "bdd_above ((\<lambda>x. x \<bullet> a) ` s)"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3393
by (simp add: assms bounded_imp_bdd_above bounded_linear_image bounded_linear_inner_left)
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3394
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3395
lemma bounded_inner_imp_bdd_below:
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  3396
  assumes "bounded s"
60615
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3397
    shows "bdd_below ((\<lambda>x. x \<bullet> a) ` s)"
e5fa1d5d3952 Useful lemmas. The theorem concerning swapping the variables in a double integral.
paulson <lp15@cam.ac.uk>
parents: 60585
diff changeset
  3398
by (simp add: assms bounded_imp_bdd_below bounded_linear_image bounded_linear_inner_left)
54258
adfc759263ab use bdd_above and bdd_below for conditionally complete lattices
hoelzl
parents: 54230
diff changeset
  3399
33270
paulson
parents: 33175
diff changeset
  3400
lemma bounded_has_Sup:
paulson
parents: 33175
diff changeset
  3401
  fixes S :: "real set"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3402
  assumes "bounded S"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3403
    and "S \<noteq> {}"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3404
  shows "\<forall>x\<in>S. x \<le> Sup S"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3405
    and "\<forall>b. (\<forall>x\<in>S. x \<le> b) \<longrightarrow> Sup S \<le> b"
33270
paulson
parents: 33175
diff changeset
  3406
proof
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3407
  show "\<forall>b. (\<forall>x\<in>S. x \<le> b) \<longrightarrow> Sup S \<le> b"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3408
    using assms by (metis cSup_least)
54258
adfc759263ab use bdd_above and bdd_below for conditionally complete lattices
hoelzl
parents: 54230
diff changeset
  3409
qed (metis cSup_upper assms(1) bounded_imp_bdd_above)
33270
paulson
parents: 33175
diff changeset
  3410
paulson
parents: 33175
diff changeset
  3411
lemma Sup_insert:
paulson
parents: 33175
diff changeset
  3412
  fixes S :: "real set"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  3413
  shows "bounded S \<Longrightarrow> Sup (insert x S) = (if S = {} then x else max x (Sup S))"
54258
adfc759263ab use bdd_above and bdd_below for conditionally complete lattices
hoelzl
parents: 54230
diff changeset
  3414
  by (auto simp: bounded_imp_bdd_above sup_max cSup_insert_If)
33270
paulson
parents: 33175
diff changeset
  3415
paulson
parents: 33175
diff changeset
  3416
lemma Sup_insert_finite:
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  3417
  fixes S :: "'a::conditionally_complete_linorder set"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  3418
  shows "finite S \<Longrightarrow> Sup (insert x S) = (if S = {} then x else max x (Sup S))"
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  3419
by (simp add: cSup_insert sup_max)
33270
paulson
parents: 33175
diff changeset
  3420
paulson
parents: 33175
diff changeset
  3421
lemma bounded_has_Inf:
paulson
parents: 33175
diff changeset
  3422
  fixes S :: "real set"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3423
  assumes "bounded S"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3424
    and "S \<noteq> {}"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3425
  shows "\<forall>x\<in>S. x \<ge> Inf S"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3426
    and "\<forall>b. (\<forall>x\<in>S. x \<ge> b) \<longrightarrow> Inf S \<ge> b"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3427
proof
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3428
  show "\<forall>b. (\<forall>x\<in>S. x \<ge> b) \<longrightarrow> Inf S \<ge> b"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3429
    using assms by (metis cInf_greatest)
54258
adfc759263ab use bdd_above and bdd_below for conditionally complete lattices
hoelzl
parents: 54230
diff changeset
  3430
qed (metis cInf_lower assms(1) bounded_imp_bdd_below)
33270
paulson
parents: 33175
diff changeset
  3431
paulson
parents: 33175
diff changeset
  3432
lemma Inf_insert:
paulson
parents: 33175
diff changeset
  3433
  fixes S :: "real set"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  3434
  shows "bounded S \<Longrightarrow> Inf (insert x S) = (if S = {} then x else min x (Inf S))"
54259
71c701dc5bf9 add SUP and INF for conditionally complete lattices
hoelzl
parents: 54258
diff changeset
  3435
  by (auto simp: bounded_imp_bdd_below inf_min cInf_insert_If)
50944
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  3436
33270
paulson
parents: 33175
diff changeset
  3437
lemma Inf_insert_finite:
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  3438
  fixes S :: "'a::conditionally_complete_linorder set"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  3439
  shows "finite S \<Longrightarrow> Inf (insert x S) = (if S = {} then x else min x (Inf S))"
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  3440
by (simp add: cInf_eq_Min)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  3441
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  3442
lemma finite_imp_less_Inf:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  3443
  fixes a :: "'a::conditionally_complete_linorder"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  3444
  shows "\<lbrakk>finite X; x \<in> X; \<And>x. x\<in>X \<Longrightarrow> a < x\<rbrakk> \<Longrightarrow> a < Inf X"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  3445
  by (induction X rule: finite_induct) (simp_all add: cInf_eq_Min Inf_insert_finite)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  3446
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  3447
lemma finite_less_Inf_iff:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  3448
  fixes a :: "'a :: conditionally_complete_linorder"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  3449
  shows "\<lbrakk>finite X; X \<noteq> {}\<rbrakk> \<Longrightarrow> a < Inf X \<longleftrightarrow> (\<forall>x \<in> X. a < x)"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  3450
  by (auto simp: cInf_eq_Min)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  3451
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  3452
lemma finite_imp_Sup_less:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  3453
  fixes a :: "'a::conditionally_complete_linorder"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  3454
  shows "\<lbrakk>finite X; x \<in> X; \<And>x. x\<in>X \<Longrightarrow> a > x\<rbrakk> \<Longrightarrow> a > Sup X"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  3455
  by (induction X rule: finite_induct) (simp_all add: cSup_eq_Max Sup_insert_finite)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  3456
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  3457
lemma finite_Sup_less_iff:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  3458
  fixes a :: "'a :: conditionally_complete_linorder"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  3459
  shows "\<lbrakk>finite X; X \<noteq> {}\<rbrakk> \<Longrightarrow> a > Sup X \<longleftrightarrow> (\<forall>x \<in> X. a > x)"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  3460
  by (auto simp: cSup_eq_Max)
33270
paulson
parents: 33175
diff changeset
  3461
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3462
subsection \<open>Compactness\<close>
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3463
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3464
subsubsection \<open>Bolzano-Weierstrass property\<close>
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3465
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3466
lemma heine_borel_imp_bolzano_weierstrass:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3467
  assumes "compact s"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3468
    and "infinite t"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3469
    and "t \<subseteq> s"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3470
  shows "\<exists>x \<in> s. x islimpt t"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  3471
proof (rule ccontr)
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3472
  assume "\<not> (\<exists>x \<in> s. x islimpt t)"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3473
  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)"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3474
    unfolding islimpt_def
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3475
    using bchoice[of s "\<lambda> x T. x \<in> T \<and> open T \<and> (\<forall>y\<in>t. y \<in> T \<longrightarrow> y = x)"]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3476
    by auto
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3477
  obtain g where g: "g \<subseteq> {t. \<exists>x. x \<in> s \<and> t = f x}" "finite g" "s \<subseteq> \<Union>g"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3478
    using assms(1)[unfolded compact_eq_heine_borel, THEN spec[where x="{t. \<exists>x. x\<in>s \<and> t = f x}"]]
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3479
    using f by auto
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3480
  from g(1,3) have g':"\<forall>x\<in>g. \<exists>xa \<in> s. x = f xa"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3481
    by auto
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3482
  {
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3483
    fix x y
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3484
    assume "x \<in> t" "y \<in> t" "f x = f y"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3485
    then have "x \<in> f x"  "y \<in> f x \<longrightarrow> y = x"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3486
      using f[THEN bspec[where x=x]] and \<open>t \<subseteq> s\<close> by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3487
    then have "x = y"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3488
      using \<open>f x = f y\<close> and f[THEN bspec[where x=y]] and \<open>y \<in> t\<close> and \<open>t \<subseteq> s\<close>
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3489
      by auto
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3490
  }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3491
  then have "inj_on f t"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3492
    unfolding inj_on_def by simp
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3493
  then have "infinite (f ` t)"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3494
    using assms(2) using finite_imageD by auto
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3495
  moreover
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3496
  {
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3497
    fix x
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3498
    assume "x \<in> t" "f x \<notin> g"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3499
    from g(3) assms(3) \<open>x \<in> t\<close> obtain h where "h \<in> g" and "x \<in> h"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3500
      by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3501
    then obtain y where "y \<in> s" "h = f y"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3502
      using g'[THEN bspec[where x=h]] by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3503
    then have "y = x"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3504
      using f[THEN bspec[where x=y]] and \<open>x\<in>t\<close> and \<open>x\<in>h\<close>[unfolded \<open>h = f y\<close>]
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3505
      by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3506
    then have False
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3507
      using \<open>f x \<notin> g\<close> \<open>h \<in> g\<close> unfolding \<open>h = f y\<close>
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3508
      by auto
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3509
  }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3510
  then have "f ` t \<subseteq> g" by auto
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3511
  ultimately show False
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3512
    using g(2) using finite_subset by auto
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3513
qed
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3514
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3515
lemma acc_point_range_imp_convergent_subsequence:
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3516
  fixes l :: "'a :: first_countable_topology"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3517
  assumes l: "\<forall>U. l\<in>U \<longrightarrow> open U \<longrightarrow> infinite (U \<inter> range f)"
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  3518
  shows "\<exists>r. subseq r \<and> (f \<circ> r) \<longlonglongrightarrow> l"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3519
proof -
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  3520
  from countable_basis_at_decseq[of l]
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  3521
  obtain A where A:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  3522
      "\<And>i. open (A i)"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  3523
      "\<And>i. l \<in> A i"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  3524
      "\<And>S. open S \<Longrightarrow> l \<in> S \<Longrightarrow> eventually (\<lambda>i. A i \<subseteq> S) sequentially"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  3525
    by blast
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3526
  def s \<equiv> "\<lambda>n i. SOME j. i < j \<and> f j \<in> A (Suc n)"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3527
  {
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3528
    fix n i
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3529
    have "infinite (A (Suc n) \<inter> range f - f`{.. i})"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3530
      using l A by auto
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3531
    then have "\<exists>x. x \<in> A (Suc n) \<inter> range f - f`{.. i}"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3532
      unfolding ex_in_conv by (intro notI) simp
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3533
    then have "\<exists>j. f j \<in> A (Suc n) \<and> j \<notin> {.. i}"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3534
      by auto
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3535
    then have "\<exists>a. i < a \<and> f a \<in> A (Suc n)"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3536
      by (auto simp: not_le)
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3537
    then have "i < s n i" "f (s n i) \<in> A (Suc n)"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3538
      unfolding s_def by (auto intro: someI2_ex)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3539
  }
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3540
  note s = this
55415
05f5fdb8d093 renamed 'nat_{case,rec}' to '{case,rec}_nat'
blanchet
parents: 54863
diff changeset
  3541
  def r \<equiv> "rec_nat (s 0 0) s"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3542
  have "subseq r"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3543
    by (auto simp: r_def s subseq_Suc_iff)
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3544
  moreover
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  3545
  have "(\<lambda>n. f (r n)) \<longlonglongrightarrow> l"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3546
  proof (rule topological_tendstoI)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3547
    fix S
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3548
    assume "open S" "l \<in> S"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3549
    with A(3) have "eventually (\<lambda>i. A i \<subseteq> S) sequentially"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3550
      by auto
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3551
    moreover
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3552
    {
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3553
      fix i
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3554
      assume "Suc 0 \<le> i"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3555
      then have "f (r i) \<in> A i"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3556
        by (cases i) (simp_all add: r_def s)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3557
    }
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3558
    then have "eventually (\<lambda>i. f (r i) \<in> A i) sequentially"
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3559
      by (auto simp: eventually_sequentially)
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3560
    ultimately show "eventually (\<lambda>i. f (r i) \<in> S) sequentially"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3561
      by eventually_elim auto
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3562
  qed
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  3563
  ultimately show "\<exists>r. subseq r \<and> (f \<circ> r) \<longlonglongrightarrow> l"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3564
    by (auto simp: convergent_def comp_def)
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3565
qed
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3566
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3567
lemma sequence_infinite_lemma:
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3568
  fixes f :: "nat \<Rightarrow> 'a::t1_space"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3569
  assumes "\<forall>n. f n \<noteq> l"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  3570
    and "(f \<longlongrightarrow> l) sequentially"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3571
  shows "infinite (range f)"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3572
proof
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3573
  assume "finite (range f)"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3574
  then have "closed (range f)"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3575
    by (rule finite_imp_closed)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3576
  then have "open (- range f)"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3577
    by (rule open_Compl)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3578
  from assms(1) have "l \<in> - range f"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3579
    by auto
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3580
  from assms(2) have "eventually (\<lambda>n. f n \<in> - range f) sequentially"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3581
    using \<open>open (- range f)\<close> \<open>l \<in> - range f\<close>
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3582
    by (rule topological_tendstoD)
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3583
  then show False
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3584
    unfolding eventually_sequentially
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3585
    by auto
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3586
qed
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3587
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3588
lemma closure_insert:
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3589
  fixes x :: "'a::t1_space"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3590
  shows "closure (insert x s) = insert x (closure s)"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3591
  apply (rule closure_unique)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3592
  apply (rule insert_mono [OF closure_subset])
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3593
  apply (rule closed_insert [OF closed_closure])
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3594
  apply (simp add: closure_minimal)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3595
  done
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3596
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3597
lemma islimpt_insert:
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3598
  fixes x :: "'a::t1_space"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3599
  shows "x islimpt (insert a s) \<longleftrightarrow> x islimpt s"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3600
proof
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3601
  assume *: "x islimpt (insert a s)"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3602
  show "x islimpt s"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3603
  proof (rule islimptI)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3604
    fix t
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3605
    assume t: "x \<in> t" "open t"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3606
    show "\<exists>y\<in>s. y \<in> t \<and> y \<noteq> x"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3607
    proof (cases "x = a")
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3608
      case True
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3609
      obtain y where "y \<in> insert a s" "y \<in> t" "y \<noteq> x"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3610
        using * t by (rule islimptE)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3611
      with \<open>x = a\<close> show ?thesis by auto
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3612
    next
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3613
      case False
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3614
      with t have t': "x \<in> t - {a}" "open (t - {a})"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3615
        by (simp_all add: open_Diff)
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3616
      obtain y where "y \<in> insert a s" "y \<in> t - {a}" "y \<noteq> x"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3617
        using * t' by (rule islimptE)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3618
      then show ?thesis by auto
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3619
    qed
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3620
  qed
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3621
next
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3622
  assume "x islimpt s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3623
  then show "x islimpt (insert a s)"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3624
    by (rule islimpt_subset) auto
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3625
qed
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3626
50897
078590669527 generalize lemma islimpt_finite to class t1_space
huffman
parents: 50884
diff changeset
  3627
lemma islimpt_finite:
078590669527 generalize lemma islimpt_finite to class t1_space
huffman
parents: 50884
diff changeset
  3628
  fixes x :: "'a::t1_space"
078590669527 generalize lemma islimpt_finite to class t1_space
huffman
parents: 50884
diff changeset
  3629
  shows "finite s \<Longrightarrow> \<not> x islimpt s"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3630
  by (induct set: finite) (simp_all add: islimpt_insert)
50897
078590669527 generalize lemma islimpt_finite to class t1_space
huffman
parents: 50884
diff changeset
  3631
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3632
lemma islimpt_union_finite:
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3633
  fixes x :: "'a::t1_space"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3634
  shows "finite s \<Longrightarrow> x islimpt (s \<union> t) \<longleftrightarrow> x islimpt t"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3635
  by (simp add: islimpt_Un islimpt_finite)
50897
078590669527 generalize lemma islimpt_finite to class t1_space
huffman
parents: 50884
diff changeset
  3636
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3637
lemma islimpt_eq_acc_point:
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3638
  fixes l :: "'a :: t1_space"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3639
  shows "l islimpt S \<longleftrightarrow> (\<forall>U. l\<in>U \<longrightarrow> open U \<longrightarrow> infinite (U \<inter> S))"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3640
proof (safe intro!: islimptI)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3641
  fix U
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3642
  assume "l islimpt S" "l \<in> U" "open U" "finite (U \<inter> S)"
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3643
  then have "l islimpt S" "l \<in> (U - (U \<inter> S - {l}))" "open (U - (U \<inter> S - {l}))"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3644
    by (auto intro: finite_imp_closed)
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3645
  then show False
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3646
    by (rule islimptE) auto
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3647
next
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3648
  fix T
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3649
  assume *: "\<forall>U. l\<in>U \<longrightarrow> open U \<longrightarrow> infinite (U \<inter> S)" "l \<in> T" "open T"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3650
  then have "infinite (T \<inter> S - {l})"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3651
    by auto
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3652
  then have "\<exists>x. x \<in> (T \<inter> S - {l})"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3653
    unfolding ex_in_conv by (intro notI) simp
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3654
  then show "\<exists>y\<in>S. y \<in> T \<and> y \<noteq> l"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3655
    by auto
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3656
qed
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3657
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3658
lemma islimpt_range_imp_convergent_subsequence:
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3659
  fixes l :: "'a :: {t1_space, first_countable_topology}"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3660
  assumes l: "l islimpt (range f)"
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  3661
  shows "\<exists>r. subseq r \<and> (f \<circ> r) \<longlonglongrightarrow> l"
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3662
  using l unfolding islimpt_eq_acc_point
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3663
  by (rule acc_point_range_imp_convergent_subsequence)
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3664
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3665
lemma sequence_unique_limpt:
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3666
  fixes f :: "nat \<Rightarrow> 'a::t2_space"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  3667
  assumes "(f \<longlongrightarrow> l) sequentially"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3668
    and "l' islimpt (range f)"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3669
  shows "l' = l"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3670
proof (rule ccontr)
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3671
  assume "l' \<noteq> l"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3672
  obtain s t where "open s" "open t" "l' \<in> s" "l \<in> t" "s \<inter> t = {}"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3673
    using hausdorff [OF \<open>l' \<noteq> l\<close>] by auto
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3674
  have "eventually (\<lambda>n. f n \<in> t) sequentially"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3675
    using assms(1) \<open>open t\<close> \<open>l \<in> t\<close> by (rule topological_tendstoD)
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3676
  then obtain N where "\<forall>n\<ge>N. f n \<in> t"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3677
    unfolding eventually_sequentially by auto
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3678
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3679
  have "UNIV = {..<N} \<union> {N..}"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3680
    by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3681
  then have "l' islimpt (f ` ({..<N} \<union> {N..}))"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3682
    using assms(2) by simp
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3683
  then have "l' islimpt (f ` {..<N} \<union> f ` {N..})"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3684
    by (simp add: image_Un)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3685
  then have "l' islimpt (f ` {N..})"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3686
    by (simp add: islimpt_union_finite)
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3687
  then obtain y where "y \<in> f ` {N..}" "y \<in> s" "y \<noteq> l'"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3688
    using \<open>l' \<in> s\<close> \<open>open s\<close> by (rule islimptE)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3689
  then obtain n where "N \<le> n" "f n \<in> s" "f n \<noteq> l'"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3690
    by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3691
  with \<open>\<forall>n\<ge>N. f n \<in> t\<close> have "f n \<in> s \<inter> t"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3692
    by simp
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3693
  with \<open>s \<inter> t = {}\<close> show False
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3694
    by simp
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3695
qed
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3696
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3697
lemma bolzano_weierstrass_imp_closed:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  3698
  fixes s :: "'a::{first_countable_topology,t2_space} set"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3699
  assumes "\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t)"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3700
  shows "closed s"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3701
proof -
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3702
  {
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3703
    fix x l
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  3704
    assume as: "\<forall>n::nat. x n \<in> s" "(x \<longlongrightarrow> l) sequentially"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3705
    then have "l \<in> s"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3706
    proof (cases "\<forall>n. x n \<noteq> l")
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3707
      case False
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3708
      then show "l\<in>s" using as(1) by auto
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3709
    next
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3710
      case True note cas = this
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3711
      with as(2) have "infinite (range x)"
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3712
        using sequence_infinite_lemma[of x l] by auto
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3713
      then obtain l' where "l'\<in>s" "l' islimpt (range x)"
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3714
        using assms[THEN spec[where x="range x"]] as(1) by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3715
      then show "l\<in>s" using sequence_unique_limpt[of x l l']
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3716
        using as cas by auto
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3717
    qed
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3718
  }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3719
  then show ?thesis
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3720
    unfolding closed_sequential_limits by fast
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3721
qed
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3722
50944
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  3723
lemma compact_imp_bounded:
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3724
  assumes "compact U"
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3725
  shows "bounded U"
50944
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  3726
proof -
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3727
  have "compact U" "\<forall>x\<in>U. open (ball x 1)" "U \<subseteq> (\<Union>x\<in>U. ball x 1)"
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3728
    using assms by auto
50944
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  3729
  then obtain D where D: "D \<subseteq> U" "finite D" "U \<subseteq> (\<Union>x\<in>D. ball x 1)"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3730
    by (rule compactE_image)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3731
  from \<open>finite D\<close> have "bounded (\<Union>x\<in>D. ball x 1)"
50955
ada575c605e1 simplify proof of compact_imp_bounded
huffman
parents: 50949
diff changeset
  3732
    by (simp add: bounded_UN)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3733
  then show "bounded U" using \<open>U \<subseteq> (\<Union>x\<in>D. ball x 1)\<close>
50955
ada575c605e1 simplify proof of compact_imp_bounded
huffman
parents: 50949
diff changeset
  3734
    by (rule bounded_subset)
50944
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  3735
qed
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  3736
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3737
text\<open>In particular, some common special cases.\<close>
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3738
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3739
lemma compact_union [intro]:
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  3740
  assumes "compact s"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  3741
    and "compact t"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3742
  shows " compact (s \<union> t)"
50898
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  3743
proof (rule compactI)
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3744
  fix f
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3745
  assume *: "Ball f open" "s \<union> t \<subseteq> \<Union>f"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3746
  from * \<open>compact s\<close> obtain s' where "s' \<subseteq> f \<and> finite s' \<and> s \<subseteq> \<Union>s'"
56073
29e308b56d23 enhanced simplifier solver for preconditions of rewrite rule, can now deal with conjunctions
nipkow
parents: 55927
diff changeset
  3747
    unfolding compact_eq_heine_borel by (auto elim!: allE[of _ f])
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3748
  moreover
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3749
  from * \<open>compact t\<close> obtain t' where "t' \<subseteq> f \<and> finite t' \<and> t \<subseteq> \<Union>t'"
56073
29e308b56d23 enhanced simplifier solver for preconditions of rewrite rule, can now deal with conjunctions
nipkow
parents: 55927
diff changeset
  3750
    unfolding compact_eq_heine_borel by (auto elim!: allE[of _ f])
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3751
  ultimately show "\<exists>f'\<subseteq>f. finite f' \<and> s \<union> t \<subseteq> \<Union>f'"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3752
    by (auto intro!: exI[of _ "s' \<union> t'"])
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3753
qed
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3754
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3755
lemma compact_Union [intro]: "finite S \<Longrightarrow> (\<And>T. T \<in> S \<Longrightarrow> compact T) \<Longrightarrow> compact (\<Union>S)"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3756
  by (induct set: finite) auto
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3757
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3758
lemma compact_UN [intro]:
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3759
  "finite A \<Longrightarrow> (\<And>x. x \<in> A \<Longrightarrow> compact (B x)) \<Longrightarrow> compact (\<Union>x\<in>A. B x)"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3760
  unfolding SUP_def by (rule compact_Union) auto
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3761
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3762
lemma closed_inter_compact [intro]:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3763
  assumes "closed s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3764
    and "compact t"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3765
  shows "compact (s \<inter> t)"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3766
  using compact_inter_closed [of t s] assms
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3767
  by (simp add: Int_commute)
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3768
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3769
lemma compact_inter [intro]:
50898
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  3770
  fixes s t :: "'a :: t2_space set"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3771
  assumes "compact s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3772
    and "compact t"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3773
  shows "compact (s \<inter> t)"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3774
  using assms by (intro compact_inter_closed compact_imp_closed)
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3775
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3776
lemma compact_sing [simp]: "compact {a}"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3777
  unfolding compact_eq_heine_borel by auto
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3778
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3779
lemma compact_insert [simp]:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3780
  assumes "compact s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3781
  shows "compact (insert x s)"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3782
proof -
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3783
  have "compact ({x} \<union> s)"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3784
    using compact_sing assms by (rule compact_union)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3785
  then show ?thesis by simp
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3786
qed
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3787
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  3788
lemma finite_imp_compact: "finite s \<Longrightarrow> compact s"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3789
  by (induct set: finite) simp_all
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3790
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3791
lemma open_delete:
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3792
  fixes s :: "'a::t1_space set"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3793
  shows "open s \<Longrightarrow> open (s - {x})"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3794
  by (simp add: open_Diff)
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3795
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3796
text\<open>Compactness expressed with filters\<close>
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3797
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3798
lemma closure_iff_nhds_not_empty:
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3799
  "x \<in> closure X \<longleftrightarrow> (\<forall>A. \<forall>S\<subseteq>A. open S \<longrightarrow> x \<in> S \<longrightarrow> X \<inter> A \<noteq> {})"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3800
proof safe
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3801
  assume x: "x \<in> closure X"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3802
  fix S A
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3803
  assume "open S" "x \<in> S" "X \<inter> A = {}" "S \<subseteq> A"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3804
  then have "x \<notin> closure (-S)"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3805
    by (auto simp: closure_complement subset_eq[symmetric] intro: interiorI)
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3806
  with x have "x \<in> closure X - closure (-S)"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3807
    by auto
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3808
  also have "\<dots> \<subseteq> closure (X \<inter> S)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3809
    using \<open>open S\<close> open_inter_closure_subset[of S X] by (simp add: closed_Compl ac_simps)
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3810
  finally have "X \<inter> S \<noteq> {}" by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3811
  then show False using \<open>X \<inter> A = {}\<close> \<open>S \<subseteq> A\<close> by auto
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3812
next
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3813
  assume "\<forall>A S. S \<subseteq> A \<longrightarrow> open S \<longrightarrow> x \<in> S \<longrightarrow> X \<inter> A \<noteq> {}"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3814
  from this[THEN spec, of "- X", THEN spec, of "- closure X"]
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3815
  show "x \<in> closure X"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3816
    by (simp add: closure_subset open_Compl)
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3817
qed
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3818
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3819
lemma compact_filter:
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3820
  "compact U \<longleftrightarrow> (\<forall>F. F \<noteq> bot \<longrightarrow> eventually (\<lambda>x. x \<in> U) F \<longrightarrow> (\<exists>x\<in>U. inf (nhds x) F \<noteq> bot))"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3821
proof (intro allI iffI impI compact_fip[THEN iffD2] notI)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3822
  fix F
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3823
  assume "compact U"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3824
  assume F: "F \<noteq> bot" "eventually (\<lambda>x. x \<in> U) F"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3825
  then have "U \<noteq> {}"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3826
    by (auto simp: eventually_False)
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3827
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3828
  def Z \<equiv> "closure ` {A. eventually (\<lambda>x. x \<in> A) F}"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3829
  then have "\<forall>z\<in>Z. closed z"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3830
    by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3831
  moreover
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3832
  have ev_Z: "\<And>z. z \<in> Z \<Longrightarrow> eventually (\<lambda>x. x \<in> z) F"
61810
3c5040d5694a sorted out eventually_mono
paulson <lp15@cam.ac.uk>
parents: 61808
diff changeset
  3833
    unfolding Z_def by (auto elim: eventually_mono intro: set_mp[OF closure_subset])
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3834
  have "(\<forall>B \<subseteq> Z. finite B \<longrightarrow> U \<inter> \<Inter>B \<noteq> {})"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3835
  proof (intro allI impI)
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3836
    fix B assume "finite B" "B \<subseteq> Z"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3837
    with \<open>finite B\<close> ev_Z F(2) have "eventually (\<lambda>x. x \<in> U \<inter> (\<Inter>B)) F"
60040
1fa1023b13b9 move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents: 60017
diff changeset
  3838
      by (auto simp: eventually_ball_finite_distrib eventually_conj_iff)
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3839
    with F show "U \<inter> \<Inter>B \<noteq> {}"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3840
      by (intro notI) (simp add: eventually_False)
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3841
  qed
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3842
  ultimately have "U \<inter> \<Inter>Z \<noteq> {}"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3843
    using \<open>compact U\<close> unfolding compact_fip by blast
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3844
  then obtain x where "x \<in> U" and x: "\<And>z. z \<in> Z \<Longrightarrow> x \<in> z"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3845
    by auto
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3846
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3847
  have "\<And>P. eventually P (inf (nhds x) F) \<Longrightarrow> P \<noteq> bot"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3848
    unfolding eventually_inf eventually_nhds
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3849
  proof safe
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3850
    fix P Q R S
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3851
    assume "eventually R F" "open S" "x \<in> S"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3852
    with open_inter_closure_eq_empty[of S "{x. R x}"] x[of "closure {x. R x}"]
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3853
    have "S \<inter> {x. R x} \<noteq> {}" by (auto simp: Z_def)
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3854
    moreover assume "Ball S Q" "\<forall>x. Q x \<and> R x \<longrightarrow> bot x"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3855
    ultimately show False by (auto simp: set_eq_iff)
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3856
  qed
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3857
  with \<open>x \<in> U\<close> show "\<exists>x\<in>U. inf (nhds x) F \<noteq> bot"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3858
    by (metis eventually_bot)
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3859
next
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3860
  fix A
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3861
  assume A: "\<forall>a\<in>A. closed a" "\<forall>B\<subseteq>A. finite B \<longrightarrow> U \<inter> \<Inter>B \<noteq> {}" "U \<inter> \<Inter>A = {}"
57276
49c51eeaa623 filters are easier to define with INF on filters.
hoelzl
parents: 57275
diff changeset
  3862
  def F \<equiv> "INF a:insert U A. principal a"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3863
  have "F \<noteq> bot"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3864
    unfolding F_def
57276
49c51eeaa623 filters are easier to define with INF on filters.
hoelzl
parents: 57275
diff changeset
  3865
  proof (rule INF_filter_not_bot)
49c51eeaa623 filters are easier to define with INF on filters.
hoelzl
parents: 57275
diff changeset
  3866
    fix X assume "X \<subseteq> insert U A" "finite X"
49c51eeaa623 filters are easier to define with INF on filters.
hoelzl
parents: 57275
diff changeset
  3867
    moreover with A(2)[THEN spec, of "X - {U}"] have "U \<inter> \<Inter>(X - {U}) \<noteq> {}"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3868
      by auto
57276
49c51eeaa623 filters are easier to define with INF on filters.
hoelzl
parents: 57275
diff changeset
  3869
    ultimately show "(INF a:X. principal a) \<noteq> bot"
49c51eeaa623 filters are easier to define with INF on filters.
hoelzl
parents: 57275
diff changeset
  3870
      by (auto simp add: INF_principal_finite principal_eq_bot_iff)
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3871
  qed
57276
49c51eeaa623 filters are easier to define with INF on filters.
hoelzl
parents: 57275
diff changeset
  3872
  moreover
49c51eeaa623 filters are easier to define with INF on filters.
hoelzl
parents: 57275
diff changeset
  3873
  have "F \<le> principal U"
49c51eeaa623 filters are easier to define with INF on filters.
hoelzl
parents: 57275
diff changeset
  3874
    unfolding F_def by auto
49c51eeaa623 filters are easier to define with INF on filters.
hoelzl
parents: 57275
diff changeset
  3875
  then have "eventually (\<lambda>x. x \<in> U) F"
49c51eeaa623 filters are easier to define with INF on filters.
hoelzl
parents: 57275
diff changeset
  3876
    by (auto simp: le_filter_def eventually_principal)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3877
  moreover
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3878
  assume "\<forall>F. F \<noteq> bot \<longrightarrow> eventually (\<lambda>x. x \<in> U) F \<longrightarrow> (\<exists>x\<in>U. inf (nhds x) F \<noteq> bot)"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3879
  ultimately obtain x where "x \<in> U" and x: "inf (nhds x) F \<noteq> bot"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3880
    by auto
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3881
57276
49c51eeaa623 filters are easier to define with INF on filters.
hoelzl
parents: 57275
diff changeset
  3882
  { fix V assume "V \<in> A"
49c51eeaa623 filters are easier to define with INF on filters.
hoelzl
parents: 57275
diff changeset
  3883
    then have "F \<le> principal V"
49c51eeaa623 filters are easier to define with INF on filters.
hoelzl
parents: 57275
diff changeset
  3884
      unfolding F_def by (intro INF_lower2[of V]) auto
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3885
    then have V: "eventually (\<lambda>x. x \<in> V) F"
57276
49c51eeaa623 filters are easier to define with INF on filters.
hoelzl
parents: 57275
diff changeset
  3886
      by (auto simp: le_filter_def eventually_principal)
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3887
    have "x \<in> closure V"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3888
      unfolding closure_iff_nhds_not_empty
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3889
    proof (intro impI allI)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3890
      fix S A
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3891
      assume "open S" "x \<in> S" "S \<subseteq> A"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3892
      then have "eventually (\<lambda>x. x \<in> A) (nhds x)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3893
        by (auto simp: eventually_nhds)
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3894
      with V have "eventually (\<lambda>x. x \<in> V \<inter> A) (inf (nhds x) F)"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3895
        by (auto simp: eventually_inf)
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3896
      with x show "V \<inter> A \<noteq> {}"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3897
        by (auto simp del: Int_iff simp add: trivial_limit_def)
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3898
    qed
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3899
    then have "x \<in> V"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3900
      using \<open>V \<in> A\<close> A(1) by simp
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3901
  }
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3902
  with \<open>x\<in>U\<close> have "x \<in> U \<inter> \<Inter>A" by auto
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3903
  with \<open>U \<inter> \<Inter>A = {}\<close> show False by auto
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3904
qed
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3905
50941
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3906
definition "countably_compact U \<longleftrightarrow>
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3907
    (\<forall>A. countable A \<longrightarrow> (\<forall>a\<in>A. open a) \<longrightarrow> U \<subseteq> \<Union>A \<longrightarrow> (\<exists>T\<subseteq>A. finite T \<and> U \<subseteq> \<Union>T))"
50941
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3908
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3909
lemma countably_compactE:
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3910
  assumes "countably_compact s" and "\<forall>t\<in>C. open t" and "s \<subseteq> \<Union>C" "countable C"
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3911
  obtains C' where "C' \<subseteq> C" and "finite C'" and "s \<subseteq> \<Union>C'"
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3912
  using assms unfolding countably_compact_def by metis
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3913
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3914
lemma countably_compactI:
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3915
  assumes "\<And>C. \<forall>t\<in>C. open t \<Longrightarrow> s \<subseteq> \<Union>C \<Longrightarrow> countable C \<Longrightarrow> (\<exists>C'\<subseteq>C. finite C' \<and> s \<subseteq> \<Union>C')"
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3916
  shows "countably_compact s"
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3917
  using assms unfolding countably_compact_def by metis
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3918
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3919
lemma compact_imp_countably_compact: "compact U \<Longrightarrow> countably_compact U"
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3920
  by (auto simp: compact_eq_heine_borel countably_compact_def)
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3921
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3922
lemma countably_compact_imp_compact:
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3923
  assumes "countably_compact U"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3924
    and ccover: "countable B" "\<forall>b\<in>B. open b"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3925
    and basis: "\<And>T x. open T \<Longrightarrow> x \<in> T \<Longrightarrow> x \<in> U \<Longrightarrow> \<exists>b\<in>B. x \<in> b \<and> b \<inter> U \<subseteq> T"
50941
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3926
  shows "compact U"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3927
  using \<open>countably_compact U\<close>
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3928
  unfolding compact_eq_heine_borel countably_compact_def
50941
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3929
proof safe
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3930
  fix A
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3931
  assume A: "\<forall>a\<in>A. open a" "U \<subseteq> \<Union>A"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3932
  assume *: "\<forall>A. countable A \<longrightarrow> (\<forall>a\<in>A. open a) \<longrightarrow> U \<subseteq> \<Union>A \<longrightarrow> (\<exists>T\<subseteq>A. finite T \<and> U \<subseteq> \<Union>T)"
50941
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3933
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3934
  moreover def C \<equiv> "{b\<in>B. \<exists>a\<in>A. b \<inter> U \<subseteq> a}"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3935
  ultimately have "countable C" "\<forall>a\<in>C. open a"
50941
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3936
    unfolding C_def using ccover by auto
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3937
  moreover
50941
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3938
  have "\<Union>A \<inter> U \<subseteq> \<Union>C"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3939
  proof safe
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3940
    fix x a
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3941
    assume "x \<in> U" "x \<in> a" "a \<in> A"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3942
    with basis[of a x] A obtain b where "b \<in> B" "x \<in> b" "b \<inter> U \<subseteq> a"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3943
      by blast
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3944
    with \<open>a \<in> A\<close> show "x \<in> \<Union>C"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3945
      unfolding C_def by auto
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3946
  qed
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3947
  then have "U \<subseteq> \<Union>C" using \<open>U \<subseteq> \<Union>A\<close> by auto
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53291
diff changeset
  3948
  ultimately obtain T where T: "T\<subseteq>C" "finite T" "U \<subseteq> \<Union>T"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3949
    using * by metis
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53291
diff changeset
  3950
  then have "\<forall>t\<in>T. \<exists>a\<in>A. t \<inter> U \<subseteq> a"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3951
    by (auto simp: C_def)
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  3952
  then obtain f where "\<forall>t\<in>T. f t \<in> A \<and> t \<inter> U \<subseteq> f t"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  3953
    unfolding bchoice_iff Bex_def ..
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53291
diff changeset
  3954
  with T show "\<exists>T\<subseteq>A. finite T \<and> U \<subseteq> \<Union>T"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  3955
    unfolding C_def by (intro exI[of _ "f`T"]) fastforce
50941
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3956
qed
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3957
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3958
lemma countably_compact_imp_compact_second_countable:
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3959
  "countably_compact U \<Longrightarrow> compact (U :: 'a :: second_countable_topology set)"
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3960
proof (rule countably_compact_imp_compact)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3961
  fix T and x :: 'a
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3962
  assume "open T" "x \<in> T"
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  3963
  from topological_basisE[OF is_basis this] obtain b where
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  3964
    "b \<in> (SOME B. countable B \<and> topological_basis B)" "x \<in> b" "b \<subseteq> T" .
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3965
  then show "\<exists>b\<in>SOME B. countable B \<and> topological_basis B. x \<in> b \<and> b \<inter> U \<subseteq> T"
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  3966
    by blast
50941
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  3967
qed (insert countable_basis topological_basis_open[OF is_basis], auto)
36437
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  3968
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3969
lemma countably_compact_eq_compact:
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3970
  "countably_compact U \<longleftrightarrow> compact (U :: 'a :: second_countable_topology set)"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  3971
  using countably_compact_imp_compact_second_countable compact_imp_countably_compact by blast
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3972
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3973
subsubsection\<open>Sequential compactness\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3974
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3975
definition seq_compact :: "'a::topological_space set \<Rightarrow> bool"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  3976
  where "seq_compact S \<longleftrightarrow>
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  3977
    (\<forall>f. (\<forall>n. f n \<in> S) \<longrightarrow> (\<exists>l\<in>S. \<exists>r. subseq r \<and> ((f \<circ> r) \<longlongrightarrow> l) sequentially))"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  3978
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  3979
lemma seq_compactI:
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  3980
  assumes "\<And>f. \<forall>n. f n \<in> S \<Longrightarrow> \<exists>l\<in>S. \<exists>r. subseq r \<and> ((f \<circ> r) \<longlongrightarrow> l) sequentially"
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  3981
  shows "seq_compact S"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  3982
  unfolding seq_compact_def using assms by fast
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  3983
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  3984
lemma seq_compactE:
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  3985
  assumes "seq_compact S" "\<forall>n. f n \<in> S"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  3986
  obtains l r where "l \<in> S" "subseq r" "((f \<circ> r) \<longlongrightarrow> l) sequentially"
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  3987
  using assms unfolding seq_compact_def by fast
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  3988
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  3989
lemma closed_sequentially: (* TODO: move upwards *)
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  3990
  assumes "closed s" and "\<forall>n. f n \<in> s" and "f \<longlonglongrightarrow> l"
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  3991
  shows "l \<in> s"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  3992
proof (rule ccontr)
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  3993
  assume "l \<notin> s"
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  3994
  with \<open>closed s\<close> and \<open>f \<longlonglongrightarrow> l\<close> have "eventually (\<lambda>n. f n \<in> - s) sequentially"
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  3995
    by (fast intro: topological_tendstoD)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  3996
  with \<open>\<forall>n. f n \<in> s\<close> show "False"
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  3997
    by simp
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  3998
qed
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  3999
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4000
lemma seq_compact_inter_closed:
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4001
  assumes "seq_compact s" and "closed t"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4002
  shows "seq_compact (s \<inter> t)"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4003
proof (rule seq_compactI)
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4004
  fix f assume "\<forall>n::nat. f n \<in> s \<inter> t"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4005
  hence "\<forall>n. f n \<in> s" and "\<forall>n. f n \<in> t"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4006
    by simp_all
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4007
  from \<open>seq_compact s\<close> and \<open>\<forall>n. f n \<in> s\<close>
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4008
  obtain l r where "l \<in> s" and r: "subseq r" and l: "(f \<circ> r) \<longlonglongrightarrow> l"
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4009
    by (rule seq_compactE)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4010
  from \<open>\<forall>n. f n \<in> t\<close> have "\<forall>n. (f \<circ> r) n \<in> t"
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4011
    by simp
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4012
  from \<open>closed t\<close> and this and l have "l \<in> t"
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4013
    by (rule closed_sequentially)
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4014
  with \<open>l \<in> s\<close> and r and l show "\<exists>l\<in>s \<inter> t. \<exists>r. subseq r \<and> (f \<circ> r) \<longlonglongrightarrow> l"
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4015
    by fast
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4016
qed
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4017
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4018
lemma seq_compact_closed_subset:
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4019
  assumes "closed s" and "s \<subseteq> t" and "seq_compact t"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4020
  shows "seq_compact s"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4021
  using assms seq_compact_inter_closed [of t s] by (simp add: Int_absorb1)
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4022
50941
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  4023
lemma seq_compact_imp_countably_compact:
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  4024
  fixes U :: "'a :: first_countable_topology set"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4025
  assumes "seq_compact U"
50941
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  4026
  shows "countably_compact U"
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  4027
proof (safe intro!: countably_compactI)
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4028
  fix A
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4029
  assume A: "\<forall>a\<in>A. open a" "U \<subseteq> \<Union>A" "countable A"
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4030
  have subseq: "\<And>X. range X \<subseteq> U \<Longrightarrow> \<exists>r x. x \<in> U \<and> subseq r \<and> (X \<circ> r) \<longlonglongrightarrow> x"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4031
    using \<open>seq_compact U\<close> by (fastforce simp: seq_compact_def subset_eq)
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4032
  show "\<exists>T\<subseteq>A. finite T \<and> U \<subseteq> \<Union>T"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4033
  proof cases
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4034
    assume "finite A"
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4035
    with A show ?thesis by auto
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4036
  next
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4037
    assume "infinite A"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4038
    then have "A \<noteq> {}" by auto
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4039
    show ?thesis
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4040
    proof (rule ccontr)
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4041
      assume "\<not> (\<exists>T\<subseteq>A. finite T \<and> U \<subseteq> \<Union>T)"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4042
      then have "\<forall>T. \<exists>x. T \<subseteq> A \<and> finite T \<longrightarrow> (x \<in> U - \<Union>T)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4043
        by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4044
      then obtain X' where T: "\<And>T. T \<subseteq> A \<Longrightarrow> finite T \<Longrightarrow> X' T \<in> U - \<Union>T"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4045
        by metis
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4046
      def X \<equiv> "\<lambda>n. X' (from_nat_into A ` {.. n})"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4047
      have X: "\<And>n. X n \<in> U - (\<Union>i\<le>n. from_nat_into A i)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4048
        using \<open>A \<noteq> {}\<close> unfolding X_def SUP_def by (intro T) (auto intro: from_nat_into)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4049
      then have "range X \<subseteq> U"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4050
        by auto
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4051
      with subseq[of X] obtain r x where "x \<in> U" and r: "subseq r" "(X \<circ> r) \<longlonglongrightarrow> x"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4052
        by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4053
      from \<open>x\<in>U\<close> \<open>U \<subseteq> \<Union>A\<close> from_nat_into_surj[OF \<open>countable A\<close>]
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4054
      obtain n where "x \<in> from_nat_into A n" by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4055
      with r(2) A(1) from_nat_into[OF \<open>A \<noteq> {}\<close>, of n]
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4056
      have "eventually (\<lambda>i. X (r i) \<in> from_nat_into A n) sequentially"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4057
        unfolding tendsto_def by (auto simp: comp_def)
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4058
      then obtain N where "\<And>i. N \<le> i \<Longrightarrow> X (r i) \<in> from_nat_into A n"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4059
        by (auto simp: eventually_sequentially)
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4060
      moreover from X have "\<And>i. n \<le> r i \<Longrightarrow> X (r i) \<notin> from_nat_into A n"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4061
        by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4062
      moreover from \<open>subseq r\<close>[THEN seq_suble, of "max n N"] have "\<exists>i. n \<le> r i \<and> N \<le> i"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4063
        by (auto intro!: exI[of _ "max n N"])
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4064
      ultimately show False
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4065
        by auto
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4066
    qed
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4067
  qed
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4068
qed
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4069
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4070
lemma compact_imp_seq_compact:
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4071
  fixes U :: "'a :: first_countable_topology set"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4072
  assumes "compact U"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4073
  shows "seq_compact U"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4074
  unfolding seq_compact_def
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4075
proof safe
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4076
  fix X :: "nat \<Rightarrow> 'a"
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4077
  assume "\<forall>n. X n \<in> U"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4078
  then have "eventually (\<lambda>x. x \<in> U) (filtermap X sequentially)"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4079
    by (auto simp: eventually_filtermap)
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4080
  moreover
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4081
  have "filtermap X sequentially \<noteq> bot"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4082
    by (simp add: trivial_limit_def eventually_filtermap)
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4083
  ultimately
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4084
  obtain x where "x \<in> U" and x: "inf (nhds x) (filtermap X sequentially) \<noteq> bot" (is "?F \<noteq> _")
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4085
    using \<open>compact U\<close> by (auto simp: compact_filter)
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4086
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  4087
  from countable_basis_at_decseq[of x]
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  4088
  obtain A where A:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  4089
      "\<And>i. open (A i)"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  4090
      "\<And>i. x \<in> A i"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  4091
      "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> eventually (\<lambda>i. A i \<subseteq> S) sequentially"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  4092
    by blast
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4093
  def s \<equiv> "\<lambda>n i. SOME j. i < j \<and> X j \<in> A (Suc n)"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4094
  {
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4095
    fix n i
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4096
    have "\<exists>a. i < a \<and> X a \<in> A (Suc n)"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4097
    proof (rule ccontr)
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4098
      assume "\<not> (\<exists>a>i. X a \<in> A (Suc n))"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4099
      then have "\<And>a. Suc i \<le> a \<Longrightarrow> X a \<notin> A (Suc n)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4100
        by auto
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4101
      then have "eventually (\<lambda>x. x \<notin> A (Suc n)) (filtermap X sequentially)"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4102
        by (auto simp: eventually_filtermap eventually_sequentially)
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4103
      moreover have "eventually (\<lambda>x. x \<in> A (Suc n)) (nhds x)"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4104
        using A(1,2)[of "Suc n"] by (auto simp: eventually_nhds)
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4105
      ultimately have "eventually (\<lambda>x. False) ?F"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4106
        by (auto simp add: eventually_inf)
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4107
      with x show False
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4108
        by (simp add: eventually_False)
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4109
    qed
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4110
    then have "i < s n i" "X (s n i) \<in> A (Suc n)"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4111
      unfolding s_def by (auto intro: someI2_ex)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4112
  }
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4113
  note s = this
55415
05f5fdb8d093 renamed 'nat_{case,rec}' to '{case,rec}_nat'
blanchet
parents: 54863
diff changeset
  4114
  def r \<equiv> "rec_nat (s 0 0) s"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4115
  have "subseq r"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4116
    by (auto simp: r_def s subseq_Suc_iff)
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4117
  moreover
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4118
  have "(\<lambda>n. X (r n)) \<longlonglongrightarrow> x"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4119
  proof (rule topological_tendstoI)
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4120
    fix S
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4121
    assume "open S" "x \<in> S"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4122
    with A(3) have "eventually (\<lambda>i. A i \<subseteq> S) sequentially"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4123
      by auto
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4124
    moreover
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4125
    {
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4126
      fix i
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4127
      assume "Suc 0 \<le> i"
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4128
      then have "X (r i) \<in> A i"
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4129
        by (cases i) (simp_all add: r_def s)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4130
    }
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4131
    then have "eventually (\<lambda>i. X (r i) \<in> A i) sequentially"
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4132
      by (auto simp: eventually_sequentially)
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4133
    ultimately show "eventually (\<lambda>i. X (r i) \<in> S) sequentially"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4134
      by eventually_elim auto
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4135
  qed
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4136
  ultimately show "\<exists>x \<in> U. \<exists>r. subseq r \<and> (X \<circ> r) \<longlonglongrightarrow> x"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4137
    using \<open>x \<in> U\<close> by (auto simp: convergent_def comp_def)
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4138
qed
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4139
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4140
lemma countably_compact_imp_acc_point:
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  4141
  assumes "countably_compact s"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  4142
    and "countable t"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  4143
    and "infinite t"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  4144
    and "t \<subseteq> s"
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4145
  shows "\<exists>x\<in>s. \<forall>U. x\<in>U \<and> open U \<longrightarrow> infinite (U \<inter> t)"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4146
proof (rule ccontr)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4147
  def C \<equiv> "(\<lambda>F. interior (F \<union> (- t))) ` {F. finite F \<and> F \<subseteq> t }"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4148
  note \<open>countably_compact s\<close>
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4149
  moreover have "\<forall>t\<in>C. open t"
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4150
    by (auto simp: C_def)
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4151
  moreover
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4152
  assume "\<not> (\<exists>x\<in>s. \<forall>U. x\<in>U \<and> open U \<longrightarrow> infinite (U \<inter> t))"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4153
  then have s: "\<And>x. x \<in> s \<Longrightarrow> \<exists>U. x\<in>U \<and> open U \<and> finite (U \<inter> t)" by metis
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4154
  have "s \<subseteq> \<Union>C"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4155
    using \<open>t \<subseteq> s\<close>
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4156
    unfolding C_def Union_image_eq
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4157
    apply (safe dest!: s)
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4158
    apply (rule_tac a="U \<inter> t" in UN_I)
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4159
    apply (auto intro!: interiorI simp add: finite_subset)
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4160
    done
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4161
  moreover
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4162
  from \<open>countable t\<close> have "countable C"
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4163
    unfolding C_def by (auto intro: countable_Collect_finite_subset)
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  4164
  ultimately
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  4165
  obtain D where "D \<subseteq> C" "finite D" "s \<subseteq> \<Union>D"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  4166
    by (rule countably_compactE)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4167
  then obtain E where E: "E \<subseteq> {F. finite F \<and> F \<subseteq> t }" "finite E"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4168
    and s: "s \<subseteq> (\<Union>F\<in>E. interior (F \<union> (- t)))"
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4169
    by (metis (lifting) Union_image_eq finite_subset_image C_def)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4170
  from s \<open>t \<subseteq> s\<close> have "t \<subseteq> \<Union>E"
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4171
    using interior_subset by blast
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4172
  moreover have "finite (\<Union>E)"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4173
    using E by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4174
  ultimately show False using \<open>infinite t\<close>
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4175
    by (auto simp: finite_subset)
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4176
qed
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4177
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4178
lemma countable_acc_point_imp_seq_compact:
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4179
  fixes s :: "'a::first_countable_topology set"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  4180
  assumes "\<forall>t. infinite t \<and> countable t \<and> t \<subseteq> s \<longrightarrow>
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  4181
    (\<exists>x\<in>s. \<forall>U. x\<in>U \<and> open U \<longrightarrow> infinite (U \<inter> t))"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4182
  shows "seq_compact s"
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4183
proof -
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4184
  {
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4185
    fix f :: "nat \<Rightarrow> 'a"
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4186
    assume f: "\<forall>n. f n \<in> s"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  4187
    have "\<exists>l\<in>s. \<exists>r. subseq r \<and> ((f \<circ> r) \<longlongrightarrow> l) sequentially"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4188
    proof (cases "finite (range f)")
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4189
      case True
50941
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  4190
      obtain l where "infinite {n. f n = f l}"
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  4191
        using pigeonhole_infinite[OF _ True] by auto
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  4192
      then obtain r where "subseq r" and fr: "\<forall>n. f (r n) = f l"
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  4193
        using infinite_enumerate by blast
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4194
      then have "subseq r \<and> (f \<circ> r) \<longlonglongrightarrow> f l"
58729
e8ecc79aee43 add tendsto_const and tendsto_ident_at as simp and intro rules
hoelzl
parents: 58184
diff changeset
  4195
        by (simp add: fr o_def)
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4196
      with f show "\<exists>l\<in>s. \<exists>r. subseq r \<and> (f \<circ> r) \<longlonglongrightarrow> l"
50941
3690724028b1 add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
hoelzl
parents: 50940
diff changeset
  4197
        by auto
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4198
    next
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4199
      case False
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4200
      with f assms have "\<exists>x\<in>s. \<forall>U. x\<in>U \<and> open U \<longrightarrow> infinite (U \<inter> range f)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4201
        by auto
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4202
      then obtain l where "l \<in> s" "\<forall>U. l\<in>U \<and> open U \<longrightarrow> infinite (U \<inter> range f)" ..
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  4203
      from this(2) have "\<exists>r. subseq r \<and> ((f \<circ> r) \<longlongrightarrow> l) sequentially"
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4204
        using acc_point_range_imp_convergent_subsequence[of l f] by auto
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  4205
      with \<open>l \<in> s\<close> show "\<exists>l\<in>s. \<exists>r. subseq r \<and> ((f \<circ> r) \<longlongrightarrow> l) sequentially" ..
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4206
    qed
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4207
  }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4208
  then show ?thesis
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4209
    unfolding seq_compact_def by auto
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4210
qed
44075
5952bd355779 generalize more lemmas about compactness
huffman
parents: 44074
diff changeset
  4211
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4212
lemma seq_compact_eq_countably_compact:
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4213
  fixes U :: "'a :: first_countable_topology set"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4214
  shows "seq_compact U \<longleftrightarrow> countably_compact U"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4215
  using
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4216
    countable_acc_point_imp_seq_compact
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4217
    countably_compact_imp_acc_point
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4218
    seq_compact_imp_countably_compact
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4219
  by metis
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4220
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4221
lemma seq_compact_eq_acc_point:
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4222
  fixes s :: "'a :: first_countable_topology set"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  4223
  shows "seq_compact s \<longleftrightarrow>
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  4224
    (\<forall>t. infinite t \<and> countable t \<and> t \<subseteq> s --> (\<exists>x\<in>s. \<forall>U. x\<in>U \<and> open U \<longrightarrow> infinite (U \<inter> t)))"
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4225
  using
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4226
    countable_acc_point_imp_seq_compact[of s]
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4227
    countably_compact_imp_acc_point[of s]
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4228
    seq_compact_imp_countably_compact[of s]
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4229
  by metis
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4230
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4231
lemma seq_compact_eq_compact:
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4232
  fixes U :: "'a :: second_countable_topology set"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4233
  shows "seq_compact U \<longleftrightarrow> compact U"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4234
  using seq_compact_eq_countably_compact countably_compact_eq_compact by blast
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4235
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4236
lemma bolzano_weierstrass_imp_seq_compact:
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4237
  fixes s :: "'a::{t1_space, first_countable_topology} set"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4238
  shows "\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t) \<Longrightarrow> seq_compact s"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4239
  by (rule countable_acc_point_imp_seq_compact) (metis islimpt_eq_acc_point)
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4240
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4241
subsubsection\<open>Totally bounded\<close>
50940
a7c273a83d27 group compactness-eq-seq-compactness lemmas together
hoelzl
parents: 50939
diff changeset
  4242
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4243
lemma cauchy_def: "Cauchy s \<longleftrightarrow> (\<forall>e>0. \<exists>N. \<forall>m n. m \<ge> N \<and> n \<ge> N --> dist(s m)(s n) < e)"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4244
  unfolding Cauchy_def by metis
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4245
50940
a7c273a83d27 group compactness-eq-seq-compactness lemmas together
hoelzl
parents: 50939
diff changeset
  4246
lemma seq_compact_imp_totally_bounded:
a7c273a83d27 group compactness-eq-seq-compactness lemmas together
hoelzl
parents: 50939
diff changeset
  4247
  assumes "seq_compact s"
58184
db1381d811ab cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents: 57865
diff changeset
  4248
  shows "\<forall>e>0. \<exists>k. finite k \<and> k \<subseteq> s \<and> s \<subseteq> (\<Union>x\<in>k. ball x e)"
db1381d811ab cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents: 57865
diff changeset
  4249
proof -
db1381d811ab cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents: 57865
diff changeset
  4250
  { fix e::real assume "e > 0" assume *: "\<And>k. finite k \<Longrightarrow> k \<subseteq> s \<Longrightarrow> \<not> s \<subseteq> (\<Union>x\<in>k. ball x e)"
db1381d811ab cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents: 57865
diff changeset
  4251
    let ?Q = "\<lambda>x n r. r \<in> s \<and> (\<forall>m < (n::nat). \<not> (dist (x m) r < e))"
db1381d811ab cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents: 57865
diff changeset
  4252
    have "\<exists>x. \<forall>n::nat. ?Q x n (x n)"
db1381d811ab cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents: 57865
diff changeset
  4253
    proof (rule dependent_wellorder_choice)
db1381d811ab cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents: 57865
diff changeset
  4254
      fix n x assume "\<And>y. y < n \<Longrightarrow> ?Q x y (x y)"
db1381d811ab cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents: 57865
diff changeset
  4255
      then have "\<not> s \<subseteq> (\<Union>x\<in>x ` {0..<n}. ball x e)"
db1381d811ab cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents: 57865
diff changeset
  4256
        using *[of "x ` {0 ..< n}"] by (auto simp: subset_eq)
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4257
      then obtain z where z:"z\<in>s" "z \<notin> (\<Union>x\<in>x ` {0..<n}. ball x e)"
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4258
        unfolding subset_eq by auto
58184
db1381d811ab cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents: 57865
diff changeset
  4259
      show "\<exists>r. ?Q x n r"
db1381d811ab cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents: 57865
diff changeset
  4260
        using z by auto
db1381d811ab cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents: 57865
diff changeset
  4261
    qed simp
db1381d811ab cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents: 57865
diff changeset
  4262
    then obtain x where "\<forall>n::nat. x n \<in> s" and x:"\<And>n m. m < n \<Longrightarrow> \<not> (dist (x m) (x n) < e)"
db1381d811ab cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents: 57865
diff changeset
  4263
      by blast
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  4264
    then obtain l r where "l \<in> s" and r:"subseq r" and "((x \<circ> r) \<longlongrightarrow> l) sequentially"
58184
db1381d811ab cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents: 57865
diff changeset
  4265
      using assms by (metis seq_compact_def)
db1381d811ab cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents: 57865
diff changeset
  4266
    from this(3) have "Cauchy (x \<circ> r)"
db1381d811ab cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents: 57865
diff changeset
  4267
      using LIMSEQ_imp_Cauchy by auto
db1381d811ab cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents: 57865
diff changeset
  4268
    then obtain N::nat where "\<And>m n. N \<le> m \<Longrightarrow> N \<le> n \<Longrightarrow> dist ((x \<circ> r) m) ((x \<circ> r) n) < e"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4269
      unfolding cauchy_def using \<open>e > 0\<close> by blast
58184
db1381d811ab cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents: 57865
diff changeset
  4270
    then have False
db1381d811ab cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents: 57865
diff changeset
  4271
      using x[of "r N" "r (N+1)"] r by (auto simp: subseq_def) }
db1381d811ab cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents: 57865
diff changeset
  4272
  then show ?thesis
db1381d811ab cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents: 57865
diff changeset
  4273
    by metis
50940
a7c273a83d27 group compactness-eq-seq-compactness lemmas together
hoelzl
parents: 50939
diff changeset
  4274
qed
a7c273a83d27 group compactness-eq-seq-compactness lemmas together
hoelzl
parents: 50939
diff changeset
  4275
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4276
subsubsection\<open>Heine-Borel theorem\<close>
50940
a7c273a83d27 group compactness-eq-seq-compactness lemmas together
hoelzl
parents: 50939
diff changeset
  4277
a7c273a83d27 group compactness-eq-seq-compactness lemmas together
hoelzl
parents: 50939
diff changeset
  4278
lemma seq_compact_imp_heine_borel:
a7c273a83d27 group compactness-eq-seq-compactness lemmas together
hoelzl
parents: 50939
diff changeset
  4279
  fixes s :: "'a :: metric_space set"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4280
  assumes "seq_compact s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4281
  shows "compact s"
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4282
proof -
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4283
  from seq_compact_imp_totally_bounded[OF \<open>seq_compact s\<close>]
58184
db1381d811ab cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents: 57865
diff changeset
  4284
  obtain f where f: "\<forall>e>0. finite (f e) \<and> f e \<subseteq> s \<and> s \<subseteq> (\<Union>x\<in>f e. ball x e)"
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  4285
    unfolding choice_iff' ..
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4286
  def K \<equiv> "(\<lambda>(x, r). ball x r) ` ((\<Union>e \<in> \<rat> \<inter> {0 <..}. f e) \<times> \<rat>)"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4287
  have "countably_compact s"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4288
    using \<open>seq_compact s\<close> by (rule seq_compact_imp_countably_compact)
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4289
  then show "compact s"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4290
  proof (rule countably_compact_imp_compact)
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4291
    show "countable K"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4292
      unfolding K_def using f
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4293
      by (auto intro: countable_finite countable_subset countable_rat
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4294
               intro!: countable_image countable_SIGMA countable_UN)
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4295
    show "\<forall>b\<in>K. open b" by (auto simp: K_def)
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4296
  next
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4297
    fix T x
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4298
    assume T: "open T" "x \<in> T" and x: "x \<in> s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4299
    from openE[OF T] obtain e where "0 < e" "ball x e \<subseteq> T"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4300
      by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4301
    then have "0 < e / 2" "ball x (e / 2) \<subseteq> T"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4302
      by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4303
    from Rats_dense_in_real[OF \<open>0 < e / 2\<close>] obtain r where "r \<in> \<rat>" "0 < r" "r < e / 2"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4304
      by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4305
    from f[rule_format, of r] \<open>0 < r\<close> \<open>x \<in> s\<close> obtain k where "k \<in> f r" "x \<in> ball k r"
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4306
      unfolding Union_image_eq by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4307
    from \<open>r \<in> \<rat>\<close> \<open>0 < r\<close> \<open>k \<in> f r\<close> have "ball k r \<in> K"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4308
      by (auto simp: K_def)
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4309
    then show "\<exists>b\<in>K. x \<in> b \<and> b \<inter> s \<subseteq> T"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4310
    proof (rule bexI[rotated], safe)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4311
      fix y
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4312
      assume "y \<in> ball k r"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4313
      with \<open>r < e / 2\<close> \<open>x \<in> ball k r\<close> have "dist x y < e"
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4314
        by (intro dist_double[where x = k and d=e]) (auto simp: dist_commute)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4315
      with \<open>ball x e \<subseteq> T\<close> show "y \<in> T"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4316
        by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4317
    next
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4318
      show "x \<in> ball k r" by fact
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4319
    qed
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  4320
  qed
50940
a7c273a83d27 group compactness-eq-seq-compactness lemmas together
hoelzl
parents: 50939
diff changeset
  4321
qed
a7c273a83d27 group compactness-eq-seq-compactness lemmas together
hoelzl
parents: 50939
diff changeset
  4322
a7c273a83d27 group compactness-eq-seq-compactness lemmas together
hoelzl
parents: 50939
diff changeset
  4323
lemma compact_eq_seq_compact_metric:
a7c273a83d27 group compactness-eq-seq-compactness lemmas together
hoelzl
parents: 50939
diff changeset
  4324
  "compact (s :: 'a::metric_space set) \<longleftrightarrow> seq_compact s"
a7c273a83d27 group compactness-eq-seq-compactness lemmas together
hoelzl
parents: 50939
diff changeset
  4325
  using compact_imp_seq_compact seq_compact_imp_heine_borel by blast
a7c273a83d27 group compactness-eq-seq-compactness lemmas together
hoelzl
parents: 50939
diff changeset
  4326
a7c273a83d27 group compactness-eq-seq-compactness lemmas together
hoelzl
parents: 50939
diff changeset
  4327
lemma compact_def:
a7c273a83d27 group compactness-eq-seq-compactness lemmas together
hoelzl
parents: 50939
diff changeset
  4328
  "compact (S :: 'a::metric_space set) \<longleftrightarrow>
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4329
   (\<forall>f. (\<forall>n. f n \<in> S) \<longrightarrow> (\<exists>l\<in>S. \<exists>r. subseq r \<and> (f \<circ> r) \<longlonglongrightarrow> l))"
50940
a7c273a83d27 group compactness-eq-seq-compactness lemmas together
hoelzl
parents: 50939
diff changeset
  4330
  unfolding compact_eq_seq_compact_metric seq_compact_def by auto
a7c273a83d27 group compactness-eq-seq-compactness lemmas together
hoelzl
parents: 50939
diff changeset
  4331
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4332
subsubsection \<open>Complete the chain of compactness variants\<close>
50944
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  4333
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  4334
lemma compact_eq_bolzano_weierstrass:
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  4335
  fixes s :: "'a::metric_space set"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4336
  shows "compact s \<longleftrightarrow> (\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t))"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4337
  (is "?lhs = ?rhs")
50944
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  4338
proof
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4339
  assume ?lhs
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4340
  then show ?rhs
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4341
    using heine_borel_imp_bolzano_weierstrass[of s] by auto
50944
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  4342
next
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4343
  assume ?rhs
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4344
  then show ?lhs
50944
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  4345
    unfolding compact_eq_seq_compact_metric by (rule bolzano_weierstrass_imp_seq_compact)
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  4346
qed
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  4347
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  4348
lemma bolzano_weierstrass_imp_bounded:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4349
  "\<forall>t. infinite t \<and> t \<subseteq> s \<longrightarrow> (\<exists>x \<in> s. x islimpt t) \<Longrightarrow> bounded s"
50944
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  4350
  using compact_imp_bounded unfolding compact_eq_bolzano_weierstrass .
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  4351
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4352
subsection \<open>Metric spaces with the Heine-Borel property\<close>
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4353
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4354
text \<open>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4355
  A metric space (or topological vector space) is said to have the
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4356
  Heine-Borel property if every closed and bounded subset is compact.
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4357
\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4358
44207
ea99698c2070 locale-ize some definitions, so perfect_space and heine_borel can inherit from the proper superclasses
huffman
parents: 44170
diff changeset
  4359
class heine_borel = metric_space +
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4360
  assumes bounded_imp_convergent_subsequence:
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  4361
    "bounded (range f) \<Longrightarrow> \<exists>l r. subseq r \<and> ((f \<circ> r) \<longlongrightarrow> l) sequentially"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4362
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4363
lemma bounded_closed_imp_seq_compact:
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4364
  fixes s::"'a::heine_borel set"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4365
  assumes "bounded s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4366
    and "closed s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4367
  shows "seq_compact s"
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  4368
proof (unfold seq_compact_def, clarify)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4369
  fix f :: "nat \<Rightarrow> 'a"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4370
  assume f: "\<forall>n. f n \<in> s"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4371
  with \<open>bounded s\<close> have "bounded (range f)"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4372
    by (auto intro: bounded_subset)
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  4373
  obtain l r where r: "subseq r" and l: "((f \<circ> r) \<longlongrightarrow> l) sequentially"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4374
    using bounded_imp_convergent_subsequence [OF \<open>bounded (range f)\<close>] by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4375
  from f have fr: "\<forall>n. (f \<circ> r) n \<in> s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4376
    by simp
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4377
  have "l \<in> s" using \<open>closed s\<close> fr l
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4378
    by (rule closed_sequentially)
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  4379
  show "\<exists>l\<in>s. \<exists>r. subseq r \<and> ((f \<circ> r) \<longlongrightarrow> l) sequentially"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4380
    using \<open>l \<in> s\<close> r l by blast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4381
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4382
50944
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  4383
lemma compact_eq_bounded_closed:
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  4384
  fixes s :: "'a::heine_borel set"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  4385
  shows "compact s \<longleftrightarrow> bounded s \<and> closed s"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  4386
  (is "?lhs = ?rhs")
50944
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  4387
proof
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4388
  assume ?lhs
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4389
  then show ?rhs
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4390
    using compact_imp_closed compact_imp_bounded
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4391
    by blast
50944
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  4392
next
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4393
  assume ?rhs
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4394
  then show ?lhs
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4395
    using bounded_closed_imp_seq_compact[of s]
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4396
    unfolding compact_eq_seq_compact_metric
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4397
    by auto
50944
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  4398
qed
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  4399
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  4400
lemma compact_components:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  4401
  fixes s :: "'a::heine_borel set"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  4402
  shows "\<lbrakk>compact s; c \<in> components s\<rbrakk> \<Longrightarrow> compact c"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  4403
by (meson bounded_subset closed_components in_components_subset compact_eq_bounded_closed)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  4404
50973
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  4405
(* TODO: is this lemma necessary? *)
50972
d2c6a0a7fcdf tuned proof
hoelzl
parents: 50971
diff changeset
  4406
lemma bounded_increasing_convergent:
d2c6a0a7fcdf tuned proof
hoelzl
parents: 50971
diff changeset
  4407
  fixes s :: "nat \<Rightarrow> real"
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4408
  shows "bounded {s n| n. True} \<Longrightarrow> \<forall>n. s n \<le> s (Suc n) \<Longrightarrow> \<exists>l. s \<longlonglongrightarrow> l"
50972
d2c6a0a7fcdf tuned proof
hoelzl
parents: 50971
diff changeset
  4409
  using Bseq_mono_convergent[of s] incseq_Suc_iff[of s]
d2c6a0a7fcdf tuned proof
hoelzl
parents: 50971
diff changeset
  4410
  by (auto simp: image_def Bseq_eq_bounded convergent_def incseq_def)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4411
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4412
instance real :: heine_borel
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4413
proof
50998
501200635659 simplify heine_borel type class
hoelzl
parents: 50973
diff changeset
  4414
  fix f :: "nat \<Rightarrow> real"
501200635659 simplify heine_borel type class
hoelzl
parents: 50973
diff changeset
  4415
  assume f: "bounded (range f)"
50972
d2c6a0a7fcdf tuned proof
hoelzl
parents: 50971
diff changeset
  4416
  obtain r where r: "subseq r" "monoseq (f \<circ> r)"
d2c6a0a7fcdf tuned proof
hoelzl
parents: 50971
diff changeset
  4417
    unfolding comp_def by (metis seq_monosub)
d2c6a0a7fcdf tuned proof
hoelzl
parents: 50971
diff changeset
  4418
  then have "Bseq (f \<circ> r)"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61552
diff changeset
  4419
    unfolding Bseq_eq_bounded using f by (force intro: bounded_subset)
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4420
  with r show "\<exists>l r. subseq r \<and> (f \<circ> r) \<longlonglongrightarrow> l"
50972
d2c6a0a7fcdf tuned proof
hoelzl
parents: 50971
diff changeset
  4421
    using Bseq_monoseq_convergent[of "f \<circ> r"] by (auto simp: convergent_def)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4422
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4423
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4424
lemma compact_lemma:
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 37452
diff changeset
  4425
  fixes f :: "nat \<Rightarrow> 'a::euclidean_space"
50998
501200635659 simplify heine_borel type class
hoelzl
parents: 50973
diff changeset
  4426
  assumes "bounded (range f)"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  4427
  shows "\<forall>d\<subseteq>Basis. \<exists>l::'a. \<exists> r.
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  4428
    subseq r \<and> (\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r n) \<bullet> i) (l \<bullet> i) < e) sequentially)"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  4429
proof safe
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4430
  fix d :: "'a set"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4431
  assume d: "d \<subseteq> Basis"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4432
  with finite_Basis have "finite d"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4433
    by (blast intro: finite_subset)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  4434
  from this d show "\<exists>l::'a. \<exists>r. subseq r \<and>
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4435
    (\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r n) \<bullet> i) (l \<bullet> i) < e) sequentially)"
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4436
  proof (induct d)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4437
    case empty
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4438
    then show ?case
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4439
      unfolding subseq_def by auto
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4440
  next
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4441
    case (insert k d)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4442
    have k[intro]: "k \<in> Basis"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4443
      using insert by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4444
    have s': "bounded ((\<lambda>x. x \<bullet> k) ` range f)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4445
      using \<open>bounded (range f)\<close>
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  4446
      by (auto intro!: bounded_linear_image bounded_linear_inner_left)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4447
    obtain l1::"'a" and r1 where r1: "subseq r1"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4448
      and lr1: "\<forall>e > 0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 n) \<bullet> i) (l1 \<bullet> i) < e) sequentially"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 37452
diff changeset
  4449
      using insert(3) using insert(4) by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4450
    have f': "\<forall>n. f (r1 n) \<bullet> k \<in> (\<lambda>x. x \<bullet> k) ` range f"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4451
      by simp
50998
501200635659 simplify heine_borel type class
hoelzl
parents: 50973
diff changeset
  4452
    have "bounded (range (\<lambda>i. f (r1 i) \<bullet> k))"
501200635659 simplify heine_borel type class
hoelzl
parents: 50973
diff changeset
  4453
      by (metis (lifting) bounded_subset f' image_subsetI s')
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  4454
    then obtain l2 r2 where r2:"subseq r2" and lr2:"((\<lambda>i. f (r1 (r2 i)) \<bullet> k) \<longlongrightarrow> l2) sequentially"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4455
      using bounded_imp_convergent_subsequence[of "\<lambda>i. f (r1 i) \<bullet> k"]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4456
      by (auto simp: o_def)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4457
    def r \<equiv> "r1 \<circ> r2"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4458
    have r:"subseq r"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4459
      using r1 and r2 unfolding r_def o_def subseq_def by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4460
    moreover
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  4461
    def l \<equiv> "(\<Sum>i\<in>Basis. (if i = k then l2 else l1\<bullet>i) *\<^sub>R i)::'a"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4462
    {
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4463
      fix e::real
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4464
      assume "e > 0"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4465
      from lr1 \<open>e > 0\<close> have N1: "eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 n) \<bullet> i) (l1 \<bullet> i) < e) sequentially"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4466
        by blast
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4467
      from lr2 \<open>e > 0\<close> have N2:"eventually (\<lambda>n. dist (f (r1 (r2 n)) \<bullet> k) l2 < e) sequentially"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4468
        by (rule tendstoD)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  4469
      from r2 N1 have N1': "eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 (r2 n)) \<bullet> i) (l1 \<bullet> i) < e) sequentially"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4470
        by (rule eventually_subseq)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  4471
      have "eventually (\<lambda>n. \<forall>i\<in>(insert k d). dist (f (r n) \<bullet> i) (l \<bullet> i) < e) sequentially"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4472
        using N1' N2
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  4473
        by eventually_elim (insert insert.prems, auto simp: l_def r_def o_def)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4474
    }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4475
    ultimately show ?case by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4476
  qed
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 37452
diff changeset
  4477
qed
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 37452
diff changeset
  4478
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 37452
diff changeset
  4479
instance euclidean_space \<subseteq> heine_borel
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4480
proof
50998
501200635659 simplify heine_borel type class
hoelzl
parents: 50973
diff changeset
  4481
  fix f :: "nat \<Rightarrow> 'a"
501200635659 simplify heine_borel type class
hoelzl
parents: 50973
diff changeset
  4482
  assume f: "bounded (range f)"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 37452
diff changeset
  4483
  then obtain l::'a and r where r: "subseq r"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  4484
    and l: "\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>Basis. dist (f (r n) \<bullet> i) (l \<bullet> i) < e) sequentially"
50998
501200635659 simplify heine_borel type class
hoelzl
parents: 50973
diff changeset
  4485
    using compact_lemma [OF f] by blast
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4486
  {
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4487
    fix e::real
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4488
    assume "e > 0"
56541
0e3abadbef39 made divide_pos_pos a simp rule
nipkow
parents: 56371
diff changeset
  4489
    hence "e / real_of_nat DIM('a) > 0" by (simp add: DIM_positive)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  4490
    with l have "eventually (\<lambda>n. \<forall>i\<in>Basis. dist (f (r n) \<bullet> i) (l \<bullet> i) < e / (real_of_nat DIM('a))) sequentially"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4491
      by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4492
    moreover
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4493
    {
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4494
      fix n
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4495
      assume n: "\<forall>i\<in>Basis. dist (f (r n) \<bullet> i) (l \<bullet> i) < e / (real_of_nat DIM('a))"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  4496
      have "dist (f (r n)) l \<le> (\<Sum>i\<in>Basis. dist (f (r n) \<bullet> i) (l \<bullet> i))"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4497
        apply (subst euclidean_dist_l2)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4498
        using zero_le_dist
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4499
        apply (rule setL2_le_setsum)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4500
        done
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  4501
      also have "\<dots> < (\<Sum>i\<in>(Basis::'a set). e / (real_of_nat DIM('a)))"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4502
        apply (rule setsum_strict_mono)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4503
        using n
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4504
        apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4505
        done
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4506
      finally have "dist (f (r n)) l < e"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  4507
        by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4508
    }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4509
    ultimately have "eventually (\<lambda>n. dist (f (r n)) l < e) sequentially"
61810
3c5040d5694a sorted out eventually_mono
paulson <lp15@cam.ac.uk>
parents: 61808
diff changeset
  4510
      by (rule eventually_mono)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4511
  }
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  4512
  then have *: "((f \<circ> r) \<longlongrightarrow> l) sequentially"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4513
    unfolding o_def tendsto_iff by simp
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  4514
  with r show "\<exists>l r. subseq r \<and> ((f \<circ> r) \<longlongrightarrow> l) sequentially"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4515
    by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4516
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4517
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4518
lemma bounded_fst: "bounded s \<Longrightarrow> bounded (fst ` s)"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4519
  unfolding bounded_def
55775
1557a391a858 A bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 55522
diff changeset
  4520
  by (metis (erased, hide_lams) dist_fst_le image_iff order_trans)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4521
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4522
lemma bounded_snd: "bounded s \<Longrightarrow> bounded (snd ` s)"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4523
  unfolding bounded_def
55775
1557a391a858 A bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 55522
diff changeset
  4524
  by (metis (no_types, hide_lams) dist_snd_le image_iff order.trans)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4525
37678
0040bafffdef "prod" and "sum" replace "*" and "+" respectively
haftmann
parents: 37649
diff changeset
  4526
instance prod :: (heine_borel, heine_borel) heine_borel
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4527
proof
50998
501200635659 simplify heine_borel type class
hoelzl
parents: 50973
diff changeset
  4528
  fix f :: "nat \<Rightarrow> 'a \<times> 'b"
501200635659 simplify heine_borel type class
hoelzl
parents: 50973
diff changeset
  4529
  assume f: "bounded (range f)"
56154
f0a927235162 more complete set of lemmas wrt. image and composition
haftmann
parents: 56073
diff changeset
  4530
  then have "bounded (fst ` range f)"
f0a927235162 more complete set of lemmas wrt. image and composition
haftmann
parents: 56073
diff changeset
  4531
    by (rule bounded_fst)
f0a927235162 more complete set of lemmas wrt. image and composition
haftmann
parents: 56073
diff changeset
  4532
  then have s1: "bounded (range (fst \<circ> f))"
f0a927235162 more complete set of lemmas wrt. image and composition
haftmann
parents: 56073
diff changeset
  4533
    by (simp add: image_comp)
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4534
  obtain l1 r1 where r1: "subseq r1" and l1: "(\<lambda>n. fst (f (r1 n))) \<longlonglongrightarrow> l1"
50998
501200635659 simplify heine_borel type class
hoelzl
parents: 50973
diff changeset
  4535
    using bounded_imp_convergent_subsequence [OF s1] unfolding o_def by fast
501200635659 simplify heine_borel type class
hoelzl
parents: 50973
diff changeset
  4536
  from f have s2: "bounded (range (snd \<circ> f \<circ> r1))"
501200635659 simplify heine_borel type class
hoelzl
parents: 50973
diff changeset
  4537
    by (auto simp add: image_comp intro: bounded_snd bounded_subset)
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  4538
  obtain l2 r2 where r2: "subseq r2" and l2: "((\<lambda>n. snd (f (r1 (r2 n)))) \<longlongrightarrow> l2) sequentially"
50998
501200635659 simplify heine_borel type class
hoelzl
parents: 50973
diff changeset
  4539
    using bounded_imp_convergent_subsequence [OF s2]
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4540
    unfolding o_def by fast
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  4541
  have l1': "((\<lambda>n. fst (f (r1 (r2 n)))) \<longlongrightarrow> l1) sequentially"
50972
d2c6a0a7fcdf tuned proof
hoelzl
parents: 50971
diff changeset
  4542
    using LIMSEQ_subseq_LIMSEQ [OF l1 r2] unfolding o_def .
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  4543
  have l: "((f \<circ> (r1 \<circ> r2)) \<longlongrightarrow> (l1, l2)) sequentially"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4544
    using tendsto_Pair [OF l1' l2] unfolding o_def by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4545
  have r: "subseq (r1 \<circ> r2)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4546
    using r1 r2 unfolding subseq_def by simp
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  4547
  show "\<exists>l r. subseq r \<and> ((f \<circ> r) \<longlongrightarrow> l) sequentially"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4548
    using l r by fast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4549
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4550
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4551
subsubsection \<open>Completeness\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4552
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4553
definition complete :: "'a::metric_space set \<Rightarrow> bool"
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4554
  where "complete s \<longleftrightarrow> (\<forall>f. (\<forall>n. f n \<in> s) \<and> Cauchy f \<longrightarrow> (\<exists>l\<in>s. f \<longlonglongrightarrow> l))"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4555
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4556
lemma completeI:
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4557
  assumes "\<And>f. \<forall>n. f n \<in> s \<Longrightarrow> Cauchy f \<Longrightarrow> \<exists>l\<in>s. f \<longlonglongrightarrow> l"
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4558
  shows "complete s"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4559
  using assms unfolding complete_def by fast
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4560
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4561
lemma completeE:
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4562
  assumes "complete s" and "\<forall>n. f n \<in> s" and "Cauchy f"
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4563
  obtains l where "l \<in> s" and "f \<longlonglongrightarrow> l"
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4564
  using assms unfolding complete_def by fast
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4565
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4566
lemma compact_imp_complete:
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4567
  assumes "compact s"
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4568
  shows "complete s"
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4569
proof -
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4570
  {
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4571
    fix f
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4572
    assume as: "(\<forall>n::nat. f n \<in> s)" "Cauchy f"
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4573
    from as(1) obtain l r where lr: "l\<in>s" "subseq r" "(f \<circ> r) \<longlonglongrightarrow> l"
50971
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4574
      using assms unfolding compact_def by blast
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4575
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4576
    note lr' = seq_suble [OF lr(2)]
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4577
    {
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4578
      fix e :: real
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4579
      assume "e > 0"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4580
      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"
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4581
        unfolding cauchy_def
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4582
        using \<open>e > 0\<close>
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4583
        apply (erule_tac x="e/2" in allE)
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4584
        apply auto
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4585
        done
60017
b785d6d06430 Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents: 59815
diff changeset
  4586
      from lr(3)[unfolded lim_sequentially, THEN spec[where x="e/2"]]
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4587
      obtain M where M:"\<forall>n\<ge>M. dist ((f \<circ> r) n) l < e/2"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4588
        using \<open>e > 0\<close> by auto
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4589
      {
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4590
        fix n :: nat
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4591
        assume n: "n \<ge> max N M"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4592
        have "dist ((f \<circ> r) n) l < e/2"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4593
          using n M by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4594
        moreover have "r n \<ge> N"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4595
          using lr'[of n] n by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4596
        then have "dist (f n) ((f \<circ> r) n) < e / 2"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4597
          using N and n by auto
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4598
        ultimately have "dist (f n) l < e"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4599
          using dist_triangle_half_r[of "f (r n)" "f n" e l]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4600
          by (auto simp add: dist_commute)
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4601
      }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4602
      then have "\<exists>N. \<forall>n\<ge>N. dist (f n) l < e" by blast
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4603
    }
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  4604
    then have "\<exists>l\<in>s. (f \<longlongrightarrow> l) sequentially" using \<open>l\<in>s\<close>
60017
b785d6d06430 Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents: 59815
diff changeset
  4605
      unfolding lim_sequentially by auto
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4606
  }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4607
  then show ?thesis unfolding complete_def by auto
50971
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4608
qed
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4609
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4610
lemma nat_approx_posE:
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4611
  fixes e::real
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4612
  assumes "0 < e"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4613
  obtains n :: nat where "1 / (Suc n) < e"
50971
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4614
proof atomize_elim
61942
f02b26f7d39d prefer symbols for "floor", "ceiling";
wenzelm
parents: 61915
diff changeset
  4615
  have "1 / real (Suc (nat \<lceil>1/e\<rceil>)) < 1 / \<lceil>1/e\<rceil>"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4616
    by (rule divide_strict_left_mono) (auto simp: \<open>0 < e\<close>)
61942
f02b26f7d39d prefer symbols for "floor", "ceiling";
wenzelm
parents: 61915
diff changeset
  4617
  also have "1 / \<lceil>1/e\<rceil> \<le> 1 / (1/e)"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61552
diff changeset
  4618
    by (rule divide_left_mono) (auto simp: \<open>0 < e\<close> ceiling_correct)
50971
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4619
  also have "\<dots> = e" by simp
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4620
  finally show  "\<exists>n. 1 / real (Suc n) < e" ..
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4621
qed
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4622
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4623
lemma compact_eq_totally_bounded:
58184
db1381d811ab cleanup Wfrec; introduce dependent_wf/wellorder_choice
hoelzl
parents: 57865
diff changeset
  4624
  "compact s \<longleftrightarrow> complete s \<and> (\<forall>e>0. \<exists>k. finite k \<and> s \<subseteq> (\<Union>x\<in>k. ball x e))"
50971
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4625
    (is "_ \<longleftrightarrow> ?rhs")
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4626
proof
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4627
  assume assms: "?rhs"
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4628
  then obtain k where k: "\<And>e. 0 < e \<Longrightarrow> finite (k e)" "\<And>e. 0 < e \<Longrightarrow> s \<subseteq> (\<Union>x\<in>k e. ball x e)"
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4629
    by (auto simp: choice_iff')
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4630
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4631
  show "compact s"
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4632
  proof cases
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4633
    assume "s = {}"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4634
    then show "compact s" by (simp add: compact_def)
50971
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4635
  next
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4636
    assume "s \<noteq> {}"
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4637
    show ?thesis
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4638
      unfolding compact_def
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4639
    proof safe
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4640
      fix f :: "nat \<Rightarrow> 'a"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4641
      assume f: "\<forall>n. f n \<in> s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4642
50971
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4643
      def e \<equiv> "\<lambda>n. 1 / (2 * Suc n)"
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4644
      then have [simp]: "\<And>n. 0 < e n" by auto
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4645
      def B \<equiv> "\<lambda>n U. SOME b. infinite {n. f n \<in> b} \<and> (\<exists>x. b \<subseteq> ball x (e n) \<inter> U)"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4646
      {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4647
        fix n U
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4648
        assume "infinite {n. f n \<in> U}"
50971
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4649
        then have "\<exists>b\<in>k (e n). infinite {i\<in>{n. f n \<in> U}. f i \<in> ball b (e n)}"
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4650
          using k f by (intro pigeonhole_infinite_rel) (auto simp: subset_eq)
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  4651
        then obtain a where
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  4652
          "a \<in> k (e n)"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  4653
          "infinite {i \<in> {n. f n \<in> U}. f i \<in> ball a (e n)}" ..
50971
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4654
        then have "\<exists>b. infinite {i. f i \<in> b} \<and> (\<exists>x. b \<subseteq> ball x (e n) \<inter> U)"
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4655
          by (intro exI[of _ "ball a (e n) \<inter> U"] exI[of _ a]) (auto simp: ac_simps)
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4656
        from someI_ex[OF this]
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4657
        have "infinite {i. f i \<in> B n U}" "\<exists>x. B n U \<subseteq> ball x (e n) \<inter> U"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4658
          unfolding B_def by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4659
      }
50971
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4660
      note B = this
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4661
55415
05f5fdb8d093 renamed 'nat_{case,rec}' to '{case,rec}_nat'
blanchet
parents: 54863
diff changeset
  4662
      def F \<equiv> "rec_nat (B 0 UNIV) B"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4663
      {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4664
        fix n
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4665
        have "infinite {i. f i \<in> F n}"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4666
          by (induct n) (auto simp: F_def B)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4667
      }
50971
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4668
      then have F: "\<And>n. \<exists>x. F (Suc n) \<subseteq> ball x (e n) \<inter> F n"
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4669
        using B by (simp add: F_def)
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4670
      then have F_dec: "\<And>m n. m \<le> n \<Longrightarrow> F n \<subseteq> F m"
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4671
        using decseq_SucI[of F] by (auto simp: decseq_def)
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4672
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4673
      obtain sel where sel: "\<And>k i. i < sel k i" "\<And>k i. f (sel k i) \<in> F k"
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4674
      proof (atomize_elim, unfold all_conj_distrib[symmetric], intro choice allI)
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4675
        fix k i
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4676
        have "infinite ({n. f n \<in> F k} - {.. i})"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4677
          using \<open>infinite {n. f n \<in> F k}\<close> by auto
50971
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4678
        from infinite_imp_nonempty[OF this]
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4679
        show "\<exists>x>i. f x \<in> F k"
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4680
          by (simp add: set_eq_iff not_le conj_commute)
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4681
      qed
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4682
55415
05f5fdb8d093 renamed 'nat_{case,rec}' to '{case,rec}_nat'
blanchet
parents: 54863
diff changeset
  4683
      def t \<equiv> "rec_nat (sel 0 0) (\<lambda>n i. sel (Suc n) i)"
50971
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4684
      have "subseq t"
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4685
        unfolding subseq_Suc_iff by (simp add: t_def sel)
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4686
      moreover have "\<forall>i. (f \<circ> t) i \<in> s"
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4687
        using f by auto
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4688
      moreover
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4689
      {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4690
        fix n
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4691
        have "(f \<circ> t) n \<in> F n"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4692
          by (cases n) (simp_all add: t_def sel)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4693
      }
50971
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4694
      note t = this
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4695
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4696
      have "Cauchy (f \<circ> t)"
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4697
      proof (safe intro!: metric_CauchyI exI elim!: nat_approx_posE)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4698
        fix r :: real and N n m
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4699
        assume "1 / Suc N < r" "Suc N \<le> n" "Suc N \<le> m"
50971
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4700
        then have "(f \<circ> t) n \<in> F (Suc N)" "(f \<circ> t) m \<in> F (Suc N)" "2 * e N < r"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61552
diff changeset
  4701
          using F_dec t by (auto simp: e_def field_simps of_nat_Suc)
50971
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4702
        with F[of N] obtain x where "dist x ((f \<circ> t) n) < e N" "dist x ((f \<circ> t) m) < e N"
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4703
          by (auto simp: subset_eq)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4704
        with dist_triangle[of "(f \<circ> t) m" "(f \<circ> t) n" x] \<open>2 * e N < r\<close>
50971
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4705
        show "dist ((f \<circ> t) m) ((f \<circ> t) n) < r"
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4706
          by (simp add: dist_commute)
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4707
      qed
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4708
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4709
      ultimately show "\<exists>l\<in>s. \<exists>r. subseq r \<and> (f \<circ> r) \<longlonglongrightarrow> l"
50971
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4710
        using assms unfolding complete_def by blast
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4711
    qed
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4712
  qed
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4713
qed (metis compact_imp_complete compact_imp_seq_compact seq_compact_imp_totally_bounded)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4714
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4715
lemma cauchy: "Cauchy s \<longleftrightarrow> (\<forall>e>0.\<exists> N::nat. \<forall>n\<ge>N. dist(s n)(s N) < e)" (is "?lhs = ?rhs")
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4716
proof -
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4717
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4718
    assume ?rhs
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4719
    {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4720
      fix e::real
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4721
      assume "e>0"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4722
      with \<open>?rhs\<close> obtain N where N:"\<forall>n\<ge>N. dist (s n) (s N) < e/2"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4723
        by (erule_tac x="e/2" in allE) auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4724
      {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4725
        fix n m
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4726
        assume nm:"N \<le> m \<and> N \<le> n"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4727
        then have "dist (s m) (s n) < e" using N
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4728
          using dist_triangle_half_l[of "s m" "s N" "e" "s n"]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4729
          by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4730
      }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4731
      then have "\<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (s m) (s n) < e"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4732
        by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4733
    }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4734
    then have ?lhs
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4735
      unfolding cauchy_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4736
      by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4737
  }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4738
  then show ?thesis
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4739
    unfolding cauchy_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4740
    using dist_triangle_half_l
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4741
    by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4742
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4743
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4744
lemma cauchy_imp_bounded:
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4745
  assumes "Cauchy s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4746
  shows "bounded (range s)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4747
proof -
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4748
  from assms obtain N :: nat where "\<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (s m) (s n) < 1"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4749
    unfolding cauchy_def
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4750
    apply (erule_tac x= 1 in allE)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4751
    apply auto
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4752
    done
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4753
  then have N:"\<forall>n. N \<le> n \<longrightarrow> dist (s N) (s n) < 1" by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4754
  moreover
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4755
  have "bounded (s ` {0..N})"
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4756
    using finite_imp_bounded[of "s ` {1..N}"] by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4757
  then obtain a where a:"\<forall>x\<in>s ` {0..N}. dist (s N) x \<le> a"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4758
    unfolding bounded_any_center [where a="s N"] by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4759
  ultimately show "?thesis"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4760
    unfolding bounded_any_center [where a="s N"]
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4761
    apply (rule_tac x="max a 1" in exI)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4762
    apply auto
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4763
    apply (erule_tac x=y in allE)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4764
    apply (erule_tac x=y in ballE)
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4765
    apply auto
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4766
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4767
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4768
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4769
instance heine_borel < complete_space
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4770
proof
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4771
  fix f :: "nat \<Rightarrow> 'a" assume "Cauchy f"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4772
  then have "bounded (range f)"
34104
22758f95e624 re-state lemmas using 'range'
huffman
parents: 33758
diff changeset
  4773
    by (rule cauchy_imp_bounded)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4774
  then have "compact (closure (range f))"
50971
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4775
    unfolding compact_eq_bounded_closed by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4776
  then have "complete (closure (range f))"
50971
5e3d3d690975 tune prove compact_eq_totally_bounded
hoelzl
parents: 50970
diff changeset
  4777
    by (rule compact_imp_complete)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4778
  moreover have "\<forall>n. f n \<in> closure (range f)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4779
    using closure_subset [of "range f"] by auto
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  4780
  ultimately have "\<exists>l\<in>closure (range f). (f \<longlongrightarrow> l) sequentially"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4781
    using \<open>Cauchy f\<close> unfolding complete_def by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4782
  then show "convergent f"
36660
1cc4ab4b7ff7 make (X ----> L) an abbreviation for (X ---> L) sequentially
huffman
parents: 36659
diff changeset
  4783
    unfolding convergent_def by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4784
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4785
44632
076a45f65e12 simplify/generalize some proofs
huffman
parents: 44628
diff changeset
  4786
instance euclidean_space \<subseteq> banach ..
076a45f65e12 simplify/generalize some proofs
huffman
parents: 44628
diff changeset
  4787
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4788
lemma complete_UNIV: "complete (UNIV :: ('a::complete_space) set)"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4789
proof (rule completeI)
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4790
  fix f :: "nat \<Rightarrow> 'a" assume "Cauchy f"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4791
  then have "convergent f" by (rule Cauchy_convergent)
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4792
  then show "\<exists>l\<in>UNIV. f \<longlonglongrightarrow> l" unfolding convergent_def by simp
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4793
qed
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4794
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4795
lemma complete_imp_closed:
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4796
  assumes "complete s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4797
  shows "closed s"
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4798
proof (unfold closed_sequential_limits, clarify)
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4799
  fix f x assume "\<forall>n. f n \<in> s" and "f \<longlonglongrightarrow> x"
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4800
  from \<open>f \<longlonglongrightarrow> x\<close> have "Cauchy f"
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4801
    by (rule LIMSEQ_imp_Cauchy)
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4802
  with \<open>complete s\<close> and \<open>\<forall>n. f n \<in> s\<close> obtain l where "l \<in> s" and "f \<longlonglongrightarrow> l"
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4803
    by (rule completeE)
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4804
  from \<open>f \<longlonglongrightarrow> x\<close> and \<open>f \<longlonglongrightarrow> l\<close> have "x = l"
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4805
    by (rule LIMSEQ_unique)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4806
  with \<open>l \<in> s\<close> show "x \<in> s"
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4807
    by simp
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4808
qed
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4809
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4810
lemma complete_inter_closed:
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4811
  assumes "complete s" and "closed t"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4812
  shows "complete (s \<inter> t)"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4813
proof (rule completeI)
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4814
  fix f assume "\<forall>n. f n \<in> s \<inter> t" and "Cauchy f"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4815
  then have "\<forall>n. f n \<in> s" and "\<forall>n. f n \<in> t"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4816
    by simp_all
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4817
  from \<open>complete s\<close> obtain l where "l \<in> s" and "f \<longlonglongrightarrow> l"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4818
    using \<open>\<forall>n. f n \<in> s\<close> and \<open>Cauchy f\<close> by (rule completeE)
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4819
  from \<open>closed t\<close> and \<open>\<forall>n. f n \<in> t\<close> and \<open>f \<longlonglongrightarrow> l\<close> have "l \<in> t"
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4820
    by (rule closed_sequentially)
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4821
  with \<open>l \<in> s\<close> and \<open>f \<longlonglongrightarrow> l\<close> show "\<exists>l\<in>s \<inter> t. f \<longlonglongrightarrow> l"
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4822
    by fast
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4823
qed
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4824
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4825
lemma complete_closed_subset:
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4826
  assumes "closed s" and "s \<subseteq> t" and "complete t"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4827
  shows "complete s"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4828
  using assms complete_inter_closed [of t s] by (simp add: Int_absorb1)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4829
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4830
lemma complete_eq_closed:
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4831
  fixes s :: "('a::complete_space) set"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4832
  shows "complete s \<longleftrightarrow> closed s"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4833
proof
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4834
  assume "closed s" then show "complete s"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4835
    using subset_UNIV complete_UNIV by (rule complete_closed_subset)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4836
next
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4837
  assume "complete s" then show "closed s"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4838
    by (rule complete_imp_closed)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4839
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4840
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4841
lemma convergent_eq_cauchy:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4842
  fixes s :: "nat \<Rightarrow> 'a::complete_space"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  4843
  shows "(\<exists>l. (s \<longlongrightarrow> l) sequentially) \<longleftrightarrow> Cauchy s"
44632
076a45f65e12 simplify/generalize some proofs
huffman
parents: 44628
diff changeset
  4844
  unfolding Cauchy_convergent_iff convergent_def ..
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4845
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4846
lemma convergent_imp_bounded:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4847
  fixes s :: "nat \<Rightarrow> 'a::metric_space"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  4848
  shows "(s \<longlongrightarrow> l) sequentially \<Longrightarrow> bounded (range s)"
50939
ae7cd20ed118 replace convergent_imp_cauchy by LIMSEQ_imp_Cauchy
hoelzl
parents: 50938
diff changeset
  4849
  by (intro cauchy_imp_bounded LIMSEQ_imp_Cauchy)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4850
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4851
lemma compact_cball[simp]:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4852
  fixes x :: "'a::heine_borel"
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4853
  shows "compact (cball x e)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4854
  using compact_eq_bounded_closed bounded_cball closed_cball
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4855
  by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4856
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4857
lemma compact_frontier_bounded[intro]:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4858
  fixes s :: "'a::heine_borel set"
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4859
  shows "bounded s \<Longrightarrow> compact (frontier s)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4860
  unfolding frontier_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4861
  using compact_eq_bounded_closed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4862
  by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4863
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4864
lemma compact_frontier[intro]:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4865
  fixes s :: "'a::heine_borel set"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  4866
  shows "compact s \<Longrightarrow> compact (frontier s)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4867
  using compact_eq_bounded_closed compact_frontier_bounded
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4868
  by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4869
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4870
lemma frontier_subset_compact:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4871
  fixes s :: "'a::heine_borel set"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  4872
  shows "compact s \<Longrightarrow> frontier s \<subseteq> s"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4873
  using frontier_subset_closed compact_eq_bounded_closed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4874
  by blast
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4875
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4876
subsection \<open>Bounded closed nest property (proof does not use Heine-Borel)\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4877
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4878
lemma bounded_closed_nest:
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4879
  fixes s :: "nat \<Rightarrow> ('a::heine_borel) set"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4880
  assumes "\<forall>n. closed (s n)"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4881
    and "\<forall>n. s n \<noteq> {}"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4882
    and "\<forall>m n. m \<le> n \<longrightarrow> s n \<subseteq> s m"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4883
    and "bounded (s 0)"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4884
  shows "\<exists>a. \<forall>n. a \<in> s n"
52624
8a7b59a81088 tuned proofs;
wenzelm
parents: 52141
diff changeset
  4885
proof -
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4886
  from assms(2) obtain x where x: "\<forall>n. x n \<in> s n"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4887
    using choice[of "\<lambda>n x. x \<in> s n"] by auto
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4888
  from assms(4,1) have "seq_compact (s 0)"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4889
    by (simp add: bounded_closed_imp_seq_compact)
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4890
  then obtain l r where lr: "l \<in> s 0" "subseq r" "(x \<circ> r) \<longlonglongrightarrow> l"
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4891
    using x and assms(3) unfolding seq_compact_def by blast
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4892
  have "\<forall>n. l \<in> s n"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4893
  proof
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4894
    fix n :: nat
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4895
    have "closed (s n)"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4896
      using assms(1) by simp
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4897
    moreover have "\<forall>i. (x \<circ> r) i \<in> s i"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4898
      using x and assms(3) and lr(2) [THEN seq_suble] by auto
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4899
    then have "\<forall>i. (x \<circ> r) (i + n) \<in> s n"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4900
      using assms(3) by (fast intro!: le_add2)
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  4901
    moreover have "(\<lambda>i. (x \<circ> r) (i + n)) \<longlonglongrightarrow> l"
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4902
      using lr(3) by (rule LIMSEQ_ignore_initial_segment)
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4903
    ultimately show "l \<in> s n"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4904
      by (rule closed_sequentially)
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4905
  qed
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4906
  then show ?thesis ..
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4907
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4908
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4909
text \<open>Decreasing case does not even need compactness, just completeness.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4910
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4911
lemma decreasing_closed_nest:
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4912
  fixes s :: "nat \<Rightarrow> ('a::complete_space) set"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4913
  assumes
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4914
    "\<forall>n. closed (s n)"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4915
    "\<forall>n. s n \<noteq> {}"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4916
    "\<forall>m n. m \<le> n \<longrightarrow> s n \<subseteq> s m"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4917
    "\<forall>e>0. \<exists>n. \<forall>x\<in>s n. \<forall>y\<in>s n. dist x y < e"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4918
  shows "\<exists>a. \<forall>n. a \<in> s n"
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4919
proof -
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4920
  have "\<forall>n. \<exists>x. x \<in> s n"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4921
    using assms(2) by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4922
  then have "\<exists>t. \<forall>n. t n \<in> s n"
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4923
    using choice[of "\<lambda>n x. x \<in> s n"] by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4924
  then obtain t where t: "\<forall>n. t n \<in> s n" by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4925
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4926
    fix e :: real
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4927
    assume "e > 0"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4928
    then obtain N where N:"\<forall>x\<in>s N. \<forall>y\<in>s N. dist x y < e"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4929
      using assms(4) by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4930
    {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4931
      fix m n :: nat
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4932
      assume "N \<le> m \<and> N \<le> n"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4933
      then have "t m \<in> s N" "t n \<in> s N"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4934
        using assms(3) t unfolding  subset_eq t by blast+
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4935
      then have "dist (t m) (t n) < e"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4936
        using N by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4937
    }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4938
    then have "\<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (t m) (t n) < e"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4939
      by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4940
  }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4941
  then have "Cauchy t"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4942
    unfolding cauchy_def by auto
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  4943
  then obtain l where l:"(t \<longlongrightarrow> l) sequentially"
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4944
    using complete_UNIV unfolding complete_def by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4945
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4946
    fix n :: nat
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4947
    {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4948
      fix e :: real
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4949
      assume "e > 0"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4950
      then obtain N :: nat where N: "\<forall>n\<ge>N. dist (t n) l < e"
60017
b785d6d06430 Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents: 59815
diff changeset
  4951
        using l[unfolded lim_sequentially] by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4952
      have "t (max n N) \<in> s n"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4953
        using assms(3)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4954
        unfolding subset_eq
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4955
        apply (erule_tac x=n in allE)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4956
        apply (erule_tac x="max n N" in allE)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4957
        using t
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4958
        apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4959
        done
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4960
      then have "\<exists>y\<in>s n. dist y l < e"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4961
        apply (rule_tac x="t (max n N)" in bexI)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4962
        using N
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4963
        apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4964
        done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4965
    }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4966
    then have "l \<in> s n"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4967
      using closed_approachable[of "s n" l] assms(1) by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4968
  }
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4969
  then show ?thesis by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4970
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4971
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  4972
text \<open>Strengthen it to the intersection actually being a singleton.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4973
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4974
lemma decreasing_closed_nest_sing:
44632
076a45f65e12 simplify/generalize some proofs
huffman
parents: 44628
diff changeset
  4975
  fixes s :: "nat \<Rightarrow> 'a::complete_space set"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4976
  assumes
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4977
    "\<forall>n. closed(s n)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4978
    "\<forall>n. s n \<noteq> {}"
54070
1a13325269c2 new topological lemmas; tuned proofs
huffman
parents: 53862
diff changeset
  4979
    "\<forall>m n. m \<le> n \<longrightarrow> s n \<subseteq> s m"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4980
    "\<forall>e>0. \<exists>n. \<forall>x \<in> (s n). \<forall> y\<in>(s n). dist x y < e"
34104
22758f95e624 re-state lemmas using 'range'
huffman
parents: 33758
diff changeset
  4981
  shows "\<exists>a. \<Inter>(range s) = {a}"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4982
proof -
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4983
  obtain a where a: "\<forall>n. a \<in> s n"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4984
    using decreasing_closed_nest[of s] using assms by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4985
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4986
    fix b
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4987
    assume b: "b \<in> \<Inter>(range s)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4988
    {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4989
      fix e :: real
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4990
      assume "e > 0"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4991
      then have "dist a b < e"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4992
        using assms(4) and b and a by blast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4993
    }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4994
    then have "dist a b = 0"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4995
      by (metis dist_eq_0_iff dist_nz less_le)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  4996
  }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4997
  with a have "\<Inter>(range s) = {a}"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4998
    unfolding image_def by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  4999
  then show ?thesis ..
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5000
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5001
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5002
text\<open>Cauchy-type criteria for uniform convergence.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5003
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5004
lemma uniformly_convergent_eq_cauchy:
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5005
  fixes s::"nat \<Rightarrow> 'b \<Rightarrow> 'a::complete_space"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5006
  shows
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5007
    "(\<exists>l. \<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> P x \<longrightarrow> dist(s n x)(l x) < e) \<longleftrightarrow>
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5008
      (\<forall>e>0. \<exists>N. \<forall>m n x. N \<le> m \<and> N \<le> n \<and> P x  \<longrightarrow> dist (s m x) (s n x) < e)"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5009
  (is "?lhs = ?rhs")
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5010
proof
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5011
  assume ?lhs
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5012
  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"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5013
    by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5014
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5015
    fix e :: real
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5016
    assume "e > 0"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5017
    then obtain N :: nat where N: "\<forall>n x. N \<le> n \<and> P x \<longrightarrow> dist (s n x) (l x) < e / 2"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5018
      using l[THEN spec[where x="e/2"]] by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5019
    {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5020
      fix n m :: nat and x :: "'b"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5021
      assume "N \<le> m \<and> N \<le> n \<and> P x"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5022
      then have "dist (s m x) (s n x) < e"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5023
        using N[THEN spec[where x=m], THEN spec[where x=x]]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5024
        using N[THEN spec[where x=n], THEN spec[where x=x]]
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5025
        using dist_triangle_half_l[of "s m x" "l x" e "s n x"] by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5026
    }
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5027
    then have "\<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
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5028
  }
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5029
  then show ?rhs by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5030
next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5031
  assume ?rhs
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5032
  then have "\<forall>x. P x \<longrightarrow> Cauchy (\<lambda>n. s n x)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5033
    unfolding cauchy_def
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5034
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5035
    apply (erule_tac x=e in allE)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5036
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5037
    done
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  5038
  then obtain l where l: "\<forall>x. P x \<longrightarrow> ((\<lambda>n. s n x) \<longlongrightarrow> l x) sequentially"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5039
    unfolding convergent_eq_cauchy[symmetric]
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  5040
    using choice[of "\<lambda>x l. P x \<longrightarrow> ((\<lambda>n. s n x) \<longlongrightarrow> l) sequentially"]
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5041
    by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5042
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5043
    fix e :: real
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5044
    assume "e > 0"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5045
    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"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5046
      using \<open>?rhs\<close>[THEN spec[where x="e/2"]] by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5047
    {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5048
      fix x
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5049
      assume "P x"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5050
      then obtain M where M:"\<forall>n\<ge>M. dist (s n x) (l x) < e/2"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5051
        using l[THEN spec[where x=x], unfolded lim_sequentially] and \<open>e > 0\<close>
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5052
        by (auto elim!: allE[where x="e/2"])
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5053
      fix n :: nat
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5054
      assume "n \<ge> N"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5055
      then have "dist(s n x)(l x) < e"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5056
        using \<open>P x\<close>and N[THEN spec[where x=n], THEN spec[where x="N+M"], THEN spec[where x=x]]
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5057
        using M[THEN spec[where x="N+M"]] and dist_triangle_half_l[of "s n x" "s (N+M) x" e "l x"]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5058
        by (auto simp add: dist_commute)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5059
    }
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5060
    then have "\<exists>N. \<forall>n x. N \<le> n \<and> P x \<longrightarrow> dist(s n x)(l x) < e"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5061
      by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5062
  }
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5063
  then show ?lhs by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5064
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5065
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5066
lemma uniformly_cauchy_imp_uniformly_convergent:
51102
358b27c56469 generalized
immler
parents: 50998
diff changeset
  5067
  fixes s :: "nat \<Rightarrow> 'a \<Rightarrow> 'b::complete_space"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5068
  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"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5069
    and "\<forall>x. P x --> (\<forall>e>0. \<exists>N. \<forall>n. N \<le> n \<longrightarrow> dist(s n x)(l x) < e)"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5070
  shows "\<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> P x \<longrightarrow> dist(s n x)(l x) < e"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5071
proof -
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5072
  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"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5073
    using assms(1) unfolding uniformly_convergent_eq_cauchy[symmetric] by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5074
  moreover
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5075
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5076
    fix x
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5077
    assume "P x"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5078
    then have "l x = l' x"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5079
      using tendsto_unique[OF trivial_limit_sequentially, of "\<lambda>n. s n x" "l x" "l' x"]
60017
b785d6d06430 Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents: 59815
diff changeset
  5080
      using l and assms(2) unfolding lim_sequentially by blast
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5081
  }
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5082
  ultimately show ?thesis by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5083
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5084
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  5085
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5086
subsection \<open>Continuity\<close>
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5087
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5088
text\<open>Derive the epsilon-delta forms, which we often use as "definitions"\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5089
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5090
lemma continuous_within_eps_delta:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5091
  "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)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5092
  unfolding continuous_within and Lim_within
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5093
  apply auto
55775
1557a391a858 A bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 55522
diff changeset
  5094
  apply (metis dist_nz dist_self)
1557a391a858 A bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 55522
diff changeset
  5095
  apply blast
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5096
  done
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5097
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5098
lemma continuous_at_eps_delta:
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5099
  "continuous (at x) f \<longleftrightarrow> (\<forall>e > 0. \<exists>d > 0. \<forall>x'. dist x' x < d \<longrightarrow> dist (f x') (f x) < e)"
45031
9583f2b56f85 add lemmas within_empty and tendsto_bot;
huffman
parents: 44909
diff changeset
  5100
  using continuous_within_eps_delta [of x UNIV f] by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5101
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  5102
lemma continuous_at_right_real_increasing:
57448
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  5103
  fixes f :: "real \<Rightarrow> real"
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  5104
  assumes nondecF: "\<And>x y. x \<le> y \<Longrightarrow> f x \<le> f y"
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  5105
  shows "continuous (at_right a) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. f (a + d) - f a < e)"
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  5106
  apply (simp add: greaterThan_def dist_real_def continuous_within Lim_within_le)
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  5107
  apply (intro all_cong ex_cong)
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  5108
  apply safe
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  5109
  apply (erule_tac x="a + d" in allE)
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  5110
  apply simp
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  5111
  apply (simp add: nondecF field_simps)
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  5112
  apply (drule nondecF)
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  5113
  apply simp
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  5114
  done
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  5115
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  5116
lemma continuous_at_left_real_increasing:
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  5117
  assumes nondecF: "\<And> x y. x \<le> y \<Longrightarrow> f x \<le> ((f y) :: real)"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  5118
  shows "(continuous (at_left (a :: real)) f) = (\<forall>e > 0. \<exists>delta > 0. f a - f (a - delta) < e)"
57448
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  5119
  apply (simp add: lessThan_def dist_real_def continuous_within Lim_within_le)
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  5120
  apply (intro all_cong ex_cong)
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  5121
  apply safe
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  5122
  apply (erule_tac x="a - d" in allE)
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  5123
  apply simp
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  5124
  apply (simp add: nondecF field_simps)
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  5125
  apply (cut_tac x="a - d" and y="x" in nondecF)
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  5126
  apply simp_all
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  5127
  done
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57418
diff changeset
  5128
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5129
text\<open>Versions in terms of open balls.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5130
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5131
lemma continuous_within_ball:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5132
  "continuous (at x within s) f \<longleftrightarrow>
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5133
    (\<forall>e > 0. \<exists>d > 0. f ` (ball x d \<inter> s) \<subseteq> ball (f x) e)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5134
  (is "?lhs = ?rhs")
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5135
proof
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5136
  assume ?lhs
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5137
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5138
    fix e :: real
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5139
    assume "e > 0"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5140
    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"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5141
      using \<open>?lhs\<close>[unfolded continuous_within Lim_within] by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5142
    {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5143
      fix y
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5144
      assume "y \<in> f ` (ball x d \<inter> s)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5145
      then have "y \<in> ball (f x) e"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5146
        using d(2)
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5147
        unfolding dist_nz[symmetric]
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5148
        apply (auto simp add: dist_commute)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5149
        apply (erule_tac x=xa in ballE)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5150
        apply auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5151
        using \<open>e > 0\<close>
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5152
        apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5153
        done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5154
    }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5155
    then have "\<exists>d>0. f ` (ball x d \<inter> s) \<subseteq> ball (f x) e"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5156
      using \<open>d > 0\<close>
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5157
      unfolding subset_eq ball_def by (auto simp add: dist_commute)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5158
  }
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5159
  then show ?rhs by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5160
next
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5161
  assume ?rhs
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5162
  then show ?lhs
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5163
    unfolding continuous_within Lim_within ball_def subset_eq
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5164
    apply (auto simp add: dist_commute)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5165
    apply (erule_tac x=e in allE)
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61552
diff changeset
  5166
    apply auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5167
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5168
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5169
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5170
lemma continuous_at_ball:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5171
  "continuous (at x) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. f ` (ball x d) \<subseteq> ball (f x) e)" (is "?lhs = ?rhs")
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5172
proof
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5173
  assume ?lhs
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5174
  then show ?rhs
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5175
    unfolding continuous_at Lim_at subset_eq Ball_def Bex_def image_iff mem_ball
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5176
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5177
    apply (erule_tac x=e in allE)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5178
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5179
    apply (rule_tac x=d in exI)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5180
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5181
    apply (erule_tac x=xa in allE)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5182
    apply (auto simp add: dist_commute dist_nz)
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5183
    unfolding dist_nz[symmetric]
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5184
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5185
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5186
next
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5187
  assume ?rhs
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5188
  then show ?lhs
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5189
    unfolding continuous_at Lim_at subset_eq Ball_def Bex_def image_iff mem_ball
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5190
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5191
    apply (erule_tac x=e in allE)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5192
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5193
    apply (rule_tac x=d in exI)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5194
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5195
    apply (erule_tac x="f xa" in allE)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5196
    apply (auto simp add: dist_commute dist_nz)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5197
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5198
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5199
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5200
text\<open>Define setwise continuity in terms of limits within the set.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5201
36359
e5c785c166b2 generalize type of continuous_on
huffman
parents: 36358
diff changeset
  5202
lemma continuous_on_iff:
e5c785c166b2 generalize type of continuous_on
huffman
parents: 36358
diff changeset
  5203
  "continuous_on s f \<longleftrightarrow>
36440
89a70297564d simplify definition of continuous_on; generalize some lemmas
huffman
parents: 36439
diff changeset
  5204
    (\<forall>x\<in>s. \<forall>e>0. \<exists>d>0. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f x') (f x) < e)"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5205
  unfolding continuous_on_def Lim_within
55775
1557a391a858 A bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 55522
diff changeset
  5206
  by (metis dist_pos_lt dist_self)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5207
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5208
definition uniformly_continuous_on :: "'a set \<Rightarrow> ('a::metric_space \<Rightarrow> 'b::metric_space) \<Rightarrow> bool"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5209
  where "uniformly_continuous_on s f \<longleftrightarrow>
36440
89a70297564d simplify definition of continuous_on; generalize some lemmas
huffman
parents: 36439
diff changeset
  5210
    (\<forall>e>0. \<exists>d>0. \<forall>x\<in>s. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f x') (f x) < e)"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents: 35028
diff changeset
  5211
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5212
text\<open>Some simple consequential lemmas.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5213
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5214
lemma continuous_onD:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5215
    assumes "continuous_on s f" "x\<in>s" "e>0"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5216
    obtains d where "d>0"  "\<And>x'. \<lbrakk>x' \<in> s; dist x' x < d\<rbrakk> \<Longrightarrow> dist (f x') (f x) < e"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5217
  using assms [unfolded continuous_on_iff] by blast
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5218
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  5219
lemma uniformly_continuous_onE:
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  5220
  assumes "uniformly_continuous_on s f" "0 < e"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  5221
  obtains d where "d>0" "\<And>x x'. \<lbrakk>x\<in>s; x'\<in>s; dist x' x < d\<rbrakk> \<Longrightarrow> dist (f x') (f x) < e"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  5222
using assms
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  5223
by (auto simp: uniformly_continuous_on_def)
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  5224
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5225
lemma uniformly_continuous_imp_continuous:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5226
  "uniformly_continuous_on s f \<Longrightarrow> continuous_on s f"
36359
e5c785c166b2 generalize type of continuous_on
huffman
parents: 36358
diff changeset
  5227
  unfolding uniformly_continuous_on_def continuous_on_iff by blast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5228
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5229
lemma continuous_at_imp_continuous_within:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5230
  "continuous (at x) f \<Longrightarrow> continuous (at x within s) f"
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60615
diff changeset
  5231
  unfolding continuous_within continuous_at using Lim_at_imp_Lim_at_within by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5232
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  5233
lemma Lim_trivial_limit: "trivial_limit net \<Longrightarrow> (f \<longlongrightarrow> l) net"
51478
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 51475
diff changeset
  5234
  by simp
36440
89a70297564d simplify definition of continuous_on; generalize some lemmas
huffman
parents: 36439
diff changeset
  5235
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61806
diff changeset
  5236
lemmas continuous_on = continuous_on_def \<comment> "legacy theorem name"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5237
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5238
lemma continuous_within_subset:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5239
  "continuous (at x within s) f \<Longrightarrow> t \<subseteq> s \<Longrightarrow> continuous (at x within t) f"
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51530
diff changeset
  5240
  unfolding continuous_within by(metis tendsto_within_subset)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5241
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5242
lemma continuous_on_interior:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5243
  "continuous_on s f \<Longrightarrow> x \<in> interior s \<Longrightarrow> continuous (at x) f"
55775
1557a391a858 A bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 55522
diff changeset
  5244
  by (metis continuous_on_eq_continuous_at continuous_on_subset interiorE)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5245
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5246
lemma continuous_on_eq:
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61076
diff changeset
  5247
  "\<lbrakk>continuous_on s f; \<And>x. x \<in> s \<Longrightarrow> f x = g x\<rbrakk> \<Longrightarrow> continuous_on s g"
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51530
diff changeset
  5248
  unfolding continuous_on_def tendsto_def eventually_at_topological
36440
89a70297564d simplify definition of continuous_on; generalize some lemmas
huffman
parents: 36439
diff changeset
  5249
  by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5250
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5251
text \<open>Characterization of various kinds of continuity in terms of sequences.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5252
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5253
lemma continuous_within_sequentially:
44533
7abe4a59f75d generalize and simplify proof of continuous_within_sequentially
huffman
parents: 44531
diff changeset
  5254
  fixes f :: "'a::metric_space \<Rightarrow> 'b::topological_space"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5255
  shows "continuous (at a within s) f \<longleftrightarrow>
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  5256
    (\<forall>x. (\<forall>n::nat. x n \<in> s) \<and> (x \<longlongrightarrow> a) sequentially
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  5257
         \<longrightarrow> ((f \<circ> x) \<longlongrightarrow> f a) sequentially)"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5258
  (is "?lhs = ?rhs")
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5259
proof
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5260
  assume ?lhs
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5261
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5262
    fix x :: "nat \<Rightarrow> 'a"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5263
    assume x: "\<forall>n. x n \<in> s" "\<forall>e>0. eventually (\<lambda>n. dist (x n) a < e) sequentially"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5264
    fix T :: "'b set"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5265
    assume "open T" and "f a \<in> T"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5266
    with \<open>?lhs\<close> obtain d where "d>0" and d:"\<forall>x\<in>s. 0 < dist x a \<and> dist x a < d \<longrightarrow> f x \<in> T"
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51530
diff changeset
  5267
      unfolding continuous_within tendsto_def eventually_at by (auto simp: dist_nz)
44533
7abe4a59f75d generalize and simplify proof of continuous_within_sequentially
huffman
parents: 44531
diff changeset
  5268
    have "eventually (\<lambda>n. dist (x n) a < d) sequentially"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5269
      using x(2) \<open>d>0\<close> by simp
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5270
    then have "eventually (\<lambda>n. (f \<circ> x) n \<in> T) sequentially"
46887
cb891d9a23c1 use eventually_elim method
noschinl
parents: 45776
diff changeset
  5271
    proof eventually_elim
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5272
      case (elim n)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5273
      then show ?case
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5274
        using d x(1) \<open>f a \<in> T\<close> unfolding dist_nz[symmetric] by auto
44533
7abe4a59f75d generalize and simplify proof of continuous_within_sequentially
huffman
parents: 44531
diff changeset
  5275
    qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5276
  }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5277
  then show ?rhs
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5278
    unfolding tendsto_iff tendsto_def by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5279
next
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5280
  assume ?rhs
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5281
  then show ?lhs
44533
7abe4a59f75d generalize and simplify proof of continuous_within_sequentially
huffman
parents: 44531
diff changeset
  5282
    unfolding continuous_within tendsto_def [where l="f a"]
7abe4a59f75d generalize and simplify proof of continuous_within_sequentially
huffman
parents: 44531
diff changeset
  5283
    by (simp add: sequentially_imp_eventually_within)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5284
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5285
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5286
lemma continuous_at_sequentially:
44533
7abe4a59f75d generalize and simplify proof of continuous_within_sequentially
huffman
parents: 44531
diff changeset
  5287
  fixes f :: "'a::metric_space \<Rightarrow> 'b::topological_space"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5288
  shows "continuous (at a) f \<longleftrightarrow>
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  5289
    (\<forall>x. (x \<longlongrightarrow> a) sequentially --> ((f \<circ> x) \<longlongrightarrow> f a) sequentially)"
45031
9583f2b56f85 add lemmas within_empty and tendsto_bot;
huffman
parents: 44909
diff changeset
  5290
  using continuous_within_sequentially[of a UNIV f] by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5291
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5292
lemma continuous_on_sequentially:
44533
7abe4a59f75d generalize and simplify proof of continuous_within_sequentially
huffman
parents: 44531
diff changeset
  5293
  fixes f :: "'a::metric_space \<Rightarrow> 'b::topological_space"
36359
e5c785c166b2 generalize type of continuous_on
huffman
parents: 36358
diff changeset
  5294
  shows "continuous_on s f \<longleftrightarrow>
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  5295
    (\<forall>x. \<forall>a \<in> s. (\<forall>n. x(n) \<in> s) \<and> (x \<longlongrightarrow> a) sequentially
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  5296
      --> ((f \<circ> x) \<longlongrightarrow> f a) sequentially)"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5297
  (is "?lhs = ?rhs")
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5298
proof
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5299
  assume ?rhs
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5300
  then show ?lhs
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5301
    using continuous_within_sequentially[of _ s f]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5302
    unfolding continuous_on_eq_continuous_within
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5303
    by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5304
next
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5305
  assume ?lhs
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5306
  then show ?rhs
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5307
    unfolding continuous_on_eq_continuous_within
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5308
    using continuous_within_sequentially[of _ s f]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5309
    by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5310
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5311
44648
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5312
lemma uniformly_continuous_on_sequentially:
36441
1d7704c29af3 generalized many lemmas about continuity
huffman
parents: 36440
diff changeset
  5313
  "uniformly_continuous_on s f \<longleftrightarrow> (\<forall>x y. (\<forall>n. x n \<in> s) \<and> (\<forall>n. y n \<in> s) \<and>
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  5314
                    ((\<lambda>n. dist (x n) (y n)) \<longlongrightarrow> 0) sequentially
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  5315
                    \<longrightarrow> ((\<lambda>n. dist (f(x n)) (f(y n))) \<longlongrightarrow> 0) sequentially)" (is "?lhs = ?rhs")
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5316
proof
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5317
  assume ?lhs
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5318
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5319
    fix x y
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5320
    assume x: "\<forall>n. x n \<in> s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5321
      and y: "\<forall>n. y n \<in> s"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  5322
      and xy: "((\<lambda>n. dist (x n) (y n)) \<longlongrightarrow> 0) sequentially"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5323
    {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5324
      fix e :: real
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5325
      assume "e > 0"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5326
      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"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5327
        using \<open>?lhs\<close>[unfolded uniformly_continuous_on_def, THEN spec[where x=e]] by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5328
      obtain N where N: "\<forall>n\<ge>N. dist (x n) (y n) < d"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5329
        using xy[unfolded lim_sequentially dist_norm] and \<open>d>0\<close> by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5330
      {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5331
        fix n
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5332
        assume "n\<ge>N"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5333
        then have "dist (f (x n)) (f (y n)) < e"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5334
          using N[THEN spec[where x=n]]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5335
          using d[THEN bspec[where x="x n"], THEN bspec[where x="y n"]]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5336
          using x and y
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5337
          unfolding dist_commute
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5338
          by simp
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5339
      }
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5340
      then have "\<exists>N. \<forall>n\<ge>N. dist (f (x n)) (f (y n)) < e"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5341
        by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5342
    }
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  5343
    then have "((\<lambda>n. dist (f(x n)) (f(y n))) \<longlongrightarrow> 0) sequentially"
60017
b785d6d06430 Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents: 59815
diff changeset
  5344
      unfolding lim_sequentially and dist_real_def by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5345
  }
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5346
  then show ?rhs by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5347
next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5348
  assume ?rhs
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5349
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5350
    assume "\<not> ?lhs"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5351
    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"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5352
      unfolding uniformly_continuous_on_def by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5353
    then obtain fa where fa:
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5354
      "\<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"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5355
      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"]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5356
      unfolding Bex_def
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5357
      by (auto simp add: dist_commute)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5358
    def x \<equiv> "\<lambda>n::nat. fst (fa (inverse (real n + 1)))"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5359
    def y \<equiv> "\<lambda>n::nat. snd (fa (inverse (real n + 1)))"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5360
    have xyn: "\<forall>n. x n \<in> s \<and> y n \<in> s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5361
      and xy0: "\<forall>n. dist (x n) (y n) < inverse (real n + 1)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5362
      and fxy:"\<forall>n. \<not> dist (f (x n)) (f (y n)) < e"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5363
      unfolding x_def and y_def using fa
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5364
      by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5365
    {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5366
      fix e :: real
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5367
      assume "e > 0"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5368
      then obtain N :: nat where "N \<noteq> 0" and N: "0 < inverse (real N) \<and> inverse (real N) < e"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5369
        unfolding real_arch_inv[of e] by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5370
      {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5371
        fix n :: nat
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5372
        assume "n \<ge> N"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5373
        then have "inverse (real n + 1) < inverse (real N)"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61552
diff changeset
  5374
          using of_nat_0_le_iff and \<open>N\<noteq>0\<close> by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5375
        also have "\<dots> < e" using N by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5376
        finally have "inverse (real n + 1) < e" by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5377
        then have "dist (x n) (y n) < e"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5378
          using xy0[THEN spec[where x=n]] by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5379
      }
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5380
      then have "\<exists>N. \<forall>n\<ge>N. dist (x n) (y n) < e" by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5381
    }
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5382
    then have "\<forall>e>0. \<exists>N. \<forall>n\<ge>N. dist (f (x n)) (f (y n)) < e"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5383
      using \<open>?rhs\<close>[THEN spec[where x=x], THEN spec[where x=y]] and xyn
60017
b785d6d06430 Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents: 59815
diff changeset
  5384
      unfolding lim_sequentially dist_real_def by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5385
    then have False using fxy and \<open>e>0\<close> by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5386
  }
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5387
  then show ?lhs
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5388
    unfolding uniformly_continuous_on_def by blast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5389
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5390
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61907
diff changeset
  5391
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5392
text\<open>The usual transformation theorems.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5393
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5394
lemma continuous_transform_within:
36667
21404f7dec59 generalize some lemmas
huffman
parents: 36660
diff changeset
  5395
  fixes f g :: "'a::metric_space \<Rightarrow> 'b::topological_space"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5396
  assumes "0 < d"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5397
    and "x \<in> s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5398
    and "\<forall>x' \<in> s. dist x' x < d --> f x' = g x'"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5399
    and "continuous (at x within s) f"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5400
  shows "continuous (at x within s) g"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5401
  unfolding continuous_within
36667
21404f7dec59 generalize some lemmas
huffman
parents: 36660
diff changeset
  5402
proof (rule Lim_transform_within)
21404f7dec59 generalize some lemmas
huffman
parents: 36660
diff changeset
  5403
  show "0 < d" by fact
21404f7dec59 generalize some lemmas
huffman
parents: 36660
diff changeset
  5404
  show "\<forall>x'\<in>s. 0 < dist x' x \<and> dist x' x < d \<longrightarrow> f x' = g x'"
21404f7dec59 generalize some lemmas
huffman
parents: 36660
diff changeset
  5405
    using assms(3) by auto
21404f7dec59 generalize some lemmas
huffman
parents: 36660
diff changeset
  5406
  have "f x = g x"
21404f7dec59 generalize some lemmas
huffman
parents: 36660
diff changeset
  5407
    using assms(1,2,3) by auto
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  5408
  then show "(f \<longlongrightarrow> g x) (at x within s)"
36667
21404f7dec59 generalize some lemmas
huffman
parents: 36660
diff changeset
  5409
    using assms(4) unfolding continuous_within by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5410
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5411
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5412
lemma continuous_transform_at:
36667
21404f7dec59 generalize some lemmas
huffman
parents: 36660
diff changeset
  5413
  fixes f g :: "'a::metric_space \<Rightarrow> 'b::topological_space"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5414
  assumes "0 < d"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5415
    and "\<forall>x'. dist x' x < d --> f x' = g x'"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5416
    and "continuous (at x) f"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5417
  shows "continuous (at x) g"
45031
9583f2b56f85 add lemmas within_empty and tendsto_bot;
huffman
parents: 44909
diff changeset
  5418
  using continuous_transform_within [of d x UNIV f g] assms by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5419
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5420
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5421
subsubsection \<open>Structural rules for pointwise continuity\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5422
51478
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 51475
diff changeset
  5423
lemmas continuous_within_id = continuous_ident
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 51475
diff changeset
  5424
60150
bd773c47ad0b New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents: 60141
diff changeset
  5425
lemmas continuous_at_id = continuous_ident
44647
e4de7750cdeb modernize lemmas about 'continuous' and 'continuous_on';
huffman
parents: 44632
diff changeset
  5426
51361
21e5b6efb317 changed continuous_intros into a named theorems collection
hoelzl
parents: 51351
diff changeset
  5427
lemma continuous_infdist[continuous_intros]:
50087
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  5428
  assumes "continuous F f"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  5429
  shows "continuous F (\<lambda>x. infdist (f x) A)"
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  5430
  using assms unfolding continuous_def by (rule tendsto_infdist)
635d73673b5e regularity of measures, therefore:
immler
parents: 49962
diff changeset
  5431
51361
21e5b6efb317 changed continuous_intros into a named theorems collection
hoelzl
parents: 51351
diff changeset
  5432
lemma continuous_infnorm[continuous_intros]:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5433
  "continuous F f \<Longrightarrow> continuous F (\<lambda>x. infnorm (f x))"
44647
e4de7750cdeb modernize lemmas about 'continuous' and 'continuous_on';
huffman
parents: 44632
diff changeset
  5434
  unfolding continuous_def by (rule tendsto_infnorm)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5435
51361
21e5b6efb317 changed continuous_intros into a named theorems collection
hoelzl
parents: 51351
diff changeset
  5436
lemma continuous_inner[continuous_intros]:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5437
  assumes "continuous F f"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5438
    and "continuous F g"
44647
e4de7750cdeb modernize lemmas about 'continuous' and 'continuous_on';
huffman
parents: 44632
diff changeset
  5439
  shows "continuous F (\<lambda>x. inner (f x) (g x))"
e4de7750cdeb modernize lemmas about 'continuous' and 'continuous_on';
huffman
parents: 44632
diff changeset
  5440
  using assms unfolding continuous_def by (rule tendsto_inner)
e4de7750cdeb modernize lemmas about 'continuous' and 'continuous_on';
huffman
parents: 44632
diff changeset
  5441
51478
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 51475
diff changeset
  5442
lemmas continuous_at_inverse = isCont_inverse
44647
e4de7750cdeb modernize lemmas about 'continuous' and 'continuous_on';
huffman
parents: 44632
diff changeset
  5443
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5444
subsubsection \<open>Structural rules for setwise continuity\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5445
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56290
diff changeset
  5446
lemma continuous_on_infnorm[continuous_intros]:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5447
  "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. infnorm (f x))"
44647
e4de7750cdeb modernize lemmas about 'continuous' and 'continuous_on';
huffman
parents: 44632
diff changeset
  5448
  unfolding continuous_on by (fast intro: tendsto_infnorm)
e4de7750cdeb modernize lemmas about 'continuous' and 'continuous_on';
huffman
parents: 44632
diff changeset
  5449
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56290
diff changeset
  5450
lemma continuous_on_inner[continuous_intros]:
44531
1d477a2b1572 replace some continuous_on lemmas with more general versions
huffman
parents: 44530
diff changeset
  5451
  fixes g :: "'a::topological_space \<Rightarrow> 'b::real_inner"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5452
  assumes "continuous_on s f"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5453
    and "continuous_on s g"
44531
1d477a2b1572 replace some continuous_on lemmas with more general versions
huffman
parents: 44530
diff changeset
  5454
  shows "continuous_on s (\<lambda>x. inner (f x) (g x))"
1d477a2b1572 replace some continuous_on lemmas with more general versions
huffman
parents: 44530
diff changeset
  5455
  using bounded_bilinear_inner assms
1d477a2b1572 replace some continuous_on lemmas with more general versions
huffman
parents: 44530
diff changeset
  5456
  by (rule bounded_bilinear.continuous_on)
1d477a2b1572 replace some continuous_on lemmas with more general versions
huffman
parents: 44530
diff changeset
  5457
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5458
subsubsection \<open>Structural rules for uniform continuity\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5459
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56290
diff changeset
  5460
lemma uniformly_continuous_on_id[continuous_intros]:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5461
  "uniformly_continuous_on s (\<lambda>x. x)"
44647
e4de7750cdeb modernize lemmas about 'continuous' and 'continuous_on';
huffman
parents: 44632
diff changeset
  5462
  unfolding uniformly_continuous_on_def by auto
e4de7750cdeb modernize lemmas about 'continuous' and 'continuous_on';
huffman
parents: 44632
diff changeset
  5463
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56290
diff changeset
  5464
lemma uniformly_continuous_on_const[continuous_intros]:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5465
  "uniformly_continuous_on s (\<lambda>x. c)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5466
  unfolding uniformly_continuous_on_def by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5467
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56290
diff changeset
  5468
lemma uniformly_continuous_on_dist[continuous_intros]:
44648
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5469
  fixes f g :: "'a::metric_space \<Rightarrow> 'b::metric_space"
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5470
  assumes "uniformly_continuous_on s f"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5471
    and "uniformly_continuous_on s g"
44648
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5472
  shows "uniformly_continuous_on s (\<lambda>x. dist (f x) (g x))"
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5473
proof -
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5474
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5475
    fix a b c d :: 'b
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5476
    have "\<bar>dist a b - dist c d\<bar> \<le> dist a c + dist b d"
44648
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5477
      using dist_triangle2 [of a b c] dist_triangle2 [of b c d]
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5478
      using dist_triangle3 [of c d a] dist_triangle [of a d b]
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5479
      by arith
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5480
  } note le = this
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5481
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5482
    fix x y
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  5483
    assume f: "(\<lambda>n. dist (f (x n)) (f (y n))) \<longlonglongrightarrow> 0"
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  5484
    assume g: "(\<lambda>n. dist (g (x n)) (g (y n))) \<longlonglongrightarrow> 0"
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  5485
    have "(\<lambda>n. \<bar>dist (f (x n)) (g (x n)) - dist (f (y n)) (g (y n))\<bar>) \<longlonglongrightarrow> 0"
44648
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5486
      by (rule Lim_transform_bound [OF _ tendsto_add_zero [OF f g]],
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5487
        simp add: le)
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5488
  }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5489
  then show ?thesis
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5490
    using assms unfolding uniformly_continuous_on_sequentially
44648
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5491
    unfolding dist_real_def by simp
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5492
qed
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5493
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56290
diff changeset
  5494
lemma uniformly_continuous_on_norm[continuous_intros]:
44648
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5495
  assumes "uniformly_continuous_on s f"
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5496
  shows "uniformly_continuous_on s (\<lambda>x. norm (f x))"
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5497
  unfolding norm_conv_dist using assms
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5498
  by (intro uniformly_continuous_on_dist uniformly_continuous_on_const)
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5499
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56290
diff changeset
  5500
lemma (in bounded_linear) uniformly_continuous_on[continuous_intros]:
44648
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5501
  assumes "uniformly_continuous_on s g"
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5502
  shows "uniformly_continuous_on s (\<lambda>x. f (g x))"
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5503
  using assms unfolding uniformly_continuous_on_sequentially
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5504
  unfolding dist_norm tendsto_norm_zero_iff diff[symmetric]
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5505
  by (auto intro: tendsto_zero)
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5506
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56290
diff changeset
  5507
lemma uniformly_continuous_on_cmul[continuous_intros]:
36441
1d7704c29af3 generalized many lemmas about continuity
huffman
parents: 36440
diff changeset
  5508
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5509
  assumes "uniformly_continuous_on s f"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5510
  shows "uniformly_continuous_on s (\<lambda>x. c *\<^sub>R f(x))"
44648
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5511
  using bounded_linear_scaleR_right assms
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5512
  by (rule bounded_linear.uniformly_continuous_on)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5513
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5514
lemma dist_minus:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5515
  fixes x y :: "'a::real_normed_vector"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5516
  shows "dist (- x) (- y) = dist x y"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5517
  unfolding dist_norm minus_diff_minus norm_minus_cancel ..
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5518
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56290
diff changeset
  5519
lemma uniformly_continuous_on_minus[continuous_intros]:
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5520
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
44648
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5521
  shows "uniformly_continuous_on s f \<Longrightarrow> uniformly_continuous_on s (\<lambda>x. - f x)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5522
  unfolding uniformly_continuous_on_def dist_minus .
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5523
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56290
diff changeset
  5524
lemma uniformly_continuous_on_add[continuous_intros]:
36441
1d7704c29af3 generalized many lemmas about continuity
huffman
parents: 36440
diff changeset
  5525
  fixes f g :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
44648
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5526
  assumes "uniformly_continuous_on s f"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5527
    and "uniformly_continuous_on s g"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5528
  shows "uniformly_continuous_on s (\<lambda>x. f x + g x)"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5529
  using assms
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5530
  unfolding uniformly_continuous_on_sequentially
44648
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5531
  unfolding dist_norm tendsto_norm_zero_iff add_diff_add
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5532
  by (auto intro: tendsto_add_zero)
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5533
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56290
diff changeset
  5534
lemma uniformly_continuous_on_diff[continuous_intros]:
36441
1d7704c29af3 generalized many lemmas about continuity
huffman
parents: 36440
diff changeset
  5535
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5536
  assumes "uniformly_continuous_on s f"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5537
    and "uniformly_continuous_on s g"
44648
897f32a827f2 simplify some proofs about uniform continuity, and add some new ones;
huffman
parents: 44647
diff changeset
  5538
  shows "uniformly_continuous_on s (\<lambda>x. f x - g x)"
54230
b1d955791529 more simplification rules on unary and binary minus
haftmann
parents: 54070
diff changeset
  5539
  using assms uniformly_continuous_on_add [of s f "- g"]
b1d955791529 more simplification rules on unary and binary minus
haftmann
parents: 54070
diff changeset
  5540
    by (simp add: fun_Compl_def uniformly_continuous_on_minus)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5541
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5542
text\<open>Continuity of all kinds is preserved under composition.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5543
51478
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 51475
diff changeset
  5544
lemmas continuous_at_compose = isCont_o
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5545
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56290
diff changeset
  5546
lemma uniformly_continuous_on_compose[continuous_intros]:
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5547
  assumes "uniformly_continuous_on s f"  "uniformly_continuous_on (f ` s) g"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  5548
  shows "uniformly_continuous_on s (g \<circ> f)"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  5549
proof -
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5550
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5551
    fix e :: real
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5552
    assume "e > 0"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5553
    then obtain d where "d > 0"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5554
      and d: "\<forall>x\<in>f ` s. \<forall>x'\<in>f ` s. dist x' x < d \<longrightarrow> dist (g x') (g x) < e"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5555
      using assms(2) unfolding uniformly_continuous_on_def by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5556
    obtain d' where "d'>0" "\<forall>x\<in>s. \<forall>x'\<in>s. dist x' x < d' \<longrightarrow> dist (f x') (f x) < d"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5557
      using \<open>d > 0\<close> using assms(1) unfolding uniformly_continuous_on_def by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5558
    then have "\<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"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5559
      using \<open>d>0\<close> using d by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5560
  }
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5561
  then show ?thesis
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5562
    using assms unfolding uniformly_continuous_on_def by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5563
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5564
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5565
text\<open>Continuity in terms of open preimages.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5566
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5567
lemma continuous_at_open:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5568
  "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)))"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5569
  unfolding continuous_within_topological [of x UNIV f]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5570
  unfolding imp_conjL
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5571
  by (intro all_cong imp_cong ex_cong conj_cong refl) auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5572
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  5573
lemma continuous_imp_tendsto:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5574
  assumes "continuous (at x0) f"
61969
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  5575
    and "x \<longlonglongrightarrow> x0"
e01015e49041 more symbols;
wenzelm
parents: 61952
diff changeset
  5576
  shows "(f \<circ> x) \<longlonglongrightarrow> (f x0)"
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  5577
proof (rule topological_tendstoI)
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  5578
  fix S
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  5579
  assume "open S" "f x0 \<in> S"
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  5580
  then obtain T where T_def: "open T" "x0 \<in> T" "\<forall>x\<in>T. f x \<in> S"
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  5581
     using assms continuous_at_open by metis
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  5582
  then have "eventually (\<lambda>n. x n \<in> T) sequentially"
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  5583
    using assms T_def by (auto simp: tendsto_def)
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  5584
  then show "eventually (\<lambda>n. (f \<circ> x) n \<in> S) sequentially"
61810
3c5040d5694a sorted out eventually_mono
paulson <lp15@cam.ac.uk>
parents: 61808
diff changeset
  5585
    using T_def by (auto elim!: eventually_mono)
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  5586
qed
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51350
diff changeset
  5587
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5588
lemma continuous_on_open:
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  5589
  "continuous_on s f \<longleftrightarrow>
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5590
    (\<forall>t. openin (subtopology euclidean (f ` s)) t \<longrightarrow>
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5591
      openin (subtopology euclidean s) {x \<in> s. f x \<in> t})"
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  5592
  unfolding continuous_on_open_invariant openin_open Int_def vimage_def Int_commute
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  5593
  by (simp add: imp_ex imageI conj_commute eq_commute cong: conj_cong)
36441
1d7704c29af3 generalized many lemmas about continuity
huffman
parents: 36440
diff changeset
  5594
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5595
text \<open>Similarly in terms of closed sets.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5596
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5597
lemma continuous_on_closed:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5598
  "continuous_on s f \<longleftrightarrow>
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5599
    (\<forall>t. closedin (subtopology euclidean (f ` s)) t \<longrightarrow>
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5600
      closedin (subtopology euclidean s) {x \<in> s. f x \<in> t})"
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  5601
  unfolding continuous_on_closed_invariant closedin_closed Int_def vimage_def Int_commute
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  5602
  by (simp add: imp_ex imageI conj_commute eq_commute cong: conj_cong)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5603
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5604
text \<open>Half-global and completely global cases.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5605
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5606
lemma continuous_openin_preimage:
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5607
  assumes "continuous_on s f"  "open t"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5608
  shows "openin (subtopology euclidean s) {x \<in> s. f x \<in> t}"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5609
proof -
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5610
  have *: "\<forall>x. x \<in> s \<and> f x \<in> t \<longleftrightarrow> x \<in> s \<and> f x \<in> (t \<inter> f ` s)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5611
    by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5612
  have "openin (subtopology euclidean (f ` s)) (t \<inter> f ` s)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5613
    using openin_open_Int[of t "f ` s", OF assms(2)] unfolding openin_open by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5614
  then show ?thesis
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5615
    using assms(1)[unfolded continuous_on_open, THEN spec[where x="t \<inter> f ` s"]]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5616
    using * by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5617
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5618
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5619
lemma continuous_closedin_preimage:
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5620
  assumes "continuous_on s f" and "closed t"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5621
  shows "closedin (subtopology euclidean s) {x \<in> s. f x \<in> t}"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5622
proof -
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5623
  have *: "\<forall>x. x \<in> s \<and> f x \<in> t \<longleftrightarrow> x \<in> s \<and> f x \<in> (t \<inter> f ` s)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5624
    by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5625
  have "closedin (subtopology euclidean (f ` s)) (t \<inter> f ` s)"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5626
    using closedin_closed_Int[of t "f ` s", OF assms(2)] unfolding Int_commute
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5627
    by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5628
  then show ?thesis
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5629
    using assms(1)[unfolded continuous_on_closed, THEN spec[where x="t \<inter> f ` s"]]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5630
    using * by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5631
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5632
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5633
lemma continuous_open_preimage:
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5634
  assumes "continuous_on s f"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5635
    and "open s"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5636
    and "open t"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5637
  shows "open {x \<in> s. f x \<in> t}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5638
proof-
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5639
  obtain T where T: "open T" "{x \<in> s. f x \<in> t} = s \<inter> T"
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5640
    using continuous_openin_preimage[OF assms(1,3)] unfolding openin_open by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5641
  then show ?thesis
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5642
    using open_Int[of s T, OF assms(2)] by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5643
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5644
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5645
lemma continuous_closed_preimage:
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5646
  assumes "continuous_on s f"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5647
    and "closed s"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5648
    and "closed t"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5649
  shows "closed {x \<in> s. f x \<in> t}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5650
proof-
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5651
  obtain T where "closed T" "{x \<in> s. f x \<in> t} = s \<inter> T"
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5652
    using continuous_closedin_preimage[OF assms(1,3)]
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5653
    unfolding closedin_closed by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5654
  then show ?thesis using closed_Int[of s T, OF assms(2)] by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5655
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5656
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5657
lemma continuous_open_preimage_univ:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5658
  "\<forall>x. continuous (at x) f \<Longrightarrow> open s \<Longrightarrow> open {x. f x \<in> s}"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5659
  using continuous_open_preimage[of UNIV f s] open_UNIV continuous_at_imp_continuous_on by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5660
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5661
lemma continuous_closed_preimage_univ:
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5662
  "(\<forall>x. continuous (at x) f) \<Longrightarrow> closed s \<Longrightarrow> closed {x. f x \<in> s}"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5663
  using continuous_closed_preimage[of UNIV f s] closed_UNIV continuous_at_imp_continuous_on by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5664
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5665
lemma continuous_open_vimage: "\<forall>x. continuous (at x) f \<Longrightarrow> open s \<Longrightarrow> open (f -` s)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5666
  unfolding vimage_def by (rule continuous_open_preimage_univ)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5667
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5668
lemma continuous_closed_vimage: "\<forall>x. continuous (at x) f \<Longrightarrow> closed s \<Longrightarrow> closed (f -` s)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5669
  unfolding vimage_def by (rule continuous_closed_preimage_univ)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5670
36441
1d7704c29af3 generalized many lemmas about continuity
huffman
parents: 36440
diff changeset
  5671
lemma interior_image_subset:
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5672
  assumes "\<forall>x. continuous (at x) f"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5673
    and "inj f"
35172
579dd5570f96 Added integration to Multivariate-Analysis (upto FTC)
himmelma
parents: 35028
diff changeset
  5674
  shows "interior (f ` s) \<subseteq> f ` (interior s)"
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  5675
proof
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  5676
  fix x assume "x \<in> interior (f ` s)"
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  5677
  then obtain T where as: "open T" "x \<in> T" "T \<subseteq> f ` s" ..
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5678
  then have "x \<in> f ` s" by auto
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  5679
  then obtain y where y: "y \<in> s" "x = f y" by auto
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  5680
  have "open (vimage f T)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5681
    using assms(1) \<open>open T\<close> by (rule continuous_open_vimage)
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  5682
  moreover have "y \<in> vimage f T"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5683
    using \<open>x = f y\<close> \<open>x \<in> T\<close> by simp
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  5684
  moreover have "vimage f T \<subseteq> s"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5685
    using \<open>T \<subseteq> image f s\<close> \<open>inj f\<close> unfolding inj_on_def subset_eq by auto
44519
ea85d78a994e simplify definition of 'interior';
huffman
parents: 44518
diff changeset
  5686
  ultimately have "y \<in> interior s" ..
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5687
  with \<open>x = f y\<close> show "x \<in> f ` interior s" ..
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5688
qed
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5689
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5690
text \<open>Equality of continuous functions on closure and related results.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5691
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5692
lemma continuous_closed_in_preimage_constant:
36668
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
  5693
  fixes f :: "_ \<Rightarrow> 'b::t1_space"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5694
  shows "continuous_on s f \<Longrightarrow> closedin (subtopology euclidean s) {x \<in> s. f x = a}"
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  5695
  using continuous_closedin_preimage[of s f "{a}"] by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5696
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5697
lemma continuous_closed_preimage_constant:
36668
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
  5698
  fixes f :: "_ \<Rightarrow> 'b::t1_space"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5699
  shows "continuous_on s f \<Longrightarrow> closed s \<Longrightarrow> closed {x \<in> s. f x = a}"
36668
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
  5700
  using continuous_closed_preimage[of s f "{a}"] by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5701
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5702
lemma continuous_constant_on_closure:
36668
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
  5703
  fixes f :: "_ \<Rightarrow> 'b::t1_space"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5704
  assumes "continuous_on (closure s) f"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5705
    and "\<forall>x \<in> s. f x = a"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5706
  shows "\<forall>x \<in> (closure s). f x = a"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5707
    using continuous_closed_preimage_constant[of "closure s" f a]
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5708
      assms closure_minimal[of s "{x \<in> closure s. f x = a}"] closure_subset
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5709
    unfolding subset_eq
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5710
    by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5711
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5712
lemma image_closure_subset:
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5713
  assumes "continuous_on (closure s) f"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5714
    and "closed t"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5715
    and "(f ` s) \<subseteq> t"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5716
  shows "f ` (closure s) \<subseteq> t"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5717
proof -
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5718
  have "s \<subseteq> {x \<in> closure s. f x \<in> t}"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5719
    using assms(3) closure_subset by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5720
  moreover have "closed {x \<in> closure s. f x \<in> t}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5721
    using continuous_closed_preimage[OF assms(1)] and assms(2) by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5722
  ultimately have "closure s = {x \<in> closure s . f x \<in> t}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5723
    using closure_minimal[of s "{x \<in> closure s. f x \<in> t}"] by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5724
  then show ?thesis by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5725
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5726
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5727
lemma continuous_on_closure_norm_le:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5728
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5729
  assumes "continuous_on (closure s) f"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5730
    and "\<forall>y \<in> s. norm(f y) \<le> b"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5731
    and "x \<in> (closure s)"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5732
  shows "norm (f x) \<le> b"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5733
proof -
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5734
  have *: "f ` s \<subseteq> cball 0 b"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5735
    using assms(2)[unfolded mem_cball_0[symmetric]] by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5736
  show ?thesis
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5737
    using image_closure_subset[OF assms(1) closed_cball[of 0 b] *] assms(3)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5738
    unfolding subset_eq
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5739
    apply (erule_tac x="f x" in ballE)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5740
    apply (auto simp add: dist_norm)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5741
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5742
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5743
61880
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5744
lemma isCont_indicator: 
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5745
  fixes x :: "'a::t2_space"
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5746
  shows "isCont (indicator A :: 'a \<Rightarrow> real) x = (x \<notin> frontier A)"
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5747
proof auto
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5748
  fix x
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5749
  assume cts_at: "isCont (indicator A :: 'a \<Rightarrow> real) x" and fr: "x \<in> frontier A"
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5750
  with continuous_at_open have 1: "\<forall>V::real set. open V \<and> indicator A x \<in> V \<longrightarrow>
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5751
    (\<exists>U::'a set. open U \<and> x \<in> U \<and> (\<forall>y\<in>U. indicator A y \<in> V))" by auto
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5752
  show False
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5753
  proof (cases "x \<in> A")
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5754
    assume x: "x \<in> A"
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5755
    hence "indicator A x \<in> ({0<..<2} :: real set)" by simp
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5756
    hence "\<exists>U. open U \<and> x \<in> U \<and> (\<forall>y\<in>U. indicator A y \<in> ({0<..<2} :: real set))"
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5757
      using 1 open_greaterThanLessThan by blast
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5758
    then guess U .. note U = this
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5759
    hence "\<forall>y\<in>U. indicator A y > (0::real)"
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5760
      unfolding greaterThanLessThan_def by auto
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5761
    hence "U \<subseteq> A" using indicator_eq_0_iff by force
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5762
    hence "x \<in> interior A" using U interiorI by auto
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5763
    thus ?thesis using fr unfolding frontier_def by simp
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5764
  next
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5765
    assume x: "x \<notin> A"
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5766
    hence "indicator A x \<in> ({-1<..<1} :: real set)" by simp
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5767
    hence "\<exists>U. open U \<and> x \<in> U \<and> (\<forall>y\<in>U. indicator A y \<in> ({-1<..<1} :: real set))"
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5768
      using 1 open_greaterThanLessThan by blast
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5769
    then guess U .. note U = this
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5770
    hence "\<forall>y\<in>U. indicator A y < (1::real)"
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5771
      unfolding greaterThanLessThan_def by auto
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5772
    hence "U \<subseteq> -A" by auto
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5773
    hence "x \<in> interior (-A)" using U interiorI by auto
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5774
    thus ?thesis using fr interior_complement unfolding frontier_def by auto
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5775
  qed
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5776
next
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5777
  assume nfr: "x \<notin> frontier A"
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5778
  hence "x \<in> interior A \<or> x \<in> interior (-A)"
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5779
    by (auto simp: frontier_def closure_interior)
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5780
  thus "isCont ((indicator A)::'a \<Rightarrow> real) x"
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5781
  proof
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5782
    assume int: "x \<in> interior A"
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5783
    hence "\<exists>U. open U \<and> x \<in> U \<and> U \<subseteq> A" unfolding interior_def by auto
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5784
    then guess U .. note U = this
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5785
    hence "\<forall>y\<in>U. indicator A y = (1::real)" unfolding indicator_def by auto
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5786
    hence "continuous_on U (indicator A)" by (simp add: continuous_on_const indicator_eq_1_iff)
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5787
    thus ?thesis using U continuous_on_eq_continuous_at by auto
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5788
  next
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5789
    assume ext: "x \<in> interior (-A)"
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5790
    hence "\<exists>U. open U \<and> x \<in> U \<and> U \<subseteq> -A" unfolding interior_def by auto
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5791
    then guess U .. note U = this
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5792
    hence "\<forall>y\<in>U. indicator A y = (0::real)" unfolding indicator_def by auto
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5793
    hence "continuous_on U (indicator A)" by (smt U continuous_on_topological indicator_def)
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5794
    thus ?thesis using U continuous_on_eq_continuous_at by auto
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5795
  qed
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5796
qed
ff4d33058566 moved some theorems from the CLT proof; reordered some theorems / notation
hoelzl
parents: 61848
diff changeset
  5797
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5798
text \<open>Making a continuous function avoid some value in a neighbourhood.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5799
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5800
lemma continuous_within_avoid:
50898
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  5801
  fixes f :: "'a::metric_space \<Rightarrow> 'b::t1_space"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5802
  assumes "continuous (at x within s) f"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5803
    and "f x \<noteq> a"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5804
  shows "\<exists>e>0. \<forall>y \<in> s. dist x y < e --> f y \<noteq> a"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5805
proof -
50898
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  5806
  obtain U where "open U" and "f x \<in> U" and "a \<notin> U"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5807
    using t1_space [OF \<open>f x \<noteq> a\<close>] by fast
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  5808
  have "(f \<longlongrightarrow> f x) (at x within s)"
50898
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  5809
    using assms(1) by (simp add: continuous_within)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5810
  then have "eventually (\<lambda>y. f y \<in> U) (at x within s)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5811
    using \<open>open U\<close> and \<open>f x \<in> U\<close>
50898
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  5812
    unfolding tendsto_def by fast
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5813
  then have "eventually (\<lambda>y. f y \<noteq> a) (at x within s)"
61810
3c5040d5694a sorted out eventually_mono
paulson <lp15@cam.ac.uk>
parents: 61808
diff changeset
  5814
    using \<open>a \<notin> U\<close> by (fast elim: eventually_mono)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5815
  then show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5816
    using \<open>f x \<noteq> a\<close> by (auto simp: dist_commute zero_less_dist_iff eventually_at)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5817
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5818
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5819
lemma continuous_at_avoid:
50898
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  5820
  fixes f :: "'a::metric_space \<Rightarrow> 'b::t1_space"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5821
  assumes "continuous (at x) f"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5822
    and "f x \<noteq> a"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5823
  shows "\<exists>e>0. \<forall>y. dist x y < e \<longrightarrow> f y \<noteq> a"
45031
9583f2b56f85 add lemmas within_empty and tendsto_bot;
huffman
parents: 44909
diff changeset
  5824
  using assms continuous_within_avoid[of x UNIV f a] by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5825
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5826
lemma continuous_on_avoid:
50898
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  5827
  fixes f :: "'a::metric_space \<Rightarrow> 'b::t1_space"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5828
  assumes "continuous_on s f"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5829
    and "x \<in> s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5830
    and "f x \<noteq> a"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5831
  shows "\<exists>e>0. \<forall>y \<in> s. dist x y < e \<longrightarrow> f y \<noteq> a"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5832
  using assms(1)[unfolded continuous_on_eq_continuous_within, THEN bspec[where x=x],
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5833
    OF assms(2)] continuous_within_avoid[of x s f a]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5834
  using assms(3)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5835
  by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5836
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5837
lemma continuous_on_open_avoid:
50898
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  5838
  fixes f :: "'a::metric_space \<Rightarrow> 'b::t1_space"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5839
  assumes "continuous_on s f"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5840
    and "open s"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5841
    and "x \<in> s"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5842
    and "f x \<noteq> a"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5843
  shows "\<exists>e>0. \<forall>y. dist x y < e \<longrightarrow> f y \<noteq> a"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5844
  using assms(1)[unfolded continuous_on_eq_continuous_at[OF assms(2)], THEN bspec[where x=x], OF assms(3)]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5845
  using continuous_at_avoid[of x f a] assms(4)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5846
  by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5847
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5848
text \<open>Proving a function is constant by proving open-ness of level set.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5849
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5850
lemma continuous_levelset_open_in_cases:
36668
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
  5851
  fixes f :: "_ \<Rightarrow> 'b::t1_space"
36359
e5c785c166b2 generalize type of continuous_on
huffman
parents: 36358
diff changeset
  5852
  shows "connected s \<Longrightarrow> continuous_on s f \<Longrightarrow>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5853
        openin (subtopology euclidean s) {x \<in> s. f x = a}
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5854
        \<Longrightarrow> (\<forall>x \<in> s. f x \<noteq> a) \<or> (\<forall>x \<in> s. f x = a)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5855
  unfolding connected_clopen
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5856
  using continuous_closed_in_preimage_constant by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5857
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5858
lemma continuous_levelset_open_in:
36668
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
  5859
  fixes f :: "_ \<Rightarrow> 'b::t1_space"
36359
e5c785c166b2 generalize type of continuous_on
huffman
parents: 36358
diff changeset
  5860
  shows "connected s \<Longrightarrow> continuous_on s f \<Longrightarrow>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5861
        openin (subtopology euclidean s) {x \<in> s. f x = a} \<Longrightarrow>
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5862
        (\<exists>x \<in> s. f x = a)  \<Longrightarrow> (\<forall>x \<in> s. f x = a)"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5863
  using continuous_levelset_open_in_cases[of s f ]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5864
  by meson
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5865
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5866
lemma continuous_levelset_open:
36668
941ba2da372e simplify definition of t1_space; generalize lemma closed_sing and related lemmas
huffman
parents: 36667
diff changeset
  5867
  fixes f :: "_ \<Rightarrow> 'b::t1_space"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5868
  assumes "connected s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5869
    and "continuous_on s f"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5870
    and "open {x \<in> s. f x = a}"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5871
    and "\<exists>x \<in> s.  f x = a"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5872
  shows "\<forall>x \<in> s. f x = a"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5873
  using continuous_levelset_open_in[OF assms(1,2), of a, unfolded openin_open]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5874
  using assms (3,4)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5875
  by fast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5876
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5877
text \<open>Some arithmetical combinations (more to prove).\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5878
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5879
lemma open_scaling[intro]:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5880
  fixes s :: "'a::real_normed_vector set"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5881
  assumes "c \<noteq> 0"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5882
    and "open s"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5883
  shows "open((\<lambda>x. c *\<^sub>R x) ` s)"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5884
proof -
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5885
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5886
    fix x
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5887
    assume "x \<in> s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5888
    then obtain e where "e>0"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5889
      and e:"\<forall>x'. dist x' x < e \<longrightarrow> x' \<in> s" using assms(2)[unfolded open_dist, THEN bspec[where x=x]]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5890
      by auto
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61942
diff changeset
  5891
    have "e * \<bar>c\<bar> > 0"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5892
      using assms(1)[unfolded zero_less_abs_iff[symmetric]] \<open>e>0\<close> by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5893
    moreover
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5894
    {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5895
      fix y
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5896
      assume "dist y (c *\<^sub>R x) < e * \<bar>c\<bar>"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5897
      then have "norm ((1 / c) *\<^sub>R y - x) < e"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5898
        unfolding dist_norm
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5899
        using norm_scaleR[of c "(1 / c) *\<^sub>R y - x", unfolded scaleR_right_diff_distrib, unfolded scaleR_scaleR] assms(1)
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5900
          assms(1)[unfolded zero_less_abs_iff[symmetric]] by (simp del:zero_less_abs_iff)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5901
      then have "y \<in> op *\<^sub>R c ` s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5902
        using rev_image_eqI[of "(1 / c) *\<^sub>R y" s y "op *\<^sub>R c"]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5903
        using e[THEN spec[where x="(1 / c) *\<^sub>R y"]]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5904
        using assms(1)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5905
        unfolding dist_norm scaleR_scaleR
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5906
        by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5907
    }
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5908
    ultimately have "\<exists>e>0. \<forall>x'. dist x' (c *\<^sub>R x) < e \<longrightarrow> x' \<in> op *\<^sub>R c ` s"
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61942
diff changeset
  5909
      apply (rule_tac x="e * \<bar>c\<bar>" in exI)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5910
      apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5911
      done
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5912
  }
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5913
  then show ?thesis unfolding open_dist by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5914
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5915
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5916
lemma minus_image_eq_vimage:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5917
  fixes A :: "'a::ab_group_add set"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5918
  shows "(\<lambda>x. - x) ` A = (\<lambda>x. - x) -` A"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5919
  by (auto intro!: image_eqI [where f="\<lambda>x. - x"])
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5920
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5921
lemma open_negations:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5922
  fixes s :: "'a::real_normed_vector set"
54489
03ff4d1e6784 eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents: 54263
diff changeset
  5923
  shows "open s \<Longrightarrow> open ((\<lambda>x. - x) ` s)"
03ff4d1e6784 eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents: 54263
diff changeset
  5924
  using open_scaling [of "- 1" s] by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5925
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5926
lemma open_translation:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5927
  fixes s :: "'a::real_normed_vector set"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5928
  assumes "open s"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  5929
  shows "open((\<lambda>x. a + x) ` s)"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5930
proof -
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5931
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5932
    fix x
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5933
    have "continuous (at x) (\<lambda>x. x - a)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5934
      by (intro continuous_diff continuous_at_id continuous_const)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5935
  }
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5936
  moreover have "{x. x - a \<in> s} = op + a ` s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5937
    by force
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5938
  ultimately show ?thesis using continuous_open_preimage_univ[of "\<lambda>x. x - a" s]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5939
    using assms by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5940
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5941
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5942
lemma open_affinity:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5943
  fixes s :: "'a::real_normed_vector set"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5944
  assumes "open s"  "c \<noteq> 0"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5945
  shows "open ((\<lambda>x. a + c *\<^sub>R x) ` s)"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5946
proof -
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5947
  have *: "(\<lambda>x. a + c *\<^sub>R x) = (\<lambda>x. a + x) \<circ> (\<lambda>x. c *\<^sub>R x)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5948
    unfolding o_def ..
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5949
  have "op + a ` op *\<^sub>R c ` s = (op + a \<circ> op *\<^sub>R c) ` s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5950
    by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5951
  then show ?thesis
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5952
    using assms open_translation[of "op *\<^sub>R c ` s" a]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5953
    unfolding *
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5954
    by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5955
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5956
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5957
lemma interior_translation:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5958
  fixes s :: "'a::real_normed_vector set"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5959
  shows "interior ((\<lambda>x. a + x) ` s) = (\<lambda>x. a + x) ` (interior s)"
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39198
diff changeset
  5960
proof (rule set_eqI, rule)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5961
  fix x
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5962
  assume "x \<in> interior (op + a ` s)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5963
  then obtain e where "e > 0" and e: "ball x e \<subseteq> op + a ` s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5964
    unfolding mem_interior by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5965
  then have "ball (x - a) e \<subseteq> s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5966
    unfolding subset_eq Ball_def mem_ball dist_norm
59815
cce82e360c2f explicit commutative additive inverse operation;
haftmann
parents: 59765
diff changeset
  5967
    by (auto simp add: diff_diff_eq)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5968
  then show "x \<in> op + a ` interior s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5969
    unfolding image_iff
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5970
    apply (rule_tac x="x - a" in bexI)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5971
    unfolding mem_interior
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5972
    using \<open>e > 0\<close>
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5973
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5974
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  5975
next
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5976
  fix x
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5977
  assume "x \<in> op + a ` interior s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5978
  then obtain y e where "e > 0" and e: "ball y e \<subseteq> s" and y: "x = a + y"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5979
    unfolding image_iff Bex_def mem_interior by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5980
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5981
    fix z
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5982
    have *: "a + y - z = y + a - z" by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5983
    assume "z \<in> ball x e"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5984
    then have "z - a \<in> s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5985
      using e[unfolded subset_eq, THEN bspec[where x="z - a"]]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5986
      unfolding mem_ball dist_norm y group_add_class.diff_diff_eq2 *
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5987
      by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5988
    then have "z \<in> op + a ` s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5989
      unfolding image_iff by (auto intro!: bexI[where x="z - a"])
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5990
  }
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5991
  then have "ball x e \<subseteq> op + a ` s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5992
    unfolding subset_eq by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  5993
  then show "x \<in> interior (op + a ` s)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5994
    unfolding mem_interior using \<open>e > 0\<close> by auto
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5995
qed
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5996
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  5997
text \<open>Topological properties of linear functions.\<close>
36437
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  5998
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  5999
lemma linear_lim_0:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6000
  assumes "bounded_linear f"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6001
  shows "(f \<longlongrightarrow> 0) (at (0))"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6002
proof -
36437
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  6003
  interpret f: bounded_linear f by fact
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6004
  have "(f \<longlongrightarrow> f 0) (at 0)"
36437
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  6005
    using tendsto_ident_at by (rule f.tendsto)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6006
  then show ?thesis unfolding f.zero .
36437
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  6007
qed
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  6008
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  6009
lemma linear_continuous_at:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6010
  assumes "bounded_linear f"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6011
  shows "continuous (at a) f"
36437
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  6012
  unfolding continuous_at using assms
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  6013
  apply (rule bounded_linear.tendsto)
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  6014
  apply (rule tendsto_ident_at)
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  6015
  done
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  6016
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  6017
lemma linear_continuous_within:
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6018
  "bounded_linear f \<Longrightarrow> continuous (at x within s) f"
36437
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  6019
  using continuous_at_imp_continuous_within[of x f s] using linear_continuous_at[of f] by auto
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  6020
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  6021
lemma linear_continuous_on:
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6022
  "bounded_linear f \<Longrightarrow> continuous_on s f"
36437
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  6023
  using continuous_at_imp_continuous_on[of s f] using linear_continuous_at[of f] by auto
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  6024
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6025
text \<open>Also bilinear functions, in composition form.\<close>
36437
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  6026
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  6027
lemma bilinear_continuous_at_compose:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6028
  "continuous (at x) f \<Longrightarrow> continuous (at x) g \<Longrightarrow> bounded_bilinear h \<Longrightarrow>
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6029
    continuous (at x) (\<lambda>x. h (f x) (g x))"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6030
  unfolding continuous_at
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6031
  using Lim_bilinear[of f "f x" "(at x)" g "g x" h]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6032
  by auto
36437
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  6033
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  6034
lemma bilinear_continuous_within_compose:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6035
  "continuous (at x within s) f \<Longrightarrow> continuous (at x within s) g \<Longrightarrow> bounded_bilinear h \<Longrightarrow>
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6036
    continuous (at x within s) (\<lambda>x. h (f x) (g x))"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61552
diff changeset
  6037
  by (rule Limits.bounded_bilinear.continuous)
36437
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  6038
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  6039
lemma bilinear_continuous_on_compose:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6040
  "continuous_on s f \<Longrightarrow> continuous_on s g \<Longrightarrow> bounded_bilinear h \<Longrightarrow>
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6041
    continuous_on s (\<lambda>x. h (f x) (g x))"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61552
diff changeset
  6042
  by (rule Limits.bounded_bilinear.continuous_on)
36437
e76cb1d4663c reorganize subsection headings
huffman
parents: 36431
diff changeset
  6043
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6044
text \<open>Preservation of compactness and connectedness under continuous function.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6045
50898
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6046
lemma compact_eq_openin_cover:
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6047
  "compact S \<longleftrightarrow>
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6048
    (\<forall>C. (\<forall>c\<in>C. openin (subtopology euclidean S) c) \<and> S \<subseteq> \<Union>C \<longrightarrow>
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6049
      (\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union>D))"
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6050
proof safe
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6051
  fix C
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6052
  assume "compact S" and "\<forall>c\<in>C. openin (subtopology euclidean S) c" and "S \<subseteq> \<Union>C"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6053
  then have "\<forall>c\<in>{T. open T \<and> S \<inter> T \<in> C}. open c" and "S \<subseteq> \<Union>{T. open T \<and> S \<inter> T \<in> C}"
50898
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6054
    unfolding openin_open by force+
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6055
  with \<open>compact S\<close> obtain D where "D \<subseteq> {T. open T \<and> S \<inter> T \<in> C}" and "finite D" and "S \<subseteq> \<Union>D"
50898
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6056
    by (rule compactE)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6057
  then have "image (\<lambda>T. S \<inter> T) D \<subseteq> C \<and> finite (image (\<lambda>T. S \<inter> T) D) \<and> S \<subseteq> \<Union>(image (\<lambda>T. S \<inter> T) D)"
50898
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6058
    by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6059
  then show "\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union>D" ..
50898
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6060
next
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6061
  assume 1: "\<forall>C. (\<forall>c\<in>C. openin (subtopology euclidean S) c) \<and> S \<subseteq> \<Union>C \<longrightarrow>
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6062
        (\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union>D)"
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6063
  show "compact S"
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6064
  proof (rule compactI)
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6065
    fix C
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6066
    let ?C = "image (\<lambda>T. S \<inter> T) C"
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6067
    assume "\<forall>t\<in>C. open t" and "S \<subseteq> \<Union>C"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6068
    then have "(\<forall>c\<in>?C. openin (subtopology euclidean S) c) \<and> S \<subseteq> \<Union>?C"
50898
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6069
      unfolding openin_open by auto
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6070
    with 1 obtain D where "D \<subseteq> ?C" and "finite D" and "S \<subseteq> \<Union>D"
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6071
      by metis
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6072
    let ?D = "inv_into C (\<lambda>T. S \<inter> T) ` D"
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6073
    have "?D \<subseteq> C \<and> finite ?D \<and> S \<subseteq> \<Union>?D"
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6074
    proof (intro conjI)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6075
      from \<open>D \<subseteq> ?C\<close> show "?D \<subseteq> C"
50898
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6076
        by (fast intro: inv_into_into)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6077
      from \<open>finite D\<close> show "finite ?D"
50898
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6078
        by (rule finite_imageI)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6079
      from \<open>S \<subseteq> \<Union>D\<close> show "S \<subseteq> \<Union>?D"
50898
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6080
        apply (rule subset_trans)
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6081
        apply clarsimp
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6082
        apply (frule subsetD [OF \<open>D \<subseteq> ?C\<close>, THEN f_inv_into_f])
50898
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6083
        apply (erule rev_bexI, fast)
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6084
        done
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6085
    qed
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6086
    then show "\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union>D" ..
50898
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6087
  qed
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6088
qed
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  6089
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6090
lemma connected_continuous_image:
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6091
  assumes "continuous_on s f"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6092
    and "connected s"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6093
  shows "connected(f ` s)"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6094
proof -
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6095
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6096
    fix T
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6097
    assume as:
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6098
      "T \<noteq> {}"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6099
      "T \<noteq> f ` s"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6100
      "openin (subtopology euclidean (f ` s)) T"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6101
      "closedin (subtopology euclidean (f ` s)) T"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6102
    have "{x \<in> s. f x \<in> T} = {} \<or> {x \<in> s. f x \<in> T} = s"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6103
      using assms(1)[unfolded continuous_on_open, THEN spec[where x=T]]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6104
      using assms(1)[unfolded continuous_on_closed, THEN spec[where x=T]]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6105
      using assms(2)[unfolded connected_clopen, THEN spec[where x="{x \<in> s. f x \<in> T}"]] as(3,4) by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6106
    then have False using as(1,2)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6107
      using as(4)[unfolded closedin_def topspace_euclidean_subtopology] by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6108
  }
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6109
  then show ?thesis
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6110
    unfolding connected_clopen by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6111
qed
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61552
diff changeset
  6112
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6113
lemma connected_linear_image:
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6114
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6115
  assumes "linear f" and "connected s"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6116
  shows "connected (f ` s)"
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6117
using connected_continuous_image assms linear_continuous_on linear_conv_bounded_linear by blast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6118
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6119
text \<open>Continuity implies uniform continuity on a compact domain.\<close>
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6120
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6121
lemma compact_uniformly_continuous:
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6122
  assumes f: "continuous_on s f"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6123
    and s: "compact s"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6124
  shows "uniformly_continuous_on s f"
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  6125
  unfolding uniformly_continuous_on_def
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  6126
proof (cases, safe)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6127
  fix e :: real
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6128
  assume "0 < e" "s \<noteq> {}"
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  6129
  def [simp]: R \<equiv> "{(y, d). y \<in> s \<and> 0 < d \<and> ball y d \<inter> s \<subseteq> {x \<in> s. f x \<in> ball (f y) (e/2) } }"
50944
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  6130
  let ?b = "(\<lambda>(y, d). ball y (d/2))"
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  6131
  have "(\<forall>r\<in>R. open (?b r))" "s \<subseteq> (\<Union>r\<in>R. ?b r)"
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  6132
  proof safe
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6133
    fix y
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6134
    assume "y \<in> s"
61518
ff12606337e9 new lemmas about topology, etc., for Cauchy integral formula
paulson
parents: 61426
diff changeset
  6135
    from continuous_openin_preimage[OF f open_ball]
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  6136
    obtain T where "open T" and T: "{x \<in> s. f x \<in> ball (f y) (e/2)} = T \<inter> s"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  6137
      unfolding openin_subtopology open_openin by metis
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  6138
    then obtain d where "ball y d \<subseteq> T" "0 < d"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6139
      using \<open>0 < e\<close> \<open>y \<in> s\<close> by (auto elim!: openE)
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6140
    with T \<open>y \<in> s\<close> show "y \<in> (\<Union>r\<in>R. ?b r)"
50944
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  6141
      by (intro UN_I[of "(y, d)"]) auto
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  6142
  qed auto
50944
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  6143
  with s obtain D where D: "finite D" "D \<subseteq> R" "s \<subseteq> (\<Union>(y, d)\<in>D. ball y (d/2))"
03b11adf1f33 simplified prove of compact_imp_bounded
hoelzl
parents: 50943
diff changeset
  6144
    by (rule compactE_image)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6145
  with \<open>s \<noteq> {}\<close> have [simp]: "\<And>x. x < Min (snd ` D) \<longleftrightarrow> (\<forall>(y, d)\<in>D. x < d)"
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  6146
    by (subst Min_gr_iff) auto
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  6147
  show "\<exists>d>0. \<forall>x\<in>s. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f x') (f x) < e"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  6148
  proof (rule, safe)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6149
    fix x x'
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6150
    assume in_s: "x' \<in> s" "x \<in> s"
50943
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  6151
    with D obtain y d where x: "x \<in> ball y (d/2)" "(y, d) \<in> D"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  6152
      by blast
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  6153
    moreover assume "dist x x' < Min (snd`D) / 2"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  6154
    ultimately have "dist y x' < d"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  6155
      by (intro dist_double[where x=x and d=d]) (auto simp: dist_commute)
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  6156
    with D x in_s show  "dist (f x) (f x') < e"
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  6157
      by (intro dist_double[where x="f y" and d=e]) (auto simp: dist_commute subset_eq)
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  6158
  qed (insert D, auto)
88a00a1c7c2c use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
hoelzl
parents: 50942
diff changeset
  6159
qed auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6160
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6161
text \<open>A uniformly convergent limit of continuous functions is continuous.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6162
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6163
lemma continuous_uniform_limit:
44212
4d10e7f342b1 generalize lemma continuous_uniform_limit to class metric_space
huffman
parents: 44211
diff changeset
  6164
  fixes f :: "'a \<Rightarrow> 'b::metric_space \<Rightarrow> 'c::metric_space"
4d10e7f342b1 generalize lemma continuous_uniform_limit to class metric_space
huffman
parents: 44211
diff changeset
  6165
  assumes "\<not> trivial_limit F"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6166
    and "eventually (\<lambda>n. continuous_on s (f n)) F"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6167
    and "\<forall>e>0. eventually (\<lambda>n. \<forall>x\<in>s. dist (f n x) (g x) < e) F"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6168
  shows "continuous_on s g"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6169
proof -
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6170
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6171
    fix x and e :: real
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6172
    assume "x\<in>s" "e>0"
44212
4d10e7f342b1 generalize lemma continuous_uniform_limit to class metric_space
huffman
parents: 44211
diff changeset
  6173
    have "eventually (\<lambda>n. \<forall>x\<in>s. dist (f n x) (g x) < e / 3) F"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6174
      using \<open>e>0\<close> assms(3)[THEN spec[where x="e/3"]] by auto
44212
4d10e7f342b1 generalize lemma continuous_uniform_limit to class metric_space
huffman
parents: 44211
diff changeset
  6175
    from eventually_happens [OF eventually_conj [OF this assms(2)]]
4d10e7f342b1 generalize lemma continuous_uniform_limit to class metric_space
huffman
parents: 44211
diff changeset
  6176
    obtain n where n:"\<forall>x\<in>s. dist (f n x) (g x) < e / 3"  "continuous_on s (f n)"
4d10e7f342b1 generalize lemma continuous_uniform_limit to class metric_space
huffman
parents: 44211
diff changeset
  6177
      using assms(1) by blast
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6178
    have "e / 3 > 0" using \<open>e>0\<close> by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6179
    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"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6180
      using n(2)[unfolded continuous_on_iff, THEN bspec[where x=x], OF \<open>x\<in>s\<close>, THEN spec[where x="e/3"]] by blast
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6181
    {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6182
      fix y
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6183
      assume "y \<in> s" and "dist y x < d"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6184
      then have "dist (f n y) (f n x) < e / 3"
44212
4d10e7f342b1 generalize lemma continuous_uniform_limit to class metric_space
huffman
parents: 44211
diff changeset
  6185
        by (rule d [rule_format])
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6186
      then have "dist (f n y) (g x) < 2 * e / 3"
44212
4d10e7f342b1 generalize lemma continuous_uniform_limit to class metric_space
huffman
parents: 44211
diff changeset
  6187
        using dist_triangle [of "f n y" "g x" "f n x"]
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6188
        using n(1)[THEN bspec[where x=x], OF \<open>x\<in>s\<close>]
44212
4d10e7f342b1 generalize lemma continuous_uniform_limit to class metric_space
huffman
parents: 44211
diff changeset
  6189
        by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6190
      then have "dist (g y) (g x) < e"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6191
        using n(1)[THEN bspec[where x=y], OF \<open>y\<in>s\<close>]
44212
4d10e7f342b1 generalize lemma continuous_uniform_limit to class metric_space
huffman
parents: 44211
diff changeset
  6192
        using dist_triangle3 [of "g y" "g x" "f n y"]
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6193
        by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6194
    }
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6195
    then have "\<exists>d>0. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (g x') (g x) < e"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6196
      using \<open>d>0\<close> by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6197
  }
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6198
  then show ?thesis
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6199
    unfolding continuous_on_iff by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6200
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6201
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  6202
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6203
subsection \<open>Topological stuff lifted from and dropped to R\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6204
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6205
lemma open_real:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6206
  fixes s :: "real set"
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61942
diff changeset
  6207
  shows "open s \<longleftrightarrow> (\<forall>x \<in> s. \<exists>e>0. \<forall>x'. \<bar>x' - x\<bar> < e --> x' \<in> s)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6208
  unfolding open_dist dist_norm by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6209
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6210
lemma islimpt_approachable_real:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6211
  fixes s :: "real set"
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61942
diff changeset
  6212
  shows "x islimpt s \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in> s. x' \<noteq> x \<and> \<bar>x' - x\<bar> < e)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6213
  unfolding islimpt_approachable dist_norm by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6214
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6215
lemma closed_real:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6216
  fixes s :: "real set"
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61942
diff changeset
  6217
  shows "closed s \<longleftrightarrow> (\<forall>x. (\<forall>e>0.  \<exists>x' \<in> s. x' \<noteq> x \<and> \<bar>x' - x\<bar> < e) \<longrightarrow> x \<in> s)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6218
  unfolding closed_limpt islimpt_approachable dist_norm by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6219
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6220
lemma continuous_at_real_range:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6221
  fixes f :: "'a::real_normed_vector \<Rightarrow> real"
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61942
diff changeset
  6222
  shows "continuous (at x) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. \<forall>x'. norm(x' - x) < d --> \<bar>f x' - f x\<bar> < e)"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6223
  unfolding continuous_at
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6224
  unfolding Lim_at
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6225
  unfolding dist_nz[symmetric]
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6226
  unfolding dist_norm
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6227
  apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6228
  apply (erule_tac x=e in allE)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6229
  apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6230
  apply (rule_tac x=d in exI)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6231
  apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6232
  apply (erule_tac x=x' in allE)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6233
  apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6234
  apply (erule_tac x=e in allE)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6235
  apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6236
  done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6237
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6238
lemma continuous_on_real_range:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6239
  fixes f :: "'a::real_normed_vector \<Rightarrow> real"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6240
  shows "continuous_on s f \<longleftrightarrow>
61945
1135b8de26c3 more symbols;
wenzelm
parents: 61942
diff changeset
  6241
    (\<forall>x \<in> s. \<forall>e>0. \<exists>d>0. (\<forall>x' \<in> s. norm(x' - x) < d \<longrightarrow> \<bar>f x' - f x\<bar> < e))"
36359
e5c785c166b2 generalize type of continuous_on
huffman
parents: 36358
diff changeset
  6242
  unfolding continuous_on_iff dist_norm by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6243
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6244
text \<open>Hence some handy theorems on distance, diameter etc. of/from a set.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6245
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6246
lemma distance_attains_sup:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6247
  assumes "compact s" "s \<noteq> {}"
51346
d33de22432e2 tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
hoelzl
parents: 51345
diff changeset
  6248
  shows "\<exists>x\<in>s. \<forall>y\<in>s. dist a y \<le> dist a x"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6249
proof (rule continuous_attains_sup [OF assms])
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6250
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6251
    fix x
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6252
    assume "x\<in>s"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6253
    have "(dist a \<longlongrightarrow> dist a x) (at x within s)"
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51530
diff changeset
  6254
      by (intro tendsto_dist tendsto_const tendsto_ident_at)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6255
  }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6256
  then show "continuous_on s (dist a)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6257
    unfolding continuous_on ..
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6258
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6259
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6260
text \<open>For \emph{minimal} distance, we only need closure, not compactness.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6261
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6262
lemma distance_attains_inf:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6263
  fixes a :: "'a::heine_borel"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6264
  assumes "closed s"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6265
    and "s \<noteq> {}"
51346
d33de22432e2 tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
hoelzl
parents: 51345
diff changeset
  6266
  shows "\<exists>x\<in>s. \<forall>y\<in>s. dist a x \<le> dist a y"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6267
proof -
51346
d33de22432e2 tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
hoelzl
parents: 51345
diff changeset
  6268
  from assms(2) obtain b where "b \<in> s" by auto
d33de22432e2 tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
hoelzl
parents: 51345
diff changeset
  6269
  let ?B = "s \<inter> cball a (dist b a)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6270
  have "?B \<noteq> {}" using \<open>b \<in> s\<close>
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6271
    by (auto simp add: dist_commute)
51346
d33de22432e2 tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
hoelzl
parents: 51345
diff changeset
  6272
  moreover have "continuous_on ?B (dist a)"
d33de22432e2 tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
hoelzl
parents: 51345
diff changeset
  6273
    by (auto intro!: continuous_at_imp_continuous_on continuous_dist continuous_at_id continuous_const)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6274
  moreover have "compact ?B"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6275
    by (intro closed_inter_compact \<open>closed s\<close> compact_cball)
51346
d33de22432e2 tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
hoelzl
parents: 51345
diff changeset
  6276
  ultimately obtain x where "x \<in> ?B" "\<forall>y\<in>?B. dist a x \<le> dist a y"
d33de22432e2 tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
hoelzl
parents: 51345
diff changeset
  6277
    by (metis continuous_attains_inf)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6278
  then show ?thesis by fastforce
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6279
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6280
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  6281
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6282
subsection \<open>Pasted sets\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6283
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6284
lemma bounded_Times:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6285
  assumes "bounded s" "bounded t"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6286
  shows "bounded (s \<times> t)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6287
proof -
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6288
  obtain x y a b where "\<forall>z\<in>s. dist x z \<le> a" "\<forall>z\<in>t. dist y z \<le> b"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6289
    using assms [unfolded bounded_def] by auto
53015
a1119cf551e8 standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents: 52625
diff changeset
  6290
  then have "\<forall>z\<in>s \<times> t. dist (x, y) z \<le> sqrt (a\<^sup>2 + b\<^sup>2)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6291
    by (auto simp add: dist_Pair_Pair real_sqrt_le_mono add_mono power_mono)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6292
  then show ?thesis unfolding bounded_any_center [where a="(x, y)"] by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6293
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6294
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6295
lemma mem_Times_iff: "x \<in> A \<times> B \<longleftrightarrow> fst x \<in> A \<and> snd x \<in> B"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6296
  by (induct x) simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6297
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  6298
lemma seq_compact_Times: "seq_compact s \<Longrightarrow> seq_compact t \<Longrightarrow> seq_compact (s \<times> t)"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6299
  unfolding seq_compact_def
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6300
  apply clarify
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6301
  apply (drule_tac x="fst \<circ> f" in spec)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6302
  apply (drule mp, simp add: mem_Times_iff)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6303
  apply (clarify, rename_tac l1 r1)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6304
  apply (drule_tac x="snd \<circ> f \<circ> r1" in spec)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6305
  apply (drule mp, simp add: mem_Times_iff)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6306
  apply (clarify, rename_tac l2 r2)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6307
  apply (rule_tac x="(l1, l2)" in rev_bexI, simp)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6308
  apply (rule_tac x="r1 \<circ> r2" in exI)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6309
  apply (rule conjI, simp add: subseq_def)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6310
  apply (drule_tac f=r2 in LIMSEQ_subseq_LIMSEQ, assumption)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6311
  apply (drule (1) tendsto_Pair) back
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6312
  apply (simp add: o_def)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6313
  done
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6314
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6315
lemma compact_Times:
51349
166170c5f8a2 generalized compact_Times to topological_space
hoelzl
parents: 51348
diff changeset
  6316
  assumes "compact s" "compact t"
166170c5f8a2 generalized compact_Times to topological_space
hoelzl
parents: 51348
diff changeset
  6317
  shows "compact (s \<times> t)"
166170c5f8a2 generalized compact_Times to topological_space
hoelzl
parents: 51348
diff changeset
  6318
proof (rule compactI)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6319
  fix C
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6320
  assume C: "\<forall>t\<in>C. open t" "s \<times> t \<subseteq> \<Union>C"
51349
166170c5f8a2 generalized compact_Times to topological_space
hoelzl
parents: 51348
diff changeset
  6321
  have "\<forall>x\<in>s. \<exists>a. open a \<and> x \<in> a \<and> (\<exists>d\<subseteq>C. finite d \<and> a \<times> t \<subseteq> \<Union>d)"
166170c5f8a2 generalized compact_Times to topological_space
hoelzl
parents: 51348
diff changeset
  6322
  proof
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6323
    fix x
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6324
    assume "x \<in> s"
51349
166170c5f8a2 generalized compact_Times to topological_space
hoelzl
parents: 51348
diff changeset
  6325
    have "\<forall>y\<in>t. \<exists>a b c. c \<in> C \<and> open a \<and> open b \<and> x \<in> a \<and> y \<in> b \<and> a \<times> b \<subseteq> c" (is "\<forall>y\<in>t. ?P y")
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6326
    proof
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6327
      fix y
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6328
      assume "y \<in> t"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6329
      with \<open>x \<in> s\<close> C obtain c where "c \<in> C" "(x, y) \<in> c" "open c" by auto
51349
166170c5f8a2 generalized compact_Times to topological_space
hoelzl
parents: 51348
diff changeset
  6330
      then show "?P y" by (auto elim!: open_prod_elim)
166170c5f8a2 generalized compact_Times to topological_space
hoelzl
parents: 51348
diff changeset
  6331
    qed
166170c5f8a2 generalized compact_Times to topological_space
hoelzl
parents: 51348
diff changeset
  6332
    then obtain a b c where b: "\<And>y. y \<in> t \<Longrightarrow> open (b y)"
166170c5f8a2 generalized compact_Times to topological_space
hoelzl
parents: 51348
diff changeset
  6333
      and c: "\<And>y. y \<in> t \<Longrightarrow> c y \<in> C \<and> open (a y) \<and> open (b y) \<and> x \<in> a y \<and> y \<in> b y \<and> a y \<times> b y \<subseteq> c y"
166170c5f8a2 generalized compact_Times to topological_space
hoelzl
parents: 51348
diff changeset
  6334
      by metis
166170c5f8a2 generalized compact_Times to topological_space
hoelzl
parents: 51348
diff changeset
  6335
    then have "\<forall>y\<in>t. open (b y)" "t \<subseteq> (\<Union>y\<in>t. b y)" by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6336
    from compactE_image[OF \<open>compact t\<close> this] obtain D where D: "D \<subseteq> t" "finite D" "t \<subseteq> (\<Union>y\<in>D. b y)"
51349
166170c5f8a2 generalized compact_Times to topological_space
hoelzl
parents: 51348
diff changeset
  6337
      by auto
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53291
diff changeset
  6338
    moreover from D c have "(\<Inter>y\<in>D. a y) \<times> t \<subseteq> (\<Union>y\<in>D. c y)"
51349
166170c5f8a2 generalized compact_Times to topological_space
hoelzl
parents: 51348
diff changeset
  6339
      by (fastforce simp: subset_eq)
166170c5f8a2 generalized compact_Times to topological_space
hoelzl
parents: 51348
diff changeset
  6340
    ultimately show "\<exists>a. open a \<and> x \<in> a \<and> (\<exists>d\<subseteq>C. finite d \<and> a \<times> t \<subseteq> \<Union>d)"
52141
eff000cab70f weaker precendence of syntax for big intersection and union on sets
haftmann
parents: 51773
diff changeset
  6341
      using c by (intro exI[of _ "c`D"] exI[of _ "\<Inter>(a`D)"] conjI) (auto intro!: open_INT)
51349
166170c5f8a2 generalized compact_Times to topological_space
hoelzl
parents: 51348
diff changeset
  6342
  qed
166170c5f8a2 generalized compact_Times to topological_space
hoelzl
parents: 51348
diff changeset
  6343
  then obtain a d where a: "\<forall>x\<in>s. open (a x)" "s \<subseteq> (\<Union>x\<in>s. a x)"
166170c5f8a2 generalized compact_Times to topological_space
hoelzl
parents: 51348
diff changeset
  6344
    and d: "\<And>x. x \<in> s \<Longrightarrow> d x \<subseteq> C \<and> finite (d x) \<and> a x \<times> t \<subseteq> \<Union>d x"
166170c5f8a2 generalized compact_Times to topological_space
hoelzl
parents: 51348
diff changeset
  6345
    unfolding subset_eq UN_iff by metis
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6346
  moreover
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6347
  from compactE_image[OF \<open>compact s\<close> a]
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6348
  obtain e where e: "e \<subseteq> s" "finite e" and s: "s \<subseteq> (\<Union>x\<in>e. a x)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6349
    by auto
51349
166170c5f8a2 generalized compact_Times to topological_space
hoelzl
parents: 51348
diff changeset
  6350
  moreover
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6351
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6352
    from s have "s \<times> t \<subseteq> (\<Union>x\<in>e. a x \<times> t)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6353
      by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6354
    also have "\<dots> \<subseteq> (\<Union>x\<in>e. \<Union>d x)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6355
      using d \<open>e \<subseteq> s\<close> by (intro UN_mono) auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6356
    finally have "s \<times> t \<subseteq> (\<Union>x\<in>e. \<Union>d x)" .
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6357
  }
51349
166170c5f8a2 generalized compact_Times to topological_space
hoelzl
parents: 51348
diff changeset
  6358
  ultimately show "\<exists>C'\<subseteq>C. finite C' \<and> s \<times> t \<subseteq> \<Union>C'"
166170c5f8a2 generalized compact_Times to topological_space
hoelzl
parents: 51348
diff changeset
  6359
    by (intro exI[of _ "(\<Union>x\<in>e. d x)"]) (auto simp add: subset_eq)
166170c5f8a2 generalized compact_Times to topological_space
hoelzl
parents: 51348
diff changeset
  6360
qed
50884
2b21b4e2d7cb differentiate (cover) compactness and sequential compactness
hoelzl
parents: 50883
diff changeset
  6361
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6362
text\<open>Hence some useful properties follow quite easily.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6363
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6364
lemma compact_scaling:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6365
  fixes s :: "'a::real_normed_vector set"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6366
  assumes "compact s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6367
  shows "compact ((\<lambda>x. c *\<^sub>R x) ` s)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6368
proof -
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6369
  let ?f = "\<lambda>x. scaleR c x"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6370
  have *: "bounded_linear ?f" by (rule bounded_linear_scaleR_right)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6371
  show ?thesis
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6372
    using compact_continuous_image[of s ?f] continuous_at_imp_continuous_on[of s ?f]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6373
    using linear_continuous_at[OF *] assms
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6374
    by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6375
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6376
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6377
lemma compact_negations:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6378
  fixes s :: "'a::real_normed_vector set"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6379
  assumes "compact s"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6380
  shows "compact ((\<lambda>x. - x) ` s)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6381
  using compact_scaling [OF assms, of "- 1"] by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6382
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6383
lemma compact_sums:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6384
  fixes s t :: "'a::real_normed_vector set"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6385
  assumes "compact s"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6386
    and "compact t"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6387
  shows "compact {x + y | x y. x \<in> s \<and> y \<in> t}"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6388
proof -
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6389
  have *: "{x + y | x y. x \<in> s \<and> y \<in> t} = (\<lambda>z. fst z + snd z) ` (s \<times> t)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6390
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6391
    unfolding image_iff
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6392
    apply (rule_tac x="(xa, y)" in bexI)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6393
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6394
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6395
  have "continuous_on (s \<times> t) (\<lambda>z. fst z + snd z)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6396
    unfolding continuous_on by (rule ballI) (intro tendsto_intros)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6397
  then show ?thesis
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6398
    unfolding * using compact_continuous_image compact_Times [OF assms] by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6399
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6400
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6401
lemma compact_differences:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6402
  fixes s t :: "'a::real_normed_vector set"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6403
  assumes "compact s"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6404
    and "compact t"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6405
  shows "compact {x - y | x y. x \<in> s \<and> y \<in> t}"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6406
proof-
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6407
  have "{x - y | x y. x\<in>s \<and> y \<in> t} =  {x + y | x y. x \<in> s \<and> y \<in> (uminus ` t)}"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6408
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6409
    apply (rule_tac x= xa in exI)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6410
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6411
    done
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6412
  then show ?thesis
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6413
    using compact_sums[OF assms(1) compact_negations[OF assms(2)]] by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6414
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6415
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6416
lemma compact_translation:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6417
  fixes s :: "'a::real_normed_vector set"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6418
  assumes "compact s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6419
  shows "compact ((\<lambda>x. a + x) ` s)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6420
proof -
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6421
  have "{x + y |x y. x \<in> s \<and> y \<in> {a}} = (\<lambda>x. a + x) ` s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6422
    by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6423
  then show ?thesis
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6424
    using compact_sums[OF assms compact_sing[of a]] by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6425
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6426
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6427
lemma compact_affinity:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6428
  fixes s :: "'a::real_normed_vector set"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6429
  assumes "compact s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6430
  shows "compact ((\<lambda>x. a + c *\<^sub>R x) ` s)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6431
proof -
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6432
  have "op + a ` op *\<^sub>R c ` s = (\<lambda>x. a + c *\<^sub>R x) ` s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6433
    by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6434
  then show ?thesis
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6435
    using compact_translation[OF compact_scaling[OF assms], of a c] by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6436
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6437
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6438
text \<open>Hence we get the following.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6439
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6440
lemma compact_sup_maxdistance:
50973
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6441
  fixes s :: "'a::metric_space set"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6442
  assumes "compact s"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6443
    and "s \<noteq> {}"
50973
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6444
  shows "\<exists>x\<in>s. \<exists>y\<in>s. \<forall>u\<in>s. \<forall>v\<in>s. dist u v \<le> dist x y"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6445
proof -
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6446
  have "compact (s \<times> s)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6447
    using \<open>compact s\<close> by (intro compact_Times)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6448
  moreover have "s \<times> s \<noteq> {}"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6449
    using \<open>s \<noteq> {}\<close> by auto
50973
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6450
  moreover have "continuous_on (s \<times> s) (\<lambda>x. dist (fst x) (snd x))"
51478
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 51475
diff changeset
  6451
    by (intro continuous_at_imp_continuous_on ballI continuous_intros)
50973
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6452
  ultimately show ?thesis
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6453
    using continuous_attains_sup[of "s \<times> s" "\<lambda>x. dist (fst x) (snd x)"] by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6454
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6455
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6456
text \<open>We can state this in terms of diameter of a set.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6457
54260
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  6458
definition diameter :: "'a::metric_space set \<Rightarrow> real" where
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  6459
  "diameter S = (if S = {} then 0 else SUP (x,y):S\<times>S. dist x y)"
50973
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6460
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6461
lemma diameter_bounded_bound:
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6462
  fixes s :: "'a :: metric_space set"
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6463
  assumes s: "bounded s" "x \<in> s" "y \<in> s"
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6464
  shows "dist x y \<le> diameter s"
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6465
proof -
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6466
  from s obtain z d where z: "\<And>x. x \<in> s \<Longrightarrow> dist z x \<le> d"
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6467
    unfolding bounded_def by auto
61424
c3658c18b7bc prod_case as canonical name for product type eliminator
haftmann
parents: 61306
diff changeset
  6468
  have "bdd_above (case_prod dist ` (s\<times>s))"
54260
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  6469
  proof (intro bdd_aboveI, safe)
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  6470
    fix a b
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  6471
    assume "a \<in> s" "b \<in> s"
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  6472
    with z[of a] z[of b] dist_triangle[of a b z]
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  6473
    show "dist a b \<le> 2 * d"
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  6474
      by (simp add: dist_commute)
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  6475
  qed
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  6476
  moreover have "(x,y) \<in> s\<times>s" using s by auto
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  6477
  ultimately have "dist x y \<le> (SUP (x,y):s\<times>s. dist x y)"
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  6478
    by (rule cSUP_upper2) simp
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6479
  with \<open>x \<in> s\<close> show ?thesis
50973
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6480
    by (auto simp add: diameter_def)
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6481
qed
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6482
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6483
lemma diameter_lower_bounded:
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6484
  fixes s :: "'a :: metric_space set"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6485
  assumes s: "bounded s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6486
    and d: "0 < d" "d < diameter s"
50973
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6487
  shows "\<exists>x\<in>s. \<exists>y\<in>s. d < dist x y"
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6488
proof (rule ccontr)
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6489
  assume contr: "\<not> ?thesis"
54260
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  6490
  moreover have "s \<noteq> {}"
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  6491
    using d by (auto simp add: diameter_def)
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  6492
  ultimately have "diameter s \<le> d"
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  6493
    by (auto simp: not_less diameter_def intro!: cSUP_least)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6494
  with \<open>d < diameter s\<close> show False by auto
50973
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6495
qed
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6496
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6497
lemma diameter_bounded:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6498
  assumes "bounded s"
50973
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6499
  shows "\<forall>x\<in>s. \<forall>y\<in>s. dist x y \<le> diameter s"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6500
    and "\<forall>d>0. d < diameter s \<longrightarrow> (\<exists>x\<in>s. \<exists>y\<in>s. dist x y > d)"
50973
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6501
  using diameter_bounded_bound[of s] diameter_lower_bounded[of s] assms
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6502
  by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6503
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6504
lemma diameter_compact_attained:
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6505
  assumes "compact s"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6506
    and "s \<noteq> {}"
50973
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6507
  shows "\<exists>x\<in>s. \<exists>y\<in>s. dist x y = diameter s"
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6508
proof -
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6509
  have b: "bounded s" using assms(1)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6510
    by (rule compact_imp_bounded)
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6511
  then obtain x y where xys: "x\<in>s" "y\<in>s"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6512
    and xy: "\<forall>u\<in>s. \<forall>v\<in>s. dist u v \<le> dist x y"
50973
4a2c82644889 generalized diameter from real_normed_vector to metric_space
hoelzl
parents: 50972
diff changeset
  6513
    using compact_sup_maxdistance[OF assms] by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6514
  then have "diameter s \<le> dist x y"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6515
    unfolding diameter_def
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6516
    apply clarsimp
54260
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54259
diff changeset
  6517
    apply (rule cSUP_least)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6518
    apply fast+
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6519
    done
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6520
  then show ?thesis
36362
06475a1547cb fix lots of looping simp calls and other warnings
huffman
parents: 36360
diff changeset
  6521
    by (metis b diameter_bounded_bound order_antisym xys)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6522
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6523
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6524
text \<open>Related results with closure as the conclusion.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6525
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6526
lemma closed_scaling:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6527
  fixes s :: "'a::real_normed_vector set"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6528
  assumes "closed s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6529
  shows "closed ((\<lambda>x. c *\<^sub>R x) ` s)"
53813
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  6530
proof (cases "c = 0")
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  6531
  case True then show ?thesis
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  6532
    by (auto simp add: image_constant_conv)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6533
next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6534
  case False
53813
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  6535
  from assms have "closed ((\<lambda>x. inverse c *\<^sub>R x) -` s)"
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  6536
    by (simp add: continuous_closed_vimage)
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  6537
  also have "(\<lambda>x. inverse c *\<^sub>R x) -` s = (\<lambda>x. c *\<^sub>R x) ` s"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6538
    using \<open>c \<noteq> 0\<close> by (auto elim: image_eqI [rotated])
53813
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  6539
  finally show ?thesis .
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6540
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6541
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6542
lemma closed_negations:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6543
  fixes s :: "'a::real_normed_vector set"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6544
  assumes "closed s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6545
  shows "closed ((\<lambda>x. -x) ` s)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6546
  using closed_scaling[OF assms, of "- 1"] by simp
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6547
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6548
lemma compact_closed_sums:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6549
  fixes s :: "'a::real_normed_vector set"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6550
  assumes "compact s" and "closed t"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6551
  shows "closed {x + y | x y. x \<in> s \<and> y \<in> t}"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6552
proof -
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6553
  let ?S = "{x + y |x y. x \<in> s \<and> y \<in> t}"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6554
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6555
    fix x l
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6556
    assume as: "\<forall>n. x n \<in> ?S"  "(x \<longlongrightarrow> l) sequentially"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6557
    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"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6558
      using choice[of "\<lambda>n y. x n = (fst y) + (snd y) \<and> fst y \<in> s \<and> snd y \<in> t"] by auto
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6559
    obtain l' r where "l'\<in>s" and r: "subseq r" and lr: "(((\<lambda>n. fst (f n)) \<circ> r) \<longlongrightarrow> l') sequentially"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6560
      using assms(1)[unfolded compact_def, THEN spec[where x="\<lambda> n. fst (f n)"]] using f(2) by auto
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6561
    have "((\<lambda>n. snd (f (r n))) \<longlongrightarrow> l - l') sequentially"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6562
      using tendsto_diff[OF LIMSEQ_subseq_LIMSEQ[OF as(2) r] lr] and f(1)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6563
      unfolding o_def
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6564
      by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6565
    then have "l - l' \<in> t"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6566
      using assms(2)[unfolded closed_sequential_limits,
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6567
        THEN spec[where x="\<lambda> n. snd (f (r n))"],
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6568
        THEN spec[where x="l - l'"]]
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6569
      using f(3)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6570
      by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6571
    then have "l \<in> ?S"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6572
      using \<open>l' \<in> s\<close>
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6573
      apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6574
      apply (rule_tac x=l' in exI)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6575
      apply (rule_tac x="l - l'" in exI)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6576
      apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6577
      done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6578
  }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6579
  then show ?thesis
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6580
    unfolding closed_sequential_limits by fast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6581
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6582
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6583
lemma closed_compact_sums:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6584
  fixes s t :: "'a::real_normed_vector set"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6585
  assumes "closed s"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6586
    and "compact t"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6587
  shows "closed {x + y | x y. x \<in> s \<and> y \<in> t}"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6588
proof -
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6589
  have "{x + y |x y. x \<in> t \<and> y \<in> s} = {x + y |x y. x \<in> s \<and> y \<in> t}"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6590
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6591
    apply (rule_tac x=y in exI)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6592
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6593
    apply (rule_tac x=y in exI)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6594
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6595
    done
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6596
  then show ?thesis
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6597
    using compact_closed_sums[OF assms(2,1)] by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6598
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6599
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6600
lemma compact_closed_differences:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6601
  fixes s t :: "'a::real_normed_vector set"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6602
  assumes "compact s"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6603
    and "closed t"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6604
  shows "closed {x - y | x y. x \<in> s \<and> y \<in> t}"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6605
proof -
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6606
  have "{x + y |x y. x \<in> s \<and> y \<in> uminus ` t} =  {x - y |x y. x \<in> s \<and> y \<in> t}"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6607
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6608
    apply (rule_tac x=xa in exI)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6609
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6610
    apply (rule_tac x=xa in exI)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6611
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6612
    done
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6613
  then show ?thesis
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6614
    using compact_closed_sums[OF assms(1) closed_negations[OF assms(2)]] by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6615
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6616
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6617
lemma closed_compact_differences:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6618
  fixes s t :: "'a::real_normed_vector set"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6619
  assumes "closed s"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6620
    and "compact t"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6621
  shows "closed {x - y | x y. x \<in> s \<and> y \<in> t}"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6622
proof -
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6623
  have "{x + y |x y. x \<in> s \<and> y \<in> uminus ` t} = {x - y |x y. x \<in> s \<and> y \<in> t}"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6624
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6625
    apply (rule_tac x=xa in exI)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6626
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6627
    apply (rule_tac x=xa in exI)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6628
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6629
    done
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6630
 then show ?thesis
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6631
  using closed_compact_sums[OF assms(1) compact_negations[OF assms(2)]] by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6632
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6633
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6634
lemma closed_translation:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6635
  fixes a :: "'a::real_normed_vector"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6636
  assumes "closed s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6637
  shows "closed ((\<lambda>x. a + x) ` s)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6638
proof -
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6639
  have "{a + y |y. y \<in> s} = (op + a ` s)" by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6640
  then show ?thesis
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6641
    using compact_closed_sums[OF compact_sing[of a] assms] by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6642
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6643
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
  6644
lemma translation_Compl:
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
  6645
  fixes a :: "'a::ab_group_add"
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
  6646
  shows "(\<lambda>x. a + x) ` (- t) = - ((\<lambda>x. a + x) ` t)"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6647
  apply (auto simp add: image_iff)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6648
  apply (rule_tac x="x - a" in bexI)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6649
  apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6650
  done
34105
87cbdecaa879 replace 'UNIV - S' with '- S'
huffman
parents: 34104
diff changeset
  6651
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6652
lemma translation_UNIV:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6653
  fixes a :: "'a::ab_group_add"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6654
  shows "range (\<lambda>x. a + x) = UNIV"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6655
  apply (auto simp add: image_iff)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6656
  apply (rule_tac x="x - a" in exI)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6657
  apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6658
  done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6659
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6660
lemma translation_diff:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6661
  fixes a :: "'a::ab_group_add"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6662
  shows "(\<lambda>x. a + x) ` (s - t) = ((\<lambda>x. a + x) ` s) - ((\<lambda>x. a + x) ` t)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6663
  by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6664
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6665
lemma closure_translation:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6666
  fixes a :: "'a::real_normed_vector"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6667
  shows "closure ((\<lambda>x. a + x) ` s) = (\<lambda>x. a + x) ` (closure s)"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6668
proof -
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6669
  have *: "op + a ` (- s) = - op + a ` s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6670
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6671
    unfolding image_iff
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6672
    apply (rule_tac x="x - a" in bexI)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6673
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6674
    done
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6675
  show ?thesis
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6676
    unfolding closure_interior translation_Compl
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6677
    using interior_translation[of a "- s"]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6678
    unfolding *
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6679
    by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6680
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6681
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6682
lemma frontier_translation:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6683
  fixes a :: "'a::real_normed_vector"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6684
  shows "frontier((\<lambda>x. a + x) ` s) = (\<lambda>x. a + x) ` (frontier s)"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6685
  unfolding frontier_def translation_diff interior_translation closure_translation
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6686
  by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6687
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  6688
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6689
subsection \<open>Separation between points and sets\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6690
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6691
lemma separate_point_closed:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6692
  fixes s :: "'a::heine_borel set"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6693
  assumes "closed s"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6694
    and "a \<notin> s"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6695
  shows "\<exists>d>0. \<forall>x\<in>s. d \<le> dist a x"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6696
proof (cases "s = {}")
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6697
  case True
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6698
  then show ?thesis by(auto intro!: exI[where x=1])
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6699
next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6700
  case False
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6701
  from assms obtain x where "x\<in>s" "\<forall>y\<in>s. dist a x \<le> dist a y"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6702
    using \<open>s \<noteq> {}\<close> distance_attains_inf [of s a] by blast
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6703
  with \<open>x\<in>s\<close> show ?thesis using dist_pos_lt[of a x] and\<open>a \<notin> s\<close>
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6704
    by blast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6705
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6706
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6707
lemma separate_compact_closed:
50949
a5689bb4ed7e generalize more topology lemmas
huffman
parents: 50948
diff changeset
  6708
  fixes s t :: "'a::heine_borel set"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6709
  assumes "compact s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6710
    and t: "closed t" "s \<inter> t = {}"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6711
  shows "\<exists>d>0. \<forall>x\<in>s. \<forall>y\<in>t. d \<le> dist x y"
51346
d33de22432e2 tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
hoelzl
parents: 51345
diff changeset
  6712
proof cases
d33de22432e2 tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
hoelzl
parents: 51345
diff changeset
  6713
  assume "s \<noteq> {} \<and> t \<noteq> {}"
d33de22432e2 tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
hoelzl
parents: 51345
diff changeset
  6714
  then have "s \<noteq> {}" "t \<noteq> {}" by auto
d33de22432e2 tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
hoelzl
parents: 51345
diff changeset
  6715
  let ?inf = "\<lambda>x. infdist x t"
d33de22432e2 tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
hoelzl
parents: 51345
diff changeset
  6716
  have "continuous_on s ?inf"
d33de22432e2 tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
hoelzl
parents: 51345
diff changeset
  6717
    by (auto intro!: continuous_at_imp_continuous_on continuous_infdist continuous_at_id)
d33de22432e2 tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
hoelzl
parents: 51345
diff changeset
  6718
  then obtain x where x: "x \<in> s" "\<forall>y\<in>s. ?inf x \<le> ?inf y"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6719
    using continuous_attains_inf[OF \<open>compact s\<close> \<open>s \<noteq> {}\<close>] by auto
51346
d33de22432e2 tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
hoelzl
parents: 51345
diff changeset
  6720
  then have "0 < ?inf x"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6721
    using t \<open>t \<noteq> {}\<close> in_closed_iff_infdist_zero by (auto simp: less_le infdist_nonneg)
51346
d33de22432e2 tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
hoelzl
parents: 51345
diff changeset
  6722
  moreover have "\<forall>x'\<in>s. \<forall>y\<in>t. ?inf x \<le> dist x' y"
d33de22432e2 tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
hoelzl
parents: 51345
diff changeset
  6723
    using x by (auto intro: order_trans infdist_le)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6724
  ultimately show ?thesis by auto
51346
d33de22432e2 tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
hoelzl
parents: 51345
diff changeset
  6725
qed (auto intro!: exI[of _ 1])
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6726
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6727
lemma separate_closed_compact:
50949
a5689bb4ed7e generalize more topology lemmas
huffman
parents: 50948
diff changeset
  6728
  fixes s t :: "'a::heine_borel set"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6729
  assumes "closed s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6730
    and "compact t"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6731
    and "s \<inter> t = {}"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6732
  shows "\<exists>d>0. \<forall>x\<in>s. \<forall>y\<in>t. d \<le> dist x y"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6733
proof -
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6734
  have *: "t \<inter> s = {}"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6735
    using assms(3) by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6736
  show ?thesis
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6737
    using separate_compact_closed[OF assms(2,1) *]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6738
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6739
    apply (rule_tac x=d in exI)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6740
    apply auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6741
    apply (erule_tac x=y in ballE)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6742
    apply (auto simp add: dist_commute)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6743
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6744
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6745
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  6746
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6747
subsection \<open>Closure of halfspaces and hyperplanes\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6748
44219
f738e3200e24 generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
huffman
parents: 44216
diff changeset
  6749
lemma isCont_open_vimage:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6750
  assumes "\<And>x. isCont f x"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6751
    and "open s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6752
  shows "open (f -` s)"
44219
f738e3200e24 generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
huffman
parents: 44216
diff changeset
  6753
proof -
f738e3200e24 generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
huffman
parents: 44216
diff changeset
  6754
  from assms(1) have "continuous_on UNIV f"
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51530
diff changeset
  6755
    unfolding isCont_def continuous_on_def by simp
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6756
  then have "open {x \<in> UNIV. f x \<in> s}"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6757
    using open_UNIV \<open>open s\<close> by (rule continuous_open_preimage)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6758
  then show "open (f -` s)"
44219
f738e3200e24 generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
huffman
parents: 44216
diff changeset
  6759
    by (simp add: vimage_def)
f738e3200e24 generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
huffman
parents: 44216
diff changeset
  6760
qed
f738e3200e24 generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
huffman
parents: 44216
diff changeset
  6761
f738e3200e24 generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
huffman
parents: 44216
diff changeset
  6762
lemma isCont_closed_vimage:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6763
  assumes "\<And>x. isCont f x"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6764
    and "closed s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6765
  shows "closed (f -` s)"
44219
f738e3200e24 generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
huffman
parents: 44216
diff changeset
  6766
  using assms unfolding closed_def vimage_Compl [symmetric]
f738e3200e24 generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
huffman
parents: 44216
diff changeset
  6767
  by (rule isCont_open_vimage)
f738e3200e24 generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
huffman
parents: 44216
diff changeset
  6768
44213
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44212
diff changeset
  6769
lemma open_Collect_less:
51478
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 51475
diff changeset
  6770
  fixes f g :: "'a::t2_space \<Rightarrow> real"
44219
f738e3200e24 generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
huffman
parents: 44216
diff changeset
  6771
  assumes f: "\<And>x. isCont f x"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6772
    and g: "\<And>x. isCont g x"
44213
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44212
diff changeset
  6773
  shows "open {x. f x < g x}"
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44212
diff changeset
  6774
proof -
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44212
diff changeset
  6775
  have "open ((\<lambda>x. g x - f x) -` {0<..})"
44219
f738e3200e24 generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
huffman
parents: 44216
diff changeset
  6776
    using isCont_diff [OF g f] open_real_greaterThan
f738e3200e24 generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
huffman
parents: 44216
diff changeset
  6777
    by (rule isCont_open_vimage)
44213
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44212
diff changeset
  6778
  also have "((\<lambda>x. g x - f x) -` {0<..}) = {x. f x < g x}"
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44212
diff changeset
  6779
    by auto
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44212
diff changeset
  6780
  finally show ?thesis .
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44212
diff changeset
  6781
qed
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44212
diff changeset
  6782
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44212
diff changeset
  6783
lemma closed_Collect_le:
51478
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 51475
diff changeset
  6784
  fixes f g :: "'a::t2_space \<Rightarrow> real"
44219
f738e3200e24 generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
huffman
parents: 44216
diff changeset
  6785
  assumes f: "\<And>x. isCont f x"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6786
    and g: "\<And>x. isCont g x"
44213
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44212
diff changeset
  6787
  shows "closed {x. f x \<le> g x}"
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44212
diff changeset
  6788
proof -
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44212
diff changeset
  6789
  have "closed ((\<lambda>x. g x - f x) -` {0..})"
44219
f738e3200e24 generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
huffman
parents: 44216
diff changeset
  6790
    using isCont_diff [OF g f] closed_real_atLeast
f738e3200e24 generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
huffman
parents: 44216
diff changeset
  6791
    by (rule isCont_closed_vimage)
44213
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44212
diff changeset
  6792
  also have "((\<lambda>x. g x - f x) -` {0..}) = {x. f x \<le> g x}"
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44212
diff changeset
  6793
    by auto
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44212
diff changeset
  6794
  finally show ?thesis .
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44212
diff changeset
  6795
qed
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44212
diff changeset
  6796
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44212
diff changeset
  6797
lemma closed_Collect_eq:
51478
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 51475
diff changeset
  6798
  fixes f g :: "'a::t2_space \<Rightarrow> 'b::t2_space"
44219
f738e3200e24 generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
huffman
parents: 44216
diff changeset
  6799
  assumes f: "\<And>x. isCont f x"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6800
    and g: "\<And>x. isCont g x"
44213
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44212
diff changeset
  6801
  shows "closed {x. f x = g x}"
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44212
diff changeset
  6802
proof -
44216
903bfe95fece generalized lemma closed_Collect_eq
huffman
parents: 44213
diff changeset
  6803
  have "open {(x::'b, y::'b). x \<noteq> y}"
903bfe95fece generalized lemma closed_Collect_eq
huffman
parents: 44213
diff changeset
  6804
    unfolding open_prod_def by (auto dest!: hausdorff)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6805
  then have "closed {(x::'b, y::'b). x = y}"
44216
903bfe95fece generalized lemma closed_Collect_eq
huffman
parents: 44213
diff changeset
  6806
    unfolding closed_def split_def Collect_neg_eq .
44219
f738e3200e24 generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
huffman
parents: 44216
diff changeset
  6807
  with isCont_Pair [OF f g]
44216
903bfe95fece generalized lemma closed_Collect_eq
huffman
parents: 44213
diff changeset
  6808
  have "closed ((\<lambda>x. (f x, g x)) -` {(x, y). x = y})"
44219
f738e3200e24 generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
huffman
parents: 44216
diff changeset
  6809
    by (rule isCont_closed_vimage)
44216
903bfe95fece generalized lemma closed_Collect_eq
huffman
parents: 44213
diff changeset
  6810
  also have "\<dots> = {x. f x = g x}" by auto
44213
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44212
diff changeset
  6811
  finally show ?thesis .
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44212
diff changeset
  6812
qed
6fb54701a11b add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
huffman
parents: 44212
diff changeset
  6813
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6814
lemma continuous_on_closed_Collect_le:
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6815
  fixes f g :: "'a::t2_space \<Rightarrow> real"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6816
  assumes f: "continuous_on s f" and g: "continuous_on s g" and s: "closed s"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6817
  shows "closed {x \<in> s. f x \<le> g x}"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6818
proof -
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6819
  have "closed ((\<lambda>x. g x - f x) -` {0..} \<inter> s)"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6820
    using closed_real_atLeast continuous_on_diff [OF g f]
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6821
    by (simp add: continuous_on_closed_vimage [OF s])
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6822
  also have "((\<lambda>x. g x - f x) -` {0..} \<inter> s) = {x\<in>s. f x \<le> g x}"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6823
    by auto
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6824
  finally show ?thesis .
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6825
qed
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6826
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6827
lemma continuous_at_inner: "continuous (at x) (inner a)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6828
  unfolding continuous_at by (intro tendsto_intros)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6829
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6830
lemma closed_halfspace_le: "closed {x. inner a x \<le> b}"
44233
aa74ce315bae add simp rules for isCont
huffman
parents: 44219
diff changeset
  6831
  by (simp add: closed_Collect_le)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6832
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6833
lemma closed_halfspace_ge: "closed {x. inner a x \<ge> b}"
44233
aa74ce315bae add simp rules for isCont
huffman
parents: 44219
diff changeset
  6834
  by (simp add: closed_Collect_le)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6835
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6836
lemma closed_hyperplane: "closed {x. inner a x = b}"
44233
aa74ce315bae add simp rules for isCont
huffman
parents: 44219
diff changeset
  6837
  by (simp add: closed_Collect_eq)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6838
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6839
lemma closed_halfspace_component_le: "closed {x::'a::euclidean_space. x\<bullet>i \<le> a}"
44233
aa74ce315bae add simp rules for isCont
huffman
parents: 44219
diff changeset
  6840
  by (simp add: closed_Collect_le)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6841
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6842
lemma closed_halfspace_component_ge: "closed {x::'a::euclidean_space. x\<bullet>i \<ge> a}"
44233
aa74ce315bae add simp rules for isCont
huffman
parents: 44219
diff changeset
  6843
  by (simp add: closed_Collect_le)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6844
53813
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  6845
lemma closed_interval_left:
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  6846
  fixes b :: "'a::euclidean_space"
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  6847
  shows "closed {x::'a. \<forall>i\<in>Basis. x\<bullet>i \<le> b\<bullet>i}"
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  6848
  by (simp add: Collect_ball_eq closed_INT closed_Collect_le)
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  6849
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  6850
lemma closed_interval_right:
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  6851
  fixes a :: "'a::euclidean_space"
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  6852
  shows "closed {x::'a. \<forall>i\<in>Basis. a\<bullet>i \<le> x\<bullet>i}"
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  6853
  by (simp add: Collect_ball_eq closed_INT closed_Collect_le)
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  6854
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6855
lemma continuous_le_on_closure:
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6856
  fixes a::real
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6857
  assumes f: "continuous_on (closure s) f"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6858
      and x: "x \<in> closure(s)"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6859
      and xlo: "\<And>x. x \<in> s ==> f(x) \<le> a"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6860
    shows "f(x) \<le> a"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61552
diff changeset
  6861
    using image_closure_subset [OF f]
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6862
  using image_closure_subset [OF f] closed_halfspace_le [of "1::real" a] assms
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6863
  by force
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6864
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6865
lemma continuous_ge_on_closure:
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6866
  fixes a::real
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6867
  assumes f: "continuous_on (closure s) f"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6868
      and x: "x \<in> closure(s)"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6869
      and xlo: "\<And>x. x \<in> s ==> f(x) \<ge> a"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6870
    shows "f(x) \<ge> a"
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6871
  using image_closure_subset [OF f] closed_halfspace_ge [of a "1::real"] assms
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6872
  by force
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  6873
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6874
text \<open>Openness of halfspaces.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6875
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6876
lemma open_halfspace_lt: "open {x. inner a x < b}"
44233
aa74ce315bae add simp rules for isCont
huffman
parents: 44219
diff changeset
  6877
  by (simp add: open_Collect_less)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6878
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6879
lemma open_halfspace_gt: "open {x. inner a x > b}"
44233
aa74ce315bae add simp rules for isCont
huffman
parents: 44219
diff changeset
  6880
  by (simp add: open_Collect_less)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6881
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6882
lemma open_halfspace_component_lt: "open {x::'a::euclidean_space. x\<bullet>i < a}"
44233
aa74ce315bae add simp rules for isCont
huffman
parents: 44219
diff changeset
  6883
  by (simp add: open_Collect_less)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6884
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6885
lemma open_halfspace_component_gt: "open {x::'a::euclidean_space. x\<bullet>i > a}"
44233
aa74ce315bae add simp rules for isCont
huffman
parents: 44219
diff changeset
  6886
  by (simp add: open_Collect_less)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6887
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6888
text \<open>This gives a simple derivation of limit component bounds.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6889
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6890
lemma Lim_component_le:
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6891
  fixes f :: "'a \<Rightarrow> 'b::euclidean_space"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6892
  assumes "(f \<longlongrightarrow> l) net"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6893
    and "\<not> (trivial_limit net)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6894
    and "eventually (\<lambda>x. f(x)\<bullet>i \<le> b) net"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  6895
  shows "l\<bullet>i \<le> b"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  6896
  by (rule tendsto_le[OF assms(2) tendsto_const tendsto_inner[OF assms(1) tendsto_const] assms(3)])
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 37452
diff changeset
  6897
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6898
lemma Lim_component_ge:
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6899
  fixes f :: "'a \<Rightarrow> 'b::euclidean_space"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6900
  assumes "(f \<longlongrightarrow> l) net"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6901
    and "\<not> (trivial_limit net)"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6902
    and "eventually (\<lambda>x. b \<le> (f x)\<bullet>i) net"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  6903
  shows "b \<le> l\<bullet>i"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  6904
  by (rule tendsto_le[OF assms(2) tendsto_inner[OF assms(1) tendsto_const] tendsto_const assms(3)])
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 37452
diff changeset
  6905
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6906
lemma Lim_component_eq:
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6907
  fixes f :: "'a \<Rightarrow> 'b::euclidean_space"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6908
  assumes net: "(f \<longlongrightarrow> l) net" "\<not> trivial_limit net"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6909
    and ev:"eventually (\<lambda>x. f(x)\<bullet>i = b) net"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  6910
  shows "l\<bullet>i = b"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  6911
  using ev[unfolded order_eq_iff eventually_conj_iff]
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6912
  using Lim_component_ge[OF net, of b i]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6913
  using Lim_component_le[OF net, of i b]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6914
  by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6915
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6916
text \<open>Limits relative to a union.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6917
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6918
lemma eventually_within_Un:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6919
  "eventually P (at x within (s \<union> t)) \<longleftrightarrow>
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6920
    eventually P (at x within s) \<and> eventually P (at x within t)"
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51530
diff changeset
  6921
  unfolding eventually_at_filter
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6922
  by (auto elim!: eventually_rev_mp)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6923
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6924
lemma Lim_within_union:
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6925
 "(f \<longlongrightarrow> l) (at x within (s \<union> t)) \<longleftrightarrow>
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6926
  (f \<longlongrightarrow> l) (at x within s) \<and> (f \<longlongrightarrow> l) (at x within t)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6927
  unfolding tendsto_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6928
  by (auto simp add: eventually_within_Un)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6929
36442
b96d9dc6acca generalize more continuity lemmas
huffman
parents: 36441
diff changeset
  6930
lemma Lim_topological:
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  6931
  "(f \<longlongrightarrow> l) net \<longleftrightarrow>
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6932
    trivial_limit net \<or> (\<forall>S. open S \<longrightarrow> l \<in> S \<longrightarrow> eventually (\<lambda>x. f x \<in> S) net)"
36442
b96d9dc6acca generalize more continuity lemmas
huffman
parents: 36441
diff changeset
  6933
  unfolding tendsto_def trivial_limit_eq by auto
b96d9dc6acca generalize more continuity lemmas
huffman
parents: 36441
diff changeset
  6934
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  6935
text \<open>Continuity relative to a union.\<close>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  6936
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  6937
lemma continuous_on_union_local:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  6938
    "\<lbrakk>closedin (subtopology euclidean (s \<union> t)) s; closedin (subtopology euclidean (s \<union> t)) t;
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  6939
      continuous_on s f; continuous_on t f\<rbrakk>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  6940
     \<Longrightarrow> continuous_on (s \<union> t) f"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  6941
  unfolding continuous_on closed_in_limpt
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  6942
  by (metis Lim_trivial_limit Lim_within_union Un_iff trivial_limit_within)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  6943
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  6944
lemma continuous_on_cases_local:
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  6945
     "\<lbrakk>closedin (subtopology euclidean (s \<union> t)) s; closedin (subtopology euclidean (s \<union> t)) t;
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  6946
       continuous_on s f; continuous_on t g;
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  6947
       \<And>x. \<lbrakk>x \<in> s \<and> ~P x \<or> x \<in> t \<and> P x\<rbrakk> \<Longrightarrow> f x = g x\<rbrakk>
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  6948
      \<Longrightarrow> continuous_on (s \<union> t) (\<lambda>x. if P x then f x else g x)"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  6949
  by (rule continuous_on_union_local) (auto intro: continuous_on_eq)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61284
diff changeset
  6950
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6951
lemma continuous_on_cases_le:
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6952
  fixes h :: "'a :: topological_space \<Rightarrow> real"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6953
  assumes "continuous_on {t \<in> s. h t \<le> a} f"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6954
      and "continuous_on {t \<in> s. a \<le> h t} g"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6955
      and h: "continuous_on s h"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6956
      and "\<And>t. \<lbrakk>t \<in> s; h t = a\<rbrakk> \<Longrightarrow> f t = g t"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6957
    shows "continuous_on s (\<lambda>t. if h t \<le> a then f(t) else g(t))"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6958
proof -
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6959
  have s: "s = {t \<in> s. h t \<in> atMost a} \<union> {t \<in> s. h t \<in> atLeast a}"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6960
    by force
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6961
  have 1: "closedin (subtopology euclidean s) {t \<in> s. h t \<in> atMost a}"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6962
    by (rule continuous_closedin_preimage [OF h closed_atMost])
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6963
  have 2: "closedin (subtopology euclidean s) {t \<in> s. h t \<in> atLeast a}"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6964
    by (rule continuous_closedin_preimage [OF h closed_atLeast])
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6965
  show ?thesis
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6966
    apply (rule continuous_on_subset [of s, OF _ order_refl])
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6967
    apply (subst s)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6968
    apply (rule continuous_on_cases_local)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6969
    using 1 2 s assms apply auto
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6970
    done
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6971
qed
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6972
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6973
lemma continuous_on_cases_1:
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6974
  fixes s :: "real set"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6975
  assumes "continuous_on {t \<in> s. t \<le> a} f"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6976
      and "continuous_on {t \<in> s. a \<le> t} g"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6977
      and "a \<in> s \<Longrightarrow> f a = g a"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6978
    shows "continuous_on s (\<lambda>t. if t \<le> a then f(t) else g(t))"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6979
using assms
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6980
by (auto simp: continuous_on_id intro: continuous_on_cases_le [where h = id, simplified])
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  6981
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  6982
text\<open>Some more convenient intermediate-value theorem formulations.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6983
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6984
lemma connected_ivt_hyperplane:
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6985
  assumes "connected s"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6986
    and "x \<in> s"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6987
    and "y \<in> s"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6988
    and "inner a x \<le> b"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6989
    and "b \<le> inner a y"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6990
  shows "\<exists>z \<in> s. inner a z = b"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6991
proof (rule ccontr)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6992
  assume as:"\<not> (\<exists>z\<in>s. inner a z = b)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6993
  let ?A = "{x. inner a x < b}"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  6994
  let ?B = "{x. inner a x > b}"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6995
  have "open ?A" "open ?B"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  6996
    using open_halfspace_lt and open_halfspace_gt by auto
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6997
  moreover
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6998
  have "?A \<inter> ?B = {}" by auto
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  6999
  moreover
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  7000
  have "s \<subseteq> ?A \<union> ?B" using as by auto
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  7001
  ultimately
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  7002
  show False
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7003
    using assms(1)[unfolded connected_def not_ex,
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7004
      THEN spec[where x="?A"], THEN spec[where x="?B"]]
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7005
    using assms(2-5)
52625
wenzelm
parents: 52624
diff changeset
  7006
    by auto
wenzelm
parents: 52624
diff changeset
  7007
qed
wenzelm
parents: 52624
diff changeset
  7008
wenzelm
parents: 52624
diff changeset
  7009
lemma connected_ivt_component:
wenzelm
parents: 52624
diff changeset
  7010
  fixes x::"'a::euclidean_space"
wenzelm
parents: 52624
diff changeset
  7011
  shows "connected s \<Longrightarrow>
wenzelm
parents: 52624
diff changeset
  7012
    x \<in> s \<Longrightarrow> y \<in> s \<Longrightarrow>
wenzelm
parents: 52624
diff changeset
  7013
    x\<bullet>k \<le> a \<Longrightarrow> a \<le> y\<bullet>k \<Longrightarrow> (\<exists>z\<in>s.  z\<bullet>k = a)"
wenzelm
parents: 52624
diff changeset
  7014
  using connected_ivt_hyperplane[of s x y "k::'a" a]
wenzelm
parents: 52624
diff changeset
  7015
  by (auto simp: inner_commute)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7016
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  7017
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7018
subsection \<open>Intervals\<close>
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7019
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7020
lemma open_box[intro]: "open (box a b)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7021
proof -
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7022
  have "open (\<Inter>i\<in>Basis. (op \<bullet> i) -` {a \<bullet> i <..< b \<bullet> i})"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7023
    by (auto intro!: continuous_open_vimage continuous_inner continuous_at_id continuous_const)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7024
  also have "(\<Inter>i\<in>Basis. (op \<bullet> i) -` {a \<bullet> i <..< b \<bullet> i}) = box a b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7025
    by (auto simp add: box_def inner_commute)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7026
  finally show ?thesis .
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7027
qed
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7028
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7029
instance euclidean_space \<subseteq> second_countable_topology
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7030
proof
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7031
  def a \<equiv> "\<lambda>f :: 'a \<Rightarrow> (real \<times> real). \<Sum>i\<in>Basis. fst (f i) *\<^sub>R i"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7032
  then have a: "\<And>f. (\<Sum>i\<in>Basis. fst (f i) *\<^sub>R i) = a f"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7033
    by simp
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7034
  def b \<equiv> "\<lambda>f :: 'a \<Rightarrow> (real \<times> real). \<Sum>i\<in>Basis. snd (f i) *\<^sub>R i"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7035
  then have b: "\<And>f. (\<Sum>i\<in>Basis. snd (f i) *\<^sub>R i) = b f"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7036
    by simp
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7037
  def B \<equiv> "(\<lambda>f. box (a f) (b f)) ` (Basis \<rightarrow>\<^sub>E (\<rat> \<times> \<rat>))"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7038
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7039
  have "Ball B open" by (simp add: B_def open_box)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7040
  moreover have "(\<forall>A. open A \<longrightarrow> (\<exists>B'\<subseteq>B. \<Union>B' = A))"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7041
  proof safe
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7042
    fix A::"'a set"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7043
    assume "open A"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7044
    show "\<exists>B'\<subseteq>B. \<Union>B' = A"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7045
      apply (rule exI[of _ "{b\<in>B. b \<subseteq> A}"])
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7046
      apply (subst (3) open_UNION_box[OF \<open>open A\<close>])
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7047
      apply (auto simp add: a b B_def)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7048
      done
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7049
  qed
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7050
  ultimately
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7051
  have "topological_basis B"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7052
    unfolding topological_basis_def by blast
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7053
  moreover
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7054
  have "countable B"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7055
    unfolding B_def
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7056
    by (intro countable_image countable_PiE finite_Basis countable_SIGMA countable_rat)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7057
  ultimately show "\<exists>B::'a set set. countable B \<and> open = generate_topology B"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7058
    by (blast intro: topological_basis_imp_subbasis)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7059
qed
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7060
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7061
instance euclidean_space \<subseteq> polish_space ..
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7062
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7063
lemma closed_cbox[intro]:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7064
  fixes a b :: "'a::euclidean_space"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7065
  shows "closed (cbox a b)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7066
proof -
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7067
  have "closed (\<Inter>i\<in>Basis. (\<lambda>x. x\<bullet>i) -` {a\<bullet>i .. b\<bullet>i})"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7068
    by (intro closed_INT ballI continuous_closed_vimage allI
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7069
      linear_continuous_at closed_real_atLeastAtMost finite_Basis bounded_linear_inner_left)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7070
  also have "(\<Inter>i\<in>Basis. (\<lambda>x. x\<bullet>i) -` {a\<bullet>i .. b\<bullet>i}) = cbox a b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7071
    by (auto simp add: cbox_def)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7072
  finally show "closed (cbox a b)" .
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7073
qed
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7074
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7075
lemma interior_cbox [intro]:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7076
  fixes a b :: "'a::euclidean_space"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7077
  shows "interior (cbox a b) = box a b" (is "?L = ?R")
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7078
proof(rule subset_antisym)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7079
  show "?R \<subseteq> ?L"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7080
    using box_subset_cbox open_box
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7081
    by (rule interior_maximal)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7082
  {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7083
    fix x
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7084
    assume "x \<in> interior (cbox a b)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7085
    then obtain s where s: "open s" "x \<in> s" "s \<subseteq> cbox a b" ..
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7086
    then obtain e where "e>0" and e:"\<forall>x'. dist x' x < e \<longrightarrow> x' \<in> cbox a b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7087
      unfolding open_dist and subset_eq by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7088
    {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7089
      fix i :: 'a
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7090
      assume i: "i \<in> Basis"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7091
      have "dist (x - (e / 2) *\<^sub>R i) x < e"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7092
        and "dist (x + (e / 2) *\<^sub>R i) x < e"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7093
        unfolding dist_norm
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7094
        apply auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7095
        unfolding norm_minus_cancel
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7096
        using norm_Basis[OF i] \<open>e>0\<close>
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7097
        apply auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7098
        done
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7099
      then have "a \<bullet> i \<le> (x - (e / 2) *\<^sub>R i) \<bullet> i" and "(x + (e / 2) *\<^sub>R i) \<bullet> i \<le> b \<bullet> i"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7100
        using e[THEN spec[where x="x - (e/2) *\<^sub>R i"]]
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7101
          and e[THEN spec[where x="x + (e/2) *\<^sub>R i"]]
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7102
        unfolding mem_box
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7103
        using i
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7104
        by blast+
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7105
      then have "a \<bullet> i < x \<bullet> i" and "x \<bullet> i < b \<bullet> i"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7106
        using \<open>e>0\<close> i
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7107
        by (auto simp: inner_diff_left inner_Basis inner_add_left)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7108
    }
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7109
    then have "x \<in> box a b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7110
      unfolding mem_box by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7111
  }
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7112
  then show "?L \<subseteq> ?R" ..
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7113
qed
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7114
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7115
lemma bounded_cbox:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7116
  fixes a :: "'a::euclidean_space"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7117
  shows "bounded (cbox a b)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7118
proof -
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7119
  let ?b = "\<Sum>i\<in>Basis. \<bar>a\<bullet>i\<bar> + \<bar>b\<bullet>i\<bar>"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7120
  {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7121
    fix x :: "'a"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7122
    assume x: "\<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7123
    {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7124
      fix i :: 'a
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7125
      assume "i \<in> Basis"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7126
      then have "\<bar>x\<bullet>i\<bar> \<le> \<bar>a\<bullet>i\<bar> + \<bar>b\<bullet>i\<bar>"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7127
        using x[THEN bspec[where x=i]] by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7128
    }
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7129
    then have "(\<Sum>i\<in>Basis. \<bar>x \<bullet> i\<bar>) \<le> ?b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7130
      apply -
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7131
      apply (rule setsum_mono)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7132
      apply auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7133
      done
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7134
    then have "norm x \<le> ?b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7135
      using norm_le_l1[of x] by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7136
  }
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7137
  then show ?thesis
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7138
    unfolding cbox_def bounded_iff by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7139
qed
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7140
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7141
lemma bounded_box:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7142
  fixes a :: "'a::euclidean_space"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7143
  shows "bounded (box a b)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7144
  using bounded_cbox[of a b]
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7145
  using box_subset_cbox[of a b]
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7146
  using bounded_subset[of "cbox a b" "box a b"]
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7147
  by simp
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7148
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7149
lemma not_interval_univ:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7150
  fixes a :: "'a::euclidean_space"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7151
  shows "cbox a b \<noteq> UNIV" "box a b \<noteq> UNIV"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7152
  using bounded_box[of a b] bounded_cbox[of a b] by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7153
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7154
lemma compact_cbox:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7155
  fixes a :: "'a::euclidean_space"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7156
  shows "compact (cbox a b)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7157
  using bounded_closed_imp_seq_compact[of "cbox a b"] using bounded_cbox[of a b]
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7158
  by (auto simp: compact_eq_seq_compact_metric)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7159
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7160
lemma box_midpoint:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7161
  fixes a :: "'a::euclidean_space"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7162
  assumes "box a b \<noteq> {}"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7163
  shows "((1/2) *\<^sub>R (a + b)) \<in> box a b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7164
proof -
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7165
  {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7166
    fix i :: 'a
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7167
    assume "i \<in> Basis"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7168
    then have "a \<bullet> i < ((1 / 2) *\<^sub>R (a + b)) \<bullet> i \<and> ((1 / 2) *\<^sub>R (a + b)) \<bullet> i < b \<bullet> i"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7169
      using assms[unfolded box_ne_empty, THEN bspec[where x=i]] by (auto simp: inner_add_left)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7170
  }
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7171
  then show ?thesis unfolding mem_box by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7172
qed
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7173
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7174
lemma open_cbox_convex:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7175
  fixes x :: "'a::euclidean_space"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7176
  assumes x: "x \<in> box a b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7177
    and y: "y \<in> cbox a b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7178
    and e: "0 < e" "e \<le> 1"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7179
  shows "(e *\<^sub>R x + (1 - e) *\<^sub>R y) \<in> box a b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7180
proof -
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7181
  {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7182
    fix i :: 'a
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7183
    assume i: "i \<in> Basis"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7184
    have "a \<bullet> i = e * (a \<bullet> i) + (1 - e) * (a \<bullet> i)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7185
      unfolding left_diff_distrib by simp
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7186
    also have "\<dots> < e * (x \<bullet> i) + (1 - e) * (y \<bullet> i)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7187
      apply (rule add_less_le_mono)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7188
      using e unfolding mult_less_cancel_left and mult_le_cancel_left
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7189
      apply simp_all
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7190
      using x unfolding mem_box using i
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7191
      apply simp
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7192
      using y unfolding mem_box using i
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7193
      apply simp
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7194
      done
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7195
    finally have "a \<bullet> i < (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7196
      unfolding inner_simps by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7197
    moreover
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7198
    {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7199
      have "b \<bullet> i = e * (b\<bullet>i) + (1 - e) * (b\<bullet>i)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7200
        unfolding left_diff_distrib by simp
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7201
      also have "\<dots> > e * (x \<bullet> i) + (1 - e) * (y \<bullet> i)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7202
        apply (rule add_less_le_mono)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7203
        using e unfolding mult_less_cancel_left and mult_le_cancel_left
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7204
        apply simp_all
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7205
        using x
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7206
        unfolding mem_box
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7207
        using i
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7208
        apply simp
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7209
        using y
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7210
        unfolding mem_box
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7211
        using i
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7212
        apply simp
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7213
        done
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7214
      finally have "(e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i < b \<bullet> i"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7215
        unfolding inner_simps by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7216
    }
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7217
    ultimately have "a \<bullet> i < (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i \<and> (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i < b \<bullet> i"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7218
      by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7219
  }
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7220
  then show ?thesis
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7221
    unfolding mem_box by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7222
qed
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7223
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7224
lemma closure_box:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7225
  fixes a :: "'a::euclidean_space"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7226
   assumes "box a b \<noteq> {}"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7227
  shows "closure (box a b) = cbox a b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7228
proof -
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7229
  have ab: "a <e b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7230
    using assms by (simp add: eucl_less_def box_ne_empty)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7231
  let ?c = "(1 / 2) *\<^sub>R (a + b)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7232
  {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7233
    fix x
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7234
    assume as:"x \<in> cbox a b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7235
    def f \<equiv> "\<lambda>n::nat. x + (inverse (real n + 1)) *\<^sub>R (?c - x)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7236
    {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7237
      fix n
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7238
      assume fn: "f n <e b \<longrightarrow> a <e f n \<longrightarrow> f n = x" and xc: "x \<noteq> ?c"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7239
      have *: "0 < inverse (real n + 1)" "inverse (real n + 1) \<le> 1"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7240
        unfolding inverse_le_1_iff by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7241
      have "(inverse (real n + 1)) *\<^sub>R ((1 / 2) *\<^sub>R (a + b)) + (1 - inverse (real n + 1)) *\<^sub>R x =
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7242
        x + (inverse (real n + 1)) *\<^sub>R (((1 / 2) *\<^sub>R (a + b)) - x)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7243
        by (auto simp add: algebra_simps)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7244
      then have "f n <e b" and "a <e f n"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7245
        using open_cbox_convex[OF box_midpoint[OF assms] as *]
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7246
        unfolding f_def by (auto simp: box_def eucl_less_def)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7247
      then have False
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7248
        using fn unfolding f_def using xc by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7249
    }
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7250
    moreover
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7251
    {
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  7252
      assume "\<not> (f \<longlongrightarrow> x) sequentially"
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7253
      {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7254
        fix e :: real
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7255
        assume "e > 0"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7256
        then have "\<exists>N::nat. inverse (real (N + 1)) < e"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7257
          using real_arch_inv[of e]
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7258
          apply (auto simp add: Suc_pred')
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61552
diff changeset
  7259
          apply (metis Suc_pred' of_nat_Suc)
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7260
          done
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61552
diff changeset
  7261
        then obtain N :: nat where N: "inverse (real (N + 1)) < e"
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7262
          by auto
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61552
diff changeset
  7263
        have "inverse (real n + 1) < e" if "N \<le> n" for n
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61552
diff changeset
  7264
          by (auto intro!: that le_less_trans [OF _ N])
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7265
        then have "\<exists>N::nat. \<forall>n\<ge>N. inverse (real n + 1) < e" by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7266
      }
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  7267
      then have "((\<lambda>n. inverse (real n + 1)) \<longlongrightarrow> 0) sequentially"
60017
b785d6d06430 Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents: 59815
diff changeset
  7268
        unfolding lim_sequentially by(auto simp add: dist_norm)
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  7269
      then have "(f \<longlongrightarrow> x) sequentially"
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7270
        unfolding f_def
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7271
        using tendsto_add[OF tendsto_const, of "\<lambda>n::nat. (inverse (real n + 1)) *\<^sub>R ((1 / 2) *\<^sub>R (a + b) - x)" 0 sequentially x]
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7272
        using tendsto_scaleR [OF _ tendsto_const, of "\<lambda>n::nat. inverse (real n + 1)" 0 sequentially "((1 / 2) *\<^sub>R (a + b) - x)"]
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7273
        by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7274
    }
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7275
    ultimately have "x \<in> closure (box a b)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7276
      using as and box_midpoint[OF assms]
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7277
      unfolding closure_def
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7278
      unfolding islimpt_sequential
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7279
      by (cases "x=?c") (auto simp: in_box_eucl_less)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7280
  }
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7281
  then show ?thesis
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7282
    using closure_minimal[OF box_subset_cbox, of a b] by blast
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7283
qed
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7284
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7285
lemma bounded_subset_box_symmetric:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7286
  fixes s::"('a::euclidean_space) set"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7287
  assumes "bounded s"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7288
  shows "\<exists>a. s \<subseteq> box (-a) a"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7289
proof -
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7290
  obtain b where "b>0" and b: "\<forall>x\<in>s. norm x \<le> b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7291
    using assms[unfolded bounded_pos] by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7292
  def a \<equiv> "(\<Sum>i\<in>Basis. (b + 1) *\<^sub>R i)::'a"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7293
  {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7294
    fix x
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7295
    assume "x \<in> s"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7296
    fix i :: 'a
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7297
    assume i: "i \<in> Basis"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7298
    then have "(-a)\<bullet>i < x\<bullet>i" and "x\<bullet>i < a\<bullet>i"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7299
      using b[THEN bspec[where x=x], OF \<open>x\<in>s\<close>]
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7300
      using Basis_le_norm[OF i, of x]
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7301
      unfolding inner_simps and a_def
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7302
      by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7303
  }
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7304
  then show ?thesis
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7305
    by (auto intro: exI[where x=a] simp add: box_def)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7306
qed
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7307
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7308
lemma bounded_subset_open_interval:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7309
  fixes s :: "('a::euclidean_space) set"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7310
  shows "bounded s \<Longrightarrow> (\<exists>a b. s \<subseteq> box a b)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7311
  by (auto dest!: bounded_subset_box_symmetric)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7312
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7313
lemma bounded_subset_cbox_symmetric:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7314
  fixes s :: "('a::euclidean_space) set"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7315
   assumes "bounded s"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7316
  shows "\<exists>a. s \<subseteq> cbox (-a) a"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7317
proof -
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7318
  obtain a where "s \<subseteq> box (-a) a"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7319
    using bounded_subset_box_symmetric[OF assms] by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7320
  then show ?thesis
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7321
    using box_subset_cbox[of "-a" a] by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7322
qed
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7323
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7324
lemma bounded_subset_cbox:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7325
  fixes s :: "('a::euclidean_space) set"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7326
  shows "bounded s \<Longrightarrow> \<exists>a b. s \<subseteq> cbox a b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7327
  using bounded_subset_cbox_symmetric[of s] by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7328
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7329
lemma frontier_cbox:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7330
  fixes a b :: "'a::euclidean_space"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7331
  shows "frontier (cbox a b) = cbox a b - box a b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7332
  unfolding frontier_def unfolding interior_cbox and closure_closed[OF closed_cbox] ..
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7333
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7334
lemma frontier_box:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7335
  fixes a b :: "'a::euclidean_space"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7336
  shows "frontier (box a b) = (if box a b = {} then {} else cbox a b - box a b)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7337
proof (cases "box a b = {}")
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7338
  case True
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7339
  then show ?thesis
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7340
    using frontier_empty by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7341
next
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7342
  case False
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7343
  then show ?thesis
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7344
    unfolding frontier_def and closure_box[OF False] and interior_open[OF open_box]
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7345
    by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7346
qed
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7347
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7348
lemma inter_interval_mixed_eq_empty:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7349
  fixes a :: "'a::euclidean_space"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7350
   assumes "box c d \<noteq> {}"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7351
  shows "box a b \<inter> cbox c d = {} \<longleftrightarrow> box a b \<inter> box c d = {}"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7352
  unfolding closure_box[OF assms, symmetric]
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7353
  unfolding open_inter_closure_eq_empty[OF open_box] ..
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7354
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7355
lemma diameter_cbox:
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7356
  fixes a b::"'a::euclidean_space"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7357
  shows "(\<forall>i \<in> Basis. a \<bullet> i \<le> b \<bullet> i) \<Longrightarrow> diameter (cbox a b) = dist a b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7358
  by (force simp add: diameter_def SUP_def simp del: Sup_image_eq intro!: cSup_eq_maximum setL2_mono
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7359
     simp: euclidean_dist_l2[where 'a='a] cbox_def dist_norm)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7360
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7361
lemma eucl_less_eq_halfspaces:
61076
bdc1e2f0a86a eliminated \<Colon>;
wenzelm
parents: 60974
diff changeset
  7362
  fixes a :: "'a::euclidean_space"
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7363
  shows "{x. x <e a} = (\<Inter>i\<in>Basis. {x. x \<bullet> i < a \<bullet> i})"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7364
    "{x. a <e x} = (\<Inter>i\<in>Basis. {x. a \<bullet> i < x \<bullet> i})"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7365
  by (auto simp: eucl_less_def)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7366
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7367
lemma eucl_le_eq_halfspaces:
61076
bdc1e2f0a86a eliminated \<Colon>;
wenzelm
parents: 60974
diff changeset
  7368
  fixes a :: "'a::euclidean_space"
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7369
  shows "{x. \<forall>i\<in>Basis. x \<bullet> i \<le> a \<bullet> i} = (\<Inter>i\<in>Basis. {x. x \<bullet> i \<le> a \<bullet> i})"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7370
    "{x. \<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i} = (\<Inter>i\<in>Basis. {x. a \<bullet> i \<le> x \<bullet> i})"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7371
  by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7372
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7373
lemma open_Collect_eucl_less[simp, intro]:
61076
bdc1e2f0a86a eliminated \<Colon>;
wenzelm
parents: 60974
diff changeset
  7374
  fixes a :: "'a::euclidean_space"
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7375
  shows "open {x. x <e a}"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7376
    "open {x. a <e x}"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7377
  by (auto simp: eucl_less_eq_halfspaces open_halfspace_component_lt open_halfspace_component_gt)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7378
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7379
lemma closed_Collect_eucl_le[simp, intro]:
61076
bdc1e2f0a86a eliminated \<Colon>;
wenzelm
parents: 60974
diff changeset
  7380
  fixes a :: "'a::euclidean_space"
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7381
  shows "closed {x. \<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i}"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7382
    "closed {x. \<forall>i\<in>Basis. x \<bullet> i \<le> a \<bullet> i}"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7383
  unfolding eucl_le_eq_halfspaces
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7384
  by (simp_all add: closed_INT closed_Collect_le)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7385
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7386
lemma image_affinity_cbox: fixes m::real
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7387
  fixes a b c :: "'a::euclidean_space"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7388
  shows "(\<lambda>x. m *\<^sub>R x + c) ` cbox a b =
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7389
    (if cbox a b = {} then {}
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7390
     else (if 0 \<le> m then cbox (m *\<^sub>R a + c) (m *\<^sub>R b + c)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7391
     else cbox (m *\<^sub>R b + c) (m *\<^sub>R a + c)))"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7392
proof (cases "m = 0")
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7393
  case True
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7394
  {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7395
    fix x
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7396
    assume "\<forall>i\<in>Basis. x \<bullet> i \<le> c \<bullet> i" "\<forall>i\<in>Basis. c \<bullet> i \<le> x \<bullet> i"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7397
    then have "x = c"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7398
      apply -
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7399
      apply (subst euclidean_eq_iff)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7400
      apply (auto intro: order_antisym)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7401
      done
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7402
  }
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7403
  moreover have "c \<in> cbox (m *\<^sub>R a + c) (m *\<^sub>R b + c)"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7404
    unfolding True by (auto simp add: cbox_sing)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7405
  ultimately show ?thesis using True by (auto simp: cbox_def)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7406
next
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7407
  case False
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7408
  {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7409
    fix y
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7410
    assume "\<forall>i\<in>Basis. a \<bullet> i \<le> y \<bullet> i" "\<forall>i\<in>Basis. y \<bullet> i \<le> b \<bullet> i" "m > 0"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7411
    then have "\<forall>i\<in>Basis. (m *\<^sub>R a + c) \<bullet> i \<le> (m *\<^sub>R y + c) \<bullet> i" and "\<forall>i\<in>Basis. (m *\<^sub>R y + c) \<bullet> i \<le> (m *\<^sub>R b + c) \<bullet> i"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7412
      by (auto simp: inner_distrib)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7413
  }
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7414
  moreover
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7415
  {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7416
    fix y
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7417
    assume "\<forall>i\<in>Basis. a \<bullet> i \<le> y \<bullet> i" "\<forall>i\<in>Basis. y \<bullet> i \<le> b \<bullet> i" "m < 0"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7418
    then have "\<forall>i\<in>Basis. (m *\<^sub>R b + c) \<bullet> i \<le> (m *\<^sub>R y + c) \<bullet> i" and "\<forall>i\<in>Basis. (m *\<^sub>R y + c) \<bullet> i \<le> (m *\<^sub>R a + c) \<bullet> i"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7419
      by (auto simp add: mult_left_mono_neg inner_distrib)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7420
  }
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7421
  moreover
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7422
  {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7423
    fix y
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7424
    assume "m > 0" and "\<forall>i\<in>Basis. (m *\<^sub>R a + c) \<bullet> i \<le> y \<bullet> i" and "\<forall>i\<in>Basis. y \<bullet> i \<le> (m *\<^sub>R b + c) \<bullet> i"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7425
    then have "y \<in> (\<lambda>x. m *\<^sub>R x + c) ` cbox a b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7426
      unfolding image_iff Bex_def mem_box
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7427
      apply (intro exI[where x="(1 / m) *\<^sub>R (y - c)"])
61762
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
  7428
      apply (auto simp add: pos_le_divide_eq pos_divide_le_eq mult.commute inner_distrib inner_diff_left)
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7429
      done
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7430
  }
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7431
  moreover
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7432
  {
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7433
    fix y
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7434
    assume "\<forall>i\<in>Basis. (m *\<^sub>R b + c) \<bullet> i \<le> y \<bullet> i" "\<forall>i\<in>Basis. y \<bullet> i \<le> (m *\<^sub>R a + c) \<bullet> i" "m < 0"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7435
    then have "y \<in> (\<lambda>x. m *\<^sub>R x + c) ` cbox a b"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7436
      unfolding image_iff Bex_def mem_box
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7437
      apply (intro exI[where x="(1 / m) *\<^sub>R (y - c)"])
61762
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
  7438
      apply (auto simp add: neg_le_divide_eq neg_divide_le_eq mult.commute inner_distrib inner_diff_left)
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7439
      done
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7440
  }
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7441
  ultimately show ?thesis using False by (auto simp: cbox_def)
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7442
qed
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7443
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7444
lemma image_smult_cbox:"(\<lambda>x. m *\<^sub>R (x::_::euclidean_space)) ` cbox a b =
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7445
  (if cbox a b = {} then {} else if 0 \<le> m then cbox (m *\<^sub>R a) (m *\<^sub>R b) else cbox (m *\<^sub>R b) (m *\<^sub>R a))"
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7446
  using image_affinity_cbox[of m 0 a b] by auto
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7447
60176
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7448
lemma islimpt_greaterThanLessThan1:
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7449
  fixes a b::"'a::{linorder_topology, dense_order}"
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7450
  assumes "a < b"
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7451
  shows  "a islimpt {a<..<b}"
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7452
proof (rule islimptI)
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7453
  fix T
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7454
  assume "open T" "a \<in> T"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7455
  from open_right[OF this \<open>a < b\<close>]
60176
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7456
  obtain c where c: "a < c" "{a..<c} \<subseteq> T" by auto
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7457
  with assms dense[of a "min c b"]
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7458
  show "\<exists>y\<in>{a<..<b}. y \<in> T \<and> y \<noteq> a"
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7459
    by (metis atLeastLessThan_iff greaterThanLessThan_iff min_less_iff_conj
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7460
      not_le order.strict_implies_order subset_eq)
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7461
qed
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7462
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7463
lemma islimpt_greaterThanLessThan2:
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7464
  fixes a b::"'a::{linorder_topology, dense_order}"
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7465
  assumes "a < b"
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7466
  shows  "b islimpt {a<..<b}"
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7467
proof (rule islimptI)
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7468
  fix T
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7469
  assume "open T" "b \<in> T"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7470
  from open_left[OF this \<open>a < b\<close>]
60176
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7471
  obtain c where c: "c < b" "{c<..b} \<subseteq> T" by auto
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7472
  with assms dense[of "max a c" b]
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7473
  show "\<exists>y\<in>{a<..<b}. y \<in> T \<and> y \<noteq> b"
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7474
    by (metis greaterThanAtMost_iff greaterThanLessThan_iff max_less_iff_conj
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7475
      not_le order.strict_implies_order subset_eq)
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7476
qed
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7477
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7478
lemma closure_greaterThanLessThan[simp]:
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7479
  fixes a b::"'a::{linorder_topology, dense_order}"
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7480
  shows "a < b \<Longrightarrow> closure {a <..< b} = {a .. b}" (is "_ \<Longrightarrow> ?l = ?r")
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7481
proof
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7482
  have "?l \<subseteq> closure ?r"
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7483
    by (rule closure_mono) auto
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7484
  thus "closure {a<..<b} \<subseteq> {a..b}" by simp
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7485
qed (auto simp: closure_def order.order_iff_strict islimpt_greaterThanLessThan1
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7486
  islimpt_greaterThanLessThan2)
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7487
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7488
lemma closure_greaterThan[simp]:
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7489
  fixes a b::"'a::{no_top, linorder_topology, dense_order}"
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7490
  shows "closure {a<..} = {a..}"
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7491
proof -
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7492
  from gt_ex obtain b where "a < b" by auto
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7493
  hence "{a<..} = {a<..<b} \<union> {b..}" by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7494
  also have "closure \<dots> = {a..}" using \<open>a < b\<close> unfolding closure_union
60176
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7495
    by auto
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7496
  finally show ?thesis .
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7497
qed
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7498
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7499
lemma closure_lessThan[simp]:
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7500
  fixes b::"'a::{no_bot, linorder_topology, dense_order}"
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7501
  shows "closure {..<b} = {..b}"
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7502
proof -
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7503
  from lt_ex obtain a where "a < b" by auto
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7504
  hence "{..<b} = {a<..<b} \<union> {..a}" by auto
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7505
  also have "closure \<dots> = {..b}" using \<open>a < b\<close> unfolding closure_union
60176
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7506
    by auto
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7507
  finally show ?thesis .
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7508
qed
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7509
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7510
lemma closure_atLeastLessThan[simp]:
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7511
  fixes a b::"'a::{linorder_topology, dense_order}"
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7512
  assumes "a < b"
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7513
  shows "closure {a ..< b} = {a .. b}"
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7514
proof -
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7515
  from assms have "{a ..< b} = {a} \<union> {a <..< b}" by auto
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7516
  also have "closure \<dots> = {a .. b}" unfolding closure_union
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7517
    by (auto simp add: assms less_imp_le)
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7518
  finally show ?thesis .
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7519
qed
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7520
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7521
lemma closure_greaterThanAtMost[simp]:
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7522
  fixes a b::"'a::{linorder_topology, dense_order}"
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7523
  assumes "a < b"
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7524
  shows "closure {a <.. b} = {a .. b}"
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7525
proof -
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7526
  from assms have "{a <.. b} = {b} \<union> {a <..< b}" by auto
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7527
  also have "closure \<dots> = {a .. b}" unfolding closure_union
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7528
    by (auto simp add: assms less_imp_le)
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7529
  finally show ?thesis .
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7530
qed
38b630409aa2 closures of intervals
immler
parents: 60150
diff changeset
  7531
56189
c4daa97ac57a removed dependencies on theory Ordered_Euclidean_Space
immler
parents: 56188
diff changeset
  7532
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7533
subsection \<open>Homeomorphisms\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7534
52625
wenzelm
parents: 52624
diff changeset
  7535
definition "homeomorphism s t f g \<longleftrightarrow>
wenzelm
parents: 52624
diff changeset
  7536
  (\<forall>x\<in>s. (g(f x) = x)) \<and> (f ` s = t) \<and> continuous_on s f \<and>
wenzelm
parents: 52624
diff changeset
  7537
  (\<forall>y\<in>t. (f(g y) = y)) \<and> (g ` t = s) \<and> continuous_on t g"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7538
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  7539
definition homeomorphic :: "'a::topological_space set \<Rightarrow> 'b::topological_space set \<Rightarrow> bool"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7540
    (infixr "homeomorphic" 60)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7541
  where "s homeomorphic t \<equiv> (\<exists>f g. homeomorphism s t f g)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7542
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7543
lemma homeomorphic_refl: "s homeomorphic s"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7544
  unfolding homeomorphic_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7545
  unfolding homeomorphism_def
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7546
  using continuous_on_id
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7547
  apply (rule_tac x = "(\<lambda>x. x)" in exI)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7548
  apply (rule_tac x = "(\<lambda>x. x)" in exI)
52625
wenzelm
parents: 52624
diff changeset
  7549
  apply blast
wenzelm
parents: 52624
diff changeset
  7550
  done
wenzelm
parents: 52624
diff changeset
  7551
wenzelm
parents: 52624
diff changeset
  7552
lemma homeomorphic_sym: "s homeomorphic t \<longleftrightarrow> t homeomorphic s"
wenzelm
parents: 52624
diff changeset
  7553
  unfolding homeomorphic_def
wenzelm
parents: 52624
diff changeset
  7554
  unfolding homeomorphism_def
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7555
  by blast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7556
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7557
lemma homeomorphic_trans:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7558
  assumes "s homeomorphic t"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7559
    and "t homeomorphic u"
52625
wenzelm
parents: 52624
diff changeset
  7560
  shows "s homeomorphic u"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7561
proof -
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7562
  obtain f1 g1 where fg1: "\<forall>x\<in>s. g1 (f1 x) = x"  "f1 ` s = t"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7563
    "continuous_on s f1" "\<forall>y\<in>t. f1 (g1 y) = y" "g1 ` t = s" "continuous_on t g1"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7564
    using assms(1) unfolding homeomorphic_def homeomorphism_def by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7565
  obtain f2 g2 where fg2: "\<forall>x\<in>t. g2 (f2 x) = x"  "f2 ` t = u" "continuous_on t f2"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7566
    "\<forall>y\<in>u. f2 (g2 y) = y" "g2 ` u = t" "continuous_on u g2"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7567
    using assms(2) unfolding homeomorphic_def homeomorphism_def by auto
52625
wenzelm
parents: 52624
diff changeset
  7568
  {
wenzelm
parents: 52624
diff changeset
  7569
    fix x
wenzelm
parents: 52624
diff changeset
  7570
    assume "x\<in>s"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7571
    then have "(g1 \<circ> g2) ((f2 \<circ> f1) x) = x"
52625
wenzelm
parents: 52624
diff changeset
  7572
      using fg1(1)[THEN bspec[where x=x]] and fg2(1)[THEN bspec[where x="f1 x"]] and fg1(2)
wenzelm
parents: 52624
diff changeset
  7573
      by auto
wenzelm
parents: 52624
diff changeset
  7574
  }
wenzelm
parents: 52624
diff changeset
  7575
  moreover have "(f2 \<circ> f1) ` s = u"
wenzelm
parents: 52624
diff changeset
  7576
    using fg1(2) fg2(2) by auto
wenzelm
parents: 52624
diff changeset
  7577
  moreover have "continuous_on s (f2 \<circ> f1)"
wenzelm
parents: 52624
diff changeset
  7578
    using continuous_on_compose[OF fg1(3)] and fg2(3) unfolding fg1(2) by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7579
  moreover
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7580
  {
52625
wenzelm
parents: 52624
diff changeset
  7581
    fix y
wenzelm
parents: 52624
diff changeset
  7582
    assume "y\<in>u"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7583
    then have "(f2 \<circ> f1) ((g1 \<circ> g2) y) = y"
52625
wenzelm
parents: 52624
diff changeset
  7584
      using fg2(4)[THEN bspec[where x=y]] and fg1(4)[THEN bspec[where x="g2 y"]] and fg2(5)
wenzelm
parents: 52624
diff changeset
  7585
      by auto
wenzelm
parents: 52624
diff changeset
  7586
  }
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7587
  moreover have "(g1 \<circ> g2) ` u = s" using fg1(5) fg2(5) by auto
52625
wenzelm
parents: 52624
diff changeset
  7588
  moreover have "continuous_on u (g1 \<circ> g2)"
wenzelm
parents: 52624
diff changeset
  7589
    using continuous_on_compose[OF fg2(6)] and fg1(6)
wenzelm
parents: 52624
diff changeset
  7590
    unfolding fg2(5)
wenzelm
parents: 52624
diff changeset
  7591
    by auto
wenzelm
parents: 52624
diff changeset
  7592
  ultimately show ?thesis
wenzelm
parents: 52624
diff changeset
  7593
    unfolding homeomorphic_def homeomorphism_def
wenzelm
parents: 52624
diff changeset
  7594
    apply (rule_tac x="f2 \<circ> f1" in exI)
wenzelm
parents: 52624
diff changeset
  7595
    apply (rule_tac x="g1 \<circ> g2" in exI)
wenzelm
parents: 52624
diff changeset
  7596
    apply auto
wenzelm
parents: 52624
diff changeset
  7597
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7598
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7599
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7600
lemma homeomorphic_minimal:
52625
wenzelm
parents: 52624
diff changeset
  7601
  "s homeomorphic t \<longleftrightarrow>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7602
    (\<exists>f g. (\<forall>x\<in>s. f(x) \<in> t \<and> (g(f(x)) = x)) \<and>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7603
           (\<forall>y\<in>t. g(y) \<in> s \<and> (f(g(y)) = y)) \<and>
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7604
           continuous_on s f \<and> continuous_on t g)"
52625
wenzelm
parents: 52624
diff changeset
  7605
  unfolding homeomorphic_def homeomorphism_def
wenzelm
parents: 52624
diff changeset
  7606
  apply auto
wenzelm
parents: 52624
diff changeset
  7607
  apply (rule_tac x=f in exI)
wenzelm
parents: 52624
diff changeset
  7608
  apply (rule_tac x=g in exI)
wenzelm
parents: 52624
diff changeset
  7609
  apply auto
wenzelm
parents: 52624
diff changeset
  7610
  apply (rule_tac x=f in exI)
wenzelm
parents: 52624
diff changeset
  7611
  apply (rule_tac x=g in exI)
wenzelm
parents: 52624
diff changeset
  7612
  apply auto
wenzelm
parents: 52624
diff changeset
  7613
  unfolding image_iff
wenzelm
parents: 52624
diff changeset
  7614
  apply (erule_tac x="g x" in ballE)
wenzelm
parents: 52624
diff changeset
  7615
  apply (erule_tac x="x" in ballE)
wenzelm
parents: 52624
diff changeset
  7616
  apply auto
wenzelm
parents: 52624
diff changeset
  7617
  apply (rule_tac x="g x" in bexI)
wenzelm
parents: 52624
diff changeset
  7618
  apply auto
wenzelm
parents: 52624
diff changeset
  7619
  apply (erule_tac x="f x" in ballE)
wenzelm
parents: 52624
diff changeset
  7620
  apply (erule_tac x="x" in ballE)
wenzelm
parents: 52624
diff changeset
  7621
  apply auto
wenzelm
parents: 52624
diff changeset
  7622
  apply (rule_tac x="f x" in bexI)
wenzelm
parents: 52624
diff changeset
  7623
  apply auto
wenzelm
parents: 52624
diff changeset
  7624
  done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7625
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7626
text \<open>Relatively weak hypotheses if a set is compact.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7627
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7628
lemma homeomorphism_compact:
50898
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  7629
  fixes f :: "'a::topological_space \<Rightarrow> 'b::t2_space"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7630
  assumes "compact s" "continuous_on s f"  "f ` s = t"  "inj_on f s"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7631
  shows "\<exists>g. homeomorphism s t f g"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7632
proof -
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7633
  def g \<equiv> "\<lambda>x. SOME y. y\<in>s \<and> f y = x"
52625
wenzelm
parents: 52624
diff changeset
  7634
  have g: "\<forall>x\<in>s. g (f x) = x"
wenzelm
parents: 52624
diff changeset
  7635
    using assms(3) assms(4)[unfolded inj_on_def] unfolding g_def by auto
wenzelm
parents: 52624
diff changeset
  7636
  {
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7637
    fix y
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7638
    assume "y \<in> t"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7639
    then obtain x where x:"f x = y" "x\<in>s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7640
      using assms(3) by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7641
    then have "g (f x) = x" using g by auto
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  7642
    then have "f (g y) = y" unfolding x(1)[symmetric] by auto
52625
wenzelm
parents: 52624
diff changeset
  7643
  }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7644
  then have g':"\<forall>x\<in>t. f (g x) = x" by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7645
  moreover
52625
wenzelm
parents: 52624
diff changeset
  7646
  {
wenzelm
parents: 52624
diff changeset
  7647
    fix x
wenzelm
parents: 52624
diff changeset
  7648
    have "x\<in>s \<Longrightarrow> x \<in> g ` t"
wenzelm
parents: 52624
diff changeset
  7649
      using g[THEN bspec[where x=x]]
wenzelm
parents: 52624
diff changeset
  7650
      unfolding image_iff
wenzelm
parents: 52624
diff changeset
  7651
      using assms(3)
wenzelm
parents: 52624
diff changeset
  7652
      by (auto intro!: bexI[where x="f x"])
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7653
    moreover
52625
wenzelm
parents: 52624
diff changeset
  7654
    {
wenzelm
parents: 52624
diff changeset
  7655
      assume "x\<in>g ` t"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7656
      then obtain y where y:"y\<in>t" "g y = x" by auto
52625
wenzelm
parents: 52624
diff changeset
  7657
      then obtain x' where x':"x'\<in>s" "f x' = y"
wenzelm
parents: 52624
diff changeset
  7658
        using assms(3) by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7659
      then have "x \<in> s"
52625
wenzelm
parents: 52624
diff changeset
  7660
        unfolding g_def
wenzelm
parents: 52624
diff changeset
  7661
        using someI2[of "\<lambda>b. b\<in>s \<and> f b = y" x' "\<lambda>x. x\<in>s"]
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  7662
        unfolding y(2)[symmetric] and g_def
52625
wenzelm
parents: 52624
diff changeset
  7663
        by auto
wenzelm
parents: 52624
diff changeset
  7664
    }
wenzelm
parents: 52624
diff changeset
  7665
    ultimately have "x\<in>s \<longleftrightarrow> x \<in> g ` t" ..
wenzelm
parents: 52624
diff changeset
  7666
  }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7667
  then have "g ` t = s" by auto
52625
wenzelm
parents: 52624
diff changeset
  7668
  ultimately show ?thesis
wenzelm
parents: 52624
diff changeset
  7669
    unfolding homeomorphism_def homeomorphic_def
wenzelm
parents: 52624
diff changeset
  7670
    apply (rule_tac x=g in exI)
wenzelm
parents: 52624
diff changeset
  7671
    using g and assms(3) and continuous_on_inv[OF assms(2,1), of g, unfolded assms(3)] and assms(2)
wenzelm
parents: 52624
diff changeset
  7672
    apply auto
wenzelm
parents: 52624
diff changeset
  7673
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7674
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7675
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7676
lemma homeomorphic_compact:
50898
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  7677
  fixes f :: "'a::topological_space \<Rightarrow> 'b::t2_space"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7678
  shows "compact s \<Longrightarrow> continuous_on s f \<Longrightarrow> (f ` s = t) \<Longrightarrow> inj_on f s \<Longrightarrow> s homeomorphic t"
37486
b993fac7985b beta-eta was too much, because it transformed SOME x. P x into Eps P, which caused problems later;
blanchet
parents: 37452
diff changeset
  7679
  unfolding homeomorphic_def by (metis homeomorphism_compact)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7680
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7681
text\<open>Preservation of topological properties.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7682
52625
wenzelm
parents: 52624
diff changeset
  7683
lemma homeomorphic_compactness: "s homeomorphic t \<Longrightarrow> (compact s \<longleftrightarrow> compact t)"
wenzelm
parents: 52624
diff changeset
  7684
  unfolding homeomorphic_def homeomorphism_def
wenzelm
parents: 52624
diff changeset
  7685
  by (metis compact_continuous_image)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7686
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7687
text\<open>Results on translation, scaling etc.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7688
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7689
lemma homeomorphic_scaling:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7690
  fixes s :: "'a::real_normed_vector set"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7691
  assumes "c \<noteq> 0"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7692
  shows "s homeomorphic ((\<lambda>x. c *\<^sub>R x) ` s)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7693
  unfolding homeomorphic_minimal
52625
wenzelm
parents: 52624
diff changeset
  7694
  apply (rule_tac x="\<lambda>x. c *\<^sub>R x" in exI)
wenzelm
parents: 52624
diff changeset
  7695
  apply (rule_tac x="\<lambda>x. (1 / c) *\<^sub>R x" in exI)
wenzelm
parents: 52624
diff changeset
  7696
  using assms
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56290
diff changeset
  7697
  apply (auto simp add: continuous_intros)
52625
wenzelm
parents: 52624
diff changeset
  7698
  done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7699
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7700
lemma homeomorphic_translation:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7701
  fixes s :: "'a::real_normed_vector set"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7702
  shows "s homeomorphic ((\<lambda>x. a + x) ` s)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7703
  unfolding homeomorphic_minimal
52625
wenzelm
parents: 52624
diff changeset
  7704
  apply (rule_tac x="\<lambda>x. a + x" in exI)
wenzelm
parents: 52624
diff changeset
  7705
  apply (rule_tac x="\<lambda>x. -a + x" in exI)
54230
b1d955791529 more simplification rules on unary and binary minus
haftmann
parents: 54070
diff changeset
  7706
  using continuous_on_add [OF continuous_on_const continuous_on_id, of s a]
b1d955791529 more simplification rules on unary and binary minus
haftmann
parents: 54070
diff changeset
  7707
    continuous_on_add [OF continuous_on_const continuous_on_id, of "plus a ` s" "- a"]
52625
wenzelm
parents: 52624
diff changeset
  7708
  apply auto
wenzelm
parents: 52624
diff changeset
  7709
  done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7710
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7711
lemma homeomorphic_affinity:
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7712
  fixes s :: "'a::real_normed_vector set"
52625
wenzelm
parents: 52624
diff changeset
  7713
  assumes "c \<noteq> 0"
wenzelm
parents: 52624
diff changeset
  7714
  shows "s homeomorphic ((\<lambda>x. a + c *\<^sub>R x) ` s)"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7715
proof -
52625
wenzelm
parents: 52624
diff changeset
  7716
  have *: "op + a ` op *\<^sub>R c ` s = (\<lambda>x. a + c *\<^sub>R x) ` s" by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7717
  show ?thesis
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7718
    using homeomorphic_trans
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7719
    using homeomorphic_scaling[OF assms, of s]
52625
wenzelm
parents: 52624
diff changeset
  7720
    using homeomorphic_translation[of "(\<lambda>x. c *\<^sub>R x) ` s" a]
wenzelm
parents: 52624
diff changeset
  7721
    unfolding *
wenzelm
parents: 52624
diff changeset
  7722
    by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7723
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7724
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7725
lemma homeomorphic_balls:
50898
ebd9b82537e0 generalized more topology theorems
huffman
parents: 50897
diff changeset
  7726
  fixes a b ::"'a::real_normed_vector"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7727
  assumes "0 < d"  "0 < e"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7728
  shows "(ball a d) homeomorphic  (ball b e)" (is ?th)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7729
    and "(cball a d) homeomorphic (cball b e)" (is ?cth)
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7730
proof -
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7731
  show ?th unfolding homeomorphic_minimal
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7732
    apply(rule_tac x="\<lambda>x. b + (e/d) *\<^sub>R (x - a)" in exI)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7733
    apply(rule_tac x="\<lambda>x. a + (d/e) *\<^sub>R (x - b)" in exI)
51364
8ee377823518 tuned proofs
hoelzl
parents: 51362
diff changeset
  7734
    using assms
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56290
diff changeset
  7735
    apply (auto intro!: continuous_intros
52625
wenzelm
parents: 52624
diff changeset
  7736
      simp: dist_commute dist_norm pos_divide_less_eq mult_strict_left_mono)
51364
8ee377823518 tuned proofs
hoelzl
parents: 51362
diff changeset
  7737
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7738
  show ?cth unfolding homeomorphic_minimal
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7739
    apply(rule_tac x="\<lambda>x. b + (e/d) *\<^sub>R (x - a)" in exI)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7740
    apply(rule_tac x="\<lambda>x. a + (d/e) *\<^sub>R (x - b)" in exI)
51364
8ee377823518 tuned proofs
hoelzl
parents: 51362
diff changeset
  7741
    using assms
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56290
diff changeset
  7742
    apply (auto intro!: continuous_intros
52625
wenzelm
parents: 52624
diff changeset
  7743
      simp: dist_commute dist_norm pos_divide_le_eq mult_strict_left_mono)
51364
8ee377823518 tuned proofs
hoelzl
parents: 51362
diff changeset
  7744
    done
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7745
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7746
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7747
text\<open>"Isometry" (up to constant bounds) of injective linear map etc.\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7748
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7749
lemma cauchy_isometric:
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  7750
  assumes e: "e > 0"
52625
wenzelm
parents: 52624
diff changeset
  7751
    and s: "subspace s"
wenzelm
parents: 52624
diff changeset
  7752
    and f: "bounded_linear f"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  7753
    and normf: "\<forall>x\<in>s. norm (f x) \<ge> e * norm x"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  7754
    and xs: "\<forall>n. x n \<in> s"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  7755
    and cf: "Cauchy (f \<circ> x)"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7756
  shows "Cauchy x"
52625
wenzelm
parents: 52624
diff changeset
  7757
proof -
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7758
  interpret f: bounded_linear f by fact
52625
wenzelm
parents: 52624
diff changeset
  7759
  {
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  7760
    fix d :: real
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  7761
    assume "d > 0"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7762
    then obtain N where N:"\<forall>n\<ge>N. norm (f (x n) - f (x N)) < e * d"
56544
b60d5d119489 made mult_pos_pos a simp rule
nipkow
parents: 56541
diff changeset
  7763
      using cf[unfolded cauchy o_def dist_norm, THEN spec[where x="e*d"]] e
52625
wenzelm
parents: 52624
diff changeset
  7764
      by auto
wenzelm
parents: 52624
diff changeset
  7765
    {
wenzelm
parents: 52624
diff changeset
  7766
      fix n
wenzelm
parents: 52624
diff changeset
  7767
      assume "n\<ge>N"
45270
d5b5c9259afd fix bug in cancel_factor simprocs so they will work on goals like 'x * y < x * z' where the common term is already on the left
huffman
parents: 45051
diff changeset
  7768
      have "e * norm (x n - x N) \<le> norm (f (x n - x N))"
52625
wenzelm
parents: 52624
diff changeset
  7769
        using subspace_sub[OF s, of "x n" "x N"]
wenzelm
parents: 52624
diff changeset
  7770
        using xs[THEN spec[where x=N]] and xs[THEN spec[where x=n]]
wenzelm
parents: 52624
diff changeset
  7771
        using normf[THEN bspec[where x="x n - x N"]]
wenzelm
parents: 52624
diff changeset
  7772
        by auto
45270
d5b5c9259afd fix bug in cancel_factor simprocs so they will work on goals like 'x * y < x * z' where the common term is already on the left
huffman
parents: 45051
diff changeset
  7773
      also have "norm (f (x n - x N)) < e * d"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7774
        using \<open>N \<le> n\<close> N unfolding f.diff[symmetric] by auto
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7775
      finally have "norm (x n - x N) < d" using \<open>e>0\<close> by simp
52625
wenzelm
parents: 52624
diff changeset
  7776
    }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7777
    then have "\<exists>N. \<forall>n\<ge>N. norm (x n - x N) < d" by auto
52625
wenzelm
parents: 52624
diff changeset
  7778
  }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7779
  then show ?thesis unfolding cauchy and dist_norm by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7780
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7781
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7782
lemma complete_isometric_image:
52625
wenzelm
parents: 52624
diff changeset
  7783
  assumes "0 < e"
wenzelm
parents: 52624
diff changeset
  7784
    and s: "subspace s"
wenzelm
parents: 52624
diff changeset
  7785
    and f: "bounded_linear f"
wenzelm
parents: 52624
diff changeset
  7786
    and normf: "\<forall>x\<in>s. norm(f x) \<ge> e * norm(x)"
wenzelm
parents: 52624
diff changeset
  7787
    and cs: "complete s"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  7788
  shows "complete (f ` s)"
52625
wenzelm
parents: 52624
diff changeset
  7789
proof -
wenzelm
parents: 52624
diff changeset
  7790
  {
wenzelm
parents: 52624
diff changeset
  7791
    fix g
wenzelm
parents: 52624
diff changeset
  7792
    assume as:"\<forall>n::nat. g n \<in> f ` s" and cfg:"Cauchy g"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7793
    then obtain x where "\<forall>n. x n \<in> s \<and> g n = f (x n)"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  7794
      using choice[of "\<lambda> n xa. xa \<in> s \<and> g n = f xa"]
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  7795
      by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  7796
    then have x:"\<forall>n. x n \<in> s"  "\<forall>n. g n = f (x n)"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  7797
      by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  7798
    then have "f \<circ> x = g"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  7799
      unfolding fun_eq_iff
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  7800
      by auto
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  7801
    then obtain l where "l\<in>s" and l:"(x \<longlongrightarrow> l) sequentially"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7802
      using cs[unfolded complete_def, THEN spec[where x="x"]]
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7803
      using cauchy_isometric[OF \<open>0 < e\<close> s f normf] and cfg and x(1)
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  7804
      by auto
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  7805
    then have "\<exists>l\<in>f ` s. (g \<longlongrightarrow> l) sequentially"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7806
      using linear_continuous_at[OF f, unfolded continuous_at_sequentially, THEN spec[where x=x], of l]
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7807
      unfolding \<open>f \<circ> x = g\<close>
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  7808
      by auto
52625
wenzelm
parents: 52624
diff changeset
  7809
  }
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  7810
  then show ?thesis
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  7811
    unfolding complete_def by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7812
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7813
52625
wenzelm
parents: 52624
diff changeset
  7814
lemma injective_imp_isometric:
wenzelm
parents: 52624
diff changeset
  7815
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
wenzelm
parents: 52624
diff changeset
  7816
  assumes s: "closed s" "subspace s"
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  7817
    and f: "bounded_linear f" "\<forall>x\<in>s. f x = 0 \<longrightarrow> x = 0"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  7818
  shows "\<exists>e>0. \<forall>x\<in>s. norm (f x) \<ge> e * norm x"
52625
wenzelm
parents: 52624
diff changeset
  7819
proof (cases "s \<subseteq> {0::'a}")
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7820
  case True
52625
wenzelm
parents: 52624
diff changeset
  7821
  {
wenzelm
parents: 52624
diff changeset
  7822
    fix x
wenzelm
parents: 52624
diff changeset
  7823
    assume "x \<in> s"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7824
    then have "x = 0" using True by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7825
    then have "norm x \<le> norm (f x)" by auto
52625
wenzelm
parents: 52624
diff changeset
  7826
  }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7827
  then show ?thesis by (auto intro!: exI[where x=1])
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7828
next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7829
  interpret f: bounded_linear f by fact
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7830
  case False
53640
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  7831
  then obtain a where a: "a \<noteq> 0" "a \<in> s"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  7832
    by auto
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  7833
  from False have "s \<noteq> {}"
3170b5eb9f5a tuned proofs;
wenzelm
parents: 53597
diff changeset
  7834
    by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7835
  let ?S = "{f x| x. (x \<in> s \<and> norm x = norm a)}"
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 37452
diff changeset
  7836
  let ?S' = "{x::'a. x\<in>s \<and> norm x = norm a}"
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 37452
diff changeset
  7837
  let ?S'' = "{x::'a. norm x = norm a}"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7838
52625
wenzelm
parents: 52624
diff changeset
  7839
  have "?S'' = frontier(cball 0 (norm a))"
wenzelm
parents: 52624
diff changeset
  7840
    unfolding frontier_cball and dist_norm by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7841
  then have "compact ?S''"
52625
wenzelm
parents: 52624
diff changeset
  7842
    using compact_frontier[OF compact_cball, of 0 "norm a"] by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7843
  moreover have "?S' = s \<inter> ?S''" by auto
52625
wenzelm
parents: 52624
diff changeset
  7844
  ultimately have "compact ?S'"
wenzelm
parents: 52624
diff changeset
  7845
    using closed_inter_compact[of s ?S''] using s(1) by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7846
  moreover have *:"f ` ?S' = ?S" by auto
52625
wenzelm
parents: 52624
diff changeset
  7847
  ultimately have "compact ?S"
wenzelm
parents: 52624
diff changeset
  7848
    using compact_continuous_image[OF linear_continuous_on[OF f(1)], of ?S'] by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7849
  then have "closed ?S" using compact_imp_closed by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7850
  moreover have "?S \<noteq> {}" using a by auto
52625
wenzelm
parents: 52624
diff changeset
  7851
  ultimately obtain b' where "b'\<in>?S" "\<forall>y\<in>?S. norm b' \<le> norm y"
wenzelm
parents: 52624
diff changeset
  7852
    using distance_attains_inf[of ?S 0] unfolding dist_0_norm by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7853
  then obtain b where "b\<in>s"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7854
    and ba: "norm b = norm a"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7855
    and b: "\<forall>x\<in>{x \<in> s. norm x = norm a}. norm (f b) \<le> norm (f x)"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  7856
    unfolding *[symmetric] unfolding image_iff by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7857
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7858
  let ?e = "norm (f b) / norm b"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7859
  have "norm b > 0" using ba and a and norm_ge_zero by auto
52625
wenzelm
parents: 52624
diff changeset
  7860
  moreover have "norm (f b) > 0"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7861
    using f(2)[THEN bspec[where x=b], OF \<open>b\<in>s\<close>]
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7862
    using \<open>norm b >0\<close>
52625
wenzelm
parents: 52624
diff changeset
  7863
    unfolding zero_less_norm_iff
wenzelm
parents: 52624
diff changeset
  7864
    by auto
56541
0e3abadbef39 made divide_pos_pos a simp rule
nipkow
parents: 56371
diff changeset
  7865
  ultimately have "0 < norm (f b) / norm b" by simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7866
  moreover
52625
wenzelm
parents: 52624
diff changeset
  7867
  {
wenzelm
parents: 52624
diff changeset
  7868
    fix x
wenzelm
parents: 52624
diff changeset
  7869
    assume "x\<in>s"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7870
    then have "norm (f b) / norm b * norm x \<le> norm (f x)"
52625
wenzelm
parents: 52624
diff changeset
  7871
    proof (cases "x=0")
wenzelm
parents: 52624
diff changeset
  7872
      case True
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7873
      then show "norm (f b) / norm b * norm x \<le> norm (f x)" by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7874
    next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7875
      case False
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7876
      then have *: "0 < norm a / norm x"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7877
        using \<open>a\<noteq>0\<close>
56541
0e3abadbef39 made divide_pos_pos a simp rule
nipkow
parents: 56371
diff changeset
  7878
        unfolding zero_less_norm_iff[symmetric] by simp
52625
wenzelm
parents: 52624
diff changeset
  7879
      have "\<forall>c. \<forall>x\<in>s. c *\<^sub>R x \<in> s"
wenzelm
parents: 52624
diff changeset
  7880
        using s[unfolded subspace_def] by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7881
      then have "(norm a / norm x) *\<^sub>R x \<in> {x \<in> s. norm x = norm a}"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7882
        using \<open>x\<in>s\<close> and \<open>x\<noteq>0\<close> by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7883
      then show "norm (f b) / norm b * norm x \<le> norm (f x)"
52625
wenzelm
parents: 52624
diff changeset
  7884
        using b[THEN bspec[where x="(norm a / norm x) *\<^sub>R x"]]
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7885
        unfolding f.scaleR and ba using \<open>x\<noteq>0\<close> \<open>a\<noteq>0\<close>
57512
cc97b347b301 reduced name variants for assoc and commute on plus and mult
haftmann
parents: 57448
diff changeset
  7886
        by (auto simp add: mult.commute pos_le_divide_eq pos_divide_le_eq)
52625
wenzelm
parents: 52624
diff changeset
  7887
    qed
wenzelm
parents: 52624
diff changeset
  7888
  }
wenzelm
parents: 52624
diff changeset
  7889
  ultimately show ?thesis by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7890
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7891
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7892
lemma closed_injective_image_subspace:
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 37452
diff changeset
  7893
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7894
  assumes "subspace s" "bounded_linear f" "\<forall>x\<in>s. f x = 0 \<longrightarrow> x = 0" "closed s"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7895
  shows "closed(f ` s)"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7896
proof -
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7897
  obtain e where "e > 0" and e: "\<forall>x\<in>s. e * norm x \<le> norm (f x)"
52625
wenzelm
parents: 52624
diff changeset
  7898
    using injective_imp_isometric[OF assms(4,1,2,3)] by auto
wenzelm
parents: 52624
diff changeset
  7899
  show ?thesis
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7900
    using complete_isometric_image[OF \<open>e>0\<close> assms(1,2) e] and assms(4)
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  7901
    unfolding complete_eq_closed[symmetric] by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7902
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7903
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  7904
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7905
subsection \<open>Some properties of a canonical subspace\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7906
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7907
lemma subspace_substandard:
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  7908
  "subspace {x::'a::euclidean_space. (\<forall>i\<in>Basis. P i \<longrightarrow> x\<bullet>i = 0)}"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  7909
  unfolding subspace_def by (auto simp: inner_add_left)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7910
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7911
lemma closed_substandard:
52625
wenzelm
parents: 52624
diff changeset
  7912
  "closed {x::'a::euclidean_space. \<forall>i\<in>Basis. P i --> x\<bullet>i = 0}" (is "closed ?A")
wenzelm
parents: 52624
diff changeset
  7913
proof -
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  7914
  let ?D = "{i\<in>Basis. P i}"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  7915
  have "closed (\<Inter>i\<in>?D. {x::'a. x\<bullet>i = 0})"
44457
d366fa5551ef declare euclidean_simps [simp] at the point they are proved;
huffman
parents: 44365
diff changeset
  7916
    by (simp add: closed_INT closed_Collect_eq)
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  7917
  also have "(\<Inter>i\<in>?D. {x::'a. x\<bullet>i = 0}) = ?A"
44457
d366fa5551ef declare euclidean_simps [simp] at the point they are proved;
huffman
parents: 44365
diff changeset
  7918
    by auto
d366fa5551ef declare euclidean_simps [simp] at the point they are proved;
huffman
parents: 44365
diff changeset
  7919
  finally show "closed ?A" .
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7920
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7921
52625
wenzelm
parents: 52624
diff changeset
  7922
lemma dim_substandard:
wenzelm
parents: 52624
diff changeset
  7923
  assumes d: "d \<subseteq> Basis"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  7924
  shows "dim {x::'a::euclidean_space. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0} = card d" (is "dim ?A = _")
53813
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  7925
proof (rule dim_unique)
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  7926
  show "d \<subseteq> ?A"
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  7927
    using d by (auto simp: inner_Basis)
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  7928
  show "independent d"
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  7929
    using independent_mono [OF independent_Basis d] .
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  7930
  show "?A \<subseteq> span d"
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  7931
  proof (clarify)
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  7932
    fix x assume x: "\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0"
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  7933
    have "finite d"
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  7934
      using finite_subset [OF d finite_Basis] .
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  7935
    then have "(\<Sum>i\<in>d. (x \<bullet> i) *\<^sub>R i) \<in> span d"
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  7936
      by (simp add: span_setsum span_clauses)
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  7937
    also have "(\<Sum>i\<in>d. (x \<bullet> i) *\<^sub>R i) = (\<Sum>i\<in>Basis. (x \<bullet> i) *\<^sub>R i)"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57276
diff changeset
  7938
      by (rule setsum.mono_neutral_cong_left [OF finite_Basis d]) (auto simp add: x)
53813
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  7939
    finally show "x \<in> span d"
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  7940
      unfolding euclidean_representation .
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  7941
  qed
0a62ad289c4d tuned proofs
huffman
parents: 53640
diff changeset
  7942
qed simp
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7943
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7944
text\<open>Hence closure and completeness of all subspaces.\<close>
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7945
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7946
lemma ex_card:
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7947
  assumes "n \<le> card A"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  7948
  shows "\<exists>S\<subseteq>A. card S = n"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  7949
proof cases
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  7950
  assume "finite A"
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  7951
  from ex_bij_betw_nat_finite[OF this] obtain f where f: "bij_betw f {0..<card A} A" ..
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7952
  moreover from f \<open>n \<le> card A\<close> have "{..< n} \<subseteq> {..< card A}" "inj_on f {..< n}"
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  7953
    by (auto simp: bij_betw_def intro: subset_inj_on)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  7954
  ultimately have "f ` {..< n} \<subseteq> A" "card (f ` {..< n}) = n"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  7955
    by (auto simp: bij_betw_def card_image)
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  7956
  then show ?thesis by blast
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  7957
next
52625
wenzelm
parents: 52624
diff changeset
  7958
  assume "\<not> finite A"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  7959
  with \<open>n \<le> card A\<close> show ?thesis by force
52625
wenzelm
parents: 52624
diff changeset
  7960
qed
wenzelm
parents: 52624
diff changeset
  7961
wenzelm
parents: 52624
diff changeset
  7962
lemma closed_subspace:
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  7963
  fixes s :: "'a::euclidean_space set"
52625
wenzelm
parents: 52624
diff changeset
  7964
  assumes "subspace s"
wenzelm
parents: 52624
diff changeset
  7965
  shows "closed s"
wenzelm
parents: 52624
diff changeset
  7966
proof -
wenzelm
parents: 52624
diff changeset
  7967
  have "dim s \<le> card (Basis :: 'a set)"
wenzelm
parents: 52624
diff changeset
  7968
    using dim_subset_UNIV by auto
wenzelm
parents: 52624
diff changeset
  7969
  with ex_card[OF this] obtain d :: "'a set" where t: "card d = dim s" and d: "d \<subseteq> Basis"
wenzelm
parents: 52624
diff changeset
  7970
    by auto
50526
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  7971
  let ?t = "{x::'a. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0}"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  7972
  have "\<exists>f. linear f \<and> f ` {x::'a. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0} = s \<and>
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  7973
      inj_on f {x::'a. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0}"
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  7974
    using dim_substandard[of d] t d assms
899c9c4e4a4c Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents: 50324
diff changeset
  7975
    by (intro subspace_isomorphism[OF subspace_substandard[of "\<lambda>i. i \<notin> d"]]) (auto simp: inner_Basis)
55522
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  7976
  then obtain f where f:
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  7977
      "linear f"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  7978
      "f ` {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0} = s"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  7979
      "inj_on f {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0}"
23d2cbac6dce tuned proofs;
wenzelm
parents: 55415
diff changeset
  7980
    by blast
52625
wenzelm
parents: 52624
diff changeset
  7981
  interpret f: bounded_linear f
wenzelm
parents: 52624
diff changeset
  7982
    using f unfolding linear_conv_bounded_linear by auto
wenzelm
parents: 52624
diff changeset
  7983
  {
wenzelm
parents: 52624
diff changeset
  7984
    fix x
wenzelm
parents: 52624
diff changeset
  7985
    have "x\<in>?t \<Longrightarrow> f x = 0 \<Longrightarrow> x = 0"
wenzelm
parents: 52624
diff changeset
  7986
      using f.zero d f(3)[THEN inj_onD, of x 0] by auto
wenzelm
parents: 52624
diff changeset
  7987
  }
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7988
  moreover have "closed ?t" using closed_substandard .
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7989
  moreover have "subspace ?t" using subspace_substandard .
52625
wenzelm
parents: 52624
diff changeset
  7990
  ultimately show ?thesis
wenzelm
parents: 52624
diff changeset
  7991
    using closed_injective_image_subspace[of ?t f]
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 37452
diff changeset
  7992
    unfolding f(2) using f(1) unfolding linear_conv_bounded_linear by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7993
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7994
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7995
lemma complete_subspace:
52625
wenzelm
parents: 52624
diff changeset
  7996
  fixes s :: "('a::euclidean_space) set"
wenzelm
parents: 52624
diff changeset
  7997
  shows "subspace s \<Longrightarrow> complete s"
wenzelm
parents: 52624
diff changeset
  7998
  using complete_eq_closed closed_subspace by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  7999
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8000
lemma dim_closure:
37489
44e42d392c6e Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents: 37452
diff changeset
  8001
  fixes s :: "('a::euclidean_space) set"
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8002
  shows "dim(closure s) = dim s" (is "?dc = ?d")
52625
wenzelm
parents: 52624
diff changeset
  8003
proof -
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8004
  have "?dc \<le> ?d" using closure_minimal[OF span_inc, of s]
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8005
    using closed_subspace[OF subspace_span, of s]
52625
wenzelm
parents: 52624
diff changeset
  8006
    using dim_subset[of "closure s" "span s"]
wenzelm
parents: 52624
diff changeset
  8007
    unfolding dim_span
wenzelm
parents: 52624
diff changeset
  8008
    by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8009
  then show ?thesis using dim_subset[OF closure_subset, of s]
52625
wenzelm
parents: 52624
diff changeset
  8010
    by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8011
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8012
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  8013
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8014
subsection \<open>Affine transformations of intervals\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8015
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8016
lemma real_affinity_le:
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  8017
 "0 < (m::'a::linordered_field) \<Longrightarrow> (m * x + c \<le> y \<longleftrightarrow> x \<le> inverse(m) * y + -(c / m))"
57865
dcfb33c26f50 tuned proofs -- fewer warnings;
wenzelm
parents: 57514
diff changeset
  8018
  by (simp add: field_simps)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8019
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8020
lemma real_le_affinity:
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  8021
 "0 < (m::'a::linordered_field) \<Longrightarrow> (y \<le> m * x + c \<longleftrightarrow> inverse(m) * y + -(c / m) \<le> x)"
57865
dcfb33c26f50 tuned proofs -- fewer warnings;
wenzelm
parents: 57514
diff changeset
  8022
  by (simp add: field_simps)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8023
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8024
lemma real_affinity_lt:
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  8025
 "0 < (m::'a::linordered_field) \<Longrightarrow> (m * x + c < y \<longleftrightarrow> x < inverse(m) * y + -(c / m))"
57865
dcfb33c26f50 tuned proofs -- fewer warnings;
wenzelm
parents: 57514
diff changeset
  8026
  by (simp add: field_simps)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8027
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8028
lemma real_lt_affinity:
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  8029
 "0 < (m::'a::linordered_field) \<Longrightarrow> (y < m * x + c \<longleftrightarrow> inverse(m) * y + -(c / m) < x)"
57865
dcfb33c26f50 tuned proofs -- fewer warnings;
wenzelm
parents: 57514
diff changeset
  8030
  by (simp add: field_simps)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8031
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8032
lemma real_affinity_eq:
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  8033
 "(m::'a::linordered_field) \<noteq> 0 \<Longrightarrow> (m * x + c = y \<longleftrightarrow> x = inverse(m) * y + -(c / m))"
57865
dcfb33c26f50 tuned proofs -- fewer warnings;
wenzelm
parents: 57514
diff changeset
  8034
  by (simp add: field_simps)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8035
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8036
lemma real_eq_affinity:
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  8037
 "(m::'a::linordered_field) \<noteq> 0 \<Longrightarrow> (y = m * x + c  \<longleftrightarrow> inverse(m) * y + -(c / m) = x)"
57865
dcfb33c26f50 tuned proofs -- fewer warnings;
wenzelm
parents: 57514
diff changeset
  8038
  by (simp add: field_simps)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8039
44210
eba74571833b Topology_Euclidean_Space.thy: organize section headings
huffman
parents: 44207
diff changeset
  8040
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8041
subsection \<open>Banach fixed point theorem (not really topological...)\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8042
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  8043
theorem banach_fix:
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8044
  assumes s: "complete s" "s \<noteq> {}"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8045
    and c: "0 \<le> c" "c < 1"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8046
    and f: "(f ` s) \<subseteq> s"
53291
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  8047
    and lipschitz: "\<forall>x\<in>s. \<forall>y\<in>s. dist (f x) (f y) \<le> c * dist x y"
f7fa953bd15b tuned proofs;
wenzelm
parents: 53282
diff changeset
  8048
  shows "\<exists>!x\<in>s. f x = x"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8049
proof -
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8050
  have "1 - c > 0" using c by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8051
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8052
  from s(2) obtain z0 where "z0 \<in> s" by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8053
  def z \<equiv> "\<lambda>n. (f ^^ n) z0"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8054
  {
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8055
    fix n :: nat
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8056
    have "z n \<in> s" unfolding z_def
52625
wenzelm
parents: 52624
diff changeset
  8057
    proof (induct n)
wenzelm
parents: 52624
diff changeset
  8058
      case 0
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8059
      then show ?case using \<open>z0 \<in> s\<close> by auto
52625
wenzelm
parents: 52624
diff changeset
  8060
    next
wenzelm
parents: 52624
diff changeset
  8061
      case Suc
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8062
      then show ?case using f by auto qed
52625
wenzelm
parents: 52624
diff changeset
  8063
  } note z_in_s = this
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8064
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8065
  def d \<equiv> "dist (z 0) (z 1)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8066
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8067
  have fzn:"\<And>n. f (z n) = z (Suc n)" unfolding z_def by auto
52625
wenzelm
parents: 52624
diff changeset
  8068
  {
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8069
    fix n :: nat
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8070
    have "dist (z n) (z (Suc n)) \<le> (c ^ n) * d"
52625
wenzelm
parents: 52624
diff changeset
  8071
    proof (induct n)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8072
      case 0
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8073
      then show ?case
52625
wenzelm
parents: 52624
diff changeset
  8074
        unfolding d_def by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8075
    next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8076
      case (Suc m)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8077
      then have "c * dist (z m) (z (Suc m)) \<le> c ^ Suc m * d"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8078
        using \<open>0 \<le> c\<close>
52625
wenzelm
parents: 52624
diff changeset
  8079
        using mult_left_mono[of "dist (z m) (z (Suc m))" "c ^ m * d" c]
wenzelm
parents: 52624
diff changeset
  8080
        by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8081
      then show ?case
52625
wenzelm
parents: 52624
diff changeset
  8082
        using lipschitz[THEN bspec[where x="z m"], OF z_in_s, THEN bspec[where x="z (Suc m)"], OF z_in_s]
wenzelm
parents: 52624
diff changeset
  8083
        unfolding fzn and mult_le_cancel_left
wenzelm
parents: 52624
diff changeset
  8084
        by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8085
    qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8086
  } note cf_z = this
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8087
52625
wenzelm
parents: 52624
diff changeset
  8088
  {
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8089
    fix n m :: nat
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8090
    have "(1 - c) * dist (z m) (z (m+n)) \<le> (c ^ m) * d * (1 - c ^ n)"
52625
wenzelm
parents: 52624
diff changeset
  8091
    proof (induct n)
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8092
      case 0
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8093
      show ?case by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8094
    next
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8095
      case (Suc k)
52625
wenzelm
parents: 52624
diff changeset
  8096
      have "(1 - c) * dist (z m) (z (m + Suc k)) \<le>
wenzelm
parents: 52624
diff changeset
  8097
          (1 - c) * (dist (z m) (z (m + k)) + dist (z (m + k)) (z (Suc (m + k))))"
wenzelm
parents: 52624
diff changeset
  8098
        using dist_triangle and c by (auto simp add: dist_triangle)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8099
      also have "\<dots> \<le> (1 - c) * (dist (z m) (z (m + k)) + c ^ (m + k) * d)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8100
        using cf_z[of "m + k"] and c by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8101
      also have "\<dots> \<le> c ^ m * d * (1 - c ^ k) + (1 - c) * c ^ (m + k) * d"
36350
bc7982c54e37 dropped group_simps, ring_simps, field_eq_simps
haftmann
parents: 36336
diff changeset
  8102
        using Suc by (auto simp add: field_simps)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8103
      also have "\<dots> = (c ^ m) * (d * (1 - c ^ k) + (1 - c) * c ^ k * d)"
36350
bc7982c54e37 dropped group_simps, ring_simps, field_eq_simps
haftmann
parents: 36336
diff changeset
  8104
        unfolding power_add by (auto simp add: field_simps)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8105
      also have "\<dots> \<le> (c ^ m) * d * (1 - c ^ Suc k)"
36350
bc7982c54e37 dropped group_simps, ring_simps, field_eq_simps
haftmann
parents: 36336
diff changeset
  8106
        using c by (auto simp add: field_simps)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8107
      finally show ?case by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8108
    qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8109
  } note cf_z2 = this
52625
wenzelm
parents: 52624
diff changeset
  8110
  {
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8111
    fix e :: real
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8112
    assume "e > 0"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8113
    then have "\<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (z m) (z n) < e"
52625
wenzelm
parents: 52624
diff changeset
  8114
    proof (cases "d = 0")
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8115
      case True
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8116
      have *: "\<And>x. ((1 - c) * x \<le> 0) = (x \<le> 0)" using \<open>1 - c > 0\<close>
57512
cc97b347b301 reduced name variants for assoc and commute on plus and mult
haftmann
parents: 57448
diff changeset
  8117
        by (metis mult_zero_left mult.commute real_mult_le_cancel_iff1)
41863
e5104b436ea1 removed dependency on Dense_Linear_Order
boehmes
parents: 41413
diff changeset
  8118
      from True have "\<And>n. z n = z0" using cf_z2[of 0] and c unfolding z_def
e5104b436ea1 removed dependency on Dense_Linear_Order
boehmes
parents: 41413
diff changeset
  8119
        by (simp add: *)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8120
      then show ?thesis using \<open>e>0\<close> by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8121
    next
52625
wenzelm
parents: 52624
diff changeset
  8122
      case False
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8123
      then have "d>0" unfolding d_def using zero_le_dist[of "z 0" "z 1"]
36778
739a9379e29b avoid using real-specific versions of generic lemmas
huffman
parents: 36669
diff changeset
  8124
        by (metis False d_def less_le)
56541
0e3abadbef39 made divide_pos_pos a simp rule
nipkow
parents: 56371
diff changeset
  8125
      hence "0 < e * (1 - c) / d"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8126
        using \<open>e>0\<close> and \<open>1-c>0\<close> by auto
52625
wenzelm
parents: 52624
diff changeset
  8127
      then obtain N where N:"c ^ N < e * (1 - c) / d"
wenzelm
parents: 52624
diff changeset
  8128
        using real_arch_pow_inv[of "e * (1 - c) / d" c] and c by auto
wenzelm
parents: 52624
diff changeset
  8129
      {
wenzelm
parents: 52624
diff changeset
  8130
        fix m n::nat
wenzelm
parents: 52624
diff changeset
  8131
        assume "m>n" and as:"m\<ge>N" "n\<ge>N"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8132
        have *:"c ^ n \<le> c ^ N" using \<open>n\<ge>N\<close> and c
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8133
          using power_decreasing[OF \<open>n\<ge>N\<close>, of c] by auto
52625
wenzelm
parents: 52624
diff changeset
  8134
        have "1 - c ^ (m - n) > 0"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8135
          using c and power_strict_mono[of c 1 "m - n"] using \<open>m>n\<close> by auto
56541
0e3abadbef39 made divide_pos_pos a simp rule
nipkow
parents: 56371
diff changeset
  8136
        hence **: "d * (1 - c ^ (m - n)) / (1 - c) > 0"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8137
          using \<open>d>0\<close> \<open>0 < 1 - c\<close> by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8138
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8139
        have "dist (z m) (z n) \<le> c ^ n * d * (1 - c ^ (m - n)) / (1 - c)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8140
          using cf_z2[of n "m - n"] and \<open>m>n\<close>
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8141
          unfolding pos_le_divide_eq[OF \<open>1-c>0\<close>]
57512
cc97b347b301 reduced name variants for assoc and commute on plus and mult
haftmann
parents: 57448
diff changeset
  8142
          by (auto simp add: mult.commute dist_commute)
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8143
        also have "\<dots> \<le> c ^ N * d * (1 - c ^ (m - n)) / (1 - c)"
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8144
          using mult_right_mono[OF * order_less_imp_le[OF **]]
57512
cc97b347b301 reduced name variants for assoc and commute on plus and mult
haftmann
parents: 57448
diff changeset
  8145
          unfolding mult.assoc by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8146
        also have "\<dots> < (e * (1 - c) / d) * d * (1 - c ^ (m - n)) / (1 - c)"
57512
cc97b347b301 reduced name variants for assoc and commute on plus and mult
haftmann
parents: 57448
diff changeset
  8147
          using mult_strict_right_mono[OF N **] unfolding mult.assoc by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8148
        also have "\<dots> = e * (1 - c ^ (m - n))"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8149
          using c and \<open>d>0\<close> and \<open>1 - c > 0\<close> by auto
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8150
        also have "\<dots> \<le> e" using c and \<open>1 - c ^ (m - n) > 0\<close> and \<open>e>0\<close>
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8151
          using mult_right_le_one_le[of e "1 - c ^ (m - n)"] by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8152
        finally have  "dist (z m) (z n) < e" by auto
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8153
      } note * = this
52625
wenzelm
parents: 52624
diff changeset
  8154
      {
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8155
        fix m n :: nat
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8156
        assume as: "N \<le> m" "N \<le> n"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8157
        then have "dist (z n) (z m) < e"
52625
wenzelm
parents: 52624
diff changeset
  8158
        proof (cases "n = m")
wenzelm
parents: 52624
diff changeset
  8159
          case True
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8160
          then show ?thesis using \<open>e>0\<close> by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8161
        next
52625
wenzelm
parents: 52624
diff changeset
  8162
          case False
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8163
          then show ?thesis using as and *[of n m] *[of m n]
52625
wenzelm
parents: 52624
diff changeset
  8164
            unfolding nat_neq_iff by (auto simp add: dist_commute)
wenzelm
parents: 52624
diff changeset
  8165
        qed
wenzelm
parents: 52624
diff changeset
  8166
      }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8167
      then show ?thesis by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8168
    qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8169
  }
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8170
  then have "Cauchy z"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8171
    unfolding cauchy_def by auto
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  8172
  then obtain x where "x\<in>s" and x:"(z \<longlongrightarrow> x) sequentially"
52625
wenzelm
parents: 52624
diff changeset
  8173
    using s(1)[unfolded compact_def complete_def, THEN spec[where x=z]] and z_in_s by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8174
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8175
  def e \<equiv> "dist (f x) x"
52625
wenzelm
parents: 52624
diff changeset
  8176
  have "e = 0"
wenzelm
parents: 52624
diff changeset
  8177
  proof (rule ccontr)
wenzelm
parents: 52624
diff changeset
  8178
    assume "e \<noteq> 0"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8179
    then have "e > 0"
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8180
      unfolding e_def using zero_le_dist[of "f x" x]
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8181
      by (metis dist_eq_0_iff dist_nz e_def)
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8182
    then obtain N where N:"\<forall>n\<ge>N. dist (z n) x < e / 2"
60017
b785d6d06430 Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents: 59815
diff changeset
  8183
      using x[unfolded lim_sequentially, THEN spec[where x="e/2"]] by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8184
    then have N':"dist (z N) x < e / 2" by auto
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8185
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8186
    have *: "c * dist (z N) x \<le> dist (z N) x"
52625
wenzelm
parents: 52624
diff changeset
  8187
      unfolding mult_le_cancel_right2
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8188
      using zero_le_dist[of "z N" x] and c
36778
739a9379e29b avoid using real-specific versions of generic lemmas
huffman
parents: 36669
diff changeset
  8189
      by (metis dist_eq_0_iff dist_nz order_less_asym less_le)
52625
wenzelm
parents: 52624
diff changeset
  8190
    have "dist (f (z N)) (f x) \<le> c * dist (z N) x"
wenzelm
parents: 52624
diff changeset
  8191
      using lipschitz[THEN bspec[where x="z N"], THEN bspec[where x=x]]
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8192
      using z_in_s[of N] \<open>x\<in>s\<close>
52625
wenzelm
parents: 52624
diff changeset
  8193
      using c
wenzelm
parents: 52624
diff changeset
  8194
      by auto
wenzelm
parents: 52624
diff changeset
  8195
    also have "\<dots> < e / 2"
wenzelm
parents: 52624
diff changeset
  8196
      using N' and c using * by auto
wenzelm
parents: 52624
diff changeset
  8197
    finally show False
wenzelm
parents: 52624
diff changeset
  8198
      unfolding fzn
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8199
      using N[THEN spec[where x="Suc N"]] and dist_triangle_half_r[of "z (Suc N)" "f x" e x]
52625
wenzelm
parents: 52624
diff changeset
  8200
      unfolding e_def
wenzelm
parents: 52624
diff changeset
  8201
      by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8202
  qed
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8203
  then have "f x = x" unfolding e_def by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8204
  moreover
52625
wenzelm
parents: 52624
diff changeset
  8205
  {
wenzelm
parents: 52624
diff changeset
  8206
    fix y
wenzelm
parents: 52624
diff changeset
  8207
    assume "f y = y" "y\<in>s"
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8208
    then have "dist x y \<le> c * dist x y"
52625
wenzelm
parents: 52624
diff changeset
  8209
      using lipschitz[THEN bspec[where x=x], THEN bspec[where x=y]]
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8210
      using \<open>x\<in>s\<close> and \<open>f x = x\<close>
52625
wenzelm
parents: 52624
diff changeset
  8211
      by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8212
    then have "dist x y = 0"
52625
wenzelm
parents: 52624
diff changeset
  8213
      unfolding mult_le_cancel_right1
wenzelm
parents: 52624
diff changeset
  8214
      using c and zero_le_dist[of x y]
wenzelm
parents: 52624
diff changeset
  8215
      by auto
53282
9d6e263fa921 tuned proofs;
wenzelm
parents: 53255
diff changeset
  8216
    then have "y = x" by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8217
  }
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8218
  ultimately show ?thesis using \<open>x\<in>s\<close> by blast+
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8219
qed
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8220
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8221
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8222
subsection \<open>Edelstein fixed point theorem\<close>
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8223
60974
6a6f15d8fbc4 New material and fixes related to the forthcoming Stone-Weierstrass development
paulson <lp15@cam.ac.uk>
parents: 60762
diff changeset
  8224
theorem edelstein_fix:
50970
3e5b67f85bf9 generalized theorem edelstein_fix to class metric_space
huffman
parents: 50955
diff changeset
  8225
  fixes s :: "'a::metric_space set"
52625
wenzelm
parents: 52624
diff changeset
  8226
  assumes s: "compact s" "s \<noteq> {}"
wenzelm
parents: 52624
diff changeset
  8227
    and gs: "(g ` s) \<subseteq> s"
wenzelm
parents: 52624
diff changeset
  8228
    and dist: "\<forall>x\<in>s. \<forall>y\<in>s. x \<noteq> y \<longrightarrow> dist (g x) (g y) < dist x y"
51347
f8a00792fbc1 tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
hoelzl
parents: 51346
diff changeset
  8229
  shows "\<exists>!x\<in>s. g x = x"
f8a00792fbc1 tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
hoelzl
parents: 51346
diff changeset
  8230
proof -
f8a00792fbc1 tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
hoelzl
parents: 51346
diff changeset
  8231
  let ?D = "(\<lambda>x. (x, x)) ` s"
f8a00792fbc1 tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
hoelzl
parents: 51346
diff changeset
  8232
  have D: "compact ?D" "?D \<noteq> {}"
f8a00792fbc1 tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
hoelzl
parents: 51346
diff changeset
  8233
    by (rule compact_continuous_image)
f8a00792fbc1 tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
hoelzl
parents: 51346
diff changeset
  8234
       (auto intro!: s continuous_Pair continuous_within_id simp: continuous_on_eq_continuous_within)
f8a00792fbc1 tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
hoelzl
parents: 51346
diff changeset
  8235
f8a00792fbc1 tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
hoelzl
parents: 51346
diff changeset
  8236
  have "\<And>x y e. x \<in> s \<Longrightarrow> y \<in> s \<Longrightarrow> 0 < e \<Longrightarrow> dist y x < e \<Longrightarrow> dist (g y) (g x) < e"
f8a00792fbc1 tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
hoelzl
parents: 51346
diff changeset
  8237
    using dist by fastforce
f8a00792fbc1 tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
hoelzl
parents: 51346
diff changeset
  8238
  then have "continuous_on s g"
f8a00792fbc1 tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
hoelzl
parents: 51346
diff changeset
  8239
    unfolding continuous_on_iff by auto
f8a00792fbc1 tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
hoelzl
parents: 51346
diff changeset
  8240
  then have cont: "continuous_on ?D (\<lambda>x. dist ((g \<circ> fst) x) (snd x))"
f8a00792fbc1 tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
hoelzl
parents: 51346
diff changeset
  8241
    unfolding continuous_on_eq_continuous_within
f8a00792fbc1 tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
hoelzl
parents: 51346
diff changeset
  8242
    by (intro continuous_dist ballI continuous_within_compose)
60040
1fa1023b13b9 move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents: 60017
diff changeset
  8243
       (auto intro!: continuous_fst continuous_snd continuous_within_id simp: image_image)
51347
f8a00792fbc1 tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
hoelzl
parents: 51346
diff changeset
  8244
f8a00792fbc1 tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
hoelzl
parents: 51346
diff changeset
  8245
  obtain a where "a \<in> s" and le: "\<And>x. x \<in> s \<Longrightarrow> dist (g a) a \<le> dist (g x) x"
f8a00792fbc1 tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
hoelzl
parents: 51346
diff changeset
  8246
    using continuous_attains_inf[OF D cont] by auto
f8a00792fbc1 tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
hoelzl
parents: 51346
diff changeset
  8247
f8a00792fbc1 tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
hoelzl
parents: 51346
diff changeset
  8248
  have "g a = a"
f8a00792fbc1 tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
hoelzl
parents: 51346
diff changeset
  8249
  proof (rule ccontr)
f8a00792fbc1 tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
hoelzl
parents: 51346
diff changeset
  8250
    assume "g a \<noteq> a"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8251
    with \<open>a \<in> s\<close> gs have "dist (g (g a)) (g a) < dist (g a) a"
51347
f8a00792fbc1 tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
hoelzl
parents: 51346
diff changeset
  8252
      by (intro dist[rule_format]) auto
f8a00792fbc1 tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
hoelzl
parents: 51346
diff changeset
  8253
    moreover have "dist (g a) a \<le> dist (g (g a)) (g a)"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8254
      using \<open>a \<in> s\<close> gs by (intro le) auto
51347
f8a00792fbc1 tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
hoelzl
parents: 51346
diff changeset
  8255
    ultimately show False by auto
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8256
  qed
51347
f8a00792fbc1 tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
hoelzl
parents: 51346
diff changeset
  8257
  moreover have "\<And>x. x \<in> s \<Longrightarrow> g x = x \<Longrightarrow> x = a"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8258
    using dist[THEN bspec[where x=a]] \<open>g a = a\<close> and \<open>a\<in>s\<close> by auto
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 60176
diff changeset
  8259
  ultimately show "\<exists>!x\<in>s. g x = x" using \<open>a \<in> s\<close> by blast
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8260
qed
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8261
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8262
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8263
lemma cball_subset_cball_iff:
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8264
  fixes a :: "'a :: euclidean_space"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8265
  shows "cball a r \<subseteq> cball a' r' \<longleftrightarrow> dist a a' + r \<le> r' \<or> r < 0"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8266
        (is "?lhs = ?rhs")
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8267
proof
61762
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
  8268
  assume ?lhs
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
  8269
  then show ?rhs
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8270
  proof (cases "r < 0")
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8271
    case True then show ?rhs by simp
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8272
  next
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8273
    case False
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8274
    then have [simp]: "r \<ge> 0" by simp
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8275
    have "norm (a - a') + r \<le> r'"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8276
    proof (cases "a = a'")
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8277
      case True then show ?thesis
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8278
        using subsetD [where c = "a + r *\<^sub>R (SOME i. i \<in> Basis)", OF \<open>?lhs\<close>]  subsetD [where c = "a", OF \<open>?lhs\<close>]
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8279
        by (force simp add: SOME_Basis dist_norm)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8280
    next
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8281
      case False
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8282
      have "norm (a' - (a + (r / norm (a - a')) *\<^sub>R (a - a'))) = norm (a' - a - (r / norm (a - a')) *\<^sub>R (a - a'))"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8283
        by (simp add: algebra_simps)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8284
      also have "... = norm ((-1 - (r / norm (a - a'))) *\<^sub>R (a - a'))"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8285
        by (simp add: algebra_simps)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8286
      also have "... = \<bar>- norm (a - a') - r\<bar>"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8287
        using  \<open>a \<noteq> a'\<close> by (simp add: abs_mult_pos field_simps)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8288
      finally have [simp]: "norm (a' - (a + (r / norm (a - a')) *\<^sub>R (a - a'))) = \<bar>norm (a - a') + r\<bar>" by linarith
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8289
      show ?thesis
61762
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
  8290
        using subsetD [where c = "a' + (1 + r / norm(a - a')) *\<^sub>R (a - a')", OF \<open>?lhs\<close>] \<open>a \<noteq> a'\<close>
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8291
        by (simp add: dist_norm scaleR_add_left)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8292
    qed
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8293
    then show ?rhs by (simp add: dist_norm)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8294
  qed
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8295
next
61762
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
  8296
  assume ?rhs then show ?lhs
61806
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  8297
    apply (auto simp: ball_def dist_norm)
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8298
    apply (metis add.commute add_le_cancel_right dist_norm dist_triangle_alt order_trans)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8299
    done
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8300
qed
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8301
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8302
lemma cball_subset_ball_iff:
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8303
  fixes a :: "'a :: euclidean_space"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8304
  shows "cball a r \<subseteq> ball a' r' \<longleftrightarrow> dist a a' + r < r' \<or> r < 0"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8305
        (is "?lhs = ?rhs")
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8306
proof
61762
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
  8307
  assume ?lhs
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
  8308
  then show ?rhs
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8309
  proof (cases "r < 0")
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8310
    case True then show ?rhs by simp
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8311
  next
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8312
    case False
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8313
    then have [simp]: "r \<ge> 0" by simp
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8314
    have "norm (a - a') + r < r'"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8315
    proof (cases "a = a'")
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8316
      case True then show ?thesis
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8317
        using subsetD [where c = "a + r *\<^sub>R (SOME i. i \<in> Basis)", OF \<open>?lhs\<close>]  subsetD [where c = "a", OF \<open>?lhs\<close>]
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8318
        by (force simp add: SOME_Basis dist_norm)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8319
    next
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8320
      case False
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8321
      { assume "norm (a - a') + r \<ge> r'"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8322
        then have "\<bar>r' - norm (a - a')\<bar> \<le> r"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8323
          apply (simp split: abs_split)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8324
          by (metis \<open>0 \<le> r\<close> \<open>?lhs\<close> centre_in_cball dist_commute dist_norm less_asym mem_ball subset_eq)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8325
        then have False
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8326
        using subsetD [where c = "a + (r' / norm(a - a') - 1) *\<^sub>R (a - a')", OF \<open>?lhs\<close>] \<open>a \<noteq> a'\<close>
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8327
        apply (simp add: dist_norm field_simps)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8328
        apply (simp add: diff_divide_distrib scaleR_left_diff_distrib)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8329
        done
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8330
      }
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8331
      then show ?thesis by force
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8332
    qed
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8333
    then show ?rhs by (simp add: dist_norm)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8334
  qed
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8335
next
61762
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
  8336
  assume ?rhs then show ?lhs
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8337
    apply (auto simp: ball_def dist_norm )
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8338
    apply (metis add.commute add_le_cancel_right dist_norm dist_triangle_alt le_less_trans)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8339
    done
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8340
qed
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8341
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8342
lemma ball_subset_cball_iff:
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8343
  fixes a :: "'a :: euclidean_space"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8344
  shows "ball a r \<subseteq> cball a' r' \<longleftrightarrow> dist a a' + r \<le> r' \<or> r \<le> 0"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8345
        (is "?lhs = ?rhs")
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8346
proof (cases "r \<le> 0")
61762
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
  8347
  case True then show ?thesis
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8348
    using dist_not_less_zero less_le_trans by force
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8349
next
61762
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
  8350
  case False show ?thesis
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8351
  proof
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8352
    assume ?lhs
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8353
    then have "(cball a r \<subseteq> cball a' r')"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8354
      by (metis False closed_cball closure_ball closure_closed closure_mono not_less)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8355
    then show ?rhs
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8356
      using False cball_subset_cball_iff by fastforce
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8357
  next
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8358
    assume ?rhs with False show ?lhs
61762
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
  8359
      using ball_subset_cball cball_subset_cball_iff by blast
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8360
  qed
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8361
qed
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8362
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8363
lemma ball_subset_ball_iff:
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8364
  fixes a :: "'a :: euclidean_space"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8365
  shows "ball a r \<subseteq> ball a' r' \<longleftrightarrow> dist a a' + r \<le> r' \<or> r \<le> 0"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8366
        (is "?lhs = ?rhs")
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8367
proof (cases "r \<le> 0")
61762
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
  8368
  case True then show ?thesis
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8369
    using dist_not_less_zero less_le_trans by force
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8370
next
61762
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
  8371
  case False show ?thesis
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8372
  proof
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8373
    assume ?lhs
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8374
    then have "0 < r'"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8375
      by (metis (no_types) False \<open>?lhs\<close> centre_in_ball dist_norm le_less_trans mem_ball norm_ge_zero not_less set_mp)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8376
    then have "(cball a r \<subseteq> cball a' r')"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8377
      by (metis False\<open>?lhs\<close> closure_ball closure_mono not_less)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8378
    then show ?rhs
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8379
      using False cball_subset_cball_iff by fastforce
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8380
  next
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8381
  assume ?rhs then show ?lhs
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8382
    apply (auto simp: ball_def)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8383
    apply (metis add.commute add_le_cancel_right dist_commute dist_triangle_lt not_le order_trans)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8384
    using dist_not_less_zero order.strict_trans2 apply blast
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8385
    done
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8386
  qed
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8387
qed
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8388
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8389
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8390
lemma ball_eq_ball_iff:
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8391
  fixes x :: "'a :: euclidean_space"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8392
  shows "ball x d = ball y e \<longleftrightarrow> d \<le> 0 \<and> e \<le> 0 \<or> x=y \<and> d=e"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8393
        (is "?lhs = ?rhs")
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8394
proof
61762
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
  8395
  assume ?lhs
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
  8396
  then show ?rhs
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8397
  proof (cases "d \<le> 0 \<or> e \<le> 0")
61762
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
  8398
    case True
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8399
      with \<open>?lhs\<close> show ?rhs
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8400
        by safe (simp_all only: ball_eq_empty [of y e, symmetric] ball_eq_empty [of x d, symmetric])
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8401
  next
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8402
    case False
61762
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
  8403
    with \<open>?lhs\<close> show ?rhs
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8404
      apply (auto simp add: set_eq_subset ball_subset_ball_iff dist_norm norm_minus_commute algebra_simps)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8405
      apply (metis add_le_same_cancel1 le_add_same_cancel1 norm_ge_zero norm_pths(2) order_trans)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8406
      apply (metis add_increasing2 add_le_imp_le_right eq_iff norm_ge_zero)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8407
      done
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8408
  qed
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8409
next
61762
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
  8410
  assume ?rhs then show ?lhs
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8411
    by (auto simp add: set_eq_subset ball_subset_ball_iff)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8412
qed
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8413
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8414
lemma cball_eq_cball_iff:
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8415
  fixes x :: "'a :: euclidean_space"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8416
  shows "cball x d = cball y e \<longleftrightarrow> d < 0 \<and> e < 0 \<or> x=y \<and> d=e"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8417
        (is "?lhs = ?rhs")
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8418
proof
61762
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
  8419
  assume ?lhs
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
  8420
  then show ?rhs
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8421
  proof (cases "d < 0 \<or> e < 0")
61762
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
  8422
    case True
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8423
      with \<open>?lhs\<close> show ?rhs
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8424
        by safe (simp_all only: cball_eq_empty [of y e, symmetric] cball_eq_empty [of x d, symmetric])
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8425
  next
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8426
    case False
61762
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
  8427
    with \<open>?lhs\<close> show ?rhs
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8428
      apply (auto simp add: set_eq_subset cball_subset_cball_iff dist_norm norm_minus_commute algebra_simps)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8429
      apply (metis add_le_same_cancel1 le_add_same_cancel1 norm_ge_zero norm_pths(2) order_trans)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8430
      apply (metis add_increasing2 add_le_imp_le_right eq_iff norm_ge_zero)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8431
      done
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8432
  qed
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8433
next
61762
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
  8434
  assume ?rhs then show ?lhs
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8435
    by (auto simp add: set_eq_subset cball_subset_cball_iff)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8436
qed
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8437
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8438
lemma ball_eq_cball_iff:
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8439
  fixes x :: "'a :: euclidean_space"
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8440
  shows "ball x d = cball y e \<longleftrightarrow> d \<le> 0 \<and> e < 0" (is "?lhs = ?rhs")
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8441
proof
61762
d50b993b4fb9 Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents: 61738
diff changeset
  8442
  assume ?lhs
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8443
  then show ?rhs
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8444
    apply (auto simp add: set_eq_subset ball_subset_cball_iff cball_subset_ball_iff algebra_simps)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8445
    apply (metis add_increasing2 add_le_cancel_right add_less_same_cancel1 dist_not_less_zero less_le_trans zero_le_dist)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8446
    apply (metis add_less_same_cancel1 dist_not_less_zero less_le_trans not_le)
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8447
    using \<open>?lhs\<close> ball_eq_empty cball_eq_empty apply blast+
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8448
    done
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8449
next
61806
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61762
diff changeset
  8450
  assume ?rhs then show ?lhs by auto
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8451
qed
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8452
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8453
lemma cball_eq_ball_iff:
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8454
  fixes x :: "'a :: euclidean_space"
61915
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61907
diff changeset
  8455
  shows "cball x d = ball y e \<longleftrightarrow> d < 0 \<and> e \<le> 0"
e9812a95d108 theory for type of bounded linear functions; differentiation under the integral sign
immler
parents: 61907
diff changeset
  8456
  using ball_eq_cball_iff by blast
61694
6571c78c9667 Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
  8457
54775
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54489
diff changeset
  8458
no_notation
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54489
diff changeset
  8459
  eucl_less (infix "<e" 50)
2d3df8633dad prefer box over greaterThanLessThan on euclidean_space
immler
parents: 54489
diff changeset
  8460
33175
2083bde13ce1 distinguished session for multivariate analysis
himmelma
parents:
diff changeset
  8461
end