src/HOL/Analysis/Starlike.thy
author immler
Wed, 02 May 2018 13:49:38 +0200
changeset 68072 493b818e8e10
parent 67990 c0ebecf6e3eb
child 68073 fad29d2a17a5
permissions -rw-r--r--
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     1
(* Title:      HOL/Analysis/Starlike.thy
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     2
   Author:     L C Paulson, University of Cambridge
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     3
   Author:     Robert Himmelmann, TU Muenchen
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     4
   Author:     Bogdan Grechuk, University of Edinburgh
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     5
   Author:     Armin Heller, TU Muenchen
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     6
   Author:     Johannes Hoelzl, TU Muenchen
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     7
*)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     8
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67962
diff changeset
     9
section \<open>Line segments, Starlike Sets, etc\<close>
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    10
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    11
theory Starlike
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    12
  imports Convex_Euclidean_Space
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    13
begin
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    14
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    15
subsection \<open>Midpoint\<close>
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    16
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
    17
definition%important midpoint :: "'a::real_vector \<Rightarrow> 'a \<Rightarrow> 'a"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    18
  where "midpoint a b = (inverse (2::real)) *\<^sub>R (a + b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    19
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    20
lemma midpoint_idem [simp]: "midpoint x x = x"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    21
  unfolding midpoint_def
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    22
  unfolding scaleR_right_distrib
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    23
  unfolding scaleR_left_distrib[symmetric]
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    24
  by auto
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    25
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    26
lemma midpoint_sym: "midpoint a b = midpoint b a"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    27
  unfolding midpoint_def by (auto simp add: scaleR_right_distrib)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    28
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    29
lemma midpoint_eq_iff: "midpoint a b = c \<longleftrightarrow> a + b = c + c"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    30
proof -
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    31
  have "midpoint a b = c \<longleftrightarrow> scaleR 2 (midpoint a b) = scaleR 2 c"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    32
    by simp
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    33
  then show ?thesis
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    34
    unfolding midpoint_def scaleR_2 [symmetric] by simp
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    35
qed
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    36
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    37
lemma
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    38
  fixes a::real
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    39
  assumes "a \<le> b" shows ge_midpoint_1: "a \<le> midpoint a b"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    40
                    and le_midpoint_1: "midpoint a b \<le> b"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    41
  by (simp_all add: midpoint_def assms)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    42
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    43
lemma dist_midpoint:
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    44
  fixes a b :: "'a::real_normed_vector" shows
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    45
  "dist a (midpoint a b) = (dist a b) / 2" (is ?t1)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    46
  "dist b (midpoint a b) = (dist a b) / 2" (is ?t2)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    47
  "dist (midpoint a b) a = (dist a b) / 2" (is ?t3)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    48
  "dist (midpoint a b) b = (dist a b) / 2" (is ?t4)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    49
proof -
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    50
  have *: "\<And>x y::'a. 2 *\<^sub>R x = - y \<Longrightarrow> norm x = (norm y) / 2"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    51
    unfolding equation_minus_iff by auto
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    52
  have **: "\<And>x y::'a. 2 *\<^sub>R x =   y \<Longrightarrow> norm x = (norm y) / 2"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    53
    by auto
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    54
  note scaleR_right_distrib [simp]
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    55
  show ?t1
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    56
    unfolding midpoint_def dist_norm
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    57
    apply (rule **)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    58
    apply (simp add: scaleR_right_diff_distrib)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    59
    apply (simp add: scaleR_2)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    60
    done
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    61
  show ?t2
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    62
    unfolding midpoint_def dist_norm
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    63
    apply (rule *)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    64
    apply (simp add: scaleR_right_diff_distrib)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    65
    apply (simp add: scaleR_2)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    66
    done
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    67
  show ?t3
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    68
    unfolding midpoint_def dist_norm
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    69
    apply (rule *)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    70
    apply (simp add: scaleR_right_diff_distrib)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    71
    apply (simp add: scaleR_2)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    72
    done
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    73
  show ?t4
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    74
    unfolding midpoint_def dist_norm
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    75
    apply (rule **)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    76
    apply (simp add: scaleR_right_diff_distrib)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    77
    apply (simp add: scaleR_2)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    78
    done
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    79
qed
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    80
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    81
lemma midpoint_eq_endpoint [simp]:
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    82
  "midpoint a b = a \<longleftrightarrow> a = b"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    83
  "midpoint a b = b \<longleftrightarrow> a = b"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    84
  unfolding midpoint_eq_iff by auto
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    85
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    86
lemma midpoint_plus_self [simp]: "midpoint a b + midpoint a b = a + b"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    87
  using midpoint_eq_iff by metis
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    88
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    89
lemma midpoint_linear_image:
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    90
   "linear f \<Longrightarrow> midpoint(f a)(f b) = f(midpoint a b)"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    91
by (simp add: linear_iff midpoint_def)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    92
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    93
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    94
subsection \<open>Line segments\<close>
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
    95
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
    96
definition%important closed_segment :: "'a::real_vector \<Rightarrow> 'a \<Rightarrow> 'a set"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    97
  where "closed_segment a b = {(1 - u) *\<^sub>R a + u *\<^sub>R b | u::real. 0 \<le> u \<and> u \<le> 1}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    98
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
    99
definition%important open_segment :: "'a::real_vector \<Rightarrow> 'a \<Rightarrow> 'a set" where
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   100
  "open_segment a b \<equiv> closed_segment a b - {a,b}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   101
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   102
lemmas segment = open_segment_def closed_segment_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   103
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   104
lemma in_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   105
    "x \<in> closed_segment a b \<longleftrightarrow> (\<exists>u. 0 \<le> u \<and> u \<le> 1 \<and> x = (1 - u) *\<^sub>R a + u *\<^sub>R b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   106
    "x \<in> open_segment a b \<longleftrightarrow> a \<noteq> b \<and> (\<exists>u. 0 < u \<and> u < 1 \<and> x = (1 - u) *\<^sub>R a + u *\<^sub>R b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   107
  using less_eq_real_def by (auto simp: segment algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   108
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   109
lemma closed_segment_linear_image:
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
   110
  "closed_segment (f a) (f b) = f ` (closed_segment a b)" if "linear f"
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
   111
proof -
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
   112
  interpret linear f by fact
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
   113
  show ?thesis
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
   114
    by (force simp add: in_segment add scale)
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
   115
qed
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   116
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   117
lemma open_segment_linear_image:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   118
    "\<lbrakk>linear f; inj f\<rbrakk> \<Longrightarrow> open_segment (f a) (f b) = f ` (open_segment a b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   119
  by (force simp: open_segment_def closed_segment_linear_image inj_on_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   120
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   121
lemma closed_segment_translation:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   122
    "closed_segment (c + a) (c + b) = image (\<lambda>x. c + x) (closed_segment a b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   123
apply safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   124
apply (rule_tac x="x-c" in image_eqI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   125
apply (auto simp: in_segment algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   126
done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   127
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   128
lemma open_segment_translation:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   129
    "open_segment (c + a) (c + b) = image (\<lambda>x. c + x) (open_segment a b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   130
by (simp add: open_segment_def closed_segment_translation translation_diff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   131
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   132
lemma closed_segment_of_real:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   133
    "closed_segment (of_real x) (of_real y) = of_real ` closed_segment x y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   134
  apply (auto simp: image_iff in_segment scaleR_conv_of_real)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   135
    apply (rule_tac x="(1-u)*x + u*y" in bexI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   136
  apply (auto simp: in_segment)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   137
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   138
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   139
lemma open_segment_of_real:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   140
    "open_segment (of_real x) (of_real y) = of_real ` open_segment x y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   141
  apply (auto simp: image_iff in_segment scaleR_conv_of_real)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   142
    apply (rule_tac x="(1-u)*x + u*y" in bexI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   143
  apply (auto simp: in_segment)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   144
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   145
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   146
lemma closed_segment_Reals:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   147
    "\<lbrakk>x \<in> Reals; y \<in> Reals\<rbrakk> \<Longrightarrow> closed_segment x y = of_real ` closed_segment (Re x) (Re y)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   148
  by (metis closed_segment_of_real of_real_Re)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   149
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   150
lemma open_segment_Reals:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   151
    "\<lbrakk>x \<in> Reals; y \<in> Reals\<rbrakk> \<Longrightarrow> open_segment x y = of_real ` open_segment (Re x) (Re y)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   152
  by (metis open_segment_of_real of_real_Re)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   153
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   154
lemma open_segment_PairD:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   155
    "(x, x') \<in> open_segment (a, a') (b, b')
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   156
     \<Longrightarrow> (x \<in> open_segment a b \<or> a = b) \<and> (x' \<in> open_segment a' b' \<or> a' = b')"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   157
  by (auto simp: in_segment)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   158
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   159
lemma closed_segment_PairD:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   160
  "(x, x') \<in> closed_segment (a, a') (b, b') \<Longrightarrow> x \<in> closed_segment a b \<and> x' \<in> closed_segment a' b'"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   161
  by (auto simp: closed_segment_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   162
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   163
lemma closed_segment_translation_eq [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   164
    "d + x \<in> closed_segment (d + a) (d + b) \<longleftrightarrow> x \<in> closed_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   165
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   166
  have *: "\<And>d x a b. x \<in> closed_segment a b \<Longrightarrow> d + x \<in> closed_segment (d + a) (d + b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   167
    apply (simp add: closed_segment_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   168
    apply (erule ex_forward)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   169
    apply (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   170
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   171
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   172
  using * [where d = "-d"] *
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   173
  by (fastforce simp add:)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   174
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   175
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   176
lemma open_segment_translation_eq [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   177
    "d + x \<in> open_segment (d + a) (d + b) \<longleftrightarrow> x \<in> open_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   178
  by (simp add: open_segment_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   179
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   180
lemma of_real_closed_segment [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   181
  "of_real x \<in> closed_segment (of_real a) (of_real b) \<longleftrightarrow> x \<in> closed_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   182
  apply (auto simp: in_segment scaleR_conv_of_real elim!: ex_forward)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   183
  using of_real_eq_iff by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   184
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   185
lemma of_real_open_segment [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   186
  "of_real x \<in> open_segment (of_real a) (of_real b) \<longleftrightarrow> x \<in> open_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   187
  apply (auto simp: in_segment scaleR_conv_of_real elim!: ex_forward del: exE)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   188
  using of_real_eq_iff by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   189
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   190
lemma convex_contains_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   191
  "convex S \<longleftrightarrow> (\<forall>a\<in>S. \<forall>b\<in>S. closed_segment a b \<subseteq> S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   192
  unfolding convex_alt closed_segment_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   193
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   194
lemma closed_segment_subset: "\<lbrakk>x \<in> S; y \<in> S; convex S\<rbrakk> \<Longrightarrow> closed_segment x y \<subseteq> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   195
  by (simp add: convex_contains_segment)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   196
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   197
lemma closed_segment_subset_convex_hull:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   198
    "\<lbrakk>x \<in> convex hull S; y \<in> convex hull S\<rbrakk> \<Longrightarrow> closed_segment x y \<subseteq> convex hull S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   199
  using convex_contains_segment by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   200
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   201
lemma segment_convex_hull:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   202
  "closed_segment a b = convex hull {a,b}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   203
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   204
  have *: "\<And>x. {x} \<noteq> {}" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   205
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   206
    unfolding segment convex_hull_insert[OF *] convex_hull_singleton
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   207
    by (safe; rule_tac x="1 - u" in exI; force)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   208
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   209
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   210
lemma open_closed_segment: "u \<in> open_segment w z \<Longrightarrow> u \<in> closed_segment w z"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   211
  by (auto simp add: closed_segment_def open_segment_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   212
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   213
lemma segment_open_subset_closed:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   214
   "open_segment a b \<subseteq> closed_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   215
  by (auto simp: closed_segment_def open_segment_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   216
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   217
lemma bounded_closed_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   218
    fixes a :: "'a::euclidean_space" shows "bounded (closed_segment a b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   219
  by (simp add: segment_convex_hull compact_convex_hull compact_imp_bounded)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   220
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   221
lemma bounded_open_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   222
    fixes a :: "'a::euclidean_space" shows "bounded (open_segment a b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   223
  by (rule bounded_subset [OF bounded_closed_segment segment_open_subset_closed])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   224
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   225
lemmas bounded_segment = bounded_closed_segment open_closed_segment
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   226
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   227
lemma ends_in_segment [iff]: "a \<in> closed_segment a b" "b \<in> closed_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   228
  unfolding segment_convex_hull
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   229
  by (auto intro!: hull_subset[unfolded subset_eq, rule_format])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   230
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   231
lemma eventually_closed_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   232
  fixes x0::"'a::real_normed_vector"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   233
  assumes "open X0" "x0 \<in> X0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   234
  shows "\<forall>\<^sub>F x in at x0 within U. closed_segment x0 x \<subseteq> X0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   235
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   236
  from openE[OF assms]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   237
  obtain e where e: "0 < e" "ball x0 e \<subseteq> X0" .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   238
  then have "\<forall>\<^sub>F x in at x0 within U. x \<in> ball x0 e"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   239
    by (auto simp: dist_commute eventually_at)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   240
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   241
  proof eventually_elim
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   242
    case (elim x)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   243
    have "x0 \<in> ball x0 e" using \<open>e > 0\<close> by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   244
    from convex_ball[unfolded convex_contains_segment, rule_format, OF this elim]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   245
    have "closed_segment x0 x \<subseteq> ball x0 e" .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   246
    also note \<open>\<dots> \<subseteq> X0\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   247
    finally show ?case .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   248
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   249
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   250
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   251
lemma segment_furthest_le:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   252
  fixes a b x y :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   253
  assumes "x \<in> closed_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   254
  shows "norm (y - x) \<le> norm (y - a) \<or>  norm (y - x) \<le> norm (y - b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   255
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   256
  obtain z where "z \<in> {a, b}" "norm (x - y) \<le> norm (z - y)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   257
    using simplex_furthest_le[of "{a, b}" y]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   258
    using assms[unfolded segment_convex_hull]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   259
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   260
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   261
    by (auto simp add:norm_minus_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   262
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   263
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   264
lemma closed_segment_commute: "closed_segment a b = closed_segment b a"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   265
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   266
  have "{a, b} = {b, a}" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   267
  thus ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   268
    by (simp add: segment_convex_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   269
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   270
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   271
lemma segment_bound1:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   272
  assumes "x \<in> closed_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   273
  shows "norm (x - a) \<le> norm (b - a)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   274
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   275
  obtain u where "x = (1 - u) *\<^sub>R a + u *\<^sub>R b" "0 \<le> u" "u \<le> 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   276
    using assms by (auto simp add: closed_segment_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   277
  then show "norm (x - a) \<le> norm (b - a)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   278
    apply clarify
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   279
    apply (auto simp: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   280
    apply (simp add: scaleR_diff_right [symmetric] mult_left_le_one_le)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   281
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   282
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   283
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   284
lemma segment_bound:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   285
  assumes "x \<in> closed_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   286
  shows "norm (x - a) \<le> norm (b - a)" "norm (x - b) \<le> norm (b - a)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   287
apply (simp add: assms segment_bound1)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   288
by (metis assms closed_segment_commute dist_commute dist_norm segment_bound1)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   290
lemma open_segment_commute: "open_segment a b = open_segment b a"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   291
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   292
  have "{a, b} = {b, a}" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   293
  thus ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   294
    by (simp add: closed_segment_commute open_segment_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   295
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   296
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   297
lemma closed_segment_idem [simp]: "closed_segment a a = {a}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   298
  unfolding segment by (auto simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   299
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   300
lemma open_segment_idem [simp]: "open_segment a a = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   301
  by (simp add: open_segment_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   302
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   303
lemma closed_segment_eq_open: "closed_segment a b = open_segment a b \<union> {a,b}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   304
  using open_segment_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   305
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   306
lemma convex_contains_open_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   307
  "convex s \<longleftrightarrow> (\<forall>a\<in>s. \<forall>b\<in>s. open_segment a b \<subseteq> s)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   308
  by (simp add: convex_contains_segment closed_segment_eq_open)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   309
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   310
lemma closed_segment_eq_real_ivl:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   311
  fixes a b::real
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   312
  shows "closed_segment a b = (if a \<le> b then {a .. b} else {b .. a})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   313
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   314
  have "b \<le> a \<Longrightarrow> closed_segment b a = {b .. a}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   315
    and "a \<le> b \<Longrightarrow> closed_segment a b = {a .. b}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   316
    by (auto simp: convex_hull_eq_real_cbox segment_convex_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   317
  thus ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   318
    by (auto simp: closed_segment_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   319
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   320
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   321
lemma open_segment_eq_real_ivl:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   322
  fixes a b::real
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   323
  shows "open_segment a b = (if a \<le> b then {a<..<b} else {b<..<a})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   324
by (auto simp: closed_segment_eq_real_ivl open_segment_def split: if_split_asm)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   325
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   326
lemma closed_segment_real_eq:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   327
  fixes u::real shows "closed_segment u v = (\<lambda>x. (v - u) * x + u) ` {0..1}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   328
  by (simp add: add.commute [of u] image_affinity_atLeastAtMost [where c=u] closed_segment_eq_real_ivl)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   329
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   330
lemma dist_in_closed_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   331
  fixes a :: "'a :: euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   332
  assumes "x \<in> closed_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   333
    shows "dist x a \<le> dist a b \<and> dist x b \<le> dist a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   334
proof (intro conjI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   335
  obtain u where u: "0 \<le> u" "u \<le> 1" and x: "x = (1 - u) *\<^sub>R a + u *\<^sub>R b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   336
    using assms by (force simp: in_segment algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   337
  have "dist x a = u * dist a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   338
    apply (simp add: dist_norm algebra_simps x)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   339
    by (metis \<open>0 \<le> u\<close> abs_of_nonneg norm_minus_commute norm_scaleR real_vector.scale_right_diff_distrib)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   340
  also have "...  \<le> dist a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   341
    by (simp add: mult_left_le_one_le u)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   342
  finally show "dist x a \<le> dist a b" .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   343
  have "dist x b = norm ((1-u) *\<^sub>R a - (1-u) *\<^sub>R b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   344
    by (simp add: dist_norm algebra_simps x)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   345
  also have "... = (1-u) * dist a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   346
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   347
    have "norm ((1 - 1 * u) *\<^sub>R (a - b)) = (1 - 1 * u) * norm (a - b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   348
      using \<open>u \<le> 1\<close> by force
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   349
    then show ?thesis
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   350
      by (simp add: dist_norm real_vector.scale_right_diff_distrib)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   351
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   352
  also have "... \<le> dist a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   353
    by (simp add: mult_left_le_one_le u)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   354
  finally show "dist x b \<le> dist a b" .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   355
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   356
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   357
lemma dist_in_open_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   358
  fixes a :: "'a :: euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   359
  assumes "x \<in> open_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   360
    shows "dist x a < dist a b \<and> dist x b < dist a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   361
proof (intro conjI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   362
  obtain u where u: "0 < u" "u < 1" and x: "x = (1 - u) *\<^sub>R a + u *\<^sub>R b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   363
    using assms by (force simp: in_segment algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   364
  have "dist x a = u * dist a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   365
    apply (simp add: dist_norm algebra_simps x)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   366
    by (metis abs_of_nonneg less_eq_real_def norm_minus_commute norm_scaleR real_vector.scale_right_diff_distrib \<open>0 < u\<close>)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   367
  also have *: "...  < dist a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   368
    by (metis (no_types) assms dist_eq_0_iff dist_not_less_zero in_segment(2) linorder_neqE_linordered_idom mult.left_neutral real_mult_less_iff1 \<open>u < 1\<close>)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   369
  finally show "dist x a < dist a b" .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   370
  have ab_ne0: "dist a b \<noteq> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   371
    using * by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   372
  have "dist x b = norm ((1-u) *\<^sub>R a - (1-u) *\<^sub>R b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   373
    by (simp add: dist_norm algebra_simps x)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   374
  also have "... = (1-u) * dist a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   375
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   376
    have "norm ((1 - 1 * u) *\<^sub>R (a - b)) = (1 - 1 * u) * norm (a - b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   377
      using \<open>u < 1\<close> by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   378
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   379
      by (simp add: dist_norm real_vector.scale_right_diff_distrib)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   380
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   381
  also have "... < dist a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   382
    using ab_ne0 \<open>0 < u\<close> by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   383
  finally show "dist x b < dist a b" .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   384
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   385
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   386
lemma dist_decreases_open_segment_0:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   387
  fixes x :: "'a :: euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   388
  assumes "x \<in> open_segment 0 b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   389
    shows "dist c x < dist c 0 \<or> dist c x < dist c b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   390
proof (rule ccontr, clarsimp simp: not_less)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   391
  obtain u where u: "0 \<noteq> b" "0 < u" "u < 1" and x: "x = u *\<^sub>R b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   392
    using assms by (auto simp: in_segment)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   393
  have xb: "x \<bullet> b < b \<bullet> b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   394
    using u x by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   395
  assume "norm c \<le> dist c x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   396
  then have "c \<bullet> c \<le> (c - x) \<bullet> (c - x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   397
    by (simp add: dist_norm norm_le)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   398
  moreover have "0 < x \<bullet> b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   399
    using u x by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   400
  ultimately have less: "c \<bullet> b < x \<bullet> b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   401
    by (simp add: x algebra_simps inner_commute u)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   402
  assume "dist c b \<le> dist c x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   403
  then have "(c - b) \<bullet> (c - b) \<le> (c - x) \<bullet> (c - x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   404
    by (simp add: dist_norm norm_le)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   405
  then have "(b \<bullet> b) * (1 - u*u) \<le> 2 * (b \<bullet> c) * (1-u)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   406
    by (simp add: x algebra_simps inner_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   407
  then have "(1+u) * (b \<bullet> b) * (1-u) \<le> 2 * (b \<bullet> c) * (1-u)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   408
    by (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   409
  then have "(1+u) * (b \<bullet> b) \<le> 2 * (b \<bullet> c)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   410
    using \<open>u < 1\<close> by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   411
  with xb have "c \<bullet> b \<ge> x \<bullet> b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   412
    by (auto simp: x algebra_simps inner_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   413
  with less show False by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   414
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   415
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   416
proposition dist_decreases_open_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   417
  fixes a :: "'a :: euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   418
  assumes "x \<in> open_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   419
    shows "dist c x < dist c a \<or> dist c x < dist c b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   420
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   421
  have *: "x - a \<in> open_segment 0 (b - a)" using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   422
    by (metis diff_self open_segment_translation_eq uminus_add_conv_diff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   423
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   424
    using dist_decreases_open_segment_0 [OF *, of "c-a"] assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   425
    by (simp add: dist_norm)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   426
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   427
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   428
corollary open_segment_furthest_le:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   429
  fixes a b x y :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   430
  assumes "x \<in> open_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   431
  shows "norm (y - x) < norm (y - a) \<or>  norm (y - x) < norm (y - b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   432
  by (metis assms dist_decreases_open_segment dist_norm)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   433
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   434
corollary dist_decreases_closed_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   435
  fixes a :: "'a :: euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   436
  assumes "x \<in> closed_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   437
    shows "dist c x \<le> dist c a \<or> dist c x \<le> dist c b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   438
apply (cases "x \<in> open_segment a b")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   439
 using dist_decreases_open_segment less_eq_real_def apply blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   440
by (metis DiffI assms empty_iff insertE open_segment_def order_refl)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   441
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   442
lemma convex_intermediate_ball:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   443
  fixes a :: "'a :: euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   444
  shows "\<lbrakk>ball a r \<subseteq> T; T \<subseteq> cball a r\<rbrakk> \<Longrightarrow> convex T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   445
apply (simp add: convex_contains_open_segment, clarify)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   446
by (metis (no_types, hide_lams) less_le_trans mem_ball mem_cball subsetCE dist_decreases_open_segment)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   447
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   448
lemma csegment_midpoint_subset: "closed_segment (midpoint a b) b \<subseteq> closed_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   449
  apply (clarsimp simp: midpoint_def in_segment)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   450
  apply (rule_tac x="(1 + u) / 2" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   451
  apply (auto simp: algebra_simps add_divide_distrib diff_divide_distrib)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   452
  by (metis real_sum_of_halves scaleR_left.add)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   453
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   454
lemma notin_segment_midpoint:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   455
  fixes a :: "'a :: euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   456
  shows "a \<noteq> b \<Longrightarrow> a \<notin> closed_segment (midpoint a b) b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   457
by (auto simp: dist_midpoint dest!: dist_in_closed_segment)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   458
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   459
lemma segment_to_closest_point:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   460
  fixes S :: "'a :: euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   461
  shows "\<lbrakk>closed S; S \<noteq> {}\<rbrakk> \<Longrightarrow> open_segment a (closest_point S a) \<inter> S = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   462
  apply (subst disjoint_iff_not_equal)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   463
  apply (clarify dest!: dist_in_open_segment)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   464
  by (metis closest_point_le dist_commute le_less_trans less_irrefl)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   465
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   466
lemma segment_to_point_exists:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   467
  fixes S :: "'a :: euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   468
    assumes "closed S" "S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   469
    obtains b where "b \<in> S" "open_segment a b \<inter> S = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   470
  by (metis assms segment_to_closest_point closest_point_exists that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   471
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   472
subsubsection\<open>More lemmas, especially for working with the underlying formula\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   473
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   474
lemma segment_eq_compose:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   475
  fixes a :: "'a :: real_vector"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   476
  shows "(\<lambda>u. (1 - u) *\<^sub>R a + u *\<^sub>R b) = (\<lambda>x. a + x) o (\<lambda>u. u *\<^sub>R (b - a))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   477
    by (simp add: o_def algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   478
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   479
lemma segment_degen_1:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   480
  fixes a :: "'a :: real_vector"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   481
  shows "(1 - u) *\<^sub>R a + u *\<^sub>R b = b \<longleftrightarrow> a=b \<or> u=1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   482
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   483
  { assume "(1 - u) *\<^sub>R a + u *\<^sub>R b = b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   484
    then have "(1 - u) *\<^sub>R a = (1 - u) *\<^sub>R b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   485
      by (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   486
    then have "a=b \<or> u=1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   487
      by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   488
  } then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   489
      by (auto simp: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   490
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   491
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   492
lemma segment_degen_0:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   493
    fixes a :: "'a :: real_vector"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   494
    shows "(1 - u) *\<^sub>R a + u *\<^sub>R b = a \<longleftrightarrow> a=b \<or> u=0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   495
  using segment_degen_1 [of "1-u" b a]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   496
  by (auto simp: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   497
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   498
lemma add_scaleR_degen:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   499
  fixes a b ::"'a::real_vector"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   500
  assumes  "(u *\<^sub>R b + v *\<^sub>R a) = (u *\<^sub>R a + v *\<^sub>R b)"  "u \<noteq> v"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   501
  shows "a=b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   502
  by (metis (no_types, hide_lams) add.commute add_diff_eq diff_add_cancel real_vector.scale_cancel_left real_vector.scale_left_diff_distrib assms)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   503
  
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   504
lemma closed_segment_image_interval:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   505
     "closed_segment a b = (\<lambda>u. (1 - u) *\<^sub>R a + u *\<^sub>R b) ` {0..1}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   506
  by (auto simp: set_eq_iff image_iff closed_segment_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   507
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   508
lemma open_segment_image_interval:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   509
     "open_segment a b = (if a=b then {} else (\<lambda>u. (1 - u) *\<^sub>R a + u *\<^sub>R b) ` {0<..<1})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   510
  by (auto simp:  open_segment_def closed_segment_def segment_degen_0 segment_degen_1)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   511
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   512
lemmas segment_image_interval = closed_segment_image_interval open_segment_image_interval
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   513
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   514
lemma open_segment_bound1:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   515
  assumes "x \<in> open_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   516
  shows "norm (x - a) < norm (b - a)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   517
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   518
  obtain u where "x = (1 - u) *\<^sub>R a + u *\<^sub>R b" "0 < u" "u < 1" "a \<noteq> b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   519
    using assms by (auto simp add: open_segment_image_interval split: if_split_asm)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   520
  then show "norm (x - a) < norm (b - a)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   521
    apply clarify
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   522
    apply (auto simp: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   523
    apply (simp add: scaleR_diff_right [symmetric])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   524
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   525
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   526
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   527
lemma compact_segment [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   528
  fixes a :: "'a::real_normed_vector"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   529
  shows "compact (closed_segment a b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   530
  by (auto simp: segment_image_interval intro!: compact_continuous_image continuous_intros)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   531
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   532
lemma closed_segment [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   533
  fixes a :: "'a::real_normed_vector"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   534
  shows "closed (closed_segment a b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   535
  by (simp add: compact_imp_closed)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   536
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   537
lemma closure_closed_segment [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   538
  fixes a :: "'a::real_normed_vector"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   539
  shows "closure(closed_segment a b) = closed_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   540
  by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   541
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   542
lemma open_segment_bound:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   543
  assumes "x \<in> open_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   544
  shows "norm (x - a) < norm (b - a)" "norm (x - b) < norm (b - a)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   545
apply (simp add: assms open_segment_bound1)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   546
by (metis assms norm_minus_commute open_segment_bound1 open_segment_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   547
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   548
lemma closure_open_segment [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   549
    fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   550
    shows "closure(open_segment a b) = (if a = b then {} else closed_segment a b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   551
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   552
  have "closure ((\<lambda>u. u *\<^sub>R (b - a)) ` {0<..<1}) = (\<lambda>u. u *\<^sub>R (b - a)) ` closure {0<..<1}" if "a \<noteq> b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   553
    apply (rule closure_injective_linear_image [symmetric])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   554
    apply (simp add:)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   555
    using that by (simp add: inj_on_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   556
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   557
    by (simp add: segment_image_interval segment_eq_compose closure_greaterThanLessThan [symmetric]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   558
         closure_translation image_comp [symmetric] del: closure_greaterThanLessThan)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   559
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   560
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   561
lemma closed_open_segment_iff [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   562
    fixes a :: "'a::euclidean_space"  shows "closed(open_segment a b) \<longleftrightarrow> a = b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   563
  by (metis open_segment_def DiffE closure_eq closure_open_segment ends_in_segment(1) insert_iff segment_image_interval(2))
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   564
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   565
lemma compact_open_segment_iff [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   566
    fixes a :: "'a::euclidean_space"  shows "compact(open_segment a b) \<longleftrightarrow> a = b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   567
  by (simp add: bounded_open_segment compact_eq_bounded_closed)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   568
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   569
lemma convex_closed_segment [iff]: "convex (closed_segment a b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   570
  unfolding segment_convex_hull by(rule convex_convex_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   571
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   572
lemma convex_open_segment [iff]: "convex(open_segment a b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   573
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   574
  have "convex ((\<lambda>u. u *\<^sub>R (b-a)) ` {0<..<1})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   575
    by (rule convex_linear_image) auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   576
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   577
    apply (simp add: open_segment_image_interval segment_eq_compose)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   578
    by (metis image_comp convex_translation)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   579
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   580
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   581
lemmas convex_segment = convex_closed_segment convex_open_segment
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   582
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   583
lemma connected_segment [iff]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   584
  fixes x :: "'a :: real_normed_vector"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   585
  shows "connected (closed_segment x y)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   586
  by (simp add: convex_connected)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   587
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   588
lemma is_interval_closed_segment_1[intro, simp]: "is_interval (closed_segment a b)" for a b::real
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   589
  by (auto simp: is_interval_convex_1)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   590
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   591
lemma IVT'_closed_segment_real:
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   592
  fixes f :: "real \<Rightarrow> real"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   593
  assumes "y \<in> closed_segment (f a) (f b)"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   594
  assumes "continuous_on (closed_segment a b) f"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   595
  shows "\<exists>x \<in> closed_segment a b. f x = y"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   596
  using IVT'[of f a y b]
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   597
    IVT'[of "-f" a "-y" b]
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   598
    IVT'[of f b y a]
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   599
    IVT'[of "-f" b "-y" a] assms
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   600
  by (cases "a \<le> b"; cases "f b \<ge> f a") (auto simp: closed_segment_eq_real_ivl continuous_on_minus)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   601
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   602
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   603
subsection\<open>Starlike sets\<close>
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   604
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
   605
definition%important "starlike S \<longleftrightarrow> (\<exists>a\<in>S. \<forall>x\<in>S. closed_segment a x \<subseteq> S)"
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   606
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   607
lemma starlike_UNIV [simp]: "starlike UNIV"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   608
  by (simp add: starlike_def)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   609
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   610
lemma convex_imp_starlike:
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   611
  "convex S \<Longrightarrow> S \<noteq> {} \<Longrightarrow> starlike S"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   612
  unfolding convex_contains_segment starlike_def by auto
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   613
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67613
diff changeset
   614
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   615
lemma affine_hull_closed_segment [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   616
     "affine hull (closed_segment a b) = affine hull {a,b}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   617
  by (simp add: segment_convex_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   618
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   619
lemma affine_hull_open_segment [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   620
    fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   621
    shows "affine hull (open_segment a b) = (if a = b then {} else affine hull {a,b})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   622
by (metis affine_hull_convex_hull affine_hull_empty closure_open_segment closure_same_affine_hull segment_convex_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   623
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   624
lemma rel_interior_closure_convex_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   625
  fixes S :: "_::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   626
  assumes "convex S" "a \<in> rel_interior S" "b \<in> closure S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   627
    shows "open_segment a b \<subseteq> rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   628
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   629
  fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   630
  have [simp]: "(1 - u) *\<^sub>R a + u *\<^sub>R b = b - (1 - u) *\<^sub>R (b - a)" for u
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   631
    by (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   632
  assume "x \<in> open_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   633
  then show "x \<in> rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   634
    unfolding closed_segment_def open_segment_def  using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   635
    by (auto intro: rel_interior_closure_convex_shrink)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   636
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   637
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   638
lemma convex_hull_insert_segments:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   639
   "convex hull (insert a S) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   640
    (if S = {} then {a} else  \<Union>x \<in> convex hull S. closed_segment a x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   641
  by (force simp add: convex_hull_insert_alt in_segment)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   642
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   643
lemma Int_convex_hull_insert_rel_exterior:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   644
  fixes z :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   645
  assumes "convex C" "T \<subseteq> C" and z: "z \<in> rel_interior C" and dis: "disjnt S (rel_interior C)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   646
  shows "S \<inter> (convex hull (insert z T)) = S \<inter> (convex hull T)" (is "?lhs = ?rhs")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   647
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   648
  have "T = {} \<Longrightarrow> z \<notin> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   649
    using dis z by (auto simp add: disjnt_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   650
  then show "?lhs \<subseteq> ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   651
  proof (clarsimp simp add: convex_hull_insert_segments)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   652
    fix x y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   653
    assume "x \<in> S" and y: "y \<in> convex hull T" and "x \<in> closed_segment z y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   654
    have "y \<in> closure C"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   655
      by (metis y \<open>convex C\<close> \<open>T \<subseteq> C\<close> closure_subset contra_subsetD convex_hull_eq hull_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   656
    moreover have "x \<notin> rel_interior C"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   657
      by (meson \<open>x \<in> S\<close> dis disjnt_iff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   658
    moreover have "x \<in> open_segment z y \<union> {z, y}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   659
      using \<open>x \<in> closed_segment z y\<close> closed_segment_eq_open by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   660
    ultimately show "x \<in> convex hull T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   661
      using rel_interior_closure_convex_segment [OF \<open>convex C\<close> z]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   662
      using y z by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   663
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   664
  show "?rhs \<subseteq> ?lhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   665
    by (meson hull_mono inf_mono subset_insertI subset_refl)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   666
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   667
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
   668
subsection%unimportant\<open>More results about segments\<close>
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   669
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   670
lemma dist_half_times2:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   671
  fixes a :: "'a :: real_normed_vector"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   672
  shows "dist ((1 / 2) *\<^sub>R (a + b)) x * 2 = dist (a+b) (2 *\<^sub>R x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   673
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   674
  have "norm ((1 / 2) *\<^sub>R (a + b) - x) * 2 = norm (2 *\<^sub>R ((1 / 2) *\<^sub>R (a + b) - x))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   675
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   676
  also have "... = norm ((a + b) - 2 *\<^sub>R x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   677
    by (simp add: real_vector.scale_right_diff_distrib)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   678
  finally show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   679
    by (simp only: dist_norm)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   680
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   681
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   682
lemma closed_segment_as_ball:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   683
    "closed_segment a b = affine hull {a,b} \<inter> cball(inverse 2 *\<^sub>R (a + b))(norm(b - a) / 2)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   684
proof (cases "b = a")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   685
  case True then show ?thesis by (auto simp: hull_inc)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   686
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   687
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   688
  then have *: "((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   689
                  dist ((1 / 2) *\<^sub>R (a + b)) x * 2 \<le> norm (b - a)) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   690
                 (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 \<le> u \<and> u \<le> 1)" for x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   691
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   692
    have "((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   693
                  dist ((1 / 2) *\<^sub>R (a + b)) x * 2 \<le> norm (b - a)) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   694
          ((\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b) \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   695
                  dist ((1 / 2) *\<^sub>R (a + b)) x * 2 \<le> norm (b - a))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   696
      unfolding eq_diff_eq [symmetric] by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   697
    also have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   698
                          norm ((a+b) - (2 *\<^sub>R x)) \<le> norm (b - a))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   699
      by (simp add: dist_half_times2) (simp add: dist_norm)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   700
    also have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   701
            norm ((a+b) - (2 *\<^sub>R ((1 - u) *\<^sub>R a + u *\<^sub>R b))) \<le> norm (b - a))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   702
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   703
    also have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   704
                norm ((1 - u * 2) *\<^sub>R (b - a)) \<le> norm (b - a))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   705
      by (simp add: algebra_simps scaleR_2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   706
    also have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   707
                          \<bar>1 - u * 2\<bar> * norm (b - a) \<le> norm (b - a))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   708
      by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   709
    also have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> \<bar>1 - u * 2\<bar> \<le> 1)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   710
      by (simp add: mult_le_cancel_right2 False)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   711
    also have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 \<le> u \<and> u \<le> 1)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   712
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   713
    finally show ?thesis .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   714
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   715
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   716
    by (simp add: affine_hull_2 Set.set_eq_iff closed_segment_def *)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   717
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   718
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   719
lemma open_segment_as_ball:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   720
    "open_segment a b =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   721
     affine hull {a,b} \<inter> ball(inverse 2 *\<^sub>R (a + b))(norm(b - a) / 2)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   722
proof (cases "b = a")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   723
  case True then show ?thesis by (auto simp: hull_inc)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   724
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   725
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   726
  then have *: "((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   727
                  dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   728
                 (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)" for x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   729
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   730
    have "((\<exists>u v. x = u *\<^sub>R a + v *\<^sub>R b \<and> u + v = 1) \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   731
                  dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a)) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   732
          ((\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b) \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   733
                  dist ((1 / 2) *\<^sub>R (a + b)) x * 2 < norm (b - a))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   734
      unfolding eq_diff_eq [symmetric] by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   735
    also have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   736
                          norm ((a+b) - (2 *\<^sub>R x)) < norm (b - a))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   737
      by (simp add: dist_half_times2) (simp add: dist_norm)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   738
    also have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   739
            norm ((a+b) - (2 *\<^sub>R ((1 - u) *\<^sub>R a + u *\<^sub>R b))) < norm (b - a))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   740
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   741
    also have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   742
                norm ((1 - u * 2) *\<^sub>R (b - a)) < norm (b - a))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   743
      by (simp add: algebra_simps scaleR_2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   744
    also have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   745
                          \<bar>1 - u * 2\<bar> * norm (b - a) < norm (b - a))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   746
      by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   747
    also have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> \<bar>1 - u * 2\<bar> < 1)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   748
      by (simp add: mult_le_cancel_right2 False)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   749
    also have "... = (\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 < u \<and> u < 1)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   750
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   751
    finally show ?thesis .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   752
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   753
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   754
    using False by (force simp: affine_hull_2 Set.set_eq_iff open_segment_image_interval *)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   755
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   756
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   757
lemmas segment_as_ball = closed_segment_as_ball open_segment_as_ball
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   758
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   759
lemma closed_segment_neq_empty [simp]: "closed_segment a b \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   760
  by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   761
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   762
lemma open_segment_eq_empty [simp]: "open_segment a b = {} \<longleftrightarrow> a = b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   763
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   764
  { assume a1: "open_segment a b = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   765
    have "{} \<noteq> {0::real<..<1}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   766
      by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   767
    then have "a = b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   768
      using a1 open_segment_image_interval by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   769
  } then show ?thesis by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   770
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   771
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   772
lemma open_segment_eq_empty' [simp]: "{} = open_segment a b \<longleftrightarrow> a = b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   773
  using open_segment_eq_empty by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   774
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   775
lemmas segment_eq_empty = closed_segment_neq_empty open_segment_eq_empty
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   776
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   777
lemma inj_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   778
  fixes a :: "'a :: real_vector"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   779
  assumes "a \<noteq> b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   780
    shows "inj_on (\<lambda>u. (1 - u) *\<^sub>R a + u *\<^sub>R b) I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   781
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   782
  fix x y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   783
  assume "(1 - x) *\<^sub>R a + x *\<^sub>R b = (1 - y) *\<^sub>R a + y *\<^sub>R b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   784
  then have "x *\<^sub>R (b - a) = y *\<^sub>R (b - a)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   785
    by (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   786
  with assms show "x = y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   787
    by (simp add: real_vector.scale_right_imp_eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   788
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   789
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   790
lemma finite_closed_segment [simp]: "finite(closed_segment a b) \<longleftrightarrow> a = b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   791
  apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   792
  apply (rule ccontr)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   793
  apply (simp add: segment_image_interval)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   794
  using infinite_Icc [OF zero_less_one] finite_imageD [OF _ inj_segment] apply blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   795
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   796
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   797
lemma finite_open_segment [simp]: "finite(open_segment a b) \<longleftrightarrow> a = b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   798
  by (auto simp: open_segment_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   799
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   800
lemmas finite_segment = finite_closed_segment finite_open_segment
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   801
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   802
lemma closed_segment_eq_sing: "closed_segment a b = {c} \<longleftrightarrow> a = c \<and> b = c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   803
  by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   804
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   805
lemma open_segment_eq_sing: "open_segment a b \<noteq> {c}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   806
  by (metis finite_insert finite_open_segment insert_not_empty open_segment_image_interval)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   807
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   808
lemmas segment_eq_sing = closed_segment_eq_sing open_segment_eq_sing
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   809
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   810
lemma subset_closed_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   811
    "closed_segment a b \<subseteq> closed_segment c d \<longleftrightarrow>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   812
     a \<in> closed_segment c d \<and> b \<in> closed_segment c d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   813
  by auto (meson contra_subsetD convex_closed_segment convex_contains_segment)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   814
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   815
lemma subset_co_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   816
    "closed_segment a b \<subseteq> open_segment c d \<longleftrightarrow>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   817
     a \<in> open_segment c d \<and> b \<in> open_segment c d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   818
using closed_segment_subset by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   819
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   820
lemma subset_open_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   821
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   822
  shows "open_segment a b \<subseteq> open_segment c d \<longleftrightarrow>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   823
         a = b \<or> a \<in> closed_segment c d \<and> b \<in> closed_segment c d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   824
        (is "?lhs = ?rhs")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   825
proof (cases "a = b")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   826
  case True then show ?thesis by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   827
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   828
  case False show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   829
  proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   830
    assume rhs: ?rhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   831
    with \<open>a \<noteq> b\<close> have "c \<noteq> d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   832
      using closed_segment_idem singleton_iff by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   833
    have "\<exists>uc. (1 - u) *\<^sub>R ((1 - ua) *\<^sub>R c + ua *\<^sub>R d) + u *\<^sub>R ((1 - ub) *\<^sub>R c + ub *\<^sub>R d) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   834
               (1 - uc) *\<^sub>R c + uc *\<^sub>R d \<and> 0 < uc \<and> uc < 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   835
        if neq: "(1 - ua) *\<^sub>R c + ua *\<^sub>R d \<noteq> (1 - ub) *\<^sub>R c + ub *\<^sub>R d" "c \<noteq> d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   836
           and "a = (1 - ua) *\<^sub>R c + ua *\<^sub>R d" "b = (1 - ub) *\<^sub>R c + ub *\<^sub>R d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   837
           and u: "0 < u" "u < 1" and uab: "0 \<le> ua" "ua \<le> 1" "0 \<le> ub" "ub \<le> 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   838
        for u ua ub
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   839
    proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   840
      have "ua \<noteq> ub"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   841
        using neq by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   842
      moreover have "(u - 1) * ua \<le> 0" using u uab
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   843
        by (simp add: mult_nonpos_nonneg)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   844
      ultimately have lt: "(u - 1) * ua < u * ub" using u uab
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   845
        by (metis antisym_conv diff_ge_0_iff_ge le_less_trans mult_eq_0_iff mult_le_0_iff not_less)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   846
      have "p * ua + q * ub < p+q" if p: "0 < p" and  q: "0 < q" for p q
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   847
      proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   848
        have "\<not> p \<le> 0" "\<not> q \<le> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   849
          using p q not_less by blast+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   850
        then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   851
          by (metis \<open>ua \<noteq> ub\<close> add_less_cancel_left add_less_cancel_right add_mono_thms_linordered_field(5)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   852
                    less_eq_real_def mult_cancel_left1 mult_less_cancel_left2 uab(2) uab(4))
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   853
      qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   854
      then have "(1 - u) * ua + u * ub < 1" using u \<open>ua \<noteq> ub\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   855
        by (metis diff_add_cancel diff_gt_0_iff_gt)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   856
      with lt show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   857
        by (rule_tac x="ua + u*(ub-ua)" in exI) (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   858
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   859
    with rhs \<open>a \<noteq> b\<close> \<open>c \<noteq> d\<close> show ?lhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   860
      unfolding open_segment_image_interval closed_segment_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   861
      by (fastforce simp add:)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   862
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   863
    assume lhs: ?lhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   864
    with \<open>a \<noteq> b\<close> have "c \<noteq> d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   865
      by (meson finite_open_segment rev_finite_subset)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   866
    have "closure (open_segment a b) \<subseteq> closure (open_segment c d)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   867
      using lhs closure_mono by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   868
    then have "closed_segment a b \<subseteq> closed_segment c d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   869
      by (simp add: \<open>a \<noteq> b\<close> \<open>c \<noteq> d\<close>)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   870
    then show ?rhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   871
      by (force simp: \<open>a \<noteq> b\<close>)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   872
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   873
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   874
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   875
lemma subset_oc_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   876
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   877
  shows "open_segment a b \<subseteq> closed_segment c d \<longleftrightarrow>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   878
         a = b \<or> a \<in> closed_segment c d \<and> b \<in> closed_segment c d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   879
apply (simp add: subset_open_segment [symmetric])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   880
apply (rule iffI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   881
 apply (metis closure_closed_segment closure_mono closure_open_segment subset_closed_segment subset_open_segment)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   882
apply (meson dual_order.trans segment_open_subset_closed)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   883
done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   884
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   885
lemmas subset_segment = subset_closed_segment subset_co_segment subset_oc_segment subset_open_segment
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   886
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   887
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   888
subsection\<open>Betweenness\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   889
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
   890
definition%important "between = (\<lambda>(a,b) x. x \<in> closed_segment a b)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   891
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   892
lemma betweenI:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   893
  assumes "0 \<le> u" "u \<le> 1" "x = (1 - u) *\<^sub>R a + u *\<^sub>R b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   894
  shows "between (a, b) x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   895
using assms unfolding between_def closed_segment_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   896
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   897
lemma betweenE:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   898
  assumes "between (a, b) x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   899
  obtains u where "0 \<le> u" "u \<le> 1" "x = (1 - u) *\<^sub>R a + u *\<^sub>R b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   900
using assms unfolding between_def closed_segment_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   901
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   902
lemma between_implies_scaled_diff:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   903
  assumes "between (S, T) X" "between (S, T) Y" "S \<noteq> Y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   904
  obtains c where "(X - Y) = c *\<^sub>R (S - Y)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   905
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   906
  from \<open>between (S, T) X\<close> obtain u\<^sub>X where X: "X = u\<^sub>X *\<^sub>R S + (1 - u\<^sub>X) *\<^sub>R T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   907
    by (metis add.commute betweenE eq_diff_eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   908
  from \<open>between (S, T) Y\<close> obtain u\<^sub>Y where Y: "Y = u\<^sub>Y *\<^sub>R S + (1 - u\<^sub>Y) *\<^sub>R T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   909
    by (metis add.commute betweenE eq_diff_eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   910
  have "X - Y = (u\<^sub>X - u\<^sub>Y) *\<^sub>R (S - T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   911
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   912
    from X Y have "X - Y =  u\<^sub>X *\<^sub>R S - u\<^sub>Y *\<^sub>R S + ((1 - u\<^sub>X) *\<^sub>R T - (1 - u\<^sub>Y) *\<^sub>R T)" by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   913
    also have "\<dots> = (u\<^sub>X - u\<^sub>Y) *\<^sub>R S - (u\<^sub>X - u\<^sub>Y) *\<^sub>R T" by (simp add: scaleR_left.diff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   914
    finally show ?thesis by (simp add: real_vector.scale_right_diff_distrib)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   915
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   916
  moreover from Y have "S - Y = (1 - u\<^sub>Y) *\<^sub>R (S - T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   917
    by (simp add: real_vector.scale_left_diff_distrib real_vector.scale_right_diff_distrib)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   918
  moreover note \<open>S \<noteq> Y\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   919
  ultimately have "(X - Y) = ((u\<^sub>X - u\<^sub>Y) / (1 - u\<^sub>Y)) *\<^sub>R (S - Y)" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   920
  from this that show thesis by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   921
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   922
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   923
lemma between_mem_segment: "between (a,b) x \<longleftrightarrow> x \<in> closed_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   924
  unfolding between_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   925
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   926
lemma between: "between (a, b) (x::'a::euclidean_space) \<longleftrightarrow> dist a b = (dist a x) + (dist x b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   927
proof (cases "a = b")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   928
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   929
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   930
    unfolding between_def split_conv
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   931
    by (auto simp add: dist_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   932
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   933
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   934
  then have Fal: "norm (a - b) \<noteq> 0" and Fal2: "norm (a - b) > 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   935
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   936
  have *: "\<And>u. a - ((1 - u) *\<^sub>R a + u *\<^sub>R b) = u *\<^sub>R (a - b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   937
    by (auto simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   938
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   939
    unfolding between_def split_conv closed_segment_def mem_Collect_eq
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   940
    apply rule
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   941
    apply (elim exE conjE)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   942
    apply (subst dist_triangle_eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   943
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   944
    fix u
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   945
    assume as: "x = (1 - u) *\<^sub>R a + u *\<^sub>R b" "0 \<le> u" "u \<le> 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   946
    then have *: "a - x = u *\<^sub>R (a - b)" "x - b = (1 - u) *\<^sub>R (a - b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   947
      unfolding as(1) by (auto simp add:algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   948
    show "norm (a - x) *\<^sub>R (x - b) = norm (x - b) *\<^sub>R (a - x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   949
      unfolding norm_minus_commute[of x a] * using as(2,3)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   950
      by (auto simp add: field_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   951
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   952
    assume as: "dist a b = dist a x + dist x b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   953
    have "norm (a - x) / norm (a - b) \<le> 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   954
      using Fal2 unfolding as[unfolded dist_norm] norm_ge_zero by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   955
    then show "\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 \<le> u \<and> u \<le> 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   956
      apply (rule_tac x="dist a x / dist a b" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   957
      unfolding dist_norm
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   958
      apply (subst euclidean_eq_iff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   959
      apply rule
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   960
      defer
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   961
      apply rule
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   962
      prefer 3
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   963
      apply rule
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   964
    proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   965
      fix i :: 'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   966
      assume i: "i \<in> Basis"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   967
      have "((1 - norm (a - x) / norm (a - b)) *\<^sub>R a + (norm (a - x) / norm (a - b)) *\<^sub>R b) \<bullet> i =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   968
        ((norm (a - b) - norm (a - x)) * (a \<bullet> i) + norm (a - x) * (b \<bullet> i)) / norm (a - b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   969
        using Fal by (auto simp add: field_simps inner_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   970
      also have "\<dots> = x\<bullet>i"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   971
        apply (rule divide_eq_imp[OF Fal])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   972
        unfolding as[unfolded dist_norm]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   973
        using as[unfolded dist_triangle_eq]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   974
        apply -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   975
        apply (subst (asm) euclidean_eq_iff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   976
        using i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   977
        apply (erule_tac x=i in ballE)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   978
        apply (auto simp add: field_simps inner_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   979
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   980
      finally show "x \<bullet> i =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   981
        ((1 - norm (a - x) / norm (a - b)) *\<^sub>R a + (norm (a - x) / norm (a - b)) *\<^sub>R b) \<bullet> i"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   982
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   983
    qed (insert Fal2, auto)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   984
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   985
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   986
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   987
lemma between_midpoint:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   988
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   989
  shows "between (a,b) (midpoint a b)" (is ?t1)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   990
    and "between (b,a) (midpoint a b)" (is ?t2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   991
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   992
  have *: "\<And>x y z. x = (1/2::real) *\<^sub>R z \<Longrightarrow> y = (1/2) *\<^sub>R z \<Longrightarrow> norm z = norm x + norm y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   993
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   994
  show ?t1 ?t2
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   995
    unfolding between midpoint_def dist_norm
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   996
    apply(rule_tac[!] *)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   997
    unfolding euclidean_eq_iff[where 'a='a]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   998
    apply (auto simp add: field_simps inner_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   999
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1000
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1001
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1002
lemma between_mem_convex_hull:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1003
  "between (a,b) x \<longleftrightarrow> x \<in> convex hull {a,b}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1004
  unfolding between_mem_segment segment_convex_hull ..
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1005
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1006
lemma between_triv_iff [simp]: "between (a,a) b \<longleftrightarrow> a=b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1007
  by (auto simp: between_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1008
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1009
lemma between_triv1 [simp]: "between (a,b) a"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1010
  by (auto simp: between_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1011
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1012
lemma between_triv2 [simp]: "between (a,b) b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1013
  by (auto simp: between_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1014
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1015
lemma between_commute:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1016
   "between (a,b) = between (b,a)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1017
by (auto simp: between_def closed_segment_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1018
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1019
lemma between_antisym:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1020
  fixes a :: "'a :: euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1021
  shows "\<lbrakk>between (b,c) a; between (a,c) b\<rbrakk> \<Longrightarrow> a = b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1022
by (auto simp: between dist_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1023
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1024
lemma between_trans:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1025
    fixes a :: "'a :: euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1026
    shows "\<lbrakk>between (b,c) a; between (a,c) d\<rbrakk> \<Longrightarrow> between (b,c) d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1027
  using dist_triangle2 [of b c d] dist_triangle3 [of b d a]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1028
  by (auto simp: between dist_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1029
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1030
lemma between_norm:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1031
    fixes a :: "'a :: euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1032
    shows "between (a,b) x \<longleftrightarrow> norm(x - a) *\<^sub>R (b - x) = norm(b - x) *\<^sub>R (x - a)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1033
  by (auto simp: between dist_triangle_eq norm_minus_commute algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1034
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1035
lemma between_swap:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1036
  fixes A B X Y :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1037
  assumes "between (A, B) X"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1038
  assumes "between (A, B) Y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1039
  shows "between (X, B) Y \<longleftrightarrow> between (A, Y) X"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1040
using assms by (auto simp add: between)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1041
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1042
lemma between_translation [simp]: "between (a + y,a + z) (a + x) \<longleftrightarrow> between (y,z) x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1043
  by (auto simp: between_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1044
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1045
lemma between_trans_2:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1046
  fixes a :: "'a :: euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1047
  shows "\<lbrakk>between (b,c) a; between (a,b) d\<rbrakk> \<Longrightarrow> between (c,d) a"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1048
  by (metis between_commute between_swap between_trans)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1049
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1050
lemma between_scaleR_lift [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1051
  fixes v :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1052
  shows "between (a *\<^sub>R v, b *\<^sub>R v) (c *\<^sub>R v) \<longleftrightarrow> v = 0 \<or> between (a, b) c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1053
  by (simp add: between dist_norm scaleR_left_diff_distrib [symmetric] distrib_right [symmetric])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1054
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1055
lemma between_1:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1056
  fixes x::real
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1057
  shows "between (a,b) x \<longleftrightarrow> (a \<le> x \<and> x \<le> b) \<or> (b \<le> x \<and> x \<le> a)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1058
  by (auto simp: between_mem_segment closed_segment_eq_real_ivl)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1059
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1060
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  1061
subsection%unimportant \<open>Shrinking towards the interior of a convex set\<close>
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1062
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1063
lemma mem_interior_convex_shrink:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1064
  fixes s :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1065
  assumes "convex s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1066
    and "c \<in> interior s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1067
    and "x \<in> s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1068
    and "0 < e"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1069
    and "e \<le> 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1070
  shows "x - e *\<^sub>R (x - c) \<in> interior s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1071
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1072
  obtain d where "d > 0" and d: "ball c d \<subseteq> s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1073
    using assms(2) unfolding mem_interior by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1074
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1075
    unfolding mem_interior
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1076
    apply (rule_tac x="e*d" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1077
    apply rule
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1078
    defer
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1079
    unfolding subset_eq Ball_def mem_ball
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1080
  proof (rule, rule)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1081
    fix y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1082
    assume as: "dist (x - e *\<^sub>R (x - c)) y < e * d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1083
    have *: "y = (1 - (1 - e)) *\<^sub>R ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) + (1 - e) *\<^sub>R x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1084
      using \<open>e > 0\<close> by (auto simp add: scaleR_left_diff_distrib scaleR_right_diff_distrib)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1085
    have "dist c ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) = \<bar>1/e\<bar> * norm (e *\<^sub>R c - y + (1 - e) *\<^sub>R x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1086
      unfolding dist_norm
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1087
      unfolding norm_scaleR[symmetric]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1088
      apply (rule arg_cong[where f=norm])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1089
      using \<open>e > 0\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1090
      by (auto simp add: euclidean_eq_iff[where 'a='a] field_simps inner_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1091
    also have "\<dots> = \<bar>1/e\<bar> * norm (x - e *\<^sub>R (x - c) - y)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1092
      by (auto intro!:arg_cong[where f=norm] simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1093
    also have "\<dots> < d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1094
      using as[unfolded dist_norm] and \<open>e > 0\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1095
      by (auto simp add:pos_divide_less_eq[OF \<open>e > 0\<close>] mult.commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1096
    finally show "y \<in> s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1097
      apply (subst *)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1098
      apply (rule assms(1)[unfolded convex_alt,rule_format])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1099
      apply (rule d[unfolded subset_eq,rule_format])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1100
      unfolding mem_ball
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1101
      using assms(3-5)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1102
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1103
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1104
  qed (insert \<open>e>0\<close> \<open>d>0\<close>, auto)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1105
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1106
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1107
lemma mem_interior_closure_convex_shrink:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1108
  fixes s :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1109
  assumes "convex s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1110
    and "c \<in> interior s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1111
    and "x \<in> closure s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1112
    and "0 < e"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1113
    and "e \<le> 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1114
  shows "x - e *\<^sub>R (x - c) \<in> interior s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1115
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1116
  obtain d where "d > 0" and d: "ball c d \<subseteq> s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1117
    using assms(2) unfolding mem_interior by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1118
  have "\<exists>y\<in>s. norm (y - x) * (1 - e) < e * d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1119
  proof (cases "x \<in> s")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1120
    case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1121
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1122
      using \<open>e > 0\<close> \<open>d > 0\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1123
      apply (rule_tac bexI[where x=x])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1124
      apply (auto)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1125
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1126
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1127
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1128
    then have x: "x islimpt s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1129
      using assms(3)[unfolded closure_def] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1130
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1131
    proof (cases "e = 1")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1132
      case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1133
      obtain y where "y \<in> s" "y \<noteq> x" "dist y x < 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1134
        using x[unfolded islimpt_approachable,THEN spec[where x=1]] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1135
      then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1136
        apply (rule_tac x=y in bexI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1137
        unfolding True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1138
        using \<open>d > 0\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1139
        apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1140
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1141
    next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1142
      case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1143
      then have "0 < e * d / (1 - e)" and *: "1 - e > 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1144
        using \<open>e \<le> 1\<close> \<open>e > 0\<close> \<open>d > 0\<close> by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1145
      then obtain y where "y \<in> s" "y \<noteq> x" "dist y x < e * d / (1 - e)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1146
        using x[unfolded islimpt_approachable,THEN spec[where x="e*d / (1 - e)"]] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1147
      then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1148
        apply (rule_tac x=y in bexI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1149
        unfolding dist_norm
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1150
        using pos_less_divide_eq[OF *]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1151
        apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1152
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1153
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1154
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1155
  then obtain y where "y \<in> s" and y: "norm (y - x) * (1 - e) < e * d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1156
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1157
  define z where "z = c + ((1 - e) / e) *\<^sub>R (x - y)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1158
  have *: "x - e *\<^sub>R (x - c) = y - e *\<^sub>R (y - z)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1159
    unfolding z_def using \<open>e > 0\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1160
    by (auto simp add: scaleR_right_diff_distrib scaleR_right_distrib scaleR_left_diff_distrib)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1161
  have "z \<in> interior s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1162
    apply (rule interior_mono[OF d,unfolded subset_eq,rule_format])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1163
    unfolding interior_open[OF open_ball] mem_ball z_def dist_norm using y and assms(4,5)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1164
    apply (auto simp add:field_simps norm_minus_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1165
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1166
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1167
    unfolding *
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1168
    apply -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1169
    apply (rule mem_interior_convex_shrink)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1170
    using assms(1,4-5) \<open>y\<in>s\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1171
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1172
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1173
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1174
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1175
lemma in_interior_closure_convex_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1176
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1177
  assumes "convex S" and a: "a \<in> interior S" and b: "b \<in> closure S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1178
    shows "open_segment a b \<subseteq> interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1179
proof (clarsimp simp: in_segment)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1180
  fix u::real
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1181
  assume u: "0 < u" "u < 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1182
  have "(1 - u) *\<^sub>R a + u *\<^sub>R b = b - (1 - u) *\<^sub>R (b - a)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1183
    by (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1184
  also have "... \<in> interior S" using mem_interior_closure_convex_shrink [OF assms] u
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1185
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1186
  finally show "(1 - u) *\<^sub>R a + u *\<^sub>R b \<in> interior S" .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1187
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1188
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1189
lemma closure_open_Int_superset:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1190
  assumes "open S" "S \<subseteq> closure T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1191
  shows "closure(S \<inter> T) = closure S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1192
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1193
  have "closure S \<subseteq> closure(S \<inter> T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1194
    by (metis assms closed_closure closure_minimal inf.orderE open_Int_closure_subset)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1195
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1196
    by (simp add: closure_mono dual_order.antisym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1197
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1198
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1199
lemma convex_closure_interior:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1200
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1201
  assumes "convex S" and int: "interior S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1202
  shows "closure(interior S) = closure S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1203
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1204
  obtain a where a: "a \<in> interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1205
    using int by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1206
  have "closure S \<subseteq> closure(interior S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1207
  proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1208
    fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1209
    assume x: "x \<in> closure S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1210
    show "x \<in> closure (interior S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1211
    proof (cases "x=a")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1212
      case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1213
      then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1214
        using \<open>a \<in> interior S\<close> closure_subset by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1215
    next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1216
      case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1217
      show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1218
      proof (clarsimp simp add: closure_def islimpt_approachable)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1219
        fix e::real
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1220
        assume xnotS: "x \<notin> interior S" and "0 < e"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1221
        show "\<exists>x'\<in>interior S. x' \<noteq> x \<and> dist x' x < e"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1222
        proof (intro bexI conjI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1223
          show "x - min (e/2 / norm (x - a)) 1 *\<^sub>R (x - a) \<noteq> x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1224
            using False \<open>0 < e\<close> by (auto simp: algebra_simps min_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1225
          show "dist (x - min (e/2 / norm (x - a)) 1 *\<^sub>R (x - a)) x < e"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1226
            using \<open>0 < e\<close> by (auto simp: dist_norm min_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1227
          show "x - min (e/2 / norm (x - a)) 1 *\<^sub>R (x - a) \<in> interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1228
            apply (clarsimp simp add: min_def a)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1229
            apply (rule mem_interior_closure_convex_shrink [OF \<open>convex S\<close> a x])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1230
            using \<open>0 < e\<close> False apply (auto simp: divide_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1231
            done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1232
        qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1233
      qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1234
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1235
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1236
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1237
    by (simp add: closure_mono interior_subset subset_antisym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1238
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1239
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1240
lemma closure_convex_Int_superset:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1241
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1242
  assumes "convex S" "interior S \<noteq> {}" "interior S \<subseteq> closure T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1243
  shows "closure(S \<inter> T) = closure S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1244
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1245
  have "closure S \<subseteq> closure(interior S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1246
    by (simp add: convex_closure_interior assms)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1247
  also have "... \<subseteq> closure (S \<inter> T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1248
    using interior_subset [of S] assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1249
    by (metis (no_types, lifting) Int_assoc Int_lower2 closure_mono closure_open_Int_superset inf.orderE open_interior)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1250
  finally show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1251
    by (simp add: closure_mono dual_order.antisym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1252
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1253
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1254
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  1255
subsection%unimportant \<open>Some obvious but surprisingly hard simplex lemmas\<close>
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1256
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1257
lemma simplex:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1258
  assumes "finite s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1259
    and "0 \<notin> s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1260
  shows "convex hull (insert 0 s) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1261
    {y. (\<exists>u. (\<forall>x\<in>s. 0 \<le> u x) \<and> sum u s \<le> 1 \<and> sum (\<lambda>x. u x *\<^sub>R x) s = y)}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1262
  unfolding convex_hull_finite[OF finite.insertI[OF assms(1)]]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1263
  apply (rule set_eqI, rule)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1264
  unfolding mem_Collect_eq
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1265
  apply (erule_tac[!] exE)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1266
  apply (erule_tac[!] conjE)+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1267
  unfolding sum_clauses(2)[OF \<open>finite s\<close>]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1268
  apply (rule_tac x=u in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1269
  defer
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1270
  apply (rule_tac x="\<lambda>x. if x = 0 then 1 - sum u s else u x" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1271
  using assms(2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1272
  unfolding if_smult and sum_delta_notmem[OF assms(2)]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1273
  apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1274
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1275
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1276
lemma substd_simplex:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1277
  assumes d: "d \<subseteq> Basis"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1278
  shows "convex hull (insert 0 d) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1279
    {x. (\<forall>i\<in>Basis. 0 \<le> x\<bullet>i) \<and> (\<Sum>i\<in>d. x\<bullet>i) \<le> 1 \<and> (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0)}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1280
  (is "convex hull (insert 0 ?p) = ?s")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1281
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1282
  let ?D = d
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1283
  have "0 \<notin> ?p"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1284
    using assms by (auto simp: image_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1285
  from d have "finite d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1286
    by (blast intro: finite_subset finite_Basis)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1287
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1288
    unfolding simplex[OF \<open>finite d\<close> \<open>0 \<notin> ?p\<close>]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1289
    apply (rule set_eqI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1290
    unfolding mem_Collect_eq
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1291
    apply rule
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1292
    apply (elim exE conjE)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1293
    apply (erule_tac[2] conjE)+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1294
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1295
    fix x :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1296
    fix u
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1297
    assume as: "\<forall>x\<in>?D. 0 \<le> u x" "sum u ?D \<le> 1" "(\<Sum>x\<in>?D. u x *\<^sub>R x) = x"
67613
ce654b0e6d69 more symbols;
wenzelm
parents: 67443
diff changeset
  1298
    have *: "\<forall>i\<in>Basis. i \<in> d \<longrightarrow> u i = x\<bullet>i"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1299
      and "(\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1300
      using as(3)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1301
      unfolding substdbasis_expansion_unique[OF assms]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1302
      by auto
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1303
    then have **: "sum u ?D = sum ((\<bullet>) x) ?D"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1304
      apply -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1305
      apply (rule sum.cong)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1306
      using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1307
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1308
      done
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1309
    have "(\<forall>i\<in>Basis. 0 \<le> x\<bullet>i) \<and> sum ((\<bullet>) x) ?D \<le> 1"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1310
    proof (rule,rule)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1311
      fix i :: 'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1312
      assume i: "i \<in> Basis"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1313
      have "i \<in> d \<Longrightarrow> 0 \<le> x\<bullet>i"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1314
        unfolding *[rule_format,OF i,symmetric]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1315
         apply (rule_tac as(1)[rule_format])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1316
         apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1317
         done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1318
      moreover have "i \<notin> d \<Longrightarrow> 0 \<le> x\<bullet>i"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1319
        using \<open>(\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0)\<close>[rule_format, OF i] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1320
      ultimately show "0 \<le> x\<bullet>i" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1321
    qed (insert as(2)[unfolded **], auto)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1322
    then show "(\<forall>i\<in>Basis. 0 \<le> x\<bullet>i) \<and> sum ((\<bullet>) x) ?D \<le> 1 \<and> (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1323
      using \<open>(\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0)\<close> by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1324
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1325
    fix x :: "'a::euclidean_space"
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1326
    assume as: "\<forall>i\<in>Basis. 0 \<le> x \<bullet> i" "sum ((\<bullet>) x) ?D \<le> 1" "(\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1327
    show "\<exists>u. (\<forall>x\<in>?D. 0 \<le> u x) \<and> sum u ?D \<le> 1 \<and> (\<Sum>x\<in>?D. u x *\<^sub>R x) = x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1328
      using as d
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1329
      unfolding substdbasis_expansion_unique[OF assms]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1330
      apply (rule_tac x="inner x" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1331
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1332
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1333
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1334
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1335
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1336
lemma std_simplex:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1337
  "convex hull (insert 0 Basis) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1338
    {x::'a::euclidean_space. (\<forall>i\<in>Basis. 0 \<le> x\<bullet>i) \<and> sum (\<lambda>i. x\<bullet>i) Basis \<le> 1}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1339
  using substd_simplex[of Basis] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1340
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1341
lemma interior_std_simplex:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1342
  "interior (convex hull (insert 0 Basis)) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1343
    {x::'a::euclidean_space. (\<forall>i\<in>Basis. 0 < x\<bullet>i) \<and> sum (\<lambda>i. x\<bullet>i) Basis < 1}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1344
  apply (rule set_eqI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1345
  unfolding mem_interior std_simplex
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1346
  unfolding subset_eq mem_Collect_eq Ball_def mem_ball
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1347
  unfolding Ball_def[symmetric]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1348
  apply rule
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1349
  apply (elim exE conjE)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1350
  defer
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1351
  apply (erule conjE)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1352
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1353
  fix x :: 'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1354
  fix e
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1355
  assume "e > 0" and as: "\<forall>xa. dist x xa < e \<longrightarrow> (\<forall>x\<in>Basis. 0 \<le> xa \<bullet> x) \<and> sum ((\<bullet>) xa) Basis \<le> 1"
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1356
  show "(\<forall>xa\<in>Basis. 0 < x \<bullet> xa) \<and> sum ((\<bullet>) x) Basis < 1"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1357
    apply safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1358
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1359
    fix i :: 'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1360
    assume i: "i \<in> Basis"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1361
    then show "0 < x \<bullet> i"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1362
      using as[THEN spec[where x="x - (e / 2) *\<^sub>R i"]] and \<open>e > 0\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1363
      unfolding dist_norm
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1364
      by (auto elim!: ballE[where x=i] simp: inner_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1365
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1366
    have **: "dist x (x + (e / 2) *\<^sub>R (SOME i. i\<in>Basis)) < e" using \<open>e > 0\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1367
      unfolding dist_norm
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1368
      by (auto intro!: mult_strict_left_mono simp: SOME_Basis)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1369
    have "\<And>i. i \<in> Basis \<Longrightarrow> (x + (e / 2) *\<^sub>R (SOME i. i\<in>Basis)) \<bullet> i =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1370
      x\<bullet>i + (if i = (SOME i. i\<in>Basis) then e/2 else 0)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1371
      by (auto simp: SOME_Basis inner_Basis inner_simps)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1372
    then have *: "sum ((\<bullet>) (x + (e / 2) *\<^sub>R (SOME i. i\<in>Basis))) Basis =
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1373
      sum (\<lambda>i. x\<bullet>i + (if (SOME i. i\<in>Basis) = i then e/2 else 0)) Basis"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1374
      apply (rule_tac sum.cong)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1375
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1376
      done
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1377
    have "sum ((\<bullet>) x) Basis < sum ((\<bullet>) (x + (e / 2) *\<^sub>R (SOME i. i\<in>Basis))) Basis"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1378
      unfolding * sum.distrib
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1379
      using \<open>e > 0\<close> DIM_positive[where 'a='a]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1380
      apply (subst sum.delta')
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1381
      apply (auto simp: SOME_Basis)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1382
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1383
    also have "\<dots> \<le> 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1384
      using **
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1385
      apply (drule_tac as[rule_format])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1386
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1387
      done
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1388
    finally show "sum ((\<bullet>) x) Basis < 1" by auto
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1389
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1390
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1391
  fix x :: 'a
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1392
  assume as: "\<forall>i\<in>Basis. 0 < x \<bullet> i" "sum ((\<bullet>) x) Basis < 1"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1393
  obtain a :: 'b where "a \<in> UNIV" using UNIV_witness ..
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1394
  let ?d = "(1 - sum ((\<bullet>) x) Basis) / real (DIM('a))"
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1395
  show "\<exists>e>0. \<forall>y. dist x y < e \<longrightarrow> (\<forall>i\<in>Basis. 0 \<le> y \<bullet> i) \<and> sum ((\<bullet>) y) Basis \<le> 1"
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1396
  proof (rule_tac x="min (Min (((\<bullet>) x) ` Basis)) D" for D in exI, intro conjI impI allI)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1397
    fix y
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1398
    assume y: "dist x y < min (Min ((\<bullet>) x ` Basis)) ?d"
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1399
    have "sum ((\<bullet>) y) Basis \<le> sum (\<lambda>i. x\<bullet>i + ?d) Basis"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1400
    proof (rule sum_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1401
      fix i :: 'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1402
      assume i: "i \<in> Basis"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1403
      then have "\<bar>y\<bullet>i - x\<bullet>i\<bar> < ?d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1404
        apply -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1405
        apply (rule le_less_trans)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1406
        using Basis_le_norm[OF i, of "y - x"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1407
        using y[unfolded min_less_iff_conj dist_norm, THEN conjunct2]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1408
        apply (auto simp add: norm_minus_commute inner_diff_left)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1409
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1410
      then show "y \<bullet> i \<le> x \<bullet> i + ?d" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1411
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1412
    also have "\<dots> \<le> 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1413
      unfolding sum.distrib sum_constant
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1414
      by (auto simp add: Suc_le_eq)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1415
    finally show "sum ((\<bullet>) y) Basis \<le> 1" .
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1416
    show "(\<forall>i\<in>Basis. 0 \<le> y \<bullet> i)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1417
    proof safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1418
      fix i :: 'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1419
      assume i: "i \<in> Basis"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1420
      have "norm (x - y) < x\<bullet>i"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1421
        apply (rule less_le_trans)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1422
        apply (rule y[unfolded min_less_iff_conj dist_norm, THEN conjunct1])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1423
        using i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1424
        apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1425
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1426
      then show "0 \<le> y\<bullet>i"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1427
        using Basis_le_norm[OF i, of "x - y"] and as(1)[rule_format, OF i]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1428
        by (auto simp: inner_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1429
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1430
  next
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1431
    have "Min (((\<bullet>) x) ` Basis) > 0"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1432
      using as by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1433
    moreover have "?d > 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1434
      using as by (auto simp: Suc_le_eq)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1435
    ultimately show "0 < min (Min ((\<bullet>) x ` Basis)) ((1 - sum ((\<bullet>) x) Basis) / real DIM('a))"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1436
      by linarith
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1437
  qed 
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1438
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1439
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1440
lemma interior_std_simplex_nonempty:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1441
  obtains a :: "'a::euclidean_space" where
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1442
    "a \<in> interior(convex hull (insert 0 Basis))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1443
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1444
  let ?D = "Basis :: 'a set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1445
  let ?a = "sum (\<lambda>b::'a. inverse (2 * real DIM('a)) *\<^sub>R b) Basis"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1446
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1447
    fix i :: 'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1448
    assume i: "i \<in> Basis"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1449
    have "?a \<bullet> i = inverse (2 * real DIM('a))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1450
      by (rule trans[of _ "sum (\<lambda>j. if i = j then inverse (2 * real DIM('a)) else 0) ?D"])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1451
         (simp_all add: sum.If_cases i) }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1452
  note ** = this
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1453
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1454
    apply (rule that[of ?a])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1455
    unfolding interior_std_simplex mem_Collect_eq
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1456
  proof safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1457
    fix i :: 'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1458
    assume i: "i \<in> Basis"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1459
    show "0 < ?a \<bullet> i"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1460
      unfolding **[OF i] by (auto simp add: Suc_le_eq DIM_positive)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1461
  next
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1462
    have "sum ((\<bullet>) ?a) ?D = sum (\<lambda>i. inverse (2 * real DIM('a))) ?D"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1463
      apply (rule sum.cong)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1464
      apply rule
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1465
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1466
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1467
    also have "\<dots> < 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1468
      unfolding sum_constant divide_inverse[symmetric]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1469
      by (auto simp add: field_simps)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1470
    finally show "sum ((\<bullet>) ?a) ?D < 1" by auto
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1471
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1472
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1473
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1474
lemma rel_interior_substd_simplex:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1475
  assumes d: "d \<subseteq> Basis"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1476
  shows "rel_interior (convex hull (insert 0 d)) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1477
    {x::'a::euclidean_space. (\<forall>i\<in>d. 0 < x\<bullet>i) \<and> (\<Sum>i\<in>d. x\<bullet>i) < 1 \<and> (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0)}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1478
  (is "rel_interior (convex hull (insert 0 ?p)) = ?s")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1479
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1480
  have "finite d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1481
    apply (rule finite_subset)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1482
    using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1483
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1484
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1485
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1486
  proof (cases "d = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1487
    case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1488
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1489
      using rel_interior_sing using euclidean_eq_iff[of _ 0] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1490
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1491
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1492
    have h0: "affine hull (convex hull (insert 0 ?p)) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1493
      {x::'a::euclidean_space. (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0)}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1494
      using affine_hull_convex_hull affine_hull_substd_basis assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1495
    have aux: "\<And>x::'a. \<forall>i\<in>Basis. (\<forall>i\<in>d. 0 \<le> x\<bullet>i) \<and> (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0) \<longrightarrow> 0 \<le> x\<bullet>i"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1496
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1497
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1498
      fix x :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1499
      assume x: "x \<in> rel_interior (convex hull (insert 0 ?p))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1500
      then obtain e where e0: "e > 0" and
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1501
        "ball x e \<inter> {xa. (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> xa\<bullet>i = 0)} \<subseteq> convex hull (insert 0 ?p)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1502
        using mem_rel_interior_ball[of x "convex hull (insert 0 ?p)"] h0 by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1503
      then have as: "\<forall>xa. dist x xa < e \<and> (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> xa\<bullet>i = 0) \<longrightarrow>
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1504
        (\<forall>i\<in>d. 0 \<le> xa \<bullet> i) \<and> sum ((\<bullet>) xa) d \<le> 1"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1505
        unfolding ball_def unfolding substd_simplex[OF assms] using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1506
      have x0: "(\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1507
        using x rel_interior_subset  substd_simplex[OF assms] by auto
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1508
      have "(\<forall>i\<in>d. 0 < x \<bullet> i) \<and> sum ((\<bullet>) x) d < 1 \<and> (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1509
        apply rule
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1510
        apply rule
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1511
      proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1512
        fix i :: 'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1513
        assume "i \<in> d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1514
        then have "\<forall>ia\<in>d. 0 \<le> (x - (e / 2) *\<^sub>R i) \<bullet> ia"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1515
          apply -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1516
          apply (rule as[rule_format,THEN conjunct1])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1517
          unfolding dist_norm
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1518
          using d \<open>e > 0\<close> x0
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1519
          apply (auto simp: inner_simps inner_Basis)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1520
          done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1521
        then show "0 < x \<bullet> i"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1522
          apply (erule_tac x=i in ballE)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1523
          using \<open>e > 0\<close> \<open>i \<in> d\<close> d
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1524
          apply (auto simp: inner_simps inner_Basis)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1525
          done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1526
      next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1527
        obtain a where a: "a \<in> d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1528
          using \<open>d \<noteq> {}\<close> by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1529
        then have **: "dist x (x + (e / 2) *\<^sub>R a) < e"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1530
          using \<open>e > 0\<close> norm_Basis[of a] d
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1531
          unfolding dist_norm
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1532
          by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1533
        have "\<And>i. i \<in> Basis \<Longrightarrow> (x + (e / 2) *\<^sub>R a) \<bullet> i = x\<bullet>i + (if i = a then e/2 else 0)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1534
          using a d by (auto simp: inner_simps inner_Basis)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1535
        then have *: "sum ((\<bullet>) (x + (e / 2) *\<^sub>R a)) d =
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1536
          sum (\<lambda>i. x\<bullet>i + (if a = i then e/2 else 0)) d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1537
          using d by (intro sum.cong) auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1538
        have "a \<in> Basis"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1539
          using \<open>a \<in> d\<close> d by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1540
        then have h1: "(\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> (x + (e / 2) *\<^sub>R a) \<bullet> i = 0)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1541
          using x0 d \<open>a\<in>d\<close> by (auto simp add: inner_add_left inner_Basis)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1542
        have "sum ((\<bullet>) x) d < sum ((\<bullet>) (x + (e / 2) *\<^sub>R a)) d"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1543
          unfolding * sum.distrib
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1544
          using \<open>e > 0\<close> \<open>a \<in> d\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1545
          using \<open>finite d\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1546
          by (auto simp add: sum.delta')
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1547
        also have "\<dots> \<le> 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1548
          using ** h1 as[rule_format, of "x + (e / 2) *\<^sub>R a"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1549
          by auto
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1550
        finally show "sum ((\<bullet>) x) d < 1 \<and> (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1551
          using x0 by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1552
      qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1553
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1554
    moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1555
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1556
      fix x :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1557
      assume as: "x \<in> ?s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1558
      have "\<forall>i. 0 < x\<bullet>i \<or> 0 = x\<bullet>i \<longrightarrow> 0 \<le> x\<bullet>i"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1559
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1560
      moreover have "\<forall>i. i \<in> d \<or> i \<notin> d" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1561
      ultimately
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1562
      have "\<forall>i. (\<forall>i\<in>d. 0 < x\<bullet>i) \<and> (\<forall>i. i \<notin> d \<longrightarrow> x\<bullet>i = 0) \<longrightarrow> 0 \<le> x\<bullet>i"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1563
        by metis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1564
      then have h2: "x \<in> convex hull (insert 0 ?p)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1565
        using as assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1566
        unfolding substd_simplex[OF assms] by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1567
      obtain a where a: "a \<in> d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1568
        using \<open>d \<noteq> {}\<close> by auto
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1569
      let ?d = "(1 - sum ((\<bullet>) x) d) / real (card d)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1570
      have "0 < card d" using \<open>d \<noteq> {}\<close> \<open>finite d\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1571
        by (simp add: card_gt_0_iff)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1572
      have "Min (((\<bullet>) x) ` d) > 0"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1573
        using as \<open>d \<noteq> {}\<close> \<open>finite d\<close> by (simp add: Min_gr_iff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1574
      moreover have "?d > 0" using as using \<open>0 < card d\<close> by auto
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1575
      ultimately have h3: "min (Min (((\<bullet>) x) ` d)) ?d > 0"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1576
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1577
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1578
      have "x \<in> rel_interior (convex hull (insert 0 ?p))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1579
        unfolding rel_interior_ball mem_Collect_eq h0
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1580
        apply (rule,rule h2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1581
        unfolding substd_simplex[OF assms]
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1582
        apply (rule_tac x="min (Min (((\<bullet>) x) ` d)) ?d" in exI)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1583
        apply (rule, rule h3)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1584
        apply safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1585
        unfolding mem_ball
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1586
      proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1587
        fix y :: 'a
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1588
        assume y: "dist x y < min (Min ((\<bullet>) x ` d)) ?d"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1589
        assume y2: "\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> y\<bullet>i = 0"
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1590
        have "sum ((\<bullet>) y) d \<le> sum (\<lambda>i. x\<bullet>i + ?d) d"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1591
        proof (rule sum_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1592
          fix i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1593
          assume "i \<in> d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1594
          with d have i: "i \<in> Basis"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1595
            by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1596
          have "\<bar>y\<bullet>i - x\<bullet>i\<bar> < ?d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1597
            apply (rule le_less_trans)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1598
            using Basis_le_norm[OF i, of "y - x"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1599
            using y[unfolded min_less_iff_conj dist_norm, THEN conjunct2]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1600
            apply (auto simp add: norm_minus_commute inner_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1601
            done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1602
          then show "y \<bullet> i \<le> x \<bullet> i + ?d" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1603
        qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1604
        also have "\<dots> \<le> 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1605
          unfolding sum.distrib sum_constant  using \<open>0 < card d\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1606
          by auto
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1607
        finally show "sum ((\<bullet>) y) d \<le> 1" .
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1608
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1609
        fix i :: 'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1610
        assume i: "i \<in> Basis"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1611
        then show "0 \<le> y\<bullet>i"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1612
        proof (cases "i\<in>d")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1613
          case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1614
          have "norm (x - y) < x\<bullet>i"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1615
            using y[unfolded min_less_iff_conj dist_norm, THEN conjunct1]
67613
ce654b0e6d69 more symbols;
wenzelm
parents: 67443
diff changeset
  1616
            using Min_gr_iff[of "(\<bullet>) x ` d" "norm (x - y)"] \<open>0 < card d\<close> \<open>i \<in> d\<close>
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1617
            by (simp add: card_gt_0_iff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1618
          then show "0 \<le> y\<bullet>i"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1619
            using Basis_le_norm[OF i, of "x - y"] and as(1)[rule_format]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1620
            by (auto simp: inner_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1621
        qed (insert y2, auto)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1622
      qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1623
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1624
    ultimately have
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1625
      "\<And>x. x \<in> rel_interior (convex hull insert 0 d) \<longleftrightarrow>
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1626
        x \<in> {x. (\<forall>i\<in>d. 0 < x \<bullet> i) \<and> sum ((\<bullet>) x) d < 1 \<and> (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0)}"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1627
      by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1628
    then show ?thesis by (rule set_eqI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1629
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1630
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1631
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1632
lemma rel_interior_substd_simplex_nonempty:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1633
  assumes "d \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1634
    and "d \<subseteq> Basis"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1635
  obtains a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1636
    where "a \<in> rel_interior (convex hull (insert 0 d))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1637
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1638
  let ?D = d
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1639
  let ?a = "sum (\<lambda>b::'a::euclidean_space. inverse (2 * real (card d)) *\<^sub>R b) ?D"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1640
  have "finite d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1641
    apply (rule finite_subset)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1642
    using assms(2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1643
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1644
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1645
  then have d1: "0 < real (card d)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1646
    using \<open>d \<noteq> {}\<close> by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1647
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1648
    fix i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1649
    assume "i \<in> d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1650
    have "?a \<bullet> i = inverse (2 * real (card d))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1651
      apply (rule trans[of _ "sum (\<lambda>j. if i = j then inverse (2 * real (card d)) else 0) ?D"])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1652
      unfolding inner_sum_left
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1653
      apply (rule sum.cong)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1654
      using \<open>i \<in> d\<close> \<open>finite d\<close> sum.delta'[of d i "(\<lambda>k. inverse (2 * real (card d)))"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1655
        d1 assms(2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1656
      by (auto simp: inner_Basis set_rev_mp[OF _ assms(2)])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1657
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1658
  note ** = this
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1659
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1660
    apply (rule that[of ?a])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1661
    unfolding rel_interior_substd_simplex[OF assms(2)] mem_Collect_eq
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1662
  proof safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1663
    fix i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1664
    assume "i \<in> d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1665
    have "0 < inverse (2 * real (card d))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1666
      using d1 by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1667
    also have "\<dots> = ?a \<bullet> i" using **[of i] \<open>i \<in> d\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1668
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1669
    finally show "0 < ?a \<bullet> i" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1670
  next
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1671
    have "sum ((\<bullet>) ?a) ?D = sum (\<lambda>i. inverse (2 * real (card d))) ?D"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1672
      by (rule sum.cong) (rule refl, rule **)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1673
    also have "\<dots> < 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1674
      unfolding sum_constant divide_real_def[symmetric]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1675
      by (auto simp add: field_simps)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1676
    finally show "sum ((\<bullet>) ?a) ?D < 1" by auto
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1677
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1678
    fix i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1679
    assume "i \<in> Basis" and "i \<notin> d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1680
    have "?a \<in> span d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1681
    proof (rule span_sum[of d "(\<lambda>b. b /\<^sub>R (2 * real (card d)))" d])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1682
      {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1683
        fix x :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1684
        assume "x \<in> d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1685
        then have "x \<in> span d"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  1686
          using span_base[of _ "d"] by auto
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1687
        then have "x /\<^sub>R (2 * real (card d)) \<in> span d"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  1688
          using span_scale[of x "d" "(inverse (real (card d)) / 2)"] by auto
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1689
      }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1690
      then show "\<And>x. x\<in>d \<Longrightarrow> x /\<^sub>R (2 * real (card d)) \<in> span d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1691
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1692
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1693
    then show "?a \<bullet> i = 0 "
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1694
      using \<open>i \<notin> d\<close> unfolding span_substd_basis[OF assms(2)] using \<open>i \<in> Basis\<close> by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1695
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1696
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1697
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1698
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  1699
subsection%unimportant \<open>Relative interior of convex set\<close>
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1700
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1701
lemma rel_interior_convex_nonempty_aux:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1702
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1703
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1704
    and "0 \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1705
  shows "rel_interior S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1706
proof (cases "S = {0}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1707
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1708
  then show ?thesis using rel_interior_sing by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1709
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1710
  case False
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  1711
  obtain B where B: "independent B \<and> B \<le> S \<and> S \<le> span B \<and>
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  1712
  card B = dim S"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1713
    using basis_exists[of S] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1714
  then have "B \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1715
    using B assms \<open>S \<noteq> {0}\<close> span_empty by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1716
  have "insert 0 B \<le> span B"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  1717
    using subspace_span[of B] subspace_0[of "span B"]
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  1718
      span_superset by auto
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1719
  then have "span (insert 0 B) \<le> span B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1720
    using span_span[of B] span_mono[of "insert 0 B" "span B"] by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1721
  then have "convex hull insert 0 B \<le> span B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1722
    using convex_hull_subset_span[of "insert 0 B"] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1723
  then have "span (convex hull insert 0 B) \<le> span B"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  1724
    using span_span[of B]
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  1725
      span_mono[of "convex hull insert 0 B" "span B"] by blast
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1726
  then have *: "span (convex hull insert 0 B) = span B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1727
    using span_mono[of B "convex hull insert 0 B"] hull_subset[of "insert 0 B"] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1728
  then have "span (convex hull insert 0 B) = span S"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  1729
    using B span_mono[of B S] span_mono[of S "span B"]
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  1730
      span_span[of B] by auto
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1731
  moreover have "0 \<in> affine hull (convex hull insert 0 B)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1732
    using hull_subset[of "convex hull insert 0 B"] hull_subset[of "insert 0 B"] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1733
  ultimately have **: "affine hull (convex hull insert 0 B) = affine hull S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1734
    using affine_hull_span_0[of "convex hull insert 0 B"] affine_hull_span_0[of "S"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1735
      assms hull_subset[of S]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1736
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1737
  obtain d and f :: "'n \<Rightarrow> 'n" where
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1738
    fd: "card d = card B" "linear f" "f ` B = d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1739
      "f ` span B = {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = (0::real)} \<and> inj_on f (span B)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1740
    and d: "d \<subseteq> Basis"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1741
    using basis_to_substdbasis_subspace_isomorphism[of B,OF _ ] B by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1742
  then have "bounded_linear f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1743
    using linear_conv_bounded_linear by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1744
  have "d \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1745
    using fd B \<open>B \<noteq> {}\<close> by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1746
  have "insert 0 d = f ` (insert 0 B)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1747
    using fd linear_0 by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1748
  then have "(convex hull (insert 0 d)) = f ` (convex hull (insert 0 B))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1749
    using convex_hull_linear_image[of f "(insert 0 d)"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1750
      convex_hull_linear_image[of f "(insert 0 B)"] \<open>linear f\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1751
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1752
  moreover have "rel_interior (f ` (convex hull insert 0 B)) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1753
    f ` rel_interior (convex hull insert 0 B)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1754
    apply (rule  rel_interior_injective_on_span_linear_image[of f "(convex hull insert 0 B)"])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1755
    using \<open>bounded_linear f\<close> fd *
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1756
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1757
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1758
  ultimately have "rel_interior (convex hull insert 0 B) \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1759
    using rel_interior_substd_simplex_nonempty[OF \<open>d \<noteq> {}\<close> d]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1760
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1761
    apply blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1762
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1763
  moreover have "convex hull (insert 0 B) \<subseteq> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1764
    using B assms hull_mono[of "insert 0 B" "S" "convex"] convex_hull_eq
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1765
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1766
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1767
    using subset_rel_interior[of "convex hull insert 0 B" S] ** by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1768
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1769
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1770
lemma rel_interior_eq_empty:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1771
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1772
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1773
  shows "rel_interior S = {} \<longleftrightarrow> S = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1774
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1775
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1776
    assume "S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1777
    then obtain a where "a \<in> S" by auto
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1778
    then have "0 \<in> (+) (-a) ` S"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1779
      using assms exI[of "(\<lambda>x. x \<in> S \<and> - a + x = 0)" a] by auto
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1780
    then have "rel_interior ((+) (-a) ` S) \<noteq> {}"
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  1781
      using rel_interior_convex_nonempty_aux[of "(+) (-a) ` S"]
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1782
        convex_translation[of S "-a"] assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1783
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1784
    then have "rel_interior S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1785
      using rel_interior_translation by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1786
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1787
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1788
    using rel_interior_empty by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1789
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1790
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1791
lemma interior_simplex_nonempty:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1792
  fixes S :: "'N :: euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1793
  assumes "independent S" "finite S" "card S = DIM('N)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1794
  obtains a where "a \<in> interior (convex hull (insert 0 S))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1795
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1796
  have "affine hull (insert 0 S) = UNIV"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  1797
    by (simp add: hull_inc affine_hull_span_0 dim_eq_full[symmetric]
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  1798
         assms(1) assms(3) dim_eq_card_independent)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1799
  moreover have "rel_interior (convex hull insert 0 S) \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1800
    using rel_interior_eq_empty [of "convex hull (insert 0 S)"] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1801
  ultimately have "interior (convex hull insert 0 S) \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1802
    by (simp add: rel_interior_interior)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1803
  with that show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1804
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1805
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1806
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1807
lemma convex_rel_interior:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1808
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1809
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1810
  shows "convex (rel_interior S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1811
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1812
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1813
    fix x y and u :: real
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1814
    assume assm: "x \<in> rel_interior S" "y \<in> rel_interior S" "0 \<le> u" "u \<le> 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1815
    then have "x \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1816
      using rel_interior_subset by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1817
    have "x - u *\<^sub>R (x-y) \<in> rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1818
    proof (cases "0 = u")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1819
      case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1820
      then have "0 < u" using assm by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1821
      then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1822
        using assm rel_interior_convex_shrink[of S y x u] assms \<open>x \<in> S\<close> by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1823
    next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1824
      case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1825
      then show ?thesis using assm by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1826
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1827
    then have "(1 - u) *\<^sub>R x + u *\<^sub>R y \<in> rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1828
      by (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1829
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1830
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1831
    unfolding convex_alt by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1832
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1833
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1834
lemma convex_closure_rel_interior:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1835
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1836
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1837
  shows "closure (rel_interior S) = closure S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1838
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1839
  have h1: "closure (rel_interior S) \<le> closure S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1840
    using closure_mono[of "rel_interior S" S] rel_interior_subset[of S] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1841
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1842
  proof (cases "S = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1843
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1844
    then obtain a where a: "a \<in> rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1845
      using rel_interior_eq_empty assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1846
    { fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1847
      assume x: "x \<in> closure S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1848
      {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1849
        assume "x = a"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1850
        then have "x \<in> closure (rel_interior S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1851
          using a unfolding closure_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1852
      }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1853
      moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1854
      {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1855
        assume "x \<noteq> a"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1856
         {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1857
           fix e :: real
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1858
           assume "e > 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1859
           define e1 where "e1 = min 1 (e/norm (x - a))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1860
           then have e1: "e1 > 0" "e1 \<le> 1" "e1 * norm (x - a) \<le> e"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1861
             using \<open>x \<noteq> a\<close> \<open>e > 0\<close> le_divide_eq[of e1 e "norm (x - a)"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1862
             by simp_all
67613
ce654b0e6d69 more symbols;
wenzelm
parents: 67443
diff changeset
  1863
           then have *: "x - e1 *\<^sub>R (x - a) \<in> rel_interior S"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1864
             using rel_interior_closure_convex_shrink[of S a x e1] assms x a e1_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1865
             by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1866
           have "\<exists>y. y \<in> rel_interior S \<and> y \<noteq> x \<and> dist y x \<le> e"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1867
              apply (rule_tac x="x - e1 *\<^sub>R (x - a)" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1868
              using * e1 dist_norm[of "x - e1 *\<^sub>R (x - a)" x] \<open>x \<noteq> a\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1869
              apply simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1870
              done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1871
        }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1872
        then have "x islimpt rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1873
          unfolding islimpt_approachable_le by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1874
        then have "x \<in> closure(rel_interior S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1875
          unfolding closure_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1876
      }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1877
      ultimately have "x \<in> closure(rel_interior S)" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1878
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1879
    then show ?thesis using h1 by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1880
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1881
    case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1882
    then have "rel_interior S = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1883
      using rel_interior_empty by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1884
    then have "closure (rel_interior S) = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1885
      using closure_empty by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1886
    with True show ?thesis by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1887
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1888
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1889
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1890
lemma rel_interior_same_affine_hull:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1891
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1892
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1893
  shows "affine hull (rel_interior S) = affine hull S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1894
  by (metis assms closure_same_affine_hull convex_closure_rel_interior)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1895
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1896
lemma rel_interior_aff_dim:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1897
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1898
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1899
  shows "aff_dim (rel_interior S) = aff_dim S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1900
  by (metis aff_dim_affine_hull2 assms rel_interior_same_affine_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1901
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1902
lemma rel_interior_rel_interior:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1903
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1904
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1905
  shows "rel_interior (rel_interior S) = rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1906
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1907
  have "openin (subtopology euclidean (affine hull (rel_interior S))) (rel_interior S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1908
    using openin_rel_interior[of S] rel_interior_same_affine_hull[of S] assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1909
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1910
    using rel_interior_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1911
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1912
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1913
lemma rel_interior_rel_open:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1914
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1915
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1916
  shows "rel_open (rel_interior S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1917
  unfolding rel_open_def using rel_interior_rel_interior assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1918
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1919
lemma convex_rel_interior_closure_aux:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1920
  fixes x y z :: "'n::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1921
  assumes "0 < a" "0 < b" "(a + b) *\<^sub>R z = a *\<^sub>R x + b *\<^sub>R y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1922
  obtains e where "0 < e" "e \<le> 1" "z = y - e *\<^sub>R (y - x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1923
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1924
  define e where "e = a / (a + b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1925
  have "z = (1 / (a + b)) *\<^sub>R ((a + b) *\<^sub>R z)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1926
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1927
    using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1928
    apply simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1929
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1930
  also have "\<dots> = (1 / (a + b)) *\<^sub>R (a *\<^sub>R x + b *\<^sub>R y)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1931
    using assms scaleR_cancel_left[of "1/(a+b)" "(a + b) *\<^sub>R z" "a *\<^sub>R x + b *\<^sub>R y"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1932
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1933
  also have "\<dots> = y - e *\<^sub>R (y-x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1934
    using e_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1935
    apply (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1936
    using scaleR_left_distrib[of "a/(a+b)" "b/(a+b)" y] assms add_divide_distrib[of a b "a+b"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1937
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1938
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1939
  finally have "z = y - e *\<^sub>R (y-x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1940
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1941
  moreover have "e > 0" using e_def assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1942
  moreover have "e \<le> 1" using e_def assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1943
  ultimately show ?thesis using that[of e] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1944
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1945
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1946
lemma convex_rel_interior_closure:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1947
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1948
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1949
  shows "rel_interior (closure S) = rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1950
proof (cases "S = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1951
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1952
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1953
    using assms rel_interior_eq_empty by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1954
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1955
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1956
  have "rel_interior (closure S) \<supseteq> rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1957
    using subset_rel_interior[of S "closure S"] closure_same_affine_hull closure_subset
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1958
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1959
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1960
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1961
    fix z
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1962
    assume z: "z \<in> rel_interior (closure S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1963
    obtain x where x: "x \<in> rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1964
      using \<open>S \<noteq> {}\<close> assms rel_interior_eq_empty by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1965
    have "z \<in> rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1966
    proof (cases "x = z")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1967
      case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1968
      then show ?thesis using x by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1969
    next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1970
      case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1971
      obtain e where e: "e > 0" "cball z e \<inter> affine hull closure S \<le> closure S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1972
        using z rel_interior_cball[of "closure S"] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1973
      hence *: "0 < e/norm(z-x)" using e False by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1974
      define y where "y = z + (e/norm(z-x)) *\<^sub>R (z-x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1975
      have yball: "y \<in> cball z e"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1976
        using mem_cball y_def dist_norm[of z y] e by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1977
      have "x \<in> affine hull closure S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1978
        using x rel_interior_subset_closure hull_inc[of x "closure S"] by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1979
      moreover have "z \<in> affine hull closure S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1980
        using z rel_interior_subset hull_subset[of "closure S"] by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1981
      ultimately have "y \<in> affine hull closure S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1982
        using y_def affine_affine_hull[of "closure S"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1983
          mem_affine_3_minus [of "affine hull closure S" z z x "e/norm(z-x)"] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1984
      then have "y \<in> closure S" using e yball by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1985
      have "(1 + (e/norm(z-x))) *\<^sub>R z = (e/norm(z-x)) *\<^sub>R x + y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1986
        using y_def by (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1987
      then obtain e1 where "0 < e1" "e1 \<le> 1" "z = y - e1 *\<^sub>R (y - x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1988
        using * convex_rel_interior_closure_aux[of "e / norm (z - x)" 1 z x y]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1989
        by (auto simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1990
      then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1991
        using rel_interior_closure_convex_shrink assms x \<open>y \<in> closure S\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1992
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1993
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1994
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1995
  ultimately show ?thesis by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1996
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1997
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1998
lemma convex_interior_closure:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1999
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2000
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2001
  shows "interior (closure S) = interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2002
  using closure_aff_dim[of S] interior_rel_interior_gen[of S]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2003
    interior_rel_interior_gen[of "closure S"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2004
    convex_rel_interior_closure[of S] assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2005
  by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2006
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2007
lemma closure_eq_rel_interior_eq:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2008
  fixes S1 S2 :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2009
  assumes "convex S1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2010
    and "convex S2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2011
  shows "closure S1 = closure S2 \<longleftrightarrow> rel_interior S1 = rel_interior S2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2012
  by (metis convex_rel_interior_closure convex_closure_rel_interior assms)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2013
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2014
lemma closure_eq_between:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2015
  fixes S1 S2 :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2016
  assumes "convex S1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2017
    and "convex S2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2018
  shows "closure S1 = closure S2 \<longleftrightarrow> rel_interior S1 \<le> S2 \<and> S2 \<subseteq> closure S1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2019
  (is "?A \<longleftrightarrow> ?B")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2020
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2021
  assume ?A
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2022
  then show ?B
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2023
    by (metis assms closure_subset convex_rel_interior_closure rel_interior_subset)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2024
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2025
  assume ?B
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2026
  then have "closure S1 \<subseteq> closure S2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2027
    by (metis assms(1) convex_closure_rel_interior closure_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2028
  moreover from \<open>?B\<close> have "closure S1 \<supseteq> closure S2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2029
    by (metis closed_closure closure_minimal)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2030
  ultimately show ?A ..
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2031
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2032
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2033
lemma open_inter_closure_rel_interior:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2034
  fixes S A :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2035
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2036
    and "open A"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2037
  shows "A \<inter> closure S = {} \<longleftrightarrow> A \<inter> rel_interior S = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2038
  by (metis assms convex_closure_rel_interior open_Int_closure_eq_empty)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2039
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2040
lemma rel_interior_open_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2041
  fixes a :: "'a :: euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2042
  shows "rel_interior(open_segment a b) = open_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2043
proof (cases "a = b")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2044
  case True then show ?thesis by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2045
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2046
  case False then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2047
    apply (simp add: rel_interior_eq openin_open)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2048
    apply (rule_tac x="ball (inverse 2 *\<^sub>R (a + b)) (norm(b - a) / 2)" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2049
    apply (simp add: open_segment_as_ball)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2050
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2051
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2052
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2053
lemma rel_interior_closed_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2054
  fixes a :: "'a :: euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2055
  shows "rel_interior(closed_segment a b) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2056
         (if a = b then {a} else open_segment a b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2057
proof (cases "a = b")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2058
  case True then show ?thesis by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2059
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2060
  case False then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2061
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2062
       (metis closure_open_segment convex_open_segment convex_rel_interior_closure
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2063
              rel_interior_open_segment)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2064
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2065
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2066
lemmas rel_interior_segment = rel_interior_closed_segment rel_interior_open_segment
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2067
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2068
lemma starlike_convex_tweak_boundary_points:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2069
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2070
  assumes "convex S" "S \<noteq> {}" and ST: "rel_interior S \<subseteq> T" and TS: "T \<subseteq> closure S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2071
  shows "starlike T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2072
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2073
  have "rel_interior S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2074
    by (simp add: assms rel_interior_eq_empty)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2075
  then obtain a where a: "a \<in> rel_interior S"  by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2076
  with ST have "a \<in> T"  by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2077
  have *: "\<And>x. x \<in> T \<Longrightarrow> open_segment a x \<subseteq> rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2078
    apply (rule rel_interior_closure_convex_segment [OF \<open>convex S\<close> a])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2079
    using assms by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2080
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2081
    unfolding starlike_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2082
    apply (rule bexI [OF _ \<open>a \<in> T\<close>])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2083
    apply (simp add: closed_segment_eq_open)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2084
    apply (intro conjI ballI a \<open>a \<in> T\<close> rel_interior_closure_convex_segment [OF \<open>convex S\<close> a])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2085
    apply (simp add: order_trans [OF * ST])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2086
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2087
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2088
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2089
subsection\<open>The relative frontier of a set\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2090
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  2091
definition%important "rel_frontier S = closure S - rel_interior S"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2092
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2093
lemma rel_frontier_empty [simp]: "rel_frontier {} = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2094
  by (simp add: rel_frontier_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2095
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2096
lemma rel_frontier_eq_empty:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2097
    fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2098
    shows "rel_frontier S = {} \<longleftrightarrow> affine S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2099
  apply (simp add: rel_frontier_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2100
  apply (simp add: rel_interior_eq_closure [symmetric])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2101
  using rel_interior_subset_closure by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2102
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2103
lemma rel_frontier_sing [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2104
    fixes a :: "'n::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2105
    shows "rel_frontier {a} = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2106
  by (simp add: rel_frontier_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2107
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2108
lemma rel_frontier_affine_hull:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2109
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2110
  shows "rel_frontier S \<subseteq> affine hull S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2111
using closure_affine_hull rel_frontier_def by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2112
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2113
lemma rel_frontier_cball [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2114
    fixes a :: "'n::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2115
    shows "rel_frontier(cball a r) = (if r = 0 then {} else sphere a r)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2116
proof (cases rule: linorder_cases [of r 0])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2117
  case less then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2118
    by (force simp: sphere_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2119
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2120
  case equal then show ?thesis by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2121
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2122
  case greater then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2123
    apply simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2124
    by (metis centre_in_ball empty_iff frontier_cball frontier_def interior_cball interior_rel_interior_gen rel_frontier_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2125
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2126
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2127
lemma rel_frontier_translation:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2128
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2129
  shows "rel_frontier((\<lambda>x. a + x) ` S) = (\<lambda>x. a + x) ` (rel_frontier S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2130
by (simp add: rel_frontier_def translation_diff rel_interior_translation closure_translation)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2131
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2132
lemma closed_affine_hull [iff]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2133
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2134
  shows "closed (affine hull S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2135
  by (metis affine_affine_hull affine_closed)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2136
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2137
lemma rel_frontier_nonempty_interior:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2138
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2139
  shows "interior S \<noteq> {} \<Longrightarrow> rel_frontier S = frontier S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2140
by (metis frontier_def interior_rel_interior_gen rel_frontier_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2141
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2142
lemma rel_frontier_frontier:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2143
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2144
  shows "affine hull S = UNIV \<Longrightarrow> rel_frontier S = frontier S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2145
by (simp add: frontier_def rel_frontier_def rel_interior_interior)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2146
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2147
lemma closest_point_in_rel_frontier:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2148
   "\<lbrakk>closed S; S \<noteq> {}; x \<in> affine hull S - rel_interior S\<rbrakk>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2149
   \<Longrightarrow> closest_point S x \<in> rel_frontier S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2150
  by (simp add: closest_point_in_rel_interior closest_point_in_set rel_frontier_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2151
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2152
lemma closed_rel_frontier [iff]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2153
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2154
  shows "closed (rel_frontier S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2155
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2156
  have *: "closedin (subtopology euclidean (affine hull S)) (closure S - rel_interior S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2157
    by (simp add: closed_subset closedin_diff closure_affine_hull openin_rel_interior)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2158
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2159
    apply (rule closedin_closed_trans[of "affine hull S" "rel_frontier S"])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2160
    unfolding rel_frontier_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2161
    using * closed_affine_hull
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2162
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2163
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2164
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2165
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2166
lemma closed_rel_boundary:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2167
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2168
  shows "closed S \<Longrightarrow> closed(S - rel_interior S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2169
by (metis closed_rel_frontier closure_closed rel_frontier_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2170
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2171
lemma compact_rel_boundary:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2172
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2173
  shows "compact S \<Longrightarrow> compact(S - rel_interior S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2174
by (metis bounded_diff closed_rel_boundary closure_eq compact_closure compact_imp_closed)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2175
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2176
lemma bounded_rel_frontier:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2177
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2178
  shows "bounded S \<Longrightarrow> bounded(rel_frontier S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2179
by (simp add: bounded_closure bounded_diff rel_frontier_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2180
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2181
lemma compact_rel_frontier_bounded:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2182
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2183
  shows "bounded S \<Longrightarrow> compact(rel_frontier S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2184
using bounded_rel_frontier closed_rel_frontier compact_eq_bounded_closed by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2185
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2186
lemma compact_rel_frontier:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2187
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2188
  shows "compact S \<Longrightarrow> compact(rel_frontier S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2189
by (meson compact_eq_bounded_closed compact_rel_frontier_bounded)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2190
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2191
lemma convex_same_rel_interior_closure:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2192
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2193
  shows "\<lbrakk>convex S; convex T\<rbrakk>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2194
         \<Longrightarrow> rel_interior S = rel_interior T \<longleftrightarrow> closure S = closure T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2195
by (simp add: closure_eq_rel_interior_eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2196
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2197
lemma convex_same_rel_interior_closure_straddle:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2198
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2199
  shows "\<lbrakk>convex S; convex T\<rbrakk>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2200
         \<Longrightarrow> rel_interior S = rel_interior T \<longleftrightarrow>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2201
             rel_interior S \<subseteq> T \<and> T \<subseteq> closure S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2202
by (simp add: closure_eq_between convex_same_rel_interior_closure)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2203
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2204
lemma convex_rel_frontier_aff_dim:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2205
  fixes S1 S2 :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2206
  assumes "convex S1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2207
    and "convex S2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2208
    and "S2 \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2209
    and "S1 \<le> rel_frontier S2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2210
  shows "aff_dim S1 < aff_dim S2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2211
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2212
  have "S1 \<subseteq> closure S2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2213
    using assms unfolding rel_frontier_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2214
  then have *: "affine hull S1 \<subseteq> affine hull S2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2215
    using hull_mono[of "S1" "closure S2"] closure_same_affine_hull[of S2] by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2216
  then have "aff_dim S1 \<le> aff_dim S2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2217
    using * aff_dim_affine_hull[of S1] aff_dim_affine_hull[of S2]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2218
      aff_dim_subset[of "affine hull S1" "affine hull S2"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2219
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2220
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2221
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2222
    assume eq: "aff_dim S1 = aff_dim S2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2223
    then have "S1 \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2224
      using aff_dim_empty[of S1] aff_dim_empty[of S2] \<open>S2 \<noteq> {}\<close> by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2225
    have **: "affine hull S1 = affine hull S2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2226
       apply (rule affine_dim_equal)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2227
       using * affine_affine_hull
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2228
       apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2229
       using \<open>S1 \<noteq> {}\<close> hull_subset[of S1]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2230
       apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2231
       using eq aff_dim_affine_hull[of S1] aff_dim_affine_hull[of S2]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2232
       apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2233
       done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2234
    obtain a where a: "a \<in> rel_interior S1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2235
      using \<open>S1 \<noteq> {}\<close> rel_interior_eq_empty assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2236
    obtain T where T: "open T" "a \<in> T \<inter> S1" "T \<inter> affine hull S1 \<subseteq> S1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2237
       using mem_rel_interior[of a S1] a by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2238
    then have "a \<in> T \<inter> closure S2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2239
      using a assms unfolding rel_frontier_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2240
    then obtain b where b: "b \<in> T \<inter> rel_interior S2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2241
      using open_inter_closure_rel_interior[of S2 T] assms T by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2242
    then have "b \<in> affine hull S1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2243
      using rel_interior_subset hull_subset[of S2] ** by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2244
    then have "b \<in> S1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2245
      using T b by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2246
    then have False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2247
      using b assms unfolding rel_frontier_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2248
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2249
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2250
    using less_le by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2251
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2252
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2253
lemma convex_rel_interior_if:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2254
  fixes S ::  "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2255
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2256
    and "z \<in> rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2257
  shows "\<forall>x\<in>affine hull S. \<exists>m. m > 1 \<and> (\<forall>e. e > 1 \<and> e \<le> m \<longrightarrow> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2258
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2259
  obtain e1 where e1: "e1 > 0 \<and> cball z e1 \<inter> affine hull S \<subseteq> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2260
    using mem_rel_interior_cball[of z S] assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2261
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2262
    fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2263
    assume x: "x \<in> affine hull S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2264
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2265
      assume "x \<noteq> z"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2266
      define m where "m = 1 + e1/norm(x-z)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2267
      hence "m > 1" using e1 \<open>x \<noteq> z\<close> by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2268
      {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2269
        fix e
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2270
        assume e: "e > 1 \<and> e \<le> m"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2271
        have "z \<in> affine hull S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2272
          using assms rel_interior_subset hull_subset[of S] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2273
        then have *: "(1 - e)*\<^sub>R x + e *\<^sub>R z \<in> affine hull S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2274
          using mem_affine[of "affine hull S" x z "(1-e)" e] affine_affine_hull[of S] x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2275
          by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2276
        have "norm (z + e *\<^sub>R x - (x + e *\<^sub>R z)) = norm ((e - 1) *\<^sub>R (x - z))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2277
          by (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2278
        also have "\<dots> = (e - 1) * norm (x-z)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2279
          using norm_scaleR e by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2280
        also have "\<dots> \<le> (m - 1) * norm (x - z)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2281
          using e mult_right_mono[of _ _ "norm(x-z)"] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2282
        also have "\<dots> = (e1 / norm (x - z)) * norm (x - z)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2283
          using m_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2284
        also have "\<dots> = e1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2285
          using \<open>x \<noteq> z\<close> e1 by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2286
        finally have **: "norm (z + e *\<^sub>R x - (x + e *\<^sub>R z)) \<le> e1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2287
          by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2288
        have "(1 - e)*\<^sub>R x+ e *\<^sub>R z \<in> cball z e1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2289
          using m_def **
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2290
          unfolding cball_def dist_norm
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2291
          by (auto simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2292
        then have "(1 - e) *\<^sub>R x+ e *\<^sub>R z \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2293
          using e * e1 by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2294
      }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2295
      then have "\<exists>m. m > 1 \<and> (\<forall>e. e > 1 \<and> e \<le> m \<longrightarrow> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S )"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2296
        using \<open>m> 1 \<close> by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2297
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2298
    moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2299
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2300
      assume "x = z"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2301
      define m where "m = 1 + e1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2302
      then have "m > 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2303
        using e1 by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2304
      {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2305
        fix e
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2306
        assume e: "e > 1 \<and> e \<le> m"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2307
        then have "(1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2308
          using e1 x \<open>x = z\<close> by (auto simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2309
        then have "(1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2310
          using e by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2311
      }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2312
      then have "\<exists>m. m > 1 \<and> (\<forall>e. e > 1 \<and> e \<le> m \<longrightarrow> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2313
        using \<open>m > 1\<close> by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2314
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2315
    ultimately have "\<exists>m. m > 1 \<and> (\<forall>e. e > 1 \<and> e \<le> m \<longrightarrow> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S )"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2316
      by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2317
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2318
  then show ?thesis by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2319
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2320
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2321
lemma convex_rel_interior_if2:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2322
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2323
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2324
  assumes "z \<in> rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2325
  shows "\<forall>x\<in>affine hull S. \<exists>e. e > 1 \<and> (1 - e)*\<^sub>R x + e *\<^sub>R z \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2326
  using convex_rel_interior_if[of S z] assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2327
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2328
lemma convex_rel_interior_only_if:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2329
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2330
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2331
    and "S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2332
  assumes "\<forall>x\<in>S. \<exists>e. e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2333
  shows "z \<in> rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2334
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2335
  obtain x where x: "x \<in> rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2336
    using rel_interior_eq_empty assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2337
  then have "x \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2338
    using rel_interior_subset by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2339
  then obtain e where e: "e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2340
    using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2341
  define y where [abs_def]: "y = (1 - e) *\<^sub>R x + e *\<^sub>R z"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2342
  then have "y \<in> S" using e by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2343
  define e1 where "e1 = 1/e"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2344
  then have "0 < e1 \<and> e1 < 1" using e by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2345
  then have "z  =y - (1 - e1) *\<^sub>R (y - x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2346
    using e1_def y_def by (auto simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2347
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2348
    using rel_interior_convex_shrink[of S x y "1-e1"] \<open>0 < e1 \<and> e1 < 1\<close> \<open>y \<in> S\<close> x assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2349
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2350
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2351
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2352
lemma convex_rel_interior_iff:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2353
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2354
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2355
    and "S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2356
  shows "z \<in> rel_interior S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e. e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2357
  using assms hull_subset[of S "affine"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2358
    convex_rel_interior_if[of S z] convex_rel_interior_only_if[of S z]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2359
  by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2360
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2361
lemma convex_rel_interior_iff2:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2362
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2363
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2364
    and "S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2365
  shows "z \<in> rel_interior S \<longleftrightarrow> (\<forall>x\<in>affine hull S. \<exists>e. e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2366
  using assms hull_subset[of S] convex_rel_interior_if2[of S z] convex_rel_interior_only_if[of S z]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2367
  by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2368
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2369
lemma convex_interior_iff:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2370
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2371
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2372
  shows "z \<in> interior S \<longleftrightarrow> (\<forall>x. \<exists>e. e > 0 \<and> z + e *\<^sub>R x \<in> S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2373
proof (cases "aff_dim S = int DIM('n)")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2374
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2375
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2376
    assume "z \<in> interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2377
    then have False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2378
      using False interior_rel_interior_gen[of S] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2379
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2380
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2381
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2382
    assume r: "\<forall>x. \<exists>e. e > 0 \<and> z + e *\<^sub>R x \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2383
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2384
      fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2385
      obtain e1 where e1: "e1 > 0 \<and> z + e1 *\<^sub>R (x - z) \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2386
        using r by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2387
      obtain e2 where e2: "e2 > 0 \<and> z + e2 *\<^sub>R (z - x) \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2388
        using r by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2389
      define x1 where [abs_def]: "x1 = z + e1 *\<^sub>R (x - z)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2390
      then have x1: "x1 \<in> affine hull S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2391
        using e1 hull_subset[of S] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2392
      define x2 where [abs_def]: "x2 = z + e2 *\<^sub>R (z - x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2393
      then have x2: "x2 \<in> affine hull S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2394
        using e2 hull_subset[of S] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2395
      have *: "e1/(e1+e2) + e2/(e1+e2) = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2396
        using add_divide_distrib[of e1 e2 "e1+e2"] e1 e2 by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2397
      then have "z = (e2/(e1+e2)) *\<^sub>R x1 + (e1/(e1+e2)) *\<^sub>R x2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2398
        using x1_def x2_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2399
        apply (auto simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2400
        using scaleR_left_distrib[of "e1/(e1+e2)" "e2/(e1+e2)" z]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2401
        apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2402
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2403
      then have z: "z \<in> affine hull S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2404
        using mem_affine[of "affine hull S" x1 x2 "e2/(e1+e2)" "e1/(e1+e2)"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2405
          x1 x2 affine_affine_hull[of S] *
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2406
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2407
      have "x1 - x2 = (e1 + e2) *\<^sub>R (x - z)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2408
        using x1_def x2_def by (auto simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2409
      then have "x = z+(1/(e1+e2)) *\<^sub>R (x1-x2)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2410
        using e1 e2 by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2411
      then have "x \<in> affine hull S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2412
        using mem_affine_3_minus[of "affine hull S" z x1 x2 "1/(e1+e2)"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2413
          x1 x2 z affine_affine_hull[of S]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2414
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2415
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2416
    then have "affine hull S = UNIV"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2417
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2418
    then have "aff_dim S = int DIM('n)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2419
      using aff_dim_affine_hull[of S] by (simp add: aff_dim_UNIV)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2420
    then have False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2421
      using False by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2422
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2423
  ultimately show ?thesis by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2424
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2425
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2426
  then have "S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2427
    using aff_dim_empty[of S] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2428
  have *: "affine hull S = UNIV"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2429
    using True affine_hull_UNIV by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2430
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2431
    assume "z \<in> interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2432
    then have "z \<in> rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2433
      using True interior_rel_interior_gen[of S] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2434
    then have **: "\<forall>x. \<exists>e. e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2435
      using convex_rel_interior_iff2[of S z] assms \<open>S \<noteq> {}\<close> * by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2436
    fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2437
    obtain e1 where e1: "e1 > 1" "(1 - e1) *\<^sub>R (z - x) + e1 *\<^sub>R z \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2438
      using **[rule_format, of "z-x"] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2439
    define e where [abs_def]: "e = e1 - 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2440
    then have "(1 - e1) *\<^sub>R (z - x) + e1 *\<^sub>R z = z + e *\<^sub>R x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2441
      by (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2442
    then have "e > 0" "z + e *\<^sub>R x \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2443
      using e1 e_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2444
    then have "\<exists>e. e > 0 \<and> z + e *\<^sub>R x \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2445
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2446
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2447
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2448
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2449
    assume r: "\<forall>x. \<exists>e. e > 0 \<and> z + e *\<^sub>R x \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2450
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2451
      fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2452
      obtain e1 where e1: "e1 > 0" "z + e1 *\<^sub>R (z - x) \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2453
        using r[rule_format, of "z-x"] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2454
      define e where "e = e1 + 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2455
      then have "z + e1 *\<^sub>R (z - x) = (1 - e) *\<^sub>R x + e *\<^sub>R z"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2456
        by (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2457
      then have "e > 1" "(1 - e)*\<^sub>R x + e *\<^sub>R z \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2458
        using e1 e_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2459
      then have "\<exists>e. e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2460
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2461
    then have "z \<in> rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2462
      using convex_rel_interior_iff2[of S z] assms \<open>S \<noteq> {}\<close> by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2463
    then have "z \<in> interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2464
      using True interior_rel_interior_gen[of S] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2465
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2466
  ultimately show ?thesis by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2467
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2468
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2469
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  2470
subsubsection%unimportant \<open>Relative interior and closure under common operations\<close>
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2471
67613
ce654b0e6d69 more symbols;
wenzelm
parents: 67443
diff changeset
  2472
lemma rel_interior_inter_aux: "\<Inter>{rel_interior S |S. S \<in> I} \<subseteq> \<Inter>I"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2473
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2474
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2475
    fix y
67613
ce654b0e6d69 more symbols;
wenzelm
parents: 67443
diff changeset
  2476
    assume "y \<in> \<Inter>{rel_interior S |S. S \<in> I}"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2477
    then have y: "\<forall>S \<in> I. y \<in> rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2478
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2479
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2480
      fix S
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2481
      assume "S \<in> I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2482
      then have "y \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2483
        using rel_interior_subset y by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2484
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2485
    then have "y \<in> \<Inter>I" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2486
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2487
  then show ?thesis by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2488
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2489
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2490
lemma closure_Int: "closure (\<Inter>I) \<le> \<Inter>{closure S |S. S \<in> I}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2491
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2492
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2493
    fix y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2494
    assume "y \<in> \<Inter>I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2495
    then have y: "\<forall>S \<in> I. y \<in> S" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2496
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2497
      fix S
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2498
      assume "S \<in> I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2499
      then have "y \<in> closure S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2500
        using closure_subset y by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2501
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2502
    then have "y \<in> \<Inter>{closure S |S. S \<in> I}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2503
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2504
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2505
  then have "\<Inter>I \<subseteq> \<Inter>{closure S |S. S \<in> I}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2506
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2507
  moreover have "closed (\<Inter>{closure S |S. S \<in> I})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2508
    unfolding closed_Inter closed_closure by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2509
  ultimately show ?thesis using closure_hull[of "\<Inter>I"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2510
    hull_minimal[of "\<Inter>I" "\<Inter>{closure S |S. S \<in> I}" "closed"] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2511
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2512
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2513
lemma convex_closure_rel_interior_inter:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2514
  assumes "\<forall>S\<in>I. convex (S :: 'n::euclidean_space set)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2515
    and "\<Inter>{rel_interior S |S. S \<in> I} \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2516
  shows "\<Inter>{closure S |S. S \<in> I} \<le> closure (\<Inter>{rel_interior S |S. S \<in> I})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2517
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2518
  obtain x where x: "\<forall>S\<in>I. x \<in> rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2519
    using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2520
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2521
    fix y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2522
    assume "y \<in> \<Inter>{closure S |S. S \<in> I}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2523
    then have y: "\<forall>S \<in> I. y \<in> closure S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2524
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2525
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2526
      assume "y = x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2527
      then have "y \<in> closure (\<Inter>{rel_interior S |S. S \<in> I})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2528
        using x closure_subset[of "\<Inter>{rel_interior S |S. S \<in> I}"] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2529
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2530
    moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2531
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2532
      assume "y \<noteq> x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2533
      { fix e :: real
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2534
        assume e: "e > 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2535
        define e1 where "e1 = min 1 (e/norm (y - x))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2536
        then have e1: "e1 > 0" "e1 \<le> 1" "e1 * norm (y - x) \<le> e"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2537
          using \<open>y \<noteq> x\<close> \<open>e > 0\<close> le_divide_eq[of e1 e "norm (y - x)"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2538
          by simp_all
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2539
        define z where "z = y - e1 *\<^sub>R (y - x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2540
        {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2541
          fix S
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2542
          assume "S \<in> I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2543
          then have "z \<in> rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2544
            using rel_interior_closure_convex_shrink[of S x y e1] assms x y e1 z_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2545
            by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2546
        }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2547
        then have *: "z \<in> \<Inter>{rel_interior S |S. S \<in> I}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2548
          by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2549
        have "\<exists>z. z \<in> \<Inter>{rel_interior S |S. S \<in> I} \<and> z \<noteq> y \<and> dist z y \<le> e"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2550
          apply (rule_tac x="z" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2551
          using \<open>y \<noteq> x\<close> z_def * e1 e dist_norm[of z y]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2552
          apply simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2553
          done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2554
      }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2555
      then have "y islimpt \<Inter>{rel_interior S |S. S \<in> I}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2556
        unfolding islimpt_approachable_le by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2557
      then have "y \<in> closure (\<Inter>{rel_interior S |S. S \<in> I})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2558
        unfolding closure_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2559
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2560
    ultimately have "y \<in> closure (\<Inter>{rel_interior S |S. S \<in> I})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2561
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2562
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2563
  then show ?thesis by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2564
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2565
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2566
lemma convex_closure_inter:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2567
  assumes "\<forall>S\<in>I. convex (S :: 'n::euclidean_space set)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2568
    and "\<Inter>{rel_interior S |S. S \<in> I} \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2569
  shows "closure (\<Inter>I) = \<Inter>{closure S |S. S \<in> I}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2570
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2571
  have "\<Inter>{closure S |S. S \<in> I} \<le> closure (\<Inter>{rel_interior S |S. S \<in> I})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2572
    using convex_closure_rel_interior_inter assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2573
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2574
  have "closure (\<Inter>{rel_interior S |S. S \<in> I}) \<le> closure (\<Inter>I)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2575
    using rel_interior_inter_aux closure_mono[of "\<Inter>{rel_interior S |S. S \<in> I}" "\<Inter>I"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2576
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2577
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2578
    using closure_Int[of I] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2579
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2580
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2581
lemma convex_inter_rel_interior_same_closure:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2582
  assumes "\<forall>S\<in>I. convex (S :: 'n::euclidean_space set)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2583
    and "\<Inter>{rel_interior S |S. S \<in> I} \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2584
  shows "closure (\<Inter>{rel_interior S |S. S \<in> I}) = closure (\<Inter>I)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2585
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2586
  have "\<Inter>{closure S |S. S \<in> I} \<le> closure (\<Inter>{rel_interior S |S. S \<in> I})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2587
    using convex_closure_rel_interior_inter assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2588
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2589
  have "closure (\<Inter>{rel_interior S |S. S \<in> I}) \<le> closure (\<Inter>I)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2590
    using rel_interior_inter_aux closure_mono[of "\<Inter>{rel_interior S |S. S \<in> I}" "\<Inter>I"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2591
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2592
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2593
    using closure_Int[of I] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2594
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2595
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2596
lemma convex_rel_interior_inter:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2597
  assumes "\<forall>S\<in>I. convex (S :: 'n::euclidean_space set)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2598
    and "\<Inter>{rel_interior S |S. S \<in> I} \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2599
  shows "rel_interior (\<Inter>I) \<subseteq> \<Inter>{rel_interior S |S. S \<in> I}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2600
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2601
  have "convex (\<Inter>I)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2602
    using assms convex_Inter by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2603
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2604
  have "convex (\<Inter>{rel_interior S |S. S \<in> I})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2605
    apply (rule convex_Inter)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2606
    using assms convex_rel_interior
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2607
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2608
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2609
  ultimately
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2610
  have "rel_interior (\<Inter>{rel_interior S |S. S \<in> I}) = rel_interior (\<Inter>I)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2611
    using convex_inter_rel_interior_same_closure assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2612
      closure_eq_rel_interior_eq[of "\<Inter>{rel_interior S |S. S \<in> I}" "\<Inter>I"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2613
    by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2614
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2615
    using rel_interior_subset[of "\<Inter>{rel_interior S |S. S \<in> I}"] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2616
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2617
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2618
lemma convex_rel_interior_finite_inter:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2619
  assumes "\<forall>S\<in>I. convex (S :: 'n::euclidean_space set)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2620
    and "\<Inter>{rel_interior S |S. S \<in> I} \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2621
    and "finite I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2622
  shows "rel_interior (\<Inter>I) = \<Inter>{rel_interior S |S. S \<in> I}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2623
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2624
  have "\<Inter>I \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2625
    using assms rel_interior_inter_aux[of I] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2626
  have "convex (\<Inter>I)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2627
    using convex_Inter assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2628
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2629
  proof (cases "I = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2630
    case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2631
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2632
      using Inter_empty rel_interior_UNIV by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2633
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2634
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2635
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2636
      fix z
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2637
      assume z: "z \<in> \<Inter>{rel_interior S |S. S \<in> I}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2638
      {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2639
        fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2640
        assume x: "x \<in> \<Inter>I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2641
        {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2642
          fix S
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2643
          assume S: "S \<in> I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2644
          then have "z \<in> rel_interior S" "x \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2645
            using z x by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2646
          then have "\<exists>m. m > 1 \<and> (\<forall>e. e > 1 \<and> e \<le> m \<longrightarrow> (1 - e)*\<^sub>R x + e *\<^sub>R z \<in> S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2647
            using convex_rel_interior_if[of S z] S assms hull_subset[of S] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2648
        }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2649
        then obtain mS where
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2650
          mS: "\<forall>S\<in>I. mS S > 1 \<and> (\<forall>e. e > 1 \<and> e \<le> mS S \<longrightarrow> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S)" by metis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2651
        define e where "e = Min (mS ` I)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2652
        then have "e \<in> mS ` I" using assms \<open>I \<noteq> {}\<close> by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2653
        then have "e > 1" using mS by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2654
        moreover have "\<forall>S\<in>I. e \<le> mS S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2655
          using e_def assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2656
        ultimately have "\<exists>e > 1. (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> \<Inter>I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2657
          using mS by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2658
      }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2659
      then have "z \<in> rel_interior (\<Inter>I)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2660
        using convex_rel_interior_iff[of "\<Inter>I" z] \<open>\<Inter>I \<noteq> {}\<close> \<open>convex (\<Inter>I)\<close> by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2661
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2662
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2663
      using convex_rel_interior_inter[of I] assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2664
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2665
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2666
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2667
lemma convex_closure_inter_two:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2668
  fixes S T :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2669
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2670
    and "convex T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2671
  assumes "rel_interior S \<inter> rel_interior T \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2672
  shows "closure (S \<inter> T) = closure S \<inter> closure T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2673
  using convex_closure_inter[of "{S,T}"] assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2674
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2675
lemma convex_rel_interior_inter_two:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2676
  fixes S T :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2677
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2678
    and "convex T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2679
    and "rel_interior S \<inter> rel_interior T \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2680
  shows "rel_interior (S \<inter> T) = rel_interior S \<inter> rel_interior T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2681
  using convex_rel_interior_finite_inter[of "{S,T}"] assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2682
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2683
lemma convex_affine_closure_Int:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2684
  fixes S T :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2685
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2686
    and "affine T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2687
    and "rel_interior S \<inter> T \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2688
  shows "closure (S \<inter> T) = closure S \<inter> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2689
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2690
  have "affine hull T = T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2691
    using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2692
  then have "rel_interior T = T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2693
    using rel_interior_affine_hull[of T] by metis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2694
  moreover have "closure T = T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2695
    using assms affine_closed[of T] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2696
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2697
    using convex_closure_inter_two[of S T] assms affine_imp_convex by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2698
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2699
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2700
lemma connected_component_1_gen:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2701
  fixes S :: "'a :: euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2702
  assumes "DIM('a) = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2703
  shows "connected_component S a b \<longleftrightarrow> closed_segment a b \<subseteq> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2704
unfolding connected_component_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2705
by (metis (no_types, lifting) assms subsetD subsetI convex_contains_segment convex_segment(1)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2706
            ends_in_segment connected_convex_1_gen)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2707
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2708
lemma connected_component_1:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2709
  fixes S :: "real set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2710
  shows "connected_component S a b \<longleftrightarrow> closed_segment a b \<subseteq> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2711
by (simp add: connected_component_1_gen)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2712
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2713
lemma convex_affine_rel_interior_Int:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2714
  fixes S T :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2715
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2716
    and "affine T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2717
    and "rel_interior S \<inter> T \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2718
  shows "rel_interior (S \<inter> T) = rel_interior S \<inter> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2719
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2720
  have "affine hull T = T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2721
    using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2722
  then have "rel_interior T = T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2723
    using rel_interior_affine_hull[of T] by metis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2724
  moreover have "closure T = T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2725
    using assms affine_closed[of T] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2726
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2727
    using convex_rel_interior_inter_two[of S T] assms affine_imp_convex by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2728
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2729
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2730
lemma convex_affine_rel_frontier_Int:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2731
   fixes S T :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2732
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2733
    and "affine T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2734
    and "interior S \<inter> T \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2735
  shows "rel_frontier(S \<inter> T) = frontier S \<inter> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2736
using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2737
apply (simp add: rel_frontier_def convex_affine_closure_Int frontier_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2738
by (metis Diff_Int_distrib2 Int_emptyI convex_affine_closure_Int convex_affine_rel_interior_Int empty_iff interior_rel_interior_gen)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2739
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2740
lemma rel_interior_convex_Int_affine:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2741
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2742
  assumes "convex S" "affine T" "interior S \<inter> T \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2743
    shows "rel_interior(S \<inter> T) = interior S \<inter> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2744
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2745
  obtain a where aS: "a \<in> interior S" and aT:"a \<in> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2746
    using assms by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2747
  have "rel_interior S = interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2748
    by (metis (no_types) aS affine_hull_nonempty_interior equals0D rel_interior_interior)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2749
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2750
    by (metis (no_types) affine_imp_convex assms convex_rel_interior_inter_two hull_same rel_interior_affine_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2751
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2752
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2753
lemma closure_convex_Int_affine:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2754
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2755
  assumes "convex S" "affine T" "rel_interior S \<inter> T \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2756
  shows "closure(S \<inter> T) = closure S \<inter> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2757
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2758
  have "closure (S \<inter> T) \<subseteq> closure T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2759
    by (simp add: closure_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2760
  also have "... \<subseteq> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2761
    by (simp add: affine_closed assms)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2762
  finally show "closure(S \<inter> T) \<subseteq> closure S \<inter> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2763
    by (simp add: closure_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2764
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2765
  obtain a where "a \<in> rel_interior S" "a \<in> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2766
    using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2767
  then have ssT: "subspace ((\<lambda>x. (-a)+x) ` T)" and "a \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2768
    using affine_diffs_subspace rel_interior_subset assms by blast+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2769
  show "closure S \<inter> T \<subseteq> closure (S \<inter> T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2770
  proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2771
    fix x  assume "x \<in> closure S \<inter> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2772
    show "x \<in> closure (S \<inter> T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2773
    proof (cases "x = a")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2774
      case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2775
      then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2776
        using \<open>a \<in> S\<close> \<open>a \<in> T\<close> closure_subset by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2777
    next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2778
      case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2779
      then have "x \<in> closure(open_segment a x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2780
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2781
      then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2782
        using \<open>x \<in> closure S \<inter> T\<close> assms convex_affine_closure_Int by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2783
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2784
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2785
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2786
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2787
lemma subset_rel_interior_convex:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2788
  fixes S T :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2789
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2790
    and "convex T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2791
    and "S \<le> closure T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2792
    and "\<not> S \<subseteq> rel_frontier T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2793
  shows "rel_interior S \<subseteq> rel_interior T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2794
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2795
  have *: "S \<inter> closure T = S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2796
    using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2797
  have "\<not> rel_interior S \<subseteq> rel_frontier T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2798
    using closure_mono[of "rel_interior S" "rel_frontier T"] closed_rel_frontier[of T]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2799
      closure_closed[of S] convex_closure_rel_interior[of S] closure_subset[of S] assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2800
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2801
  then have "rel_interior S \<inter> rel_interior (closure T) \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2802
    using assms rel_frontier_def[of T] rel_interior_subset convex_rel_interior_closure[of T]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2803
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2804
  then have "rel_interior S \<inter> rel_interior T = rel_interior (S \<inter> closure T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2805
    using assms convex_closure convex_rel_interior_inter_two[of S "closure T"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2806
      convex_rel_interior_closure[of T]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2807
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2808
  also have "\<dots> = rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2809
    using * by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2810
  finally show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2811
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2812
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2813
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2814
lemma rel_interior_convex_linear_image:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2815
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2816
  assumes "linear f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2817
    and "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2818
  shows "f ` (rel_interior S) = rel_interior (f ` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2819
proof (cases "S = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2820
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2821
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2822
    using assms rel_interior_empty rel_interior_eq_empty by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2823
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2824
  case False
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  2825
  interpret linear f by fact
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2826
  have *: "f ` (rel_interior S) \<subseteq> f ` S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2827
    unfolding image_mono using rel_interior_subset by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2828
  have "f ` S \<subseteq> f ` (closure S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2829
    unfolding image_mono using closure_subset by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2830
  also have "\<dots> = f ` (closure (rel_interior S))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2831
    using convex_closure_rel_interior assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2832
  also have "\<dots> \<subseteq> closure (f ` (rel_interior S))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2833
    using closure_linear_image_subset assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2834
  finally have "closure (f ` S) = closure (f ` rel_interior S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2835
    using closure_mono[of "f ` S" "closure (f ` rel_interior S)"] closure_closure
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2836
      closure_mono[of "f ` rel_interior S" "f ` S"] *
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2837
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2838
  then have "rel_interior (f ` S) = rel_interior (f ` rel_interior S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2839
    using assms convex_rel_interior
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2840
      linear_conv_bounded_linear[of f] convex_linear_image[of _ S]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2841
      convex_linear_image[of _ "rel_interior S"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2842
      closure_eq_rel_interior_eq[of "f ` S" "f ` rel_interior S"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2843
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2844
  then have "rel_interior (f ` S) \<subseteq> f ` rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2845
    using rel_interior_subset by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2846
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2847
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2848
    fix z
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2849
    assume "z \<in> f ` rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2850
    then obtain z1 where z1: "z1 \<in> rel_interior S" "f z1 = z" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2851
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2852
      fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2853
      assume "x \<in> f ` S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2854
      then obtain x1 where x1: "x1 \<in> S" "f x1 = x" by auto
67613
ce654b0e6d69 more symbols;
wenzelm
parents: 67443
diff changeset
  2855
      then obtain e where e: "e > 1" "(1 - e) *\<^sub>R x1 + e *\<^sub>R z1 \<in> S"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2856
        using convex_rel_interior_iff[of S z1] \<open>convex S\<close> x1 z1 by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2857
      moreover have "f ((1 - e) *\<^sub>R x1 + e *\<^sub>R z1) = (1 - e) *\<^sub>R x + e *\<^sub>R z"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  2858
        using x1 z1 by (simp add: linear_add linear_scale \<open>linear f\<close>)
67613
ce654b0e6d69 more symbols;
wenzelm
parents: 67443
diff changeset
  2859
      ultimately have "(1 - e) *\<^sub>R x + e *\<^sub>R z \<in> f ` S"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2860
        using imageI[of "(1 - e) *\<^sub>R x1 + e *\<^sub>R z1" S f] by auto
67613
ce654b0e6d69 more symbols;
wenzelm
parents: 67443
diff changeset
  2861
      then have "\<exists>e. e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> f ` S"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2862
        using e by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2863
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2864
    then have "z \<in> rel_interior (f ` S)"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  2865
      using convex_rel_interior_iff[of "f ` S" z] \<open>convex S\<close> \<open>linear f\<close>
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  2866
        \<open>S \<noteq> {}\<close> convex_linear_image[of f S]  linear_conv_bounded_linear[of f]
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2867
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2868
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2869
  ultimately show ?thesis by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2870
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2871
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2872
lemma rel_interior_convex_linear_preimage:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2873
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2874
  assumes "linear f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2875
    and "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2876
    and "f -` (rel_interior S) \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2877
  shows "rel_interior (f -` S) = f -` (rel_interior S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2878
proof -
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  2879
  interpret linear f by fact
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2880
  have "S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2881
    using assms rel_interior_empty by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2882
  have nonemp: "f -` S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2883
    by (metis assms(3) rel_interior_subset subset_empty vimage_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2884
  then have "S \<inter> (range f) \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2885
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2886
  have conv: "convex (f -` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2887
    using convex_linear_vimage assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2888
  then have "convex (S \<inter> range f)"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  2889
    by (simp add: assms(2) convex_Int convex_linear_image linear_axioms)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2890
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2891
    fix z
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2892
    assume "z \<in> f -` (rel_interior S)"
67613
ce654b0e6d69 more symbols;
wenzelm
parents: 67443
diff changeset
  2893
    then have z: "f z \<in> rel_interior S"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2894
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2895
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2896
      fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2897
      assume "x \<in> f -` S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2898
      then have "f x \<in> S" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2899
      then obtain e where e: "e > 1" "(1 - e) *\<^sub>R f x + e *\<^sub>R f z \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2900
        using convex_rel_interior_iff[of S "f z"] z assms \<open>S \<noteq> {}\<close> by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2901
      moreover have "(1 - e) *\<^sub>R f x + e *\<^sub>R f z = f ((1 - e) *\<^sub>R x + e *\<^sub>R z)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2902
        using \<open>linear f\<close> by (simp add: linear_iff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2903
      ultimately have "\<exists>e. e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> f -` S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2904
        using e by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2905
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2906
    then have "z \<in> rel_interior (f -` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2907
      using convex_rel_interior_iff[of "f -` S" z] conv nonemp by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2908
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2909
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2910
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2911
    fix z
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2912
    assume z: "z \<in> rel_interior (f -` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2913
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2914
      fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2915
      assume "x \<in> S \<inter> range f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2916
      then obtain y where y: "f y = x" "y \<in> f -` S" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2917
      then obtain e where e: "e > 1" "(1 - e) *\<^sub>R y + e *\<^sub>R z \<in> f -` S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2918
        using convex_rel_interior_iff[of "f -` S" z] z conv by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2919
      moreover have "(1 - e) *\<^sub>R x + e *\<^sub>R f z = f ((1 - e) *\<^sub>R y + e *\<^sub>R z)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2920
        using \<open>linear f\<close> y by (simp add: linear_iff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2921
      ultimately have "\<exists>e. e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R f z \<in> S \<inter> range f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2922
        using e by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2923
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2924
    then have "f z \<in> rel_interior (S \<inter> range f)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2925
      using \<open>convex (S \<inter> (range f))\<close> \<open>S \<inter> range f \<noteq> {}\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2926
        convex_rel_interior_iff[of "S \<inter> (range f)" "f z"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2927
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2928
    moreover have "affine (range f)"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  2929
      by (simp add: linear_axioms linear_subspace_image subspace_imp_affine)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2930
    ultimately have "f z \<in> rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2931
      using convex_affine_rel_interior_Int[of S "range f"] assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2932
    then have "z \<in> f -` (rel_interior S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2933
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2934
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2935
  ultimately show ?thesis by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2936
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2937
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2938
lemma rel_interior_Times:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2939
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2940
    and T :: "'m::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2941
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2942
    and "convex T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2943
  shows "rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2944
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2945
  { assume "S = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2946
    then have ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2947
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2948
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2949
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2950
  { assume "T = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2951
    then have ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2952
       by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2953
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2954
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2955
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2956
    assume "S \<noteq> {}" "T \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2957
    then have ri: "rel_interior S \<noteq> {}" "rel_interior T \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2958
      using rel_interior_eq_empty assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2959
    then have "fst -` rel_interior S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2960
      using fst_vimage_eq_Times[of "rel_interior S"] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2961
    then have "rel_interior ((fst :: 'n * 'm \<Rightarrow> 'n) -` S) = fst -` rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2962
      using fst_linear \<open>convex S\<close> rel_interior_convex_linear_preimage[of fst S] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2963
    then have s: "rel_interior (S \<times> (UNIV :: 'm set)) = rel_interior S \<times> UNIV"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2964
      by (simp add: fst_vimage_eq_Times)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2965
    from ri have "snd -` rel_interior T \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2966
      using snd_vimage_eq_Times[of "rel_interior T"] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2967
    then have "rel_interior ((snd :: 'n * 'm \<Rightarrow> 'm) -` T) = snd -` rel_interior T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2968
      using snd_linear \<open>convex T\<close> rel_interior_convex_linear_preimage[of snd T] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2969
    then have t: "rel_interior ((UNIV :: 'n set) \<times> T) = UNIV \<times> rel_interior T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2970
      by (simp add: snd_vimage_eq_Times)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2971
    from s t have *: "rel_interior (S \<times> (UNIV :: 'm set)) \<inter> rel_interior ((UNIV :: 'n set) \<times> T) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2972
      rel_interior S \<times> rel_interior T" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2973
    have "S \<times> T = S \<times> (UNIV :: 'm set) \<inter> (UNIV :: 'n set) \<times> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2974
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2975
    then have "rel_interior (S \<times> T) = rel_interior ((S \<times> (UNIV :: 'm set)) \<inter> ((UNIV :: 'n set) \<times> T))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2976
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2977
    also have "\<dots> = rel_interior (S \<times> (UNIV :: 'm set)) \<inter> rel_interior ((UNIV :: 'n set) \<times> T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2978
       apply (subst convex_rel_interior_inter_two[of "S \<times> (UNIV :: 'm set)" "(UNIV :: 'n set) \<times> T"])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2979
       using * ri assms convex_Times
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2980
       apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2981
       done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2982
    finally have ?thesis using * by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2983
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2984
  ultimately show ?thesis by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2985
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2986
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2987
lemma rel_interior_scaleR:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2988
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2989
  assumes "c \<noteq> 0"
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  2990
  shows "(( *\<^sub>R) c) ` (rel_interior S) = rel_interior ((( *\<^sub>R) c) ` S)"
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  2991
  using rel_interior_injective_linear_image[of "(( *\<^sub>R) c)" S]
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  2992
    linear_conv_bounded_linear[of "( *\<^sub>R) c"] linear_scaleR injective_scaleR[of c] assms
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2993
  by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2994
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2995
lemma rel_interior_convex_scaleR:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2996
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2997
  assumes "convex S"
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  2998
  shows "(( *\<^sub>R) c) ` (rel_interior S) = rel_interior ((( *\<^sub>R) c) ` S)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2999
  by (metis assms linear_scaleR rel_interior_convex_linear_image)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3000
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3001
lemma convex_rel_open_scaleR:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3002
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3003
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3004
    and "rel_open S"
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  3005
  shows "convex ((( *\<^sub>R) c) ` S) \<and> rel_open ((( *\<^sub>R) c) ` S)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3006
  by (metis assms convex_scaling rel_interior_convex_scaleR rel_open_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3007
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3008
lemma convex_rel_open_finite_inter:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3009
  assumes "\<forall>S\<in>I. convex (S :: 'n::euclidean_space set) \<and> rel_open S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3010
    and "finite I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3011
  shows "convex (\<Inter>I) \<and> rel_open (\<Inter>I)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3012
proof (cases "\<Inter>{rel_interior S |S. S \<in> I} = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3013
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3014
  then have "\<Inter>I = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3015
    using assms unfolding rel_open_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3016
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3017
    unfolding rel_open_def using rel_interior_empty by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3018
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3019
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3020
  then have "rel_open (\<Inter>I)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3021
    using assms unfolding rel_open_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3022
    using convex_rel_interior_finite_inter[of I]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3023
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3024
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3025
    using convex_Inter assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3026
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3027
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3028
lemma convex_rel_open_linear_image:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3029
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3030
  assumes "linear f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3031
    and "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3032
    and "rel_open S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3033
  shows "convex (f ` S) \<and> rel_open (f ` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3034
  by (metis assms convex_linear_image rel_interior_convex_linear_image rel_open_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3035
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3036
lemma convex_rel_open_linear_preimage:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3037
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3038
  assumes "linear f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3039
    and "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3040
    and "rel_open S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3041
  shows "convex (f -` S) \<and> rel_open (f -` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3042
proof (cases "f -` (rel_interior S) = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3043
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3044
  then have "f -` S = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3045
    using assms unfolding rel_open_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3046
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3047
    unfolding rel_open_def using rel_interior_empty by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3048
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3049
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3050
  then have "rel_open (f -` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3051
    using assms unfolding rel_open_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3052
    using rel_interior_convex_linear_preimage[of f S]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3053
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3054
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3055
    using convex_linear_vimage assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3056
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3057
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3058
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3059
lemma rel_interior_projection:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3060
  fixes S :: "('m::euclidean_space \<times> 'n::euclidean_space) set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3061
    and f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3062
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3063
    and "f = (\<lambda>y. {z. (y, z) \<in> S})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3064
  shows "(y, z) \<in> rel_interior S \<longleftrightarrow> (y \<in> rel_interior {y. (f y \<noteq> {})} \<and> z \<in> rel_interior (f y))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3065
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3066
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3067
    fix y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3068
    assume "y \<in> {y. f y \<noteq> {}}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3069
    then obtain z where "(y, z) \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3070
      using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3071
    then have "\<exists>x. x \<in> S \<and> y = fst x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3072
      apply (rule_tac x="(y, z)" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3073
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3074
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3075
    then obtain x where "x \<in> S" "y = fst x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3076
      by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3077
    then have "y \<in> fst ` S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3078
      unfolding image_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3079
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3080
  then have "fst ` S = {y. f y \<noteq> {}}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3081
    unfolding fst_def using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3082
  then have h1: "fst ` rel_interior S = rel_interior {y. f y \<noteq> {}}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3083
    using rel_interior_convex_linear_image[of fst S] assms fst_linear by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3084
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3085
    fix y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3086
    assume "y \<in> rel_interior {y. f y \<noteq> {}}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3087
    then have "y \<in> fst ` rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3088
      using h1 by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3089
    then have *: "rel_interior S \<inter> fst -` {y} \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3090
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3091
    moreover have aff: "affine (fst -` {y})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3092
      unfolding affine_alt by (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3093
    ultimately have **: "rel_interior (S \<inter> fst -` {y}) = rel_interior S \<inter> fst -` {y}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3094
      using convex_affine_rel_interior_Int[of S "fst -` {y}"] assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3095
    have conv: "convex (S \<inter> fst -` {y})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3096
      using convex_Int assms aff affine_imp_convex by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3097
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3098
      fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3099
      assume "x \<in> f y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3100
      then have "(y, x) \<in> S \<inter> (fst -` {y})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3101
        using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3102
      moreover have "x = snd (y, x)" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3103
      ultimately have "x \<in> snd ` (S \<inter> fst -` {y})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3104
        by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3105
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3106
    then have "snd ` (S \<inter> fst -` {y}) = f y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3107
      using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3108
    then have ***: "rel_interior (f y) = snd ` rel_interior (S \<inter> fst -` {y})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3109
      using rel_interior_convex_linear_image[of snd "S \<inter> fst -` {y}"] snd_linear conv
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3110
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3111
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3112
      fix z
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3113
      assume "z \<in> rel_interior (f y)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3114
      then have "z \<in> snd ` rel_interior (S \<inter> fst -` {y})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3115
        using *** by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3116
      moreover have "{y} = fst ` rel_interior (S \<inter> fst -` {y})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3117
        using * ** rel_interior_subset by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3118
      ultimately have "(y, z) \<in> rel_interior (S \<inter> fst -` {y})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3119
        by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3120
      then have "(y,z) \<in> rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3121
        using ** by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3122
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3123
    moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3124
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3125
      fix z
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3126
      assume "(y, z) \<in> rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3127
      then have "(y, z) \<in> rel_interior (S \<inter> fst -` {y})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3128
        using ** by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3129
      then have "z \<in> snd ` rel_interior (S \<inter> fst -` {y})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3130
        by (metis Range_iff snd_eq_Range)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3131
      then have "z \<in> rel_interior (f y)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3132
        using *** by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3133
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3134
    ultimately have "\<And>z. (y, z) \<in> rel_interior S \<longleftrightarrow> z \<in> rel_interior (f y)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3135
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3136
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3137
  then have h2: "\<And>y z. y \<in> rel_interior {t. f t \<noteq> {}} \<Longrightarrow>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3138
    (y, z) \<in> rel_interior S \<longleftrightarrow> z \<in> rel_interior (f y)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3139
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3140
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3141
    fix y z
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3142
    assume asm: "(y, z) \<in> rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3143
    then have "y \<in> fst ` rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3144
      by (metis Domain_iff fst_eq_Domain)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3145
    then have "y \<in> rel_interior {t. f t \<noteq> {}}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3146
      using h1 by auto
67613
ce654b0e6d69 more symbols;
wenzelm
parents: 67443
diff changeset
  3147
    then have "y \<in> rel_interior {t. f t \<noteq> {}}" and "(z \<in> rel_interior (f y))"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3148
      using h2 asm by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3149
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3150
  then show ?thesis using h2 by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3151
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3152
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3153
lemma rel_frontier_Times:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3154
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3155
    and T :: "'m::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3156
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3157
    and "convex T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3158
  shows "rel_frontier S \<times> rel_frontier T \<subseteq> rel_frontier (S \<times> T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3159
    by (force simp: rel_frontier_def rel_interior_Times assms closure_Times)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3160
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3161
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  3162
subsubsection%unimportant \<open>Relative interior of convex cone\<close>
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3163
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3164
lemma cone_rel_interior:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3165
  fixes S :: "'m::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3166
  assumes "cone S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3167
  shows "cone ({0} \<union> rel_interior S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3168
proof (cases "S = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3169
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3170
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3171
    by (simp add: rel_interior_empty cone_0)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3172
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3173
  case False
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  3174
  then have *: "0 \<in> S \<and> (\<forall>c. c > 0 \<longrightarrow> ( *\<^sub>R) c ` S = S)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3175
    using cone_iff[of S] assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3176
  then have *: "0 \<in> ({0} \<union> rel_interior S)"
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  3177
    and "\<forall>c. c > 0 \<longrightarrow> ( *\<^sub>R) c ` ({0} \<union> rel_interior S) = ({0} \<union> rel_interior S)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3178
    by (auto simp add: rel_interior_scaleR)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3179
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3180
    using cone_iff[of "{0} \<union> rel_interior S"] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3181
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3182
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3183
lemma rel_interior_convex_cone_aux:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3184
  fixes S :: "'m::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3185
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3186
  shows "(c, x) \<in> rel_interior (cone hull ({(1 :: real)} \<times> S)) \<longleftrightarrow>
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  3187
    c > 0 \<and> x \<in> ((( *\<^sub>R) c) ` (rel_interior S))"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3188
proof (cases "S = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3189
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3190
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3191
    by (simp add: rel_interior_empty cone_hull_empty)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3192
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3193
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3194
  then obtain s where "s \<in> S" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3195
  have conv: "convex ({(1 :: real)} \<times> S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3196
    using convex_Times[of "{(1 :: real)}" S] assms convex_singleton[of "1 :: real"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3197
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3198
  define f where "f y = {z. (y, z) \<in> cone hull ({1 :: real} \<times> S)}" for y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3199
  then have *: "(c, x) \<in> rel_interior (cone hull ({(1 :: real)} \<times> S)) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3200
    (c \<in> rel_interior {y. f y \<noteq> {}} \<and> x \<in> rel_interior (f c))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3201
    apply (subst rel_interior_projection[of "cone hull ({(1 :: real)} \<times> S)" f c x])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3202
    using convex_cone_hull[of "{(1 :: real)} \<times> S"] conv
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3203
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3204
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3205
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3206
    fix y :: real
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3207
    assume "y \<ge> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3208
    then have "y *\<^sub>R (1,s) \<in> cone hull ({1 :: real} \<times> S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3209
      using cone_hull_expl[of "{(1 :: real)} \<times> S"] \<open>s \<in> S\<close> by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3210
    then have "f y \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3211
      using f_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3212
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3213
  then have "{y. f y \<noteq> {}} = {0..}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3214
    using f_def cone_hull_expl[of "{1 :: real} \<times> S"] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3215
  then have **: "rel_interior {y. f y \<noteq> {}} = {0<..}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3216
    using rel_interior_real_semiline by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3217
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3218
    fix c :: real
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3219
    assume "c > 0"
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  3220
    then have "f c = (( *\<^sub>R) c ` S)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3221
      using f_def cone_hull_expl[of "{1 :: real} \<times> S"] by auto
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  3222
    then have "rel_interior (f c) = ( *\<^sub>R) c ` rel_interior S"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3223
      using rel_interior_convex_scaleR[of S c] assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3224
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3225
  then show ?thesis using * ** by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3226
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3227
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3228
lemma rel_interior_convex_cone:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3229
  fixes S :: "'m::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3230
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3231
  shows "rel_interior (cone hull ({1 :: real} \<times> S)) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3232
    {(c, c *\<^sub>R x) | c x. c > 0 \<and> x \<in> rel_interior S}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3233
  (is "?lhs = ?rhs")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3234
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3235
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3236
    fix z
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3237
    assume "z \<in> ?lhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3238
    have *: "z = (fst z, snd z)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3239
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3240
    have "z \<in> ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3241
      using rel_interior_convex_cone_aux[of S "fst z" "snd z"] assms \<open>z \<in> ?lhs\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3242
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3243
      apply (rule_tac x = "fst z" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3244
      apply (rule_tac x = x in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3245
      using *
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3246
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3247
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3248
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3249
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3250
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3251
    fix z
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3252
    assume "z \<in> ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3253
    then have "z \<in> ?lhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3254
      using rel_interior_convex_cone_aux[of S "fst z" "snd z"] assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3255
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3256
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3257
  ultimately show ?thesis by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3258
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3259
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3260
lemma convex_hull_finite_union:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3261
  assumes "finite I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3262
  assumes "\<forall>i\<in>I. convex (S i) \<and> (S i) \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3263
  shows "convex hull (\<Union>(S ` I)) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3264
    {sum (\<lambda>i. c i *\<^sub>R s i) I | c s. (\<forall>i\<in>I. c i \<ge> 0) \<and> sum c I = 1 \<and> (\<forall>i\<in>I. s i \<in> S i)}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3265
  (is "?lhs = ?rhs")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3266
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3267
  have "?lhs \<supseteq> ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3268
  proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3269
    fix x
67613
ce654b0e6d69 more symbols;
wenzelm
parents: 67443
diff changeset
  3270
    assume "x \<in> ?rhs"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3271
    then obtain c s where *: "sum (\<lambda>i. c i *\<^sub>R s i) I = x" "sum c I = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3272
      "(\<forall>i\<in>I. c i \<ge> 0) \<and> (\<forall>i\<in>I. s i \<in> S i)" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3273
    then have "\<forall>i\<in>I. s i \<in> convex hull (\<Union>(S ` I))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3274
      using hull_subset[of "\<Union>(S ` I)" convex] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3275
    then show "x \<in> ?lhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3276
      unfolding *(1)[symmetric]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3277
      apply (subst convex_sum[of I "convex hull \<Union>(S ` I)" c s])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3278
      using * assms convex_convex_hull
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3279
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3280
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3281
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3282
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3283
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3284
    fix i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3285
    assume "i \<in> I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3286
    with assms have "\<exists>p. p \<in> S i" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3287
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3288
  then obtain p where p: "\<forall>i\<in>I. p i \<in> S i" by metis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3290
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3291
    fix i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3292
    assume "i \<in> I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3293
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3294
      fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3295
      assume "x \<in> S i"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3296
      define c where "c j = (if j = i then 1::real else 0)" for j
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3297
      then have *: "sum c I = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3298
        using \<open>finite I\<close> \<open>i \<in> I\<close> sum.delta[of I i "\<lambda>j::'a. 1::real"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3299
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3300
      define s where "s j = (if j = i then x else p j)" for j
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3301
      then have "\<forall>j. c j *\<^sub>R s j = (if j = i then x else 0)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3302
        using c_def by (auto simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3303
      then have "x = sum (\<lambda>i. c i *\<^sub>R s i) I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3304
        using s_def c_def \<open>finite I\<close> \<open>i \<in> I\<close> sum.delta[of I i "\<lambda>j::'a. x"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3305
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3306
      then have "x \<in> ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3307
        apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3308
        apply (rule_tac x = c in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3309
        apply (rule_tac x = s in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3310
        using * c_def s_def p \<open>x \<in> S i\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3311
        apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3312
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3313
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3314
    then have "?rhs \<supseteq> S i" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3315
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3316
  then have *: "?rhs \<supseteq> \<Union>(S ` I)" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3317
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3318
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3319
    fix u v :: real
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3320
    assume uv: "u \<ge> 0 \<and> v \<ge> 0 \<and> u + v = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3321
    fix x y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3322
    assume xy: "x \<in> ?rhs \<and> y \<in> ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3323
    from xy obtain c s where
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3324
      xc: "x = sum (\<lambda>i. c i *\<^sub>R s i) I \<and> (\<forall>i\<in>I. c i \<ge> 0) \<and> sum c I = 1 \<and> (\<forall>i\<in>I. s i \<in> S i)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3325
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3326
    from xy obtain d t where
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3327
      yc: "y = sum (\<lambda>i. d i *\<^sub>R t i) I \<and> (\<forall>i\<in>I. d i \<ge> 0) \<and> sum d I = 1 \<and> (\<forall>i\<in>I. t i \<in> S i)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3328
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3329
    define e where "e i = u * c i + v * d i" for i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3330
    have ge0: "\<forall>i\<in>I. e i \<ge> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3331
      using e_def xc yc uv by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3332
    have "sum (\<lambda>i. u * c i) I = u * sum c I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3333
      by (simp add: sum_distrib_left)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3334
    moreover have "sum (\<lambda>i. v * d i) I = v * sum d I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3335
      by (simp add: sum_distrib_left)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3336
    ultimately have sum1: "sum e I = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3337
      using e_def xc yc uv by (simp add: sum.distrib)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3338
    define q where "q i = (if e i = 0 then p i else (u * c i / e i) *\<^sub>R s i + (v * d i / e i) *\<^sub>R t i)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3339
      for i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3340
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3341
      fix i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3342
      assume i: "i \<in> I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3343
      have "q i \<in> S i"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3344
      proof (cases "e i = 0")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3345
        case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3346
        then show ?thesis using i p q_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3347
      next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3348
        case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3349
        then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3350
          using mem_convex_alt[of "S i" "s i" "t i" "u * (c i)" "v * (d i)"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3351
            mult_nonneg_nonneg[of u "c i"] mult_nonneg_nonneg[of v "d i"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3352
            assms q_def e_def i False xc yc uv
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3353
          by (auto simp del: mult_nonneg_nonneg)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3354
      qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3355
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3356
    then have qs: "\<forall>i\<in>I. q i \<in> S i" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3357
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3358
      fix i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3359
      assume i: "i \<in> I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3360
      have "(u * c i) *\<^sub>R s i + (v * d i) *\<^sub>R t i = e i *\<^sub>R q i"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3361
      proof (cases "e i = 0")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3362
        case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3363
        have ge: "u * (c i) \<ge> 0 \<and> v * d i \<ge> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3364
          using xc yc uv i by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3365
        moreover from ge have "u * c i \<le> 0 \<and> v * d i \<le> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3366
          using True e_def i by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3367
        ultimately have "u * c i = 0 \<and> v * d i = 0" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3368
        with True show ?thesis by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3369
      next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3370
        case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3371
        then have "(u * (c i)/(e i))*\<^sub>R (s i)+(v * (d i)/(e i))*\<^sub>R (t i) = q i"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3372
          using q_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3373
        then have "e i *\<^sub>R ((u * (c i)/(e i))*\<^sub>R (s i)+(v * (d i)/(e i))*\<^sub>R (t i))
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3374
               = (e i) *\<^sub>R (q i)" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3375
        with False show ?thesis by (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3376
      qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3377
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3378
    then have *: "\<forall>i\<in>I. (u * c i) *\<^sub>R s i + (v * d i) *\<^sub>R t i = e i *\<^sub>R q i"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3379
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3380
    have "u *\<^sub>R x + v *\<^sub>R y = sum (\<lambda>i. (u * c i) *\<^sub>R s i + (v * d i) *\<^sub>R t i) I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3381
      using xc yc by (simp add: algebra_simps scaleR_right.sum sum.distrib)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3382
    also have "\<dots> = sum (\<lambda>i. e i *\<^sub>R q i) I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3383
      using * by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3384
    finally have "u *\<^sub>R x + v *\<^sub>R y = sum (\<lambda>i. (e i) *\<^sub>R (q i)) I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3385
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3386
    then have "u *\<^sub>R x + v *\<^sub>R y \<in> ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3387
      using ge0 sum1 qs by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3388
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3389
  then have "convex ?rhs" unfolding convex_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3390
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3391
    using \<open>?lhs \<supseteq> ?rhs\<close> * hull_minimal[of "\<Union>(S ` I)" ?rhs convex]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3392
    by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3393
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3394
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3395
lemma convex_hull_union_two:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3396
  fixes S T :: "'m::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3397
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3398
    and "S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3399
    and "convex T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3400
    and "T \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3401
  shows "convex hull (S \<union> T) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3402
    {u *\<^sub>R s + v *\<^sub>R t | u v s t. u \<ge> 0 \<and> v \<ge> 0 \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3403
  (is "?lhs = ?rhs")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3404
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3405
  define I :: "nat set" where "I = {1, 2}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3406
  define s where "s i = (if i = (1::nat) then S else T)" for i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3407
  have "\<Union>(s ` I) = S \<union> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3408
    using s_def I_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3409
  then have "convex hull (\<Union>(s ` I)) = convex hull (S \<union> T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3410
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3411
  moreover have "convex hull \<Union>(s ` I) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3412
    {\<Sum> i\<in>I. c i *\<^sub>R sa i | c sa. (\<forall>i\<in>I. 0 \<le> c i) \<and> sum c I = 1 \<and> (\<forall>i\<in>I. sa i \<in> s i)}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3413
      apply (subst convex_hull_finite_union[of I s])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3414
      using assms s_def I_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3415
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3416
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3417
  moreover have
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3418
    "{\<Sum>i\<in>I. c i *\<^sub>R sa i | c sa. (\<forall>i\<in>I. 0 \<le> c i) \<and> sum c I = 1 \<and> (\<forall>i\<in>I. sa i \<in> s i)} \<le> ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3419
    using s_def I_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3420
  ultimately show "?lhs \<subseteq> ?rhs" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3421
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3422
    fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3423
    assume "x \<in> ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3424
    then obtain u v s t where *: "x = u *\<^sub>R s + v *\<^sub>R t \<and> u \<ge> 0 \<and> v \<ge> 0 \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3425
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3426
    then have "x \<in> convex hull {s, t}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3427
      using convex_hull_2[of s t] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3428
    then have "x \<in> convex hull (S \<union> T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3429
      using * hull_mono[of "{s, t}" "S \<union> T"] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3430
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3431
  then show "?lhs \<supseteq> ?rhs" by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3432
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3433
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3434
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  3435
subsection%unimportant \<open>Convexity on direct sums\<close>
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3436
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3437
lemma closure_sum:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3438
  fixes S T :: "'a::real_normed_vector set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3439
  shows "closure S + closure T \<subseteq> closure (S + T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3440
  unfolding set_plus_image closure_Times [symmetric] split_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3441
  by (intro closure_bounded_linear_image_subset bounded_linear_add
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3442
    bounded_linear_fst bounded_linear_snd)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3443
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3444
lemma rel_interior_sum:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3445
  fixes S T :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3446
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3447
    and "convex T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3448
  shows "rel_interior (S + T) = rel_interior S + rel_interior T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3449
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3450
  have "rel_interior S + rel_interior T = (\<lambda>(x,y). x + y) ` (rel_interior S \<times> rel_interior T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3451
    by (simp add: set_plus_image)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3452
  also have "\<dots> = (\<lambda>(x,y). x + y) ` rel_interior (S \<times> T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3453
    using rel_interior_Times assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3454
  also have "\<dots> = rel_interior (S + T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3455
    using fst_snd_linear convex_Times assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3456
      rel_interior_convex_linear_image[of "(\<lambda>(x,y). x + y)" "S \<times> T"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3457
    by (auto simp add: set_plus_image)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3458
  finally show ?thesis ..
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3459
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3460
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3461
lemma rel_interior_sum_gen:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3462
  fixes S :: "'a \<Rightarrow> 'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3463
  assumes "\<forall>i\<in>I. convex (S i)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3464
  shows "rel_interior (sum S I) = sum (\<lambda>i. rel_interior (S i)) I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3465
  apply (subst sum_set_cond_linear[of convex])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3466
  using rel_interior_sum rel_interior_sing[of "0"] assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3467
  apply (auto simp add: convex_set_plus)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3468
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3469
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3470
lemma convex_rel_open_direct_sum:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3471
  fixes S T :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3472
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3473
    and "rel_open S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3474
    and "convex T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3475
    and "rel_open T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3476
  shows "convex (S \<times> T) \<and> rel_open (S \<times> T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3477
  by (metis assms convex_Times rel_interior_Times rel_open_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3478
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3479
lemma convex_rel_open_sum:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3480
  fixes S T :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3481
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3482
    and "rel_open S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3483
    and "convex T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3484
    and "rel_open T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3485
  shows "convex (S + T) \<and> rel_open (S + T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3486
  by (metis assms convex_set_plus rel_interior_sum rel_open_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3487
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3488
lemma convex_hull_finite_union_cones:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3489
  assumes "finite I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3490
    and "I \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3491
  assumes "\<forall>i\<in>I. convex (S i) \<and> cone (S i) \<and> S i \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3492
  shows "convex hull (\<Union>(S ` I)) = sum S I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3493
  (is "?lhs = ?rhs")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3494
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3495
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3496
    fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3497
    assume "x \<in> ?lhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3498
    then obtain c xs where
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3499
      x: "x = sum (\<lambda>i. c i *\<^sub>R xs i) I \<and> (\<forall>i\<in>I. c i \<ge> 0) \<and> sum c I = 1 \<and> (\<forall>i\<in>I. xs i \<in> S i)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3500
      using convex_hull_finite_union[of I S] assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3501
    define s where "s i = c i *\<^sub>R xs i" for i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3502
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3503
      fix i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3504
      assume "i \<in> I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3505
      then have "s i \<in> S i"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3506
        using s_def x assms mem_cone[of "S i" "xs i" "c i"] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3507
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3508
    then have "\<forall>i\<in>I. s i \<in> S i" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3509
    moreover have "x = sum s I" using x s_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3510
    ultimately have "x \<in> ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3511
      using set_sum_alt[of I S] assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3512
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3513
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3514
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3515
    fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3516
    assume "x \<in> ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3517
    then obtain s where x: "x = sum s I \<and> (\<forall>i\<in>I. s i \<in> S i)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3518
      using set_sum_alt[of I S] assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3519
    define xs where "xs i = of_nat(card I) *\<^sub>R s i" for i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3520
    then have "x = sum (\<lambda>i. ((1 :: real) / of_nat(card I)) *\<^sub>R xs i) I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3521
      using x assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3522
    moreover have "\<forall>i\<in>I. xs i \<in> S i"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3523
      using x xs_def assms by (simp add: cone_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3524
    moreover have "\<forall>i\<in>I. (1 :: real) / of_nat (card I) \<ge> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3525
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3526
    moreover have "sum (\<lambda>i. (1 :: real) / of_nat (card I)) I = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3527
      using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3528
    ultimately have "x \<in> ?lhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3529
      apply (subst convex_hull_finite_union[of I S])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3530
      using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3531
      apply blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3532
      using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3533
      apply blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3534
      apply rule
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3535
      apply (rule_tac x = "(\<lambda>i. (1 :: real) / of_nat (card I))" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3536
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3537
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3538
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3539
  ultimately show ?thesis by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3540
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3541
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3542
lemma convex_hull_union_cones_two:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3543
  fixes S T :: "'m::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3544
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3545
    and "cone S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3546
    and "S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3547
  assumes "convex T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3548
    and "cone T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3549
    and "T \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3550
  shows "convex hull (S \<union> T) = S + T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3551
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3552
  define I :: "nat set" where "I = {1, 2}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3553
  define A where "A i = (if i = (1::nat) then S else T)" for i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3554
  have "\<Union>(A ` I) = S \<union> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3555
    using A_def I_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3556
  then have "convex hull (\<Union>(A ` I)) = convex hull (S \<union> T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3557
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3558
  moreover have "convex hull \<Union>(A ` I) = sum A I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3559
    apply (subst convex_hull_finite_union_cones[of I A])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3560
    using assms A_def I_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3561
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3562
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3563
  moreover have "sum A I = S + T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3564
    using A_def I_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3565
    unfolding set_plus_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3566
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3567
    unfolding set_plus_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3568
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3569
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3570
  ultimately show ?thesis by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3571
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3572
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3573
lemma rel_interior_convex_hull_union:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3574
  fixes S :: "'a \<Rightarrow> 'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3575
  assumes "finite I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3576
    and "\<forall>i\<in>I. convex (S i) \<and> S i \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3577
  shows "rel_interior (convex hull (\<Union>(S ` I))) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3578
    {sum (\<lambda>i. c i *\<^sub>R s i) I | c s. (\<forall>i\<in>I. c i > 0) \<and> sum c I = 1 \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3579
      (\<forall>i\<in>I. s i \<in> rel_interior(S i))}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3580
  (is "?lhs = ?rhs")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3581
proof (cases "I = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3582
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3583
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3584
    using convex_hull_empty rel_interior_empty by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3585
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3586
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3587
  define C0 where "C0 = convex hull (\<Union>(S ` I))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3588
  have "\<forall>i\<in>I. C0 \<ge> S i"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3589
    unfolding C0_def using hull_subset[of "\<Union>(S ` I)"] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3590
  define K0 where "K0 = cone hull ({1 :: real} \<times> C0)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3591
  define K where "K i = cone hull ({1 :: real} \<times> S i)" for i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3592
  have "\<forall>i\<in>I. K i \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3593
    unfolding K_def using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3594
    by (simp add: cone_hull_empty_iff[symmetric])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3595
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3596
    fix i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3597
    assume "i \<in> I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3598
    then have "convex (K i)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3599
      unfolding K_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3600
      apply (subst convex_cone_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3601
      apply (subst convex_Times)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3602
      using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3603
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3604
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3605
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3606
  then have convK: "\<forall>i\<in>I. convex (K i)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3607
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3608
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3609
    fix i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3610
    assume "i \<in> I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3611
    then have "K0 \<supseteq> K i"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3612
      unfolding K0_def K_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3613
      apply (subst hull_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3614
      using \<open>\<forall>i\<in>I. C0 \<ge> S i\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3615
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3616
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3617
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3618
  then have "K0 \<supseteq> \<Union>(K ` I)" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3619
  moreover have "convex K0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3620
    unfolding K0_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3621
    apply (subst convex_cone_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3622
    apply (subst convex_Times)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3623
    unfolding C0_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3624
    using convex_convex_hull
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3625
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3626
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3627
  ultimately have geq: "K0 \<supseteq> convex hull (\<Union>(K ` I))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3628
    using hull_minimal[of _ "K0" "convex"] by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3629
  have "\<forall>i\<in>I. K i \<supseteq> {1 :: real} \<times> S i"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3630
    using K_def by (simp add: hull_subset)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3631
  then have "\<Union>(K ` I) \<supseteq> {1 :: real} \<times> \<Union>(S ` I)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3632
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3633
  then have "convex hull \<Union>(K ` I) \<supseteq> convex hull ({1 :: real} \<times> \<Union>(S ` I))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3634
    by (simp add: hull_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3635
  then have "convex hull \<Union>(K ` I) \<supseteq> {1 :: real} \<times> C0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3636
    unfolding C0_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3637
    using convex_hull_Times[of "{(1 :: real)}" "\<Union>(S ` I)"] convex_hull_singleton
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3638
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3639
  moreover have "cone (convex hull (\<Union>(K ` I)))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3640
    apply (subst cone_convex_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3641
    using cone_Union[of "K ` I"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3642
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3643
    unfolding K_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3644
    using cone_cone_hull
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3645
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3646
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3647
  ultimately have "convex hull (\<Union>(K ` I)) \<supseteq> K0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3648
    unfolding K0_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3649
    using hull_minimal[of _ "convex hull (\<Union>(K ` I))" "cone"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3650
    by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3651
  then have "K0 = convex hull (\<Union>(K ` I))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3652
    using geq by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3653
  also have "\<dots> = sum K I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3654
    apply (subst convex_hull_finite_union_cones[of I K])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3655
    using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3656
    apply blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3657
    using False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3658
    apply blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3659
    unfolding K_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3660
    apply rule
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3661
    apply (subst convex_cone_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3662
    apply (subst convex_Times)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3663
    using assms cone_cone_hull \<open>\<forall>i\<in>I. K i \<noteq> {}\<close> K_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3664
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3665
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3666
  finally have "K0 = sum K I" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3667
  then have *: "rel_interior K0 = sum (\<lambda>i. (rel_interior (K i))) I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3668
    using rel_interior_sum_gen[of I K] convK by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3669
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3670
    fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3671
    assume "x \<in> ?lhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3672
    then have "(1::real, x) \<in> rel_interior K0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3673
      using K0_def C0_def rel_interior_convex_cone_aux[of C0 "1::real" x] convex_convex_hull
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3674
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3675
    then obtain k where k: "(1::real, x) = sum k I \<and> (\<forall>i\<in>I. k i \<in> rel_interior (K i))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3676
      using \<open>finite I\<close> * set_sum_alt[of I "\<lambda>i. rel_interior (K i)"] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3677
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3678
      fix i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3679
      assume "i \<in> I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3680
      then have "convex (S i) \<and> k i \<in> rel_interior (cone hull {1} \<times> S i)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3681
        using k K_def assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3682
      then have "\<exists>ci si. k i = (ci, ci *\<^sub>R si) \<and> 0 < ci \<and> si \<in> rel_interior (S i)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3683
        using rel_interior_convex_cone[of "S i"] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3684
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3685
    then obtain c s where
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3686
      cs: "\<forall>i\<in>I. k i = (c i, c i *\<^sub>R s i) \<and> 0 < c i \<and> s i \<in> rel_interior (S i)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3687
      by metis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3688
    then have "x = (\<Sum>i\<in>I. c i *\<^sub>R s i) \<and> sum c I = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3689
      using k by (simp add: sum_prod)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3690
    then have "x \<in> ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3691
      using k
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3692
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3693
      apply (rule_tac x = c in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3694
      apply (rule_tac x = s in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3695
      using cs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3696
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3697
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3698
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3699
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3700
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3701
    fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3702
    assume "x \<in> ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3703
    then obtain c s where cs: "x = sum (\<lambda>i. c i *\<^sub>R s i) I \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3704
        (\<forall>i\<in>I. c i > 0) \<and> sum c I = 1 \<and> (\<forall>i\<in>I. s i \<in> rel_interior (S i))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3705
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3706
    define k where "k i = (c i, c i *\<^sub>R s i)" for i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3707
    {
67613
ce654b0e6d69 more symbols;
wenzelm
parents: 67443
diff changeset
  3708
      fix i assume "i \<in> I"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3709
      then have "k i \<in> rel_interior (K i)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3710
        using k_def K_def assms cs rel_interior_convex_cone[of "S i"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3711
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3712
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3713
    then have "(1::real, x) \<in> rel_interior K0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3714
      using K0_def * set_sum_alt[of I "(\<lambda>i. rel_interior (K i))"] assms k_def cs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3715
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3716
      apply (rule_tac x = k in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3717
      apply (simp add: sum_prod)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3718
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3719
    then have "x \<in> ?lhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3720
      using K0_def C0_def rel_interior_convex_cone_aux[of C0 1 x]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3721
      by (auto simp add: convex_convex_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3722
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3723
  ultimately show ?thesis by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3724
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3725
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3726
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3727
lemma convex_le_Inf_differential:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3728
  fixes f :: "real \<Rightarrow> real"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3729
  assumes "convex_on I f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3730
    and "x \<in> interior I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3731
    and "y \<in> I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3732
  shows "f y \<ge> f x + Inf ((\<lambda>t. (f x - f t) / (x - t)) ` ({x<..} \<inter> I)) * (y - x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3733
  (is "_ \<ge> _ + Inf (?F x) * (y - x)")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3734
proof (cases rule: linorder_cases)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3735
  assume "x < y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3736
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3737
  have "open (interior I)" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3738
  from openE[OF this \<open>x \<in> interior I\<close>]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3739
  obtain e where e: "0 < e" "ball x e \<subseteq> interior I" .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3740
  moreover define t where "t = min (x + e / 2) ((x + y) / 2)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3741
  ultimately have "x < t" "t < y" "t \<in> ball x e"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3742
    by (auto simp: dist_real_def field_simps split: split_min)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3743
  with \<open>x \<in> interior I\<close> e interior_subset[of I] have "t \<in> I" "x \<in> I" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3744
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3745
  have "open (interior I)" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3746
  from openE[OF this \<open>x \<in> interior I\<close>]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3747
  obtain e where "0 < e" "ball x e \<subseteq> interior I" .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3748
  moreover define K where "K = x - e / 2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3749
  with \<open>0 < e\<close> have "K \<in> ball x e" "K < x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3750
    by (auto simp: dist_real_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3751
  ultimately have "K \<in> I" "K < x" "x \<in> I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3752
    using interior_subset[of I] \<open>x \<in> interior I\<close> by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3753
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3754
  have "Inf (?F x) \<le> (f x - f y) / (x - y)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3755
  proof (intro bdd_belowI cInf_lower2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3756
    show "(f x - f t) / (x - t) \<in> ?F x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3757
      using \<open>t \<in> I\<close> \<open>x < t\<close> by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3758
    show "(f x - f t) / (x - t) \<le> (f x - f y) / (x - y)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3759
      using \<open>convex_on I f\<close> \<open>x \<in> I\<close> \<open>y \<in> I\<close> \<open>x < t\<close> \<open>t < y\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3760
      by (rule convex_on_diff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3761
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3762
    fix y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3763
    assume "y \<in> ?F x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3764
    with order_trans[OF convex_on_diff[OF \<open>convex_on I f\<close> \<open>K \<in> I\<close> _ \<open>K < x\<close> _]]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3765
    show "(f K - f x) / (K - x) \<le> y" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3766
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3767
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3768
    using \<open>x < y\<close> by (simp add: field_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3769
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3770
  assume "y < x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3771
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3772
  have "open (interior I)" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3773
  from openE[OF this \<open>x \<in> interior I\<close>]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3774
  obtain e where e: "0 < e" "ball x e \<subseteq> interior I" .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3775
  moreover define t where "t = x + e / 2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3776
  ultimately have "x < t" "t \<in> ball x e"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3777
    by (auto simp: dist_real_def field_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3778
  with \<open>x \<in> interior I\<close> e interior_subset[of I] have "t \<in> I" "x \<in> I" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3779
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3780
  have "(f x - f y) / (x - y) \<le> Inf (?F x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3781
  proof (rule cInf_greatest)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3782
    have "(f x - f y) / (x - y) = (f y - f x) / (y - x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3783
      using \<open>y < x\<close> by (auto simp: field_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3784
    also
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3785
    fix z
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3786
    assume "z \<in> ?F x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3787
    with order_trans[OF convex_on_diff[OF \<open>convex_on I f\<close> \<open>y \<in> I\<close> _ \<open>y < x\<close>]]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3788
    have "(f y - f x) / (y - x) \<le> z"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3789
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3790
    finally show "(f x - f y) / (x - y) \<le> z" .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3791
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3792
    have "open (interior I)" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3793
    from openE[OF this \<open>x \<in> interior I\<close>]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3794
    obtain e where e: "0 < e" "ball x e \<subseteq> interior I" .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3795
    then have "x + e / 2 \<in> ball x e"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3796
      by (auto simp: dist_real_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3797
    with e interior_subset[of I] have "x + e / 2 \<in> {x<..} \<inter> I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3798
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3799
    then show "?F x \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3800
      by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3801
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3802
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3803
    using \<open>y < x\<close> by (simp add: field_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3804
qed simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3805
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  3806
subsection%unimportant\<open>Explicit formulas for interior and relative interior of convex hull\<close>
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3807
66765
c1dfa973b269 new theorem at_within_cbox_finite
paulson <lp15@cam.ac.uk>
parents: 66641
diff changeset
  3808
lemma at_within_cbox_finite:
c1dfa973b269 new theorem at_within_cbox_finite
paulson <lp15@cam.ac.uk>
parents: 66641
diff changeset
  3809
  assumes "x \<in> box a b" "x \<notin> S" "finite S"
c1dfa973b269 new theorem at_within_cbox_finite
paulson <lp15@cam.ac.uk>
parents: 66641
diff changeset
  3810
  shows "(at x within cbox a b - S) = at x"
c1dfa973b269 new theorem at_within_cbox_finite
paulson <lp15@cam.ac.uk>
parents: 66641
diff changeset
  3811
proof -
c1dfa973b269 new theorem at_within_cbox_finite
paulson <lp15@cam.ac.uk>
parents: 66641
diff changeset
  3812
  have "interior (cbox a b - S) = box a b - S"
c1dfa973b269 new theorem at_within_cbox_finite
paulson <lp15@cam.ac.uk>
parents: 66641
diff changeset
  3813
    using \<open>finite S\<close> by (simp add: interior_diff finite_imp_closed)
c1dfa973b269 new theorem at_within_cbox_finite
paulson <lp15@cam.ac.uk>
parents: 66641
diff changeset
  3814
  then show ?thesis
c1dfa973b269 new theorem at_within_cbox_finite
paulson <lp15@cam.ac.uk>
parents: 66641
diff changeset
  3815
    using at_within_interior assms by fastforce
c1dfa973b269 new theorem at_within_cbox_finite
paulson <lp15@cam.ac.uk>
parents: 66641
diff changeset
  3816
qed
c1dfa973b269 new theorem at_within_cbox_finite
paulson <lp15@cam.ac.uk>
parents: 66641
diff changeset
  3817
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3818
lemma affine_independent_convex_affine_hull:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3819
  fixes s :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3820
  assumes "~affine_dependent s" "t \<subseteq> s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3821
    shows "convex hull t = affine hull t \<inter> convex hull s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3822
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3823
  have fin: "finite s" "finite t" using assms aff_independent_finite finite_subset by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3824
    { fix u v x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3825
      assume uv: "sum u t = 1" "\<forall>x\<in>s. 0 \<le> v x" "sum v s = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3826
                 "(\<Sum>x\<in>s. v x *\<^sub>R x) = (\<Sum>v\<in>t. u v *\<^sub>R v)" "x \<in> t"
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67399
diff changeset
  3827
      then have s: "s = (s - t) \<union> t" \<comment> \<open>split into separate cases\<close>
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3828
        using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3829
      have [simp]: "(\<Sum>x\<in>t. v x *\<^sub>R x) + (\<Sum>x\<in>s - t. v x *\<^sub>R x) = (\<Sum>x\<in>t. u x *\<^sub>R x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3830
                   "sum v t + sum v (s - t) = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3831
        using uv fin s
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3832
        by (auto simp: sum.union_disjoint [symmetric] Un_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3833
      have "(\<Sum>x\<in>s. if x \<in> t then v x - u x else v x) = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3834
           "(\<Sum>x\<in>s. (if x \<in> t then v x - u x else v x) *\<^sub>R x) = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3835
        using uv fin
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3836
        by (subst s, subst sum.union_disjoint, auto simp: algebra_simps sum_subtractf)+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3837
    } note [simp] = this
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3838
  have "convex hull t \<subseteq> affine hull t"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3839
    using convex_hull_subset_affine_hull by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3840
  moreover have "convex hull t \<subseteq> convex hull s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3841
    using assms hull_mono by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3842
  moreover have "affine hull t \<inter> convex hull s \<subseteq> convex hull t"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3843
    using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3844
    apply (simp add: convex_hull_finite affine_hull_finite fin affine_dependent_explicit)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3845
    apply (drule_tac x=s in spec)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3846
    apply (auto simp: fin)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3847
    apply (rule_tac x=u in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3848
    apply (rename_tac v)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3849
    apply (drule_tac x="\<lambda>x. if x \<in> t then v x - u x else v x" in spec)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3850
    apply (force)+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3851
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3852
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3853
    by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3854
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3855
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3856
lemma affine_independent_span_eq:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3857
  fixes s :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3858
  assumes "~affine_dependent s" "card s = Suc (DIM ('a))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3859
    shows "affine hull s = UNIV"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3860
proof (cases "s = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3861
  case True then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3862
    using assms by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3863
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3864
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3865
    then obtain a t where t: "a \<notin> t" "s = insert a t"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3866
      by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3867
    then have fin: "finite t" using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3868
      by (metis finite_insert aff_independent_finite)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3869
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3870
    using assms t fin
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3871
      apply (simp add: affine_dependent_iff_dependent affine_hull_insert_span_gen)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3872
      apply (rule subset_antisym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3873
      apply force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3874
      apply (rule Fun.vimage_subsetD)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3875
      apply (metis add.commute diff_add_cancel surj_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3876
      apply (rule card_ge_dim_independent)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3877
      apply (auto simp: card_image inj_on_def dim_subset_UNIV)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3878
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3879
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3880
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3881
lemma affine_independent_span_gt:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3882
  fixes s :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3883
  assumes ind: "~ affine_dependent s" and dim: "DIM ('a) < card s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3884
    shows "affine hull s = UNIV"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3885
  apply (rule affine_independent_span_eq [OF ind])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3886
  apply (rule antisym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3887
  using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3888
  apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3889
  apply (metis add_2_eq_Suc' not_less_eq_eq affine_dependent_biggerset aff_independent_finite)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3890
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3891
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3892
lemma empty_interior_affine_hull:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3893
  fixes s :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3894
  assumes "finite s" and dim: "card s \<le> DIM ('a)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3895
    shows "interior(affine hull s) = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3896
  using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3897
  apply (induct s rule: finite_induct)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3898
  apply (simp_all add:  affine_dependent_iff_dependent affine_hull_insert_span_gen interior_translation)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3899
  apply (rule empty_interior_lowdim)
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  3900
  by (auto simp: Suc_le_lessD card_image_le dual_order.trans intro!: dim_le_card'[THEN le_less_trans])
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3901
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3902
lemma empty_interior_convex_hull:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3903
  fixes s :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3904
  assumes "finite s" and dim: "card s \<le> DIM ('a)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3905
    shows "interior(convex hull s) = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3906
  by (metis Diff_empty Diff_eq_empty_iff convex_hull_subset_affine_hull
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3907
            interior_mono empty_interior_affine_hull [OF assms])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3908
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3909
lemma explicit_subset_rel_interior_convex_hull:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3910
  fixes s :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3911
  shows "finite s
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3912
         \<Longrightarrow> {y. \<exists>u. (\<forall>x \<in> s. 0 < u x \<and> u x < 1) \<and> sum u s = 1 \<and> sum (\<lambda>x. u x *\<^sub>R x) s = y}
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3913
             \<subseteq> rel_interior (convex hull s)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3914
  by (force simp add:  rel_interior_convex_hull_union [where S="\<lambda>x. {x}" and I=s, simplified])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3915
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3916
lemma explicit_subset_rel_interior_convex_hull_minimal:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3917
  fixes s :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3918
  shows "finite s
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3919
         \<Longrightarrow> {y. \<exists>u. (\<forall>x \<in> s. 0 < u x) \<and> sum u s = 1 \<and> sum (\<lambda>x. u x *\<^sub>R x) s = y}
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3920
             \<subseteq> rel_interior (convex hull s)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3921
  by (force simp add:  rel_interior_convex_hull_union [where S="\<lambda>x. {x}" and I=s, simplified])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3922
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3923
lemma rel_interior_convex_hull_explicit:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3924
  fixes s :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3925
  assumes "~ affine_dependent s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3926
  shows "rel_interior(convex hull s) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3927
         {y. \<exists>u. (\<forall>x \<in> s. 0 < u x) \<and> sum u s = 1 \<and> sum (\<lambda>x. u x *\<^sub>R x) s = y}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3928
         (is "?lhs = ?rhs")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3929
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3930
  show "?rhs \<le> ?lhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3931
    by (simp add: aff_independent_finite explicit_subset_rel_interior_convex_hull_minimal assms)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3932
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3933
  show "?lhs \<le> ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3934
  proof (cases "\<exists>a. s = {a}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3935
    case True then show "?lhs \<le> ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3936
      by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3937
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3938
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3939
    have fs: "finite s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3940
      using assms by (simp add: aff_independent_finite)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3941
    { fix a b and d::real
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3942
      assume ab: "a \<in> s" "b \<in> s" "a \<noteq> b"
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67399
diff changeset
  3943
      then have s: "s = (s - {a,b}) \<union> {a,b}" \<comment> \<open>split into separate cases\<close>
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3944
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3945
      have "(\<Sum>x\<in>s. if x = a then - d else if x = b then d else 0) = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3946
           "(\<Sum>x\<in>s. (if x = a then - d else if x = b then d else 0) *\<^sub>R x) = d *\<^sub>R b - d *\<^sub>R a"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3947
        using ab fs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3948
        by (subst s, subst sum.union_disjoint, auto)+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3949
    } note [simp] = this
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3950
    { fix y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3951
      assume y: "y \<in> convex hull s" "y \<notin> ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3952
      { fix u T a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3953
        assume ua: "\<forall>x\<in>s. 0 \<le> u x" "sum u s = 1" "\<not> 0 < u a" "a \<in> s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3954
           and yT: "y = (\<Sum>x\<in>s. u x *\<^sub>R x)" "y \<in> T" "open T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3955
           and sb: "T \<inter> affine hull s \<subseteq> {w. \<exists>u. (\<forall>x\<in>s. 0 \<le> u x) \<and> sum u s = 1 \<and> (\<Sum>x\<in>s. u x *\<^sub>R x) = w}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3956
        have ua0: "u a = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3957
          using ua by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3958
        obtain b where b: "b\<in>s" "a \<noteq> b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3959
          using ua False by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3960
        obtain e where e: "0 < e" "ball (\<Sum>x\<in>s. u x *\<^sub>R x) e \<subseteq> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3961
          using yT by (auto elim: openE)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3962
        with b obtain d where d: "0 < d" "norm(d *\<^sub>R (a-b)) < e"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3963
          by (auto intro: that [of "e / 2 / norm(a-b)"])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3964
        have "(\<Sum>x\<in>s. u x *\<^sub>R x) \<in> affine hull s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3965
          using yT y by (metis affine_hull_convex_hull hull_redundant_eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3966
        then have "(\<Sum>x\<in>s. u x *\<^sub>R x) - d *\<^sub>R (a - b) \<in> affine hull s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3967
          using ua b by (auto simp: hull_inc intro: mem_affine_3_minus2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3968
        then have "y - d *\<^sub>R (a - b) \<in> T \<inter> affine hull s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3969
          using d e yT by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3970
        then obtain v where "\<forall>x\<in>s. 0 \<le> v x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3971
                            "sum v s = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3972
                            "(\<Sum>x\<in>s. v x *\<^sub>R x) = (\<Sum>x\<in>s. u x *\<^sub>R x) - d *\<^sub>R (a - b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3973
          using subsetD [OF sb] yT
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3974
          by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3975
        then have False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3976
          using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3977
          apply (simp add: affine_dependent_explicit_finite fs)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3978
          apply (drule_tac x="\<lambda>x. (v x - u x) - (if x = a then -d else if x = b then d else 0)" in spec)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3979
          using ua b d
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3980
          apply (auto simp: algebra_simps sum_subtractf sum.distrib)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3981
          done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3982
      } note * = this
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3983
      have "y \<notin> rel_interior (convex hull s)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3984
        using y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3985
        apply (simp add: mem_rel_interior affine_hull_convex_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3986
        apply (auto simp: convex_hull_finite [OF fs])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3987
        apply (drule_tac x=u in spec)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3988
        apply (auto intro: *)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3989
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3990
    } with rel_interior_subset show "?lhs \<le> ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3991
      by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3992
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3993
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3994
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3995
lemma interior_convex_hull_explicit_minimal:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3996
  fixes s :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3997
  shows
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3998
   "~ affine_dependent s
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3999
        ==> interior(convex hull s) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4000
             (if card(s) \<le> DIM('a) then {}
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4001
              else {y. \<exists>u. (\<forall>x \<in> s. 0 < u x) \<and> sum u s = 1 \<and> (\<Sum>x\<in>s. u x *\<^sub>R x) = y})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4002
  apply (simp add: aff_independent_finite empty_interior_convex_hull, clarify)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4003
  apply (rule trans [of _ "rel_interior(convex hull s)"])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4004
  apply (simp add: affine_hull_convex_hull affine_independent_span_gt rel_interior_interior)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4005
  by (simp add: rel_interior_convex_hull_explicit)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4006
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4007
lemma interior_convex_hull_explicit:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4008
  fixes s :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4009
  assumes "~ affine_dependent s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4010
  shows
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4011
   "interior(convex hull s) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4012
             (if card(s) \<le> DIM('a) then {}
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4013
              else {y. \<exists>u. (\<forall>x \<in> s. 0 < u x \<and> u x < 1) \<and> sum u s = 1 \<and> (\<Sum>x\<in>s. u x *\<^sub>R x) = y})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4014
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4015
  { fix u :: "'a \<Rightarrow> real" and a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4016
    assume "card Basis < card s" and u: "\<And>x. x\<in>s \<Longrightarrow> 0 < u x" "sum u s = 1" and a: "a \<in> s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4017
    then have cs: "Suc 0 < card s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4018
      by (metis DIM_positive less_trans_Suc)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4019
    obtain b where b: "b \<in> s" "a \<noteq> b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4020
    proof (cases "s \<le> {a}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4021
      case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4022
      then show thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4023
        using cs subset_singletonD by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4024
    next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4025
      case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4026
      then show thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4027
      by (blast intro: that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4028
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4029
    have "u a + u b \<le> sum u {a,b}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4030
      using a b by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4031
    also have "... \<le> sum u s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4032
      apply (rule Groups_Big.sum_mono2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4033
      using a b u
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4034
      apply (auto simp: less_imp_le aff_independent_finite assms)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4035
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4036
    finally have "u a < 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4037
      using \<open>b \<in> s\<close> u by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4038
  } note [simp] = this
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4039
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4040
    using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4041
    apply (auto simp: interior_convex_hull_explicit_minimal)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4042
    apply (rule_tac x=u in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4043
    apply (auto simp: not_le)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4044
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4045
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4046
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4047
lemma interior_closed_segment_ge2:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4048
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4049
  assumes "2 \<le> DIM('a)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4050
    shows  "interior(closed_segment a b) = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4051
using assms unfolding segment_convex_hull
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4052
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4053
  have "card {a, b} \<le> DIM('a)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4054
    using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4055
    by (simp add: card_insert_if linear not_less_eq_eq numeral_2_eq_2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4056
  then show "interior (convex hull {a, b}) = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4057
    by (metis empty_interior_convex_hull finite.insertI finite.emptyI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4058
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4059
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4060
lemma interior_open_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4061
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4062
  shows  "interior(open_segment a b) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4063
                 (if 2 \<le> DIM('a) then {} else open_segment a b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4064
proof (simp add: not_le, intro conjI impI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4065
  assume "2 \<le> DIM('a)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4066
  then show "interior (open_segment a b) = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4067
    apply (simp add: segment_convex_hull open_segment_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4068
    apply (metis Diff_subset interior_mono segment_convex_hull subset_empty interior_closed_segment_ge2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4069
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4070
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4071
  assume le2: "DIM('a) < 2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4072
  show "interior (open_segment a b) = open_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4073
  proof (cases "a = b")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4074
    case True then show ?thesis by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4075
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4076
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4077
    with le2 have "affine hull (open_segment a b) = UNIV"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4078
      apply simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4079
      apply (rule affine_independent_span_gt)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4080
      apply (simp_all add: affine_dependent_def insert_Diff_if)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4081
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4082
    then show "interior (open_segment a b) = open_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4083
      using rel_interior_interior rel_interior_open_segment by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4084
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4085
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4086
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4087
lemma interior_closed_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4088
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4089
  shows "interior(closed_segment a b) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4090
                 (if 2 \<le> DIM('a) then {} else open_segment a b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4091
proof (cases "a = b")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4092
  case True then show ?thesis by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4093
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4094
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4095
  then have "closure (open_segment a b) = closed_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4096
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4097
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4098
    by (metis (no_types) convex_interior_closure convex_open_segment interior_open_segment)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4099
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4100
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4101
lemmas interior_segment = interior_closed_segment interior_open_segment
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4102
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4103
lemma closed_segment_eq [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4104
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4105
  shows "closed_segment a b = closed_segment c d \<longleftrightarrow> {a,b} = {c,d}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4106
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4107
  assume abcd: "closed_segment a b = closed_segment c d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4108
  show "{a,b} = {c,d}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4109
  proof (cases "a=b \<or> c=d")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4110
    case True with abcd show ?thesis by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4111
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4112
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4113
    then have neq: "a \<noteq> b \<and> c \<noteq> d" by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4114
    have *: "closed_segment c d - {a, b} = rel_interior (closed_segment c d)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4115
      using neq abcd by (metis (no_types) open_segment_def rel_interior_closed_segment)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4116
    have "b \<in> {c, d}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4117
    proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4118
      have "insert b (closed_segment c d) = closed_segment c d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4119
        using abcd by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4120
      then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4121
        by (metis DiffD2 Diff_insert2 False * insertI1 insert_Diff_if open_segment_def rel_interior_closed_segment)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4122
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4123
    moreover have "a \<in> {c, d}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4124
      by (metis Diff_iff False * abcd ends_in_segment(1) insertI1 open_segment_def rel_interior_closed_segment)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4125
    ultimately show "{a, b} = {c, d}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4126
      using neq by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4127
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4128
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4129
  assume "{a,b} = {c,d}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4130
  then show "closed_segment a b = closed_segment c d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4131
    by (simp add: segment_convex_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4132
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4133
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4134
lemma closed_open_segment_eq [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4135
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4136
  shows "closed_segment a b \<noteq> open_segment c d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4137
by (metis DiffE closed_segment_neq_empty closure_closed_segment closure_open_segment ends_in_segment(1) insertI1 open_segment_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4138
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4139
lemma open_closed_segment_eq [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4140
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4141
  shows "open_segment a b \<noteq> closed_segment c d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4142
using closed_open_segment_eq by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4143
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4144
lemma open_segment_eq [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4145
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4146
  shows "open_segment a b = open_segment c d \<longleftrightarrow> a = b \<and> c = d \<or> {a,b} = {c,d}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4147
        (is "?lhs = ?rhs")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4148
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4149
  assume abcd: ?lhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4150
  show ?rhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4151
  proof (cases "a=b \<or> c=d")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4152
    case True with abcd show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4153
      using finite_open_segment by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4154
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4155
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4156
    then have a2: "a \<noteq> b \<and> c \<noteq> d" by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4157
    with abcd show ?rhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4158
      unfolding open_segment_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4159
      by (metis (no_types) abcd closed_segment_eq closure_open_segment)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4160
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4161
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4162
  assume ?rhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4163
  then show ?lhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4164
    by (metis Diff_cancel convex_hull_singleton insert_absorb2 open_segment_def segment_convex_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4165
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4166
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67962
diff changeset
  4167
subsection%unimportant\<open>Similar results for closure and (relative or absolute) frontier\<close>
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4168
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4169
lemma closure_convex_hull [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4170
  fixes s :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4171
  shows "compact s ==> closure(convex hull s) = convex hull s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4172
  by (simp add: compact_imp_closed compact_convex_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4173
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4174
lemma rel_frontier_convex_hull_explicit:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4175
  fixes s :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4176
  assumes "~ affine_dependent s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4177
  shows "rel_frontier(convex hull s) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4178
         {y. \<exists>u. (\<forall>x \<in> s. 0 \<le> u x) \<and> (\<exists>x \<in> s. u x = 0) \<and> sum u s = 1 \<and> sum (\<lambda>x. u x *\<^sub>R x) s = y}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4179
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4180
  have fs: "finite s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4181
    using assms by (simp add: aff_independent_finite)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4182
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4183
    apply (simp add: rel_frontier_def finite_imp_compact rel_interior_convex_hull_explicit assms fs)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4184
    apply (auto simp: convex_hull_finite fs)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4185
    apply (drule_tac x=u in spec)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4186
    apply (rule_tac x=u in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4187
    apply force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4188
    apply (rename_tac v)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4189
    apply (rule notE [OF assms])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4190
    apply (simp add: affine_dependent_explicit)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4191
    apply (rule_tac x=s in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4192
    apply (auto simp: fs)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4193
    apply (rule_tac x = "\<lambda>x. u x - v x" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4194
    apply (force simp: sum_subtractf scaleR_diff_left)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4195
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4196
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4197
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4198
lemma frontier_convex_hull_explicit:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4199
  fixes s :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4200
  assumes "~ affine_dependent s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4201
  shows "frontier(convex hull s) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4202
         {y. \<exists>u. (\<forall>x \<in> s. 0 \<le> u x) \<and> (DIM ('a) < card s \<longrightarrow> (\<exists>x \<in> s. u x = 0)) \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4203
             sum u s = 1 \<and> sum (\<lambda>x. u x *\<^sub>R x) s = y}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4204
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4205
  have fs: "finite s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4206
    using assms by (simp add: aff_independent_finite)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4207
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4208
  proof (cases "DIM ('a) < card s")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4209
    case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4210
    with assms fs show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4211
      by (simp add: rel_frontier_def frontier_def rel_frontier_convex_hull_explicit [symmetric]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4212
                    interior_convex_hull_explicit_minimal rel_interior_convex_hull_explicit)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4213
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4214
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4215
    then have "card s \<le> DIM ('a)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4216
      by linarith
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4217
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4218
      using assms fs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4219
      apply (simp add: frontier_def interior_convex_hull_explicit finite_imp_compact)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4220
      apply (simp add: convex_hull_finite)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4221
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4222
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4223
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4224
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4225
lemma rel_frontier_convex_hull_cases:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4226
  fixes s :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4227
  assumes "~ affine_dependent s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4228
  shows "rel_frontier(convex hull s) = \<Union>{convex hull (s - {x}) |x. x \<in> s}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4229
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4230
  have fs: "finite s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4231
    using assms by (simp add: aff_independent_finite)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4232
  { fix u a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4233
  have "\<forall>x\<in>s. 0 \<le> u x \<Longrightarrow> a \<in> s \<Longrightarrow> u a = 0 \<Longrightarrow> sum u s = 1 \<Longrightarrow>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4234
            \<exists>x v. x \<in> s \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4235
                  (\<forall>x\<in>s - {x}. 0 \<le> v x) \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4236
                      sum v (s - {x}) = 1 \<and> (\<Sum>x\<in>s - {x}. v x *\<^sub>R x) = (\<Sum>x\<in>s. u x *\<^sub>R x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4237
    apply (rule_tac x=a in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4238
    apply (rule_tac x=u in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4239
    apply (simp add: Groups_Big.sum_diff1 fs)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4240
    done }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4241
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4242
  { fix a u
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4243
    have "a \<in> s \<Longrightarrow> \<forall>x\<in>s - {a}. 0 \<le> u x \<Longrightarrow> sum u (s - {a}) = 1 \<Longrightarrow>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4244
            \<exists>v. (\<forall>x\<in>s. 0 \<le> v x) \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4245
                 (\<exists>x\<in>s. v x = 0) \<and> sum v s = 1 \<and> (\<Sum>x\<in>s. v x *\<^sub>R x) = (\<Sum>x\<in>s - {a}. u x *\<^sub>R x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4246
    apply (rule_tac x="\<lambda>x. if x = a then 0 else u x" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4247
    apply (auto simp: sum.If_cases Diff_eq if_smult fs)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4248
    done }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4249
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4250
    using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4251
    apply (simp add: rel_frontier_convex_hull_explicit)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4252
    apply (simp add: convex_hull_finite fs Union_SetCompr_eq, auto)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4253
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4254
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4255
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4256
lemma frontier_convex_hull_eq_rel_frontier:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4257
  fixes s :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4258
  assumes "~ affine_dependent s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4259
  shows "frontier(convex hull s) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4260
           (if card s \<le> DIM ('a) then convex hull s else rel_frontier(convex hull s))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4261
  using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4262
  unfolding rel_frontier_def frontier_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4263
  by (simp add: affine_independent_span_gt rel_interior_interior
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4264
                finite_imp_compact empty_interior_convex_hull aff_independent_finite)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4265
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4266
lemma frontier_convex_hull_cases:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4267
  fixes s :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4268
  assumes "~ affine_dependent s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4269
  shows "frontier(convex hull s) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4270
           (if card s \<le> DIM ('a) then convex hull s else \<Union>{convex hull (s - {x}) |x. x \<in> s})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4271
by (simp add: assms frontier_convex_hull_eq_rel_frontier rel_frontier_convex_hull_cases)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4272
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4273
lemma in_frontier_convex_hull:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4274
  fixes s :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4275
  assumes "finite s" "card s \<le> Suc (DIM ('a))" "x \<in> s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4276
  shows   "x \<in> frontier(convex hull s)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4277
proof (cases "affine_dependent s")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4278
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4279
  with assms show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4280
    apply (auto simp: affine_dependent_def frontier_def finite_imp_compact hull_inc)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4281
    by (metis card.insert_remove convex_hull_subset_affine_hull empty_interior_affine_hull finite_Diff hull_redundant insert_Diff insert_Diff_single insert_not_empty interior_mono not_less_eq_eq subset_empty)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4282
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4283
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4284
  { assume "card s = Suc (card Basis)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4285
    then have cs: "Suc 0 < card s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4286
      by (simp add: DIM_positive)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4287
    with subset_singletonD have "\<exists>y \<in> s. y \<noteq> x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4288
      by (cases "s \<le> {x}") fastforce+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4289
  } note [dest!] = this
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4290
  show ?thesis using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4291
    unfolding frontier_convex_hull_cases [OF False] Union_SetCompr_eq
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4292
    by (auto simp: le_Suc_eq hull_inc)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4293
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4294
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4295
lemma not_in_interior_convex_hull:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4296
  fixes s :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4297
  assumes "finite s" "card s \<le> Suc (DIM ('a))" "x \<in> s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4298
  shows   "x \<notin> interior(convex hull s)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4299
using in_frontier_convex_hull [OF assms]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4300
by (metis Diff_iff frontier_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4301
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4302
lemma interior_convex_hull_eq_empty:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4303
  fixes s :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4304
  assumes "card s = Suc (DIM ('a))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4305
  shows   "interior(convex hull s) = {} \<longleftrightarrow> affine_dependent s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4306
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4307
  { fix a b
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4308
    assume ab: "a \<in> interior (convex hull s)" "b \<in> s" "b \<in> affine hull (s - {b})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4309
    then have "interior(affine hull s) = {}" using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4310
      by (metis DIM_positive One_nat_def Suc_mono card.remove card_infinite empty_interior_affine_hull eq_iff hull_redundant insert_Diff not_less zero_le_one)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4311
    then have False using ab
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4312
      by (metis convex_hull_subset_affine_hull equals0D interior_mono subset_eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4313
  } then
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4314
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4315
    using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4316
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4317
    apply (metis UNIV_I affine_hull_convex_hull affine_hull_empty affine_independent_span_eq convex_convex_hull empty_iff rel_interior_interior rel_interior_same_affine_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4318
    apply (auto simp: affine_dependent_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4319
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4320
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4321
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4322
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4323
subsection \<open>Coplanarity, and collinearity in terms of affine hull\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4324
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  4325
definition%important coplanar  where
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4326
   "coplanar s \<equiv> \<exists>u v w. s \<subseteq> affine hull {u,v,w}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4327
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4328
lemma collinear_affine_hull:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4329
  "collinear s \<longleftrightarrow> (\<exists>u v. s \<subseteq> affine hull {u,v})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4330
proof (cases "s={}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4331
  case True then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4332
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4333
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4334
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4335
  then obtain x where x: "x \<in> s" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4336
  { fix u
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4337
    assume *: "\<And>x y. \<lbrakk>x\<in>s; y\<in>s\<rbrakk> \<Longrightarrow> \<exists>c. x - y = c *\<^sub>R u"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4338
    have "\<exists>u v. s \<subseteq> {a *\<^sub>R u + b *\<^sub>R v |a b. a + b = 1}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4339
      apply (rule_tac x=x in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4340
      apply (rule_tac x="x+u" in exI, clarify)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4341
      apply (erule exE [OF * [OF x]])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4342
      apply (rename_tac c)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4343
      apply (rule_tac x="1+c" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4344
      apply (rule_tac x="-c" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4345
      apply (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4346
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4347
  } moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4348
  { fix u v x y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4349
    assume *: "s \<subseteq> {a *\<^sub>R u + b *\<^sub>R v |a b. a + b = 1}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4350
    have "x\<in>s \<Longrightarrow> y\<in>s \<Longrightarrow> \<exists>c. x - y = c *\<^sub>R (v-u)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4351
      apply (drule subsetD [OF *])+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4352
      apply simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4353
      apply clarify
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4354
      apply (rename_tac r1 r2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4355
      apply (rule_tac x="r1-r2" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4356
      apply (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4357
      apply (metis scaleR_left.add)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4358
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4359
  } ultimately
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4360
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4361
  unfolding collinear_def affine_hull_2
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4362
    by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4363
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4364
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4365
lemma collinear_closed_segment [simp]: "collinear (closed_segment a b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4366
by (metis affine_hull_convex_hull collinear_affine_hull hull_subset segment_convex_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4367
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4368
lemma collinear_open_segment [simp]: "collinear (open_segment a b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4369
  unfolding open_segment_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4370
  by (metis convex_hull_subset_affine_hull segment_convex_hull dual_order.trans
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4371
    convex_hull_subset_affine_hull Diff_subset collinear_affine_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4372
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4373
lemma collinear_between_cases:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4374
  fixes c :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4375
  shows "collinear {a,b,c} \<longleftrightarrow> between (b,c) a \<or> between (c,a) b \<or> between (a,b) c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4376
         (is "?lhs = ?rhs")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4377
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4378
  assume ?lhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4379
  then obtain u v where uv: "\<And>x. x \<in> {a, b, c} \<Longrightarrow> \<exists>c. x = u + c *\<^sub>R v"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4380
    by (auto simp: collinear_alt)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4381
  show ?rhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4382
    using uv [of a] uv [of b] uv [of c] by (auto simp: between_1)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4383
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4384
  assume ?rhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4385
  then show ?lhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4386
    unfolding between_mem_convex_hull
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4387
    by (metis (no_types, hide_lams) collinear_closed_segment collinear_subset hull_redundant hull_subset insert_commute segment_convex_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4388
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4389
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4390
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4391
lemma subset_continuous_image_segment_1:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4392
  fixes f :: "'a::euclidean_space \<Rightarrow> real"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4393
  assumes "continuous_on (closed_segment a b) f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4394
  shows "closed_segment (f a) (f b) \<subseteq> image f (closed_segment a b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4395
by (metis connected_segment convex_contains_segment ends_in_segment imageI
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4396
           is_interval_connected_1 is_interval_convex connected_continuous_image [OF assms])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4397
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4398
lemma continuous_injective_image_segment_1:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4399
  fixes f :: "'a::euclidean_space \<Rightarrow> real"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4400
  assumes contf: "continuous_on (closed_segment a b) f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4401
      and injf: "inj_on f (closed_segment a b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4402
  shows "f ` (closed_segment a b) = closed_segment (f a) (f b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4403
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4404
  show "closed_segment (f a) (f b) \<subseteq> f ` closed_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4405
    by (metis subset_continuous_image_segment_1 contf)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4406
  show "f ` closed_segment a b \<subseteq> closed_segment (f a) (f b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4407
  proof (cases "a = b")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4408
    case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4409
    then show ?thesis by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4410
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4411
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4412
    then have fnot: "f a \<noteq> f b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4413
      using inj_onD injf by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4414
    moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4415
    have "f a \<notin> open_segment (f c) (f b)" if c: "c \<in> closed_segment a b" for c
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4416
    proof (clarsimp simp add: open_segment_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4417
      assume fa: "f a \<in> closed_segment (f c) (f b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4418
      moreover have "closed_segment (f c) (f b) \<subseteq> f ` closed_segment c b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4419
        by (meson closed_segment_subset contf continuous_on_subset convex_closed_segment ends_in_segment(2) subset_continuous_image_segment_1 that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4420
      ultimately have "f a \<in> f ` closed_segment c b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4421
        by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4422
      then have a: "a \<in> closed_segment c b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4423
        by (meson ends_in_segment inj_on_image_mem_iff_alt injf subset_closed_segment that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4424
      have cb: "closed_segment c b \<subseteq> closed_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4425
        by (simp add: closed_segment_subset that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4426
      show "f a = f c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4427
      proof (rule between_antisym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4428
        show "between (f c, f b) (f a)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4429
          by (simp add: between_mem_segment fa)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4430
        show "between (f a, f b) (f c)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4431
          by (metis a cb between_antisym between_mem_segment between_triv1 subset_iff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4432
      qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4433
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4434
    moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4435
    have "f b \<notin> open_segment (f a) (f c)" if c: "c \<in> closed_segment a b" for c
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4436
    proof (clarsimp simp add: open_segment_def fnot eq_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4437
      assume fb: "f b \<in> closed_segment (f a) (f c)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4438
      moreover have "closed_segment (f a) (f c) \<subseteq> f ` closed_segment a c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4439
        by (meson contf continuous_on_subset ends_in_segment(1) subset_closed_segment subset_continuous_image_segment_1 that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4440
      ultimately have "f b \<in> f ` closed_segment a c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4441
        by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4442
      then have b: "b \<in> closed_segment a c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4443
        by (meson ends_in_segment inj_on_image_mem_iff_alt injf subset_closed_segment that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4444
      have ca: "closed_segment a c \<subseteq> closed_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4445
        by (simp add: closed_segment_subset that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4446
      show "f b = f c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4447
      proof (rule between_antisym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4448
        show "between (f c, f a) (f b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4449
          by (simp add: between_commute between_mem_segment fb)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4450
        show "between (f b, f a) (f c)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4451
          by (metis b between_antisym between_commute between_mem_segment between_triv2 that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4452
      qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4453
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4454
    ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4455
      by (force simp: closed_segment_eq_real_ivl open_segment_eq_real_ivl split: if_split_asm)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4456
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4457
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4458
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4459
lemma continuous_injective_image_open_segment_1:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4460
  fixes f :: "'a::euclidean_space \<Rightarrow> real"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4461
  assumes contf: "continuous_on (closed_segment a b) f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4462
      and injf: "inj_on f (closed_segment a b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4463
    shows "f ` (open_segment a b) = open_segment (f a) (f b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4464
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4465
  have "f ` (open_segment a b) = f ` (closed_segment a b) - {f a, f b}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4466
    by (metis (no_types, hide_lams) empty_subsetI ends_in_segment image_insert image_is_empty inj_on_image_set_diff injf insert_subset open_segment_def segment_open_subset_closed)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4467
  also have "... = open_segment (f a) (f b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4468
    using continuous_injective_image_segment_1 [OF assms]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4469
    by (simp add: open_segment_def inj_on_image_set_diff [OF injf])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4470
  finally show ?thesis .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4471
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4472
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4473
lemma collinear_imp_coplanar:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4474
  "collinear s ==> coplanar s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4475
by (metis collinear_affine_hull coplanar_def insert_absorb2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4476
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4477
lemma collinear_small:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4478
  assumes "finite s" "card s \<le> 2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4479
    shows "collinear s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4480
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4481
  have "card s = 0 \<or> card s = 1 \<or> card s = 2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4482
    using assms by linarith
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4483
  then show ?thesis using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4484
    using card_eq_SucD
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4485
    by auto (metis collinear_2 numeral_2_eq_2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4486
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4487
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4488
lemma coplanar_small:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4489
  assumes "finite s" "card s \<le> 3"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4490
    shows "coplanar s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4491
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4492
  have "card s \<le> 2 \<or> card s = Suc (Suc (Suc 0))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4493
    using assms by linarith
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4494
  then show ?thesis using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4495
    apply safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4496
    apply (simp add: collinear_small collinear_imp_coplanar)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4497
    apply (safe dest!: card_eq_SucD)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4498
    apply (auto simp: coplanar_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4499
    apply (metis hull_subset insert_subset)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4500
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4501
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4502
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4503
lemma coplanar_empty: "coplanar {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4504
  by (simp add: coplanar_small)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4505
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4506
lemma coplanar_sing: "coplanar {a}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4507
  by (simp add: coplanar_small)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4508
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4509
lemma coplanar_2: "coplanar {a,b}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4510
  by (auto simp: card_insert_if coplanar_small)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4511
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4512
lemma coplanar_3: "coplanar {a,b,c}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4513
  by (auto simp: card_insert_if coplanar_small)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4514
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4515
lemma collinear_affine_hull_collinear: "collinear(affine hull s) \<longleftrightarrow> collinear s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4516
  unfolding collinear_affine_hull
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4517
  by (metis affine_affine_hull subset_hull hull_hull hull_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4518
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4519
lemma coplanar_affine_hull_coplanar: "coplanar(affine hull s) \<longleftrightarrow> coplanar s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4520
  unfolding coplanar_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4521
  by (metis affine_affine_hull subset_hull hull_hull hull_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4522
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4523
lemma coplanar_linear_image:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4524
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4525
  assumes "coplanar s" "linear f" shows "coplanar(f ` s)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4526
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4527
  { fix u v w
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4528
    assume "s \<subseteq> affine hull {u, v, w}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4529
    then have "f ` s \<subseteq> f ` (affine hull {u, v, w})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4530
      by (simp add: image_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4531
    then have "f ` s \<subseteq> affine hull (f ` {u, v, w})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4532
      by (metis assms(2) linear_conv_bounded_linear affine_hull_linear_image)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4533
  } then
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4534
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4535
    by auto (meson assms(1) coplanar_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4536
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4537
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4538
lemma coplanar_translation_imp: "coplanar s \<Longrightarrow> coplanar ((\<lambda>x. a + x) ` s)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4539
  unfolding coplanar_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4540
  apply clarify
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4541
  apply (rule_tac x="u+a" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4542
  apply (rule_tac x="v+a" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4543
  apply (rule_tac x="w+a" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4544
  using affine_hull_translation [of a "{u,v,w}" for u v w]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4545
  apply (force simp: add.commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4546
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4547
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4548
lemma coplanar_translation_eq: "coplanar((\<lambda>x. a + x) ` s) \<longleftrightarrow> coplanar s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4549
    by (metis (no_types) coplanar_translation_imp translation_galois)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4550
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4551
lemma coplanar_linear_image_eq:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4552
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4553
  assumes "linear f" "inj f" shows "coplanar(f ` s) = coplanar s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4554
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4555
  assume "coplanar s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4556
  then show "coplanar (f ` s)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4557
    unfolding coplanar_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4558
    using affine_hull_linear_image [of f "{u,v,w}" for u v w]  assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4559
    by (meson coplanar_def coplanar_linear_image)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4560
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4561
  obtain g where g: "linear g" "g \<circ> f = id"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4562
    using linear_injective_left_inverse [OF assms]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4563
    by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4564
  assume "coplanar (f ` s)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4565
  then obtain u v w where "f ` s \<subseteq> affine hull {u, v, w}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4566
    by (auto simp: coplanar_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4567
  then have "g ` f ` s \<subseteq> g ` (affine hull {u, v, w})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4568
    by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4569
  then have "s \<subseteq> g ` (affine hull {u, v, w})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4570
    using g by (simp add: Fun.image_comp)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4571
  then show "coplanar s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4572
    unfolding coplanar_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4573
    using affine_hull_linear_image [of g "{u,v,w}" for u v w]  \<open>linear g\<close> linear_conv_bounded_linear
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4574
    by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4575
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4576
(*The HOL Light proof is simply
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4577
    MATCH_ACCEPT_TAC(LINEAR_INVARIANT_RULE COPLANAR_LINEAR_IMAGE));;
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4578
*)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4579
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4580
lemma coplanar_subset: "\<lbrakk>coplanar t; s \<subseteq> t\<rbrakk> \<Longrightarrow> coplanar s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4581
  by (meson coplanar_def order_trans)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4582
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4583
lemma affine_hull_3_imp_collinear: "c \<in> affine hull {a,b} \<Longrightarrow> collinear {a,b,c}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4584
  by (metis collinear_2 collinear_affine_hull_collinear hull_redundant insert_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4585
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4586
lemma collinear_3_imp_in_affine_hull: "\<lbrakk>collinear {a,b,c}; a \<noteq> b\<rbrakk> \<Longrightarrow> c \<in> affine hull {a,b}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4587
  unfolding collinear_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4588
  apply clarify
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4589
  apply (frule_tac x=b in bspec, blast, drule_tac x=a in bspec, blast, erule exE)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4590
  apply (drule_tac x=c in bspec, blast, drule_tac x=a in bspec, blast, erule exE)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4591
  apply (rename_tac y x)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4592
  apply (simp add: affine_hull_2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4593
  apply (rule_tac x="1 - x/y" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4594
  apply (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4595
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4596
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4597
lemma collinear_3_affine_hull:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4598
  assumes "a \<noteq> b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4599
    shows "collinear {a,b,c} \<longleftrightarrow> c \<in> affine hull {a,b}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4600
using affine_hull_3_imp_collinear assms collinear_3_imp_in_affine_hull by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4601
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4602
lemma collinear_3_eq_affine_dependent:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4603
  "collinear{a,b,c} \<longleftrightarrow> a = b \<or> a = c \<or> b = c \<or> affine_dependent {a,b,c}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4604
apply (case_tac "a=b", simp)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4605
apply (case_tac "a=c")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4606
apply (simp add: insert_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4607
apply (case_tac "b=c")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4608
apply (simp add: insert_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4609
apply (auto simp: affine_dependent_def collinear_3_affine_hull insert_Diff_if)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4610
apply (metis collinear_3_affine_hull insert_commute)+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4611
done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4612
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4613
lemma affine_dependent_imp_collinear_3:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4614
  "affine_dependent {a,b,c} \<Longrightarrow> collinear{a,b,c}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4615
by (simp add: collinear_3_eq_affine_dependent)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4616
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4617
lemma collinear_3: "NO_MATCH 0 x \<Longrightarrow> collinear {x,y,z} \<longleftrightarrow> collinear {0, x-y, z-y}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4618
  by (auto simp add: collinear_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4619
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4620
lemma collinear_3_expand:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4621
   "collinear{a,b,c} \<longleftrightarrow> a = c \<or> (\<exists>u. b = u *\<^sub>R a + (1 - u) *\<^sub>R c)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4622
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4623
  have "collinear{a,b,c} = collinear{a,c,b}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4624
    by (simp add: insert_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4625
  also have "... = collinear {0, a - c, b - c}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4626
    by (simp add: collinear_3)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4627
  also have "... \<longleftrightarrow> (a = c \<or> b = c \<or> (\<exists>ca. b - c = ca *\<^sub>R (a - c)))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4628
    by (simp add: collinear_lemma)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4629
  also have "... \<longleftrightarrow> a = c \<or> (\<exists>u. b = u *\<^sub>R a + (1 - u) *\<^sub>R c)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4630
    by (cases "a = c \<or> b = c") (auto simp: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4631
  finally show ?thesis .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4632
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4633
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4634
lemma collinear_aff_dim: "collinear S \<longleftrightarrow> aff_dim S \<le> 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4635
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4636
  assume "collinear S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4637
  then obtain u and v :: "'a" where "aff_dim S \<le> aff_dim {u,v}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4638
    by (metis \<open>collinear S\<close> aff_dim_affine_hull aff_dim_subset collinear_affine_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4639
  then show "aff_dim S \<le> 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4640
    using order_trans by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4641
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4642
  assume "aff_dim S \<le> 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4643
  then have le1: "aff_dim (affine hull S) \<le> 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4644
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4645
  obtain B where "B \<subseteq> S" and B: "\<not> affine_dependent B" "affine hull S = affine hull B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4646
    using affine_basis_exists [of S] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4647
  then have "finite B" "card B \<le> 2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4648
    using B le1 by (auto simp: affine_independent_iff_card)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4649
  then have "collinear B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4650
    by (rule collinear_small)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4651
  then show "collinear S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4652
    by (metis \<open>affine hull S = affine hull B\<close> collinear_affine_hull_collinear)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4653
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4654
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4655
lemma collinear_midpoint: "collinear{a,midpoint a b,b}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4656
  apply (auto simp: collinear_3 collinear_lemma)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4657
  apply (drule_tac x="-1" in spec)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4658
  apply (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4659
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4660
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4661
lemma midpoint_collinear:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4662
  fixes a b c :: "'a::real_normed_vector"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4663
  assumes "a \<noteq> c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4664
    shows "b = midpoint a c \<longleftrightarrow> collinear{a,b,c} \<and> dist a b = dist b c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4665
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4666
  have *: "a - (u *\<^sub>R a + (1 - u) *\<^sub>R c) = (1 - u) *\<^sub>R (a - c)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4667
          "u *\<^sub>R a + (1 - u) *\<^sub>R c - c = u *\<^sub>R (a - c)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4668
          "\<bar>1 - u\<bar> = \<bar>u\<bar> \<longleftrightarrow> u = 1/2" for u::real
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4669
    by (auto simp: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4670
  have "b = midpoint a c \<Longrightarrow> collinear{a,b,c} "
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4671
    using collinear_midpoint by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4672
  moreover have "collinear{a,b,c} \<Longrightarrow> b = midpoint a c \<longleftrightarrow> dist a b = dist b c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4673
    apply (auto simp: collinear_3_expand assms dist_midpoint)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4674
    apply (simp add: dist_norm * assms midpoint_def del: divide_const_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4675
    apply (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4676
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4677
  ultimately show ?thesis by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4678
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4679
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4680
lemma between_imp_collinear:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4681
  fixes x :: "'a :: euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4682
  assumes "between (a,b) x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4683
    shows "collinear {a,x,b}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4684
proof (cases "x = a \<or> x = b \<or> a = b")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4685
  case True with assms show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4686
    by (auto simp: dist_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4687
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4688
  case False with assms show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4689
    apply (auto simp: collinear_3 collinear_lemma between_norm)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4690
    apply (drule_tac x="-(norm(b - x) / norm(x - a))" in spec)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4691
    apply (simp add: vector_add_divide_simps eq_vector_fraction_iff real_vector.scale_minus_right [symmetric])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4692
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4693
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4694
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4695
lemma midpoint_between:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4696
  fixes a b :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4697
  shows "b = midpoint a c \<longleftrightarrow> between (a,c) b \<and> dist a b = dist b c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4698
proof (cases "a = c")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4699
  case True then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4700
    by (auto simp: dist_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4701
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4702
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4703
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4704
    apply (rule iffI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4705
    apply (simp add: between_midpoint(1) dist_midpoint)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4706
    using False between_imp_collinear midpoint_collinear by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4707
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4708
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4709
lemma collinear_triples:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4710
  assumes "a \<noteq> b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4711
    shows "collinear(insert a (insert b S)) \<longleftrightarrow> (\<forall>x \<in> S. collinear{a,b,x})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4712
          (is "?lhs = ?rhs")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4713
proof safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4714
  fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4715
  assume ?lhs and "x \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4716
  then show "collinear {a, b, x}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4717
    using collinear_subset by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4718
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4719
  assume ?rhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4720
  then have "\<forall>x \<in> S. collinear{a,x,b}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4721
    by (simp add: insert_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4722
  then have *: "\<exists>u. x = u *\<^sub>R a + (1 - u) *\<^sub>R b" if "x \<in> (insert a (insert b S))" for x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4723
    using that assms collinear_3_expand by fastforce+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4724
  show ?lhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4725
    unfolding collinear_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4726
    apply (rule_tac x="b-a" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4727
    apply (clarify dest!: *)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4728
    by (metis (no_types, hide_lams) add.commute diff_add_cancel diff_diff_eq2 real_vector.scale_right_diff_distrib scaleR_left.diff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4729
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4730
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4731
lemma collinear_4_3:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4732
  assumes "a \<noteq> b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4733
    shows "collinear {a,b,c,d} \<longleftrightarrow> collinear{a,b,c} \<and> collinear{a,b,d}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4734
  using collinear_triples [OF assms, of "{c,d}"] by (force simp:)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4735
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4736
lemma collinear_3_trans:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4737
  assumes "collinear{a,b,c}" "collinear{b,c,d}" "b \<noteq> c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4738
    shows "collinear{a,b,d}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4739
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4740
  have "collinear{b,c,a,d}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4741
    by (metis (full_types) assms collinear_4_3 insert_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4742
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4743
    by (simp add: collinear_subset)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4744
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4745
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4746
lemma affine_hull_eq_empty [simp]: "affine hull S = {} \<longleftrightarrow> S = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4747
  using affine_hull_nonempty by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4748
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4749
lemma affine_hull_2_alt:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4750
  fixes a b :: "'a::real_vector"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4751
  shows "affine hull {a,b} = range (\<lambda>u. a + u *\<^sub>R (b - a))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4752
apply (simp add: affine_hull_2, safe)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4753
apply (rule_tac x=v in image_eqI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4754
apply (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4755
apply (metis scaleR_add_left scaleR_one, simp)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4756
apply (rule_tac x="1-u" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4757
apply (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4758
done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4759
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4760
lemma interior_convex_hull_3_minimal:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4761
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4762
  shows "\<lbrakk>~ collinear{a,b,c}; DIM('a) = 2\<rbrakk>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4763
         \<Longrightarrow> interior(convex hull {a,b,c}) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4764
                {v. \<exists>x y z. 0 < x \<and> 0 < y \<and> 0 < z \<and> x + y + z = 1 \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4765
                            x *\<^sub>R a + y *\<^sub>R b + z *\<^sub>R c = v}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4766
apply (simp add: collinear_3_eq_affine_dependent interior_convex_hull_explicit_minimal, safe)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4767
apply (rule_tac x="u a" in exI, simp)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4768
apply (rule_tac x="u b" in exI, simp)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4769
apply (rule_tac x="u c" in exI, simp)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4770
apply (rename_tac uu x y z)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4771
apply (rule_tac x="\<lambda>r. (if r=a then x else if r=b then y else if r=c then z else 0)" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4772
apply simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4773
done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4774
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4775
subsection\<open>The infimum of the distance between two sets\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4776
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  4777
definition%important setdist :: "'a::metric_space set \<Rightarrow> 'a set \<Rightarrow> real" where
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4778
  "setdist s t \<equiv>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4779
       (if s = {} \<or> t = {} then 0
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4780
        else Inf {dist x y| x y. x \<in> s \<and> y \<in> t})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4781
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4782
lemma setdist_empty1 [simp]: "setdist {} t = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4783
  by (simp add: setdist_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4784
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4785
lemma setdist_empty2 [simp]: "setdist t {} = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4786
  by (simp add: setdist_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4787
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4788
lemma setdist_pos_le [simp]: "0 \<le> setdist s t"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4789
  by (auto simp: setdist_def ex_in_conv [symmetric] intro: cInf_greatest)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4790
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4791
lemma le_setdistI:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4792
  assumes "s \<noteq> {}" "t \<noteq> {}" "\<And>x y. \<lbrakk>x \<in> s; y \<in> t\<rbrakk> \<Longrightarrow> d \<le> dist x y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4793
    shows "d \<le> setdist s t"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4794
  using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4795
  by (auto simp: setdist_def Set.ex_in_conv [symmetric] intro: cInf_greatest)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4796
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4797
lemma setdist_le_dist: "\<lbrakk>x \<in> s; y \<in> t\<rbrakk> \<Longrightarrow> setdist s t \<le> dist x y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4798
  unfolding setdist_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4799
  by (auto intro!: bdd_belowI [where m=0] cInf_lower)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4800
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4801
lemma le_setdist_iff:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4802
        "d \<le> setdist s t \<longleftrightarrow>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4803
        (\<forall>x \<in> s. \<forall>y \<in> t. d \<le> dist x y) \<and> (s = {} \<or> t = {} \<longrightarrow> d \<le> 0)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4804
  apply (cases "s = {} \<or> t = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4805
  apply (force simp add: setdist_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4806
  apply (intro iffI conjI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4807
  using setdist_le_dist apply fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4808
  apply (auto simp: intro: le_setdistI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4809
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4810
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4811
lemma setdist_ltE:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4812
  assumes "setdist s t < b" "s \<noteq> {}" "t \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4813
    obtains x y where "x \<in> s" "y \<in> t" "dist x y < b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4814
using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4815
by (auto simp: not_le [symmetric] le_setdist_iff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4816
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4817
lemma setdist_refl: "setdist s s = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4818
  apply (cases "s = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4819
  apply (force simp add: setdist_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4820
  apply (rule antisym [OF _ setdist_pos_le])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4821
  apply (metis all_not_in_conv dist_self setdist_le_dist)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4822
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4823
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4824
lemma setdist_sym: "setdist s t = setdist t s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4825
  by (force simp: setdist_def dist_commute intro!: arg_cong [where f=Inf])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4826
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4827
lemma setdist_triangle: "setdist s t \<le> setdist s {a} + setdist {a} t"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4828
proof (cases "s = {} \<or> t = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4829
  case True then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4830
    using setdist_pos_le by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4831
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4832
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4833
  have "\<And>x. x \<in> s \<Longrightarrow> setdist s t - dist x a \<le> setdist {a} t"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4834
    apply (rule le_setdistI, blast)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4835
    using False apply (fastforce intro: le_setdistI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4836
    apply (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4837
    apply (metis dist_commute dist_triangle3 order_trans [OF setdist_le_dist])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4838
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4839
  then have "setdist s t - setdist {a} t \<le> setdist s {a}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4840
    using False by (fastforce intro: le_setdistI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4841
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4842
    by (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4843
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4844
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4845
lemma setdist_singletons [simp]: "setdist {x} {y} = dist x y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4846
  by (simp add: setdist_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4847
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4848
lemma setdist_Lipschitz: "\<bar>setdist {x} s - setdist {y} s\<bar> \<le> dist x y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4849
  apply (subst setdist_singletons [symmetric])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4850
  by (metis abs_diff_le_iff diff_le_eq setdist_triangle setdist_sym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4851
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4852
lemma continuous_at_setdist [continuous_intros]: "continuous (at x) (\<lambda>y. (setdist {y} s))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4853
  by (force simp: continuous_at_eps_delta dist_real_def intro: le_less_trans [OF setdist_Lipschitz])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4854
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4855
lemma continuous_on_setdist [continuous_intros]: "continuous_on t (\<lambda>y. (setdist {y} s))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4856
  by (metis continuous_at_setdist continuous_at_imp_continuous_on)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4857
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4858
lemma uniformly_continuous_on_setdist: "uniformly_continuous_on t (\<lambda>y. (setdist {y} s))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4859
  by (force simp: uniformly_continuous_on_def dist_real_def intro: le_less_trans [OF setdist_Lipschitz])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4860
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4861
lemma setdist_subset_right: "\<lbrakk>t \<noteq> {}; t \<subseteq> u\<rbrakk> \<Longrightarrow> setdist s u \<le> setdist s t"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4862
  apply (cases "s = {} \<or> u = {}", force)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4863
  apply (auto simp: setdist_def intro!: bdd_belowI [where m=0] cInf_superset_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4864
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4865
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4866
lemma setdist_subset_left: "\<lbrakk>s \<noteq> {}; s \<subseteq> t\<rbrakk> \<Longrightarrow> setdist t u \<le> setdist s u"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4867
  by (metis setdist_subset_right setdist_sym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4868
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4869
lemma setdist_closure_1 [simp]: "setdist (closure s) t = setdist s t"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4870
proof (cases "s = {} \<or> t = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4871
  case True then show ?thesis by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4872
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4873
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4874
  { fix y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4875
    assume "y \<in> t"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4876
    have "continuous_on (closure s) (\<lambda>a. dist a y)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4877
      by (auto simp: continuous_intros dist_norm)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4878
    then have *: "\<And>x. x \<in> closure s \<Longrightarrow> setdist s t \<le> dist x y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4879
      apply (rule continuous_ge_on_closure)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4880
      apply assumption
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4881
      apply (blast intro: setdist_le_dist \<open>y \<in> t\<close> )
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4882
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4883
  } note * = this
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4884
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4885
    apply (rule antisym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4886
     using False closure_subset apply (blast intro: setdist_subset_left)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4887
    using False *
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4888
    apply (force simp add: closure_eq_empty intro!: le_setdistI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4889
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4890
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4891
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4892
lemma setdist_closure_2 [simp]: "setdist t (closure s) = setdist t s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4893
by (metis setdist_closure_1 setdist_sym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4894
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4895
lemma setdist_compact_closed:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4896
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4897
  assumes S: "compact S" and T: "closed T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4898
      and "S \<noteq> {}" "T \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4899
    shows "\<exists>x \<in> S. \<exists>y \<in> T. dist x y = setdist S T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4900
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4901
  have "(\<Union>x\<in> S. \<Union>y \<in> T. {x - y}) \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4902
    using assms by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4903
  then have "\<exists>x \<in> S. \<exists>y \<in> T. dist x y \<le> setdist S T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4904
    apply (rule distance_attains_inf [where a=0, OF compact_closed_differences [OF S T]])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4905
    apply (simp add: dist_norm le_setdist_iff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4906
    apply blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4907
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4908
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4909
    by (blast intro!: antisym [OF _ setdist_le_dist] )
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4910
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4911
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4912
lemma setdist_closed_compact:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4913
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4914
  assumes S: "closed S" and T: "compact T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4915
      and "S \<noteq> {}" "T \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4916
    shows "\<exists>x \<in> S. \<exists>y \<in> T. dist x y = setdist S T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4917
  using setdist_compact_closed [OF T S \<open>T \<noteq> {}\<close> \<open>S \<noteq> {}\<close>]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4918
  by (metis dist_commute setdist_sym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4919
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4920
lemma setdist_eq_0I: "\<lbrakk>x \<in> S; x \<in> T\<rbrakk> \<Longrightarrow> setdist S T = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4921
  by (metis antisym dist_self setdist_le_dist setdist_pos_le)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4922
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4923
lemma setdist_eq_0_compact_closed:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4924
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4925
  assumes S: "compact S" and T: "closed T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4926
    shows "setdist S T = 0 \<longleftrightarrow> S = {} \<or> T = {} \<or> S \<inter> T \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4927
  apply (cases "S = {} \<or> T = {}", force)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4928
  using setdist_compact_closed [OF S T]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4929
  apply (force intro: setdist_eq_0I )
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4930
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4931
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4932
corollary setdist_gt_0_compact_closed:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4933
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4934
  assumes S: "compact S" and T: "closed T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4935
    shows "setdist S T > 0 \<longleftrightarrow> (S \<noteq> {} \<and> T \<noteq> {} \<and> S \<inter> T = {})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4936
  using setdist_pos_le [of S T] setdist_eq_0_compact_closed [OF assms]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4937
  by linarith
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4938
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4939
lemma setdist_eq_0_closed_compact:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4940
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4941
  assumes S: "closed S" and T: "compact T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4942
    shows "setdist S T = 0 \<longleftrightarrow> S = {} \<or> T = {} \<or> S \<inter> T \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4943
  using setdist_eq_0_compact_closed [OF T S]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4944
  by (metis Int_commute setdist_sym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4945
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4946
lemma setdist_eq_0_bounded:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4947
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4948
  assumes "bounded S \<or> bounded T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4949
    shows "setdist S T = 0 \<longleftrightarrow> S = {} \<or> T = {} \<or> closure S \<inter> closure T \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4950
  apply (cases "S = {} \<or> T = {}", force)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4951
  using setdist_eq_0_compact_closed [of "closure S" "closure T"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4952
        setdist_eq_0_closed_compact [of "closure S" "closure T"] assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4953
  apply (force simp add:  bounded_closure compact_eq_bounded_closed)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4954
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4955
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4956
lemma setdist_unique:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4957
  "\<lbrakk>a \<in> S; b \<in> T; \<And>x y. x \<in> S \<and> y \<in> T ==> dist a b \<le> dist x y\<rbrakk>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4958
   \<Longrightarrow> setdist S T = dist a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4959
  by (force simp add: setdist_le_dist le_setdist_iff intro: antisym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4960
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4961
lemma setdist_closest_point:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4962
    "\<lbrakk>closed S; S \<noteq> {}\<rbrakk> \<Longrightarrow> setdist {a} S = dist a (closest_point S a)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4963
  apply (rule setdist_unique)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4964
  using closest_point_le
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4965
  apply (auto simp: closest_point_in_set)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4966
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4967
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4968
lemma setdist_eq_0_sing_1:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4969
    fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4970
    shows "setdist {x} S = 0 \<longleftrightarrow> S = {} \<or> x \<in> closure S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4971
  by (auto simp: setdist_eq_0_bounded)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4972
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4973
lemma setdist_eq_0_sing_2:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4974
    fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4975
    shows "setdist S {x} = 0 \<longleftrightarrow> S = {} \<or> x \<in> closure S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4976
  by (auto simp: setdist_eq_0_bounded)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4977
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4978
lemma setdist_neq_0_sing_1:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4979
    fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4980
    shows "\<lbrakk>setdist {x} S = a; a \<noteq> 0\<rbrakk> \<Longrightarrow> S \<noteq> {} \<and> x \<notin> closure S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4981
  by (auto simp: setdist_eq_0_sing_1)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4982
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4983
lemma setdist_neq_0_sing_2:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4984
    fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4985
    shows "\<lbrakk>setdist S {x} = a; a \<noteq> 0\<rbrakk> \<Longrightarrow> S \<noteq> {} \<and> x \<notin> closure S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4986
  by (auto simp: setdist_eq_0_sing_2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4987
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4988
lemma setdist_sing_in_set:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4989
    fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4990
    shows "x \<in> S \<Longrightarrow> setdist {x} S = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4991
  using closure_subset by (auto simp: setdist_eq_0_sing_1)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4992
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4993
lemma setdist_le_sing: "x \<in> S ==> setdist S T \<le> setdist {x} T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4994
  using setdist_subset_left by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4995
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4996
lemma setdist_eq_0_closed:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4997
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4998
  shows  "closed S \<Longrightarrow> (setdist {x} S = 0 \<longleftrightarrow> S = {} \<or> x \<in> S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4999
by (simp add: setdist_eq_0_sing_1)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5000
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5001
lemma setdist_eq_0_closedin:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5002
  fixes S :: "'a::euclidean_space set"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5003
  shows "\<lbrakk>closedin (subtopology euclidean U) S; x \<in> U\<rbrakk>
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5004
         \<Longrightarrow> (setdist {x} S = 0 \<longleftrightarrow> S = {} \<or> x \<in> S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5005
  by (auto simp: closedin_limpt setdist_eq_0_sing_1 closure_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5006
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5007
lemma setdist_gt_0_closedin:
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5008
  fixes S :: "'a::euclidean_space set"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5009
  shows "\<lbrakk>closedin (subtopology euclidean U) S; x \<in> U; S \<noteq> {}; x \<notin> S\<rbrakk>
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5010
         \<Longrightarrow> setdist {x} S > 0"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5011
  using less_eq_real_def setdist_eq_0_closedin by fastforce
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5012
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  5013
subsection%unimportant\<open>Basic lemmas about hyperplanes and halfspaces\<close>
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5014
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5015
lemma hyperplane_eq_Ex:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5016
  assumes "a \<noteq> 0" obtains x where "a \<bullet> x = b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5017
  by (rule_tac x = "(b / (a \<bullet> a)) *\<^sub>R a" in that) (simp add: assms)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5018
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5019
lemma hyperplane_eq_empty:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5020
     "{x. a \<bullet> x = b} = {} \<longleftrightarrow> a = 0 \<and> b \<noteq> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5021
  using hyperplane_eq_Ex apply auto[1]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5022
  using inner_zero_right by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5023
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5024
lemma hyperplane_eq_UNIV:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5025
   "{x. a \<bullet> x = b} = UNIV \<longleftrightarrow> a = 0 \<and> b = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5026
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5027
  have "UNIV \<subseteq> {x. a \<bullet> x = b} \<Longrightarrow> a = 0 \<and> b = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5028
    apply (drule_tac c = "((b+1) / (a \<bullet> a)) *\<^sub>R a" in subsetD)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5029
    apply simp_all
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5030
    by (metis add_cancel_right_right zero_neq_one)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5031
  then show ?thesis by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5032
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5033
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5034
lemma halfspace_eq_empty_lt:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5035
   "{x. a \<bullet> x < b} = {} \<longleftrightarrow> a = 0 \<and> b \<le> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5036
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5037
  have "{x. a \<bullet> x < b} \<subseteq> {} \<Longrightarrow> a = 0 \<and> b \<le> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5038
    apply (rule ccontr)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5039
    apply (drule_tac c = "((b-1) / (a \<bullet> a)) *\<^sub>R a" in subsetD)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5040
    apply force+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5041
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5042
  then show ?thesis by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5043
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5044
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5045
lemma halfspace_eq_empty_gt:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5046
   "{x. a \<bullet> x > b} = {} \<longleftrightarrow> a = 0 \<and> b \<ge> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5047
using halfspace_eq_empty_lt [of "-a" "-b"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5048
by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5049
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5050
lemma halfspace_eq_empty_le:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5051
   "{x. a \<bullet> x \<le> b} = {} \<longleftrightarrow> a = 0 \<and> b < 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5052
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5053
  have "{x. a \<bullet> x \<le> b} \<subseteq> {} \<Longrightarrow> a = 0 \<and> b < 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5054
    apply (rule ccontr)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5055
    apply (drule_tac c = "((b-1) / (a \<bullet> a)) *\<^sub>R a" in subsetD)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5056
    apply force+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5057
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5058
  then show ?thesis by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5059
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5060
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5061
lemma halfspace_eq_empty_ge:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5062
   "{x. a \<bullet> x \<ge> b} = {} \<longleftrightarrow> a = 0 \<and> b > 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5063
using halfspace_eq_empty_le [of "-a" "-b"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5064
by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5065
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  5066
subsection%unimportant\<open>Use set distance for an easy proof of separation properties\<close>
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5067
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5068
proposition separation_closures:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5069
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5070
  assumes "S \<inter> closure T = {}" "T \<inter> closure S = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5071
  obtains U V where "U \<inter> V = {}" "open U" "open V" "S \<subseteq> U" "T \<subseteq> V"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5072
proof (cases "S = {} \<or> T = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5073
  case True with that show ?thesis by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5074
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5075
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5076
  define f where "f \<equiv> \<lambda>x. setdist {x} T - setdist {x} S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5077
  have contf: "continuous_on UNIV f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5078
    unfolding f_def by (intro continuous_intros continuous_on_setdist)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5079
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5080
  proof (rule_tac U = "{x. f x > 0}" and V = "{x. f x < 0}" in that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5081
    show "{x. 0 < f x} \<inter> {x. f x < 0} = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5082
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5083
    show "open {x. 0 < f x}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5084
      by (simp add: open_Collect_less contf continuous_on_const)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5085
    show "open {x. f x < 0}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5086
      by (simp add: open_Collect_less contf continuous_on_const)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5087
    show "S \<subseteq> {x. 0 < f x}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5088
      apply (clarsimp simp add: f_def setdist_sing_in_set)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5089
      using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5090
      by (metis False IntI empty_iff le_less setdist_eq_0_sing_2 setdist_pos_le setdist_sym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5091
    show "T \<subseteq> {x. f x < 0}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5092
      apply (clarsimp simp add: f_def setdist_sing_in_set)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5093
      using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5094
      by (metis False IntI empty_iff le_less setdist_eq_0_sing_2 setdist_pos_le setdist_sym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5095
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5096
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5097
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5098
lemma separation_normal:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5099
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5100
  assumes "closed S" "closed T" "S \<inter> T = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5101
  obtains U V where "open U" "open V" "S \<subseteq> U" "T \<subseteq> V" "U \<inter> V = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5102
using separation_closures [of S T]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5103
by (metis assms closure_closed disjnt_def inf_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5104
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5105
lemma separation_normal_local:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5106
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5107
  assumes US: "closedin (subtopology euclidean U) S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5108
      and UT: "closedin (subtopology euclidean U) T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5109
      and "S \<inter> T = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5110
  obtains S' T' where "openin (subtopology euclidean U) S'"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5111
                      "openin (subtopology euclidean U) T'"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5112
                      "S \<subseteq> S'"  "T \<subseteq> T'"  "S' \<inter> T' = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5113
proof (cases "S = {} \<or> T = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5114
  case True with that show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5115
    apply safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5116
    using UT closedin_subset apply blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5117
    using US closedin_subset apply blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5118
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5119
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5120
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5121
  define f where "f \<equiv> \<lambda>x. setdist {x} T - setdist {x} S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5122
  have contf: "continuous_on U f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5123
    unfolding f_def by (intro continuous_intros)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5124
  show ?thesis
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5125
  proof (rule_tac S' = "(U \<inter> f -` {0<..})" and T' = "(U \<inter> f -` {..<0})" in that)
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5126
    show "(U \<inter> f -` {0<..}) \<inter> (U \<inter> f -` {..<0}) = {}"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5127
      by auto
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5128
    show "openin (subtopology euclidean U) (U \<inter> f -` {0<..})"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5129
      by (rule continuous_openin_preimage [where T=UNIV]) (simp_all add: contf)
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5130
  next
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5131
    show "openin (subtopology euclidean U) (U \<inter> f -` {..<0})"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5132
      by (rule continuous_openin_preimage [where T=UNIV]) (simp_all add: contf)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5133
  next
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5134
    have "S \<subseteq> U" "T \<subseteq> U"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5135
      using closedin_imp_subset assms by blast+
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5136
    then show "S \<subseteq> U \<inter> f -` {0<..}" "T \<subseteq> U \<inter> f -` {..<0}"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5137
      using assms False by (force simp add: f_def setdist_sing_in_set intro!: setdist_gt_0_closedin)+
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5138
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5139
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5140
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5141
lemma separation_normal_compact:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5142
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5143
  assumes "compact S" "closed T" "S \<inter> T = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5144
  obtains U V where "open U" "compact(closure U)" "open V" "S \<subseteq> U" "T \<subseteq> V" "U \<inter> V = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5145
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5146
  have "closed S" "bounded S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5147
    using assms by (auto simp: compact_eq_bounded_closed)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5148
  then obtain r where "r>0" and r: "S \<subseteq> ball 0 r"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5149
    by (auto dest!: bounded_subset_ballD)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5150
  have **: "closed (T \<union> - ball 0 r)" "S \<inter> (T \<union> - ball 0 r) = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5151
    using assms r by blast+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5152
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5153
    apply (rule separation_normal [OF \<open>closed S\<close>])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5154
    apply (rule_tac U=U and V=V in that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5155
    by auto (meson bounded_ball bounded_subset compl_le_swap2 disjoint_eq_subset_Compl)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5156
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5157
66793
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5158
subsection\<open>Connectedness of the intersection of a chain\<close>
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5159
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  5160
proposition%important connected_chain:
66793
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5161
  fixes \<F> :: "'a :: euclidean_space set set"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5162
  assumes cc: "\<And>S. S \<in> \<F> \<Longrightarrow> compact S \<and> connected S"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5163
      and linear: "\<And>S T. S \<in> \<F> \<and> T \<in> \<F> \<Longrightarrow> S \<subseteq> T \<or> T \<subseteq> S"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5164
  shows "connected(\<Inter>\<F>)"
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  5165
proof%unimportant (cases "\<F> = {}")
66793
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5166
  case True then show ?thesis
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5167
    by auto
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5168
next
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5169
  case False
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5170
  then have cf: "compact(\<Inter>\<F>)"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5171
    by (simp add: cc compact_Inter)
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5172
  have False if AB: "closed A" "closed B" "A \<inter> B = {}"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5173
                and ABeq: "A \<union> B = \<Inter>\<F>" and "A \<noteq> {}" "B \<noteq> {}" for A B
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5174
  proof -
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5175
    obtain U V where "open U" "open V" "A \<subseteq> U" "B \<subseteq> V" "U \<inter> V = {}"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5176
      using separation_normal [OF AB] by metis
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5177
    obtain K where "K \<in> \<F>" "compact K"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5178
      using cc False by blast
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5179
    then obtain N where "open N" and "K \<subseteq> N"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5180
      by blast
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5181
    let ?\<C> = "insert (U \<union> V) ((\<lambda>S. N - S) ` \<F>)"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5182
    obtain \<D> where "\<D> \<subseteq> ?\<C>" "finite \<D>" "K \<subseteq> \<Union>\<D>"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5183
    proof (rule compactE [OF \<open>compact K\<close>])
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  5184
      show "K \<subseteq> \<Union>insert (U \<union> V) ((-) N ` \<F>)"
66793
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5185
        using \<open>K \<subseteq> N\<close> ABeq \<open>A \<subseteq> U\<close> \<open>B \<subseteq> V\<close> by auto
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  5186
      show "\<And>B. B \<in> insert (U \<union> V) ((-) N ` \<F>) \<Longrightarrow> open B"
66793
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5187
        by (auto simp:  \<open>open U\<close> \<open>open V\<close> open_Un \<open>open N\<close> cc compact_imp_closed open_Diff)
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5188
    qed
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5189
    then have "finite(\<D> - {U \<union> V})"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5190
      by blast
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5191
    moreover have "\<D> - {U \<union> V} \<subseteq> (\<lambda>S. N - S) ` \<F>"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5192
      using \<open>\<D> \<subseteq> ?\<C>\<close> by blast
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5193
    ultimately obtain \<G> where "\<G> \<subseteq> \<F>" "finite \<G>" and Deq: "\<D> - {U \<union> V} = (\<lambda>S. N-S) ` \<G>"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5194
      using finite_subset_image by metis
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5195
    obtain J where "J \<in> \<F>" and J: "(\<Union>S\<in>\<G>. N - S) \<subseteq> N - J"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5196
    proof (cases "\<G> = {}")
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5197
      case True
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5198
      with \<open>\<F> \<noteq> {}\<close> that show ?thesis
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5199
        by auto
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5200
    next
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5201
      case False
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5202
      have "\<And>S T. \<lbrakk>S \<in> \<G>; T \<in> \<G>\<rbrakk> \<Longrightarrow> S \<subseteq> T \<or> T \<subseteq> S"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5203
        by (meson \<open>\<G> \<subseteq> \<F>\<close> in_mono local.linear)
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5204
      with \<open>finite \<G>\<close> \<open>\<G> \<noteq> {}\<close>
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5205
      have "\<exists>J \<in> \<G>. (\<Union>S\<in>\<G>. N - S) \<subseteq> N - J"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5206
      proof induction
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5207
        case (insert X \<H>)
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5208
        show ?case
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5209
        proof (cases "\<H> = {}")
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5210
          case True then show ?thesis by auto
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5211
        next
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5212
          case False
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5213
          then have "\<And>S T. \<lbrakk>S \<in> \<H>; T \<in> \<H>\<rbrakk> \<Longrightarrow> S \<subseteq> T \<or> T \<subseteq> S"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5214
            by (simp add: insert.prems)
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5215
          with insert.IH False obtain J where "J \<in> \<H>" and J: "(\<Union>Y\<in>\<H>. N - Y) \<subseteq> N - J"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5216
            by metis
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5217
          have "N - J \<subseteq> N - X \<or> N - X \<subseteq> N - J"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5218
            by (meson Diff_mono \<open>J \<in> \<H>\<close> insert.prems(2) insert_iff order_refl)
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5219
          then show ?thesis
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5220
          proof
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5221
            assume "N - J \<subseteq> N - X" with J show ?thesis
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5222
              by auto
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5223
          next
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5224
            assume "N - X \<subseteq> N - J"
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  5225
            with J have "N - X \<union> UNION \<H> ((-) N) \<subseteq> N - J"
66793
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5226
              by auto
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5227
            with \<open>J \<in> \<H>\<close> show ?thesis
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5228
              by blast
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5229
          qed
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5230
        qed
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5231
      qed simp
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5232
      with \<open>\<G> \<subseteq> \<F>\<close> show ?thesis by (blast intro: that)
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5233
    qed
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5234
    have "K \<subseteq> \<Union>(insert (U \<union> V) (\<D> - {U \<union> V}))"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5235
      using \<open>K \<subseteq> \<Union>\<D>\<close> by auto
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5236
    also have "... \<subseteq> (U \<union> V) \<union> (N - J)"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5237
      by (metis (no_types, hide_lams) Deq Un_subset_iff Un_upper2 J Union_insert order_trans sup_ge1)
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5238
    finally have "J \<inter> K \<subseteq> U \<union> V"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5239
      by blast
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5240
    moreover have "connected(J \<inter> K)"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5241
      by (metis Int_absorb1 \<open>J \<in> \<F>\<close> \<open>K \<in> \<F>\<close> cc inf.orderE local.linear)
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5242
    moreover have "U \<inter> (J \<inter> K) \<noteq> {}"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5243
      using ABeq \<open>J \<in> \<F>\<close> \<open>K \<in> \<F>\<close> \<open>A \<noteq> {}\<close> \<open>A \<subseteq> U\<close> by blast
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5244
    moreover have "V \<inter> (J \<inter> K) \<noteq> {}"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5245
      using ABeq \<open>J \<in> \<F>\<close> \<open>K \<in> \<F>\<close> \<open>B \<noteq> {}\<close> \<open>B \<subseteq> V\<close> by blast
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5246
    ultimately show False
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5247
        using connectedD [of "J \<inter> K" U V] \<open>open U\<close> \<open>open V\<close> \<open>U \<inter> V = {}\<close>  by auto
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5248
  qed
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5249
  with cf show ?thesis
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5250
    by (auto simp: connected_closed_set compact_imp_closed)
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5251
qed
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5252
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5253
lemma connected_chain_gen:
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5254
  fixes \<F> :: "'a :: euclidean_space set set"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5255
  assumes X: "X \<in> \<F>" "compact X"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5256
      and cc: "\<And>T. T \<in> \<F> \<Longrightarrow> closed T \<and> connected T"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5257
      and linear: "\<And>S T. S \<in> \<F> \<and> T \<in> \<F> \<Longrightarrow> S \<subseteq> T \<or> T \<subseteq> S"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5258
  shows "connected(\<Inter>\<F>)"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5259
proof -
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5260
  have "\<Inter>\<F> = (\<Inter>T\<in>\<F>. X \<inter> T)"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5261
    using X by blast
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5262
  moreover have "connected (\<Inter>T\<in>\<F>. X \<inter> T)"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5263
  proof (rule connected_chain)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  5264
    show "\<And>T. T \<in> (\<inter>) X ` \<F> \<Longrightarrow> compact T \<and> connected T"
66793
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5265
      using cc X by auto (metis inf.absorb2 inf.orderE local.linear)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  5266
    show "\<And>S T. S \<in> (\<inter>) X ` \<F> \<and> T \<in> (\<inter>) X ` \<F> \<Longrightarrow> S \<subseteq> T \<or> T \<subseteq> S"
66793
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5267
      using local.linear by blast
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5268
  qed
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5269
  ultimately show ?thesis
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5270
    by metis
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5271
qed
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5272
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5273
lemma connected_nest:
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5274
  fixes S :: "'a::linorder \<Rightarrow> 'b::euclidean_space set"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5275
  assumes S: "\<And>n. compact(S n)" "\<And>n. connected(S n)"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5276
    and nest: "\<And>m n. m \<le> n \<Longrightarrow> S n \<subseteq> S m"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5277
  shows "connected(\<Inter> (range S))"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5278
  apply (rule connected_chain)
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5279
  using S apply blast
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5280
  by (metis image_iff le_cases nest)
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5281
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5282
lemma connected_nest_gen:
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5283
  fixes S :: "'a::linorder \<Rightarrow> 'b::euclidean_space set"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5284
  assumes S: "\<And>n. closed(S n)" "\<And>n. connected(S n)" "compact(S k)"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5285
    and nest: "\<And>m n. m \<le> n \<Longrightarrow> S n \<subseteq> S m"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5286
  shows "connected(\<Inter> (range S))"
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5287
  apply (rule connected_chain_gen [of "S k"])
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5288
  using S apply auto
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5289
  by (meson le_cases nest subsetCE)
deabce3ccf1f new material about connectedness, etc.
paulson <lp15@cam.ac.uk>
parents: 66765
diff changeset
  5290
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5291
subsection\<open>Proper maps, including projections out of compact sets\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5292
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5293
lemma finite_indexed_bound:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5294
  assumes A: "finite A" "\<And>x. x \<in> A \<Longrightarrow> \<exists>n::'a::linorder. P x n"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5295
    shows "\<exists>m. \<forall>x \<in> A. \<exists>k\<le>m. P x k"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5296
using A
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5297
proof (induction A)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5298
  case empty then show ?case by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5299
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5300
  case (insert a A)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5301
    then obtain m n where "\<forall>x \<in> A. \<exists>k\<le>m. P x k" "P a n"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5302
      by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5303
    then show ?case
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5304
      apply (rule_tac x="max m n" in exI, safe)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5305
      using max.cobounded2 apply blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5306
      by (meson le_max_iff_disj)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5307
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5308
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  5309
proposition%important proper_map:
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5310
  fixes f :: "'a::heine_borel \<Rightarrow> 'b::heine_borel"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5311
  assumes "closedin (subtopology euclidean S) K"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5312
      and com: "\<And>U. \<lbrakk>U \<subseteq> T; compact U\<rbrakk> \<Longrightarrow> compact (S \<inter> f -` U)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5313
      and "f ` S \<subseteq> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5314
    shows "closedin (subtopology euclidean T) (f ` K)"
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  5315
proof%unimportant -
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5316
  have "K \<subseteq> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5317
    using assms closedin_imp_subset by metis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5318
  obtain C where "closed C" and Keq: "K = S \<inter> C"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5319
    using assms by (auto simp: closedin_closed)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5320
  have *: "y \<in> f ` K" if "y \<in> T" and y: "y islimpt f ` K" for y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5321
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5322
    obtain h where "\<forall>n. (\<exists>x\<in>K. h n = f x) \<and> h n \<noteq> y" "inj h" and hlim: "(h \<longlongrightarrow> y) sequentially"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5323
      using \<open>y \<in> T\<close> y by (force simp: limpt_sequential_inj)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5324
    then obtain X where X: "\<And>n. X n \<in> K \<and> h n = f (X n) \<and> h n \<noteq> y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5325
      by metis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5326
    then have fX: "\<And>n. f (X n) = h n"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5327
      by metis
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5328
    have "compact (C \<inter> (S \<inter> f -` insert y (range (\<lambda>i. f(X(n + i))))))" for n
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5329
      apply (rule closed_Int_compact [OF \<open>closed C\<close>])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5330
      apply (rule com)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5331
       using X \<open>K \<subseteq> S\<close> \<open>f ` S \<subseteq> T\<close> \<open>y \<in> T\<close> apply blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5332
      apply (rule compact_sequence_with_limit)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5333
      apply (simp add: fX add.commute [of n] LIMSEQ_ignore_initial_segment [OF hlim])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5334
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5335
    then have comf: "compact {a \<in> K. f a \<in> insert y (range (\<lambda>i. f(X(n + i))))}" for n
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5336
      by (simp add: Keq Int_def conj_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5337
    have ne: "\<Inter>\<F> \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5338
             if "finite \<F>"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5339
                and \<F>: "\<And>t. t \<in> \<F> \<Longrightarrow>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5340
                           (\<exists>n. t = {a \<in> K. f a \<in> insert y (range (\<lambda>i. f (X (n + i))))})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5341
             for \<F>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5342
    proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5343
      obtain m where m: "\<And>t. t \<in> \<F> \<Longrightarrow> \<exists>k\<le>m. t = {a \<in> K. f a \<in> insert y (range (\<lambda>i. f (X (k + i))))}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5344
        apply (rule exE)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5345
        apply (rule finite_indexed_bound [OF \<open>finite \<F>\<close> \<F>], assumption, force)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5346
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5347
      have "X m \<in> \<Inter>\<F>"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5348
        using X le_Suc_ex by (fastforce dest: m)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5349
      then show ?thesis by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5350
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5351
    have "\<Inter>{{a. a \<in> K \<and> f a \<in> insert y (range (\<lambda>i. f(X(n + i))))} |n. n \<in> UNIV}
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5352
               \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5353
      apply (rule compact_fip_heine_borel)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5354
       using comf apply force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5355
      using ne  apply (simp add: subset_iff del: insert_iff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5356
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5357
    then have "\<exists>x. x \<in> (\<Inter>n. {a \<in> K. f a \<in> insert y (range (\<lambda>i. f (X (n + i))))})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5358
      by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5359
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5360
      apply (simp add: image_iff fX)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5361
      by (metis \<open>inj h\<close> le_add1 not_less_eq_eq rangeI range_ex1_eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5362
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5363
  with assms closedin_subset show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5364
    by (force simp: closedin_limpt)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5365
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5366
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5367
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5368
lemma compact_continuous_image_eq:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5369
  fixes f :: "'a::heine_borel \<Rightarrow> 'b::heine_borel"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5370
  assumes f: "inj_on f S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5371
  shows "continuous_on S f \<longleftrightarrow> (\<forall>T. compact T \<and> T \<subseteq> S \<longrightarrow> compact(f ` T))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5372
           (is "?lhs = ?rhs")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5373
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5374
  assume ?lhs then show ?rhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5375
    by (metis continuous_on_subset compact_continuous_image)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5376
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5377
  assume RHS: ?rhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5378
  obtain g where gf: "\<And>x. x \<in> S \<Longrightarrow> g (f x) = x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5379
    by (metis inv_into_f_f f)
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5380
  then have *: "(S \<inter> f -` U) = g ` U" if "U \<subseteq> f ` S" for U
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5381
    using that by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5382
  have gfim: "g ` f ` S \<subseteq> S" using gf by auto
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5383
  have **: "compact (f ` S \<inter> g -` C)" if C: "C \<subseteq> S" "compact C" for C
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5384
  proof -
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5385
    obtain h where "h C \<in> C \<and> h C \<notin> S \<or> compact (f ` C)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5386
      by (force simp: C RHS)
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5387
    moreover have "f ` C = (f ` S \<inter> g -` C)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5388
      using C gf by auto
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5389
    ultimately show ?thesis
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5390
      using C by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5391
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5392
  show ?lhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5393
    using proper_map [OF _ _ gfim] **
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5394
    by (simp add: continuous_on_closed * closedin_imp_subset)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5395
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5396
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  5397
subsection%unimportant\<open>Trivial fact: convexity equals connectedness for collinear sets\<close>
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5398
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5399
lemma convex_connected_collinear:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5400
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5401
  assumes "collinear S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5402
    shows "convex S \<longleftrightarrow> connected S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5403
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5404
  assume "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5405
  then show "connected S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5406
    using convex_connected by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5407
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5408
  assume S: "connected S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5409
  show "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5410
  proof (cases "S = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5411
    case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5412
    then show ?thesis by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5413
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5414
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5415
    then obtain a where "a \<in> S" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5416
    have "collinear (affine hull S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5417
      by (simp add: assms collinear_affine_hull_collinear)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5418
    then obtain z where "z \<noteq> 0" "\<And>x. x \<in> affine hull S \<Longrightarrow> \<exists>c. x - a = c *\<^sub>R z"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5419
      by (meson \<open>a \<in> S\<close> collinear hull_inc)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5420
    then obtain f where f: "\<And>x. x \<in> affine hull S \<Longrightarrow> x - a = f x *\<^sub>R z"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5421
      by metis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5422
    then have inj_f: "inj_on f (affine hull S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5423
      by (metis diff_add_cancel inj_onI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5424
    have diff: "x - y = (f x - f y) *\<^sub>R z" if x: "x \<in> affine hull S" and y: "y \<in> affine hull S" for x y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5425
    proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5426
      have "f x *\<^sub>R z = x - a"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5427
        by (simp add: f hull_inc x)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5428
      moreover have "f y *\<^sub>R z = y - a"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5429
        by (simp add: f hull_inc y)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5430
      ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5431
        by (simp add: scaleR_left.diff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5432
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5433
    have cont_f: "continuous_on (affine hull S) f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5434
      apply (clarsimp simp: dist_norm continuous_on_iff diff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5435
      by (metis \<open>z \<noteq> 0\<close> mult.commute mult_less_cancel_left_pos norm_minus_commute real_norm_def zero_less_mult_iff zero_less_norm_iff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5436
    then have conn_fS: "connected (f ` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5437
      by (meson S connected_continuous_image continuous_on_subset hull_subset)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5438
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5439
    proof (clarsimp simp: convex_contains_segment)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5440
      fix x y z
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5441
      assume "x \<in> S" "y \<in> S" "z \<in> closed_segment x y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5442
      have False if "z \<notin> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5443
      proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5444
        have "f ` (closed_segment x y) = closed_segment (f x) (f y)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5445
          apply (rule continuous_injective_image_segment_1)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5446
          apply (meson \<open>x \<in> S\<close> \<open>y \<in> S\<close> convex_affine_hull convex_contains_segment hull_inc continuous_on_subset [OF cont_f])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5447
          by (meson \<open>x \<in> S\<close> \<open>y \<in> S\<close> convex_affine_hull convex_contains_segment hull_inc inj_on_subset [OF inj_f])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5448
        then have fz: "f z \<in> closed_segment (f x) (f y)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5449
          using \<open>z \<in> closed_segment x y\<close> by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5450
        have "z \<in> affine hull S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5451
          by (meson \<open>x \<in> S\<close> \<open>y \<in> S\<close> \<open>z \<in> closed_segment x y\<close> convex_affine_hull convex_contains_segment hull_inc subset_eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5452
        then have fz_notin: "f z \<notin> f ` S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5453
          using hull_subset inj_f inj_onD that by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5454
        moreover have "{..<f z} \<inter> f ` S \<noteq> {}" "{f z<..} \<inter> f ` S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5455
        proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5456
          have "{..<f z} \<inter> f ` {x,y} \<noteq> {}"  "{f z<..} \<inter> f ` {x,y} \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5457
            using fz fz_notin \<open>x \<in> S\<close> \<open>y \<in> S\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5458
             apply (auto simp: closed_segment_eq_real_ivl split: if_split_asm)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5459
             apply (metis image_eqI less_eq_real_def)+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5460
            done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5461
          then show "{..<f z} \<inter> f ` S \<noteq> {}" "{f z<..} \<inter> f ` S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5462
            using \<open>x \<in> S\<close> \<open>y \<in> S\<close> by blast+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5463
        qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5464
        ultimately show False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5465
          using connectedD [OF conn_fS, of "{..<f z}" "{f z<..}"] by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5466
      qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5467
      then show "z \<in> S" by meson
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5468
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5469
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5470
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5471
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5472
lemma compact_convex_collinear_segment_alt:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5473
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5474
  assumes "S \<noteq> {}" "compact S" "connected S" "collinear S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5475
  obtains a b where "S = closed_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5476
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5477
  obtain \<xi> where "\<xi> \<in> S" using \<open>S \<noteq> {}\<close> by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5478
  have "collinear (affine hull S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5479
    by (simp add: assms collinear_affine_hull_collinear)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5480
  then obtain z where "z \<noteq> 0" "\<And>x. x \<in> affine hull S \<Longrightarrow> \<exists>c. x - \<xi> = c *\<^sub>R z"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5481
    by (meson \<open>\<xi> \<in> S\<close> collinear hull_inc)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5482
  then obtain f where f: "\<And>x. x \<in> affine hull S \<Longrightarrow> x - \<xi> = f x *\<^sub>R z"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5483
    by metis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5484
  let ?g = "\<lambda>r. r *\<^sub>R z + \<xi>"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5485
  have gf: "?g (f x) = x" if "x \<in> affine hull S" for x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5486
    by (metis diff_add_cancel f that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5487
  then have inj_f: "inj_on f (affine hull S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5488
    by (metis inj_onI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5489
  have diff: "x - y = (f x - f y) *\<^sub>R z" if x: "x \<in> affine hull S" and y: "y \<in> affine hull S" for x y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5490
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5491
    have "f x *\<^sub>R z = x - \<xi>"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5492
      by (simp add: f hull_inc x)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5493
    moreover have "f y *\<^sub>R z = y - \<xi>"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5494
      by (simp add: f hull_inc y)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5495
    ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5496
      by (simp add: scaleR_left.diff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5497
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5498
  have cont_f: "continuous_on (affine hull S) f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5499
    apply (clarsimp simp: dist_norm continuous_on_iff diff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5500
    by (metis \<open>z \<noteq> 0\<close> mult.commute mult_less_cancel_left_pos norm_minus_commute real_norm_def zero_less_mult_iff zero_less_norm_iff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5501
  then have "connected (f ` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5502
    by (meson \<open>connected S\<close> connected_continuous_image continuous_on_subset hull_subset)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5503
  moreover have "compact (f ` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5504
    by (meson \<open>compact S\<close> compact_continuous_image_eq cont_f hull_subset inj_f)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5505
  ultimately obtain x y where "f ` S = {x..y}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5506
    by (meson connected_compact_interval_1)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5507
  then have fS_eq: "f ` S = closed_segment x y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5508
    using \<open>S \<noteq> {}\<close> closed_segment_eq_real_ivl by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5509
  obtain a b where "a \<in> S" "f a = x" "b \<in> S" "f b = y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5510
    by (metis (full_types) ends_in_segment fS_eq imageE)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5511
  have "f ` (closed_segment a b) = closed_segment (f a) (f b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5512
    apply (rule continuous_injective_image_segment_1)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5513
     apply (meson \<open>a \<in> S\<close> \<open>b \<in> S\<close> convex_affine_hull convex_contains_segment hull_inc continuous_on_subset [OF cont_f])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5514
    by (meson \<open>a \<in> S\<close> \<open>b \<in> S\<close> convex_affine_hull convex_contains_segment hull_inc inj_on_subset [OF inj_f])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5515
  then have "f ` (closed_segment a b) = f ` S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5516
    by (simp add: \<open>f a = x\<close> \<open>f b = y\<close> fS_eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5517
  then have "?g ` f ` (closed_segment a b) = ?g ` f ` S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5518
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5519
  moreover have "(\<lambda>x. f x *\<^sub>R z + \<xi>) ` closed_segment a b = closed_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5520
    apply safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5521
     apply (metis (mono_tags, hide_lams) \<open>a \<in> S\<close> \<open>b \<in> S\<close> convex_affine_hull convex_contains_segment gf hull_inc subsetCE)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5522
    by (metis (mono_tags, lifting) \<open>a \<in> S\<close> \<open>b \<in> S\<close> convex_affine_hull convex_contains_segment gf hull_subset image_iff subsetCE)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5523
  ultimately have "closed_segment a b = S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5524
    using gf by (simp add: image_comp o_def hull_inc cong: image_cong)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5525
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5526
    using that by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5527
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5528
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5529
lemma compact_convex_collinear_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5530
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5531
  assumes "S \<noteq> {}" "compact S" "convex S" "collinear S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5532
  obtains a b where "S = closed_segment a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5533
  using assms convex_connected_collinear compact_convex_collinear_segment_alt by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5534
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5535
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5536
lemma proper_map_from_compact:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5537
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5538
  assumes contf: "continuous_on S f" and imf: "f ` S \<subseteq> T" and "compact S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5539
          "closedin (subtopology euclidean T) K"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5540
  shows "compact (S \<inter> f -` K)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5541
by (rule closedin_compact [OF \<open>compact S\<close>] continuous_closedin_preimage_gen assms)+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5542
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5543
lemma proper_map_fst:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5544
  assumes "compact T" "K \<subseteq> S" "compact K"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5545
    shows "compact (S \<times> T \<inter> fst -` K)"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5546
proof -
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5547
  have "(S \<times> T \<inter> fst -` K) = K \<times> T"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5548
    using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5549
  then show ?thesis by (simp add: assms compact_Times)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5550
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5551
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5552
lemma closed_map_fst:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5553
  fixes S :: "'a::euclidean_space set" and T :: "'b::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5554
  assumes "compact T" "closedin (subtopology euclidean (S \<times> T)) c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5555
   shows "closedin (subtopology euclidean S) (fst ` c)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5556
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5557
  have *: "fst ` (S \<times> T) \<subseteq> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5558
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5559
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5560
    using proper_map [OF _ _ *] by (simp add: proper_map_fst assms)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5561
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5562
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5563
lemma proper_map_snd:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5564
  assumes "compact S" "K \<subseteq> T" "compact K"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5565
    shows "compact (S \<times> T \<inter> snd -` K)"
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5566
proof -
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  5567
  have "(S \<times> T \<inter> snd -` K) = S \<times> K"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5568
    using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5569
  then show ?thesis by (simp add: assms compact_Times)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5570
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5571
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5572
lemma closed_map_snd:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5573
  fixes S :: "'a::euclidean_space set" and T :: "'b::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5574
  assumes "compact S" "closedin (subtopology euclidean (S \<times> T)) c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5575
   shows "closedin (subtopology euclidean T) (snd ` c)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5576
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5577
  have *: "snd ` (S \<times> T) \<subseteq> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5578
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5579
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5580
    using proper_map [OF _ _ *] by (simp add: proper_map_snd assms)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5581
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5582
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5583
lemma closedin_compact_projection:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5584
  fixes S :: "'a::euclidean_space set" and T :: "'b::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5585
  assumes "compact S" and clo: "closedin (subtopology euclidean (S \<times> T)) U"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5586
    shows "closedin (subtopology euclidean T) {y. \<exists>x. x \<in> S \<and> (x, y) \<in> U}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5587
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5588
  have "U \<subseteq> S \<times> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5589
    by (metis clo closedin_imp_subset)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5590
  then have "{y. \<exists>x. x \<in> S \<and> (x, y) \<in> U} = snd ` U"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5591
    by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5592
  moreover have "closedin (subtopology euclidean T) (snd ` U)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5593
    by (rule closed_map_snd [OF assms])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5594
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5595
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5596
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5597
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5598
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5599
lemma closed_compact_projection:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5600
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5601
    and T :: "('a * 'b::euclidean_space) set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5602
  assumes "compact S" and clo: "closed T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5603
    shows "closed {y. \<exists>x. x \<in> S \<and> (x, y) \<in> T}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5604
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5605
  have *: "{y. \<exists>x. x \<in> S \<and> Pair x y \<in> T} =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5606
        {y. \<exists>x. x \<in> S \<and> Pair x y \<in> ((S \<times> UNIV) \<inter> T)}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5607
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5608
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5609
    apply (subst *)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5610
    apply (rule closedin_closed_trans [OF _ closed_UNIV])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5611
    apply (rule closedin_compact_projection [OF \<open>compact S\<close>])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5612
    by (simp add: clo closedin_closed_Int)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5613
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5614
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  5615
subsubsection%unimportant\<open>Representing affine hull as a finite intersection of hyperplanes\<close>
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5616
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5617
proposition affine_hull_convex_Int_nonempty_interior:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5618
  fixes S :: "'a::real_normed_vector set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5619
  assumes "convex S" "S \<inter> interior T \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5620
    shows "affine hull (S \<inter> T) = affine hull S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5621
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5622
  show "affine hull (S \<inter> T) \<subseteq> affine hull S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5623
    by (simp add: hull_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5624
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5625
  obtain a where "a \<in> S" "a \<in> T" and at: "a \<in> interior T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5626
    using assms interior_subset by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5627
  then obtain e where "e > 0" and e: "cball a e \<subseteq> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5628
    using mem_interior_cball by blast
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  5629
  have *: "x \<in> (+) a ` span ((\<lambda>x. x - a) ` (S \<inter> T))" if "x \<in> S" for x
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5630
  proof (cases "x = a")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5631
    case True with that span_0 eq_add_iff image_def mem_Collect_eq show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5632
      by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5633
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5634
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5635
    define k where "k = min (1/2) (e / norm (x-a))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5636
    have k: "0 < k" "k < 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5637
      using \<open>e > 0\<close> False by (auto simp: k_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5638
    then have xa: "(x-a) = inverse k *\<^sub>R k *\<^sub>R (x-a)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5639
      by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5640
    have "e / norm (x - a) \<ge> k"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5641
      using k_def by linarith
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5642
    then have "a + k *\<^sub>R (x - a) \<in> cball a e"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5643
      using \<open>0 < k\<close> False by (simp add: dist_norm field_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5644
    then have T: "a + k *\<^sub>R (x - a) \<in> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5645
      using e by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5646
    have S: "a + k *\<^sub>R (x - a) \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5647
      using k \<open>a \<in> S\<close> convexD [OF \<open>convex S\<close> \<open>a \<in> S\<close> \<open>x \<in> S\<close>, of "1-k" k]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5648
      by (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5649
    have "inverse k *\<^sub>R k *\<^sub>R (x-a) \<in> span ((\<lambda>x. x - a) ` (S \<inter> T))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5650
      apply (rule span_mul)
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  5651
      apply (rule span_base)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5652
      apply (rule image_eqI [where x = "a + k *\<^sub>R (x - a)"])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5653
      apply (auto simp: S T)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5654
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5655
    with xa image_iff show ?thesis  by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5656
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5657
  show "affine hull S \<subseteq> affine hull (S \<inter> T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5658
    apply (simp add: subset_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5659
    apply (simp add: \<open>a \<in> S\<close> \<open>a \<in> T\<close> hull_inc affine_hull_span_gen [of a])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5660
    apply (force simp: *)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5661
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5662
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5663
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5664
corollary affine_hull_convex_Int_open:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5665
  fixes S :: "'a::real_normed_vector set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5666
  assumes "convex S" "open T" "S \<inter> T \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5667
    shows "affine hull (S \<inter> T) = affine hull S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5668
using affine_hull_convex_Int_nonempty_interior assms interior_eq by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5669
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5670
corollary affine_hull_affine_Int_nonempty_interior:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5671
  fixes S :: "'a::real_normed_vector set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5672
  assumes "affine S" "S \<inter> interior T \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5673
    shows "affine hull (S \<inter> T) = affine hull S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5674
by (simp add: affine_hull_convex_Int_nonempty_interior affine_imp_convex assms)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5675
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5676
corollary affine_hull_affine_Int_open:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5677
  fixes S :: "'a::real_normed_vector set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5678
  assumes "affine S" "open T" "S \<inter> T \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5679
    shows "affine hull (S \<inter> T) = affine hull S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5680
by (simp add: affine_hull_convex_Int_open affine_imp_convex assms)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5681
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5682
corollary affine_hull_convex_Int_openin:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5683
  fixes S :: "'a::real_normed_vector set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5684
  assumes "convex S" "openin (subtopology euclidean (affine hull S)) T" "S \<inter> T \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5685
    shows "affine hull (S \<inter> T) = affine hull S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5686
using assms unfolding openin_open
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5687
by (metis affine_hull_convex_Int_open hull_subset inf.orderE inf_assoc)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5688
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5689
corollary affine_hull_openin:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5690
  fixes S :: "'a::real_normed_vector set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5691
  assumes "openin (subtopology euclidean (affine hull T)) S" "S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5692
    shows "affine hull S = affine hull T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5693
using assms unfolding openin_open
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5694
by (metis affine_affine_hull affine_hull_affine_Int_open hull_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5695
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5696
corollary affine_hull_open:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5697
  fixes S :: "'a::real_normed_vector set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5698
  assumes "open S" "S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5699
    shows "affine hull S = UNIV"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5700
by (metis affine_hull_convex_Int_nonempty_interior assms convex_UNIV hull_UNIV inf_top.left_neutral interior_open)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5701
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5702
lemma aff_dim_convex_Int_nonempty_interior:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5703
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5704
  shows "\<lbrakk>convex S; S \<inter> interior T \<noteq> {}\<rbrakk> \<Longrightarrow> aff_dim(S \<inter> T) = aff_dim S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5705
using aff_dim_affine_hull2 affine_hull_convex_Int_nonempty_interior by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5706
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5707
lemma aff_dim_convex_Int_open:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5708
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5709
  shows "\<lbrakk>convex S; open T; S \<inter> T \<noteq> {}\<rbrakk> \<Longrightarrow>  aff_dim(S \<inter> T) = aff_dim S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5710
using aff_dim_convex_Int_nonempty_interior interior_eq by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5711
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5712
lemma affine_hull_Diff:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5713
  fixes S:: "'a::real_normed_vector set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5714
  assumes ope: "openin (subtopology euclidean (affine hull S)) S" and "finite F" "F \<subset> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5715
    shows "affine hull (S - F) = affine hull S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5716
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5717
  have clo: "closedin (subtopology euclidean S) F"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5718
    using assms finite_imp_closedin by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5719
  moreover have "S - F \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5720
    using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5721
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5722
    by (metis ope closedin_def topspace_euclidean_subtopology affine_hull_openin openin_trans)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5723
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5724
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5725
lemma affine_hull_halfspace_lt:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5726
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5727
  shows "affine hull {x. a \<bullet> x < r} = (if a = 0 \<and> r \<le> 0 then {} else UNIV)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5728
using halfspace_eq_empty_lt [of a r]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5729
by (simp add: open_halfspace_lt affine_hull_open)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5730
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5731
lemma affine_hull_halfspace_le:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5732
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5733
  shows "affine hull {x. a \<bullet> x \<le> r} = (if a = 0 \<and> r < 0 then {} else UNIV)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5734
proof (cases "a = 0")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5735
  case True then show ?thesis by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5736
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5737
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5738
  then have "affine hull closure {x. a \<bullet> x < r} = UNIV"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5739
    using affine_hull_halfspace_lt closure_same_affine_hull by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5740
  moreover have "{x. a \<bullet> x < r} \<subseteq> {x. a \<bullet> x \<le> r}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5741
    by (simp add: Collect_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5742
  ultimately show ?thesis using False antisym_conv hull_mono top_greatest
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5743
    by (metis affine_hull_halfspace_lt)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5744
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5745
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5746
lemma affine_hull_halfspace_gt:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5747
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5748
  shows "affine hull {x. a \<bullet> x > r} = (if a = 0 \<and> r \<ge> 0 then {} else UNIV)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5749
using halfspace_eq_empty_gt [of r a]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5750
by (simp add: open_halfspace_gt affine_hull_open)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5751
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5752
lemma affine_hull_halfspace_ge:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5753
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5754
  shows "affine hull {x. a \<bullet> x \<ge> r} = (if a = 0 \<and> r > 0 then {} else UNIV)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5755
using affine_hull_halfspace_le [of "-a" "-r"] by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5756
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5757
lemma aff_dim_halfspace_lt:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5758
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5759
  shows "aff_dim {x. a \<bullet> x < r} =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5760
        (if a = 0 \<and> r \<le> 0 then -1 else DIM('a))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5761
by simp (metis aff_dim_open halfspace_eq_empty_lt open_halfspace_lt)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5762
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5763
lemma aff_dim_halfspace_le:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5764
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5765
  shows "aff_dim {x. a \<bullet> x \<le> r} =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5766
        (if a = 0 \<and> r < 0 then -1 else DIM('a))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5767
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5768
  have "int (DIM('a)) = aff_dim (UNIV::'a set)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5769
    by (simp add: aff_dim_UNIV)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5770
  then have "aff_dim (affine hull {x. a \<bullet> x \<le> r}) = DIM('a)" if "(a = 0 \<longrightarrow> r \<ge> 0)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5771
    using that by (simp add: affine_hull_halfspace_le not_less)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5772
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5773
    by (force simp: aff_dim_affine_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5774
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5775
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5776
lemma aff_dim_halfspace_gt:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5777
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5778
  shows "aff_dim {x. a \<bullet> x > r} =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5779
        (if a = 0 \<and> r \<ge> 0 then -1 else DIM('a))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5780
by simp (metis aff_dim_open halfspace_eq_empty_gt open_halfspace_gt)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5781
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5782
lemma aff_dim_halfspace_ge:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5783
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5784
  shows "aff_dim {x. a \<bullet> x \<ge> r} =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5785
        (if a = 0 \<and> r > 0 then -1 else DIM('a))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5786
using aff_dim_halfspace_le [of "-a" "-r"] by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5787
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  5788
subsection%unimportant\<open>Properties of special hyperplanes\<close>
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5789
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5790
lemma subspace_hyperplane: "subspace {x. a \<bullet> x = 0}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5791
  by (simp add: subspace_def inner_right_distrib)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5792
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5793
lemma subspace_hyperplane2: "subspace {x. x \<bullet> a = 0}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5794
  by (simp add: inner_commute inner_right_distrib subspace_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5795
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5796
lemma special_hyperplane_span:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5797
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5798
  assumes "k \<in> Basis"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5799
  shows "{x. k \<bullet> x = 0} = span (Basis - {k})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5800
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5801
  have *: "x \<in> span (Basis - {k})" if "k \<bullet> x = 0" for x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5802
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5803
    have "x = (\<Sum>b\<in>Basis. (x \<bullet> b) *\<^sub>R b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5804
      by (simp add: euclidean_representation)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5805
    also have "... = (\<Sum>b \<in> Basis - {k}. (x \<bullet> b) *\<^sub>R b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5806
      by (auto simp: sum.remove [of _ k] inner_commute assms that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5807
    finally have "x = (\<Sum>b\<in>Basis - {k}. (x \<bullet> b) *\<^sub>R b)" .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5808
    then show ?thesis
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  5809
      by (simp add: span_finite)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5810
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5811
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5812
    apply (rule span_subspace [symmetric])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5813
    using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5814
    apply (auto simp: inner_not_same_Basis intro: * subspace_hyperplane)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5815
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5816
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5817
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5818
lemma dim_special_hyperplane:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5819
  fixes k :: "'n::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5820
  shows "k \<in> Basis \<Longrightarrow> dim {x. k \<bullet> x = 0} = DIM('n) - 1"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  5821
  apply (simp add: special_hyperplane_span)
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  5822
  apply (rule dim_unique [OF order_refl])
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  5823
    apply (auto simp: Diff_subset independent_substdbasis)
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  5824
  apply (metis member_remove remove_def span_clauses(1))
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  5825
  done
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5826
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5827
proposition dim_hyperplane:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5828
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5829
  assumes "a \<noteq> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5830
    shows "dim {x. a \<bullet> x = 0} = DIM('a) - 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5831
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5832
  have span0: "span {x. a \<bullet> x = 0} = {x. a \<bullet> x = 0}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5833
    by (rule span_unique) (auto simp: subspace_hyperplane)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5834
  then obtain B where "independent B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5835
              and Bsub: "B \<subseteq> {x. a \<bullet> x = 0}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5836
              and subspB: "{x. a \<bullet> x = 0} \<subseteq> span B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5837
              and card0: "(card B = dim {x. a \<bullet> x = 0})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5838
              and ortho: "pairwise orthogonal B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5839
    using orthogonal_basis_exists by metis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5840
  with assms have "a \<notin> span B"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  5841
    by (metis (mono_tags, lifting) span_eq inner_eq_zero_iff mem_Collect_eq span0)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5842
  then have ind: "independent (insert a B)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5843
    by (simp add: \<open>independent B\<close> independent_insert)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5844
  have "finite B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5845
    using \<open>independent B\<close> independent_bound by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5846
  have "UNIV \<subseteq> span (insert a B)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5847
  proof fix y::'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5848
    obtain r z where z: "y = r *\<^sub>R a + z" "a \<bullet> z = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5849
      apply (rule_tac r="(a \<bullet> y) / (a \<bullet> a)" and z = "y - ((a \<bullet> y) / (a \<bullet> a)) *\<^sub>R a" in that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5850
      using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5851
      by (auto simp: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5852
    show "y \<in> span (insert a B)"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  5853
      by (metis (mono_tags, lifting) z Bsub span_eq_iff
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5854
         add_diff_cancel_left' mem_Collect_eq span0 span_breakdown_eq span_subspace subspB)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5855
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5856
  then have dima: "DIM('a) = dim(insert a B)"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  5857
    by (metis independent_Basis span_Basis dim_eq_card top.extremum_uniqueI)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5858
  then show ?thesis
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  5859
    by (metis (mono_tags, lifting) Bsub Diff_insert_absorb \<open>a \<notin> span B\<close> ind card0
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  5860
        card_Diff_singleton dim_span indep_card_eq_dim_span insertI1 subsetCE
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  5861
        subspB)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5862
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5863
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5864
lemma lowdim_eq_hyperplane:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5865
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5866
  assumes "dim S = DIM('a) - 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5867
  obtains a where "a \<noteq> 0" and "span S = {x. a \<bullet> x = 0}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5868
proof -
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  5869
  have dimS: "dim S < DIM('a)"
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  5870
    by (simp add: assms)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5871
  then obtain b where b: "b \<noteq> 0" "span S \<subseteq> {a. b \<bullet> a = 0}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5872
    using lowdim_subset_hyperplane [of S] by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5873
  show ?thesis
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  5874
    apply (rule that[OF b(1)])
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  5875
    apply (rule subspace_dim_equal)
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  5876
    by (auto simp: assms b dim_hyperplane dim_span subspace_hyperplane
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  5877
        subspace_span)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5878
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5879
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5880
lemma dim_eq_hyperplane:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5881
  fixes S :: "'n::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5882
  shows "dim S = DIM('n) - 1 \<longleftrightarrow> (\<exists>a. a \<noteq> 0 \<and> span S = {x. a \<bullet> x = 0})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5883
by (metis One_nat_def dim_hyperplane dim_span lowdim_eq_hyperplane)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5884
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5885
proposition aff_dim_eq_hyperplane:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5886
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5887
  shows "aff_dim S = DIM('a) - 1 \<longleftrightarrow> (\<exists>a b. a \<noteq> 0 \<and> affine hull S = {x. a \<bullet> x = b})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5888
proof (cases "S = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5889
  case True then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5890
    by (auto simp: dest: hyperplane_eq_Ex)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5891
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5892
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5893
  then obtain c where "c \<in> S" by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5894
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5895
  proof (cases "c = 0")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5896
    case True show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5897
    apply (simp add: aff_dim_eq_dim [of c] affine_hull_span_gen [of c] \<open>c \<in> S\<close> hull_inc dim_eq_hyperplane
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5898
                del: One_nat_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5899
    apply (rule ex_cong)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5900
    apply (metis (mono_tags) span_0 \<open>c = 0\<close> image_add_0 inner_zero_right mem_Collect_eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5901
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5902
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5903
    case False
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  5904
    have xc_im: "x \<in> (+) c ` {y. a \<bullet> y = 0}" if "a \<bullet> x = a \<bullet> c" for a x
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5905
    proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5906
      have "\<exists>y. a \<bullet> y = 0 \<and> c + y = x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5907
        by (metis that add.commute diff_add_cancel inner_commute inner_diff_left right_minus_eq)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  5908
      then show "x \<in> (+) c ` {y. a \<bullet> y = 0}"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5909
        by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5910
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5911
    have 2: "span ((\<lambda>x. x - c) ` S) = {x. a \<bullet> x = 0}"
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  5912
         if "(+) c ` span ((\<lambda>x. x - c) ` S) = {x. a \<bullet> x = b}" for a b
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5913
    proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5914
      have "b = a \<bullet> c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5915
        using span_0 that by fastforce
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  5916
      with that have "(+) c ` span ((\<lambda>x. x - c) ` S) = {x. a \<bullet> x = a \<bullet> c}"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5917
        by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5918
      then have "span ((\<lambda>x. x - c) ` S) = (\<lambda>x. x - c) ` {x. a \<bullet> x = a \<bullet> c}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5919
        by (metis (no_types) image_cong translation_galois uminus_add_conv_diff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5920
      also have "... = {x. a \<bullet> x = 0}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5921
        by (force simp: inner_distrib inner_diff_right
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5922
             intro: image_eqI [where x="x+c" for x])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5923
      finally show ?thesis .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5924
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5925
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5926
      apply (simp add: aff_dim_eq_dim [of c] affine_hull_span_gen [of c] \<open>c \<in> S\<close> hull_inc dim_eq_hyperplane
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5927
                  del: One_nat_def, safe)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5928
      apply (fastforce simp add: inner_distrib intro: xc_im)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5929
      apply (force simp: intro!: 2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5930
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5931
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5932
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5933
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5934
corollary aff_dim_hyperplane [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5935
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5936
  shows "a \<noteq> 0 \<Longrightarrow> aff_dim {x. a \<bullet> x = r} = DIM('a) - 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5937
by (metis aff_dim_eq_hyperplane affine_hull_eq affine_hyperplane)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5938
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  5939
subsection%unimportant\<open>Some stepping theorems\<close>
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5940
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5941
lemma aff_dim_insert:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5942
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5943
  shows "aff_dim (insert a S) = (if a \<in> affine hull S then aff_dim S else aff_dim S + 1)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5944
proof (cases "S = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5945
  case True then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5946
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5947
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5948
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5949
  then obtain x s' where S: "S = insert x s'" "x \<notin> s'"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5950
    by (meson Set.set_insert all_not_in_conv)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5951
  show ?thesis using S
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5952
    apply (simp add: hull_redundant cong: aff_dim_affine_hull2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5953
    apply (simp add: affine_hull_insert_span_gen hull_inc)
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  5954
    by (force simp add:span_zero insert_commute [of a] hull_inc aff_dim_eq_dim [of x] dim_insert)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5955
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5956
66297
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5957
lemma affine_dependent_choose:
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5958
  fixes a :: "'a :: euclidean_space"
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5959
  assumes "~(affine_dependent S)"
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5960
  shows "affine_dependent(insert a S) \<longleftrightarrow> a \<notin> S \<and> a \<in> affine hull S"
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5961
        (is "?lhs = ?rhs")
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5962
proof safe
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5963
  assume "affine_dependent (insert a S)" and "a \<in> S"
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5964
  then show "False"
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5965
    using \<open>a \<in> S\<close> assms insert_absorb by fastforce
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5966
next
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5967
  assume lhs: "affine_dependent (insert a S)"
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5968
  then have "a \<notin> S"
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5969
    by (metis (no_types) assms insert_absorb)
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5970
  moreover have "finite S"
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5971
    using affine_independent_iff_card assms by blast
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5972
  moreover have "aff_dim (insert a S) \<noteq> int (card S)"
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5973
    using \<open>finite S\<close> affine_independent_iff_card \<open>a \<notin> S\<close> lhs by fastforce
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5974
  ultimately show "a \<in> affine hull S"
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5975
    by (metis aff_dim_affine_independent aff_dim_insert assms)
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5976
next
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5977
  assume "a \<notin> S" and "a \<in> affine hull S"
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5978
  show "affine_dependent (insert a S)"
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5979
    by (simp add: \<open>a \<in> affine hull S\<close> \<open>a \<notin> S\<close> affine_dependent_def)
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5980
qed
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5981
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5982
lemma affine_independent_insert:
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5983
  fixes a :: "'a :: euclidean_space"
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5984
  shows "\<lbrakk>~(affine_dependent S); a \<notin> affine hull S\<rbrakk> \<Longrightarrow> ~(affine_dependent(insert a S))"
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5985
  by (simp add: affine_dependent_choose)
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5986
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5987
lemma subspace_bounded_eq_trivial:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5988
  fixes S :: "'a::real_normed_vector set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5989
  assumes "subspace S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5990
    shows "bounded S \<longleftrightarrow> S = {0}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5991
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5992
  have "False" if "bounded S" "x \<in> S" "x \<noteq> 0" for x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5993
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5994
    obtain B where B: "\<And>y. y \<in> S \<Longrightarrow> norm y < B" "B > 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5995
      using \<open>bounded S\<close> by (force simp: bounded_pos_less)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5996
    have "(B / norm x) *\<^sub>R x \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5997
      using assms subspace_mul \<open>x \<in> S\<close> by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5998
    moreover have "norm ((B / norm x) *\<^sub>R x) = B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5999
      using that B by (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6000
    ultimately show False using B by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6001
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6002
  then have "bounded S \<Longrightarrow> S = {0}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6003
    using assms subspace_0 by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6004
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6005
    by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6006
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6007
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6008
lemma affine_bounded_eq_trivial:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6009
  fixes S :: "'a::real_normed_vector set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6010
  assumes "affine S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6011
    shows "bounded S \<longleftrightarrow> S = {} \<or> (\<exists>a. S = {a})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6012
proof (cases "S = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6013
  case True then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6014
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6015
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6016
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6017
  then obtain b where "b \<in> S" by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6018
  with False assms show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6019
    apply safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6020
    using affine_diffs_subspace [OF assms \<open>b \<in> S\<close>]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6021
    apply (metis (no_types, lifting) subspace_bounded_eq_trivial ab_left_minus bounded_translation
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6022
                image_empty image_insert translation_invert)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6023
    apply force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6024
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6025
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6026
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6027
lemma affine_bounded_eq_lowdim:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6028
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6029
  assumes "affine S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6030
    shows "bounded S \<longleftrightarrow> aff_dim S \<le> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6031
apply safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6032
using affine_bounded_eq_trivial assms apply fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6033
by (metis aff_dim_sing aff_dim_subset affine_dim_equal affine_sing all_not_in_conv assms bounded_empty bounded_insert dual_order.antisym empty_subsetI insert_subset)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6034
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6035
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6036
lemma bounded_hyperplane_eq_trivial_0:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6037
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6038
  assumes "a \<noteq> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6039
  shows "bounded {x. a \<bullet> x = 0} \<longleftrightarrow> DIM('a) = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6040
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6041
  assume "bounded {x. a \<bullet> x = 0}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6042
  then have "aff_dim {x. a \<bullet> x = 0} \<le> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6043
    by (simp add: affine_bounded_eq_lowdim affine_hyperplane)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6044
  with assms show "DIM('a) = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6045
    by (simp add: le_Suc_eq aff_dim_hyperplane)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6046
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6047
  assume "DIM('a) = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6048
  then show "bounded {x. a \<bullet> x = 0}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6049
    by (simp add: aff_dim_hyperplane affine_bounded_eq_lowdim affine_hyperplane assms)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6050
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6051
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6052
lemma bounded_hyperplane_eq_trivial:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6053
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6054
  shows "bounded {x. a \<bullet> x = r} \<longleftrightarrow> (if a = 0 then r \<noteq> 0 else DIM('a) = 1)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6055
proof (simp add: bounded_hyperplane_eq_trivial_0, clarify)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6056
  assume "r \<noteq> 0" "a \<noteq> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6057
  have "aff_dim {x. y \<bullet> x = 0} = aff_dim {x. a \<bullet> x = r}" if "y \<noteq> 0" for y::'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6058
    by (metis that \<open>a \<noteq> 0\<close> aff_dim_hyperplane)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6059
  then show "bounded {x. a \<bullet> x = r} = (DIM('a) = Suc 0)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6060
    by (metis One_nat_def \<open>a \<noteq> 0\<close> affine_bounded_eq_lowdim affine_hyperplane bounded_hyperplane_eq_trivial_0)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6061
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6062
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  6063
subsection%unimportant\<open>General case without assuming closure and getting non-strict separation\<close>
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6064
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6065
proposition separating_hyperplane_closed_point_inset:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6066
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6067
  assumes "convex S" "closed S" "S \<noteq> {}" "z \<notin> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6068
  obtains a b where "a \<in> S" "(a - z) \<bullet> z < b" "\<And>x. x \<in> S \<Longrightarrow> b < (a - z) \<bullet> x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6069
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6070
  obtain y where "y \<in> S" and y: "\<And>u. u \<in> S \<Longrightarrow> dist z y \<le> dist z u"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6071
    using distance_attains_inf [of S z] assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6072
  then have *: "(y - z) \<bullet> z < (y - z) \<bullet> z + (norm (y - z))\<^sup>2 / 2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6073
    using \<open>y \<in> S\<close> \<open>z \<notin> S\<close> by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6074
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6075
  proof (rule that [OF \<open>y \<in> S\<close> *])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6076
    fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6077
    assume "x \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6078
    have yz: "0 < (y - z) \<bullet> (y - z)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6079
      using \<open>y \<in> S\<close> \<open>z \<notin> S\<close> by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6080
    { assume 0: "0 < ((z - y) \<bullet> (x - y))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6081
      with any_closest_point_dot [OF \<open>convex S\<close> \<open>closed S\<close>]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6082
      have False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6083
        using y \<open>x \<in> S\<close> \<open>y \<in> S\<close> not_less by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6084
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6085
    then have "0 \<le> ((y - z) \<bullet> (x - y))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6086
      by (force simp: not_less inner_diff_left)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6087
    with yz have "0 < 2 * ((y - z) \<bullet> (x - y)) + (y - z) \<bullet> (y - z)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6088
      by (simp add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6089
    then show "(y - z) \<bullet> z + (norm (y - z))\<^sup>2 / 2 < (y - z) \<bullet> x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6090
      by (simp add: field_simps inner_diff_left inner_diff_right dot_square_norm [symmetric])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6091
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6092
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6093
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6094
lemma separating_hyperplane_closed_0_inset:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6095
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6096
  assumes "convex S" "closed S" "S \<noteq> {}" "0 \<notin> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6097
  obtains a b where "a \<in> S" "a \<noteq> 0" "0 < b" "\<And>x. x \<in> S \<Longrightarrow> a \<bullet> x > b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6098
using separating_hyperplane_closed_point_inset [OF assms]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6099
by simp (metis \<open>0 \<notin> S\<close>)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6100
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6101
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6102
proposition separating_hyperplane_set_0_inspan:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6103
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6104
  assumes "convex S" "S \<noteq> {}" "0 \<notin> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6105
  obtains a where "a \<in> span S" "a \<noteq> 0" "\<And>x. x \<in> S \<Longrightarrow> 0 \<le> a \<bullet> x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6106
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6107
  define k where [abs_def]: "k c = {x. 0 \<le> c \<bullet> x}" for c :: 'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6108
  have *: "span S \<inter> frontier (cball 0 1) \<inter> \<Inter>f' \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6109
          if f': "finite f'" "f' \<subseteq> k ` S" for f'
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6110
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6111
    obtain C where "C \<subseteq> S" "finite C" and C: "f' = k ` C"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6112
      using finite_subset_image [OF f'] by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6113
    obtain a where "a \<in> S" "a \<noteq> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6114
      using \<open>S \<noteq> {}\<close> \<open>0 \<notin> S\<close> ex_in_conv by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6115
    then have "norm (a /\<^sub>R (norm a)) = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6116
      by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6117
    moreover have "a /\<^sub>R (norm a) \<in> span S"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6118
      by (simp add: \<open>a \<in> S\<close> span_scale span_base)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6119
    ultimately have ass: "a /\<^sub>R (norm a) \<in> span S \<inter> sphere 0 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6120
      by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6121
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6122
    proof (cases "C = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6123
      case True with C ass show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6124
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6125
    next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6126
      case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6127
      have "closed (convex hull C)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6128
        using \<open>finite C\<close> compact_eq_bounded_closed finite_imp_compact_convex_hull by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6129
      moreover have "convex hull C \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6130
        by (simp add: False)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6131
      moreover have "0 \<notin> convex hull C"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6132
        by (metis \<open>C \<subseteq> S\<close> \<open>convex S\<close> \<open>0 \<notin> S\<close> convex_hull_subset hull_same insert_absorb insert_subset)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6133
      ultimately obtain a b
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6134
            where "a \<in> convex hull C" "a \<noteq> 0" "0 < b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6135
                  and ab: "\<And>x. x \<in> convex hull C \<Longrightarrow> a \<bullet> x > b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6136
        using separating_hyperplane_closed_0_inset by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6137
      then have "a \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6138
        by (metis \<open>C \<subseteq> S\<close> assms(1) subsetCE subset_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6139
      moreover have "norm (a /\<^sub>R (norm a)) = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6140
        using \<open>a \<noteq> 0\<close> by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6141
      moreover have "a /\<^sub>R (norm a) \<in> span S"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6142
        by (simp add: \<open>a \<in> S\<close> span_scale span_base)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6143
      ultimately have ass: "a /\<^sub>R (norm a) \<in> span S \<inter> sphere 0 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6144
        by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6145
      have aa: "a /\<^sub>R (norm a) \<in> (\<Inter>c\<in>C. {x. 0 \<le> c \<bullet> x})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6146
        apply (clarsimp simp add: divide_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6147
        using ab \<open>0 < b\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6148
        by (metis hull_inc inner_commute less_eq_real_def less_trans)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6149
      show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6150
        apply (simp add: C k_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6151
        using ass aa Int_iff empty_iff by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6152
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6153
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6154
  have "(span S \<inter> frontier(cball 0 1)) \<inter> (\<Inter> (k ` S)) \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6155
    apply (rule compact_imp_fip)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6156
    apply (blast intro: compact_cball)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6157
    using closed_halfspace_ge k_def apply blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6158
    apply (metis *)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6159
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6160
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6161
    unfolding set_eq_iff k_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6162
    by simp (metis inner_commute norm_eq_zero that zero_neq_one)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6163
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6164
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6165
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6166
lemma separating_hyperplane_set_point_inaff:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6167
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6168
  assumes "convex S" "S \<noteq> {}" and zno: "z \<notin> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6169
  obtains a b where "(z + a) \<in> affine hull (insert z S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6170
                and "a \<noteq> 0" and "a \<bullet> z \<le> b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6171
                and "\<And>x. x \<in> S \<Longrightarrow> a \<bullet> x \<ge> b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6172
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6173
from separating_hyperplane_set_0_inspan [of "image (\<lambda>x. -z + x) S"]
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  6174
  have "convex ((+) (- z) ` S)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6175
    by (simp add: \<open>convex S\<close>)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  6176
  moreover have "(+) (- z) ` S \<noteq> {}"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6177
    by (simp add: \<open>S \<noteq> {}\<close>)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  6178
  moreover have "0 \<notin> (+) (- z) ` S"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6179
    using zno by auto
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  6180
  ultimately obtain a where "a \<in> span ((+) (- z) ` S)" "a \<noteq> 0"
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  6181
                  and a:  "\<And>x. x \<in> ((+) (- z) ` S) \<Longrightarrow> 0 \<le> a \<bullet> x"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6182
    using separating_hyperplane_set_0_inspan [of "image (\<lambda>x. -z + x) S"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6183
    by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6184
  then have szx: "\<And>x. x \<in> S \<Longrightarrow> a \<bullet> z \<le> a \<bullet> x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6185
    by (metis (no_types, lifting) imageI inner_minus_right inner_right_distrib minus_add neg_le_0_iff_le neg_le_iff_le real_add_le_0_iff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6186
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6187
    apply (rule_tac a=a and b = "a  \<bullet> z" in that, simp_all)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  6188
    using \<open>a \<in> span ((+) (- z) ` S)\<close> affine_hull_insert_span_gen apply blast
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6189
    apply (simp_all add: \<open>a \<noteq> 0\<close> szx)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6190
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6191
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6192
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6193
proposition supporting_hyperplane_rel_boundary:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6194
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6195
  assumes "convex S" "x \<in> S" and xno: "x \<notin> rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6196
  obtains a where "a \<noteq> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6197
              and "\<And>y. y \<in> S \<Longrightarrow> a \<bullet> x \<le> a \<bullet> y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6198
              and "\<And>y. y \<in> rel_interior S \<Longrightarrow> a \<bullet> x < a \<bullet> y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6199
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6200
  obtain a b where aff: "(x + a) \<in> affine hull (insert x (rel_interior S))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6201
                  and "a \<noteq> 0" and "a \<bullet> x \<le> b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6202
                  and ageb: "\<And>u. u \<in> (rel_interior S) \<Longrightarrow> a \<bullet> u \<ge> b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6203
    using separating_hyperplane_set_point_inaff [of "rel_interior S" x] assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6204
    by (auto simp: rel_interior_eq_empty convex_rel_interior)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6205
  have le_ay: "a \<bullet> x \<le> a \<bullet> y" if "y \<in> S" for y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6206
  proof -
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  6207
    have con: "continuous_on (closure (rel_interior S)) ((\<bullet>) a)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6208
      by (rule continuous_intros continuous_on_subset | blast)+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6209
    have y: "y \<in> closure (rel_interior S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6210
      using \<open>convex S\<close> closure_def convex_closure_rel_interior \<open>y \<in> S\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6211
      by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6212
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6213
      using continuous_ge_on_closure [OF con y] ageb \<open>a \<bullet> x \<le> b\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6214
      by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6215
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6216
  have 3: "a \<bullet> x < a \<bullet> y" if "y \<in> rel_interior S" for y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6217
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6218
    obtain e where "0 < e" "y \<in> S" and e: "cball y e \<inter> affine hull S \<subseteq> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6219
      using \<open>y \<in> rel_interior S\<close> by (force simp: rel_interior_cball)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6220
    define y' where "y' = y - (e / norm a) *\<^sub>R ((x + a) - x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6221
    have "y' \<in> cball y e"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6222
      unfolding y'_def using \<open>0 < e\<close> by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6223
    moreover have "y' \<in> affine hull S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6224
      unfolding y'_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6225
      by (metis \<open>x \<in> S\<close> \<open>y \<in> S\<close> \<open>convex S\<close> aff affine_affine_hull hull_redundant
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6226
                rel_interior_same_affine_hull hull_inc mem_affine_3_minus2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6227
    ultimately have "y' \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6228
      using e by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6229
    have "a \<bullet> x \<le> a \<bullet> y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6230
      using le_ay \<open>a \<noteq> 0\<close> \<open>y \<in> S\<close> by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6231
    moreover have "a \<bullet> x \<noteq> a \<bullet> y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6232
      using le_ay [OF \<open>y' \<in> S\<close>] \<open>a \<noteq> 0\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6233
      apply (simp add: y'_def inner_diff dot_square_norm power2_eq_square)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6234
      by (metis \<open>0 < e\<close> add_le_same_cancel1 inner_commute inner_real_def inner_zero_left le_diff_eq norm_le_zero_iff real_mult_le_cancel_iff2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6235
    ultimately show ?thesis by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6236
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6237
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6238
    by (rule that [OF \<open>a \<noteq> 0\<close> le_ay 3])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6239
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6240
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6241
lemma supporting_hyperplane_relative_frontier:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6242
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6243
  assumes "convex S" "x \<in> closure S" "x \<notin> rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6244
  obtains a where "a \<noteq> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6245
              and "\<And>y. y \<in> closure S \<Longrightarrow> a \<bullet> x \<le> a \<bullet> y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6246
              and "\<And>y. y \<in> rel_interior S \<Longrightarrow> a \<bullet> x < a \<bullet> y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6247
using supporting_hyperplane_rel_boundary [of "closure S" x]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6248
by (metis assms convex_closure convex_rel_interior_closure)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6249
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6250
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  6251
subsection%unimportant\<open> Some results on decomposing convex hulls: intersections, simplicial subdivision\<close>
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6252
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6253
lemma
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6254
  fixes s :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6255
  assumes "~ (affine_dependent(s \<union> t))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6256
    shows convex_hull_Int_subset: "convex hull s \<inter> convex hull t \<subseteq> convex hull (s \<inter> t)" (is ?C)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6257
      and affine_hull_Int_subset: "affine hull s \<inter> affine hull t \<subseteq> affine hull (s \<inter> t)" (is ?A)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6258
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6259
  have [simp]: "finite s" "finite t"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6260
    using aff_independent_finite assms by blast+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6261
    have "sum u (s \<inter> t) = 1 \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6262
          (\<Sum>v\<in>s \<inter> t. u v *\<^sub>R v) = (\<Sum>v\<in>s. u v *\<^sub>R v)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6263
      if [simp]:  "sum u s = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6264
                 "sum v t = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6265
         and eq: "(\<Sum>x\<in>t. v x *\<^sub>R x) = (\<Sum>x\<in>s. u x *\<^sub>R x)" for u v
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6266
    proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6267
    define f where "f x = (if x \<in> s then u x else 0) - (if x \<in> t then v x else 0)" for x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6268
    have "sum f (s \<union> t) = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6269
      apply (simp add: f_def sum_Un sum_subtractf)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6270
      apply (simp add: sum.inter_restrict [symmetric] Int_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6271
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6272
    moreover have "(\<Sum>x\<in>(s \<union> t). f x *\<^sub>R x) = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6273
      apply (simp add: f_def sum_Un scaleR_left_diff_distrib sum_subtractf)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6274
      apply (simp add: if_smult sum.inter_restrict [symmetric] Int_commute eq
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6275
          cong del: if_weak_cong)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6276
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6277
    ultimately have "\<And>v. v \<in> s \<union> t \<Longrightarrow> f v = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6278
      using aff_independent_finite assms unfolding affine_dependent_explicit
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6279
      by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6280
    then have u [simp]: "\<And>x. x \<in> s \<Longrightarrow> u x = (if x \<in> t then v x else 0)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6281
      by (simp add: f_def) presburger
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6282
    have "sum u (s \<inter> t) = sum u s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6283
      by (simp add: sum.inter_restrict)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6284
    then have "sum u (s \<inter> t) = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6285
      using that by linarith
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6286
    moreover have "(\<Sum>v\<in>s \<inter> t. u v *\<^sub>R v) = (\<Sum>v\<in>s. u v *\<^sub>R v)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6287
      by (auto simp: if_smult sum.inter_restrict intro: sum.cong)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6288
    ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6289
      by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6290
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6291
    then show ?A ?C
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6292
      by (auto simp: convex_hull_finite affine_hull_finite)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6293
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6294
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6295
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6296
proposition affine_hull_Int:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6297
  fixes s :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6298
  assumes "~ (affine_dependent(s \<union> t))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6299
    shows "affine hull (s \<inter> t) = affine hull s \<inter> affine hull t"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6300
apply (rule subset_antisym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6301
apply (simp add: hull_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6302
by (simp add: affine_hull_Int_subset assms)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6303
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6304
proposition convex_hull_Int:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6305
  fixes s :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6306
  assumes "~ (affine_dependent(s \<union> t))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6307
    shows "convex hull (s \<inter> t) = convex hull s \<inter> convex hull t"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6308
apply (rule subset_antisym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6309
apply (simp add: hull_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6310
by (simp add: convex_hull_Int_subset assms)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6311
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6312
proposition
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6313
  fixes s :: "'a::euclidean_space set set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6314
  assumes "~ (affine_dependent (\<Union>s))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6315
    shows affine_hull_Inter: "affine hull (\<Inter>s) = (\<Inter>t\<in>s. affine hull t)" (is "?A")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6316
      and convex_hull_Inter: "convex hull (\<Inter>s) = (\<Inter>t\<in>s. convex hull t)" (is "?C")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6317
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6318
  have "finite s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6319
    using aff_independent_finite assms finite_UnionD by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6320
  then have "?A \<and> ?C" using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6321
  proof (induction s rule: finite_induct)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6322
    case empty then show ?case by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6323
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6324
    case (insert t F)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6325
    then show ?case
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6326
    proof (cases "F={}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6327
      case True then show ?thesis by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6328
    next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6329
      case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6330
      with "insert.prems" have [simp]: "\<not> affine_dependent (t \<union> \<Inter>F)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6331
        by (auto intro: affine_dependent_subset)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6332
      have [simp]: "\<not> affine_dependent (\<Union>F)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6333
        using affine_independent_subset insert.prems by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6334
      show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6335
        by (simp add: affine_hull_Int convex_hull_Int insert.IH)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6336
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6337
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6338
  then show "?A" "?C"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6339
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6340
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6341
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6342
proposition in_convex_hull_exchange_unique:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6343
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6344
  assumes naff: "~ affine_dependent S" and a: "a \<in> convex hull S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6345
      and S: "T \<subseteq> S" "T' \<subseteq> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6346
      and x:  "x \<in> convex hull (insert a T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6347
      and x': "x \<in> convex hull (insert a T')"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6348
    shows "x \<in> convex hull (insert a (T \<inter> T'))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6349
proof (cases "a \<in> S")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6350
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6351
  then have "\<not> affine_dependent (insert a T \<union> insert a T')"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6352
    using affine_dependent_subset assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6353
  then have "x \<in> convex hull (insert a T \<inter> insert a T')"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6354
    by (metis IntI convex_hull_Int x x')
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6355
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6356
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6357
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6358
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6359
  then have anot: "a \<notin> T" "a \<notin> T'"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6360
    using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6361
  have [simp]: "finite S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6362
    by (simp add: aff_independent_finite assms)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6363
  then obtain b where b0: "\<And>s. s \<in> S \<Longrightarrow> 0 \<le> b s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6364
                  and b1: "sum b S = 1" and aeq: "a = (\<Sum>s\<in>S. b s *\<^sub>R s)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6365
    using a by (auto simp: convex_hull_finite)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6366
  have fin [simp]: "finite T" "finite T'"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6367
    using assms infinite_super \<open>finite S\<close> by blast+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6368
  then obtain c c' where c0: "\<And>t. t \<in> insert a T \<Longrightarrow> 0 \<le> c t"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6369
                     and c1: "sum c (insert a T) = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6370
                     and xeq: "x = (\<Sum>t \<in> insert a T. c t *\<^sub>R t)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6371
                     and c'0: "\<And>t. t \<in> insert a T' \<Longrightarrow> 0 \<le> c' t"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6372
                     and c'1: "sum c' (insert a T') = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6373
                     and x'eq: "x = (\<Sum>t \<in> insert a T'. c' t *\<^sub>R t)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6374
    using x x' by (auto simp: convex_hull_finite)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6375
  with fin anot
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6376
  have sumTT': "sum c T = 1 - c a" "sum c' T' = 1 - c' a"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6377
   and wsumT: "(\<Sum>t \<in> T. c t *\<^sub>R t) = x - c a *\<^sub>R a"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6378
    by simp_all
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6379
  have wsumT': "(\<Sum>t \<in> T'. c' t *\<^sub>R t) = x - c' a *\<^sub>R a"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6380
    using x'eq fin anot by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6381
  define cc  where "cc \<equiv> \<lambda>x. if x \<in> T then c x else 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6382
  define cc' where "cc' \<equiv> \<lambda>x. if x \<in> T' then c' x else 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6383
  define dd  where "dd \<equiv> \<lambda>x. cc x - cc' x + (c a - c' a) * b x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6384
  have sumSS': "sum cc S = 1 - c a" "sum cc' S = 1 - c' a"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6385
    unfolding cc_def cc'_def  using S
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6386
    by (simp_all add: Int_absorb1 Int_absorb2 sum_subtractf sum.inter_restrict [symmetric] sumTT')
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6387
  have wsumSS: "(\<Sum>t \<in> S. cc t *\<^sub>R t) = x - c a *\<^sub>R a" "(\<Sum>t \<in> S. cc' t *\<^sub>R t) = x - c' a *\<^sub>R a"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6388
    unfolding cc_def cc'_def  using S
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6389
    by (simp_all add: Int_absorb1 Int_absorb2 if_smult sum.inter_restrict [symmetric] wsumT wsumT' cong: if_cong)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6390
  have sum_dd0: "sum dd S = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6391
    unfolding dd_def  using S
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6392
    by (simp add: sumSS' comm_monoid_add_class.sum.distrib sum_subtractf
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6393
                  algebra_simps sum_distrib_right [symmetric] b1)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6394
  have "(\<Sum>v\<in>S. (b v * x) *\<^sub>R v) = x *\<^sub>R (\<Sum>v\<in>S. b v *\<^sub>R v)" for x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6395
    by (simp add: pth_5 real_vector.scale_sum_right mult.commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6396
  then have *: "(\<Sum>v\<in>S. (b v * x) *\<^sub>R v) = x *\<^sub>R a" for x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6397
    using aeq by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6398
  have "(\<Sum>v \<in> S. dd v *\<^sub>R v) = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6399
    unfolding dd_def using S
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6400
    by (simp add: * wsumSS sum.distrib sum_subtractf algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6401
  then have dd0: "dd v = 0" if "v \<in> S" for v
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6402
    using naff that \<open>finite S\<close> sum_dd0 unfolding affine_dependent_explicit
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6403
    apply (simp only: not_ex)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6404
    apply (drule_tac x=S in spec)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6405
    apply (drule_tac x=dd in spec, simp)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6406
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6407
  consider "c' a \<le> c a" | "c a \<le> c' a" by linarith
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6408
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6409
  proof cases
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6410
    case 1
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6411
    then have "sum cc S \<le> sum cc' S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6412
      by (simp add: sumSS')
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6413
    then have le: "cc x \<le> cc' x" if "x \<in> S" for x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6414
      using dd0 [OF that] 1 b0 mult_left_mono that
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6415
      by (fastforce simp add: dd_def algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6416
    have cc0: "cc x = 0" if "x \<in> S" "x \<notin> T \<inter> T'" for x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6417
      using le [OF \<open>x \<in> S\<close>] that c0
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6418
      by (force simp: cc_def cc'_def split: if_split_asm)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6419
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6420
    proof (simp add: convex_hull_finite, intro exI conjI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6421
      show "\<forall>x\<in>T \<inter> T'. 0 \<le> (cc(a := c a)) x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6422
        by (simp add: c0 cc_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6423
      show "0 \<le> (cc(a := c a)) a"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6424
        by (simp add: c0)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6425
      have "sum (cc(a := c a)) (insert a (T \<inter> T')) = c a + sum (cc(a := c a)) (T \<inter> T')"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6426
        by (simp add: anot)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6427
      also have "... = c a + sum (cc(a := c a)) S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6428
        apply simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6429
        apply (rule sum.mono_neutral_left)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6430
        using \<open>T \<subseteq> S\<close> apply (auto simp: \<open>a \<notin> S\<close> cc0)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6431
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6432
      also have "... = c a + (1 - c a)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6433
        by (metis \<open>a \<notin> S\<close> fun_upd_other sum.cong sumSS')
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6434
      finally show "sum (cc(a := c a)) (insert a (T \<inter> T')) = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6435
        by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6436
      have "(\<Sum>x\<in>insert a (T \<inter> T'). (cc(a := c a)) x *\<^sub>R x) = c a *\<^sub>R a + (\<Sum>x \<in> T \<inter> T'. (cc(a := c a)) x *\<^sub>R x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6437
        by (simp add: anot)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6438
      also have "... = c a *\<^sub>R a + (\<Sum>x \<in> S. (cc(a := c a)) x *\<^sub>R x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6439
        apply simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6440
        apply (rule sum.mono_neutral_left)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6441
        using \<open>T \<subseteq> S\<close> apply (auto simp: \<open>a \<notin> S\<close> cc0)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6442
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6443
      also have "... = c a *\<^sub>R a + x - c a *\<^sub>R a"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6444
        by (simp add: wsumSS \<open>a \<notin> S\<close> if_smult sum_delta_notmem)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6445
      finally show "(\<Sum>x\<in>insert a (T \<inter> T'). (cc(a := c a)) x *\<^sub>R x) = x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6446
        by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6447
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6448
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6449
    case 2
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6450
    then have "sum cc' S \<le> sum cc S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6451
      by (simp add: sumSS')
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6452
    then have le: "cc' x \<le> cc x" if "x \<in> S" for x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6453
      using dd0 [OF that] 2 b0 mult_left_mono that
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6454
      by (fastforce simp add: dd_def algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6455
    have cc0: "cc' x = 0" if "x \<in> S" "x \<notin> T \<inter> T'" for x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6456
      using le [OF \<open>x \<in> S\<close>] that c'0
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6457
      by (force simp: cc_def cc'_def split: if_split_asm)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6458
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6459
    proof (simp add: convex_hull_finite, intro exI conjI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6460
      show "\<forall>x\<in>T \<inter> T'. 0 \<le> (cc'(a := c' a)) x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6461
        by (simp add: c'0 cc'_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6462
      show "0 \<le> (cc'(a := c' a)) a"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6463
        by (simp add: c'0)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6464
      have "sum (cc'(a := c' a)) (insert a (T \<inter> T')) = c' a + sum (cc'(a := c' a)) (T \<inter> T')"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6465
        by (simp add: anot)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6466
      also have "... = c' a + sum (cc'(a := c' a)) S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6467
        apply simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6468
        apply (rule sum.mono_neutral_left)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6469
        using \<open>T \<subseteq> S\<close> apply (auto simp: \<open>a \<notin> S\<close> cc0)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6470
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6471
      also have "... = c' a + (1 - c' a)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6472
        by (metis \<open>a \<notin> S\<close> fun_upd_other sum.cong sumSS')
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6473
      finally show "sum (cc'(a := c' a)) (insert a (T \<inter> T')) = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6474
        by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6475
      have "(\<Sum>x\<in>insert a (T \<inter> T'). (cc'(a := c' a)) x *\<^sub>R x) = c' a *\<^sub>R a + (\<Sum>x \<in> T \<inter> T'. (cc'(a := c' a)) x *\<^sub>R x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6476
        by (simp add: anot)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6477
      also have "... = c' a *\<^sub>R a + (\<Sum>x \<in> S. (cc'(a := c' a)) x *\<^sub>R x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6478
        apply simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6479
        apply (rule sum.mono_neutral_left)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6480
        using \<open>T \<subseteq> S\<close> apply (auto simp: \<open>a \<notin> S\<close> cc0)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6481
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6482
      also have "... = c a *\<^sub>R a + x - c a *\<^sub>R a"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6483
        by (simp add: wsumSS \<open>a \<notin> S\<close> if_smult sum_delta_notmem)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6484
      finally show "(\<Sum>x\<in>insert a (T \<inter> T'). (cc'(a := c' a)) x *\<^sub>R x) = x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6485
        by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6486
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6487
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6488
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6489
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6490
corollary convex_hull_exchange_Int:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6491
  fixes a  :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6492
  assumes "~ affine_dependent S" "a \<in> convex hull S" "T \<subseteq> S" "T' \<subseteq> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6493
  shows "(convex hull (insert a T)) \<inter> (convex hull (insert a T')) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6494
         convex hull (insert a (T \<inter> T'))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6495
apply (rule subset_antisym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6496
  using in_convex_hull_exchange_unique assms apply blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6497
  by (metis hull_mono inf_le1 inf_le2 insert_inter_insert le_inf_iff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6498
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6499
lemma Int_closed_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6500
  fixes b :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6501
  assumes "b \<in> closed_segment a c \<or> ~collinear{a,b,c}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6502
    shows "closed_segment a b \<inter> closed_segment b c = {b}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6503
proof (cases "c = a")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6504
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6505
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6506
    using assms collinear_3_eq_affine_dependent by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6507
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6508
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6509
  from assms show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6510
  proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6511
    assume "b \<in> closed_segment a c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6512
    moreover have "\<not> affine_dependent {a, c}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6513
      by (simp add: affine_independent_2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6514
    ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6515
      using False convex_hull_exchange_Int [of "{a,c}" b "{a}" "{c}"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6516
      by (simp add: segment_convex_hull insert_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6517
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6518
    assume ncoll: "\<not> collinear {a, b, c}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6519
    have False if "closed_segment a b \<inter> closed_segment b c \<noteq> {b}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6520
    proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6521
      have "b \<in> closed_segment a b" and "b \<in> closed_segment b c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6522
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6523
      with that obtain d where "b \<noteq> d" "d \<in> closed_segment a b" "d \<in> closed_segment b c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6524
        by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6525
      then have d: "collinear {a, d, b}"  "collinear {b, d, c}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6526
        by (auto simp:  between_mem_segment between_imp_collinear)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6527
      have "collinear {a, b, c}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6528
        apply (rule collinear_3_trans [OF _ _ \<open>b \<noteq> d\<close>])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6529
        using d  by (auto simp: insert_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6530
      with ncoll show False ..
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6531
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6532
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6533
      by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6534
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6535
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6536
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6537
lemma affine_hull_finite_intersection_hyperplanes:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6538
  fixes s :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6539
  obtains f where
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6540
     "finite f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6541
     "of_nat (card f) + aff_dim s = DIM('a)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6542
     "affine hull s = \<Inter>f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6543
     "\<And>h. h \<in> f \<Longrightarrow> \<exists>a b. a \<noteq> 0 \<and> h = {x. a \<bullet> x = b}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6544
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6545
  obtain b where "b \<subseteq> s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6546
             and indb: "\<not> affine_dependent b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6547
             and eq: "affine hull s = affine hull b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6548
    using affine_basis_exists by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6549
  obtain c where indc: "\<not> affine_dependent c" and "b \<subseteq> c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6550
             and affc: "affine hull c = UNIV"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6551
    by (metis extend_to_affine_basis affine_UNIV hull_same indb subset_UNIV)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6552
  then have "finite c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6553
    by (simp add: aff_independent_finite)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6554
  then have fbc: "finite b" "card b \<le> card c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6555
    using \<open>b \<subseteq> c\<close> infinite_super by (auto simp: card_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6556
  have imeq: "(\<lambda>x. affine hull x) ` ((\<lambda>a. c - {a}) ` (c - b)) = ((\<lambda>a. affine hull (c - {a})) ` (c - b))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6557
    by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6558
  have card1: "card ((\<lambda>a. affine hull (c - {a})) ` (c - b)) = card (c - b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6559
    apply (rule card_image [OF inj_onI])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6560
    by (metis Diff_eq_empty_iff Diff_iff indc affine_dependent_def hull_subset insert_iff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6561
  have card2: "(card (c - b)) + aff_dim s = DIM('a)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6562
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6563
    have aff: "aff_dim (UNIV::'a set) = aff_dim c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6564
      by (metis aff_dim_affine_hull affc)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6565
    have "aff_dim b = aff_dim s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6566
      by (metis (no_types) aff_dim_affine_hull eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6567
    then have "int (card b) = 1 + aff_dim s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6568
      by (simp add: aff_dim_affine_independent indb)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6569
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6570
      using fbc aff
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6571
      by (simp add: \<open>\<not> affine_dependent c\<close> \<open>b \<subseteq> c\<close> aff_dim_affine_independent aff_dim_UNIV card_Diff_subset of_nat_diff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6572
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6573
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6574
  proof (cases "c = b")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6575
    case True show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6576
      apply (rule_tac f="{}" in that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6577
      using True affc
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6578
      apply (simp_all add: eq [symmetric])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6579
      by (metis aff_dim_UNIV aff_dim_affine_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6580
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6581
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6582
    have ind: "\<not> affine_dependent (\<Union>a\<in>c - b. c - {a})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6583
      by (rule affine_independent_subset [OF indc]) auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6584
    have affeq: "affine hull s = (\<Inter>x\<in>(\<lambda>a. c - {a}) ` (c - b). affine hull x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6585
      using \<open>b \<subseteq> c\<close> False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6586
      apply (subst affine_hull_Inter [OF ind, symmetric])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6587
      apply (simp add: eq double_diff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6588
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6589
    have *: "1 + aff_dim (c - {t}) = int (DIM('a))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6590
            if t: "t \<in> c" for t
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6591
    proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6592
      have "insert t c = c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6593
        using t by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6594
      then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6595
        by (metis (full_types) add.commute aff_dim_affine_hull aff_dim_insert aff_dim_UNIV affc affine_dependent_def indc insert_Diff_single t)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6596
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6597
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6598
      apply (rule_tac f = "(\<lambda>x. affine hull x) ` ((\<lambda>a. c - {a}) ` (c - b))" in that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6599
         using \<open>finite c\<close> apply blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6600
        apply (simp add: imeq card1 card2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6601
      apply (simp add: affeq, clarify)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6602
      apply (metis DIM_positive One_nat_def Suc_leI add_diff_cancel_left' of_nat_1 aff_dim_eq_hyperplane of_nat_diff *)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6603
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6604
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6605
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6606
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6607
lemma affine_hyperplane_sums_eq_UNIV_0:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6608
  fixes S :: "'a :: euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6609
  assumes "affine S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6610
     and "0 \<in> S" and "w \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6611
     and "a \<bullet> w \<noteq> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6612
   shows "{x + y| x y. x \<in> S \<and> a \<bullet> y = 0} = UNIV"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6613
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6614
  have "subspace S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6615
    by (simp add: assms subspace_affine)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6616
  have span1: "span {y. a \<bullet> y = 0} \<subseteq> span {x + y |x y. x \<in> S \<and> a \<bullet> y = 0}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6617
    apply (rule span_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6618
    using \<open>0 \<in> S\<close> add.left_neutral by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6619
  have "w \<notin> span {y. a \<bullet> y = 0}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6620
    using \<open>a \<bullet> w \<noteq> 0\<close> span_induct subspace_hyperplane by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6621
  moreover have "w \<in> span {x + y |x y. x \<in> S \<and> a \<bullet> y = 0}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6622
    using \<open>w \<in> S\<close>
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6623
    by (metis (mono_tags, lifting) inner_zero_right mem_Collect_eq pth_d span_base)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6624
  ultimately have span2: "span {y. a \<bullet> y = 0} \<noteq> span {x + y |x y. x \<in> S \<and> a \<bullet> y = 0}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6625
    by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6626
  have "a \<noteq> 0" using assms inner_zero_left by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6627
  then have "DIM('a) - 1 = dim {y. a \<bullet> y = 0}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6628
    by (simp add: dim_hyperplane)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6629
  also have "... < dim {x + y |x y. x \<in> S \<and> a \<bullet> y = 0}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6630
    using span1 span2 by (blast intro: dim_psubset)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6631
  finally have DIM_lt: "DIM('a) - 1 < dim {x + y |x y. x \<in> S \<and> a \<bullet> y = 0}" .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6632
  have subs: "subspace {x + y| x y. x \<in> S \<and> a \<bullet> y = 0}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6633
    using subspace_sums [OF \<open>subspace S\<close> subspace_hyperplane] by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6634
  moreover have "span {x + y| x y. x \<in> S \<and> a \<bullet> y = 0} = UNIV"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6635
    apply (rule dim_eq_full [THEN iffD1])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6636
    apply (rule antisym [OF dim_subset_UNIV])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6637
    using DIM_lt apply simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6638
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6639
  ultimately show ?thesis
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6640
    by (simp add: subs) (metis (lifting) span_eq_iff subs)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6641
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6642
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6643
proposition affine_hyperplane_sums_eq_UNIV:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6644
  fixes S :: "'a :: euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6645
  assumes "affine S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6646
      and "S \<inter> {v. a \<bullet> v = b} \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6647
      and "S - {v. a \<bullet> v = b} \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6648
    shows "{x + y| x y. x \<in> S \<and> a \<bullet> y = b} = UNIV"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6649
proof (cases "a = 0")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6650
  case True with assms show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6651
    by (auto simp: if_splits)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6652
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6653
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6654
  obtain c where "c \<in> S" and c: "a \<bullet> c = b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6655
    using assms by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6656
  with affine_diffs_subspace [OF \<open>affine S\<close>]
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  6657
  have "subspace ((+) (- c) ` S)" by blast
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  6658
  then have aff: "affine ((+) (- c) ` S)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6659
    by (simp add: subspace_imp_affine)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  6660
  have 0: "0 \<in> (+) (- c) ` S"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6661
    by (simp add: \<open>c \<in> S\<close>)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  6662
  obtain d where "d \<in> S" and "a \<bullet> d \<noteq> b" and dc: "d-c \<in> (+) (- c) ` S"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6663
    using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6664
  then have adc: "a \<bullet> (d - c) \<noteq> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6665
    by (simp add: c inner_diff_right)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  6666
  let ?U = "(+) (c+c) ` {x + y |x y. x \<in> (+) (- c) ` S \<and> a \<bullet> y = 0}"
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  6667
  have "u + v \<in> (+) (c + c) ` {x + v |x v. x \<in> (+) (- c) ` S \<and> a \<bullet> v = 0}"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6668
              if "u \<in> S" "b = a \<bullet> v" for u v
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6669
    apply (rule_tac x="u+v-c-c" in image_eqI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6670
    apply (simp_all add: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6671
    apply (rule_tac x="u-c" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6672
    apply (rule_tac x="v-c" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6673
    apply (simp add: algebra_simps that c)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6674
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6675
  moreover have "\<lbrakk>a \<bullet> v = 0; u \<in> S\<rbrakk>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6676
       \<Longrightarrow> \<exists>x ya. v + (u + c) = x + ya \<and> x \<in> S \<and> a \<bullet> ya = b" for v u
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6677
    by (metis add.left_commute c inner_right_distrib pth_d)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6678
  ultimately have "{x + y |x y. x \<in> S \<and> a \<bullet> y = b} = ?U"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6679
    by (fastforce simp: algebra_simps)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  6680
  also have "... = (+) (c+c) ` UNIV"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6681
    by (simp add: affine_hyperplane_sums_eq_UNIV_0 [OF aff 0 dc adc])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6682
  also have "... = UNIV"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6683
    by (simp add: translation_UNIV)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6684
  finally show ?thesis .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6685
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6686
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6687
lemma aff_dim_sums_Int_0:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6688
  assumes "affine S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6689
      and "affine T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6690
      and "0 \<in> S" "0 \<in> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6691
    shows "aff_dim {x + y| x y. x \<in> S \<and> y \<in> T} = (aff_dim S + aff_dim T) - aff_dim(S \<inter> T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6692
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6693
  have "0 \<in> {x + y |x y. x \<in> S \<and> y \<in> T}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6694
    using assms by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6695
  then have 0: "0 \<in> affine hull {x + y |x y. x \<in> S \<and> y \<in> T}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6696
    by (metis (lifting) hull_inc)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6697
  have sub: "subspace S"  "subspace T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6698
    using assms by (auto simp: subspace_affine)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6699
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6700
    using dim_sums_Int [OF sub] by (simp add: aff_dim_zero assms 0 hull_inc)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6701
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6702
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6703
proposition aff_dim_sums_Int:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6704
  assumes "affine S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6705
      and "affine T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6706
      and "S \<inter> T \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6707
    shows "aff_dim {x + y| x y. x \<in> S \<and> y \<in> T} = (aff_dim S + aff_dim T) - aff_dim(S \<inter> T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6708
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6709
  obtain a where a: "a \<in> S" "a \<in> T" using assms by force
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  6710
  have aff: "affine ((+) (-a) ` S)"  "affine ((+) (-a) ` T)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6711
    using assms by (auto simp: affine_translation [symmetric])
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  6712
  have zero: "0 \<in> ((+) (-a) ` S)"  "0 \<in> ((+) (-a) ` T)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6713
    using a assms by auto
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  6714
  have [simp]: "{x + y |x y. x \<in> (+) (- a) ` S \<and> y \<in> (+) (- a) ` T} =
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  6715
        (+) (- 2 *\<^sub>R a) ` {x + y| x y. x \<in> S \<and> y \<in> T}"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6716
    by (force simp: algebra_simps scaleR_2)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  6717
  have [simp]: "(+) (- a) ` S \<inter> (+) (- a) ` T = (+) (- a) ` (S \<inter> T)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6718
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6719
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6720
    using aff_dim_sums_Int_0 [OF aff zero]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6721
    by (auto simp: aff_dim_translation_eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6722
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6723
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6724
lemma aff_dim_affine_Int_hyperplane:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6725
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6726
  assumes "affine S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6727
    shows "aff_dim(S \<inter> {x. a \<bullet> x = b}) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6728
             (if S \<inter> {v. a \<bullet> v = b} = {} then - 1
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6729
              else if S \<subseteq> {v. a \<bullet> v = b} then aff_dim S
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6730
              else aff_dim S - 1)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6731
proof (cases "a = 0")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6732
  case True with assms show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6733
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6734
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6735
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6736
  then have "aff_dim (S \<inter> {x. a \<bullet> x = b}) = aff_dim S - 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6737
            if "x \<in> S" "a \<bullet> x \<noteq> b" and non: "S \<inter> {v. a \<bullet> v = b} \<noteq> {}" for x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6738
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6739
    have [simp]: "{x + y| x y. x \<in> S \<and> a \<bullet> y = b} = UNIV"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6740
      using affine_hyperplane_sums_eq_UNIV [OF assms non] that  by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6741
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6742
      using aff_dim_sums_Int [OF assms affine_hyperplane non]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6743
      by (simp add: of_nat_diff False)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6744
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6745
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6746
    by (metis (mono_tags, lifting) inf.orderE aff_dim_empty_eq mem_Collect_eq subsetI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6747
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6748
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6749
lemma aff_dim_lt_full:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6750
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6751
  shows "aff_dim S < DIM('a) \<longleftrightarrow> (affine hull S \<noteq> UNIV)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6752
by (metis (no_types) aff_dim_affine_hull aff_dim_le_DIM aff_dim_UNIV affine_hull_UNIV less_le)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6753
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6754
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6755
subsection\<open> Orthogonal bases, Gram-Schmidt process, and related theorems\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6756
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6757
lemma pairwise_orthogonal_independent:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6758
  assumes "pairwise orthogonal S" and "0 \<notin> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6759
    shows "independent S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6760
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6761
  have 0: "\<And>x y. \<lbrakk>x \<noteq> y; x \<in> S; y \<in> S\<rbrakk> \<Longrightarrow> x \<bullet> y = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6762
    using assms by (simp add: pairwise_def orthogonal_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6763
  have "False" if "a \<in> S" and a: "a \<in> span (S - {a})" for a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6764
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6765
    obtain T U where "T \<subseteq> S - {a}" "a = (\<Sum>v\<in>T. U v *\<^sub>R v)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6766
      using a by (force simp: span_explicit)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6767
    then have "a \<bullet> a = a \<bullet> (\<Sum>v\<in>T. U v *\<^sub>R v)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6768
      by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6769
    also have "... = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6770
      apply (simp add: inner_sum_right)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6771
      apply (rule comm_monoid_add_class.sum.neutral)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6772
      by (metis "0" DiffE \<open>T \<subseteq> S - {a}\<close> mult_not_zero singletonI subsetCE \<open>a \<in> S\<close>)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6773
    finally show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6774
      using \<open>0 \<notin> S\<close> \<open>a \<in> S\<close> by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6775
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6776
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6777
    by (force simp: dependent_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6778
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6779
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6780
lemma pairwise_orthogonal_imp_finite:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6781
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6782
  assumes "pairwise orthogonal S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6783
    shows "finite S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6784
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6785
  have "independent (S - {0})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6786
    apply (rule pairwise_orthogonal_independent)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6787
     apply (metis Diff_iff assms pairwise_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6788
    by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6789
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6790
    by (meson independent_imp_finite infinite_remove)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6791
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6792
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6793
lemma subspace_orthogonal_to_vector: "subspace {y. orthogonal x y}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6794
  by (simp add: subspace_def orthogonal_clauses)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6795
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6796
lemma subspace_orthogonal_to_vectors: "subspace {y. \<forall>x \<in> S. orthogonal x y}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6797
  by (simp add: subspace_def orthogonal_clauses)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6798
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6799
lemma orthogonal_to_span:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6800
  assumes a: "a \<in> span S" and x: "\<And>y. y \<in> S \<Longrightarrow> orthogonal x y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6801
    shows "orthogonal x a"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6802
  by (metis a orthogonal_clauses(1,2,4)
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6803
      span_induct_alt x)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6804
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  6805
proposition%important Gram_Schmidt_step:
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6806
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6807
  assumes S: "pairwise orthogonal S" and x: "x \<in> span S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6808
    shows "orthogonal x (a - (\<Sum>b\<in>S. (b \<bullet> a / (b \<bullet> b)) *\<^sub>R b))"
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  6809
proof%unimportant -
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6810
  have "finite S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6811
    by (simp add: S pairwise_orthogonal_imp_finite)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6812
  have "orthogonal (a - (\<Sum>b\<in>S. (b \<bullet> a / (b \<bullet> b)) *\<^sub>R b)) x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6813
       if "x \<in> S" for x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6814
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6815
    have "a \<bullet> x = (\<Sum>y\<in>S. if y = x then y \<bullet> a else 0)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6816
      by (simp add: \<open>finite S\<close> inner_commute sum.delta that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6817
    also have "... =  (\<Sum>b\<in>S. b \<bullet> a * (b \<bullet> x) / (b \<bullet> b))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6818
      apply (rule sum.cong [OF refl], simp)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6819
      by (meson S orthogonal_def pairwise_def that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6820
   finally show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6821
     by (simp add: orthogonal_def algebra_simps inner_sum_left)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6822
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6823
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6824
    using orthogonal_to_span orthogonal_commute x by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6825
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6826
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6827
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6828
lemma orthogonal_extension_aux:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6829
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6830
  assumes "finite T" "finite S" "pairwise orthogonal S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6831
    shows "\<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6832
using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6833
proof (induction arbitrary: S)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6834
  case empty then show ?case
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6835
    by simp (metis sup_bot_right)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6836
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6837
  case (insert a T)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6838
  have 0: "\<And>x y. \<lbrakk>x \<noteq> y; x \<in> S; y \<in> S\<rbrakk> \<Longrightarrow> x \<bullet> y = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6839
    using insert by (simp add: pairwise_def orthogonal_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6840
  define a' where "a' = a - (\<Sum>b\<in>S. (b \<bullet> a / (b \<bullet> b)) *\<^sub>R b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6841
  obtain U where orthU: "pairwise orthogonal (S \<union> insert a' U)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6842
             and spanU: "span (insert a' S \<union> U) = span (insert a' S \<union> T)"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6843
    by (rule exE [OF insert.IH [of "insert a' S"]])
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6844
      (auto simp: Gram_Schmidt_step a'_def insert.prems orthogonal_commute
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6845
        pairwise_orthogonal_insert span_clauses)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6846
  have orthS: "\<And>x. x \<in> S \<Longrightarrow> a' \<bullet> x = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6847
    apply (simp add: a'_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6848
    using Gram_Schmidt_step [OF \<open>pairwise orthogonal S\<close>]
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6849
    apply (force simp: orthogonal_def inner_commute span_superset [THEN subsetD])
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6850
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6851
  have "span (S \<union> insert a' U) = span (insert a' (S \<union> T))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6852
    using spanU by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6853
  also have "... = span (insert a (S \<union> T))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6854
    apply (rule eq_span_insert_eq)
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6855
    apply (simp add: a'_def span_neg span_sum span_clauses(1)
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6856
        span_scale)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6857
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6858
  also have "... = span (S \<union> insert a T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6859
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6860
  finally show ?case
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6861
    apply (rule_tac x="insert a' U" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6862
    using orthU apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6863
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6864
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6865
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6866
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  6867
proposition%important orthogonal_extension:
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6868
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6869
  assumes S: "pairwise orthogonal S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6870
  obtains U where "pairwise orthogonal (S \<union> U)" "span (S \<union> U) = span (S \<union> T)"
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  6871
proof%unimportant -
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6872
  obtain B where "finite B" "span B = span T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6873
    using basis_subspace_exists [of "span T"] subspace_span by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6874
  with orthogonal_extension_aux [of B S]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6875
  obtain U where "pairwise orthogonal (S \<union> U)" "span (S \<union> U) = span (S \<union> B)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6876
    using assms pairwise_orthogonal_imp_finite by auto
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6877
  with \<open>span B = span T\<close> show ?thesis
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6878
    by (rule_tac U=U in that) (auto simp: span_Un)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6879
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6880
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6881
corollary orthogonal_extension_strong:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6882
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6883
  assumes S: "pairwise orthogonal S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6884
  obtains U where "U \<inter> (insert 0 S) = {}" "pairwise orthogonal (S \<union> U)"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6885
                  "span (S \<union> U) = span (S \<union> T)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6886
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6887
  obtain U where "pairwise orthogonal (S \<union> U)" "span (S \<union> U) = span (S \<union> T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6888
    using orthogonal_extension assms by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6889
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6890
    apply (rule_tac U = "U - (insert 0 S)" in that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6891
      apply blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6892
     apply (force simp: pairwise_def)
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6893
    apply (metis Un_Diff_cancel Un_insert_left span_redundant span_zero)
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6894
    done
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6895
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6896
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67962
diff changeset
  6897
subsection\<open>Decomposing a vector into parts in orthogonal subspaces\<close>
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6898
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6899
text\<open>existence of orthonormal basis for a subspace.\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6900
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6901
lemma orthogonal_spanningset_subspace:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6902
  fixes S :: "'a :: euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6903
  assumes "subspace S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6904
  obtains B where "B \<subseteq> S" "pairwise orthogonal B" "span B = S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6905
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6906
  obtain B where "B \<subseteq> S" "independent B" "S \<subseteq> span B" "card B = dim S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6907
    using basis_exists by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6908
  with orthogonal_extension [of "{}" B]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6909
  show ?thesis
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6910
    by (metis Un_empty_left assms pairwise_empty span_superset span_subspace that)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6911
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6912
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6913
lemma orthogonal_basis_subspace:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6914
  fixes S :: "'a :: euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6915
  assumes "subspace S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6916
  obtains B where "0 \<notin> B" "B \<subseteq> S" "pairwise orthogonal B" "independent B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6917
                  "card B = dim S" "span B = S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6918
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6919
  obtain B where "B \<subseteq> S" "pairwise orthogonal B" "span B = S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6920
    using assms orthogonal_spanningset_subspace by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6921
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6922
    apply (rule_tac B = "B - {0}" in that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6923
    apply (auto simp: indep_card_eq_dim_span pairwise_subset Diff_subset pairwise_orthogonal_independent elim: pairwise_subset)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6924
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6925
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6926
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  6927
proposition%important orthonormal_basis_subspace:
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6928
  fixes S :: "'a :: euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6929
  assumes "subspace S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6930
  obtains B where "B \<subseteq> S" "pairwise orthogonal B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6931
              and "\<And>x. x \<in> B \<Longrightarrow> norm x = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6932
              and "independent B" "card B = dim S" "span B = S"
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  6933
proof%unimportant -
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6934
  obtain B where "0 \<notin> B" "B \<subseteq> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6935
             and orth: "pairwise orthogonal B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6936
             and "independent B" "card B = dim S" "span B = S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6937
    by (blast intro: orthogonal_basis_subspace [OF assms])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6938
  have 1: "(\<lambda>x. x /\<^sub>R norm x) ` B \<subseteq> S"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6939
    using \<open>span B = S\<close> span_clauses(1) span_scale by fastforce
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6940
  have 2: "pairwise orthogonal ((\<lambda>x. x /\<^sub>R norm x) ` B)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6941
    using orth by (force simp: pairwise_def orthogonal_clauses)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6942
  have 3: "\<And>x. x \<in> (\<lambda>x. x /\<^sub>R norm x) ` B \<Longrightarrow> norm x = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6943
    by (metis (no_types, lifting) \<open>0 \<notin> B\<close> image_iff norm_sgn sgn_div_norm)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6944
  have 4: "independent ((\<lambda>x. x /\<^sub>R norm x) ` B)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6945
    by (metis "2" "3" norm_zero pairwise_orthogonal_independent zero_neq_one)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6946
  have "inj_on (\<lambda>x. x /\<^sub>R norm x) B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6947
  proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6948
    fix x y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6949
    assume "x \<in> B" "y \<in> B" "x /\<^sub>R norm x = y /\<^sub>R norm y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6950
    moreover have "\<And>i. i \<in> B \<Longrightarrow> norm (i /\<^sub>R norm i) = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6951
      using 3 by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6952
    ultimately show "x = y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6953
      by (metis norm_eq_1 orth orthogonal_clauses(7) orthogonal_commute orthogonal_def pairwise_def zero_neq_one)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6954
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6955
  then have 5: "card ((\<lambda>x. x /\<^sub>R norm x) ` B) = dim S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6956
    by (metis \<open>card B = dim S\<close> card_image)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6957
  have 6: "span ((\<lambda>x. x /\<^sub>R norm x) ` B) = S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6958
    by (metis "1" "4" "5" assms card_eq_dim independent_finite span_subspace)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6959
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6960
    by (rule that [OF 1 2 3 4 5 6])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6961
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6962
66641
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  6963
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  6964
proposition%important orthogonal_to_subspace_exists_gen:
66641
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  6965
  fixes S :: "'a :: euclidean_space set"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  6966
  assumes "span S \<subset> span T"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  6967
  obtains x where "x \<noteq> 0" "x \<in> span T" "\<And>y. y \<in> span S \<Longrightarrow> orthogonal x y"
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  6968
proof%unimportant -
66641
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  6969
  obtain B where "B \<subseteq> span S" and orthB: "pairwise orthogonal B"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  6970
             and "\<And>x. x \<in> B \<Longrightarrow> norm x = 1"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  6971
             and "independent B" "card B = dim S" "span B = span S"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6972
    by (rule orthonormal_basis_subspace [of "span S", OF subspace_span])
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6973
      (auto simp: dim_span)
66641
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  6974
  with assms obtain u where spanBT: "span B \<subseteq> span T" and "u \<notin> span B" "u \<in> span T"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  6975
    by auto
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  6976
  obtain C where orthBC: "pairwise orthogonal (B \<union> C)" and spanBC: "span (B \<union> C) = span (B \<union> {u})"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  6977
    by (blast intro: orthogonal_extension [OF orthB])
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  6978
  show thesis
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  6979
  proof (cases "C \<subseteq> insert 0 B")
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  6980
    case True
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  6981
    then have "C \<subseteq> span B"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6982
      using span_eq
66641
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  6983
      by (metis span_insert_0 subset_trans)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  6984
    moreover have "u \<in> span (B \<union> C)"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6985
      using \<open>span (B \<union> C) = span (B \<union> {u})\<close> span_superset by force
66641
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  6986
    ultimately show ?thesis
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6987
      using True \<open>u \<notin> span B\<close>
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6988
      by (metis Un_insert_left span_insert_0 sup.orderE)
66641
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  6989
  next
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  6990
    case False
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  6991
    then obtain x where "x \<in> C" "x \<noteq> 0" "x \<notin> B"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  6992
      by blast
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  6993
    then have "x \<in> span T"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6994
      by (metis (no_types, lifting) Un_insert_right Un_upper2 \<open>u \<in> span T\<close> spanBT spanBC
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6995
          \<open>u \<in> span T\<close> insert_subset span_superset span_mono
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  6996
          span_span subsetCE subset_trans sup_bot.comm_neutral)
66641
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  6997
    moreover have "orthogonal x y" if "y \<in> span B" for y
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  6998
      using that
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  6999
    proof (rule span_induct)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7000
      show "subspace {a. orthogonal x a}"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7001
        by (simp add: subspace_orthogonal_to_vector)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7002
      show "\<And>b. b \<in> B \<Longrightarrow> orthogonal x b"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7003
        by (metis Un_iff \<open>x \<in> C\<close> \<open>x \<notin> B\<close> orthBC pairwise_def)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7004
    qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7005
    ultimately show ?thesis
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7006
      using \<open>x \<noteq> 0\<close> that \<open>span B = span S\<close> by auto
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7007
  qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7008
qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7009
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7010
corollary orthogonal_to_subspace_exists:
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7011
  fixes S :: "'a :: euclidean_space set"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7012
  assumes "dim S < DIM('a)"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7013
  obtains x where "x \<noteq> 0" "\<And>y. y \<in> span S \<Longrightarrow> orthogonal x y"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7014
proof -
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7015
have "span S \<subset> UNIV"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7016
  by (metis (mono_tags) UNIV_I assms inner_eq_zero_iff less_le lowdim_subset_hyperplane
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7017
      mem_Collect_eq top.extremum_strict top.not_eq_extremum)
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7018
  with orthogonal_to_subspace_exists_gen [of S UNIV] that show ?thesis
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7019
    by (auto simp: span_UNIV)
66641
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7020
qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7021
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7022
corollary orthogonal_to_vector_exists:
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7023
  fixes x :: "'a :: euclidean_space"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7024
  assumes "2 \<le> DIM('a)"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7025
  obtains y where "y \<noteq> 0" "orthogonal x y"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7026
proof -
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7027
  have "dim {x} < DIM('a)"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7028
    using assms by auto
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7029
  then show thesis
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7030
    by (rule orthogonal_to_subspace_exists) (simp add: orthogonal_commute span_clauses(1) that)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7031
qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7032
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  7033
proposition%important orthogonal_subspace_decomp_exists:
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7034
  fixes S :: "'a :: euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7035
  obtains y z where "y \<in> span S" "\<And>w. w \<in> span S \<Longrightarrow> orthogonal z w" "x = y + z"
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  7036
proof%unimportant -
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7037
  obtain T where "0 \<notin> T" "T \<subseteq> span S" "pairwise orthogonal T" "independent T"
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7038
    "card T = dim (span S)" "span T = span S"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7039
    using orthogonal_basis_subspace subspace_span by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7040
  let ?a = "\<Sum>b\<in>T. (b \<bullet> x / (b \<bullet> b)) *\<^sub>R b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7041
  have orth: "orthogonal (x - ?a) w" if "w \<in> span S" for w
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7042
    by (simp add: Gram_Schmidt_step \<open>pairwise orthogonal T\<close> \<open>span T = span S\<close>
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7043
        orthogonal_commute that)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7044
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7045
    apply (rule_tac y = "?a" and z = "x - ?a" in that)
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7046
      apply (meson \<open>T \<subseteq> span S\<close> span_scale span_sum subsetCE)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7047
     apply (fact orth, simp)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7048
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7049
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7050
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7051
lemma orthogonal_subspace_decomp_unique:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7052
  fixes S :: "'a :: euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7053
  assumes "x + y = x' + y'"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7054
      and ST: "x \<in> span S" "x' \<in> span S" "y \<in> span T" "y' \<in> span T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7055
      and orth: "\<And>a b. \<lbrakk>a \<in> S; b \<in> T\<rbrakk> \<Longrightarrow> orthogonal a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7056
  shows "x = x' \<and> y = y'"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7057
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7058
  have "x + y - y' = x'"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7059
    by (simp add: assms)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7060
  moreover have "\<And>a b. \<lbrakk>a \<in> span S; b \<in> span T\<rbrakk> \<Longrightarrow> orthogonal a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7061
    by (meson orth orthogonal_commute orthogonal_to_span)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7062
  ultimately have "0 = x' - x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7063
    by (metis (full_types) add_diff_cancel_left' ST diff_right_commute orthogonal_clauses(10) orthogonal_clauses(5) orthogonal_self)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7064
  with assms show ?thesis by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7065
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7066
67683
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7067
lemma vector_in_orthogonal_spanningset:
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7068
  fixes a :: "'a::euclidean_space"
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7069
  obtains S where "a \<in> S" "pairwise orthogonal S" "span S = UNIV"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7070
  by (metis UNIV_I Un_iff empty_iff insert_subset orthogonal_extension pairwise_def
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7071
      pairwise_orthogonal_insert span_UNIV subsetI subset_antisym)
67683
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7072
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7073
lemma vector_in_orthogonal_basis:
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7074
  fixes a :: "'a::euclidean_space"
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7075
  assumes "a \<noteq> 0"
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7076
  obtains S where "a \<in> S" "0 \<notin> S" "pairwise orthogonal S" "independent S" "finite S"
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7077
                  "span S = UNIV" "card S = DIM('a)"
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7078
proof -
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7079
  obtain S where S: "a \<in> S" "pairwise orthogonal S" "span S = UNIV"
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7080
    using vector_in_orthogonal_spanningset .
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7081
  show thesis
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7082
  proof
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7083
    show "pairwise orthogonal (S - {0})"
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7084
      using pairwise_mono S(2) by blast
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7085
    show "independent (S - {0})"
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7086
      by (simp add: \<open>pairwise orthogonal (S - {0})\<close> pairwise_orthogonal_independent)
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7087
    show "finite (S - {0})"
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7088
      using \<open>independent (S - {0})\<close> independent_finite by blast
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7089
    show "card (S - {0}) = DIM('a)"
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7090
      using span_delete_0 [of S] S
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7091
      by (simp add: \<open>independent (S - {0})\<close> indep_card_eq_dim_span dim_UNIV)
67683
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7092
  qed (use S \<open>a \<noteq> 0\<close> in auto)
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7093
qed
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7094
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7095
lemma vector_in_orthonormal_basis:
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7096
  fixes a :: "'a::euclidean_space"
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7097
  assumes "norm a = 1"
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7098
  obtains S where "a \<in> S" "pairwise orthogonal S" "\<And>x. x \<in> S \<Longrightarrow> norm x = 1"
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7099
    "independent S" "card S = DIM('a)" "span S = UNIV"
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7100
proof -
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7101
  have "a \<noteq> 0"
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7102
    using assms by auto
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7103
  then obtain S where "a \<in> S" "0 \<notin> S" "finite S"
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7104
          and S: "pairwise orthogonal S" "independent S" "span S = UNIV" "card S = DIM('a)"
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7105
    by (metis vector_in_orthogonal_basis)
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7106
  let ?S = "(\<lambda>x. x /\<^sub>R norm x) ` S"
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7107
  show thesis
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7108
  proof
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7109
    show "a \<in> ?S"
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7110
      using \<open>a \<in> S\<close> assms image_iff by fastforce
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7111
  next
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7112
    show "pairwise orthogonal ?S"
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7113
      using \<open>pairwise orthogonal S\<close> by (auto simp: pairwise_def orthogonal_def)
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7114
    show "\<And>x. x \<in> (\<lambda>x. x /\<^sub>R norm x) ` S \<Longrightarrow> norm x = 1"
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7115
      using \<open>0 \<notin> S\<close> by (auto simp: divide_simps)
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7116
    then show "independent ?S"
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7117
      by (metis \<open>pairwise orthogonal ((\<lambda>x. x /\<^sub>R norm x) ` S)\<close> norm_zero pairwise_orthogonal_independent zero_neq_one)
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7118
    have "inj_on (\<lambda>x. x /\<^sub>R norm x) S"
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7119
      unfolding inj_on_def
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7120
      by (metis (full_types) S(1) \<open>0 \<notin> S\<close> inverse_nonzero_iff_nonzero norm_eq_zero orthogonal_scaleR orthogonal_self pairwise_def)
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7121
    then show "card ?S = DIM('a)"
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7122
      by (simp add: card_image S)
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7123
    show "span ?S = UNIV"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7124
      by (metis (no_types) \<open>0 \<notin> S\<close> \<open>finite S\<close> \<open>span S = UNIV\<close>
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7125
          field_class.field_inverse_zero inverse_inverse_eq less_irrefl span_image_scale
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7126
          zero_less_norm_iff)
67683
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7127
  qed
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7128
qed
817944aeac3f Lots of new material about matrices, etc.
paulson <lp15@cam.ac.uk>
parents: 67613
diff changeset
  7129
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  7130
proposition%important dim_orthogonal_sum:
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7131
  fixes A :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7132
  assumes "\<And>x y. \<lbrakk>x \<in> A; y \<in> B\<rbrakk> \<Longrightarrow> x \<bullet> y = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7133
    shows "dim(A \<union> B) = dim A + dim B"
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  7134
proof%unimportant -
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7135
  have 1: "\<And>x y. \<lbrakk>x \<in> span A; y \<in> B\<rbrakk> \<Longrightarrow> x \<bullet> y = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7136
    by (erule span_induct [OF _ subspace_hyperplane2]; simp add: assms)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7137
  have "\<And>x y. \<lbrakk>x \<in> span A; y \<in> span B\<rbrakk> \<Longrightarrow> x \<bullet> y = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7138
    apply (erule span_induct [OF _ subspace_hyperplane])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7139
    using 1 by (simp add: )
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7140
  then have 0: "\<And>x y. \<lbrakk>x \<in> span A; y \<in> span B\<rbrakk> \<Longrightarrow> x \<bullet> y = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7141
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7142
  have "dim(A \<union> B) = dim (span (A \<union> B))"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7143
    by (simp add: dim_span)
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7144
  also have "span (A \<union> B) = ((\<lambda>(a, b). a + b) ` (span A \<times> span B))"
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7145
    by (auto simp add: span_Un image_def)
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7146
  also have "dim \<dots> = dim {x + y |x y. x \<in> span A \<and> y \<in> span B}"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7147
    by (auto intro!: arg_cong [where f=dim])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7148
  also have "... = dim {x + y |x y. x \<in> span A \<and> y \<in> span B} + dim(span A \<inter> span B)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7149
    by (auto simp: dest: 0)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7150
  also have "... = dim (span A) + dim (span B)"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7151
    by (rule dim_sums_Int) (auto simp: subspace_span)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7152
  also have "... = dim A + dim B"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7153
    by (simp add: dim_span)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7154
  finally show ?thesis .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7155
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7156
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7157
lemma dim_subspace_orthogonal_to_vectors:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7158
  fixes A :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7159
  assumes "subspace A" "subspace B" "A \<subseteq> B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7160
    shows "dim {y \<in> B. \<forall>x \<in> A. orthogonal x y} + dim A = dim B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7161
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7162
  have "dim (span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)) = dim (span B)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7163
  proof (rule arg_cong [where f=dim, OF subset_antisym])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7164
    show "span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A) \<subseteq> span B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7165
      by (simp add: \<open>A \<subseteq> B\<close> Collect_restrict span_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7166
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7167
    have *: "x \<in> span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7168
         if "x \<in> B" for x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7169
    proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7170
      obtain y z where "x = y + z" "y \<in> span A" and orth: "\<And>w. w \<in> span A \<Longrightarrow> orthogonal z w"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7171
        using orthogonal_subspace_decomp_exists [of A x] that by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7172
      have "y \<in> span B"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7173
        using \<open>y \<in> span A\<close> assms(3) span_mono by blast
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7174
      then have "z \<in> {a \<in> B. \<forall>x. x \<in> A \<longrightarrow> orthogonal x a}"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7175
        apply simp
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7176
        using \<open>x = y + z\<close> assms(1) assms(2) orth orthogonal_commute span_add_eq
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7177
          span_eq_iff that by blast
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7178
      then have z: "z \<in> span {y \<in> B. \<forall>x\<in>A. orthogonal x y}"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7179
        by (meson span_superset subset_iff)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7180
      then show ?thesis
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7181
        apply (auto simp: span_Un image_def  \<open>x = y + z\<close> \<open>y \<in> span A\<close>)
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7182
        using \<open>y \<in> span A\<close> add.commute by blast
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7183
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7184
    show "span B \<subseteq> span ({y \<in> B. \<forall>x\<in>A. orthogonal x y} \<union> A)"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7185
      by (rule span_minimal)
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7186
        (auto intro: * span_minimal simp: subspace_span)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7187
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7188
  then show ?thesis
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7189
    by (metis (no_types, lifting) dim_orthogonal_sum dim_span mem_Collect_eq
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7190
        orthogonal_commute orthogonal_def)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7191
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7192
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7193
lemma aff_dim_openin:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7194
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7195
  assumes ope: "openin (subtopology euclidean T) S" and "affine T" "S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7196
  shows "aff_dim S = aff_dim T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7197
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7198
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7199
  proof (rule order_antisym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7200
    show "aff_dim S \<le> aff_dim T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7201
      by (blast intro: aff_dim_subset [OF openin_imp_subset] ope)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7202
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7203
    obtain a where "a \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7204
      using \<open>S \<noteq> {}\<close> by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7205
    have "S \<subseteq> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7206
      using ope openin_imp_subset by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7207
    then have "a \<in> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7208
      using \<open>a \<in> S\<close> by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7209
    then have subT': "subspace ((\<lambda>x. - a + x) ` T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7210
      using affine_diffs_subspace \<open>affine T\<close> by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7211
    then obtain B where Bsub: "B \<subseteq> ((\<lambda>x. - a + x) ` T)" and po: "pairwise orthogonal B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7212
                    and eq1: "\<And>x. x \<in> B \<Longrightarrow> norm x = 1" and "independent B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7213
                    and cardB: "card B = dim ((\<lambda>x. - a + x) ` T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7214
                    and spanB: "span B = ((\<lambda>x. - a + x) ` T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7215
      by (rule orthonormal_basis_subspace) auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7216
    obtain e where "0 < e" and e: "cball a e \<inter> T \<subseteq> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7217
      by (meson \<open>a \<in> S\<close> openin_contains_cball ope)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7218
    have "aff_dim T = aff_dim ((\<lambda>x. - a + x) ` T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7219
      by (metis aff_dim_translation_eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7220
    also have "... = dim ((\<lambda>x. - a + x) ` T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7221
      using aff_dim_subspace subT' by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7222
    also have "... = card B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7223
      by (simp add: cardB)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7224
    also have "... = card ((\<lambda>x. e *\<^sub>R x) ` B)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7225
      using \<open>0 < e\<close>  by (force simp: inj_on_def card_image)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7226
    also have "... \<le> dim ((\<lambda>x. - a + x) ` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7227
    proof (simp, rule independent_card_le_dim)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7228
      have e': "cball 0 e \<inter> (\<lambda>x. x - a) ` T \<subseteq> (\<lambda>x. x - a) ` S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7229
        using e by (auto simp: dist_norm norm_minus_commute subset_eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7230
      have "(\<lambda>x. e *\<^sub>R x) ` B \<subseteq> cball 0 e \<inter> (\<lambda>x. x - a) ` T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7231
        using Bsub \<open>0 < e\<close> eq1 subT' \<open>a \<in> T\<close> by (auto simp: subspace_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7232
      then show "(\<lambda>x. e *\<^sub>R x) ` B \<subseteq> (\<lambda>x. x - a) ` S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7233
        using e' by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7234
      show "independent ((\<lambda>x. e *\<^sub>R x) ` B)"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7235
        using linear_scale_self \<open>independent B\<close>
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7236
        apply (rule linear_independent_injective_image)
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7237
        using \<open>0 < e\<close> inj_on_def by fastforce
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7238
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7239
    also have "... = aff_dim S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7240
      using \<open>a \<in> S\<close> aff_dim_eq_dim hull_inc by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7241
    finally show "aff_dim T \<le> aff_dim S" .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7242
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7243
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7244
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7245
lemma dim_openin:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7246
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7247
  assumes ope: "openin (subtopology euclidean T) S" and "subspace T" "S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7248
  shows "dim S = dim T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7249
proof (rule order_antisym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7250
  show "dim S \<le> dim T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7251
    by (metis ope dim_subset openin_subset topspace_euclidean_subtopology)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7252
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7253
  have "dim T = aff_dim S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7254
    using aff_dim_openin
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7255
    by (metis aff_dim_subspace \<open>subspace T\<close> \<open>S \<noteq> {}\<close> ope subspace_affine)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7256
  also have "... \<le> dim S"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7257
    by (metis aff_dim_subset aff_dim_subspace dim_span span_superset
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7258
        subspace_span)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7259
  finally show "dim T \<le> dim S" by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7260
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7261
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67962
diff changeset
  7262
subsection\<open>Lower-dimensional affine subsets are nowhere dense\<close>
66641
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7263
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  7264
proposition%important dense_complement_subspace:
66641
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7265
  fixes S :: "'a :: euclidean_space set"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7266
  assumes dim_less: "dim T < dim S" and "subspace S" shows "closure(S - T) = S"
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  7267
proof%unimportant -
66641
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7268
  have "closure(S - U) = S" if "dim U < dim S" "U \<subseteq> S" for U
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7269
  proof -
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7270
    have "span U \<subset> span S"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7271
      by (metis neq_iff psubsetI span_eq_dim span_mono that)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7272
    then obtain a where "a \<noteq> 0" "a \<in> span S" and a: "\<And>y. y \<in> span U \<Longrightarrow> orthogonal a y"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7273
      using orthogonal_to_subspace_exists_gen by metis
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7274
    show ?thesis
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7275
    proof
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7276
      have "closed S"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7277
        by (simp add: \<open>subspace S\<close> closed_subspace)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7278
      then show "closure (S - U) \<subseteq> S"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7279
        by (simp add: Diff_subset closure_minimal)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7280
      show "S \<subseteq> closure (S - U)"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7281
      proof (clarsimp simp: closure_approachable)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7282
        fix x and e::real
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7283
        assume "x \<in> S" "0 < e"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7284
        show "\<exists>y\<in>S - U. dist y x < e"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7285
        proof (cases "x \<in> U")
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7286
          case True
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7287
          let ?y = "x + (e/2 / norm a) *\<^sub>R a"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7288
          show ?thesis
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7289
          proof
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7290
            show "dist ?y x < e"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7291
              using \<open>0 < e\<close> by (simp add: dist_norm)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7292
          next
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7293
            have "?y \<in> S"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7294
              by (metis \<open>a \<in> span S\<close> \<open>x \<in> S\<close> assms(2) span_eq_iff subspace_add subspace_scale)
66641
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7295
            moreover have "?y \<notin> U"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7296
            proof -
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7297
              have "e/2 / norm a \<noteq> 0"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7298
                using \<open>0 < e\<close> \<open>a \<noteq> 0\<close> by auto
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7299
              then show ?thesis
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7300
                by (metis True \<open>a \<noteq> 0\<close> a orthogonal_scaleR orthogonal_self scale_eq_0_iff span_add_eq span_clauses(1))
66641
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7301
            qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7302
            ultimately show "?y \<in> S - U" by blast
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7303
          qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7304
        next
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7305
          case False
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7306
          with \<open>0 < e\<close> \<open>x \<in> S\<close> show ?thesis by force
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7307
        qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7308
      qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7309
    qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7310
  qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7311
  moreover have "S - S \<inter> T = S-T"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7312
    by blast
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7313
  moreover have "dim (S \<inter> T) < dim S"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7314
    by (metis dim_less dim_subset inf.cobounded2 inf.orderE inf.strict_boundedE not_le)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7315
  ultimately show ?thesis
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7316
    by force
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7317
qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7318
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7319
corollary dense_complement_affine:
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7320
  fixes S :: "'a :: euclidean_space set"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7321
  assumes less: "aff_dim T < aff_dim S" and "affine S" shows "closure(S - T) = S"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7322
proof (cases "S \<inter> T = {}")
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7323
  case True
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7324
  then show ?thesis
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7325
    by (metis Diff_triv affine_hull_eq \<open>affine S\<close> closure_same_affine_hull closure_subset hull_subset subset_antisym)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7326
next
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7327
  case False
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7328
  then obtain z where z: "z \<in> S \<inter> T" by blast
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  7329
  then have "subspace ((+) (- z) ` S)"
66641
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7330
    by (meson IntD1 affine_diffs_subspace \<open>affine S\<close>)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  7331
  moreover have "int (dim ((+) (- z) ` T)) < int (dim ((+) (- z) ` S))"
66641
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7332
    using z less by (simp add: aff_dim_eq_dim [symmetric] hull_inc)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  7333
  ultimately have "closure(((+) (- z) ` S) - ((+) (- z) ` T)) = ((+) (- z) ` S)"
66641
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7334
    by (simp add: dense_complement_subspace)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7335
  then show ?thesis
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7336
    by (metis closure_translation translation_diff translation_invert)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7337
qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7338
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7339
corollary dense_complement_openin_affine_hull:
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7340
  fixes S :: "'a :: euclidean_space set"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7341
  assumes less: "aff_dim T < aff_dim S"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7342
      and ope: "openin (subtopology euclidean (affine hull S)) S"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7343
    shows "closure(S - T) = closure S"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7344
proof -
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7345
  have "affine hull S - T \<subseteq> affine hull S"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7346
    by blast
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7347
  then have "closure (S \<inter> closure (affine hull S - T)) = closure (S \<inter> (affine hull S - T))"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7348
    by (rule closure_openin_Int_closure [OF ope])
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7349
  then show ?thesis
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7350
    by (metis Int_Diff aff_dim_affine_hull affine_affine_hull dense_complement_affine hull_subset inf.orderE less)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7351
qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7352
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7353
corollary dense_complement_convex:
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7354
  fixes S :: "'a :: euclidean_space set"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7355
  assumes "aff_dim T < aff_dim S" "convex S"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7356
    shows "closure(S - T) = closure S"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7357
proof
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7358
  show "closure (S - T) \<subseteq> closure S"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7359
    by (simp add: Diff_subset closure_mono)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7360
  have "closure (rel_interior S - T) = closure (rel_interior S)"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7361
    apply (rule dense_complement_openin_affine_hull)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7362
    apply (simp add: assms rel_interior_aff_dim)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7363
    using \<open>convex S\<close> rel_interior_rel_open rel_open by blast
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7364
  then show "closure S \<subseteq> closure (S - T)"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7365
    by (metis Diff_mono \<open>convex S\<close> closure_mono convex_closure_rel_interior order_refl rel_interior_subset)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7366
qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7367
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7368
corollary dense_complement_convex_closed:
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7369
  fixes S :: "'a :: euclidean_space set"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7370
  assumes "aff_dim T < aff_dim S" "convex S" "closed S"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7371
    shows "closure(S - T) = S"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7372
  by (simp add: assms dense_complement_convex)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7373
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7374
67968
a5ad4c015d1c removed dots at the end of (sub)titles
nipkow
parents: 67962
diff changeset
  7375
subsection%unimportant\<open>Parallel slices, etc\<close>
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7376
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7377
text\<open> If we take a slice out of a set, we can do it perpendicularly,
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7378
  with the normal vector to the slice parallel to the affine hull.\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7379
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7380
proposition affine_parallel_slice:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7381
  fixes S :: "'a :: euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7382
  assumes "affine S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7383
      and "S \<inter> {x. a \<bullet> x \<le> b} \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7384
      and "~ (S \<subseteq> {x. a \<bullet> x \<le> b})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7385
  obtains a' b' where "a' \<noteq> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7386
                   "S \<inter> {x. a' \<bullet> x \<le> b'} = S \<inter> {x. a \<bullet> x \<le> b}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7387
                   "S \<inter> {x. a' \<bullet> x = b'} = S \<inter> {x. a \<bullet> x = b}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7388
                   "\<And>w. w \<in> S \<Longrightarrow> (w + a') \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7389
proof (cases "S \<inter> {x. a \<bullet> x = b} = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7390
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7391
  then obtain u v where "u \<in> S" "v \<in> S" "a \<bullet> u \<le> b" "a \<bullet> v > b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7392
    using assms by (auto simp: not_le)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7393
  define \<eta> where "\<eta> = u + ((b - a \<bullet> u) / (a \<bullet> v - a \<bullet> u)) *\<^sub>R (v - u)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7394
  have "\<eta> \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7395
    by (simp add: \<eta>_def \<open>u \<in> S\<close> \<open>v \<in> S\<close> \<open>affine S\<close> mem_affine_3_minus)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7396
  moreover have "a \<bullet> \<eta> = b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7397
    using \<open>a \<bullet> u \<le> b\<close> \<open>b < a \<bullet> v\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7398
    by (simp add: \<eta>_def algebra_simps) (simp add: field_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7399
  ultimately have False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7400
    using True by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7401
  then show ?thesis ..
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7402
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7403
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7404
  then obtain z where "z \<in> S" and z: "a \<bullet> z = b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7405
    using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7406
  with affine_diffs_subspace [OF \<open>affine S\<close>]
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  7407
  have sub: "subspace ((+) (- z) ` S)" by blast
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  7408
  then have aff: "affine ((+) (- z) ` S)" and span: "span ((+) (- z) ` S) = ((+) (- z) ` S)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7409
    by (auto simp: subspace_imp_affine)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  7410
  obtain a' a'' where a': "a' \<in> span ((+) (- z) ` S)" and a: "a = a' + a''"
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  7411
                  and "\<And>w. w \<in> span ((+) (- z) ` S) \<Longrightarrow> orthogonal a'' w"
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  7412
      using orthogonal_subspace_decomp_exists [of "(+) (- z) ` S" "a"] by metis
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7413
  then have "\<And>w. w \<in> S \<Longrightarrow> a'' \<bullet> (w-z) = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7414
    by (simp add: imageI orthogonal_def span)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7415
  then have a'': "\<And>w. w \<in> S \<Longrightarrow> a'' \<bullet> w = (a - a') \<bullet> z"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7416
    by (simp add: a inner_diff_right)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7417
  then have ba'': "\<And>w. w \<in> S \<Longrightarrow> a'' \<bullet> w = b - a' \<bullet> z"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7418
    by (simp add: inner_diff_left z)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  7419
  have "\<And>w. w \<in> (+) (- z) ` S \<Longrightarrow> (w + a') \<in> (+) (- z) ` S"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7420
    by (metis subspace_add a' span_eq_iff sub)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7421
  then have Sclo: "\<And>w. w \<in> S \<Longrightarrow> (w + a') \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7422
    by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7423
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7424
  proof (cases "a' = 0")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7425
    case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7426
    with a assms True a'' diff_zero less_irrefl show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7427
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7428
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7429
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7430
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7431
      apply (rule_tac a' = "a'" and b' = "a' \<bullet> z" in that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7432
      apply (auto simp: a ba'' inner_left_distrib False Sclo)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7433
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7434
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7435
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7436
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7437
lemma diffs_affine_hull_span:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7438
  assumes "a \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7439
    shows "{x - a |x. x \<in> affine hull S} = span {x - a |x. x \<in> S}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7440
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7441
  have *: "((\<lambda>x. x - a) ` (S - {a})) = {x. x + a \<in> S} - {0}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7442
    by (auto simp: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7443
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7444
    apply (simp add: affine_hull_span2 [OF assms] *)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7445
    apply (auto simp: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7446
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7447
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7448
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7449
lemma aff_dim_dim_affine_diffs:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7450
  fixes S :: "'a :: euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7451
  assumes "affine S" "a \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7452
    shows "aff_dim S = dim {x - a |x. x \<in> S}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7453
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7454
  obtain B where aff: "affine hull B = affine hull S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7455
             and ind: "\<not> affine_dependent B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7456
             and card: "of_nat (card B) = aff_dim S + 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7457
    using aff_dim_basis_exists by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7458
  then have "B \<noteq> {}" using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7459
    by (metis affine_hull_eq_empty ex_in_conv)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7460
  then obtain c where "c \<in> B" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7461
  then have "c \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7462
    by (metis aff affine_hull_eq \<open>affine S\<close> hull_inc)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7463
  have xy: "x - c = y - a \<longleftrightarrow> y = x + 1 *\<^sub>R (a - c)" for x y c and a::'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7464
    by (auto simp: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7465
  have *: "{x - c |x. x \<in> S} = {x - a |x. x \<in> S}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7466
    apply safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7467
    apply (simp_all only: xy)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7468
    using mem_affine_3_minus [OF \<open>affine S\<close>] \<open>a \<in> S\<close> \<open>c \<in> S\<close> apply blast+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7469
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7470
  have affS: "affine hull S = S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7471
    by (simp add: \<open>affine S\<close>)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7472
  have "aff_dim S = of_nat (card B) - 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7473
    using card by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7474
  also have "... = dim {x - c |x. x \<in> B}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7475
    by (simp add: affine_independent_card_dim_diffs [OF ind \<open>c \<in> B\<close>])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7476
  also have "... = dim {x - c | x. x \<in> affine hull B}"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7477
     by (simp add: diffs_affine_hull_span \<open>c \<in> B\<close> dim_span)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7478
  also have "... = dim {x - a |x. x \<in> S}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7479
     by (simp add: affS aff *)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7480
   finally show ?thesis .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7481
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7482
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7483
lemma aff_dim_linear_image_le:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7484
  assumes "linear f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7485
    shows "aff_dim(f ` S) \<le> aff_dim S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7486
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7487
  have "aff_dim (f ` T) \<le> aff_dim T" if "affine T" for T
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7488
  proof (cases "T = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7489
    case True then show ?thesis by (simp add: aff_dim_geq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7490
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7491
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7492
    then obtain a where "a \<in> T" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7493
    have 1: "((\<lambda>x. x - f a) ` f ` T) = {x - f a |x. x \<in> f ` T}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7494
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7495
    have 2: "{x - f a| x. x \<in> f ` T} = f ` {x - a| x. x \<in> T}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7496
      by (force simp: linear_diff [OF assms])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7497
    have "aff_dim (f ` T) = int (dim {x - f a |x. x \<in> f ` T})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7498
      by (simp add: \<open>a \<in> T\<close> hull_inc aff_dim_eq_dim [of "f a"] 1)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7499
    also have "... = int (dim (f ` {x - a| x. x \<in> T}))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7500
      by (force simp: linear_diff [OF assms] 2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7501
    also have "... \<le> int (dim {x - a| x. x \<in> T})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7502
      by (simp add: dim_image_le [OF assms])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7503
    also have "... \<le> aff_dim T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7504
      by (simp add: aff_dim_dim_affine_diffs [symmetric] \<open>a \<in> T\<close> \<open>affine T\<close>)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7505
    finally show ?thesis .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7506
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7507
  then
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7508
  have "aff_dim (f ` (affine hull S)) \<le> aff_dim (affine hull S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7509
    using affine_affine_hull [of S] by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7510
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7511
    using affine_hull_linear_image assms linear_conv_bounded_linear by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7512
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7513
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7514
lemma aff_dim_injective_linear_image [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7515
  assumes "linear f" "inj f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7516
    shows "aff_dim (f ` S) = aff_dim S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7517
proof (rule antisym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7518
  show "aff_dim (f ` S) \<le> aff_dim S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7519
    by (simp add: aff_dim_linear_image_le assms(1))
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7520
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7521
  obtain g where "linear g" "g \<circ> f = id"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7522
    using assms(1) assms(2) linear_injective_left_inverse by blast
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7523
  then have "aff_dim S \<le> aff_dim(g ` f ` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7524
    by (simp add: image_comp)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7525
  also have "... \<le> aff_dim (f ` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7526
    by (simp add: \<open>linear g\<close> aff_dim_linear_image_le)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7527
  finally show "aff_dim S \<le> aff_dim (f ` S)" .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7528
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7529
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7530
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7531
lemma choose_affine_subset:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7532
  assumes "affine S" "-1 \<le> d" and dle: "d \<le> aff_dim S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7533
  obtains T where "affine T" "T \<subseteq> S" "aff_dim T = d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7534
proof (cases "d = -1 \<or> S={}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7535
  case True with assms show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7536
    by (metis aff_dim_empty affine_empty bot.extremum that eq_iff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7537
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7538
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7539
  with assms obtain a where "a \<in> S" "0 \<le> d" by auto
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  7540
  with assms have ss: "subspace ((+) (- a) ` S)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7541
    by (simp add: affine_diffs_subspace)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  7542
  have "nat d \<le> dim ((+) (- a) ` S)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7543
    by (metis aff_dim_subspace aff_dim_translation_eq dle nat_int nat_mono ss)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  7544
  then obtain T where "subspace T" and Tsb: "T \<subseteq> span ((+) (- a) ` S)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7545
                  and Tdim: "dim T = nat d"
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  7546
    using choose_subspace_of_subspace [of "nat d" "(+) (- a) ` S"] by blast
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7547
  then have "affine T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7548
    using subspace_affine by blast
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  7549
  then have "affine ((+) a ` T)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7550
    by (metis affine_hull_eq affine_hull_translation)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  7551
  moreover have "(+) a ` T \<subseteq> S"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7552
  proof -
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  7553
    have "T \<subseteq> (+) (- a) ` S"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7554
      by (metis (no_types) span_eq_iff Tsb ss)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  7555
    then show "(+) a ` T \<subseteq> S"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7556
      using add_ac by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7557
  qed
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 66884
diff changeset
  7558
  moreover have "aff_dim ((+) a ` T) = d"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7559
    by (simp add: aff_dim_subspace Tdim \<open>0 \<le> d\<close> \<open>subspace T\<close> aff_dim_translation_eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7560
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7561
    by (rule that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7562
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7563
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7564
subsection\<open>Several Variants of Paracompactness\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7565
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  7566
proposition%important paracompact:
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7567
  fixes S :: "'a :: euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7568
  assumes "S \<subseteq> \<Union>\<C>" and opC: "\<And>T. T \<in> \<C> \<Longrightarrow> open T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7569
  obtains \<C>' where "S \<subseteq> \<Union> \<C>'"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7570
               and "\<And>U. U \<in> \<C>' \<Longrightarrow> open U \<and> (\<exists>T. T \<in> \<C> \<and> U \<subseteq> T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7571
               and "\<And>x. x \<in> S
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7572
                       \<Longrightarrow> \<exists>V. open V \<and> x \<in> V \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7573
                               finite {U. U \<in> \<C>' \<and> (U \<inter> V \<noteq> {})}"
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  7574
proof%unimportant (cases "S = {}")
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7575
  case True with that show ?thesis by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7576
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7577
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7578
  have "\<exists>T U. x \<in> U \<and> open U \<and> closure U \<subseteq> T \<and> T \<in> \<C>" if "x \<in> S" for x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7579
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7580
    obtain T where "x \<in> T" "T \<in> \<C>" "open T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7581
      using assms \<open>x \<in> S\<close> by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7582
    then obtain e where "e > 0" "cball x e \<subseteq> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7583
      by (force simp: open_contains_cball)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7584
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7585
      apply (rule_tac x = T in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7586
      apply (rule_tac x = "ball x e" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7587
      using  \<open>T \<in> \<C>\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7588
      apply (simp add: closure_minimal)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7589
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7590
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7591
  then obtain F G where Gin: "x \<in> G x" and oG: "open (G x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7592
                    and clos: "closure (G x) \<subseteq> F x" and Fin: "F x \<in> \<C>"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7593
         if "x \<in> S" for x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7594
    by metis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7595
  then obtain \<F> where "\<F> \<subseteq> G ` S" "countable \<F>" "\<Union>\<F> = UNION S G"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7596
    using Lindelof [of "G ` S"] by (metis image_iff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7597
  then obtain K where K: "K \<subseteq> S" "countable K" and eq: "UNION K G = UNION S G"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7598
    by (metis countable_subset_image)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7599
  with False Gin have "K \<noteq> {}" by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7600
  then obtain a :: "nat \<Rightarrow> 'a" where "range a = K"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7601
    by (metis range_from_nat_into \<open>countable K\<close>)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7602
  then have odif: "\<And>n. open (F (a n) - \<Union>{closure (G (a m)) |m. m < n})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7603
    using \<open>K \<subseteq> S\<close> Fin opC by (fastforce simp add:)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7604
  let ?C = "range (\<lambda>n. F(a n) - \<Union>{closure(G(a m)) |m. m < n})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7605
  have enum_S: "\<exists>n. x \<in> F(a n) \<and> x \<in> G(a n)" if "x \<in> S" for x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7606
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7607
    have "\<exists>y \<in> K. x \<in> G y" using eq that Gin by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7608
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7609
      using clos K \<open>range a = K\<close> closure_subset by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7610
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7611
  have 1: "S \<subseteq> Union ?C"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7612
  proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7613
    fix x assume "x \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7614
    define n where "n \<equiv> LEAST n. x \<in> F(a n)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7615
    have n: "x \<in> F(a n)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7616
      using enum_S [OF \<open>x \<in> S\<close>] by (force simp: n_def intro: LeastI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7617
    have notn: "x \<notin> F(a m)" if "m < n" for m
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7618
      using that not_less_Least by (force simp: n_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7619
    then have "x \<notin> \<Union>{closure (G (a m)) |m. m < n}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7620
      using n \<open>K \<subseteq> S\<close> \<open>range a = K\<close> clos notn by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7621
    with n show "x \<in> Union ?C"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7622
      by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7623
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7624
  have 3: "\<exists>V. open V \<and> x \<in> V \<and> finite {U. U \<in> ?C \<and> (U \<inter> V \<noteq> {})}" if "x \<in> S" for x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7625
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7626
    obtain n where n: "x \<in> F(a n)" "x \<in> G(a n)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7627
      using \<open>x \<in> S\<close> enum_S by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7628
    have "{U \<in> ?C. U \<inter> G (a n) \<noteq> {}} \<subseteq> (\<lambda>n. F(a n) - \<Union>{closure(G(a m)) |m. m < n}) ` atMost n"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7629
    proof clarsimp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7630
      fix k  assume "(F (a k) - \<Union>{closure (G (a m)) |m. m < k}) \<inter> G (a n) \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7631
      then have "k \<le> n"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7632
        by auto (metis closure_subset not_le subsetCE)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7633
      then show "F (a k) - \<Union>{closure (G (a m)) |m. m < k}
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7634
                 \<in> (\<lambda>n. F (a n) - \<Union>{closure (G (a m)) |m. m < n}) ` {..n}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7635
        by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7636
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7637
    moreover have "finite ((\<lambda>n. F(a n) - \<Union>{closure(G(a m)) |m. m < n}) ` atMost n)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7638
      by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7639
    ultimately have *: "finite {U \<in> ?C. U \<inter> G (a n) \<noteq> {}}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7640
      using finite_subset by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7641
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7642
      apply (rule_tac x="G (a n)" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7643
      apply (intro conjI oG n *)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7644
      using \<open>K \<subseteq> S\<close> \<open>range a = K\<close> apply blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7645
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7646
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7647
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7648
    apply (rule that [OF 1 _ 3])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7649
    using Fin \<open>K \<subseteq> S\<close> \<open>range a = K\<close>  apply (auto simp: odif)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7650
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7651
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7652
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7653
corollary paracompact_closedin:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7654
  fixes S :: "'a :: euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7655
  assumes cin: "closedin (subtopology euclidean U) S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7656
      and oin: "\<And>T. T \<in> \<C> \<Longrightarrow> openin (subtopology euclidean U) T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7657
      and "S \<subseteq> \<Union>\<C>"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7658
  obtains \<C>' where "S \<subseteq> \<Union> \<C>'"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7659
               and "\<And>V. V \<in> \<C>' \<Longrightarrow> openin (subtopology euclidean U) V \<and> (\<exists>T. T \<in> \<C> \<and> V \<subseteq> T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7660
               and "\<And>x. x \<in> U
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7661
                       \<Longrightarrow> \<exists>V. openin (subtopology euclidean U) V \<and> x \<in> V \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7662
                               finite {X. X \<in> \<C>' \<and> (X \<inter> V \<noteq> {})}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7663
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7664
  have "\<exists>Z. open Z \<and> (T = U \<inter> Z)" if "T \<in> \<C>" for T
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7665
    using oin [OF that] by (auto simp: openin_open)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7666
  then obtain F where opF: "open (F T)" and intF: "U \<inter> F T = T" if "T \<in> \<C>" for T
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7667
    by metis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7668
  obtain K where K: "closed K" "U \<inter> K = S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7669
    using cin by (auto simp: closedin_closed)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7670
  have 1: "U \<subseteq> \<Union>insert (- K) (F ` \<C>)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7671
    by clarsimp (metis Int_iff Union_iff \<open>U \<inter> K = S\<close> \<open>S \<subseteq> \<Union>\<C>\<close> subsetD intF)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7672
  have 2: "\<And>T. T \<in> insert (- K) (F ` \<C>) \<Longrightarrow> open T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7673
    using \<open>closed K\<close> by (auto simp: opF)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7674
  obtain \<D> where "U \<subseteq> \<Union>\<D>"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7675
             and D1: "\<And>U. U \<in> \<D> \<Longrightarrow> open U \<and> (\<exists>T. T \<in> insert (- K) (F ` \<C>) \<and> U \<subseteq> T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7676
             and D2: "\<And>x. x \<in> U \<Longrightarrow> \<exists>V. open V \<and> x \<in> V \<and> finite {U \<in> \<D>. U \<inter> V \<noteq> {}}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7677
    using paracompact [OF 1 2] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7678
  let ?C = "{U \<inter> V |V. V \<in> \<D> \<and> (V \<inter> K \<noteq> {})}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7679
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7680
  proof (rule_tac \<C>' = "{U \<inter> V |V. V \<in> \<D> \<and> (V \<inter> K \<noteq> {})}" in that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7681
    show "S \<subseteq> \<Union>?C"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7682
      using \<open>U \<inter> K = S\<close> \<open>U \<subseteq> \<Union>\<D>\<close> K by (blast dest!: subsetD)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7683
    show "\<And>V. V \<in> ?C \<Longrightarrow> openin (subtopology euclidean U) V \<and> (\<exists>T. T \<in> \<C> \<and> V \<subseteq> T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7684
      using D1 intF by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7685
    have *: "{X. (\<exists>V. X = U \<inter> V \<and> V \<in> \<D> \<and> V \<inter> K \<noteq> {}) \<and> X \<inter> (U \<inter> V) \<noteq> {}} \<subseteq>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7686
             (\<lambda>x. U \<inter> x) ` {U \<in> \<D>. U \<inter> V \<noteq> {}}" for V
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7687
      by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7688
    show "\<exists>V. openin (subtopology euclidean U) V \<and> x \<in> V \<and> finite {X \<in> ?C. X \<inter> V \<noteq> {}}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7689
         if "x \<in> U" for x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7690
      using D2 [OF that]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7691
      apply clarify
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7692
      apply (rule_tac x="U \<inter> V" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7693
      apply (auto intro: that finite_subset [OF *])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7694
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7695
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7696
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7697
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7698
corollary paracompact_closed:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7699
  fixes S :: "'a :: euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7700
  assumes "closed S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7701
      and opC: "\<And>T. T \<in> \<C> \<Longrightarrow> open T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7702
      and "S \<subseteq> \<Union>\<C>"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7703
  obtains \<C>' where "S \<subseteq> \<Union>\<C>'"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7704
               and "\<And>U. U \<in> \<C>' \<Longrightarrow> open U \<and> (\<exists>T. T \<in> \<C> \<and> U \<subseteq> T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7705
               and "\<And>x. \<exists>V. open V \<and> x \<in> V \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7706
                               finite {U. U \<in> \<C>' \<and> (U \<inter> V \<noteq> {})}"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  7707
using paracompact_closedin [of UNIV S \<C>] assms by auto
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7708
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7709
  
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  7710
subsection%unimportant\<open>Closed-graph characterization of continuity\<close>
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7711
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7712
lemma continuous_closed_graph_gen:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7713
  fixes T :: "'b::real_normed_vector set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7714
  assumes contf: "continuous_on S f" and fim: "f ` S \<subseteq> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7715
    shows "closedin (subtopology euclidean (S \<times> T)) ((\<lambda>x. Pair x (f x)) ` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7716
proof -
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  7717
  have eq: "((\<lambda>x. Pair x (f x)) ` S) =(S \<times> T \<inter> (\<lambda>z. (f \<circ> fst)z - snd z) -` {0})"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7718
    using fim by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7719
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7720
    apply (subst eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7721
    apply (intro continuous_intros continuous_closedin_preimage continuous_on_subset [OF contf])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7722
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7723
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7724
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7725
lemma continuous_closed_graph_eq:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7726
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7727
  assumes "compact T" and fim: "f ` S \<subseteq> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7728
  shows "continuous_on S f \<longleftrightarrow>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7729
         closedin (subtopology euclidean (S \<times> T)) ((\<lambda>x. Pair x (f x)) ` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7730
         (is "?lhs = ?rhs")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7731
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7732
  have "?lhs" if ?rhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7733
  proof (clarsimp simp add: continuous_on_closed_gen [OF fim])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7734
    fix U
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7735
    assume U: "closedin (subtopology euclidean T) U"
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  7736
    have eq: "(S \<inter> f -` U) = fst ` (((\<lambda>x. Pair x (f x)) ` S) \<inter> (S \<times> U))"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7737
      by (force simp: image_iff)
66884
c2128ab11f61 Switching to inverse image and constant_on, plus some new material
paulson <lp15@cam.ac.uk>
parents: 66793
diff changeset
  7738
    show "closedin (subtopology euclidean S) (S \<inter> f -` U)"
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7739
      by (simp add: U closedin_Int closedin_Times closed_map_fst [OF \<open>compact T\<close>] that eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7740
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7741
  with continuous_closed_graph_gen assms show ?thesis by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7742
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7743
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7744
lemma continuous_closed_graph:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7745
  fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7746
  assumes "closed S" and contf: "continuous_on S f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7747
  shows "closed ((\<lambda>x. Pair x (f x)) ` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7748
  apply (rule closedin_closed_trans)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7749
   apply (rule continuous_closed_graph_gen [OF contf subset_UNIV])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7750
  by (simp add: \<open>closed S\<close> closed_Times)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7751
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7752
lemma continuous_from_closed_graph:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7753
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7754
  assumes "compact T" and fim: "f ` S \<subseteq> T" and clo: "closed ((\<lambda>x. Pair x (f x)) ` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7755
  shows "continuous_on S f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7756
    using fim clo
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7757
    by (auto intro: closed_subset simp: continuous_closed_graph_eq [OF \<open>compact T\<close> fim])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7758
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7759
lemma continuous_on_Un_local_open:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7760
  assumes opS: "openin (subtopology euclidean (S \<union> T)) S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7761
      and opT: "openin (subtopology euclidean (S \<union> T)) T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7762
      and contf: "continuous_on S f" and contg: "continuous_on T f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7763
    shows "continuous_on (S \<union> T) f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7764
using pasting_lemma [of "{S,T}" "S \<union> T" "\<lambda>i. i" "\<lambda>i. f" f] contf contg opS opT by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7765
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7766
lemma continuous_on_cases_local_open:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7767
  assumes opS: "openin (subtopology euclidean (S \<union> T)) S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7768
      and opT: "openin (subtopology euclidean (S \<union> T)) T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7769
      and contf: "continuous_on S f" and contg: "continuous_on T g"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7770
      and fg: "\<And>x. x \<in> S \<and> ~P x \<or> x \<in> T \<and> P x \<Longrightarrow> f x = g x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7771
    shows "continuous_on (S \<union> T) (\<lambda>x. if P x then f x else g x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7772
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7773
  have "\<And>x. x \<in> S \<Longrightarrow> (if P x then f x else g x) = f x"  "\<And>x. x \<in> T \<Longrightarrow> (if P x then f x else g x) = g x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7774
    by (simp_all add: fg)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7775
  then have "continuous_on S (\<lambda>x. if P x then f x else g x)" "continuous_on T (\<lambda>x. if P x then f x else g x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7776
    by (simp_all add: contf contg cong: continuous_on_cong)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7777
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7778
    by (rule continuous_on_Un_local_open [OF opS opT])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7779
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7780
  
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  7781
subsection%unimportant\<open>The union of two collinear segments is another segment\<close>
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7782
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7783
proposition in_convex_hull_exchange:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7784
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7785
  assumes a: "a \<in> convex hull S" and xS: "x \<in> convex hull S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7786
  obtains b where "b \<in> S" "x \<in> convex hull (insert a (S - {b}))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7787
proof (cases "a \<in> S")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7788
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7789
  with xS insert_Diff that  show ?thesis by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7790
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7791
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7792
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7793
  proof (cases "finite S \<and> card S \<le> Suc (DIM('a))")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7794
    case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7795
    then obtain u where u0: "\<And>i. i \<in> S \<Longrightarrow> 0 \<le> u i" and u1: "sum u S = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7796
                    and ua: "(\<Sum>i\<in>S. u i *\<^sub>R i) = a"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7797
        using a by (auto simp: convex_hull_finite)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7798
    obtain v where v0: "\<And>i. i \<in> S \<Longrightarrow> 0 \<le> v i" and v1: "sum v S = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7799
               and vx: "(\<Sum>i\<in>S. v i *\<^sub>R i) = x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7800
      using True xS by (auto simp: convex_hull_finite)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7801
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7802
    proof (cases "\<exists>b. b \<in> S \<and> v b = 0")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7803
      case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7804
      then obtain b where b: "b \<in> S" "v b = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7805
        by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7806
      show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7807
      proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7808
        have fin: "finite (insert a (S - {b}))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7809
          using sum.infinite v1 by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7810
        show "x \<in> convex hull insert a (S - {b})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7811
          unfolding convex_hull_finite [OF fin] mem_Collect_eq
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7812
        proof (intro conjI exI ballI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7813
          have "(\<Sum>x \<in> insert a (S - {b}). if x = a then 0 else v x) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7814
                (\<Sum>x \<in> S - {b}. if x = a then 0 else v x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7815
            apply (rule sum.mono_neutral_right)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7816
            using fin by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7817
          also have "... = (\<Sum>x \<in> S - {b}. v x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7818
            using b False by (auto intro!: sum.cong split: if_split_asm)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7819
          also have "... = (\<Sum>x\<in>S. v x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7820
            by (metis \<open>v b = 0\<close> diff_zero sum.infinite sum_diff1 u1 zero_neq_one)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7821
          finally show "(\<Sum>x\<in>insert a (S - {b}). if x = a then 0 else v x) = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7822
            by (simp add: v1)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7823
          show "\<And>x. x \<in> insert a (S - {b}) \<Longrightarrow> 0 \<le> (if x = a then 0 else v x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7824
            by (auto simp: v0)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7825
          have "(\<Sum>x \<in> insert a (S - {b}). (if x = a then 0 else v x) *\<^sub>R x) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7826
                (\<Sum>x \<in> S - {b}. (if x = a then 0 else v x) *\<^sub>R x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7827
            apply (rule sum.mono_neutral_right)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7828
            using fin by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7829
          also have "... = (\<Sum>x \<in> S - {b}. v x *\<^sub>R x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7830
            using b False by (auto intro!: sum.cong split: if_split_asm)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7831
          also have "... = (\<Sum>x\<in>S. v x *\<^sub>R x)"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7832
            by (metis (no_types, lifting) b(2) diff_zero fin finite.emptyI finite_Diff2 finite_insert scale_eq_0_iff sum_diff1)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7833
          finally show "(\<Sum>x\<in>insert a (S - {b}). (if x = a then 0 else v x) *\<^sub>R x) = x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7834
            by (simp add: vx)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7835
        qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7836
      qed (rule \<open>b \<in> S\<close>)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7837
    next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7838
      case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7839
      have le_Max: "u i / v i \<le> Max ((\<lambda>i. u i / v i) ` S)" if "i \<in> S" for i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7840
        by (simp add: True that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7841
      have "Max ((\<lambda>i. u i / v i) ` S) \<in> (\<lambda>i. u i / v i) ` S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7842
        using True v1 by (auto intro: Max_in)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7843
      then obtain b where "b \<in> S" and beq: "Max ((\<lambda>b. u b / v b) ` S) = u b / v b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7844
        by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7845
      then have "0 \<noteq> u b / v b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7846
        using le_Max beq divide_le_0_iff le_numeral_extra(2) sum_nonpos u1
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7847
        by (metis False eq_iff v0)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7848
      then have  "0 < u b" "0 < v b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7849
        using False \<open>b \<in> S\<close> u0 v0 by force+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7850
      have fin: "finite (insert a (S - {b}))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7851
        using sum.infinite v1 by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7852
      show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7853
      proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7854
        show "x \<in> convex hull insert a (S - {b})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7855
          unfolding convex_hull_finite [OF fin] mem_Collect_eq
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7856
        proof (intro conjI exI ballI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7857
          have "(\<Sum>x \<in> insert a (S - {b}). if x=a then v b / u b else v x - (v b / u b) * u x) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7858
                v b / u b + (\<Sum>x \<in> S - {b}. v x - (v b / u b) * u x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7859
            using \<open>a \<notin> S\<close> \<open>b \<in> S\<close> True  apply simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7860
            apply (rule sum.cong, auto)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7861
            done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7862
          also have "... = v b / u b + (\<Sum>x \<in> S - {b}. v x) - (v b / u b) * (\<Sum>x \<in> S - {b}. u x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7863
            by (simp add: Groups_Big.sum_subtractf sum_distrib_left)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7864
          also have "... = (\<Sum>x\<in>S. v x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7865
            using \<open>0 < u b\<close> True  by (simp add: Groups_Big.sum_diff1 u1 field_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7866
          finally show "sum (\<lambda>x. if x=a then v b / u b else v x - (v b / u b) * u x) (insert a (S - {b})) = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7867
            by (simp add: v1)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7868
          show "0 \<le> (if i = a then v b / u b else v i - v b / u b * u i)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7869
            if "i \<in> insert a (S - {b})" for i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7870
            using \<open>0 < u b\<close> \<open>0 < v b\<close> v0 [of i] le_Max [of i] beq that False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7871
            by (auto simp: field_simps split: if_split_asm)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7872
          have "(\<Sum>x\<in>insert a (S - {b}). (if x=a then v b / u b else v x - v b / u b * u x) *\<^sub>R x) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7873
                (v b / u b) *\<^sub>R a + (\<Sum>x\<in>S - {b}. (v x - v b / u b * u x) *\<^sub>R x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7874
            using \<open>a \<notin> S\<close> \<open>b \<in> S\<close> True  apply simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7875
            apply (rule sum.cong, auto)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7876
            done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7877
          also have "... = (v b / u b) *\<^sub>R a + (\<Sum>x \<in> S - {b}. v x *\<^sub>R x) - (v b / u b) *\<^sub>R (\<Sum>x \<in> S - {b}. u x *\<^sub>R x)"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  7878
            by (simp add: Groups_Big.sum_subtractf scaleR_left_diff_distrib sum_distrib_left scale_sum_right)
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7879
          also have "... = (\<Sum>x\<in>S. v x *\<^sub>R x)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7880
            using \<open>0 < u b\<close> True  by (simp add: ua vx Groups_Big.sum_diff1 algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7881
          finally
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7882
          show "(\<Sum>x\<in>insert a (S - {b}). (if x=a then v b / u b else v x - v b / u b * u x) *\<^sub>R x) = x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7883
            by (simp add: vx)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7884
        qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7885
      qed (rule \<open>b \<in> S\<close>)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7886
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7887
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7888
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7889
    obtain T where "finite T" "T \<subseteq> S" and caT: "card T \<le> Suc (DIM('a))" and xT: "x \<in> convex hull T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7890
      using xS by (auto simp: caratheodory [of S])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7891
    with False obtain b where b: "b \<in> S" "b \<notin> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7892
      by (metis antisym subsetI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7893
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7894
    proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7895
      show "x \<in> convex hull insert a (S - {b})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7896
        using  \<open>T \<subseteq> S\<close> b by (blast intro: subsetD [OF hull_mono xT])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7897
    qed (rule \<open>b \<in> S\<close>)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7898
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7899
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7900
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7901
lemma convex_hull_exchange_Union:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7902
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7903
  assumes "a \<in> convex hull S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7904
  shows "convex hull S = (\<Union>b \<in> S. convex hull (insert a (S - {b})))" (is "?lhs = ?rhs")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7905
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7906
  show "?lhs \<subseteq> ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7907
    by (blast intro: in_convex_hull_exchange [OF assms])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7908
  show "?rhs \<subseteq> ?lhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7909
  proof clarify
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7910
    fix x b
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7911
    assume"b \<in> S" "x \<in> convex hull insert a (S - {b})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7912
    then show "x \<in> convex hull S" if "b \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7913
      by (metis (no_types) that assms order_refl hull_mono hull_redundant insert_Diff_single insert_subset subsetCE)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7914
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7915
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7916
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7917
lemma Un_closed_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7918
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7919
  assumes "b \<in> closed_segment a c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7920
    shows "closed_segment a b \<union> closed_segment b c = closed_segment a c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7921
proof (cases "c = a")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7922
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7923
  with assms show ?thesis by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7924
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7925
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7926
  with assms have "convex hull {a, b} \<union> convex hull {b, c} = (\<Union>ba\<in>{a, c}. convex hull insert b ({a, c} - {ba}))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7927
    by (auto simp: insert_Diff_if insert_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7928
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7929
    using convex_hull_exchange_Union
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7930
    by (metis assms segment_convex_hull)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7931
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7932
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7933
lemma Un_open_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7934
  fixes a :: "'a::euclidean_space"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7935
  assumes "b \<in> open_segment a c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7936
  shows "open_segment a b \<union> {b} \<union> open_segment b c = open_segment a c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7937
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7938
  have b: "b \<in> closed_segment a c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7939
    by (simp add: assms open_closed_segment)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7940
  have *: "open_segment a c \<subseteq> insert b (open_segment a b \<union> open_segment b c)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7941
          if "{b,c,a} \<union> open_segment a b \<union> open_segment b c = {c,a} \<union> open_segment a c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7942
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7943
    have "insert a (insert c (insert b (open_segment a b \<union> open_segment b c))) = insert a (insert c (open_segment a c))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7944
      using that by (simp add: insert_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7945
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7946
      by (metis (no_types) Diff_cancel Diff_eq_empty_iff Diff_insert2 open_segment_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7947
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7948
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7949
    using Un_closed_segment [OF b]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7950
    apply (simp add: closed_segment_eq_open)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7951
      apply (rule equalityI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7952
    using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7953
     apply (simp add: b subset_open_segment)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7954
      using * by (simp add: insert_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7955
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7956
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7957
subsection\<open>Covering an open set by a countable chain of compact sets\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7958
  
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  7959
proposition%important open_Union_compact_subsets:
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7960
  fixes S :: "'a::euclidean_space set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7961
  assumes "open S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7962
  obtains C where "\<And>n. compact(C n)" "\<And>n. C n \<subseteq> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7963
                  "\<And>n. C n \<subseteq> interior(C(Suc n))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7964
                  "\<Union>(range C) = S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7965
                  "\<And>K. \<lbrakk>compact K; K \<subseteq> S\<rbrakk> \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. K \<subseteq> (C n)"
67962
0acdcd8f4ba1 a first shot at tagging for HOL-Analysis manual
immler
parents: 67686
diff changeset
  7966
proof%unimportant (cases "S = {}")
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7967
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7968
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7969
    by (rule_tac C = "\<lambda>n. {}" in that) auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7970
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7971
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7972
  then obtain a where "a \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7973
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7974
  let ?C = "\<lambda>n. cball a (real n) - (\<Union>x \<in> -S. \<Union>e \<in> ball 0 (1 / real(Suc n)). {x + e})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7975
  have "\<exists>N. \<forall>n\<ge>N. K \<subseteq> (f n)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7976
        if "\<And>n. compact(f n)" and sub_int: "\<And>n. f n \<subseteq> interior (f(Suc n))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7977
            and eq: "\<Union>(range f) = S" and "compact K" "K \<subseteq> S" for f K
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7978
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7979
    have *: "\<forall>n. f n \<subseteq> (\<Union>n. interior (f n))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7980
      by (meson Sup_upper2 UNIV_I \<open>\<And>n. f n \<subseteq> interior (f (Suc n))\<close> image_iff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7981
    have mono: "\<And>m n. m \<le> n \<Longrightarrow>f m \<subseteq> f n"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7982
      by (meson dual_order.trans interior_subset lift_Suc_mono_le sub_int)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7983
    obtain I where "finite I" and I: "K \<subseteq> (\<Union>i\<in>I. interior (f i))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7984
    proof (rule compactE_image [OF \<open>compact K\<close>])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7985
      show "K \<subseteq> (\<Union>n. interior (f n))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7986
        using \<open>K \<subseteq> S\<close> \<open>UNION UNIV f = S\<close> * by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7987
    qed auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7988
    { fix n
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7989
      assume n: "Max I \<le> n"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7990
      have "(\<Union>i\<in>I. interior (f i)) \<subseteq> f n"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7991
        by (rule UN_least) (meson dual_order.trans interior_subset mono I Max_ge [OF \<open>finite I\<close>] n)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7992
      then have "K \<subseteq> f n"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7993
        using I by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7994
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7995
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7996
      by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7997
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7998
  moreover have "\<exists>f. (\<forall>n. compact(f n)) \<and> (\<forall>n. (f n) \<subseteq> S) \<and> (\<forall>n. (f n) \<subseteq> interior(f(Suc n))) \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7999
                     ((\<Union>(range f) = S))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8000
  proof (intro exI conjI allI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8001
    show "\<And>n. compact (?C n)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8002
      by (auto simp: compact_diff open_sums)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8003
    show "\<And>n. ?C n \<subseteq> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8004
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8005
    show "?C n \<subseteq> interior (?C (Suc n))" for n
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8006
    proof (simp add: interior_diff, rule Diff_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8007
      show "cball a (real n) \<subseteq> ball a (1 + real n)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8008
        by (simp add: cball_subset_ball_iff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8009
      have cl: "closed (\<Union>x\<in>- S. \<Union>e\<in>cball 0 (1 / (2 + real n)). {x + e})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8010
        using assms by (auto intro: closed_compact_sums)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8011
      have "closure (\<Union>x\<in>- S. \<Union>y\<in>ball 0 (1 / (2 + real n)). {x + y})
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8012
            \<subseteq> (\<Union>x \<in> -S. \<Union>e \<in> cball 0 (1 / (2 + real n)). {x + e})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8013
        by (intro closure_minimal UN_mono ball_subset_cball order_refl cl)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8014
      also have "... \<subseteq> (\<Union>x \<in> -S. \<Union>y\<in>ball 0 (1 / (1 + real n)). {x + y})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8015
        apply (intro UN_mono order_refl)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8016
        apply (simp add: cball_subset_ball_iff divide_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8017
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8018
      finally show "closure (\<Union>x\<in>- S. \<Union>y\<in>ball 0 (1 / (2 + real n)). {x + y})
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8019
                    \<subseteq> (\<Union>x \<in> -S. \<Union>y\<in>ball 0 (1 / (1 + real n)). {x + y})" .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8020
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8021
    have "S \<subseteq> UNION UNIV ?C"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8022
    proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8023
      fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8024
      assume x: "x \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8025
      then obtain e where "e > 0" and e: "ball x e \<subseteq> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8026
        using assms open_contains_ball by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8027
      then obtain N1 where "N1 > 0" and N1: "real N1 > 1/e"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8028
        using reals_Archimedean2
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8029
        by (metis divide_less_0_iff less_eq_real_def neq0_conv not_le of_nat_0 of_nat_1 of_nat_less_0_iff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8030
      obtain N2 where N2: "norm(x - a) \<le> real N2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8031
        by (meson real_arch_simple)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8032
      have N12: "inverse((N1 + N2) + 1) \<le> inverse(N1)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8033
        using \<open>N1 > 0\<close> by (auto simp: divide_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8034
      have "x \<noteq> y + z" if "y \<notin> S" "norm z < 1 / (1 + (real N1 + real N2))" for y z
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8035
      proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8036
        have "e * real N1 < e * (1 + (real N1 + real N2))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8037
          by (simp add: \<open>0 < e\<close>)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8038
        then have "1 / (1 + (real N1 + real N2)) < e"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8039
          using N1 \<open>e > 0\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8040
          by (metis divide_less_eq less_trans mult.commute of_nat_add of_nat_less_0_iff of_nat_Suc)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8041
        then have "x - z \<in> ball x e"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8042
          using that by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8043
        then have "x - z \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8044
          using e by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8045
        with that show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8046
          by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8047
      qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8048
      with N2 show "x \<in> UNION UNIV ?C"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8049
        by (rule_tac a = "N1+N2" in UN_I) (auto simp: dist_norm norm_minus_commute)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8050
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8051
    then show "UNION UNIV ?C = S" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8052
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8053
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8054
    using that by metis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8055
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8056
67986
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8057
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8058
subsection{*Orthogonal complement*}
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8059
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8060
definition orthogonal_comp ("_\<^sup>\<bottom>" [80] 80)
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8061
  where "orthogonal_comp W \<equiv> {x. \<forall>y \<in> W. orthogonal y x}"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8062
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8063
lemma subspace_orthogonal_comp: "subspace (W\<^sup>\<bottom>)"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8064
  unfolding subspace_def orthogonal_comp_def orthogonal_def
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8065
  by (auto simp: inner_right_distrib)
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8066
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8067
lemma orthogonal_comp_anti_mono:
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8068
  assumes "A \<subseteq> B"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8069
  shows "B\<^sup>\<bottom> \<subseteq> A\<^sup>\<bottom>"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8070
proof
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8071
  fix x assume x: "x \<in> B\<^sup>\<bottom>"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8072
  show "x \<in> orthogonal_comp A" using x unfolding orthogonal_comp_def
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8073
    by (simp add: orthogonal_def, metis assms in_mono)
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8074
qed
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8075
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8076
lemma orthogonal_comp_null [simp]: "{0}\<^sup>\<bottom> = UNIV"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8077
  by (auto simp: orthogonal_comp_def orthogonal_def)
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8078
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8079
lemma orthogonal_comp_UNIV [simp]: "UNIV\<^sup>\<bottom> = {0}"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8080
  unfolding orthogonal_comp_def orthogonal_def
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8081
  by auto (use inner_eq_zero_iff in blast)
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8082
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8083
lemma orthogonal_comp_subset: "U \<subseteq> U\<^sup>\<bottom>\<^sup>\<bottom>"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8084
  by (auto simp: orthogonal_comp_def orthogonal_def inner_commute)
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8085
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8086
lemma subspace_sum_minimal:
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8087
  assumes "S \<subseteq> U" "T \<subseteq> U" "subspace U"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8088
  shows "S + T \<subseteq> U"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8089
proof
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8090
  fix x
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8091
  assume "x \<in> S + T"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8092
  then obtain xs xt where "xs \<in> S" "xt \<in> T" "x = xs+xt"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8093
    by (meson set_plus_elim)
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8094
  then show "x \<in> U"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8095
    by (meson assms subsetCE subspace_add)
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8096
qed
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8097
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8098
lemma subspace_sum_orthogonal_comp:
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8099
  fixes U :: "'a :: euclidean_space set"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8100
  assumes "subspace U"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8101
  shows "U + U\<^sup>\<bottom> = UNIV"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8102
proof -
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8103
  obtain B where "B \<subseteq> U"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8104
    and ortho: "pairwise orthogonal B" "\<And>x. x \<in> B \<Longrightarrow> norm x = 1"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8105
    and "independent B" "card B = dim U" "span B = U"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8106
    using orthonormal_basis_subspace [OF assms] by metis
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8107
  then have "finite B"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8108
    by (simp add: indep_card_eq_dim_span)
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8109
  have *: "\<forall>x\<in>B. \<forall>y\<in>B. x \<bullet> y = (if x=y then 1 else 0)"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8110
    using ortho norm_eq_1 by (auto simp: orthogonal_def pairwise_def)
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8111
  { fix v
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8112
    let ?u = "\<Sum>b\<in>B. (v \<bullet> b) *\<^sub>R b"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8113
    have "v = ?u + (v - ?u)"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8114
      by simp
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8115
    moreover have "?u \<in> U"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  8116
      by (metis (no_types, lifting) \<open>span B = U\<close> assms subspace_sum
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  8117
          span_clauses(1) span_scale)
67986
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8118
    moreover have "(v - ?u) \<in> U\<^sup>\<bottom>"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8119
    proof (clarsimp simp: orthogonal_comp_def orthogonal_def)
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8120
      fix y
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8121
      assume "y \<in> U"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8122
      with \<open>span B = U\<close> span_finite [OF \<open>finite B\<close>]
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8123
      obtain u where u: "y = (\<Sum>b\<in>B. u b *\<^sub>R b)"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8124
        by auto
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8125
      have "b \<bullet> (v - ?u) = 0" if "b \<in> B" for b
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8126
        using that \<open>finite B\<close>
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8127
        by (simp add: * algebra_simps inner_sum_right if_distrib [of "( *)v" for v] inner_commute cong: if_cong)
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8128
      then show "y \<bullet> (v - ?u) = 0"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8129
        by (simp add: u inner_sum_left)
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8130
    qed
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8131
    ultimately have "v \<in> U + U\<^sup>\<bottom>"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8132
      using set_plus_intro by fastforce
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8133
  } then show ?thesis
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8134
    by auto
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8135
qed
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8136
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8137
lemma orthogonal_Int_0:
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8138
  assumes "subspace U"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8139
  shows "U \<inter> U\<^sup>\<bottom> = {0}"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8140
  using orthogonal_comp_def orthogonal_self
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8141
  by (force simp: assms subspace_0 subspace_orthogonal_comp)
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8142
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8143
lemma orthogonal_comp_self:
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8144
  fixes U :: "'a :: euclidean_space set"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8145
  assumes "subspace U"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8146
  shows "U\<^sup>\<bottom>\<^sup>\<bottom> = U"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8147
proof
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8148
  have ssU': "subspace (U\<^sup>\<bottom>)"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8149
    by (simp add: subspace_orthogonal_comp)
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8150
  have "u \<in> U" if "u \<in> U\<^sup>\<bottom>\<^sup>\<bottom>" for u
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8151
  proof -
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8152
    obtain v w where "u = v+w" "v \<in> U" "w \<in> U\<^sup>\<bottom>"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8153
      using subspace_sum_orthogonal_comp [OF assms] set_plus_elim by blast
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8154
    then have "u-v \<in> U\<^sup>\<bottom>"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8155
      by simp
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8156
    moreover have "v \<in> U\<^sup>\<bottom>\<^sup>\<bottom>"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8157
      using \<open>v \<in> U\<close> orthogonal_comp_subset by blast
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8158
    then have "u-v \<in> U\<^sup>\<bottom>\<^sup>\<bottom>"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8159
      by (simp add: subspace_diff subspace_orthogonal_comp that)
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8160
    ultimately have "u-v = 0"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8161
      using orthogonal_Int_0 ssU' by blast
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8162
    with \<open>v \<in> U\<close> show ?thesis
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8163
      by auto
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8164
  qed
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8165
  then show "U\<^sup>\<bottom>\<^sup>\<bottom> \<subseteq> U"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8166
    by auto
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8167
qed (use orthogonal_comp_subset in auto)
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8168
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8169
lemma ker_orthogonal_comp_adjoint:
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8170
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8171
  assumes "linear f"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8172
  shows "f -` {0} =  (range (adjoint f))\<^sup>\<bottom>"
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8173
  apply (auto simp: orthogonal_comp_def orthogonal_def)
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8174
  apply (simp add: adjoint_works assms(1) inner_commute)
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8175
  by (metis adjoint_works all_zero_iff assms(1) inner_commute)
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8176
67989
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8177
subsection\<open> A non-injective linear function maps into a hyperplane.\<close>
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8178
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8179
lemma linear_surj_adj_imp_inj:
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8180
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8181
  assumes "linear f" "surj (adjoint f)"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8182
  shows "inj f"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8183
proof -
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8184
  have "\<exists>x. y = adjoint f x" for y
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8185
    using assms by (simp add: surjD)
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8186
  then show "inj f"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8187
    using assms unfolding inj_on_def image_def
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8188
    by (metis (no_types) adjoint_works euclidean_eqI)
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8189
qed
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8190
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8191
(*http://mathonline.wikidot.com/injectivity-and-surjectivity-of-the-adjoint-of-a-linear-map*)
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8192
lemma surj_adjoint_iff_inj [simp]:
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8193
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8194
  assumes "linear f"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8195
  shows  "surj (adjoint f) \<longleftrightarrow> inj f"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8196
proof
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8197
  assume "surj (adjoint f)"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8198
  then show "inj f"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8199
    by (simp add: assms linear_surj_adj_imp_inj)
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8200
next
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8201
  assume "inj f"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8202
  have "f -` {0} = {0}"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8203
    using assms \<open>inj f\<close> linear_0 linear_injective_0 by fastforce
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8204
  moreover have "f -` {0} = range (adjoint f)\<^sup>\<bottom>"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8205
    by (intro ker_orthogonal_comp_adjoint assms)
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8206
  ultimately have "range (adjoint f)\<^sup>\<bottom>\<^sup>\<bottom> = UNIV"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8207
    by (metis orthogonal_comp_null)
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8208
  then show "surj (adjoint f)"
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  8209
    using adjoint_linear \<open>linear f\<close>
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  8210
    by (subst (asm) orthogonal_comp_self)
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  8211
      (simp add: adjoint_linear linear_subspace_image)
67989
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8212
qed
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8213
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8214
lemma inj_adjoint_iff_surj [simp]:
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8215
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8216
  assumes "linear f"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8217
  shows  "inj (adjoint f) \<longleftrightarrow> surj f"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8218
proof
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8219
  assume "inj (adjoint f)"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8220
  have "(adjoint f) -` {0} = {0}"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8221
    by (metis \<open>inj (adjoint f)\<close> adjoint_linear assms surj_adjoint_iff_inj ker_orthogonal_comp_adjoint orthogonal_comp_UNIV)
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8222
  then have "(range(f))\<^sup>\<bottom> = {0}"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8223
    by (metis (no_types, hide_lams) adjoint_adjoint adjoint_linear assms ker_orthogonal_comp_adjoint set_zero)
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8224
  then show "surj f"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8225
    by (metis \<open>inj (adjoint f)\<close> adjoint_adjoint adjoint_linear assms surj_adjoint_iff_inj)
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8226
next
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8227
  assume "surj f"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8228
  then have "range f = (adjoint f -` {0})\<^sup>\<bottom>"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8229
    by (simp add: adjoint_adjoint adjoint_linear assms ker_orthogonal_comp_adjoint)
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8230
  then have "{0} = adjoint f -` {0}"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8231
    using \<open>surj f\<close> adjoint_adjoint adjoint_linear assms ker_orthogonal_comp_adjoint by force
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8232
  then show "inj (adjoint f)"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8233
    by (simp add: \<open>surj f\<close> adjoint_adjoint adjoint_linear assms linear_surj_adj_imp_inj)
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8234
qed
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8235
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8236
proposition linear_singular_into_hyperplane:
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8237
  fixes f :: "'n::euclidean_space \<Rightarrow> 'n"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8238
  assumes "linear f"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8239
  shows "\<not> inj f \<longleftrightarrow> (\<exists>a. a \<noteq> 0 \<and> (\<forall>x. a \<bullet> f x = 0))" (is "_ = ?rhs")
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8240
proof
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8241
  assume "\<not>inj f"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8242
  then show ?rhs
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8243
    using all_zero_iff
68072
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  8244
    by (metis (no_types, hide_lams) adjoint_clauses(2) adjoint_linear assms
493b818e8e10 added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
immler
parents: 67990
diff changeset
  8245
        linear_injective_0 linear_injective_imp_surjective linear_surj_adj_imp_inj)
67989
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8246
next
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8247
  assume ?rhs
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8248
  then show "\<not>inj f"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8249
    by (metis assms linear_injective_isomorphism all_zero_iff)
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8250
qed
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8251
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8252
lemma linear_singular_image_hyperplane:
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8253
  fixes f :: "'n::euclidean_space \<Rightarrow> 'n"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8254
  assumes "linear f" "\<not>inj f"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8255
  obtains a where "a \<noteq> 0" "\<And>S. f ` S \<subseteq> {x. a \<bullet> x = 0}"
706f86afff43 more results about measure and negligibility
paulson <lp15@cam.ac.uk>
parents: 67986
diff changeset
  8256
  using assms by (fastforce simp add: linear_singular_into_hyperplane)
67986
b65c4a6a015e quite a few more results about negligibility, etc., and a bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 67968
diff changeset
  8257
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8258
end