src/HOL/Analysis/Starlike.thy
author paulson <lp15@cam.ac.uk>
Thu, 05 Oct 2017 15:35:24 +0100
changeset 66765 c1dfa973b269
parent 66641 ff2e0115fea4
child 66793 deabce3ccf1f
permissions -rw-r--r--
new theorem at_within_cbox_finite
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
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     9
section \<open>Line segments, Starlike Sets, etc.\<close>
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
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    14
begin
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    15
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    16
definition midpoint :: "'a::real_vector \<Rightarrow> 'a \<Rightarrow> 'a"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    17
  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
    18
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    19
definition closed_segment :: "'a::real_vector \<Rightarrow> 'a \<Rightarrow> 'a set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    20
  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
    21
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    22
definition open_segment :: "'a::real_vector \<Rightarrow> 'a \<Rightarrow> 'a set" where
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    23
  "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
    24
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    25
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
    26
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    27
lemma in_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    28
    "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
    29
    "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
    30
  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
    31
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    32
lemma closed_segment_linear_image:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    33
    "linear f \<Longrightarrow> closed_segment (f a) (f b) = 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
    34
  by (force simp add: in_segment linear_add_cmul)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    35
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    36
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
    37
    "\<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
    38
  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
    39
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    40
lemma closed_segment_translation:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    41
    "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
    42
apply safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    43
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
    44
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
    45
done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    46
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    47
lemma open_segment_translation:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    48
    "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
    49
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
    50
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    51
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
    52
    "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
    53
  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
    54
    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
    55
  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
    56
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    57
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    58
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
    59
    "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
    60
  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
    61
    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
    62
  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
    63
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    64
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    65
lemma closed_segment_Reals:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    66
    "\<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
    67
  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
    68
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    69
lemma open_segment_Reals:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    70
    "\<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
    71
  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
    72
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    73
lemma open_segment_PairD:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    74
    "(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
    75
     \<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
    76
  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
    77
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    78
lemma closed_segment_PairD:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    79
  "(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
    80
  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
    81
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    82
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
    83
    "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
    84
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    85
  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
    86
    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
    87
    apply (erule ex_forward)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    88
    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
    89
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    90
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    91
  using * [where d = "-d"] *
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    92
  by (fastforce simp add:)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    93
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    94
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    95
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
    96
    "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
    97
  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
    98
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    99
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
   100
  "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
   101
  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
   102
  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
   103
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   104
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
   105
  "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
   106
  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
   107
  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
   108
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   109
lemma midpoint_idem [simp]: "midpoint x x = x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   110
  unfolding midpoint_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   111
  unfolding scaleR_right_distrib
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   112
  unfolding scaleR_left_distrib[symmetric]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   113
  by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   114
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   115
lemma midpoint_sym: "midpoint a b = midpoint b a"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   116
  unfolding midpoint_def by (auto simp add: scaleR_right_distrib)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   117
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   118
lemma midpoint_eq_iff: "midpoint a b = c \<longleftrightarrow> a + b = c + c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   119
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   120
  have "midpoint a b = c \<longleftrightarrow> scaleR 2 (midpoint a b) = scaleR 2 c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   121
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   122
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   123
    unfolding midpoint_def scaleR_2 [symmetric] by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   124
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   125
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   126
lemma
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   127
  fixes a::real
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   128
  assumes "a \<le> b" shows ge_midpoint_1: "a \<le> midpoint a b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   129
                    and le_midpoint_1: "midpoint a b \<le> b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   130
  by (simp_all add: midpoint_def assms)
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 dist_midpoint:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   133
  fixes a b :: "'a::real_normed_vector" shows
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   134
  "dist a (midpoint a b) = (dist a b) / 2" (is ?t1)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   135
  "dist b (midpoint a b) = (dist a b) / 2" (is ?t2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   136
  "dist (midpoint a b) a = (dist a b) / 2" (is ?t3)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   137
  "dist (midpoint a b) b = (dist a b) / 2" (is ?t4)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   138
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   139
  have *: "\<And>x y::'a. 2 *\<^sub>R x = - y \<Longrightarrow> norm x = (norm y) / 2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   140
    unfolding equation_minus_iff by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   141
  have **: "\<And>x y::'a. 2 *\<^sub>R x =   y \<Longrightarrow> norm x = (norm y) / 2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   142
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   143
  note scaleR_right_distrib [simp]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   144
  show ?t1
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   145
    unfolding midpoint_def dist_norm
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   146
    apply (rule **)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   147
    apply (simp add: scaleR_right_diff_distrib)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   148
    apply (simp add: scaleR_2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   149
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   150
  show ?t2
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   151
    unfolding midpoint_def dist_norm
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   152
    apply (rule *)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   153
    apply (simp add: scaleR_right_diff_distrib)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   154
    apply (simp add: scaleR_2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   155
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   156
  show ?t3
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   157
    unfolding midpoint_def dist_norm
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   158
    apply (rule *)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   159
    apply (simp add: scaleR_right_diff_distrib)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   160
    apply (simp add: scaleR_2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   161
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   162
  show ?t4
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   163
    unfolding midpoint_def dist_norm
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   164
    apply (rule **)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   165
    apply (simp add: scaleR_right_diff_distrib)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   166
    apply (simp add: scaleR_2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   167
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   168
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   169
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   170
lemma midpoint_eq_endpoint [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   171
  "midpoint a b = a \<longleftrightarrow> a = b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   172
  "midpoint a b = b \<longleftrightarrow> a = b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   173
  unfolding midpoint_eq_iff by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   174
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   175
lemma midpoint_plus_self [simp]: "midpoint a b + midpoint a b = a + b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   176
  using midpoint_eq_iff by metis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   177
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   178
lemma midpoint_linear_image:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   179
   "linear f \<Longrightarrow> midpoint(f a)(f b) = f(midpoint a b)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   180
by (simp add: linear_iff midpoint_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   181
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   182
subsection\<open>Starlike sets\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   183
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   184
definition "starlike S \<longleftrightarrow> (\<exists>a\<in>S. \<forall>x\<in>S. closed_segment a x \<subseteq> S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   185
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   186
lemma starlike_UNIV [simp]: "starlike UNIV"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   187
  by (simp add: starlike_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   188
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   189
lemma convex_contains_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   190
  "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
   191
  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
   192
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   193
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
   194
  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
   195
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   196
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
   197
    "\<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
   198
  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
   199
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   200
lemma convex_imp_starlike:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   201
  "convex S \<Longrightarrow> S \<noteq> {} \<Longrightarrow> starlike S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   202
  unfolding convex_contains_segment starlike_def by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   203
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   204
lemma segment_convex_hull:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   205
  "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
   206
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   207
  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
   208
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   209
    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
   210
    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
   211
qed
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 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
   214
  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
   215
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   216
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
   217
   "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
   218
  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
   219
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   220
lemma bounded_closed_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   221
    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
   222
  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
   223
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   224
lemma bounded_open_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   225
    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
   226
  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
   227
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   228
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
   229
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   230
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
   231
  unfolding segment_convex_hull
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   232
  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
   233
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   234
lemma eventually_closed_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   235
  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
   236
  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
   237
  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
   238
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   239
  from openE[OF assms]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   240
  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
   241
  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
   242
    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
   243
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   244
  proof eventually_elim
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   245
    case (elim x)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   246
    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
   247
    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
   248
    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
   249
    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
   250
    finally show ?case .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   251
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   252
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   253
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   254
lemma segment_furthest_le:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   255
  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
   256
  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
   257
  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
   258
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   259
  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
   260
    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
   261
    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
   262
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   263
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   264
    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
   265
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   266
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   267
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
   268
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   269
  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
   270
  thus ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   271
    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
   272
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   273
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   274
lemma segment_bound1:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   275
  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
   276
  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
   277
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   278
  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
   279
    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
   280
  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
   281
    apply clarify
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   282
    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
   283
    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
   284
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   285
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   286
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   287
lemma segment_bound:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   288
  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
   289
  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
   290
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
   291
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
   292
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   293
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
   294
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   295
  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
   296
  thus ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   297
    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
   298
qed
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 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
   301
  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
   302
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   303
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
   304
  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
   305
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   306
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
   307
  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
   308
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   309
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
   310
  "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
   311
  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
   312
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   313
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
   314
  fixes a b::real
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   315
  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
   316
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   317
  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
   318
    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
   319
    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
   320
  thus ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   321
    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
   322
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   323
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   324
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
   325
  fixes a b::real
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   326
  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
   327
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
   328
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   329
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
   330
  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
   331
  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
   332
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   333
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
   334
  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
   335
  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
   336
    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
   337
proof (intro conjI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   338
  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
   339
    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
   340
  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
   341
    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
   342
    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
   343
  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
   344
    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
   345
  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
   346
  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
   347
    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
   348
  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
   349
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   350
    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
   351
      using \<open>u \<le> 1\<close> by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   352
    then show ?thesis                     
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   353
      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
   354
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   355
  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
   356
    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
   357
  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
   358
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   359
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   360
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
   361
  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
   362
  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
   363
    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
   364
proof (intro conjI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   365
  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
   366
    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
   367
  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
   368
    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
   369
    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
   370
  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
   371
    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
   372
  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
   373
  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
   374
    using * by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   375
  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
   376
    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
   377
  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
   378
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   379
    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
   380
      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
   381
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   382
      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
   383
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   384
  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
   385
    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
   386
  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
   387
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   388
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   389
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
   390
  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
   391
  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
   392
    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
   393
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
   394
  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
   395
    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
   396
  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
   397
    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
   398
  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
   399
  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
   400
    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
   401
  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
   402
    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
   403
  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
   404
    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
   405
  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
   406
  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
   407
    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
   408
  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
   409
    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
   410
  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
   411
    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
   412
  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
   413
    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
   414
  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
   415
    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
   416
  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
   417
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   418
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   419
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
   420
  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
   421
  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
   422
    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
   423
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   424
  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
   425
    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
   426
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   427
    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
   428
    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
   429
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   430
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   431
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
   432
  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
   433
  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
   434
  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
   435
  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
   436
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   437
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
   438
  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
   439
  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
   440
    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
   441
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
   442
 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
   443
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
   444
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   445
lemma convex_intermediate_ball:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   446
  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
   447
  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
   448
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
   449
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
   450
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   451
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
   452
  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
   453
  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
   454
  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
   455
  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
   456
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   457
lemma notin_segment_midpoint:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   458
  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
   459
  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
   460
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
   461
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   462
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
   463
  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
   464
  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
   465
  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
   466
  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
   467
  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
   468
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   469
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
   470
  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
   471
    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
   472
    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
   473
  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
   474
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   475
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
   476
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   477
lemma segment_eq_compose:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   478
  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
   479
  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
   480
    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
   481
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   482
lemma segment_degen_1:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   483
  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
   484
  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
   485
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   486
  { 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
   487
    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
   488
      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
   489
    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
   490
      by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   491
  } then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   492
      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
   493
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   494
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   495
lemma segment_degen_0:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   496
    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
   497
    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
   498
  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
   499
  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
   500
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   501
lemma add_scaleR_degen:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   502
  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
   503
  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
   504
  shows "a=b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   505
  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
   506
  
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   507
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
   508
     "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
   509
  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
   510
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   511
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
   512
     "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
   513
  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
   514
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   515
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
   516
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   517
lemma open_segment_bound1:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   518
  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
   519
  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
   520
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   521
  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
   522
    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
   523
  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
   524
    apply clarify
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   525
    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
   526
    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
   527
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   528
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   529
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   530
lemma compact_segment [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   531
  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
   532
  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
   533
  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
   534
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   535
lemma closed_segment [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   536
  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
   537
  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
   538
  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
   539
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   540
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
   541
  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
   542
  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
   543
  by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   544
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   545
lemma open_segment_bound:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   546
  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
   547
  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
   548
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
   549
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
   550
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   551
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
   552
    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
   553
    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
   554
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   555
  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
   556
    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
   557
    apply (simp add:)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   558
    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
   559
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   560
    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
   561
         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
   562
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   563
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   564
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
   565
    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
   566
  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
   567
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   568
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
   569
    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
   570
  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
   571
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   572
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
   573
  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
   574
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   575
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
   576
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   577
  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
   578
    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
   579
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   580
    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
   581
    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
   582
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   583
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   584
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   585
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
   586
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   587
lemma connected_segment [iff]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   588
  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
   589
  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
   590
  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
   591
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   592
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
   593
     "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
   594
  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
   595
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   596
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
   597
    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
   598
    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
   599
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
   600
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   601
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
   602
  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
   603
  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
   604
    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
   605
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   606
  fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   607
  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
   608
    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
   609
  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
   610
  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
   611
    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
   612
    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
   613
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   614
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   615
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
   616
   "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
   617
    (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
   618
  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
   619
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   620
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
   621
  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
   622
  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
   623
  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
   624
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   625
  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
   626
    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
   627
  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
   628
  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
   629
    fix x y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   630
    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
   631
    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
   632
      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
   633
    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
   634
      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
   635
    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
   636
      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
   637
    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
   638
      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
   639
      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
   640
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   641
  show "?rhs \<subseteq> ?lhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   642
    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
   643
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   644
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   645
subsection\<open>More results about segments\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   646
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   647
lemma dist_half_times2:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   648
  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
   649
  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
   650
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   651
  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
   652
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   653
  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
   654
    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
   655
  finally show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   656
    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
   657
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   658
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   659
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
   660
    "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
   661
proof (cases "b = a")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   662
  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
   663
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   664
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   665
  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
   666
                  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
   667
                 (\<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
   668
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   669
    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
   670
                  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
   671
          ((\<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
   672
                  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
   673
      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
   674
    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
   675
                          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
   676
      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
   677
    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
   678
            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
   679
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   680
    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
   681
                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
   682
      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
   683
    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
   684
                          \<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
   685
      by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   686
    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
   687
      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
   688
    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
   689
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   690
    finally show ?thesis .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   691
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   692
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   693
    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
   694
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   695
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   696
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
   697
    "open_segment a b =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   698
     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
   699
proof (cases "b = a")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   700
  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
   701
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   702
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   703
  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
   704
                  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
   705
                 (\<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
   706
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   707
    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
   708
                  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
   709
          ((\<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
   710
                  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
   711
      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
   712
    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
   713
                          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
   714
      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
   715
    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
   716
            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
   717
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   718
    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
   719
                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
   720
      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
   721
    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
   722
                          \<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
   723
      by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   724
    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
   725
      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
   726
    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
   727
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   728
    finally show ?thesis .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   729
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   730
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   731
    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
   732
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   733
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   734
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
   735
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   736
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
   737
  by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   738
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   739
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
   740
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   741
  { 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
   742
    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
   743
      by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   744
    then have "a = b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   745
      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
   746
  } 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
   747
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   748
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   749
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
   750
  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
   751
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   752
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
   753
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   754
lemma inj_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   755
  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
   756
  assumes "a \<noteq> b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   757
    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
   758
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   759
  fix x y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   760
  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
   761
  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
   762
    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
   763
  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
   764
    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
   765
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   766
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   767
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
   768
  apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   769
  apply (rule ccontr)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   770
  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
   771
  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
   772
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   773
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   774
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
   775
  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
   776
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   777
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
   778
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   779
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
   780
  by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   781
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   782
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
   783
  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
   784
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   785
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
   786
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   787
lemma subset_closed_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   788
    "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
   789
     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
   790
  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
   791
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   792
lemma subset_co_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   793
    "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
   794
     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
   795
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
   796
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   797
lemma subset_open_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   798
  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
   799
  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
   800
         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
   801
        (is "?lhs = ?rhs")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   802
proof (cases "a = b")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   803
  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
   804
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   805
  case False show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   806
  proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   807
    assume rhs: ?rhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   808
    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
   809
      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
   810
    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
   811
               (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
   812
        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
   813
           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
   814
           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
   815
        for u ua ub
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   816
    proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   817
      have "ua \<noteq> ub"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   818
        using neq by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   819
      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
   820
        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
   821
      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
   822
        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
   823
      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
   824
      proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   825
        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
   826
          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
   827
        then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   828
          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
   829
                    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
   830
      qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   831
      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
   832
        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
   833
      with lt show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   834
        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
   835
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   836
    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
   837
      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
   838
      by (fastforce simp add:)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   839
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   840
    assume lhs: ?lhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   841
    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
   842
      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
   843
    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
   844
      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
   845
    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
   846
      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
   847
    then show ?rhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   848
      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
   849
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   850
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   851
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   852
lemma subset_oc_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   853
  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
   854
  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
   855
         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
   856
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
   857
apply (rule iffI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   858
 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
   859
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
   860
done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   861
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   862
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
   863
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   864
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   865
subsection\<open>Betweenness\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   866
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   867
definition "between = (\<lambda>(a,b) x. 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
   868
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   869
lemma betweenI:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   870
  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
   871
  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
   872
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
   873
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   874
lemma betweenE:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   875
  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
   876
  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
   877
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
   878
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   879
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
   880
  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
   881
  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
   882
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   883
  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
   884
    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
   885
  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
   886
    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
   887
  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
   888
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   889
    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
   890
    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
   891
    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
   892
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   893
  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
   894
    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
   895
  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
   896
  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
   897
  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
   898
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   899
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   900
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
   901
  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
   902
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   903
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
   904
proof (cases "a = b")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   905
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   906
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   907
    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
   908
    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
   909
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   910
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   911
  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
   912
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   913
  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
   914
    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
   915
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   916
    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
   917
    apply rule
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   918
    apply (elim exE conjE)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   919
    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
   920
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   921
    fix u
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   922
    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
   923
    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
   924
      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
   925
    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
   926
      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
   927
      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
   928
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   929
    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
   930
    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
   931
      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
   932
    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
   933
      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
   934
      unfolding dist_norm
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   935
      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
   936
      apply rule
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   937
      defer
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   938
      apply rule
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   939
      prefer 3
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
    proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   942
      fix i :: 'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   943
      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
   944
      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
   945
        ((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
   946
        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
   947
      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
   948
        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
   949
        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
   950
        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
   951
        apply -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   952
        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
   953
        using i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   954
        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
   955
        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
   956
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   957
      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
   958
        ((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
   959
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   960
    qed (insert Fal2, auto)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   961
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   962
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   963
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   964
lemma between_midpoint:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   965
  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
   966
  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
   967
    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
   968
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   969
  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
   970
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   971
  show ?t1 ?t2
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   972
    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
   973
    apply(rule_tac[!] *)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   974
    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
   975
    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
   976
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   977
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   978
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   979
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
   980
  "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
   981
  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
   982
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   983
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
   984
  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
   985
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   986
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
   987
  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
   988
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   989
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
   990
  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
   991
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   992
lemma between_commute:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   993
   "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
   994
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
   995
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   996
lemma between_antisym:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   997
  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
   998
  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
   999
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
  1000
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1001
lemma between_trans:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1002
    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
  1003
    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
  1004
  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
  1005
  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
  1006
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1007
lemma between_norm:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1008
    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
  1009
    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
  1010
  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
  1011
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1012
lemma between_swap:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1013
  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
  1014
  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
  1015
  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
  1016
  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
  1017
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
  1018
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1019
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
  1020
  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
  1021
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1022
lemma between_trans_2:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1023
  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
  1024
  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
  1025
  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
  1026
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1027
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
  1028
  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
  1029
  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
  1030
  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
  1031
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1032
lemma between_1:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1033
  fixes x::real
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1034
  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
  1035
  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
  1036
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1037
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1038
subsection \<open>Shrinking towards the interior of a convex set\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1039
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1040
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
  1041
  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
  1042
  assumes "convex s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1043
    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
  1044
    and "x \<in> s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1045
    and "0 < e"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1046
    and "e \<le> 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1047
  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
  1048
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1049
  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
  1050
    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
  1051
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1052
    unfolding mem_interior
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1053
    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
  1054
    apply rule
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1055
    defer
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1056
    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
  1057
  proof (rule, rule)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1058
    fix y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1059
    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
  1060
    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
  1061
      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
  1062
    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
  1063
      unfolding dist_norm
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1064
      unfolding norm_scaleR[symmetric]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1065
      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
  1066
      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
  1067
      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
  1068
    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
  1069
      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
  1070
    also have "\<dots> < d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1071
      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
  1072
      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
  1073
    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
  1074
      apply (subst *)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1075
      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
  1076
      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
  1077
      unfolding mem_ball
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1078
      using assms(3-5)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1079
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1080
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1081
  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
  1082
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1083
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1084
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
  1085
  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
  1086
  assumes "convex s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1087
    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
  1088
    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
  1089
    and "0 < e"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1090
    and "e \<le> 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1091
  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
  1092
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1093
  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
  1094
    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
  1095
  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
  1096
  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
  1097
    case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1098
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1099
      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
  1100
      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
  1101
      apply (auto)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1102
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1103
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1104
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1105
    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
  1106
      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
  1107
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1108
    proof (cases "e = 1")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1109
      case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1110
      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
  1111
        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
  1112
      then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1113
        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
  1114
        unfolding True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1115
        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
  1116
        apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1117
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1118
    next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1119
      case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1120
      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
  1121
        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
  1122
      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
  1123
        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
  1124
      then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1125
        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
  1126
        unfolding dist_norm
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1127
        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
  1128
        apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1129
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1130
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1131
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1132
  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
  1133
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1134
  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
  1135
  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
  1136
    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
  1137
    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
  1138
  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
  1139
    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
  1140
    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
  1141
    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
  1142
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1143
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1144
    unfolding *
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1145
    apply -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1146
    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
  1147
    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
  1148
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1149
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1150
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1151
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1152
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
  1153
  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
  1154
  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
  1155
    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
  1156
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
  1157
  fix u::real
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1158
  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
  1159
  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
  1160
    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
  1161
  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
  1162
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1163
  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
  1164
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1165
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1166
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
  1167
  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
  1168
  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
  1169
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1170
  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
  1171
    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
  1172
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1173
    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
  1174
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1175
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1176
lemma convex_closure_interior:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1177
  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
  1178
  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
  1179
  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
  1180
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1181
  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
  1182
    using int by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1183
  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
  1184
  proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1185
    fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1186
    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
  1187
    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
  1188
    proof (cases "x=a")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1189
      case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1190
      then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1191
        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
  1192
    next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1193
      case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1194
      show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1195
      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
  1196
        fix e::real
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1197
        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
  1198
        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
  1199
        proof (intro bexI conjI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1200
          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
  1201
            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
  1202
          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
  1203
            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
  1204
          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
  1205
            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
  1206
            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
  1207
            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
  1208
            done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1209
        qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1210
      qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1211
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1212
  qed
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
    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
  1215
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1216
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1217
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
  1218
  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
  1219
  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
  1220
  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
  1221
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1222
  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
  1223
    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
  1224
  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
  1225
    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
  1226
    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
  1227
  finally show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1228
    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
  1229
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1230
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1231
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1232
subsection \<open>Some obvious but surprisingly hard simplex lemmas\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1233
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1234
lemma simplex:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1235
  assumes "finite s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1236
    and "0 \<notin> s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1237
  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
  1238
    {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
  1239
  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
  1240
  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
  1241
  unfolding mem_Collect_eq
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1242
  apply (erule_tac[!] exE)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1243
  apply (erule_tac[!] conjE)+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1244
  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
  1245
  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
  1246
  defer
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1247
  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
  1248
  using assms(2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1249
  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
  1250
  apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1251
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1252
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1253
lemma substd_simplex:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1254
  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
  1255
  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
  1256
    {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
  1257
  (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
  1258
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1259
  let ?D = d
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1260
  have "0 \<notin> ?p"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1261
    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
  1262
  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
  1263
    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
  1264
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1265
    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
  1266
    apply (rule set_eqI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1267
    unfolding mem_Collect_eq
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1268
    apply rule
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1269
    apply (elim exE conjE)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1270
    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
  1271
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1272
    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
  1273
    fix u
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1274
    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"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1275
    have *: "\<forall>i\<in>Basis. i:d \<longrightarrow> u i = x\<bullet>i"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1276
      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
  1277
      using as(3)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1278
      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
  1279
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1280
    then have **: "sum u ?D = sum (op \<bullet> x) ?D"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1281
      apply -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1282
      apply (rule sum.cong)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1283
      using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1284
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1285
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1286
    have "(\<forall>i\<in>Basis. 0 \<le> x\<bullet>i) \<and> sum (op \<bullet> x) ?D \<le> 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1287
    proof (rule,rule)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1288
      fix i :: 'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1289
      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
  1290
      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
  1291
        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
  1292
         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
  1293
         apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1294
         done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1295
      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
  1296
        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
  1297
      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
  1298
    qed (insert as(2)[unfolded **], auto)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1299
    then show "(\<forall>i\<in>Basis. 0 \<le> x\<bullet>i) \<and> sum (op \<bullet> x) ?D \<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
  1300
      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
  1301
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1302
    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
  1303
    assume as: "\<forall>i\<in>Basis. 0 \<le> x \<bullet> i" "sum (op \<bullet> x) ?D \<le> 1" "(\<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
  1304
    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
  1305
      using as d
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1306
      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
  1307
      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
  1308
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1309
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1310
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1311
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1312
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1313
lemma std_simplex:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1314
  "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
  1315
    {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
  1316
  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
  1317
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1318
lemma interior_std_simplex:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1319
  "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
  1320
    {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
  1321
  apply (rule set_eqI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1322
  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
  1323
  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
  1324
  unfolding Ball_def[symmetric]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1325
  apply rule
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1326
  apply (elim exE conjE)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1327
  defer
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1328
  apply (erule conjE)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1329
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1330
  fix x :: 'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1331
  fix e
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1332
  assume "e > 0" and as: "\<forall>xa. dist x xa < e \<longrightarrow> (\<forall>x\<in>Basis. 0 \<le> xa \<bullet> x) \<and> sum (op \<bullet> xa) Basis \<le> 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1333
  show "(\<forall>xa\<in>Basis. 0 < x \<bullet> xa) \<and> sum (op \<bullet> x) Basis < 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1334
    apply safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1335
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1336
    fix i :: 'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1337
    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
  1338
    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
  1339
      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
  1340
      unfolding dist_norm
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1341
      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
  1342
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1343
    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
  1344
      unfolding dist_norm
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1345
      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
  1346
    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
  1347
      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
  1348
      by (auto simp: SOME_Basis inner_Basis inner_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1349
    then have *: "sum (op \<bullet> (x + (e / 2) *\<^sub>R (SOME i. i\<in>Basis))) Basis =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1350
      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
  1351
      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
  1352
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1353
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1354
    have "sum (op \<bullet> x) Basis < sum (op \<bullet> (x + (e / 2) *\<^sub>R (SOME i. i\<in>Basis))) Basis"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1355
      unfolding * sum.distrib
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1356
      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
  1357
      apply (subst sum.delta')
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1358
      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
  1359
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1360
    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
  1361
      using **
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1362
      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
  1363
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1364
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1365
    finally show "sum (op \<bullet> x) Basis < 1" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1366
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1367
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1368
  fix x :: 'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1369
  assume as: "\<forall>i\<in>Basis. 0 < x \<bullet> i" "sum (op \<bullet> x) Basis < 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1370
  obtain a :: 'b where "a \<in> UNIV" using UNIV_witness ..
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1371
  let ?d = "(1 - sum (op \<bullet> x) Basis) / real (DIM('a))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1372
  show "\<exists>e>0. \<forall>y. dist x y < e \<longrightarrow> (\<forall>i\<in>Basis. 0 \<le> y \<bullet> i) \<and> sum (op \<bullet> y) Basis \<le> 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1373
  proof (rule_tac x="min (Min ((op \<bullet> x) ` Basis)) D" for D in exI, intro conjI impI allI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1374
    fix y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1375
    assume y: "dist x y < min (Min (op \<bullet> x ` Basis)) ?d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1376
    have "sum (op \<bullet> y) Basis \<le> sum (\<lambda>i. x\<bullet>i + ?d) Basis"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1377
    proof (rule sum_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1378
      fix i :: 'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1379
      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
  1380
      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
  1381
        apply -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1382
        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
  1383
        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
  1384
        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
  1385
        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
  1386
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1387
      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
  1388
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1389
    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
  1390
      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
  1391
      by (auto simp add: Suc_le_eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1392
    finally show "sum (op \<bullet> y) Basis \<le> 1" .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1393
    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
  1394
    proof safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1395
      fix i :: 'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1396
      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
  1397
      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
  1398
        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
  1399
        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
  1400
        using i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1401
        apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1402
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1403
      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
  1404
        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
  1405
        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
  1406
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1407
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1408
    have "Min ((op \<bullet> x) ` Basis) > 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1409
      using as by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1410
    moreover have "?d > 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1411
      using as by (auto simp: Suc_le_eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1412
    ultimately show "0 < min (Min (op \<bullet> x ` Basis)) ((1 - sum (op \<bullet> x) Basis) / real DIM('a))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1413
      by linarith
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1414
  qed 
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1415
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1416
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1417
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
  1418
  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
  1419
    "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
  1420
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1421
  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
  1422
  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
  1423
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1424
    fix i :: 'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1425
    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
  1426
    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
  1427
      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
  1428
         (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
  1429
  note ** = this
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1430
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1431
    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
  1432
    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
  1433
  proof safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1434
    fix i :: 'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1435
    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
  1436
    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
  1437
      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
  1438
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1439
    have "sum (op \<bullet> ?a) ?D = sum (\<lambda>i. inverse (2 * real DIM('a))) ?D"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1440
      apply (rule sum.cong)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1441
      apply rule
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1442
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1443
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1444
    also have "\<dots> < 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1445
      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
  1446
      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
  1447
    finally show "sum (op \<bullet> ?a) ?D < 1" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1448
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1449
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1450
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1451
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
  1452
  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
  1453
  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
  1454
    {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
  1455
  (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
  1456
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1457
  have "finite d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1458
    apply (rule finite_subset)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1459
    using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1460
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1461
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1462
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1463
  proof (cases "d = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1464
    case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1465
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1466
      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
  1467
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1468
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1469
    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
  1470
      {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
  1471
      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
  1472
    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
  1473
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1474
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1475
      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
  1476
      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
  1477
      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
  1478
        "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
  1479
        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
  1480
      then have as: "\<forall>xa. dist x xa < e \<and> (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> xa\<bullet>i = 0) \<longrightarrow>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1481
        (\<forall>i\<in>d. 0 \<le> xa \<bullet> i) \<and> sum (op \<bullet> xa) d \<le> 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1482
        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
  1483
      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
  1484
        using x rel_interior_subset  substd_simplex[OF assms] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1485
      have "(\<forall>i\<in>d. 0 < x \<bullet> i) \<and> sum (op \<bullet> x) d < 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
  1486
        apply rule
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1487
        apply rule
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1488
      proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1489
        fix i :: 'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1490
        assume "i \<in> d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1491
        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
  1492
          apply -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1493
          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
  1494
          unfolding dist_norm
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1495
          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
  1496
          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
  1497
          done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1498
        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
  1499
          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
  1500
          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
  1501
          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
  1502
          done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1503
      next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1504
        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
  1505
          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
  1506
        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
  1507
          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
  1508
          unfolding dist_norm
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1509
          by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1510
        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
  1511
          using a d by (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
  1512
        then have *: "sum (op \<bullet> (x + (e / 2) *\<^sub>R a)) d =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1513
          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
  1514
          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
  1515
        have "a \<in> Basis"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1516
          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
  1517
        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
  1518
          using x0 d \<open>a\<in>d\<close> by (auto simp add: inner_add_left inner_Basis)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1519
        have "sum (op \<bullet> x) d < sum (op \<bullet> (x + (e / 2) *\<^sub>R a)) d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1520
          unfolding * sum.distrib
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1521
          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
  1522
          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
  1523
          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
  1524
        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
  1525
          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
  1526
          by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1527
        finally show "sum (op \<bullet> x) d < 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
  1528
          using x0 by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1529
      qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1530
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1531
    moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1532
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1533
      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
  1534
      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
  1535
      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
  1536
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1537
      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
  1538
      ultimately
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1539
      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
  1540
        by metis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1541
      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
  1542
        using as assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1543
        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
  1544
      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
  1545
        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
  1546
      let ?d = "(1 - sum (op \<bullet> x) d) / real (card d)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1547
      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
  1548
        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
  1549
      have "Min ((op \<bullet> x) ` d) > 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1550
        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
  1551
      moreover have "?d > 0" using as using \<open>0 < card d\<close> by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1552
      ultimately have h3: "min (Min ((op \<bullet> x) ` d)) ?d > 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1553
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1554
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1555
      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
  1556
        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
  1557
        apply (rule,rule h2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1558
        unfolding substd_simplex[OF assms]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1559
        apply (rule_tac x="min (Min ((op \<bullet> x) ` d)) ?d" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1560
        apply (rule, rule h3)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1561
        apply safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1562
        unfolding mem_ball
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1563
      proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1564
        fix y :: 'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1565
        assume y: "dist x y < min (Min (op \<bullet> x ` d)) ?d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1566
        assume y2: "\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> y\<bullet>i = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1567
        have "sum (op \<bullet> y) d \<le> sum (\<lambda>i. x\<bullet>i + ?d) d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1568
        proof (rule sum_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1569
          fix i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1570
          assume "i \<in> d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1571
          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
  1572
            by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1573
          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
  1574
            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
  1575
            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
  1576
            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
  1577
            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
  1578
            done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1579
          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
  1580
        qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1581
        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
  1582
          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
  1583
          by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1584
        finally show "sum (op \<bullet> y) d \<le> 1" .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1585
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1586
        fix i :: 'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1587
        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
  1588
        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
  1589
        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
  1590
          case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1591
          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
  1592
            using 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
  1593
            using Min_gr_iff[of "op \<bullet> x ` d" "norm (x - y)"] \<open>0 < card d\<close> \<open>i:d\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1594
            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
  1595
          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
  1596
            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
  1597
            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
  1598
        qed (insert y2, auto)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1599
      qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1600
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1601
    ultimately have
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1602
      "\<And>x. x \<in> rel_interior (convex hull insert 0 d) \<longleftrightarrow>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1603
        x \<in> {x. (\<forall>i\<in>d. 0 < x \<bullet> i) \<and> sum (op \<bullet> x) d < 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
  1604
      by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1605
    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
  1606
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1607
qed
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
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
  1610
  assumes "d \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1611
    and "d \<subseteq> Basis"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1612
  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
  1613
    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
  1614
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1615
  let ?D = d
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1616
  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
  1617
  have "finite d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1618
    apply (rule finite_subset)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1619
    using assms(2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1620
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1621
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1622
  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
  1623
    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
  1624
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1625
    fix i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1626
    assume "i \<in> d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1627
    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
  1628
      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
  1629
      unfolding inner_sum_left
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1630
      apply (rule sum.cong)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1631
      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
  1632
        d1 assms(2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1633
      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
  1634
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1635
  note ** = this
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1636
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1637
    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
  1638
    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
  1639
  proof safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1640
    fix i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1641
    assume "i \<in> d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1642
    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
  1643
      using d1 by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1644
    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
  1645
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1646
    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
  1647
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1648
    have "sum (op \<bullet> ?a) ?D = sum (\<lambda>i. inverse (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
  1649
      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
  1650
    also have "\<dots> < 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1651
      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
  1652
      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
  1653
    finally show "sum (op \<bullet> ?a) ?D < 1" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1654
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1655
    fix i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1656
    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
  1657
    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
  1658
    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
  1659
      {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1660
        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
  1661
        assume "x \<in> d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1662
        then have "x \<in> span d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1663
          using span_superset[of _ "d"] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1664
        then have "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
  1665
          using span_mul[of x "d" "(inverse (real (card d)) / 2)"] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1666
      }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1667
      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
  1668
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1669
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1670
    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
  1671
      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
  1672
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1673
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1674
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1675
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1676
subsection \<open>Relative interior of convex set\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1677
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1678
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
  1679
  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
  1680
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1681
    and "0 \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1682
  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
  1683
proof (cases "S = {0}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1684
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1685
  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
  1686
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1687
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1688
  obtain B where B: "independent B \<and> B \<le> S \<and> S \<le> span B \<and> card B = dim S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1689
    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
  1690
  then have "B \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1691
    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
  1692
  have "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
  1693
    using subspace_span[of B] subspace_0[of "span B"] span_inc by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1694
  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
  1695
    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
  1696
  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
  1697
    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
  1698
  then have "span (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
  1699
    using span_span[of B] span_mono[of "convex hull 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
  1700
  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
  1701
    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
  1702
  then have "span (convex hull insert 0 B) = span S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1703
    using B span_mono[of B S] span_mono[of S "span B"] span_span[of B] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1704
  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
  1705
    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
  1706
  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
  1707
    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
  1708
      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
  1709
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1710
  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
  1711
    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
  1712
      "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
  1713
    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
  1714
    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
  1715
  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
  1716
    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
  1717
  have "d \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1718
    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
  1719
  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
  1720
    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
  1721
  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
  1722
    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
  1723
      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
  1724
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1725
  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
  1726
    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
  1727
    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
  1728
    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
  1729
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1730
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1731
  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
  1732
    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
  1733
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1734
    apply blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1735
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1736
  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
  1737
    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
  1738
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1739
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1740
    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
  1741
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1742
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1743
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
  1744
  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
  1745
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1746
  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
  1747
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1748
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1749
    assume "S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1750
    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
  1751
    then have "0 \<in> op + (-a) ` S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1752
      using assms exI[of "(\<lambda>x. x \<in> S \<and> - a + x = 0)" a] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1753
    then have "rel_interior (op + (-a) ` S) \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1754
      using rel_interior_convex_nonempty_aux[of "op + (-a) ` S"]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1755
        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
  1756
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1757
    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
  1758
      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
  1759
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1760
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1761
    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
  1762
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1763
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1764
lemma interior_simplex_nonempty:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1765
  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
  1766
  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
  1767
  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
  1768
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1769
  have "affine hull (insert 0 S) = UNIV"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1770
    apply (simp add: hull_inc affine_hull_span_0)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1771
    using assms dim_eq_full indep_card_eq_dim_span by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1772
  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
  1773
    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
  1774
  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
  1775
    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
  1776
  with that show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1777
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1778
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1779
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1780
lemma convex_rel_interior:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1781
  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
  1782
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1783
  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
  1784
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1785
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1786
    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
  1787
    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
  1788
    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
  1789
      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
  1790
    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
  1791
    proof (cases "0 = u")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1792
      case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1793
      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
  1794
      then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1795
        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
  1796
    next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1797
      case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1798
      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
  1799
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1800
    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
  1801
      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
  1802
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1803
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1804
    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
  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_closure_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 "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
  1811
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1812
  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
  1813
    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
  1814
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1815
  proof (cases "S = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1816
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1817
    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
  1818
      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
  1819
    { fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1820
      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
  1821
      {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1822
        assume "x = a"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1823
        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
  1824
          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
  1825
      }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1826
      moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1827
      {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1828
        assume "x \<noteq> a"
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
           fix e :: real
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1831
           assume "e > 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1832
           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
  1833
           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
  1834
             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
  1835
             by simp_all
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1836
           then have *: "x - e1 *\<^sub>R (x - a) : rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1837
             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
  1838
             by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1839
           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
  1840
              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
  1841
              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
  1842
              apply simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1843
              done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1844
        }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1845
        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
  1846
          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
  1847
        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
  1848
          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
  1849
      }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1850
      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
  1851
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1852
    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
  1853
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1854
    case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1855
    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
  1856
      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
  1857
    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
  1858
      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
  1859
    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
  1860
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1861
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1862
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1863
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
  1864
  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
  1865
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1866
  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
  1867
  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
  1868
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1869
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
  1870
  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
  1871
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1872
  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
  1873
  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
  1874
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1875
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
  1876
  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
  1877
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1878
  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
  1879
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1880
  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
  1881
    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
  1882
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1883
    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
  1884
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1885
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1886
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
  1887
  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
  1888
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1889
  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
  1890
  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
  1891
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1892
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
  1893
  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
  1894
  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
  1895
  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
  1896
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1897
  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
  1898
  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
  1899
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1900
    using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1901
    apply simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1902
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1903
  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
  1904
    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
  1905
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1906
  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
  1907
    using e_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1908
    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
  1909
    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
  1910
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1911
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1912
  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
  1913
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1914
  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
  1915
  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
  1916
  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
  1917
qed
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:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1920
  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
  1921
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1922
  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
  1923
proof (cases "S = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1924
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1925
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1926
    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
  1927
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1928
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1929
  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
  1930
    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
  1931
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1932
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1933
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1934
    fix z
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1935
    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
  1936
    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
  1937
      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
  1938
    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
  1939
    proof (cases "x = z")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1940
      case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1941
      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
  1942
    next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1943
      case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1944
      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
  1945
        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
  1946
      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
  1947
      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
  1948
      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
  1949
        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
  1950
      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
  1951
        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
  1952
      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
  1953
        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
  1954
      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
  1955
        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
  1956
          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
  1957
      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
  1958
      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
  1959
        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
  1960
      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
  1961
        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
  1962
        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
  1963
      then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1964
        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
  1965
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1966
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1967
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1968
  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
  1969
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1970
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1971
lemma convex_interior_closure:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1972
  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
  1973
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1974
  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
  1975
  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
  1976
    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
  1977
    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
  1978
  by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1979
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1980
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
  1981
  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
  1982
  assumes "convex S1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1983
    and "convex S2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1984
  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
  1985
  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
  1986
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1987
lemma closure_eq_between:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1988
  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
  1989
  assumes "convex S1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1990
    and "convex S2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1991
  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
  1992
  (is "?A \<longleftrightarrow> ?B")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1993
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1994
  assume ?A
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1995
  then show ?B
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1996
    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
  1997
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1998
  assume ?B
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1999
  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
  2000
    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
  2001
  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
  2002
    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
  2003
  ultimately show ?A ..
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2004
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2005
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2006
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
  2007
  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
  2008
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2009
    and "open A"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2010
  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
  2011
  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
  2012
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2013
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
  2014
  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
  2015
  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
  2016
proof (cases "a = b")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2017
  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
  2018
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2019
  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
  2020
    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
  2021
    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
  2022
    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
  2023
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2024
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2025
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2026
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
  2027
  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
  2028
  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
  2029
         (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
  2030
proof (cases "a = b")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2031
  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
  2032
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2033
  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
  2034
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2035
       (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
  2036
              rel_interior_open_segment)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2037
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2038
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2039
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
  2040
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2041
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
  2042
  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
  2043
  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
  2044
  shows "starlike T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2045
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2046
  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
  2047
    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
  2048
  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
  2049
  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
  2050
  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
  2051
    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
  2052
    using assms by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2053
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2054
    unfolding starlike_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2055
    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
  2056
    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
  2057
    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
  2058
    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
  2059
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2060
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2061
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2062
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
  2063
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2064
definition "rel_frontier 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
  2065
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2066
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
  2067
  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
  2068
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2069
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
  2070
    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
  2071
    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
  2072
  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
  2073
  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
  2074
  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
  2075
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2076
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
  2077
    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
  2078
    shows "rel_frontier {a} = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2079
  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
  2080
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2081
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
  2082
  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
  2083
  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
  2084
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
  2085
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2086
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
  2087
    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
  2088
    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
  2089
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
  2090
  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
  2091
    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
  2092
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2093
  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
  2094
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2095
  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
  2096
    apply simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2097
    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
  2098
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2099
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2100
lemma rel_frontier_translation:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2101
  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
  2102
  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
  2103
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
  2104
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2105
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
  2106
  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
  2107
  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
  2108
  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
  2109
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2110
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
  2111
  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
  2112
  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
  2113
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
  2114
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2115
lemma rel_frontier_frontier:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2116
  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
  2117
  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
  2118
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
  2119
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2120
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
  2121
   "\<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
  2122
   \<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
  2123
  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
  2124
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2125
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
  2126
  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
  2127
  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
  2128
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2129
  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
  2130
    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
  2131
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2132
    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
  2133
    unfolding rel_frontier_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2134
    using * closed_affine_hull
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2135
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2136
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2137
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2138
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2139
lemma closed_rel_boundary:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2140
  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
  2141
  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
  2142
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
  2143
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2144
lemma compact_rel_boundary:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2145
  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
  2146
  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
  2147
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
  2148
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2149
lemma bounded_rel_frontier:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2150
  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
  2151
  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
  2152
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
  2153
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2154
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
  2155
  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
  2156
  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
  2157
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
  2158
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2159
lemma compact_rel_frontier:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2160
  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
  2161
  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
  2162
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
  2163
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2164
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
  2165
  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
  2166
  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
  2167
         \<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
  2168
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
  2169
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2170
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
  2171
  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
  2172
  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
  2173
         \<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
  2174
             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
  2175
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
  2176
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2177
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
  2178
  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
  2179
  assumes "convex S1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2180
    and "convex S2"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2181
    and "S2 \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2182
    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
  2183
  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
  2184
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2185
  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
  2186
    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
  2187
  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
  2188
    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
  2189
  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
  2190
    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
  2191
      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
  2192
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2193
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2194
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2195
    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
  2196
    then have "S1 \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2197
      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
  2198
    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
  2199
       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
  2200
       using * affine_affine_hull
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2201
       apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2202
       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
  2203
       apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2204
       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
  2205
       apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2206
       done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2207
    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
  2208
      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
  2209
    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
  2210
       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
  2211
    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
  2212
      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
  2213
    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
  2214
      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
  2215
    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
  2216
      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
  2217
    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
  2218
      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
  2219
    then have False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2220
      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
  2221
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2222
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2223
    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
  2224
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2225
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2226
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
  2227
  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
  2228
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2229
    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
  2230
  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
  2231
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2232
  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
  2233
    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
  2234
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2235
    fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2236
    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
  2237
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2238
      assume "x \<noteq> z"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2239
      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
  2240
      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
  2241
      {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2242
        fix e
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2243
        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
  2244
        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
  2245
          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
  2246
        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
  2247
          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
  2248
          by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2249
        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
  2250
          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
  2251
        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
  2252
          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
  2253
        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
  2254
          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
  2255
        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
  2256
          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
  2257
        also have "\<dots> = e1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2258
          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
  2259
        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
  2260
          by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2261
        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
  2262
          using m_def **
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2263
          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
  2264
          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
  2265
        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
  2266
          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
  2267
      }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2268
      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
  2269
        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
  2270
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2271
    moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2272
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2273
      assume "x = z"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2274
      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
  2275
      then have "m > 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2276
        using e1 by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2277
      {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2278
        fix e
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2279
        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
  2280
        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
  2281
          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
  2282
        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
  2283
          using e by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2284
      }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2285
      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
  2286
        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
  2287
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2288
    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
  2289
      by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2290
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2291
  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
  2292
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2293
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2294
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
  2295
  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
  2296
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2297
  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
  2298
  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
  2299
  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
  2300
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2301
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
  2302
  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
  2303
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2304
    and "S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2305
  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
  2306
  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
  2307
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2308
  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
  2309
    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
  2310
  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
  2311
    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
  2312
  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
  2313
    using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2314
  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
  2315
  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
  2316
  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
  2317
  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
  2318
  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
  2319
    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
  2320
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2321
    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
  2322
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2323
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2324
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2325
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
  2326
  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
  2327
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2328
    and "S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2329
  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
  2330
  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
  2331
    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
  2332
  by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2333
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2334
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
  2335
  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
  2336
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2337
    and "S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2338
  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
  2339
  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
  2340
  by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2341
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2342
lemma convex_interior_iff:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2343
  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
  2344
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2345
  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
  2346
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
  2347
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2348
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2349
    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
  2350
    then have False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2351
      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
  2352
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2353
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2354
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2355
    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
  2356
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2357
      fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2358
      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
  2359
        using r by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2360
      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
  2361
        using r by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2362
      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
  2363
      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
  2364
        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
  2365
      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
  2366
      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
  2367
        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
  2368
      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
  2369
        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
  2370
      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
  2371
        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
  2372
        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
  2373
        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
  2374
        apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2375
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2376
      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
  2377
        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
  2378
          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
  2379
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2380
      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
  2381
        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
  2382
      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
  2383
        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
  2384
      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
  2385
        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
  2386
          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
  2387
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2388
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2389
    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
  2390
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2391
    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
  2392
      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
  2393
    then have False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2394
      using False by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2395
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2396
  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
  2397
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2398
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2399
  then have "S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2400
    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
  2401
  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
  2402
    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
  2403
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2404
    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
  2405
    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
  2406
      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
  2407
    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
  2408
      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
  2409
    fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2410
    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
  2411
      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
  2412
    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
  2413
    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
  2414
      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
  2415
    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
  2416
      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
  2417
    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
  2418
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2419
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2420
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2421
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2422
    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
  2423
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2424
      fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2425
      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
  2426
        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
  2427
      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
  2428
      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
  2429
        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
  2430
      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
  2431
        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
  2432
      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
  2433
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2434
    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
  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
    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
  2437
      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
  2438
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2439
  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
  2440
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2441
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2442
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2443
subsubsection \<open>Relative interior and closure under common operations\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2444
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2445
lemma rel_interior_inter_aux: "\<Inter>{rel_interior S |S. S : I} \<subseteq> \<Inter>I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2446
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2447
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2448
    fix y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2449
    assume "y \<in> \<Inter>{rel_interior S |S. S : I}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2450
    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
  2451
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2452
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2453
      fix S
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2454
      assume "S \<in> I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2455
      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
  2456
        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
  2457
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2458
    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
  2459
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2460
  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
  2461
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2462
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2463
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
  2464
proof -
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
    fix y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2467
    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
  2468
    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
  2469
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2470
      fix S
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2471
      assume "S \<in> I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2472
      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
  2473
        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
  2474
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2475
    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
  2476
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2477
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2478
  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
  2479
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2480
  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
  2481
    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
  2482
  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
  2483
    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
  2484
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2485
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2486
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
  2487
  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
  2488
    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
  2489
  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
  2490
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2491
  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
  2492
    using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2493
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2494
    fix y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2495
    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
  2496
    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
  2497
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2498
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2499
      assume "y = x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2500
      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
  2501
        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
  2502
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2503
    moreover
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
      assume "y \<noteq> x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2506
      { fix e :: real
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2507
        assume e: "e > 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2508
        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
  2509
        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
  2510
          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
  2511
          by simp_all
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2512
        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
  2513
        {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2514
          fix S
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2515
          assume "S \<in> I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2516
          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
  2517
            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
  2518
            by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2519
        }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2520
        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
  2521
          by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2522
        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
  2523
          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
  2524
          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
  2525
          apply simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2526
          done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2527
      }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2528
      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
  2529
        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
  2530
      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
  2531
        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
  2532
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2533
    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
  2534
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2535
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2536
  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
  2537
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2538
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2539
lemma convex_closure_inter:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2540
  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
  2541
    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
  2542
  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
  2543
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2544
  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
  2545
    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
  2546
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2547
  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
  2548
    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
  2549
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2550
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2551
    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
  2552
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2553
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2554
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
  2555
  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
  2556
    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
  2557
  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
  2558
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2559
  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
  2560
    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
  2561
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2562
  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
  2563
    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
  2564
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2565
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2566
    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
  2567
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2568
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2569
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
  2570
  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
  2571
    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
  2572
  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
  2573
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2574
  have "convex (\<Inter>I)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2575
    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
  2576
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2577
  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
  2578
    apply (rule convex_Inter)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2579
    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
  2580
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2581
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2582
  ultimately
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2583
  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
  2584
    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
  2585
      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
  2586
    by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2587
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2588
    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
  2589
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2590
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2591
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
  2592
  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
  2593
    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
  2594
    and "finite I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2595
  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
  2596
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2597
  have "\<Inter>I \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2598
    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
  2599
  have "convex (\<Inter>I)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2600
    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
  2601
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2602
  proof (cases "I = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2603
    case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2604
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2605
      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
  2606
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2607
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2608
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2609
      fix z
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2610
      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
  2611
      {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2612
        fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2613
        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
  2614
        {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2615
          fix S
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2616
          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
  2617
          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
  2618
            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
  2619
          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
  2620
            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
  2621
        }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2622
        then obtain mS where
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2623
          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
  2624
        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
  2625
        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
  2626
        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
  2627
        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
  2628
          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
  2629
        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
  2630
          using mS by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2631
      }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2632
      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
  2633
        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
  2634
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2635
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2636
      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
  2637
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2638
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2639
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2640
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
  2641
  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
  2642
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2643
    and "convex T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2644
  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
  2645
  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
  2646
  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
  2647
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2648
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
  2649
  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
  2650
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2651
    and "convex T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2652
    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
  2653
  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
  2654
  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
  2655
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2656
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
  2657
  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
  2658
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2659
    and "affine T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2660
    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
  2661
  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
  2662
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2663
  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
  2664
    using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2665
  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
  2666
    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
  2667
  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
  2668
    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
  2669
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2670
    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
  2671
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2672
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2673
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
  2674
  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
  2675
  assumes "DIM('a) = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2676
  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
  2677
unfolding connected_component_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2678
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
  2679
            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
  2680
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2681
lemma connected_component_1:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2682
  fixes S :: "real set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2683
  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
  2684
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
  2685
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2686
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
  2687
  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
  2688
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2689
    and "affine T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2690
    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
  2691
  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
  2692
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2693
  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
  2694
    using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2695
  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
  2696
    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
  2697
  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
  2698
    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
  2699
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2700
    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
  2701
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2702
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2703
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
  2704
   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
  2705
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2706
    and "affine T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2707
    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
  2708
  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
  2709
using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2710
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
  2711
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
  2712
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2713
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
  2714
  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
  2715
  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
  2716
    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
  2717
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2718
  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
  2719
    using assms by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2720
  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
  2721
    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
  2722
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2723
    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
  2724
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2725
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2726
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
  2727
  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
  2728
  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
  2729
  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
  2730
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2731
  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
  2732
    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
  2733
  also have "... \<subseteq> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2734
    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
  2735
  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
  2736
    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
  2737
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2738
  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
  2739
    using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2740
  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
  2741
    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
  2742
  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
  2743
  proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2744
    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
  2745
    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
  2746
    proof (cases "x = a")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2747
      case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2748
      then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2749
        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
  2750
    next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2751
      case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2752
      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
  2753
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2754
      then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2755
        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
  2756
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2757
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2758
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2759
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2760
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
  2761
  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
  2762
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2763
    and "convex T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2764
    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
  2765
    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
  2766
  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
  2767
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2768
  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
  2769
    using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2770
  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
  2771
    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
  2772
      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
  2773
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2774
  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
  2775
    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
  2776
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2777
  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
  2778
    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
  2779
      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
  2780
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2781
  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
  2782
    using * by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2783
  finally show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2784
    by auto
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 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
  2788
  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
  2789
  assumes "linear f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2790
    and "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2791
  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
  2792
proof (cases "S = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2793
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2794
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2795
    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
  2796
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2797
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2798
  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
  2799
    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
  2800
  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
  2801
    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
  2802
  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
  2803
    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
  2804
  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
  2805
    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
  2806
  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
  2807
    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
  2808
      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
  2809
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2810
  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
  2811
    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
  2812
      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
  2813
      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
  2814
      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
  2815
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2816
  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
  2817
    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
  2818
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2819
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2820
    fix z
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2821
    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
  2822
    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
  2823
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2824
      fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2825
      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
  2826
      then obtain x1 where x1: "x1 \<in> S" "f x1 = x" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2827
      then obtain e where e: "e > 1" "(1 - e) *\<^sub>R x1 + e *\<^sub>R z1 : S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2828
        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
  2829
      moreover have "f ((1 - e) *\<^sub>R x1 + e *\<^sub>R z1) = (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
  2830
        using x1 z1 \<open>linear f\<close> by (simp add: linear_add_cmul)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2831
      ultimately have "(1 - e) *\<^sub>R x + e *\<^sub>R z : f ` S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2832
        using imageI[of "(1 - e) *\<^sub>R x1 + e *\<^sub>R z1" S f] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2833
      then have "\<exists>e. e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R z : f ` S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2834
        using e by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2835
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2836
    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
  2837
      using convex_rel_interior_iff[of "f ` S" z] \<open>convex S\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2838
        \<open>linear f\<close> \<open>S \<noteq> {}\<close> convex_linear_image[of f S]  linear_conv_bounded_linear[of f]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2839
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2840
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2841
  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
  2842
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2843
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2844
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
  2845
  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
  2846
  assumes "linear f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2847
    and "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2848
    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
  2849
  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
  2850
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2851
  have "S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2852
    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
  2853
  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
  2854
    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
  2855
  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
  2856
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2857
  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
  2858
    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
  2859
  then have "convex (S \<inter> range f)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2860
    by (metis assms(1) assms(2) convex_Int subspace_UNIV subspace_imp_convex subspace_linear_image)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2861
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2862
    fix z
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2863
    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
  2864
    then have z: "f z : rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2865
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2866
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2867
      fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2868
      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
  2869
      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
  2870
      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
  2871
        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
  2872
      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
  2873
        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
  2874
      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
  2875
        using e by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2876
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2877
    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
  2878
      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
  2879
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2880
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2881
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2882
    fix z
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2883
    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
  2884
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2885
      fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2886
      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
  2887
      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
  2888
      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
  2889
        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
  2890
      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
  2891
        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
  2892
      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
  2893
        using e by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2894
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2895
    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
  2896
      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
  2897
        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
  2898
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2899
    moreover have "affine (range f)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2900
      by (metis assms(1) subspace_UNIV subspace_imp_affine subspace_linear_image)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2901
    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
  2902
      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
  2903
    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
  2904
      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
  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
  2907
qed
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
lemma rel_interior_Times:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2910
  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
  2911
    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
  2912
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2913
    and "convex T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2914
  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
  2915
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2916
  { assume "S = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2917
    then have ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2918
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2919
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2920
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2921
  { assume "T = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2922
    then have ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2923
       by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2924
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2925
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2926
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2927
    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
  2928
    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
  2929
      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
  2930
    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
  2931
      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
  2932
    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
  2933
      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
  2934
    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
  2935
      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
  2936
    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
  2937
      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
  2938
    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
  2939
      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
  2940
    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
  2941
      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
  2942
    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
  2943
      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
  2944
    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
  2945
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2946
    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
  2947
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2948
    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
  2949
       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
  2950
       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
  2951
       apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2952
       done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2953
    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
  2954
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2955
  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
  2956
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2957
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2958
lemma rel_interior_scaleR:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2959
  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
  2960
  assumes "c \<noteq> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2961
  shows "(op *\<^sub>R c) ` (rel_interior S) = rel_interior ((op *\<^sub>R c) ` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2962
  using rel_interior_injective_linear_image[of "(op *\<^sub>R c)" S]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2963
    linear_conv_bounded_linear[of "op *\<^sub>R c"] linear_scaleR injective_scaleR[of c] assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2964
  by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2965
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2966
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
  2967
  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
  2968
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2969
  shows "(op *\<^sub>R c) ` (rel_interior S) = rel_interior ((op *\<^sub>R c) ` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2970
  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
  2971
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2972
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
  2973
  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
  2974
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2975
    and "rel_open S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2976
  shows "convex ((op *\<^sub>R c) ` S) \<and> rel_open ((op *\<^sub>R c) ` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2977
  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
  2978
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2979
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
  2980
  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
  2981
    and "finite I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2982
  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
  2983
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
  2984
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2985
  then have "\<Inter>I = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2986
    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
  2987
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2988
    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
  2989
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2990
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2991
  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
  2992
    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
  2993
    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
  2994
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2995
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2996
    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
  2997
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2998
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2999
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
  3000
  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
  3001
  assumes "linear f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3002
    and "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3003
    and "rel_open S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3004
  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
  3005
  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
  3006
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3007
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
  3008
  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
  3009
  assumes "linear f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3010
    and "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3011
    and "rel_open S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3012
  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
  3013
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
  3014
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3015
  then have "f -` S = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3016
    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
  3017
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3018
    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
  3019
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3020
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3021
  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
  3022
    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
  3023
    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
  3024
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3025
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3026
    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
  3027
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3028
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3029
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3030
lemma rel_interior_projection:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3031
  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
  3032
    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
  3033
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3034
    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
  3035
  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
  3036
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3037
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3038
    fix y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3039
    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
  3040
    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
  3041
      using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3042
    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
  3043
      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
  3044
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3045
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3046
    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
  3047
      by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3048
    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
  3049
      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
  3050
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3051
  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
  3052
    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
  3053
  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
  3054
    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
  3055
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3056
    fix y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3057
    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
  3058
    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
  3059
      using h1 by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3060
    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
  3061
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3062
    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
  3063
      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
  3064
    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
  3065
      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
  3066
    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
  3067
      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
  3068
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3069
      fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3070
      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
  3071
      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
  3072
        using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3073
      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
  3074
      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
  3075
        by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3076
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3077
    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
  3078
      using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3079
    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
  3080
      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
  3081
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3082
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3083
      fix z
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3084
      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
  3085
      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
  3086
        using *** by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3087
      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
  3088
        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
  3089
      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
  3090
        by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3091
      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
  3092
        using ** by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3093
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3094
    moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3095
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3096
      fix z
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3097
      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
  3098
      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
  3099
        using ** by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3100
      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
  3101
        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
  3102
      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
  3103
        using *** by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3104
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3105
    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
  3106
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3107
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3108
  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
  3109
    (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
  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 y z
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3113
    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
  3114
    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
  3115
      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
  3116
    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
  3117
      using h1 by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3118
    then have "y \<in> rel_interior {t. f t \<noteq> {}}" and "(z : rel_interior (f y))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3119
      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
  3120
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3121
  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
  3122
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3123
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3124
lemma rel_frontier_Times:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3125
  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
  3126
    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
  3127
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3128
    and "convex T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3129
  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
  3130
    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
  3131
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3132
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3133
subsubsection \<open>Relative interior of convex cone\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3134
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3135
lemma cone_rel_interior:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3136
  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
  3137
  assumes "cone S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3138
  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
  3139
proof (cases "S = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3140
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3141
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3142
    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
  3143
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3144
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3145
  then have *: "0 \<in> S \<and> (\<forall>c. c > 0 \<longrightarrow> op *\<^sub>R c ` S = S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3146
    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
  3147
  then have *: "0 \<in> ({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
  3148
    and "\<forall>c. c > 0 \<longrightarrow> op *\<^sub>R c ` ({0} \<union> rel_interior S) = ({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
  3149
    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
  3150
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3151
    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
  3152
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3153
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3154
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
  3155
  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
  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
  shows "(c, x) \<in> rel_interior (cone hull ({(1 :: real)} \<times> S)) \<longleftrightarrow>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3158
    c > 0 \<and> x \<in> ((op *\<^sub>R c) ` (rel_interior S))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3159
proof (cases "S = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3160
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3161
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3162
    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
  3163
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3164
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3165
  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
  3166
  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
  3167
    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
  3168
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3169
  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
  3170
  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
  3171
    (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
  3172
    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
  3173
    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
  3174
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3175
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3176
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3177
    fix y :: real
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3178
    assume "y \<ge> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3179
    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
  3180
      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
  3181
    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
  3182
      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
  3183
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3184
  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
  3185
    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
  3186
  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
  3187
    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
  3188
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3189
    fix c :: real
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3190
    assume "c > 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3191
    then have "f c = (op *\<^sub>R c ` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3192
      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
  3193
    then have "rel_interior (f c) = op *\<^sub>R c ` rel_interior S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3194
      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
  3195
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3196
  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
  3197
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3198
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3199
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
  3200
  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
  3201
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3202
  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
  3203
    {(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
  3204
  (is "?lhs = ?rhs")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3205
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3206
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3207
    fix z
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3208
    assume "z \<in> ?lhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3209
    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
  3210
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3211
    have "z \<in> ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3212
      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
  3213
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3214
      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
  3215
      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
  3216
      using *
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3217
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3218
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3219
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3220
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3221
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3222
    fix z
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3223
    assume "z \<in> ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3224
    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
  3225
      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
  3226
      by auto
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
  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
  3229
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3230
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3231
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
  3232
  assumes "finite I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3233
  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
  3234
  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
  3235
    {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
  3236
  (is "?lhs = ?rhs")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3237
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3238
  have "?lhs \<supseteq> ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3239
  proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3240
    fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3241
    assume "x : ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3242
    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
  3243
      "(\<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
  3244
    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
  3245
      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
  3246
    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
  3247
      unfolding *(1)[symmetric]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3248
      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
  3249
      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
  3250
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3251
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3252
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3253
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3254
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3255
    fix i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3256
    assume "i \<in> I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3257
    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
  3258
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3259
  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
  3260
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3261
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3262
    fix i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3263
    assume "i \<in> I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3264
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3265
      fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3266
      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
  3267
      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
  3268
      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
  3269
        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
  3270
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3271
      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
  3272
      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
  3273
        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
  3274
      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
  3275
        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
  3276
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3277
      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
  3278
        apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3279
        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
  3280
        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
  3281
        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
  3282
        apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3283
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3284
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3285
    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
  3286
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3287
  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
  3288
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
    fix u v :: real
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3291
    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
  3292
    fix x y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3293
    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
  3294
    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
  3295
      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
  3296
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3297
    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
  3298
      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
  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 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
  3301
    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
  3302
      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
  3303
    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
  3304
      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
  3305
    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
  3306
      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
  3307
    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
  3308
      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
  3309
    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
  3310
      for i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3311
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3312
      fix i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3313
      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
  3314
      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
  3315
      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
  3316
        case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3317
        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
  3318
      next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3319
        case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3320
        then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3321
          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
  3322
            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
  3323
            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
  3324
          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
  3325
      qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3326
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3327
    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
  3328
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3329
      fix i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3330
      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
  3331
      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
  3332
      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
  3333
        case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3334
        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
  3335
          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
  3336
        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
  3337
          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
  3338
        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
  3339
        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
  3340
      next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3341
        case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3342
        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
  3343
          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
  3344
        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
  3345
               = (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
  3346
        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
  3347
      qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3348
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3349
    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
  3350
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3351
    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
  3352
      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
  3353
    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
  3354
      using * by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3355
    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
  3356
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3357
    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
  3358
      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
  3359
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3360
  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
  3361
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3362
    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
  3363
    by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3364
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3365
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3366
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
  3367
  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
  3368
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3369
    and "S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3370
    and "convex T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3371
    and "T \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3372
  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
  3373
    {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
  3374
  (is "?lhs = ?rhs")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3375
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3376
  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
  3377
  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
  3378
  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
  3379
    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
  3380
  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
  3381
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3382
  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
  3383
    {\<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
  3384
      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
  3385
      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
  3386
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3387
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3388
  moreover have
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3389
    "{\<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
  3390
    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
  3391
  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
  3392
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3393
    fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3394
    assume "x \<in> ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3395
    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
  3396
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3397
    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
  3398
      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
  3399
    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
  3400
      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
  3401
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3402
  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
  3403
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3404
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3405
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3406
subsection \<open>Convexity on direct sums\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3407
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3408
lemma closure_sum:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3409
  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
  3410
  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
  3411
  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
  3412
  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
  3413
    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
  3414
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3415
lemma rel_interior_sum:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3416
  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
  3417
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3418
    and "convex T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3419
  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
  3420
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3421
  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
  3422
    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
  3423
  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
  3424
    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
  3425
  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
  3426
    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
  3427
      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
  3428
    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
  3429
  finally show ?thesis ..
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3430
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3431
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3432
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
  3433
  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
  3434
  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
  3435
  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
  3436
  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
  3437
  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
  3438
  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
  3439
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3440
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3441
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
  3442
  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
  3443
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3444
    and "rel_open S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3445
    and "convex T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3446
    and "rel_open T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3447
  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
  3448
  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
  3449
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3450
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
  3451
  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
  3452
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3453
    and "rel_open S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3454
    and "convex T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3455
    and "rel_open T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3456
  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
  3457
  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
  3458
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3459
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
  3460
  assumes "finite I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3461
    and "I \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3462
  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
  3463
  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
  3464
  (is "?lhs = ?rhs")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3465
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3466
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3467
    fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3468
    assume "x \<in> ?lhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3469
    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
  3470
      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
  3471
      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
  3472
    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
  3473
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3474
      fix i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3475
      assume "i \<in> I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3476
      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
  3477
        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
  3478
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3479
    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
  3480
    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
  3481
    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
  3482
      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
  3483
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3484
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3485
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3486
    fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3487
    assume "x \<in> ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3488
    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
  3489
      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
  3490
    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
  3491
    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
  3492
      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
  3493
    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
  3494
      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
  3495
    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
  3496
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3497
    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
  3498
      using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3499
    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
  3500
      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
  3501
      using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3502
      apply blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3503
      using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3504
      apply blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3505
      apply rule
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3506
      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
  3507
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3508
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3509
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3510
  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
  3511
qed
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
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
  3514
  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
  3515
  assumes "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3516
    and "cone S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3517
    and "S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3518
  assumes "convex T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3519
    and "cone T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3520
    and "T \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3521
  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
  3522
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3523
  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
  3524
  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
  3525
  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
  3526
    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
  3527
  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
  3528
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3529
  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
  3530
    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
  3531
    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
  3532
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3533
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3534
  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
  3535
    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
  3536
    unfolding set_plus_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3537
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3538
    unfolding set_plus_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3539
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3540
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3541
  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
  3542
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3543
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3544
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
  3545
  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
  3546
  assumes "finite I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3547
    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
  3548
  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
  3549
    {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
  3550
      (\<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
  3551
  (is "?lhs = ?rhs")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3552
proof (cases "I = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3553
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3554
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3555
    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
  3556
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3557
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3558
  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
  3559
  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
  3560
    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
  3561
  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
  3562
  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
  3563
  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
  3564
    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
  3565
    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
  3566
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3567
    fix i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3568
    assume "i \<in> I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3569
    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
  3570
      unfolding K_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3571
      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
  3572
      apply (subst convex_Times)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3573
      using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3574
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3575
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3576
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3577
  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
  3578
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3579
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3580
    fix i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3581
    assume "i \<in> I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3582
    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
  3583
      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
  3584
      apply (subst hull_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3585
      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
  3586
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3587
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3588
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3589
  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
  3590
  moreover have "convex K0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3591
    unfolding K0_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3592
    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
  3593
    apply (subst convex_Times)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3594
    unfolding C0_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3595
    using convex_convex_hull
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3596
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3597
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3598
  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
  3599
    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
  3600
  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
  3601
    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
  3602
  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
  3603
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3604
  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
  3605
    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
  3606
  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
  3607
    unfolding C0_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3608
    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
  3609
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3610
  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
  3611
    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
  3612
    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
  3613
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3614
    unfolding K_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3615
    using cone_cone_hull
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3616
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3617
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3618
  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
  3619
    unfolding K0_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3620
    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
  3621
    by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3622
  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
  3623
    using geq by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3624
  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
  3625
    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
  3626
    using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3627
    apply blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3628
    using False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3629
    apply blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3630
    unfolding K_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3631
    apply rule
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3632
    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
  3633
    apply (subst convex_Times)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3634
    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
  3635
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3636
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3637
  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
  3638
  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
  3639
    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
  3640
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3641
    fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3642
    assume "x \<in> ?lhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3643
    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
  3644
      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
  3645
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3646
    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
  3647
      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
  3648
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3649
      fix i
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3650
      assume "i \<in> I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3651
      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
  3652
        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
  3653
      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
  3654
        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
  3655
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3656
    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
  3657
      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
  3658
      by metis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3659
    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
  3660
      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
  3661
    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
  3662
      using k
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3663
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3664
      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
  3665
      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
  3666
      using cs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3667
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3668
      done
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
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3671
  {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3672
    fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3673
    assume "x \<in> ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3674
    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
  3675
        (\<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
  3676
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3677
    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
  3678
    {
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3679
      fix i assume "i:I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3680
      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
  3681
        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
  3682
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3683
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3684
    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
  3685
      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
  3686
      apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3687
      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
  3688
      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
  3689
      done
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> ?lhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3691
      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
  3692
      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
  3693
  }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3694
  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
  3695
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3696
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3697
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3698
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
  3699
  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
  3700
  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
  3701
    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
  3702
    and "y \<in> I"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3703
  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
  3704
  (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
  3705
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
  3706
  assume "x < y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3707
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3708
  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
  3709
  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
  3710
  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
  3711
  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
  3712
  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
  3713
    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
  3714
  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
  3715
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3716
  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
  3717
  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
  3718
  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
  3719
  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
  3720
  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
  3721
    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
  3722
  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
  3723
    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
  3724
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3725
  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
  3726
  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
  3727
    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
  3728
      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
  3729
    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
  3730
      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
  3731
      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
  3732
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3733
    fix y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3734
    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
  3735
    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
  3736
    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
  3737
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3738
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3739
    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
  3740
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3741
  assume "y < x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3742
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3743
  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
  3744
  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
  3745
  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
  3746
  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
  3747
  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
  3748
    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
  3749
  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
  3750
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3751
  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
  3752
  proof (rule cInf_greatest)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3753
    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
  3754
      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
  3755
    also
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3756
    fix z
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3757
    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
  3758
    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
  3759
    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
  3760
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3761
    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
  3762
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3763
    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
  3764
    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
  3765
    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
  3766
    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
  3767
      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
  3768
    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
  3769
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3770
    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
  3771
      by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3772
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3773
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3774
    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
  3775
qed simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3776
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3777
subsection\<open>Explicit formulas for interior and relative interior of convex hull\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3778
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3779
lemma interior_atLeastAtMost [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3780
  fixes a::real shows "interior {a..b} = {a<..<b}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3781
  using interior_cbox [of a b] by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3782
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3783
lemma interior_atLeastLessThan [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3784
  fixes a::real shows "interior {a..<b} = {a<..<b}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3785
  by (metis atLeastLessThan_def greaterThanLessThan_def interior_atLeastAtMost interior_Int interior_interior interior_real_semiline)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3786
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3787
lemma interior_lessThanAtMost [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3788
  fixes a::real shows "interior {a<..b} = {a<..<b}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3789
  by (metis atLeastAtMost_def greaterThanAtMost_def interior_atLeastAtMost interior_Int
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3790
            interior_interior interior_real_semiline)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3791
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3792
lemma at_within_closed_interval:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3793
    fixes x::real
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3794
    shows "a < x \<Longrightarrow> x < b \<Longrightarrow> (at x within {a..b}) = at x"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3795
  by (metis at_within_interior greaterThanLessThan_iff interior_atLeastAtMost)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3796
66765
c1dfa973b269 new theorem at_within_cbox_finite
paulson <lp15@cam.ac.uk>
parents: 66641
diff changeset
  3797
lemma at_within_cbox_finite:
c1dfa973b269 new theorem at_within_cbox_finite
paulson <lp15@cam.ac.uk>
parents: 66641
diff changeset
  3798
  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
  3799
  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
  3800
proof -
c1dfa973b269 new theorem at_within_cbox_finite
paulson <lp15@cam.ac.uk>
parents: 66641
diff changeset
  3801
  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
  3802
    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
  3803
  then show ?thesis
c1dfa973b269 new theorem at_within_cbox_finite
paulson <lp15@cam.ac.uk>
parents: 66641
diff changeset
  3804
    using at_within_interior assms by fastforce
c1dfa973b269 new theorem at_within_cbox_finite
paulson <lp15@cam.ac.uk>
parents: 66641
diff changeset
  3805
qed
c1dfa973b269 new theorem at_within_cbox_finite
paulson <lp15@cam.ac.uk>
parents: 66641
diff changeset
  3806
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3807
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
  3808
  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
  3809
  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
  3810
    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
  3811
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3812
  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
  3813
    { fix u v x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3814
      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
  3815
                 "(\<Sum>x\<in>s. v x *\<^sub>R x) = (\<Sum>v\<in>t. u v *\<^sub>R v)" "x \<in> t"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3816
      then have s: "s = (s - t) \<union> t" \<comment>\<open>split into separate cases\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3817
        using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3818
      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
  3819
                   "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
  3820
        using uv fin s
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3821
        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
  3822
      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
  3823
           "(\<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
  3824
        using uv fin
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3825
        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
  3826
    } note [simp] = this
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3827
  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
  3828
    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
  3829
  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
  3830
    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
  3831
  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
  3832
    using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3833
    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
  3834
    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
  3835
    apply (auto simp: fin)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3836
    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
  3837
    apply (rename_tac v)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3838
    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
  3839
    apply (force)+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3840
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3841
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3842
    by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3843
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3844
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3845
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
  3846
  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
  3847
  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
  3848
    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
  3849
proof (cases "s = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3850
  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
  3851
    using assms by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3852
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3853
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3854
    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
  3855
      by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3856
    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
  3857
      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
  3858
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3859
    using assms t fin
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3860
      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
  3861
      apply (rule subset_antisym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3862
      apply force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3863
      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
  3864
      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
  3865
      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
  3866
      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
  3867
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3868
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3869
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3870
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
  3871
  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
  3872
  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
  3873
    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
  3874
  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
  3875
  apply (rule antisym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3876
  using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3877
  apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3878
  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
  3879
  done
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 empty_interior_affine_hull:
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 "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
  3884
    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
  3885
  using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3886
  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
  3887
  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
  3888
  apply (rule empty_interior_lowdim)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3889
  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
  3890
  apply (metis Suc_le_lessD not_less order_trans card_image_le finite_imageI dim_le_card)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3891
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3892
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3893
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
  3894
  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
  3895
  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
  3896
    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
  3897
  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
  3898
            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
  3899
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3900
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
  3901
  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
  3902
  shows "finite s
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3903
         \<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
  3904
             \<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
  3905
  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
  3906
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3907
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
  3908
  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
  3909
  shows "finite s
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3910
         \<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
  3911
             \<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
  3912
  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
  3913
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3914
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
  3915
  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
  3916
  assumes "~ affine_dependent s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3917
  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
  3918
         {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
  3919
         (is "?lhs = ?rhs")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3920
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3921
  show "?rhs \<le> ?lhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3922
    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
  3923
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3924
  show "?lhs \<le> ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3925
  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
  3926
    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
  3927
      by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3928
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3929
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3930
    have fs: "finite s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3931
      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
  3932
    { 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
  3933
      assume ab: "a \<in> s" "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
  3934
      then have s: "s = (s - {a,b}) \<union> {a,b}" \<comment>\<open>split into separate cases\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3935
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3936
      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
  3937
           "(\<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
  3938
        using ab fs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3939
        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
  3940
    } note [simp] = this
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3941
    { fix y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3942
      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
  3943
      { fix u T a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3944
        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
  3945
           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
  3946
           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
  3947
        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
  3948
          using ua by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3949
        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
  3950
          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
  3951
        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
  3952
          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
  3953
        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
  3954
          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
  3955
        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
  3956
          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
  3957
        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
  3958
          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
  3959
        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
  3960
          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
  3961
        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
  3962
                            "sum v s = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3963
                            "(\<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
  3964
          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
  3965
          by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3966
        then have False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3967
          using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3968
          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
  3969
          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
  3970
          using ua b d
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3971
          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
  3972
          done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3973
      } note * = this
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3974
      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
  3975
        using y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3976
        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
  3977
        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
  3978
        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
  3979
        apply (auto intro: *)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3980
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3981
    } 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
  3982
      by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3983
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3984
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3985
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3986
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
  3987
  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
  3988
  shows
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3989
   "~ affine_dependent s
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3990
        ==> interior(convex hull s) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3991
             (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
  3992
              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
  3993
  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
  3994
  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
  3995
  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
  3996
  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
  3997
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3998
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
  3999
  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
  4000
  assumes "~ affine_dependent s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4001
  shows
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4002
   "interior(convex hull s) =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4003
             (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
  4004
              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
  4005
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4006
  { 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
  4007
    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
  4008
    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
  4009
      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
  4010
    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
  4011
    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
  4012
      case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4013
      then show thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4014
        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
  4015
    next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4016
      case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4017
      then show thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4018
      by (blast intro: that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4019
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4020
    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
  4021
      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
  4022
    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
  4023
      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
  4024
      using a b u
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4025
      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
  4026
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4027
    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
  4028
      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
  4029
  } note [simp] = this
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4030
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4031
    using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4032
    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
  4033
    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
  4034
    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
  4035
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4036
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4037
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4038
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
  4039
  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
  4040
  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
  4041
    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
  4042
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
  4043
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4044
  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
  4045
    using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4046
    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
  4047
  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
  4048
    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
  4049
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4050
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4051
lemma interior_open_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4052
  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
  4053
  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
  4054
                 (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
  4055
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
  4056
  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
  4057
  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
  4058
    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
  4059
    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
  4060
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4061
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4062
  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
  4063
  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
  4064
  proof (cases "a = b")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4065
    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
  4066
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4067
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4068
    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
  4069
      apply simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4070
      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
  4071
      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
  4072
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4073
    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
  4074
      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
  4075
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4076
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4077
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4078
lemma interior_closed_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4079
  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
  4080
  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
  4081
                 (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
  4082
proof (cases "a = b")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4083
  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
  4084
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4085
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4086
  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
  4087
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4088
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4089
    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
  4090
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4091
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4092
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
  4093
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4094
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
  4095
  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
  4096
  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
  4097
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4098
  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
  4099
  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
  4100
  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
  4101
    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
  4102
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4103
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4104
    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
  4105
    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
  4106
      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
  4107
    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
  4108
    proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4109
      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
  4110
        using abcd by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4111
      then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4112
        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
  4113
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4114
    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
  4115
      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
  4116
    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
  4117
      using neq by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4118
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4119
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4120
  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
  4121
  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
  4122
    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
  4123
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4124
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4125
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
  4126
  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
  4127
  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
  4128
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
  4129
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4130
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
  4131
  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
  4132
  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
  4133
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
  4134
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4135
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
  4136
  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
  4137
  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
  4138
        (is "?lhs = ?rhs")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4139
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4140
  assume abcd: ?lhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4141
  show ?rhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4142
  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
  4143
    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
  4144
      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
  4145
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4146
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4147
    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
  4148
    with abcd show ?rhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4149
      unfolding open_segment_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4150
      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
  4151
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4152
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4153
  assume ?rhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4154
  then show ?lhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4155
    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
  4156
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4157
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4158
subsection\<open>Similar results for closure and (relative or absolute) frontier.\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4159
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4160
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
  4161
  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
  4162
  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
  4163
  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
  4164
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4165
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
  4166
  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
  4167
  assumes "~ affine_dependent s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4168
  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
  4169
         {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
  4170
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4171
  have fs: "finite s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4172
    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
  4173
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4174
    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
  4175
    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
  4176
    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
  4177
    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
  4178
    apply force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4179
    apply (rename_tac v)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4180
    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
  4181
    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
  4182
    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
  4183
    apply (auto simp: fs)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4184
    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
  4185
    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
  4186
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4187
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4188
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4189
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
  4190
  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
  4191
  assumes "~ affine_dependent s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4192
  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
  4193
         {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
  4194
             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
  4195
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4196
  have fs: "finite s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4197
    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
  4198
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4199
  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
  4200
    case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4201
    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
  4202
      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
  4203
                    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
  4204
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4205
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4206
    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
  4207
      by linarith
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4208
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4209
      using assms fs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4210
      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
  4211
      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
  4212
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4213
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4214
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4215
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4216
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
  4217
  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
  4218
  assumes "~ affine_dependent s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4219
  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
  4220
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4221
  have fs: "finite s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4222
    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
  4223
  { fix u a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4224
  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
  4225
            \<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
  4226
                  (\<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
  4227
                      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
  4228
    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
  4229
    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
  4230
    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
  4231
    done }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4232
  moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4233
  { fix a u
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4234
    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
  4235
            \<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
  4236
                 (\<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
  4237
    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
  4238
    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
  4239
    done }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4240
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4241
    using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4242
    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
  4243
    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
  4244
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4245
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4246
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4247
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
  4248
  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
  4249
  assumes "~ affine_dependent s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4250
  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
  4251
           (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
  4252
  using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4253
  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
  4254
  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
  4255
                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
  4256
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4257
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
  4258
  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
  4259
  assumes "~ affine_dependent s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4260
  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
  4261
           (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
  4262
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
  4263
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4264
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
  4265
  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
  4266
  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
  4267
  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
  4268
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
  4269
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4270
  with assms show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4271
    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
  4272
    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
  4273
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4274
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4275
  { 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
  4276
    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
  4277
      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
  4278
    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
  4279
      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
  4280
  } note [dest!] = this
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4281
  show ?thesis using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4282
    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
  4283
    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
  4284
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4285
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4286
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
  4287
  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
  4288
  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
  4289
  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
  4290
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
  4291
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
  4292
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4293
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
  4294
  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
  4295
  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
  4296
  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
  4297
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4298
  { fix a b
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4299
    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
  4300
    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
  4301
      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
  4302
    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
  4303
      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
  4304
  } then
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4305
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4306
    using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4307
    apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4308
    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
  4309
    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
  4310
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4311
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4312
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4313
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4314
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
  4315
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4316
definition coplanar  where
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4317
   "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
  4318
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4319
lemma collinear_affine_hull:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4320
  "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
  4321
proof (cases "s={}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4322
  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
  4323
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4324
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4325
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4326
  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
  4327
  { fix u
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4328
    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
  4329
    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
  4330
      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
  4331
      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
  4332
      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
  4333
      apply (rename_tac c)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4334
      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
  4335
      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
  4336
      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
  4337
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4338
  } moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4339
  { 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
  4340
    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
  4341
    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
  4342
      apply (drule subsetD [OF *])+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4343
      apply simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4344
      apply clarify
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4345
      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
  4346
      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
  4347
      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
  4348
      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
  4349
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4350
  } ultimately
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4351
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4352
  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
  4353
    by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4354
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4355
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4356
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
  4357
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
  4358
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4359
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
  4360
  unfolding open_segment_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4361
  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
  4362
    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
  4363
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4364
lemma collinear_between_cases:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4365
  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
  4366
  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
  4367
         (is "?lhs = ?rhs")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4368
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4369
  assume ?lhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4370
  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
  4371
    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
  4372
  show ?rhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4373
    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
  4374
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4375
  assume ?rhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4376
  then show ?lhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4377
    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
  4378
    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
  4379
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4380
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4381
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4382
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
  4383
  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
  4384
  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
  4385
  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
  4386
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
  4387
           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
  4388
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4389
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
  4390
  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
  4391
  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
  4392
      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
  4393
  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
  4394
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4395
  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
  4396
    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
  4397
  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
  4398
  proof (cases "a = b")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4399
    case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4400
    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
  4401
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4402
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4403
    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
  4404
      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
  4405
    moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4406
    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
  4407
    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
  4408
      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
  4409
      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
  4410
        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
  4411
      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
  4412
        by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4413
      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
  4414
        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
  4415
      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
  4416
        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
  4417
      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
  4418
      proof (rule between_antisym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4419
        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
  4420
          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
  4421
        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
  4422
          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
  4423
      qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4424
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4425
    moreover
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4426
    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
  4427
    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
  4428
      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
  4429
      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
  4430
        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
  4431
      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
  4432
        by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4433
      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
  4434
        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
  4435
      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
  4436
        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
  4437
      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
  4438
      proof (rule between_antisym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4439
        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
  4440
          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
  4441
        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
  4442
          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
  4443
      qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4444
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4445
    ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4446
      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
  4447
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4448
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4449
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4450
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
  4451
  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
  4452
  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
  4453
      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
  4454
    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
  4455
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4456
  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
  4457
    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
  4458
  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
  4459
    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
  4460
    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
  4461
  finally show ?thesis .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4462
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4463
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4464
lemma collinear_imp_coplanar:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4465
  "collinear s ==> coplanar s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4466
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
  4467
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4468
lemma collinear_small:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4469
  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
  4470
    shows "collinear s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4471
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4472
  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
  4473
    using assms by linarith
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4474
  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
  4475
    using card_eq_SucD
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4476
    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
  4477
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4478
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4479
lemma coplanar_small:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4480
  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
  4481
    shows "coplanar s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4482
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4483
  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
  4484
    using assms by linarith
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4485
  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
  4486
    apply safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4487
    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
  4488
    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
  4489
    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
  4490
    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
  4491
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4492
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4493
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4494
lemma coplanar_empty: "coplanar {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4495
  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
  4496
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4497
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
  4498
  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
  4499
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4500
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
  4501
  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
  4502
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4503
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
  4504
  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
  4505
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4506
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
  4507
  unfolding collinear_affine_hull
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4508
  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
  4509
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4510
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
  4511
  unfolding coplanar_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4512
  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
  4513
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4514
lemma coplanar_linear_image:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4515
  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
  4516
  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
  4517
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4518
  { fix u v w
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4519
    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
  4520
    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
  4521
      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
  4522
    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
  4523
      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
  4524
  } then
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4525
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4526
    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
  4527
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4528
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4529
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
  4530
  unfolding coplanar_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4531
  apply clarify
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4532
  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
  4533
  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
  4534
  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
  4535
  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
  4536
  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
  4537
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4538
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4539
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
  4540
    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
  4541
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4542
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
  4543
  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
  4544
  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
  4545
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4546
  assume "coplanar s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4547
  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
  4548
    unfolding coplanar_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4549
    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
  4550
    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
  4551
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4552
  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
  4553
    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
  4554
    by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4555
  assume "coplanar (f ` s)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4556
  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
  4557
    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
  4558
  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
  4559
    by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4560
  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
  4561
    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
  4562
  then show "coplanar s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4563
    unfolding coplanar_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4564
    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
  4565
    by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4566
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4567
(*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
  4568
    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
  4569
*)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4570
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4571
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
  4572
  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
  4573
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4574
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
  4575
  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
  4576
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4577
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
  4578
  unfolding collinear_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4579
  apply clarify
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4580
  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
  4581
  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
  4582
  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
  4583
  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
  4584
  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
  4585
  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
  4586
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4587
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4588
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
  4589
  assumes "a \<noteq> b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4590
    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
  4591
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
  4592
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4593
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
  4594
  "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
  4595
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
  4596
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
  4597
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
  4598
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
  4599
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
  4600
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
  4601
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
  4602
done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4603
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4604
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
  4605
  "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
  4606
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
  4607
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4608
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
  4609
  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
  4610
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4611
lemma collinear_3_expand:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4612
   "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
  4613
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4614
  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
  4615
    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
  4616
  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
  4617
    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
  4618
  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
  4619
    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
  4620
  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
  4621
    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
  4622
  finally show ?thesis .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4623
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4624
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4625
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
  4626
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4627
  assume "collinear S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4628
  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
  4629
    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
  4630
  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
  4631
    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
  4632
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4633
  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
  4634
  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
  4635
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4636
  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
  4637
    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
  4638
  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
  4639
    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
  4640
  then have "collinear B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4641
    by (rule collinear_small)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4642
  then show "collinear S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4643
    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
  4644
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4645
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4646
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
  4647
  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
  4648
  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
  4649
  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
  4650
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4651
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4652
lemma midpoint_collinear:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4653
  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
  4654
  assumes "a \<noteq> c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4655
    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
  4656
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4657
  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
  4658
          "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
  4659
          "\<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
  4660
    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
  4661
  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
  4662
    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
  4663
  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
  4664
    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
  4665
    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
  4666
    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
  4667
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4668
  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
  4669
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4670
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4671
lemma between_imp_collinear:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4672
  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
  4673
  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
  4674
    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
  4675
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
  4676
  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
  4677
    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
  4678
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4679
  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
  4680
    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
  4681
    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
  4682
    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
  4683
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4684
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4685
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4686
lemma midpoint_between:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4687
  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
  4688
  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
  4689
proof (cases "a = c")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4690
  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
  4691
    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
  4692
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4693
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4694
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4695
    apply (rule iffI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4696
    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
  4697
    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
  4698
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4699
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4700
lemma collinear_triples:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4701
  assumes "a \<noteq> b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4702
    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
  4703
          (is "?lhs = ?rhs")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4704
proof safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4705
  fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4706
  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
  4707
  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
  4708
    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
  4709
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4710
  assume ?rhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4711
  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
  4712
    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
  4713
  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
  4714
    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
  4715
  show ?lhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4716
    unfolding collinear_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4717
    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
  4718
    apply (clarify dest!: *)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4719
    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
  4720
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4721
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4722
lemma collinear_4_3:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4723
  assumes "a \<noteq> b"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4724
    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
  4725
  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
  4726
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4727
lemma collinear_3_trans:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4728
  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
  4729
    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
  4730
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4731
  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
  4732
    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
  4733
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4734
    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
  4735
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4736
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4737
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
  4738
  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
  4739
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4740
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
  4741
  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
  4742
  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
  4743
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
  4744
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
  4745
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
  4746
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
  4747
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
  4748
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
  4749
done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4750
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4751
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
  4752
  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
  4753
  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
  4754
         \<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
  4755
                {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
  4756
                            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
  4757
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
  4758
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
  4759
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
  4760
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
  4761
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
  4762
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
  4763
apply simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4764
done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4765
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4766
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
  4767
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4768
definition setdist :: "'a::metric_space set \<Rightarrow> 'a set \<Rightarrow> real" where
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4769
  "setdist s t \<equiv>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4770
       (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
  4771
        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
  4772
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4773
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
  4774
  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
  4775
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4776
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
  4777
  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
  4778
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4779
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
  4780
  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
  4781
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4782
lemma le_setdistI:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4783
  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
  4784
    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
  4785
  using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4786
  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
  4787
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4788
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
  4789
  unfolding setdist_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4790
  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
  4791
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4792
lemma le_setdist_iff:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4793
        "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
  4794
        (\<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
  4795
  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
  4796
  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
  4797
  apply (intro iffI conjI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4798
  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
  4799
  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
  4800
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4801
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4802
lemma setdist_ltE:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4803
  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
  4804
    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
  4805
using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4806
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
  4807
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4808
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
  4809
  apply (cases "s = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4810
  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
  4811
  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
  4812
  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
  4813
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4814
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4815
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
  4816
  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
  4817
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4818
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
  4819
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
  4820
  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
  4821
    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
  4822
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4823
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4824
  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
  4825
    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
  4826
    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
  4827
    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
  4828
    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
  4829
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4830
  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
  4831
    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
  4832
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4833
    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
  4834
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4835
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4836
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
  4837
  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
  4838
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4839
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
  4840
  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
  4841
  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
  4842
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4843
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
  4844
  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
  4845
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4846
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
  4847
  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
  4848
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4849
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
  4850
  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
  4851
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4852
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
  4853
  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
  4854
  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
  4855
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4856
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4857
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
  4858
  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
  4859
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4860
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
  4861
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
  4862
  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
  4863
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4864
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4865
  { fix y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4866
    assume "y \<in> t"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4867
    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
  4868
      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
  4869
    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
  4870
      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
  4871
      apply assumption
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4872
      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
  4873
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4874
  } note * = this
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4875
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4876
    apply (rule antisym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4877
     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
  4878
    using False *
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4879
    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
  4880
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4881
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4882
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4883
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
  4884
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
  4885
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4886
lemma setdist_compact_closed:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4887
  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
  4888
  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
  4889
      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
  4890
    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
  4891
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4892
  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
  4893
    using assms by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4894
  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
  4895
    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
  4896
    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
  4897
    apply blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4898
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4899
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4900
    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
  4901
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4902
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4903
lemma setdist_closed_compact:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4904
  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
  4905
  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
  4906
      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
  4907
    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
  4908
  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
  4909
  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
  4910
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4911
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
  4912
  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
  4913
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4914
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
  4915
  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
  4916
  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
  4917
    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
  4918
  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
  4919
  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
  4920
  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
  4921
  done
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
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
  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 \<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
  4927
  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
  4928
  by linarith
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4929
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4930
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
  4931
  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
  4932
  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
  4933
    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
  4934
  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
  4935
  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
  4936
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4937
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
  4938
  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
  4939
  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
  4940
    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
  4941
  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
  4942
  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
  4943
        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
  4944
  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
  4945
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4946
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4947
lemma setdist_unique:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4948
  "\<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
  4949
   \<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
  4950
  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
  4951
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4952
lemma setdist_closest_point:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4953
    "\<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
  4954
  apply (rule setdist_unique)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4955
  using closest_point_le
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4956
  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
  4957
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4958
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4959
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
  4960
    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
  4961
    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
  4962
  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
  4963
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4964
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
  4965
    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
  4966
    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
  4967
  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
  4968
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4969
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
  4970
    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
  4971
    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
  4972
  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
  4973
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4974
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
  4975
    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
  4976
    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
  4977
  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
  4978
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4979
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
  4980
    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
  4981
    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
  4982
  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
  4983
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4984
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
  4985
  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
  4986
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4987
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
  4988
  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
  4989
  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
  4990
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
  4991
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4992
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
  4993
  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
  4994
  shows "\<lbrakk>closedin (subtopology euclidean u) S; x \<in> u\<rbrakk>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4995
         \<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
  4996
  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
  4997
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4998
subsection\<open>Basic lemmas about hyperplanes and halfspaces\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  4999
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5000
lemma hyperplane_eq_Ex:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5001
  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
  5002
  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
  5003
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5004
lemma hyperplane_eq_empty:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5005
     "{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
  5006
  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
  5007
  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
  5008
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5009
lemma hyperplane_eq_UNIV:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5010
   "{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
  5011
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5012
  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
  5013
    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
  5014
    apply simp_all
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5015
    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
  5016
  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
  5017
qed
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 halfspace_eq_empty_lt:
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 \<le> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5021
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5022
  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
  5023
    apply (rule ccontr)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5024
    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
  5025
    apply force+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5026
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5027
  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
  5028
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5029
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5030
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
  5031
   "{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
  5032
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
  5033
by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5034
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5035
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
  5036
   "{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
  5037
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5038
  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
  5039
    apply (rule ccontr)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5040
    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
  5041
    apply force+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5042
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5043
  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
  5044
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5045
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5046
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
  5047
   "{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
  5048
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
  5049
by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5050
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5051
subsection\<open>Use set distance for an easy proof of separation properties\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5052
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5053
proposition separation_closures:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5054
  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
  5055
  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
  5056
  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
  5057
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
  5058
  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
  5059
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5060
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5061
  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
  5062
  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
  5063
    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
  5064
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5065
  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
  5066
    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
  5067
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5068
    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
  5069
      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
  5070
    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
  5071
      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
  5072
    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
  5073
      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
  5074
      using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5075
      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
  5076
    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
  5077
      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
  5078
      using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5079
      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
  5080
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5081
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5082
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5083
lemma separation_normal:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5084
  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
  5085
  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
  5086
  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
  5087
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
  5088
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
  5089
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5090
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5091
lemma separation_normal_local:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5092
  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
  5093
  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
  5094
      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
  5095
      and "S \<inter> T = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5096
  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
  5097
                      "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
  5098
                      "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
  5099
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
  5100
  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
  5101
    apply safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5102
    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
  5103
    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
  5104
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5105
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5106
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5107
  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
  5108
  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
  5109
    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
  5110
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5111
  proof (rule_tac S' = "{x\<in>U. f x > 0}" and T' = "{x\<in>U. 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
  5112
    show "{x \<in> U. 0 < f x} \<inter> {x \<in> U. f x < 0} = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5113
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5114
    have "openin (subtopology euclidean U) {x \<in> U. f x \<in> {0<..}}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5115
      by (rule continuous_openin_preimage [where T=UNIV]) (simp_all add: contf)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5116
    then show "openin (subtopology euclidean U) {x \<in> U. 0 < f x}" by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5117
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5118
    have "openin (subtopology euclidean U) {x \<in> U. f x \<in> {..<0}}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5119
      by (rule continuous_openin_preimage [where T=UNIV]) (simp_all add: contf)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5120
    then show "openin (subtopology euclidean U) {x \<in> U. f x < 0}" by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5121
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5122
    show "S \<subseteq> {x \<in> U. 0 < f x}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5123
      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
  5124
      using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5125
      by (metis False Int_insert_right closedin_imp_subset empty_not_insert insert_absorb insert_subset linorder_neqE_linordered_idom not_le setdist_eq_0_closedin setdist_pos_le)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5126
    show "T \<subseteq> {x \<in> U. f x < 0}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5127
      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
  5128
      using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5129
      by (metis False closedin_subset disjoint_iff_not_equal insert_absorb insert_subset linorder_neqE_linordered_idom not_less setdist_eq_0_closedin setdist_pos_le topspace_euclidean_subtopology)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5130
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5131
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5132
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5133
lemma separation_normal_compact:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5134
  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
  5135
  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
  5136
  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
  5137
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5138
  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
  5139
    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
  5140
  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
  5141
    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
  5142
  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
  5143
    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
  5144
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5145
    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
  5146
    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
  5147
    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
  5148
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5149
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5150
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
  5151
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5152
lemma finite_indexed_bound:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5153
  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
  5154
    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
  5155
using A
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5156
proof (induction A)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5157
  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
  5158
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5159
  case (insert a A)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5160
    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
  5161
      by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5162
    then show ?case
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5163
      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
  5164
      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
  5165
      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
  5166
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5167
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5168
proposition proper_map:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5169
  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
  5170
  assumes "closedin (subtopology euclidean S) K"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5171
      and com: "\<And>U. \<lbrakk>U \<subseteq> T; compact U\<rbrakk> \<Longrightarrow> compact {x \<in> S. f x \<in> U}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5172
      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
  5173
    shows "closedin (subtopology euclidean T) (f ` K)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5174
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5175
  have "K \<subseteq> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5176
    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
  5177
  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
  5178
    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
  5179
  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
  5180
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5181
    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
  5182
      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
  5183
    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
  5184
      by metis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5185
    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
  5186
      by metis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5187
    have "compact (C \<inter> {a \<in> S. 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
  5188
      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
  5189
      apply (rule com)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5190
       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
  5191
      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
  5192
      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
  5193
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5194
    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
  5195
      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
  5196
    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
  5197
             if "finite \<F>"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5198
                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
  5199
                           (\<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
  5200
             for \<F>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5201
    proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5202
      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
  5203
        apply (rule exE)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5204
        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
  5205
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5206
      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
  5207
        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
  5208
      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
  5209
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5210
    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
  5211
               \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5212
      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
  5213
       using comf apply force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5214
      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
  5215
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5216
    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
  5217
      by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5218
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5219
      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
  5220
      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
  5221
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5222
  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
  5223
    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
  5224
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5225
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5226
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5227
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
  5228
  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
  5229
  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
  5230
  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
  5231
           (is "?lhs = ?rhs")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5232
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5233
  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
  5234
    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
  5235
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5236
  assume RHS: ?rhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5237
  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
  5238
    by (metis inv_into_f_f f)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5239
  then have *: "{x \<in> S. f x \<in> U} = g ` U" if "U \<subseteq> f ` S" for U
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5240
    using that by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5241
  have gfim: "g ` f ` S \<subseteq> S" using gf by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5242
  have **: "compact {x \<in> f ` S. g x \<in> C}" if C: "C \<subseteq> S" "compact C" for C
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5243
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5244
    obtain h :: "'a set \<Rightarrow> 'a" where "h C \<in> C \<and> h C \<notin> S \<or> compact (f ` C)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5245
      by (force simp: C RHS)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5246
    moreover have "f ` C = {b \<in> f ` S. g b \<in> C}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5247
      using C gf by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5248
    ultimately show "compact {b \<in> f ` S. g b \<in> C}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5249
      using C by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5250
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5251
  show ?lhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5252
    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
  5253
    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
  5254
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5255
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5256
subsection\<open>Trivial fact: convexity equals connectedness for collinear sets\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5257
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5258
lemma convex_connected_collinear:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5259
  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
  5260
  assumes "collinear S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5261
    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
  5262
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5263
  assume "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5264
  then show "connected S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5265
    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
  5266
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5267
  assume S: "connected S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5268
  show "convex S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5269
  proof (cases "S = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5270
    case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5271
    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
  5272
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5273
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5274
    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
  5275
    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
  5276
      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
  5277
    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
  5278
      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
  5279
    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
  5280
      by metis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5281
    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
  5282
      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
  5283
    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
  5284
    proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5285
      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
  5286
        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
  5287
      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
  5288
        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
  5289
      ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5290
        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
  5291
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5292
    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
  5293
      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
  5294
      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
  5295
    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
  5296
      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
  5297
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5298
    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
  5299
      fix x y z
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5300
      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
  5301
      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
  5302
      proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5303
        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
  5304
          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
  5305
          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
  5306
          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
  5307
        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
  5308
          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
  5309
        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
  5310
          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
  5311
        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
  5312
          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
  5313
        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
  5314
        proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5315
          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
  5316
            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
  5317
             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
  5318
             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
  5319
            done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5320
          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
  5321
            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
  5322
        qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5323
        ultimately show False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5324
          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
  5325
      qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5326
      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
  5327
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5328
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5329
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5330
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5331
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
  5332
  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
  5333
  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
  5334
  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
  5335
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5336
  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
  5337
  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
  5338
    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
  5339
  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
  5340
    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
  5341
  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
  5342
    by metis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5343
  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
  5344
  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
  5345
    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
  5346
  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
  5347
    by (metis inj_onI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5348
  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
  5349
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5350
    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
  5351
      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
  5352
    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
  5353
      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
  5354
    ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5355
      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
  5356
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5357
  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
  5358
    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
  5359
    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
  5360
  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
  5361
    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
  5362
  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
  5363
    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
  5364
  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
  5365
    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
  5366
  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
  5367
    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
  5368
  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
  5369
    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
  5370
  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
  5371
    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
  5372
     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
  5373
    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
  5374
  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
  5375
    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
  5376
  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
  5377
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5378
  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
  5379
    apply safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5380
     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
  5381
    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
  5382
  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
  5383
    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
  5384
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5385
    using that by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5386
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5387
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5388
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
  5389
  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
  5390
  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
  5391
  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
  5392
  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
  5393
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5394
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5395
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
  5396
  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
  5397
  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
  5398
          "closedin (subtopology euclidean T) K"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5399
  shows "compact {x. x \<in> S \<and> f x \<in> K}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5400
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
  5401
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5402
lemma proper_map_fst:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5403
  assumes "compact T" "K \<subseteq> S" "compact K"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5404
    shows "compact {z \<in> S \<times> T. fst z \<in> K}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5405
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5406
  have "{z \<in> S \<times> T. fst z \<in> K} = K \<times> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5407
    using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5408
  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
  5409
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5410
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5411
lemma closed_map_fst:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5412
  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
  5413
  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
  5414
   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
  5415
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5416
  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
  5417
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5418
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5419
    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
  5420
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5421
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5422
lemma proper_map_snd:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5423
  assumes "compact S" "K \<subseteq> T" "compact K"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5424
    shows "compact {z \<in> S \<times> T. snd z \<in> K}"
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 "{z \<in> S \<times> T. snd z \<in> K} = S \<times> K"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5427
    using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5428
  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
  5429
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5430
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5431
lemma closed_map_snd:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5432
  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
  5433
  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
  5434
   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
  5435
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5436
  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
  5437
    by auto
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
    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
  5440
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5441
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5442
lemma closedin_compact_projection:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5443
  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
  5444
  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
  5445
    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
  5446
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5447
  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
  5448
    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
  5449
  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
  5450
    by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5451
  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
  5452
    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
  5453
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5454
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5455
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5456
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5457
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5458
lemma closed_compact_projection:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5459
  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
  5460
    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
  5461
  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
  5462
    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
  5463
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5464
  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
  5465
        {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
  5466
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5467
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5468
    apply (subst *)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5469
    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
  5470
    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
  5471
    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
  5472
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5473
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5474
subsubsection\<open>Representing affine hull as a finite intersection of hyperplanes\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5475
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5476
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
  5477
  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
  5478
  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
  5479
    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
  5480
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5481
  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
  5482
    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
  5483
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5484
  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
  5485
    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
  5486
  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
  5487
    using mem_interior_cball by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5488
  have *: "x \<in> op + a ` span ((\<lambda>x. x - a) ` (S \<inter> T))" 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
  5489
  proof (cases "x = a")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5490
    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
  5491
      by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5492
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5493
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5494
    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
  5495
    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
  5496
      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
  5497
    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
  5498
      by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5499
    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
  5500
      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
  5501
    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
  5502
      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
  5503
    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
  5504
      using e by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5505
    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
  5506
      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
  5507
      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
  5508
    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
  5509
      apply (rule span_mul)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5510
      apply (rule span_superset)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5511
      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
  5512
      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
  5513
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5514
    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
  5515
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5516
  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
  5517
    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
  5518
    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
  5519
    apply (force simp: *)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5520
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5521
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5522
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5523
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
  5524
  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
  5525
  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
  5526
    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
  5527
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
  5528
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5529
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
  5530
  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
  5531
  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
  5532
    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
  5533
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
  5534
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5535
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
  5536
  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
  5537
  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
  5538
    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
  5539
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
  5540
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5541
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
  5542
  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
  5543
  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
  5544
    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
  5545
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
  5546
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
  5547
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5548
corollary affine_hull_openin:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5549
  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
  5550
  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
  5551
    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
  5552
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
  5553
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
  5554
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5555
corollary affine_hull_open:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5556
  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
  5557
  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
  5558
    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
  5559
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
  5560
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5561
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
  5562
  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
  5563
  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
  5564
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
  5565
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5566
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
  5567
  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
  5568
  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
  5569
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
  5570
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5571
lemma affine_hull_Diff:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5572
  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
  5573
  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
  5574
    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
  5575
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5576
  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
  5577
    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
  5578
  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
  5579
    using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5580
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5581
    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
  5582
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5583
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5584
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
  5585
  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
  5586
  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
  5587
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
  5588
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
  5589
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5590
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
  5591
  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
  5592
  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
  5593
proof (cases "a = 0")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5594
  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
  5595
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5596
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5597
  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
  5598
    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
  5599
  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
  5600
    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
  5601
  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
  5602
    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
  5603
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5604
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5605
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
  5606
  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
  5607
  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
  5608
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
  5609
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
  5610
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5611
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
  5612
  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
  5613
  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
  5614
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
  5615
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5616
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
  5617
  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
  5618
  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
  5619
        (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
  5620
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
  5621
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5622
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
  5623
  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
  5624
  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
  5625
        (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
  5626
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5627
  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
  5628
    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
  5629
  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
  5630
    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
  5631
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5632
    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
  5633
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5634
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5635
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
  5636
  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
  5637
  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
  5638
        (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
  5639
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
  5640
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5641
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
  5642
  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
  5643
  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
  5644
        (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
  5645
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
  5646
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5647
subsection\<open>Properties of special hyperplanes\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5648
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5649
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
  5650
  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
  5651
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5652
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
  5653
  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
  5654
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5655
lemma special_hyperplane_span:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5656
  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
  5657
  assumes "k \<in> Basis"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5658
  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
  5659
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5660
  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
  5661
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5662
    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
  5663
      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
  5664
    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
  5665
      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
  5666
    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
  5667
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5668
      by (simp add: Linear_Algebra.span_finite) metis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5669
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5670
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5671
    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
  5672
    using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5673
    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
  5674
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5675
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5676
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5677
lemma dim_special_hyperplane:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5678
  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
  5679
  shows "k \<in> Basis \<Longrightarrow> dim {x. k \<bullet> x = 0} = DIM('n) - 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5680
apply (simp add: special_hyperplane_span)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5681
apply (rule Linear_Algebra.dim_unique [OF subset_refl])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5682
apply (auto simp: Diff_subset independent_substdbasis)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5683
apply (metis member_remove remove_def span_clauses(1))
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5684
done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5685
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5686
proposition dim_hyperplane:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5687
  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
  5688
  assumes "a \<noteq> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5689
    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
  5690
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5691
  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
  5692
    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
  5693
  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
  5694
              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
  5695
              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
  5696
              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
  5697
              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
  5698
    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
  5699
  with assms have "a \<notin> span B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5700
    by (metis (mono_tags, lifting) span_eq inner_eq_zero_iff mem_Collect_eq span0 span_subspace)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5701
  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
  5702
    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
  5703
  have "finite B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5704
    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
  5705
  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
  5706
  proof fix y::'a
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5707
    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
  5708
      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
  5709
      using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5710
      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
  5711
    show "y \<in> span (insert a B)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5712
      by (metis (mono_tags, lifting) z Bsub Convex_Euclidean_Space.span_eq
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5713
         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
  5714
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5715
  then have dima: "DIM('a) = dim(insert a B)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5716
    by (metis antisym dim_UNIV dim_subset_UNIV subset_le_dim)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5717
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5718
    by (metis (mono_tags, lifting) Bsub Diff_insert_absorb \<open>a \<notin> span B\<close> ind card0 card_Diff_singleton dim_span indep_card_eq_dim_span insertI1 subsetCE subspB)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5719
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5720
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5721
lemma lowdim_eq_hyperplane:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5722
  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
  5723
  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
  5724
  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
  5725
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5726
  have [simp]: "dim S < DIM('a)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5727
    by (simp add: DIM_positive assms)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5728
  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
  5729
    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
  5730
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5731
    using b that real_vector_class.subspace_span [of S]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5732
    by (simp add: assms dim_hyperplane subspace_dim_equal subspace_hyperplane)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5733
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5734
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5735
lemma dim_eq_hyperplane:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5736
  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
  5737
  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
  5738
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
  5739
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5740
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
  5741
  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
  5742
  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
  5743
proof (cases "S = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5744
  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
  5745
    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
  5746
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5747
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5748
  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
  5749
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5750
  proof (cases "c = 0")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5751
    case True show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5752
    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
  5753
                del: One_nat_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5754
    apply (rule ex_cong)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5755
    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
  5756
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5757
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5758
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5759
    have xc_im: "x \<in> op + c ` {y. a \<bullet> y = 0}" if "a \<bullet> x = a \<bullet> c" for a x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5760
    proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5761
      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
  5762
        by (metis that add.commute diff_add_cancel inner_commute inner_diff_left right_minus_eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5763
      then show "x \<in> op + c ` {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
  5764
        by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5765
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5766
    have 2: "span ((\<lambda>x. x - c) ` 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
  5767
         if "op + c ` span ((\<lambda>x. x - c) ` S) = {x. a \<bullet> x = b}" for a b
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5768
    proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5769
      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
  5770
        using span_0 that by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5771
      with that have "op + c ` span ((\<lambda>x. x - c) ` S) = {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
  5772
        by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5773
      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
  5774
        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
  5775
      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
  5776
        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
  5777
             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
  5778
      finally show ?thesis .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5779
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5780
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5781
      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
  5782
                  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
  5783
      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
  5784
      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
  5785
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5786
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5787
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5788
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5789
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
  5790
  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
  5791
  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
  5792
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
  5793
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5794
subsection\<open>Some stepping theorems\<close>
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 dim_empty [simp]: "dim ({} :: 'a::euclidean_space set) = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5797
  by (force intro!: dim_unique)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5798
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5799
lemma dim_insert:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5800
  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
  5801
  shows "dim (insert x S) = (if x \<in> span S then dim S else dim S + 1)"
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
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5804
  proof (cases "x \<in> span S")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5805
    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
  5806
      by (metis dim_span span_redundant)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5807
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5808
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5809
    obtain B where B: "B \<subseteq> span S" "independent B" "span S \<subseteq> span B" "card B = dim (span S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5810
      using basis_exists [of "span S"] by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5811
    have 1: "insert x B \<subseteq> span (insert x S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5812
      by (meson \<open>B \<subseteq> span S\<close> dual_order.trans insertI1 insert_subsetI span_mono span_superset subset_insertI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5813
    have 2: "span (insert x S) \<subseteq> span (insert x B)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5814
      by (metis \<open>B \<subseteq> span S\<close> \<open>span S \<subseteq> span B\<close> span_breakdown_eq span_subspace subsetI subspace_span)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5815
    have 3: "independent (insert x B)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5816
      by (metis B independent_insert span_subspace subspace_span False)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5817
    have "dim (span (insert x S)) = Suc (dim S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5818
      apply (rule dim_unique [OF 1 2 3])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5819
      by (metis B False card_insert_disjoint dim_span independent_imp_finite subsetCE)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5820
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5821
      by (simp add: False)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5822
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5823
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5824
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5825
lemma dim_singleton [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5826
  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
  5827
  shows "dim{x} = (if x = 0 then 0 else 1)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5828
by (simp add: dim_insert)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5829
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5830
lemma dim_eq_0 [simp]:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5831
  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
  5832
  shows "dim S = 0 \<longleftrightarrow> S \<subseteq> {0}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5833
apply safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5834
apply (metis DIM_positive DIM_real card_ge_dim_independent contra_subsetD dim_empty dim_insert dim_singleton empty_subsetI independent_empty less_not_refl zero_le)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5835
by (metis dim_singleton dim_subset le_0_eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5836
                  
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5837
lemma aff_dim_insert:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5838
  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
  5839
  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
  5840
proof (cases "S = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5841
  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
  5842
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5843
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5844
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5845
  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
  5846
    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
  5847
  show ?thesis using S
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5848
    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
  5849
    apply (simp add: affine_hull_insert_span_gen hull_inc)
66297
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5850
    apply (simp add: 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
  5851
    apply (metis (no_types, lifting) add_minus_cancel image_iff uminus_add_conv_diff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5852
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5853
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5854
66297
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5855
lemma affine_dependent_choose:
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5856
  fixes a :: "'a :: euclidean_space"
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5857
  assumes "~(affine_dependent S)"
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5858
  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
  5859
        (is "?lhs = ?rhs")
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5860
proof safe
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5861
  assume "affine_dependent (insert a S)" and "a \<in> S"
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5862
  then show "False"
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5863
    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
  5864
next
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5865
  assume lhs: "affine_dependent (insert a S)"
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5866
  then have "a \<notin> S"
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5867
    by (metis (no_types) assms insert_absorb)
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5868
  moreover have "finite S"
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5869
    using affine_independent_iff_card assms by blast
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5870
  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
  5871
    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
  5872
  ultimately show "a \<in> affine hull S"
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5873
    by (metis aff_dim_affine_independent aff_dim_insert assms)
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5874
next
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5875
  assume "a \<notin> S" and "a \<in> affine hull S"
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5876
  show "affine_dependent (insert a S)"
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5877
    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
  5878
qed
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5879
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5880
lemma affine_independent_insert:
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5881
  fixes a :: "'a :: euclidean_space"
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5882
  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
  5883
  by (simp add: affine_dependent_choose)
d425bdf419f5 polytopes: simplical subdivisions, etc.
paulson <lp15@cam.ac.uk>
parents: 66289
diff changeset
  5884
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5885
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
  5886
  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
  5887
  assumes "subspace S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5888
    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
  5889
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5890
  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
  5891
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5892
    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
  5893
      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
  5894
    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
  5895
      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
  5896
    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
  5897
      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
  5898
    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
  5899
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5900
  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
  5901
    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
  5902
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5903
    by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5904
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5905
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5906
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
  5907
  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
  5908
  assumes "affine S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5909
    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
  5910
proof (cases "S = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5911
  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
  5912
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5913
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5914
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5915
  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
  5916
  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
  5917
    apply safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5918
    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
  5919
    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
  5920
                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
  5921
    apply force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5922
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5923
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5924
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5925
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
  5926
  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
  5927
  assumes "affine S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5928
    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
  5929
apply safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5930
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
  5931
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
  5932
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
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
  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
  assumes "a \<noteq> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5937
  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
  5938
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5939
  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
  5940
  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
  5941
    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
  5942
  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
  5943
    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
  5944
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5945
  assume "DIM('a) = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5946
  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
  5947
    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
  5948
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5949
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5950
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
  5951
  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
  5952
  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
  5953
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
  5954
  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
  5955
  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
  5956
    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
  5957
  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
  5958
    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
  5959
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5960
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5961
subsection\<open>General case without assuming closure and getting non-strict separation\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5962
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5963
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
  5964
  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
  5965
  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
  5966
  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
  5967
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5968
  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
  5969
    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
  5970
  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
  5971
    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
  5972
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5973
  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
  5974
    fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5975
    assume "x \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5976
    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
  5977
      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
  5978
    { 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
  5979
      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
  5980
      have False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5981
        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
  5982
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5983
    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
  5984
      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
  5985
    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
  5986
      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
  5987
    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
  5988
      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
  5989
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5990
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5991
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5992
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
  5993
  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
  5994
  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
  5995
  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
  5996
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
  5997
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
  5998
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  5999
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6000
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
  6001
  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
  6002
  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
  6003
  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
  6004
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6005
  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
  6006
  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
  6007
          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
  6008
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6009
    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
  6010
      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
  6011
    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
  6012
      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
  6013
    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
  6014
      by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6015
    moreover have "a /\<^sub>R (norm a) \<in> span S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6016
      by (simp add: \<open>a \<in> S\<close> span_mul span_superset)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6017
    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
  6018
      by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6019
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6020
    proof (cases "C = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6021
      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
  6022
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6023
    next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6024
      case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6025
      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
  6026
        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
  6027
      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
  6028
        by (simp add: False)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6029
      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
  6030
        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
  6031
      ultimately obtain a b
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6032
            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
  6033
                  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
  6034
        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
  6035
      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
  6036
        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
  6037
      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
  6038
        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
  6039
      moreover have "a /\<^sub>R (norm a) \<in> span S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6040
        by (simp add: \<open>a \<in> S\<close> span_mul span_superset)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6041
      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
  6042
        by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6043
      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
  6044
        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
  6045
        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
  6046
        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
  6047
      show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6048
        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
  6049
        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
  6050
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6051
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6052
  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
  6053
    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
  6054
    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
  6055
    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
  6056
    apply (metis *)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6057
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6058
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6059
    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
  6060
    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
  6061
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6062
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6063
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6064
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
  6065
  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
  6066
  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
  6067
  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
  6068
                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
  6069
                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
  6070
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6071
from 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
  6072
  have "convex (op + (- z) ` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6073
    by (simp add: \<open>convex S\<close>)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6074
  moreover have "op + (- z) ` S \<noteq> {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6075
    by (simp add: \<open>S \<noteq> {}\<close>)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6076
  moreover have "0 \<notin> op + (- z) ` S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6077
    using zno by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6078
  ultimately obtain a where "a \<in> span (op + (- z) ` S)" "a \<noteq> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6079
                  and a:  "\<And>x. x \<in> (op + (- z) ` 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
  6080
    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
  6081
    by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6082
  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
  6083
    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
  6084
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6085
    apply (rule_tac a=a and b = "a  \<bullet> z" in that, simp_all)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6086
    using \<open>a \<in> span (op + (- z) ` S)\<close> affine_hull_insert_span_gen apply blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6087
    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
  6088
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6089
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6090
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6091
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
  6092
  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
  6093
  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
  6094
  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
  6095
              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
  6096
              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
  6097
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6098
  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
  6099
                  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
  6100
                  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
  6101
    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
  6102
    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
  6103
  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
  6104
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6105
    have con: "continuous_on (closure (rel_interior S)) (op \<bullet> a)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6106
      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
  6107
    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
  6108
      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
  6109
      by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6110
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6111
      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
  6112
      by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6113
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6114
  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
  6115
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6116
    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
  6117
      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
  6118
    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
  6119
    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
  6120
      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
  6121
    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
  6122
      unfolding y'_def
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6123
      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
  6124
                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
  6125
    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
  6126
      using e by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6127
    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
  6128
      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
  6129
    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
  6130
      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
  6131
      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
  6132
      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
  6133
    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
  6134
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6135
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6136
    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
  6137
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6138
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6139
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
  6140
  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
  6141
  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
  6142
  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
  6143
              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
  6144
              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
  6145
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
  6146
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
  6147
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6148
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6149
subsection\<open> Some results on decomposing convex hulls: intersections, simplicial subdivision\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6150
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6151
lemma
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6152
  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
  6153
  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
  6154
    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
  6155
      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
  6156
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6157
  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
  6158
    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
  6159
    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
  6160
          (\<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
  6161
      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
  6162
                 "sum v t = 1"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6163
         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
  6164
    proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6165
    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
  6166
    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
  6167
      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
  6168
      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
  6169
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6170
    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
  6171
      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
  6172
      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
  6173
          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
  6174
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6175
    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
  6176
      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
  6177
      by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6178
    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
  6179
      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
  6180
    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
  6181
      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
  6182
    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
  6183
      using that by linarith
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6184
    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
  6185
      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
  6186
    ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6187
      by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6188
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6189
    then show ?A ?C
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6190
      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
  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
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6194
proposition affine_hull_Int:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6195
  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
  6196
  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
  6197
    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
  6198
apply (rule subset_antisym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6199
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
  6200
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
  6201
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6202
proposition convex_hull_Int:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6203
  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
  6204
  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
  6205
    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
  6206
apply (rule subset_antisym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6207
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
  6208
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
  6209
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6210
proposition
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6211
  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
  6212
  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
  6213
    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
  6214
      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
  6215
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6216
  have "finite s"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6217
    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
  6218
  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
  6219
  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
  6220
    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
  6221
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6222
    case (insert t F)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6223
    then show ?case
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6224
    proof (cases "F={}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6225
      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
  6226
    next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6227
      case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6228
      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
  6229
        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
  6230
      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
  6231
        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
  6232
      show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6233
        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
  6234
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6235
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6236
  then show "?A" "?C"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6237
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6238
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6239
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6240
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
  6241
  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
  6242
  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
  6243
      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
  6244
      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
  6245
      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
  6246
    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
  6247
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
  6248
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6249
  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
  6250
    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
  6251
  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
  6252
    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
  6253
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6254
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6255
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6256
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6257
  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
  6258
    using assms by auto
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"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6260
    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
  6261
  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
  6262
                  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
  6263
    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
  6264
  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
  6265
    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
  6266
  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
  6267
                     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
  6268
                     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
  6269
                     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
  6270
                     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
  6271
                     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
  6272
    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
  6273
  with fin anot
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6274
  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
  6275
   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
  6276
    by simp_all
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6277
  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
  6278
    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
  6279
  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
  6280
  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
  6281
  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
  6282
  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
  6283
    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
  6284
    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
  6285
  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
  6286
    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
  6287
    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
  6288
  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
  6289
    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
  6290
    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
  6291
                  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
  6292
  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
  6293
    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
  6294
  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
  6295
    using aeq by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6296
  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
  6297
    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
  6298
    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
  6299
  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
  6300
    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
  6301
    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
  6302
    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
  6303
    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
  6304
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6305
  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
  6306
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6307
  proof cases
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6308
    case 1
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6309
    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
  6310
      by (simp add: sumSS')
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6311
    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
  6312
      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
  6313
      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
  6314
    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
  6315
      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
  6316
      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
  6317
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6318
    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
  6319
      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
  6320
        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
  6321
      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
  6322
        by (simp add: c0)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6323
      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
  6324
        by (simp add: anot)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6325
      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
  6326
        apply simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6327
        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
  6328
        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
  6329
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6330
      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
  6331
        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
  6332
      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
  6333
        by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6334
      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
  6335
        by (simp add: anot)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6336
      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
  6337
        apply simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6338
        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
  6339
        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
  6340
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6341
      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
  6342
        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
  6343
      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
  6344
        by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6345
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6346
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6347
    case 2
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6348
    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
  6349
      by (simp add: sumSS')
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6350
    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
  6351
      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
  6352
      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
  6353
    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
  6354
      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
  6355
      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
  6356
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6357
    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
  6358
      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
  6359
        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
  6360
      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
  6361
        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
  6362
      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
  6363
        by (simp add: anot)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6364
      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
  6365
        apply simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6366
        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
  6367
        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
  6368
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6369
      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
  6370
        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
  6371
      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
  6372
        by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6373
      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
  6374
        by (simp add: anot)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6375
      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
  6376
        apply simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6377
        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
  6378
        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
  6379
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6380
      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
  6381
        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
  6382
      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
  6383
        by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6384
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6385
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6386
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6387
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6388
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
  6389
  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
  6390
  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
  6391
  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
  6392
         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
  6393
apply (rule subset_antisym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6394
  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
  6395
  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
  6396
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6397
lemma Int_closed_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6398
  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
  6399
  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
  6400
    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
  6401
proof (cases "c = a")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6402
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6403
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6404
    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
  6405
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6406
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6407
  from assms show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6408
  proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6409
    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
  6410
    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
  6411
      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
  6412
    ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6413
      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
  6414
      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
  6415
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6416
    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
  6417
    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
  6418
    proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6419
      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
  6420
        by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6421
      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
  6422
        by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6423
      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
  6424
        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
  6425
      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
  6426
        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
  6427
        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
  6428
      with ncoll show False ..
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6429
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6430
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6431
      by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6432
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6433
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6434
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6435
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
  6436
  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
  6437
  obtains f where
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6438
     "finite f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6439
     "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
  6440
     "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
  6441
     "\<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
  6442
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6443
  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
  6444
             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
  6445
             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
  6446
    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
  6447
  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
  6448
             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
  6449
    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
  6450
  then have "finite c"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6451
    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
  6452
  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
  6453
    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
  6454
  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
  6455
    by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6456
  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
  6457
    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
  6458
    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
  6459
  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
  6460
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6461
    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
  6462
      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
  6463
    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
  6464
      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
  6465
    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
  6466
      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
  6467
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6468
      using fbc aff
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6469
      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
  6470
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6471
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6472
  proof (cases "c = b")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6473
    case True show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6474
      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
  6475
      using True affc
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6476
      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
  6477
      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
  6478
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6479
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6480
    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
  6481
      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
  6482
    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
  6483
      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
  6484
      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
  6485
      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
  6486
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6487
    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
  6488
            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
  6489
    proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6490
      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
  6491
        using t by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6492
      then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6493
        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
  6494
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6495
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6496
      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
  6497
         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
  6498
        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
  6499
      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
  6500
      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
  6501
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6502
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6503
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6504
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6505
subsection\<open>Misc results about span\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6506
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6507
lemma eq_span_insert_eq:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6508
  assumes "(x - y) \<in> span S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6509
    shows "span(insert x S) = span(insert y S)"
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
  have *: "span(insert x S) \<subseteq> span(insert y S)" if "(x - y) \<in> span S" for x y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6512
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6513
    have 1: "(r *\<^sub>R x - r *\<^sub>R y) \<in> span S" for r
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6514
      by (metis real_vector.scale_right_diff_distrib span_mul that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6515
    have 2: "(z - k *\<^sub>R y) - k *\<^sub>R (x - y) = z - k *\<^sub>R x" for  z k
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6516
      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
  6517
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6518
    apply (clarsimp simp add: span_breakdown_eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6519
    by (metis 1 2 diff_add_cancel real_vector.scale_right_diff_distrib span_add_eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6520
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6521
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6522
    apply (intro subset_antisym * assms)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6523
    using assms subspace_neg subspace_span minus_diff_eq by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6524
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6525
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6526
lemma dim_psubset:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6527
    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
  6528
    shows "span S \<subset> span T \<Longrightarrow> dim S < dim T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6529
by (metis (no_types, hide_lams) dim_span less_le not_le subspace_dim_equal subspace_span)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6530
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6531
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6532
lemma basis_subspace_exists:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6533
  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
  6534
  shows
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6535
   "subspace S
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6536
        \<Longrightarrow> \<exists>b. finite b \<and> b \<subseteq> S \<and>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6537
                independent b \<and> span b = S \<and> card b = dim S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6538
by (metis span_subspace basis_exists independent_imp_finite)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6539
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6540
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
  6541
  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
  6542
  assumes "affine S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6543
     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
  6544
     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
  6545
   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
  6546
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6547
  have "subspace S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6548
    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
  6549
  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
  6550
    apply (rule span_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6551
    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
  6552
  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
  6553
    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
  6554
  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
  6555
    using \<open>w \<in> S\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6556
    by (metis (mono_tags, lifting) inner_zero_right mem_Collect_eq pth_d span_superset)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6557
  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
  6558
    by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6559
  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
  6560
  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
  6561
    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
  6562
  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
  6563
    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
  6564
  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
  6565
  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
  6566
    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
  6567
  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
  6568
    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
  6569
    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
  6570
    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
  6571
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6572
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6573
    by (simp add: subs) (metis (lifting) span_eq subs)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6574
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6575
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6576
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
  6577
  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
  6578
  assumes "affine S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6579
      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
  6580
      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
  6581
    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
  6582
proof (cases "a = 0")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6583
  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
  6584
    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
  6585
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6586
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6587
  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
  6588
    using assms by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6589
  with affine_diffs_subspace [OF \<open>affine S\<close>]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6590
  have "subspace (op + (- c) ` S)" by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6591
  then have aff: "affine (op + (- c) ` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6592
    by (simp add: subspace_imp_affine)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6593
  have 0: "0 \<in> op + (- c) ` S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6594
    by (simp add: \<open>c \<in> S\<close>)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6595
  obtain d where "d \<in> S" and "a \<bullet> d \<noteq> b" and dc: "d-c \<in> op + (- c) ` S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6596
    using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6597
  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
  6598
    by (simp add: c inner_diff_right)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6599
  let ?U = "op + (c+c) ` {x + y |x y. x \<in> op + (- c) ` 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
  6600
  have "u + v \<in> op + (c + c) ` {x + v |x v. x \<in> op + (- c) ` S \<and> a \<bullet> v = 0}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6601
              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
  6602
    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
  6603
    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
  6604
    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
  6605
    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
  6606
    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
  6607
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6608
  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
  6609
       \<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
  6610
    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
  6611
  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
  6612
    by (fastforce simp: algebra_simps)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6613
  also have "... = op + (c+c) ` UNIV"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6614
    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
  6615
  also have "... = UNIV"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6616
    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
  6617
  finally show ?thesis .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6618
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6619
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6620
proposition dim_sums_Int:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6621
    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
  6622
  assumes "subspace S" "subspace T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6623
  shows "dim {x + y |x y. x \<in> S \<and> y \<in> T} + dim(S \<inter> T) = dim S + dim T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6624
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6625
  obtain B where B: "B \<subseteq> S \<inter> T" "S \<inter> T \<subseteq> span B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6626
             and indB: "independent B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6627
             and cardB: "card B = dim (S \<inter> T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6628
    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
  6629
  then obtain C D where "B \<subseteq> C" "C \<subseteq> S" "independent C" "S \<subseteq> span C"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6630
                    and "B \<subseteq> D" "D \<subseteq> T" "independent D" "T \<subseteq> span D"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6631
    using maximal_independent_subset_extend
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6632
    by (metis Int_subset_iff \<open>B \<subseteq> S \<inter> T\<close> indB)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6633
  then have "finite B" "finite C" "finite D"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6634
    by (simp_all add: independent_imp_finite indB independent_bound)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6635
  have Beq: "B = C \<inter> D"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6636
    apply (rule sym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6637
    apply (rule spanning_subset_independent)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6638
    using \<open>B \<subseteq> C\<close> \<open>B \<subseteq> D\<close> apply blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6639
    apply (meson \<open>independent C\<close> independent_mono inf.cobounded1)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6640
    using B \<open>C \<subseteq> S\<close> \<open>D \<subseteq> T\<close> apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6641
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6642
  then have Deq: "D = B \<union> (D - C)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6643
    by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6644
  have CUD: "C \<union> D \<subseteq> {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
  6645
    apply safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6646
    apply (metis add.right_neutral subsetCE \<open>C \<subseteq> S\<close> \<open>subspace T\<close> set_eq_subset span_0 span_minimal)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6647
    apply (metis add.left_neutral subsetCE \<open>D \<subseteq> T\<close> \<open>subspace S\<close> set_eq_subset span_0 span_minimal)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6648
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6649
  have "a v = 0" if 0: "(\<Sum>v\<in>C. a v *\<^sub>R v) + (\<Sum>v\<in>D - C. a 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
  6650
                 and v: "v \<in> C \<union> (D-C)" for a v
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6651
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6652
    have eq: "(\<Sum>v\<in>D - C. a v *\<^sub>R v) = - (\<Sum>v\<in>C. a v *\<^sub>R v)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6653
      using that add_eq_0_iff by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6654
    have "(\<Sum>v\<in>D - C. a v *\<^sub>R v) \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6655
      apply (subst eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6656
      apply (rule subspace_neg [OF \<open>subspace S\<close>])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6657
      apply (rule subspace_sum [OF \<open>subspace S\<close>])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6658
      by (meson subsetCE subspace_mul \<open>C \<subseteq> S\<close> \<open>subspace S\<close>)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6659
    moreover have "(\<Sum>v\<in>D - C. a v *\<^sub>R v) \<in> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6660
      apply (rule subspace_sum [OF \<open>subspace T\<close>])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6661
      by (meson DiffD1 \<open>D \<subseteq> T\<close> \<open>subspace T\<close> subset_eq subspace_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6662
    ultimately have "(\<Sum>v \<in> D-C. a v *\<^sub>R v) \<in> span B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6663
      using B by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6664
    then obtain e where e: "(\<Sum>v\<in>B. e v *\<^sub>R v) = (\<Sum>v \<in> D-C. a v *\<^sub>R v)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6665
      using span_finite [OF \<open>finite B\<close>] by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6666
    have "\<And>c v. \<lbrakk>(\<Sum>v\<in>C. c v *\<^sub>R v) = 0; v \<in> C\<rbrakk> \<Longrightarrow> c v = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6667
      using independent_explicit \<open>independent C\<close> by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6668
    define cc where "cc x = (if x \<in> B then a x + e x else a x)" for x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6669
    have [simp]: "C \<inter> B = B" "D \<inter> B = B" "C \<inter> - B = C-D" "B \<inter> (D - C) = {}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6670
      using \<open>B \<subseteq> C\<close> \<open>B \<subseteq> D\<close> Beq by blast+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6671
    have f2: "(\<Sum>v\<in>C \<inter> D. e v *\<^sub>R v) = (\<Sum>v\<in>D - C. a v *\<^sub>R v)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6672
      using Beq e by presburger
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6673
    have f3: "(\<Sum>v\<in>C \<union> D. a v *\<^sub>R v) = (\<Sum>v\<in>C - D. a v *\<^sub>R v) + (\<Sum>v\<in>D - C. a v *\<^sub>R v) + (\<Sum>v\<in>C \<inter> D. a v *\<^sub>R v)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6674
      using \<open>finite C\<close> \<open>finite D\<close> sum.union_diff2 by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6675
    have f4: "(\<Sum>v\<in>C \<union> (D - C). a v *\<^sub>R v) = (\<Sum>v\<in>C. a v *\<^sub>R v) + (\<Sum>v\<in>D - C. a v *\<^sub>R v)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6676
      by (meson Diff_disjoint \<open>finite C\<close> \<open>finite D\<close> finite_Diff sum.union_disjoint)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6677
    have "(\<Sum>v\<in>C. cc 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
  6678
      using 0 f2 f3 f4
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6679
      apply (simp add: cc_def Beq if_smult \<open>finite C\<close> sum.If_cases algebra_simps sum.distrib)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6680
      apply (simp add: add.commute add.left_commute diff_eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6681
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6682
    then have "\<And>v. v \<in> C \<Longrightarrow> cc v = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6683
      using independent_explicit \<open>independent C\<close> by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6684
    then have C0: "\<And>v. v \<in> C - B \<Longrightarrow> a v = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6685
      by (simp add: cc_def Beq) meson
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6686
    then have [simp]: "(\<Sum>x\<in>C - B. a 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
  6687
      by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6688
    have "(\<Sum>x\<in>C. a x *\<^sub>R x) = (\<Sum>x\<in>B. 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
  6689
    proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6690
      have "C - D = C - B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6691
        using Beq by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6692
      then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6693
        using Beq \<open>(\<Sum>x\<in>C - B. a x *\<^sub>R x) = 0\<close> f3 f4 by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6694
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6695
    with 0 have Dcc0: "(\<Sum>v\<in>D. a 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
  6696
      apply (subst Deq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6697
      by (simp add: \<open>finite B\<close> \<open>finite D\<close> sum_Un)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6698
    then have D0: "\<And>v. v \<in> D \<Longrightarrow> a v = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6699
      using independent_explicit \<open>independent D\<close> by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6700
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6701
      using v C0 D0 Beq by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6702
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6703
  then have "independent (C \<union> (D - C))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6704
    by (simp add: independent_explicit \<open>finite C\<close> \<open>finite D\<close> sum_Un del: Un_Diff_cancel)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6705
  then have indCUD: "independent (C \<union> D)" by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6706
  have "dim (S \<inter> T) = card B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6707
    by (rule dim_unique [OF B indB refl])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6708
  moreover have "dim S = card C"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6709
    by (metis \<open>C \<subseteq> S\<close> \<open>independent C\<close> \<open>S \<subseteq> span C\<close> basis_card_eq_dim)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6710
  moreover have "dim T = card D"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6711
    by (metis \<open>D \<subseteq> T\<close> \<open>independent D\<close> \<open>T \<subseteq> span D\<close> basis_card_eq_dim)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6712
  moreover have "dim {x + y |x y. x \<in> S \<and> y \<in> T} = card(C \<union> D)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6713
    apply (rule dim_unique [OF CUD _ indCUD refl], clarify)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6714
    apply (meson \<open>S \<subseteq> span C\<close> \<open>T \<subseteq> span D\<close> span_add span_inc span_minimal subsetCE subspace_span sup.bounded_iff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6715
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6716
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6717
    using \<open>B = C \<inter> D\<close> [symmetric]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6718
    by (simp add:  \<open>independent C\<close> \<open>independent D\<close> card_Un_Int independent_finite)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6719
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6720
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6721
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6722
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
  6723
  assumes "affine S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6724
      and "affine T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6725
      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
  6726
    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
  6727
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6728
  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
  6729
    using assms by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6730
  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
  6731
    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
  6732
  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
  6733
    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
  6734
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6735
    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
  6736
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6737
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6738
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
  6739
  assumes "affine S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6740
      and "affine T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6741
      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
  6742
    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
  6743
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6744
  obtain a where a: "a \<in> S" "a \<in> T" using assms by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6745
  have aff: "affine (op+ (-a) ` S)"  "affine (op+ (-a) ` T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6746
    using assms by (auto simp: affine_translation [symmetric])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6747
  have zero: "0 \<in> (op+ (-a) ` S)"  "0 \<in> (op+ (-a) ` T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6748
    using a assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6749
  have [simp]: "{x + y |x y. x \<in> op + (- a) ` S \<and> y \<in> op + (- a) ` T} =
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6750
        op + (- 2 *\<^sub>R a) ` {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
  6751
    by (force simp: algebra_simps scaleR_2)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6752
  have [simp]: "op + (- a) ` S \<inter> op + (- a) ` T = op + (- a) ` (S \<inter> T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6753
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6754
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6755
    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
  6756
    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
  6757
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6758
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6759
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
  6760
  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
  6761
  assumes "affine S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6762
    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
  6763
             (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
  6764
              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
  6765
              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
  6766
proof (cases "a = 0")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6767
  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
  6768
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6769
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6770
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6771
  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
  6772
            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
  6773
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6774
    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
  6775
      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
  6776
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6777
      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
  6778
      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
  6779
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6780
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6781
    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
  6782
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6783
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6784
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
  6785
  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
  6786
  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
  6787
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
  6788
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6789
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6790
lemma dim_Times:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6791
  fixes S :: "'a :: euclidean_space set" and T :: "'a set"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6792
  assumes "subspace S" "subspace T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6793
  shows "dim(S \<times> T) = dim S + dim T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6794
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6795
  have ss: "subspace ((\<lambda>x. (x, 0)) ` S)" "subspace (Pair 0 ` T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6796
    by (rule subspace_linear_image, unfold_locales, auto simp: assms)+
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6797
  have "dim(S \<times> T) = dim({u + v |u v. u \<in> (\<lambda>x. (x, 0)) ` S \<and> v \<in> Pair 0 ` T})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6798
    by (simp add: Times_eq_image_sum)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6799
  moreover have "dim ((\<lambda>x. (x, 0::'a)) ` S) = dim S" "dim (Pair (0::'a) ` T) = dim T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6800
    by (auto simp: additive.intro linear.intro linear_axioms.intro inj_on_def intro: dim_image_eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6801
  moreover have "dim ((\<lambda>x. (x, 0)) ` S \<inter> Pair 0 ` T) = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6802
    by (subst dim_eq_0) (force simp: zero_prod_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6803
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6804
    using dim_sums_Int [OF ss] by linarith
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6805
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6806
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6807
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
  6808
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6809
lemma span_delete_0 [simp]: "span(S - {0}) = span S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6810
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6811
  show "span (S - {0}) \<subseteq> span S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6812
    by (blast intro!: span_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6813
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6814
  have "span S \<subseteq> span(insert 0 (S - {0}))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6815
    by (blast intro!: span_mono)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6816
  also have "... \<subseteq> span(S - {0})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6817
    using span_insert_0 by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6818
  finally show "span S \<subseteq> span (S - {0})" .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6819
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6820
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6821
lemma span_image_scale:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6822
  assumes "finite S" and nz: "\<And>x. x \<in> S \<Longrightarrow> c x \<noteq> 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6823
    shows "span ((\<lambda>x. c x *\<^sub>R x) ` S) = span S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6824
using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6825
proof (induction S arbitrary: c)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6826
  case (empty c) show ?case by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6827
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6828
  case (insert x F c)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6829
  show ?case
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6830
  proof (intro set_eqI iffI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6831
    fix y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6832
      assume "y \<in> span ((\<lambda>x. c x *\<^sub>R x) ` insert x F)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6833
      then show "y \<in> span (insert x F)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6834
        using insert by (force simp: span_breakdown_eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6835
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6836
    fix y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6837
      assume "y \<in> span (insert x F)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6838
      then show "y \<in> span ((\<lambda>x. c x *\<^sub>R x) ` insert x F)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6839
        using insert
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6840
        apply (clarsimp simp: span_breakdown_eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6841
        apply (rule_tac x="k / c x" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6842
        by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6843
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6844
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6845
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6846
lemma pairwise_orthogonal_independent:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6847
  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
  6848
    shows "independent S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6849
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6850
  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
  6851
    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
  6852
  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
  6853
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6854
    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
  6855
      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
  6856
    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
  6857
      by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6858
    also have "... = 0"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6859
      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
  6860
      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
  6861
      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
  6862
    finally show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6863
      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
  6864
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6865
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6866
    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
  6867
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6868
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6869
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
  6870
  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
  6871
  assumes "pairwise orthogonal S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6872
    shows "finite S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6873
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6874
  have "independent (S - {0})"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6875
    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
  6876
     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
  6877
    by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6878
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6879
    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
  6880
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6881
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6882
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
  6883
  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
  6884
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6885
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
  6886
  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
  6887
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6888
lemma orthogonal_to_span:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6889
  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
  6890
    shows "orthogonal x a"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6891
apply (rule span_induct [OF a subspace_orthogonal_to_vector])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6892
apply (simp add: x)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6893
done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6894
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6895
proposition Gram_Schmidt_step:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6896
  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
  6897
  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
  6898
    shows "orthogonal x (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
  6899
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6900
  have "finite S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6901
    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
  6902
  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
  6903
       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
  6904
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6905
    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
  6906
      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
  6907
    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
  6908
      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
  6909
      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
  6910
   finally show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6911
     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
  6912
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6913
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6914
    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
  6915
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6916
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6917
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6918
lemma orthogonal_extension_aux:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6919
  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
  6920
  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
  6921
    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
  6922
using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6923
proof (induction arbitrary: S)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6924
  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
  6925
    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
  6926
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6927
  case (insert a T)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6928
  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
  6929
    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
  6930
  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
  6931
  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
  6932
             and spanU: "span (insert a' S \<union> 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
  6933
    apply (rule exE [OF insert.IH [of "insert a' S"]])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6934
    apply (auto simp: Gram_Schmidt_step a'_def insert.prems orthogonal_commute pairwise_orthogonal_insert span_clauses)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6935
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6936
  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
  6937
    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
  6938
    using Gram_Schmidt_step [OF \<open>pairwise orthogonal S\<close>]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6939
    apply (force simp: orthogonal_def inner_commute span_inc [THEN subsetD])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6940
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6941
  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
  6942
    using spanU by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6943
  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
  6944
    apply (rule eq_span_insert_eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6945
    apply (simp add: a'_def span_neg span_sum span_clauses(1) span_mul)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6946
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6947
  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
  6948
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6949
  finally show ?case
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6950
    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
  6951
    using orthU apply auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6952
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6953
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6954
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6955
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6956
proposition orthogonal_extension:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6957
  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
  6958
  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
  6959
  obtains 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
  6960
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6961
  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
  6962
    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
  6963
  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
  6964
  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
  6965
    using assms pairwise_orthogonal_imp_finite by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6966
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6967
    apply (rule_tac U=U in that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6968
     apply (simp add: \<open>pairwise orthogonal (S \<union> U)\<close>)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6969
    by (metis \<open>span (S \<union> U) = span (S \<union> B)\<close> \<open>span B = span T\<close> span_Un)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6970
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6971
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6972
corollary orthogonal_extension_strong:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6973
  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
  6974
  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
  6975
  obtains U where "U \<inter> (insert 0 S) = {}" "pairwise orthogonal (S \<union> U)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6976
                   "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
  6977
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6978
  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
  6979
    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
  6980
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6981
    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
  6982
      apply blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6983
     apply (force simp: pairwise_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6984
    apply (metis (no_types, lifting) Un_Diff_cancel span_insert_0 span_Un)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6985
  done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6986
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6987
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6988
subsection\<open>Decomposing a vector into parts in orthogonal subspaces.\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6989
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6990
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
  6991
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6992
lemma orthogonal_spanningset_subspace:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6993
  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
  6994
  assumes "subspace S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6995
  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
  6996
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  6997
  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
  6998
    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
  6999
  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
  7000
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7001
    by (metis Un_empty_left assms pairwise_empty span_inc span_subspace that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7002
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7003
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7004
lemma orthogonal_basis_subspace:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7005
  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
  7006
  assumes "subspace S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7007
  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
  7008
                  "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
  7009
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7010
  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
  7011
    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
  7012
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7013
    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
  7014
    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
  7015
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7016
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7017
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7018
proposition orthonormal_basis_subspace:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7019
  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
  7020
  assumes "subspace S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7021
  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
  7022
              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
  7023
              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
  7024
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7025
  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
  7026
             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
  7027
             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
  7028
    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
  7029
  have 1: "(\<lambda>x. x /\<^sub>R norm x) ` B \<subseteq> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7030
    using \<open>span B = S\<close> span_clauses(1) span_mul by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7031
  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
  7032
    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
  7033
  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
  7034
    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
  7035
  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
  7036
    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
  7037
  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
  7038
  proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7039
    fix x y
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7040
    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
  7041
    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
  7042
      using 3 by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7043
    ultimately show "x = y"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7044
      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
  7045
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7046
  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
  7047
    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
  7048
  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
  7049
    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
  7050
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7051
    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
  7052
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7053
66641
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7054
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7055
proposition orthogonal_to_subspace_exists_gen:
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7056
  fixes S :: "'a :: euclidean_space set"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7057
  assumes "span S \<subset> span T"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7058
  obtains x where "x \<noteq> 0" "x \<in> span T" "\<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
  7059
proof -
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7060
  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
  7061
             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
  7062
             and "independent B" "card B = dim S" "span B = span S"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7063
    by (rule orthonormal_basis_subspace [of "span S"]) auto
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7064
  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
  7065
    by auto
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7066
  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
  7067
    by (blast intro: orthogonal_extension [OF orthB])
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7068
  show thesis
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7069
  proof (cases "C \<subseteq> insert 0 B")
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7070
    case True
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7071
    then have "C \<subseteq> span B"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7072
      using Linear_Algebra.span_eq
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7073
      by (metis span_insert_0 subset_trans)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7074
    moreover have "u \<in> span (B \<union> C)"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7075
      using \<open>span (B \<union> C) = span (B \<union> {u})\<close> span_inc by force
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7076
    ultimately show ?thesis
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7077
      by (metis \<open>u \<notin> span B\<close> span_Un span_span sup.orderE)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7078
  next
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7079
    case False
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7080
    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
  7081
      by blast
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7082
    then have "x \<in> span T"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7083
      by (metis (no_types, lifting) Un_insert_right Un_upper2 \<open>u \<in> span T\<close> spanBT spanBC \<open>u \<in> span T\<close> insert_subset span_inc span_mono span_span subsetCE subset_trans sup_bot.comm_neutral)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7084
    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
  7085
      using that
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7086
    proof (rule span_induct)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7087
      show "subspace {a. orthogonal x a}"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7088
        by (simp add: subspace_orthogonal_to_vector)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7089
      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
  7090
        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
  7091
    qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7092
    ultimately show ?thesis
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7093
      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
  7094
  qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7095
qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7096
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7097
corollary orthogonal_to_subspace_exists:
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7098
  fixes S :: "'a :: euclidean_space set"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7099
  assumes "dim S < DIM('a)"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7100
  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
  7101
proof -
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7102
have "span S \<subset> UNIV"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7103
  by (metis assms dim_eq_full less_irrefl top.not_eq_extremum)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7104
  with orthogonal_to_subspace_exists_gen [of S UNIV] that show ?thesis by auto
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7105
qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7106
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7107
corollary orthogonal_to_vector_exists:
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7108
  fixes x :: "'a :: euclidean_space"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7109
  assumes "2 \<le> DIM('a)"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7110
  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
  7111
proof -
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7112
  have "dim {x} < DIM('a)"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7113
    using assms by auto
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7114
  then show thesis
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7115
    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
  7116
qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7117
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7118
proposition orthogonal_subspace_decomp_exists:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7119
  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
  7120
  obtains y z where "y \<in> span S" "\<And>w. w \<in> span S \<Longrightarrow> orthogonal z w" "x = y + z"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7121
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7122
  obtain T where "0 \<notin> T" "T \<subseteq> span S" "pairwise orthogonal T" "independent T" "card T = dim (span S)" "span T = span S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7123
    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
  7124
  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
  7125
  have orth: "orthogonal (x - ?a) w" if "w \<in> span S" for w
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7126
    by (simp add: Gram_Schmidt_step \<open>pairwise orthogonal T\<close> \<open>span T = span S\<close> orthogonal_commute that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7127
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7128
    apply (rule_tac y = "?a" and z = "x - ?a" in that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7129
      apply (meson \<open>T \<subseteq> span S\<close> span_mul span_sum subsetCE)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7130
     apply (fact orth, simp)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7131
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7132
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7133
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7134
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
  7135
  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
  7136
  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
  7137
      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
  7138
      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
  7139
  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
  7140
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7141
  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
  7142
    by (simp add: assms)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7143
  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
  7144
    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
  7145
  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
  7146
    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
  7147
  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
  7148
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7149
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7150
proposition dim_orthogonal_sum:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7151
  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
  7152
  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
  7153
    shows "dim(A \<union> B) = dim A + dim B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7154
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7155
  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
  7156
    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
  7157
  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
  7158
    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
  7159
    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
  7160
  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
  7161
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7162
  have "dim(A \<union> B) = dim (span (A \<union> B))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7163
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7164
  also have "... = dim ((\<lambda>(a, b). a + b) ` (span A \<times> 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: span_Un)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7166
  also have "... = dim {x + y |x y. x \<in> span A \<and> y \<in> span B}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7167
    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
  7168
  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
  7169
    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
  7170
  also have "... = dim (span A) + dim (span B)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7171
    by (rule dim_sums_Int) auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7172
  also have "... = dim A + dim B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7173
    by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7174
  finally show ?thesis .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7175
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7176
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7177
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
  7178
  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
  7179
  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
  7180
    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
  7181
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7182
  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
  7183
  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
  7184
    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
  7185
      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
  7186
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7187
    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
  7188
         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
  7189
    proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7190
      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
  7191
        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
  7192
      have "y \<in> span B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7193
        by (metis span_eq \<open>y \<in> span A\<close> assms subset_iff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7194
      then have "z \<in> {a \<in> B. \<forall>x. x \<in> A \<longrightarrow> orthogonal x a}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7195
        by simp (metis (no_types) span_eq \<open>x = y + z\<close> \<open>subspace A\<close> \<open>subspace B\<close> orth orthogonal_commute span_add_eq that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7196
      then have z: "z \<in> span {y \<in> B. \<forall>x\<in>A. orthogonal x y}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7197
        by (meson span_inc subset_iff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7198
      then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7199
        apply (simp add: span_Un image_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7200
        apply (rule bexI [OF _ z])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7201
        apply (simp add: \<open>x = y + z\<close> \<open>y \<in> span A\<close>)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7202
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7203
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7204
    show "span B \<subseteq> 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
  7205
      by (rule span_minimal) (auto intro: * span_minimal elim: )
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7206
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7207
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7208
    by (metis (no_types, lifting) dim_orthogonal_sum dim_span mem_Collect_eq orthogonal_commute orthogonal_def)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7209
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7210
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7211
lemma aff_dim_openin:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7212
  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
  7213
  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
  7214
  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
  7215
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7216
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7217
  proof (rule order_antisym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7218
    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
  7219
      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
  7220
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7221
    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
  7222
      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
  7223
    have "S \<subseteq> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7224
      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
  7225
    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
  7226
      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
  7227
    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
  7228
      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
  7229
    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
  7230
                    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
  7231
                    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
  7232
                    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
  7233
      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
  7234
    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
  7235
      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
  7236
    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
  7237
      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
  7238
    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
  7239
      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
  7240
    also have "... = card B"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7241
      by (simp add: cardB)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7242
    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
  7243
      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
  7244
    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
  7245
    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
  7246
      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
  7247
        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
  7248
      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
  7249
        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
  7250
      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
  7251
        using e' by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7252
      show "independent ((\<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
  7253
        using \<open>independent B\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7254
        apply (rule independent_injective_image, simp)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7255
        by (metis \<open>0 < e\<close> injective_scaleR less_irrefl)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7256
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7257
    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
  7258
      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
  7259
    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
  7260
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7261
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7262
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7263
lemma dim_openin:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7264
  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
  7265
  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
  7266
  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
  7267
proof (rule order_antisym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7268
  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
  7269
    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
  7270
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7271
  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
  7272
    using aff_dim_openin
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7273
    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
  7274
  also have "... \<le> dim S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7275
    by (metis aff_dim_subset aff_dim_subspace dim_span span_inc subspace_span)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7276
  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
  7277
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7278
66641
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7279
subsection\<open>Lower-dimensional affine subsets are nowhere dense.\<close>
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7280
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7281
proposition dense_complement_subspace:
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7282
  fixes S :: "'a :: euclidean_space set"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7283
  assumes dim_less: "dim T < dim S" and "subspace S" shows "closure(S - T) = S"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7284
proof -
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7285
  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
  7286
  proof -
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7287
    have "span U \<subset> span S"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7288
      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
  7289
    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
  7290
      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
  7291
    show ?thesis
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7292
    proof
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7293
      have "closed S"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7294
        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
  7295
      then show "closure (S - U) \<subseteq> S"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7296
        by (simp add: Diff_subset closure_minimal)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7297
      show "S \<subseteq> closure (S - U)"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7298
      proof (clarsimp simp: closure_approachable)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7299
        fix x and e::real
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7300
        assume "x \<in> S" "0 < e"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7301
        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
  7302
        proof (cases "x \<in> U")
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7303
          case True
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7304
          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
  7305
          show ?thesis
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7306
          proof
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7307
            show "dist ?y x < e"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7308
              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
  7309
          next
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7310
            have "?y \<in> S"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7311
              by (metis span_eq \<open>a \<in> span S\<close> \<open>x \<in> S\<close> \<open>subspace S\<close> subspace_add subspace_mul)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7312
            moreover have "?y \<notin> U"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7313
            proof -
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7314
              have "e/2 / norm a \<noteq> 0"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7315
                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
  7316
              then show ?thesis
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7317
                by (metis True \<open>a \<noteq> 0\<close> a orthogonal_scaleR orthogonal_self real_vector.scale_eq_0_iff span_add_eq span_clauses(1))
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7318
            qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7319
            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
  7320
          qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7321
        next
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7322
          case False
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7323
          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
  7324
        qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7325
      qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7326
    qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7327
  qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7328
  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
  7329
    by blast
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7330
  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
  7331
    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
  7332
  ultimately show ?thesis
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7333
    by force
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7334
qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7335
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7336
corollary dense_complement_affine:
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7337
  fixes S :: "'a :: euclidean_space set"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7338
  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
  7339
proof (cases "S \<inter> T = {}")
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7340
  case True
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7341
  then show ?thesis
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7342
    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
  7343
next
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7344
  case False
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7345
  then obtain z where z: "z \<in> S \<inter> T" by blast
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7346
  then have "subspace (op + (- z) ` S)"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7347
    by (meson IntD1 affine_diffs_subspace \<open>affine S\<close>)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7348
  moreover have "int (dim (op + (- z) ` T)) < int (dim (op + (- z) ` S))"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7349
    using z less by (simp add: aff_dim_eq_dim [symmetric] hull_inc)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7350
  ultimately have "closure((op + (- z) ` S) - (op + (- z) ` T)) = (op + (- z) ` S)"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7351
    by (simp add: dense_complement_subspace)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7352
  then show ?thesis
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7353
    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
  7354
qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7355
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7356
corollary dense_complement_openin_affine_hull:
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7357
  fixes S :: "'a :: euclidean_space set"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7358
  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
  7359
      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
  7360
    shows "closure(S - T) = closure S"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7361
proof -
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7362
  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
  7363
    by blast
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7364
  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
  7365
    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
  7366
  then show ?thesis
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7367
    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
  7368
qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7369
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7370
corollary dense_complement_convex:
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7371
  fixes S :: "'a :: euclidean_space set"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7372
  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
  7373
    shows "closure(S - T) = closure S"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7374
proof
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7375
  show "closure (S - T) \<subseteq> closure S"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7376
    by (simp add: Diff_subset closure_mono)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7377
  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
  7378
    apply (rule dense_complement_openin_affine_hull)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7379
    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
  7380
    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
  7381
  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
  7382
    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
  7383
qed
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7384
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7385
corollary dense_complement_convex_closed:
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7386
  fixes S :: "'a :: euclidean_space set"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7387
  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
  7388
    shows "closure(S - T) = S"
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7389
  by (simp add: assms dense_complement_convex)
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7390
ff2e0115fea4 Simplicial complexes and triangulations; Baire Category Theorem
paulson <lp15@cam.ac.uk>
parents: 66297
diff changeset
  7391
66289
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7392
subsection\<open>Parallel slices, etc.\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7393
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7394
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
  7395
  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
  7396
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7397
proposition affine_parallel_slice:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7398
  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
  7399
  assumes "affine S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7400
      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
  7401
      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
  7402
  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
  7403
                   "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
  7404
                   "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
  7405
                   "\<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
  7406
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
  7407
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7408
  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
  7409
    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
  7410
  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
  7411
  have "\<eta> \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7412
    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
  7413
  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
  7414
    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
  7415
    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
  7416
  ultimately have False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7417
    using True by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7418
  then show ?thesis ..
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7419
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7420
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7421
  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
  7422
    using assms by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7423
  with affine_diffs_subspace [OF \<open>affine S\<close>]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7424
  have sub: "subspace (op + (- z) ` S)" by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7425
  then have aff: "affine (op + (- z) ` S)" and span: "span (op + (- z) ` S) = (op + (- z) ` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7426
    by (auto simp: subspace_imp_affine)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7427
  obtain a' a'' where a': "a' \<in> span (op + (- z) ` S)" and a: "a = a' + a''"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7428
                  and "\<And>w. w \<in> span (op + (- z) ` S) \<Longrightarrow> orthogonal a'' w"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7429
      using orthogonal_subspace_decomp_exists [of "op + (- z) ` S" "a"] by metis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7430
  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
  7431
    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
  7432
  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
  7433
    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
  7434
  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
  7435
    by (simp add: inner_diff_left z)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7436
  have "\<And>w. w \<in> op + (- z) ` S \<Longrightarrow> (w + a') \<in> op + (- z) ` S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7437
    by (metis subspace_add a' span_eq sub)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7438
  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
  7439
    by fastforce
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7440
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7441
  proof (cases "a' = 0")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7442
    case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7443
    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
  7444
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7445
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7446
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7447
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7448
      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
  7449
      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
  7450
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7451
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7452
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7453
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7454
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
  7455
  assumes "a \<in> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7456
    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
  7457
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7458
  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
  7459
    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
  7460
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7461
    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
  7462
    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
  7463
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7464
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7465
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7466
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
  7467
  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
  7468
  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
  7469
    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
  7470
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7471
  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
  7472
             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
  7473
             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
  7474
    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
  7475
  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
  7476
    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
  7477
  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
  7478
  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
  7479
    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
  7480
  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
  7481
    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
  7482
  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
  7483
    apply safe
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7484
    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
  7485
    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
  7486
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7487
  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
  7488
    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
  7489
  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
  7490
    using card by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7491
  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
  7492
    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
  7493
  also have "... = dim {x - c | x. x \<in> affine hull B}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7494
     by (simp add: diffs_affine_hull_span \<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
  7495
  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
  7496
     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
  7497
   finally show ?thesis .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7498
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7499
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7500
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
  7501
  assumes "linear f"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7502
    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
  7503
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7504
  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
  7505
  proof (cases "T = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7506
    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
  7507
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7508
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7509
    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
  7510
    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
  7511
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7512
    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
  7513
      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
  7514
    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
  7515
      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
  7516
    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
  7517
      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
  7518
    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
  7519
      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
  7520
    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
  7521
      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
  7522
    finally show ?thesis .
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7523
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7524
  then
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7525
  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
  7526
    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
  7527
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7528
    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
  7529
qed
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 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
  7532
  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
  7533
    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
  7534
proof (rule antisym)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7535
  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
  7536
    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
  7537
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7538
  obtain g where "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
  7539
    using linear_injective_left_inverse assms by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7540
  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
  7541
    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
  7542
  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
  7543
    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
  7544
  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
  7545
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7546
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7547
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7548
text\<open>Choosing a subspace of a given dimension\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7549
proposition choose_subspace_of_subspace:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7550
  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
  7551
  assumes "n \<le> dim S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7552
  obtains T where "subspace T" "T \<subseteq> span S" "dim T = n"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7553
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7554
  have "\<exists>T. subspace T \<and> T \<subseteq> span S \<and> dim T = n"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7555
  using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7556
  proof (induction n)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7557
    case 0 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
  7558
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7559
    case (Suc n)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7560
    then obtain T where "subspace T" "T \<subseteq> span S" "dim T = n"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7561
      by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7562
    then show ?case
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7563
    proof (cases "span S \<subseteq> span T")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7564
      case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7565
      have "dim S = dim T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7566
        apply (rule span_eq_dim [OF subset_antisym [OF True]])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7567
        by (simp add: \<open>T \<subseteq> span S\<close> span_minimal subspace_span)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7568
      then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7569
        using Suc.prems \<open>dim T = n\<close> by linarith
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7570
    next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7571
      case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7572
      then obtain y where y: "y \<in> S" "y \<notin> T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7573
        by (meson span_mono subsetI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7574
      then have "span (insert y T) \<subseteq> span S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7575
        by (metis (no_types) \<open>T \<subseteq> span S\<close> subsetD insert_subset span_inc span_mono span_span)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7576
      with \<open>dim T = n\<close>  \<open>subspace T\<close> y show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7577
        apply (rule_tac x="span(insert y T)" in exI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7578
        apply (auto simp: dim_insert)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7579
        using span_eq by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7580
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7581
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7582
  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
  7583
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7584
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7585
lemma choose_affine_subset:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7586
  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
  7587
  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
  7588
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
  7589
  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
  7590
    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
  7591
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7592
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7593
  with assms obtain a where "a \<in> S" "0 \<le> d" by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7594
  with assms have ss: "subspace (op + (- a) ` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7595
    by (simp add: affine_diffs_subspace)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7596
  have "nat d \<le> dim (op + (- a) ` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7597
    by (metis aff_dim_subspace aff_dim_translation_eq dle nat_int nat_mono ss)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7598
  then obtain T where "subspace T" and Tsb: "T \<subseteq> span (op + (- a) ` S)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7599
                  and Tdim: "dim T = nat d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7600
    using choose_subspace_of_subspace [of "nat d" "op + (- a) ` S"] by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7601
  then have "affine T"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7602
    using subspace_affine by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7603
  then have "affine (op + a ` T)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7604
    by (metis affine_hull_eq affine_hull_translation)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7605
  moreover have "op + a ` T \<subseteq> S"
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 "T \<subseteq> op + (- a) ` S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7608
      by (metis (no_types) span_eq Tsb ss)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7609
    then show "op + a ` T \<subseteq> S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7610
      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
  7611
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7612
  moreover have "aff_dim (op + a ` T) = d"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7613
    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
  7614
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7615
    by (rule that)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7616
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7617
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7618
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
  7619
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7620
proposition paracompact:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7621
  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
  7622
  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
  7623
  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
  7624
               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
  7625
               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
  7626
                       \<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
  7627
                               finite {U. U \<in> \<C>' \<and> (U \<inter> V \<noteq> {})}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7628
proof (cases "S = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7629
  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
  7630
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7631
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7632
  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
  7633
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7634
    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
  7635
      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
  7636
    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
  7637
      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
  7638
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7639
      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
  7640
      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
  7641
      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
  7642
      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
  7643
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7644
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7645
  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
  7646
                    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
  7647
         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
  7648
    by metis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7649
  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
  7650
    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
  7651
  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
  7652
    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
  7653
  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
  7654
  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
  7655
    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
  7656
  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
  7657
    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
  7658
  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
  7659
  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
  7660
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7661
    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
  7662
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7663
      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
  7664
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7665
  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
  7666
  proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7667
    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
  7668
    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
  7669
    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
  7670
      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
  7671
    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
  7672
      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
  7673
    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
  7674
      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
  7675
    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
  7676
      by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7677
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7678
  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
  7679
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7680
    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
  7681
      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
  7682
    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
  7683
    proof clarsimp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7684
      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
  7685
      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
  7686
        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
  7687
      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
  7688
                 \<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
  7689
        by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7690
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7691
    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
  7692
      by force
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7693
    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
  7694
      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
  7695
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7696
      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
  7697
      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
  7698
      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
  7699
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7700
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7701
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7702
    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
  7703
    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
  7704
    done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7705
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7706
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7707
corollary paracompact_closedin:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7708
  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
  7709
  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
  7710
      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
  7711
      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
  7712
  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
  7713
               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
  7714
               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
  7715
                       \<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
  7716
                               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
  7717
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7718
  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
  7719
    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
  7720
  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
  7721
    by metis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7722
  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
  7723
    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
  7724
  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
  7725
    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
  7726
  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
  7727
    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
  7728
  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
  7729
             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
  7730
             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
  7731
    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
  7732
  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
  7733
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7734
  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
  7735
    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
  7736
      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
  7737
    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
  7738
      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
  7739
    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
  7740
             (\<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
  7741
      by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7742
    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
  7743
         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
  7744
      using D2 [OF that]
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7745
      apply clarify
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7746
      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
  7747
      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
  7748
      done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7749
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7750
qed
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
corollary paracompact_closed:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7753
  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
  7754
  assumes "closed S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7755
      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
  7756
      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
  7757
  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
  7758
               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
  7759
               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
  7760
                               finite {U. U \<in> \<C>' \<and> (U \<inter> V \<noteq> {})}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7761
using paracompact_closedin [of UNIV S \<C>] assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7762
by (auto simp: open_openin [symmetric] closed_closedin [symmetric])
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7763
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7764
  
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7765
subsection\<open>Closed-graph characterization of continuity\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7766
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7767
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
  7768
  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
  7769
  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
  7770
    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
  7771
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7772
  have eq: "((\<lambda>x. Pair x (f x)) ` S) = {z. z \<in> S \<times> T \<and> (f \<circ> fst)z - snd z \<in> {0}}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7773
    using fim by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7774
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7775
    apply (subst eq)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7776
    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
  7777
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7778
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7779
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7780
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
  7781
  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
  7782
  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
  7783
  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
  7784
         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
  7785
         (is "?lhs = ?rhs")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7786
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7787
  have "?lhs" if ?rhs
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7788
  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
  7789
    fix U
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7790
    assume U: "closedin (subtopology euclidean T) U"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7791
    have eq: "{x. x \<in> S \<and> f x \<in> U} = fst ` (((\<lambda>x. Pair x (f x)) ` S) \<inter> (S \<times> U))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7792
      by (force simp: image_iff)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7793
    show "closedin (subtopology euclidean S) {x \<in> S. f x \<in> U}"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7794
      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
  7795
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7796
  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
  7797
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7798
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7799
lemma continuous_closed_graph:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7800
  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
  7801
  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
  7802
  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
  7803
  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
  7804
   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
  7805
  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
  7806
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7807
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
  7808
  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
  7809
  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
  7810
  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
  7811
    using fim clo
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7812
    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
  7813
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7814
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
  7815
  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
  7816
      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
  7817
      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
  7818
    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
  7819
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
  7820
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7821
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
  7822
  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
  7823
      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
  7824
      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
  7825
      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
  7826
    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
  7827
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7828
  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
  7829
    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
  7830
  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
  7831
    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
  7832
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7833
    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
  7834
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7835
  
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7836
subsection\<open>The union of two collinear segments is another segment\<close>
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7837
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7838
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
  7839
  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
  7840
  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
  7841
  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
  7842
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
  7843
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7844
  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
  7845
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7846
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7847
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7848
  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
  7849
    case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7850
    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
  7851
                    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
  7852
        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
  7853
    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
  7854
               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
  7855
      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
  7856
    show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7857
    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
  7858
      case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7859
      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
  7860
        by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7861
      show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7862
      proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7863
        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
  7864
          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
  7865
        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
  7866
          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
  7867
        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
  7868
          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
  7869
                (\<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
  7870
            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
  7871
            using fin by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7872
          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
  7873
            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
  7874
          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
  7875
            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
  7876
          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
  7877
            by (simp add: v1)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7878
          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
  7879
            by (auto simp: v0)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7880
          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
  7881
                (\<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
  7882
            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
  7883
            using fin by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7884
          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
  7885
            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
  7886
          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
  7887
            by (metis (no_types, lifting) b(2) diff_zero fin finite.emptyI finite_Diff2 finite_insert real_vector.scale_eq_0_iff sum_diff1)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7888
          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
  7889
            by (simp add: vx)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7890
        qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7891
      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
  7892
    next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7893
      case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7894
      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
  7895
        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
  7896
      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
  7897
        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
  7898
      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
  7899
        by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7900
      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
  7901
        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
  7902
        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
  7903
      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
  7904
        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
  7905
      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
  7906
        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
  7907
      show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7908
      proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7909
        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
  7910
          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
  7911
        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
  7912
          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
  7913
                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
  7914
            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
  7915
            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
  7916
            done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7917
          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
  7918
            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
  7919
          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
  7920
            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
  7921
          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
  7922
            by (simp add: v1)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7923
          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
  7924
            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
  7925
            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
  7926
            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
  7927
          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
  7928
                (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
  7929
            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
  7930
            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
  7931
            done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7932
          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)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7933
            by (simp add: Groups_Big.sum_subtractf scaleR_left_diff_distrib sum_distrib_left real_vector.scale_sum_right)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7934
          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
  7935
            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
  7936
          finally
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7937
          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
  7938
            by (simp add: vx)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7939
        qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7940
      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
  7941
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7942
  next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7943
    case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7944
    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
  7945
      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
  7946
    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
  7947
      by (metis antisym subsetI)
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
    proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7950
      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
  7951
        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
  7952
    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
  7953
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7954
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7955
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7956
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
  7957
  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
  7958
  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
  7959
  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
  7960
proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7961
  show "?lhs \<subseteq> ?rhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7962
    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
  7963
  show "?rhs \<subseteq> ?lhs"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7964
  proof clarify
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7965
    fix x b
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7966
    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
  7967
    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
  7968
      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
  7969
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7970
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7971
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7972
lemma Un_closed_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7973
  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
  7974
  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
  7975
    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
  7976
proof (cases "c = a")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7977
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7978
  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
  7979
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7980
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7981
  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
  7982
    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
  7983
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7984
    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
  7985
    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
  7986
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7987
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7988
lemma Un_open_segment:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7989
  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
  7990
  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
  7991
  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
  7992
proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7993
  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
  7994
    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
  7995
  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
  7996
          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
  7997
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  7998
    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
  7999
      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
  8000
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8001
      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
  8002
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8003
  show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8004
    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
  8005
    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
  8006
      apply (rule equalityI)
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8007
    using assms
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8008
     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
  8009
      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
  8010
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8011
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8012
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
  8013
  
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8014
proposition open_Union_compact_subsets:
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8015
  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
  8016
  assumes "open S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8017
  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
  8018
                  "\<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
  8019
                  "\<Union>(range C) = S"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8020
                  "\<And>K. \<lbrakk>compact K; K \<subseteq> S\<rbrakk> \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. K \<subseteq> (C n)"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8021
proof (cases "S = {}")
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8022
  case True
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8023
  then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8024
    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
  8025
next
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8026
  case False
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8027
  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
  8028
    by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8029
  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
  8030
  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
  8031
        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
  8032
            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
  8033
  proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8034
    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
  8035
      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
  8036
    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
  8037
      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
  8038
    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
  8039
    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
  8040
      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
  8041
        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
  8042
    qed auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8043
    { fix n
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8044
      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
  8045
      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
  8046
        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
  8047
      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
  8048
        using I by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8049
    }
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8050
    then show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8051
      by blast
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
  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
  8054
                     ((\<Union>(range f) = S))"
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8055
  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
  8056
    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
  8057
      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
  8058
    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
  8059
      by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8060
    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
  8061
    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
  8062
      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
  8063
        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
  8064
      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
  8065
        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
  8066
      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
  8067
            \<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
  8068
        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
  8069
      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
  8070
        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
  8071
        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
  8072
        done
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8073
      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
  8074
                    \<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
  8075
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8076
    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
  8077
    proof
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8078
      fix x
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8079
      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
  8080
      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
  8081
        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
  8082
      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
  8083
        using reals_Archimedean2
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8084
        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
  8085
      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
  8086
        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
  8087
      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
  8088
        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
  8089
      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
  8090
      proof -
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8091
        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
  8092
          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
  8093
        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
  8094
          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
  8095
          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
  8096
        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
  8097
          using that by simp
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8098
        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
  8099
          using e by blast
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8100
        with that show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8101
          by auto
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8102
      qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8103
      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
  8104
        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
  8105
    qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8106
    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
  8107
  qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8108
  ultimately show ?thesis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8109
    using that by metis
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8110
qed
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8111
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8112
end
2562f151541c Divided Convex_Euclidean_Space.thy in half, creating new theory Starlike
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  8113